@neo-edi/sdk 1.0.9 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -89,6 +89,23 @@ const updated = await client.customers.update('ACME-001', {
89
89
  await client.customers.delete('ACME-001');
90
90
  ```
91
91
 
92
+ ## Sub-Customers (Customer Hierarchy)
93
+
94
+ ```typescript
95
+ // Add sub-customer to parent
96
+ const result = await client.subCustomers.add('PARENT-001', 'CHILD-001');
97
+ // Returns: { hierarchyId, parentCustomerId, childCustomerId, created, activated }
98
+
99
+ // List sub-customers
100
+ const subs = await client.subCustomers.list('PARENT-001');
101
+
102
+ // Include inactive relationships
103
+ const allSubs = await client.subCustomers.list('PARENT-001', { includeInactive: true });
104
+
105
+ // Remove sub-customer
106
+ await client.subCustomers.remove('PARENT-001', 'CHILD-001');
107
+ ```
108
+
92
109
  ## Partner-Customer Relationships
93
110
 
94
111
  ```typescript
@@ -98,6 +115,14 @@ const result = await client.partnerCustomers.register({
98
115
  tradingPartnerIds: ['PARTNER-001', 'PARTNER-002'],
99
116
  isActive: true
100
117
  });
118
+
119
+ // Get partner subscriptions for a customer
120
+ const subs = await client.partnerCustomers.getSubscriptions('ACME-001');
121
+
122
+ // Include inactive subscriptions
123
+ const allSubs = await client.partnerCustomers.getSubscriptions('ACME-001', {
124
+ includeInactive: true
125
+ });
101
126
  ```
102
127
 
103
128
  ## Mapping Templates
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { ListCustomersParams, EdiCustomer, CreateCustomerRequest, UpdateCustomerRequest, EdiPartner, RegisterPartnerCustomerRequest, PartnerCustomerRegistrationResult, ListMappingTemplatesParams, EdiMappingTemplate, CreateMappingTemplateRequest, UpdateMappingTemplateRequest, CsvHeaderMappingCollection, CsvDataTransformationConfig, IngestCsvResult, DryRunResult } from '@neo-edi/types';
2
- export { Address, ApiResponse, CreateCustomerRequest, CreateMappingTemplateRequest, CreatePartnerRequest, CsvDataTransformationConfig, CsvHeaderMappingCollection, CsvHeaderMappingConfig, CsvHeaderTableEntry, DryRunResult, Edi852DeliverySummary, Edi852Header, Edi852HeaderFilter, Edi852Item, Edi852Location, Edi852Status, EdiCustomer, EdiMappingTemplate, EdiPartner, EdiPartnerCustomer, IngestCsvResult, ListCustomersParams, ListMappingTemplatesParams, PaginatedResponse, PartnerCustomerRegistrationResult, RegisterPartnerCustomerRequest, UpdateCustomerRequest, UpdateMappingTemplateRequest, UpdatePartnerRequest } from '@neo-edi/types';
1
+ import { ListCustomersParams, EdiCustomer, CreateCustomerRequest, UpdateCustomerRequest, ListSubCustomersParams, SubCustomer, AddSubCustomerResponse, EdiPartner, RegisterPartnerCustomerRequest, PartnerCustomerRegistrationResult, GetSubscriptionsParams, CustomerSubscriptionsResponse, ListMappingTemplatesParams, EdiMappingTemplate, CreateMappingTemplateRequest, UpdateMappingTemplateRequest, CsvHeaderMappingCollection, CsvDataTransformationConfig, IngestCsvResult, DryRunResult } from '@neo-edi/types';
2
+ export { AddSubCustomerRequest, AddSubCustomerResponse, Address, ApiResponse, CreateCustomerRequest, CreateMappingTemplateRequest, CreatePartnerRequest, CsvDataTransformationConfig, CsvHeaderMappingCollection, CsvHeaderMappingConfig, CsvHeaderTableEntry, DryRunResult, Edi852DeliverySummary, Edi852Header, Edi852HeaderFilter, Edi852Item, Edi852Location, Edi852Status, EdiCustomer, EdiMappingTemplate, EdiPartner, EdiPartnerCustomer, IngestCsvResult, ListCustomersParams, ListMappingTemplatesParams, ListSubCustomersParams, PaginatedResponse, PartnerCustomerRegistrationResult, RegisterPartnerCustomerRequest, SubCustomer, SubCustomersResponse, UpdateCustomerRequest, UpdateMappingTemplateRequest, UpdatePartnerRequest } from '@neo-edi/types';
3
3
 
4
4
  /**
5
5
  * Base HTTP client for the SDK
@@ -30,7 +30,7 @@ declare class HttpClient {
30
30
  post<T>(path: string, body?: unknown): Promise<T>;
31
31
  patch<T>(path: string, body?: unknown): Promise<T>;
32
32
  put<T>(path: string, body?: unknown): Promise<T>;
33
- delete<T>(path: string): Promise<T>;
33
+ delete<T>(path: string, query?: Record<string, string | number | boolean | undefined>): Promise<T>;
34
34
  }
35
35
 
36
36
  /**
@@ -62,6 +62,27 @@ declare class CustomersResource {
62
62
  delete(customerId: string): Promise<void>;
63
63
  }
64
64
 
65
+ /**
66
+ * Sub-customers (customer hierarchy) resource
67
+ */
68
+
69
+ declare class SubCustomersResource {
70
+ private http;
71
+ constructor(http: HttpClient);
72
+ /**
73
+ * List sub-customers of a parent customer
74
+ */
75
+ list(parentCustomerId: string, params?: ListSubCustomersParams): Promise<SubCustomer[]>;
76
+ /**
77
+ * Add a sub-customer to a parent customer
78
+ */
79
+ add(parentCustomerId: string, childCustomerId: string): Promise<AddSubCustomerResponse>;
80
+ /**
81
+ * Remove a sub-customer from a parent customer
82
+ */
83
+ remove(parentCustomerId: string, childCustomerId: string): Promise<void>;
84
+ }
85
+
65
86
  /**
66
87
  * Partners resource - Manage trading partners
67
88
  * @module PartnersResource
@@ -203,6 +224,10 @@ declare class PartnerCustomersResource {
203
224
  * Creates or activates relationships between a customer and multiple trading partners
204
225
  */
205
226
  register(data: RegisterPartnerCustomerRequest): Promise<PartnerCustomerRegistrationResult>;
227
+ /**
228
+ * Get partner subscriptions for a customer
229
+ */
230
+ getSubscriptions(customerId: string, params?: GetSubscriptionsParams): Promise<CustomerSubscriptionsResponse>;
206
231
  }
207
232
 
208
233
  /**
@@ -375,6 +400,10 @@ declare class NeoEdiClient {
375
400
  * Customer management operations
376
401
  */
377
402
  readonly customers: CustomersResource;
403
+ /**
404
+ * Sub-customer (hierarchy) operations
405
+ */
406
+ readonly subCustomers: SubCustomersResource;
378
407
  /**
379
408
  * Partner management operations
380
409
  */
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ListCustomersParams, EdiCustomer, CreateCustomerRequest, UpdateCustomerRequest, EdiPartner, RegisterPartnerCustomerRequest, PartnerCustomerRegistrationResult, ListMappingTemplatesParams, EdiMappingTemplate, CreateMappingTemplateRequest, UpdateMappingTemplateRequest, CsvHeaderMappingCollection, CsvDataTransformationConfig, IngestCsvResult, DryRunResult } from '@neo-edi/types';
2
- export { Address, ApiResponse, CreateCustomerRequest, CreateMappingTemplateRequest, CreatePartnerRequest, CsvDataTransformationConfig, CsvHeaderMappingCollection, CsvHeaderMappingConfig, CsvHeaderTableEntry, DryRunResult, Edi852DeliverySummary, Edi852Header, Edi852HeaderFilter, Edi852Item, Edi852Location, Edi852Status, EdiCustomer, EdiMappingTemplate, EdiPartner, EdiPartnerCustomer, IngestCsvResult, ListCustomersParams, ListMappingTemplatesParams, PaginatedResponse, PartnerCustomerRegistrationResult, RegisterPartnerCustomerRequest, UpdateCustomerRequest, UpdateMappingTemplateRequest, UpdatePartnerRequest } from '@neo-edi/types';
1
+ import { ListCustomersParams, EdiCustomer, CreateCustomerRequest, UpdateCustomerRequest, ListSubCustomersParams, SubCustomer, AddSubCustomerResponse, EdiPartner, RegisterPartnerCustomerRequest, PartnerCustomerRegistrationResult, GetSubscriptionsParams, CustomerSubscriptionsResponse, ListMappingTemplatesParams, EdiMappingTemplate, CreateMappingTemplateRequest, UpdateMappingTemplateRequest, CsvHeaderMappingCollection, CsvDataTransformationConfig, IngestCsvResult, DryRunResult } from '@neo-edi/types';
2
+ export { AddSubCustomerRequest, AddSubCustomerResponse, Address, ApiResponse, CreateCustomerRequest, CreateMappingTemplateRequest, CreatePartnerRequest, CsvDataTransformationConfig, CsvHeaderMappingCollection, CsvHeaderMappingConfig, CsvHeaderTableEntry, DryRunResult, Edi852DeliverySummary, Edi852Header, Edi852HeaderFilter, Edi852Item, Edi852Location, Edi852Status, EdiCustomer, EdiMappingTemplate, EdiPartner, EdiPartnerCustomer, IngestCsvResult, ListCustomersParams, ListMappingTemplatesParams, ListSubCustomersParams, PaginatedResponse, PartnerCustomerRegistrationResult, RegisterPartnerCustomerRequest, SubCustomer, SubCustomersResponse, UpdateCustomerRequest, UpdateMappingTemplateRequest, UpdatePartnerRequest } from '@neo-edi/types';
3
3
 
4
4
  /**
5
5
  * Base HTTP client for the SDK
@@ -30,7 +30,7 @@ declare class HttpClient {
30
30
  post<T>(path: string, body?: unknown): Promise<T>;
31
31
  patch<T>(path: string, body?: unknown): Promise<T>;
32
32
  put<T>(path: string, body?: unknown): Promise<T>;
33
- delete<T>(path: string): Promise<T>;
33
+ delete<T>(path: string, query?: Record<string, string | number | boolean | undefined>): Promise<T>;
34
34
  }
35
35
 
36
36
  /**
@@ -62,6 +62,27 @@ declare class CustomersResource {
62
62
  delete(customerId: string): Promise<void>;
63
63
  }
64
64
 
65
+ /**
66
+ * Sub-customers (customer hierarchy) resource
67
+ */
68
+
69
+ declare class SubCustomersResource {
70
+ private http;
71
+ constructor(http: HttpClient);
72
+ /**
73
+ * List sub-customers of a parent customer
74
+ */
75
+ list(parentCustomerId: string, params?: ListSubCustomersParams): Promise<SubCustomer[]>;
76
+ /**
77
+ * Add a sub-customer to a parent customer
78
+ */
79
+ add(parentCustomerId: string, childCustomerId: string): Promise<AddSubCustomerResponse>;
80
+ /**
81
+ * Remove a sub-customer from a parent customer
82
+ */
83
+ remove(parentCustomerId: string, childCustomerId: string): Promise<void>;
84
+ }
85
+
65
86
  /**
66
87
  * Partners resource - Manage trading partners
67
88
  * @module PartnersResource
@@ -203,6 +224,10 @@ declare class PartnerCustomersResource {
203
224
  * Creates or activates relationships between a customer and multiple trading partners
204
225
  */
205
226
  register(data: RegisterPartnerCustomerRequest): Promise<PartnerCustomerRegistrationResult>;
227
+ /**
228
+ * Get partner subscriptions for a customer
229
+ */
230
+ getSubscriptions(customerId: string, params?: GetSubscriptionsParams): Promise<CustomerSubscriptionsResponse>;
206
231
  }
207
232
 
208
233
  /**
@@ -375,6 +400,10 @@ declare class NeoEdiClient {
375
400
  * Customer management operations
376
401
  */
377
402
  readonly customers: CustomersResource;
403
+ /**
404
+ * Sub-customer (hierarchy) operations
405
+ */
406
+ readonly subCustomers: SubCustomersResource;
378
407
  /**
379
408
  * Partner management operations
380
409
  */
package/dist/index.js CHANGED
@@ -63,7 +63,7 @@ var NeoEdiValidationError = class extends NeoEdiError {
63
63
  // package.json
64
64
  var package_default = {
65
65
  name: "@neo-edi/sdk",
66
- version: "1.0.9",
66
+ version: "1.0.11",
67
67
  description: "TypeScript SDK for the Neo-EDI platform",
68
68
  main: "./dist/index.js",
69
69
  module: "./dist/index.mjs",
@@ -197,8 +197,8 @@ var HttpClient = class {
197
197
  put(path, body) {
198
198
  return this.request({ method: "PUT", path, body });
199
199
  }
200
- delete(path) {
201
- return this.request({ method: "DELETE", path });
200
+ delete(path, query) {
201
+ return this.request({ method: "DELETE", path, query });
202
202
  }
203
203
  };
204
204
 
@@ -268,6 +268,51 @@ var CustomersResource = class {
268
268
  }
269
269
  };
270
270
 
271
+ // src/resources/sub-customers.ts
272
+ var SubCustomersResource = class {
273
+ constructor(http) {
274
+ this.http = http;
275
+ }
276
+ /**
277
+ * List sub-customers of a parent customer
278
+ */
279
+ async list(parentCustomerId, params) {
280
+ const response = await this.http.get(
281
+ `/api/v1/customers/${encodeURIComponent(parentCustomerId)}/sub-customers`,
282
+ params
283
+ );
284
+ if (!response.success) {
285
+ throw new Error(response.error);
286
+ }
287
+ return response.data.subCustomers;
288
+ }
289
+ /**
290
+ * Add a sub-customer to a parent customer
291
+ */
292
+ async add(parentCustomerId, childCustomerId) {
293
+ const response = await this.http.post(
294
+ `/api/v1/customers/${encodeURIComponent(parentCustomerId)}/sub-customers`,
295
+ { childCustomerId }
296
+ );
297
+ if (!response.success) {
298
+ throw new Error(response.error);
299
+ }
300
+ return response.data;
301
+ }
302
+ /**
303
+ * Remove a sub-customer from a parent customer
304
+ */
305
+ async remove(parentCustomerId, childCustomerId) {
306
+ const response = await this.http.delete(
307
+ `/api/v1/customers/${encodeURIComponent(parentCustomerId)}/sub-customers`,
308
+ { childCustomerId }
309
+ );
310
+ if (!response.success) {
311
+ throw new Error(response.error);
312
+ }
313
+ }
314
+ };
315
+
271
316
  // src/resources/partners.ts
272
317
  var PartnersResource = class {
273
318
  constructor(http) {
@@ -372,6 +417,19 @@ var PartnerCustomersResource = class {
372
417
  }
373
418
  return response.data;
374
419
  }
420
+ /**
421
+ * Get partner subscriptions for a customer
422
+ */
423
+ async getSubscriptions(customerId, params) {
424
+ const response = await this.http.get(
425
+ `/api/customers/${encodeURIComponent(customerId)}/subscriptions`,
426
+ params
427
+ );
428
+ if (!response.success) {
429
+ throw new Error(response.error);
430
+ }
431
+ return response.data;
432
+ }
375
433
  };
376
434
 
377
435
  // src/resources/mapping-templates.ts
@@ -619,6 +677,7 @@ var NeoEdiClient = class {
619
677
  headers: config.headers
620
678
  });
621
679
  this.customers = new CustomersResource(this.http);
680
+ this.subCustomers = new SubCustomersResource(this.http);
622
681
  this.partners = new PartnersResource(this.http);
623
682
  this.partnerCustomers = new PartnerCustomersResource(this.http);
624
683
  this.mappingTemplates = new MappingTemplatesResource(this.http);
package/dist/index.mjs CHANGED
@@ -32,7 +32,7 @@ var NeoEdiValidationError = class extends NeoEdiError {
32
32
  // package.json
33
33
  var package_default = {
34
34
  name: "@neo-edi/sdk",
35
- version: "1.0.9",
35
+ version: "1.0.11",
36
36
  description: "TypeScript SDK for the Neo-EDI platform",
37
37
  main: "./dist/index.js",
38
38
  module: "./dist/index.mjs",
@@ -166,8 +166,8 @@ var HttpClient = class {
166
166
  put(path, body) {
167
167
  return this.request({ method: "PUT", path, body });
168
168
  }
169
- delete(path) {
170
- return this.request({ method: "DELETE", path });
169
+ delete(path, query) {
170
+ return this.request({ method: "DELETE", path, query });
171
171
  }
172
172
  };
173
173
 
@@ -237,6 +237,51 @@ var CustomersResource = class {
237
237
  }
238
238
  };
239
239
 
240
+ // src/resources/sub-customers.ts
241
+ var SubCustomersResource = class {
242
+ constructor(http) {
243
+ this.http = http;
244
+ }
245
+ /**
246
+ * List sub-customers of a parent customer
247
+ */
248
+ async list(parentCustomerId, params) {
249
+ const response = await this.http.get(
250
+ `/api/v1/customers/${encodeURIComponent(parentCustomerId)}/sub-customers`,
251
+ params
252
+ );
253
+ if (!response.success) {
254
+ throw new Error(response.error);
255
+ }
256
+ return response.data.subCustomers;
257
+ }
258
+ /**
259
+ * Add a sub-customer to a parent customer
260
+ */
261
+ async add(parentCustomerId, childCustomerId) {
262
+ const response = await this.http.post(
263
+ `/api/v1/customers/${encodeURIComponent(parentCustomerId)}/sub-customers`,
264
+ { childCustomerId }
265
+ );
266
+ if (!response.success) {
267
+ throw new Error(response.error);
268
+ }
269
+ return response.data;
270
+ }
271
+ /**
272
+ * Remove a sub-customer from a parent customer
273
+ */
274
+ async remove(parentCustomerId, childCustomerId) {
275
+ const response = await this.http.delete(
276
+ `/api/v1/customers/${encodeURIComponent(parentCustomerId)}/sub-customers`,
277
+ { childCustomerId }
278
+ );
279
+ if (!response.success) {
280
+ throw new Error(response.error);
281
+ }
282
+ }
283
+ };
284
+
240
285
  // src/resources/partners.ts
241
286
  var PartnersResource = class {
242
287
  constructor(http) {
@@ -341,6 +386,19 @@ var PartnerCustomersResource = class {
341
386
  }
342
387
  return response.data;
343
388
  }
389
+ /**
390
+ * Get partner subscriptions for a customer
391
+ */
392
+ async getSubscriptions(customerId, params) {
393
+ const response = await this.http.get(
394
+ `/api/customers/${encodeURIComponent(customerId)}/subscriptions`,
395
+ params
396
+ );
397
+ if (!response.success) {
398
+ throw new Error(response.error);
399
+ }
400
+ return response.data;
401
+ }
344
402
  };
345
403
 
346
404
  // src/resources/mapping-templates.ts
@@ -588,6 +646,7 @@ var NeoEdiClient = class {
588
646
  headers: config.headers
589
647
  });
590
648
  this.customers = new CustomersResource(this.http);
649
+ this.subCustomers = new SubCustomersResource(this.http);
591
650
  this.partners = new PartnersResource(this.http);
592
651
  this.partnerCustomers = new PartnerCustomersResource(this.http);
593
652
  this.mappingTemplates = new MappingTemplatesResource(this.http);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo-edi/sdk",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "TypeScript SDK for the Neo-EDI platform",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -16,7 +16,7 @@
16
16
  "dist"
17
17
  ],
18
18
  "dependencies": {
19
- "@neo-edi/types": "1.0.9"
19
+ "@neo-edi/types": "1.0.11"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/node": "^20",
@@ -24,7 +24,7 @@
24
24
  "typescript": "^5.0.0"
25
25
  },
26
26
  "peerDependencies": {
27
- "@neo-edi/types": "1.0.9"
27
+ "@neo-edi/types": "1.0.11"
28
28
  },
29
29
  "scripts": {
30
30
  "build": "tsup src/index.ts --format cjs,esm --dts",