UNPKG

@simpleapps-com/augur-api

Version:

TypeScript client library for Augur microservices API endpoints

97 lines 5.8 kB
import { BaseServiceClient } from '../../core/base-client'; import { ImportSchema } from './schemas'; import { createHealthCheckResource, createHealthCheckDataResource, createImpOeLineResource, createImpOeLineDataResource, createImportResource, createImportDataResource, createScheduledImportMasterResource, createScheduledImportMasterDataResource, } from './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 * ``` */ export class P21SismClient extends 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, }; /** * 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 = createHealthCheckResource(boundExecuteRequest); this.impOeLine = createImpOeLineResource(boundExecuteRequest, boundCreateListMethod); this.import = createImportResource(boundExecuteRequest, boundCreateListMethod); this.scheduledImportMaster = createScheduledImportMasterResource(boundExecuteRequest); // Initialize data-only API resources (dual API pattern) this.healthCheckData = createHealthCheckDataResource(this.healthCheck); this.impOeLineData = createImpOeLineDataResource(this.impOeLine); this.importData = createImportDataResource(this.import); this.scheduledImportMasterData = createScheduledImportMasterDataResource(this.scheduledImportMaster); } } //# sourceMappingURL=client.js.map