@simpleapps-com/augur-api
Version:
TypeScript client library for Augur microservices API endpoints
101 lines • 5.89 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.P21SismClient = void 0;
const base_client_1 = require("../../core/base-client");
const schemas_1 = require("./schemas");
const resources_1 = require("./resources");
/**
* P21 SISM (System Integration & Storage Management) API Client
* @description Client for interacting with P21 SISM API endpoints for system integration, data import management, order entry processing, and scheduled import operations within the Prophet 21 ERP ecosystem
* @fullPath api.p21Sism
* @service p21-sism
* @domain system-integration-and-storage-management
* @discoverable true
* @searchTerms ["p21-sism", "system integration", "storage management", "data import", "order entry", "scheduled imports", "ERP integration", "import processing", "data synchronization", "batch processing"]
* @relatedEndpoints ["api.p21Core.company", "api.p21Core.location", "api.orders.orders", "api.items.products", "api.nexus.receiving"]
* @commonPatterns ["Import data management", "Order entry processing", "Scheduled data synchronization", "System integration workflows", "Batch import operations"]
* @workflow ["data-import", "system-integration", "order-entry-processing", "scheduled-synchronization", "batch-operations"]
* @prerequisites ["Valid P21 system access", "ERP authentication", "Import processing permissions", "Company-specific data access"]
* @nextSteps ["api.orders.orders for order processing", "api.items.products for inventory integration", "api.p21Core for system configuration"]
* @businessRules ["Import state transitions: initial → hold → delivered", "Import UID required for all operations", "SFTP metadata for scheduled imports", "Order entry header data validation"]
* @functionalArea "system-integration-and-storage-management"
* @caching "Cache import lists for 5 minutes, real-time for import status updates, no caching for order entry operations"
* @performance "Supports pagination for import lists, batch processing for large imports, optimized for ERP transaction volumes"
* @example
* ```typescript
* import { HTTPClient } from '@augur/api-client/core';
* import { P21SismClient } from '@augur/api-client/services/p21-sism';
*
* const client = new P21SismClient(new HTTPClient({ baseURL: 'https://p21-sism.augur-api.com' }));
*
* // List recent imports for monitoring
* const recentImports = await client.import.recent.list({ hours: 24, limit: 50 });
* console.log(recentImports.data); // Import[]
*
* // Get import details for processing
* const importDetails = await client.import.get('12345');
* console.log(importDetails.data); // Import
*
* // Process order entry header data
* const orderHeader = await client.import.impOeHdr.get('12345');
* console.log(orderHeader.data); // Order entry header data
*
* // Create SFTP metadata for scheduled imports
* const sftpResult = await client.scheduledImportMaster.metadata.sftp.create('master123');
* console.log(sftpResult.data); // SFTP metadata result
* ```
*/
class P21SismClient extends base_client_1.BaseServiceClient {
// Ensure schemas are referenced to avoid unused import warnings
get schemaRefs() {
return this._schemaRefs;
}
/**
* Create a new P21SismClient instance
* @param http Configured HTTPClient instance with authentication
* @param baseUrl Base URL for the P21 SISM API (default: https://p21-sism.augur-api.com)
*/
constructor(http, baseUrl = 'https://p21-sism.augur-api.com') {
super('p21-sism', http, baseUrl);
// Schema references for 100% coverage - ensuring all exports are imported
this._schemaRefs = {
ImportSchema: schemas_1.ImportSchema,
};
/**
* Deprecated: Use healthCheckData.get instead
* @deprecated
*/
this.healthData = {
check: async () => {
const response = await this.healthCheck.get();
return response.data;
},
};
// Reference schemas to ensure 100% import coverage
void this.schemaRefs;
// Create a wrapper function that calls executeRequest dynamically
// This allows tests to spy on executeRequest after construction
// Pass params when defined OR when there's a paramsSchema (for validation)
const boundExecuteRequest = (config, params, pathParams) => {
// Pass params if defined or if there's a paramsSchema (expects params)
if (params !== undefined || config.paramsSchema !== undefined) {
return this.executeRequest(config, params, pathParams);
}
return this.executeRequest(config, undefined, pathParams);
};
// Bind createListMethod to preserve 'this' context
const boundCreateListMethod = this.createListMethod.bind(this);
// Initialize standard API resources
this.healthCheck = (0, resources_1.createHealthCheckResource)(boundExecuteRequest);
this.impOeLine = (0, resources_1.createImpOeLineResource)(boundExecuteRequest, boundCreateListMethod);
this.import = (0, resources_1.createImportResource)(boundExecuteRequest, boundCreateListMethod);
this.scheduledImportMaster = (0, resources_1.createScheduledImportMasterResource)(boundExecuteRequest);
// Initialize data-only API resources (dual API pattern)
this.healthCheckData = (0, resources_1.createHealthCheckDataResource)(this.healthCheck);
this.impOeLineData = (0, resources_1.createImpOeLineDataResource)(this.impOeLine);
this.importData = (0, resources_1.createImportDataResource)(this.import);
this.scheduledImportMasterData = (0, resources_1.createScheduledImportMasterDataResource)(this.scheduledImportMaster);
}
}
exports.P21SismClient = P21SismClient;
//# sourceMappingURL=client.js.map