@neo-edi/sdk 1.0.19 → 1.0.20

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/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { ListCustomersParams, EdiCustomer, CustomerIdentifierType, CreateCustomerRequest, UpdateCustomerRequest, ListSubCustomersParams, SubCustomerWithIdentifiers, SubCustomer, AddSubCustomerResponse, CreateSubCustomerRequest, CreateSubCustomerResponse, EdiPartner, RegisterPartnerCustomerRequest, PartnerCustomerRegistrationResult, GetSubscriptionsParams, CustomerSubscriptionsResponse, IdentifierPattern, 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';
1
+ import { ListCustomersParams, EdiCustomer, CustomerIdentifierType, CreateCustomerRequest, UpdateCustomerRequest, ListSubCustomersParams, SubCustomerWithIdentifiers, SubCustomer, AddSubCustomerResponse, CreateSubCustomerRequest, CreateSubCustomerResponse, EdiPartner, RegisterPartnerCustomerRequest, PartnerCustomerRegistrationResult, GetSubscriptionsParams, CustomerSubscriptionsResponse, IdentifierPattern, ListMappingTemplatesParams, EdiMappingTemplate, CreateMappingTemplateRequest, UpdateMappingTemplateRequest, CsvHeaderMappingCollection, CsvDataTransformationConfig, IngestCsvResult, DryRunResult, WebhookEndpoint, CreateWebhookRequest, WebhookEndpointWithSecret, UpdateWebhookRequest, ListWebhookDeliveriesParams, WebhookDelivery } from '@neo-edi/types';
2
+ export { AddSubCustomerRequest, AddSubCustomerResponse, Address, ApiResponse, CreateCustomerRequest, CreateMappingTemplateRequest, CreatePartnerRequest, CreateWebhookRequest, CsvDataTransformationConfig, CsvHeaderMappingCollection, CsvHeaderMappingConfig, CsvHeaderTableEntry, DryRunResult, Edi852DeliverySummary, Edi852Header, Edi852HeaderFilter, Edi852Item, Edi852Location, Edi852Status, EdiCustomer, EdiMappingTemplate, EdiPartner, EdiPartnerCustomer, IngestCsvResult, ListCustomersParams, ListMappingTemplatesParams, ListSubCustomersParams, ListWebhookDeliveriesParams, PaginatedResponse, PartnerCustomerRegistrationResult, RegisterPartnerCustomerRequest, SubCustomer, SubCustomersResponse, UpdateCustomerRequest, UpdateMappingTemplateRequest, UpdatePartnerRequest, UpdateWebhookRequest, WebhookDelivery, WebhookDeliveryStatus, WebhookEndpoint, WebhookEndpointWithSecret, WebhookEventType } from '@neo-edi/types';
3
3
 
4
4
  /**
5
5
  * Base HTTP client for the SDK
@@ -440,6 +440,49 @@ declare const Queries: {
440
440
  GET_EXECUTION_SUMMARIES: string;
441
441
  };
442
442
 
443
+ /**
444
+ * Webhooks resource
445
+ *
446
+ * Register endpoints that receive HMAC-signed HTTP callbacks when events occur
447
+ * for a trading partner — e.g. `document.ingested` when a delivery is ingested.
448
+ *
449
+ * Verifying incoming webhooks (on your receiver):
450
+ * const expected = "sha256=" + hmacSHA256(`${timestamp}.${rawBody}`, signingSecret)
451
+ * compare against the `v1=` value in the `X-Webhook-Signature` header, where
452
+ * `timestamp` is the `X-Webhook-Timestamp` header (and the `t=` value).
453
+ */
454
+
455
+ declare class WebhooksResource {
456
+ private http;
457
+ constructor(http: HttpClient);
458
+ /**
459
+ * List webhook endpoints for a trading partner.
460
+ */
461
+ list(partnerId: string): Promise<WebhookEndpoint[]>;
462
+ /**
463
+ * Get a single webhook endpoint by id.
464
+ */
465
+ get(endpointId: string): Promise<WebhookEndpoint>;
466
+ /**
467
+ * Create (subscribe) a webhook endpoint. The returned object includes the
468
+ * `signingSecret` — store it now, it is never returned again.
469
+ */
470
+ create(data: CreateWebhookRequest): Promise<WebhookEndpointWithSecret>;
471
+ /**
472
+ * Update a webhook endpoint (url, description, subscribed events, or enable/
473
+ * disable via `isActive`).
474
+ */
475
+ update(endpointId: string, data: UpdateWebhookRequest): Promise<WebhookEndpoint>;
476
+ /**
477
+ * Delete (unsubscribe) a webhook endpoint.
478
+ */
479
+ delete(endpointId: string): Promise<void>;
480
+ /**
481
+ * List recent delivery attempts for an endpoint (audit / debugging).
482
+ */
483
+ listDeliveries(endpointId: string, params?: ListWebhookDeliveriesParams): Promise<WebhookDelivery[]>;
484
+ }
485
+
443
486
  /**
444
487
  * Neo-EDI SDK Client
445
488
  */
@@ -529,6 +572,10 @@ declare class NeoEdiClient {
529
572
  * GraphQL query operations
530
573
  */
531
574
  readonly graphql: GraphQLResource;
575
+ /**
576
+ * Webhook subscription operations
577
+ */
578
+ readonly webhooks: WebhooksResource;
532
579
  constructor(config: NeoEdiClientConfig);
533
580
  }
534
581
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ListCustomersParams, EdiCustomer, CustomerIdentifierType, CreateCustomerRequest, UpdateCustomerRequest, ListSubCustomersParams, SubCustomerWithIdentifiers, SubCustomer, AddSubCustomerResponse, CreateSubCustomerRequest, CreateSubCustomerResponse, EdiPartner, RegisterPartnerCustomerRequest, PartnerCustomerRegistrationResult, GetSubscriptionsParams, CustomerSubscriptionsResponse, IdentifierPattern, 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';
1
+ import { ListCustomersParams, EdiCustomer, CustomerIdentifierType, CreateCustomerRequest, UpdateCustomerRequest, ListSubCustomersParams, SubCustomerWithIdentifiers, SubCustomer, AddSubCustomerResponse, CreateSubCustomerRequest, CreateSubCustomerResponse, EdiPartner, RegisterPartnerCustomerRequest, PartnerCustomerRegistrationResult, GetSubscriptionsParams, CustomerSubscriptionsResponse, IdentifierPattern, ListMappingTemplatesParams, EdiMappingTemplate, CreateMappingTemplateRequest, UpdateMappingTemplateRequest, CsvHeaderMappingCollection, CsvDataTransformationConfig, IngestCsvResult, DryRunResult, WebhookEndpoint, CreateWebhookRequest, WebhookEndpointWithSecret, UpdateWebhookRequest, ListWebhookDeliveriesParams, WebhookDelivery } from '@neo-edi/types';
2
+ export { AddSubCustomerRequest, AddSubCustomerResponse, Address, ApiResponse, CreateCustomerRequest, CreateMappingTemplateRequest, CreatePartnerRequest, CreateWebhookRequest, CsvDataTransformationConfig, CsvHeaderMappingCollection, CsvHeaderMappingConfig, CsvHeaderTableEntry, DryRunResult, Edi852DeliverySummary, Edi852Header, Edi852HeaderFilter, Edi852Item, Edi852Location, Edi852Status, EdiCustomer, EdiMappingTemplate, EdiPartner, EdiPartnerCustomer, IngestCsvResult, ListCustomersParams, ListMappingTemplatesParams, ListSubCustomersParams, ListWebhookDeliveriesParams, PaginatedResponse, PartnerCustomerRegistrationResult, RegisterPartnerCustomerRequest, SubCustomer, SubCustomersResponse, UpdateCustomerRequest, UpdateMappingTemplateRequest, UpdatePartnerRequest, UpdateWebhookRequest, WebhookDelivery, WebhookDeliveryStatus, WebhookEndpoint, WebhookEndpointWithSecret, WebhookEventType } from '@neo-edi/types';
3
3
 
4
4
  /**
5
5
  * Base HTTP client for the SDK
@@ -440,6 +440,49 @@ declare const Queries: {
440
440
  GET_EXECUTION_SUMMARIES: string;
441
441
  };
442
442
 
443
+ /**
444
+ * Webhooks resource
445
+ *
446
+ * Register endpoints that receive HMAC-signed HTTP callbacks when events occur
447
+ * for a trading partner — e.g. `document.ingested` when a delivery is ingested.
448
+ *
449
+ * Verifying incoming webhooks (on your receiver):
450
+ * const expected = "sha256=" + hmacSHA256(`${timestamp}.${rawBody}`, signingSecret)
451
+ * compare against the `v1=` value in the `X-Webhook-Signature` header, where
452
+ * `timestamp` is the `X-Webhook-Timestamp` header (and the `t=` value).
453
+ */
454
+
455
+ declare class WebhooksResource {
456
+ private http;
457
+ constructor(http: HttpClient);
458
+ /**
459
+ * List webhook endpoints for a trading partner.
460
+ */
461
+ list(partnerId: string): Promise<WebhookEndpoint[]>;
462
+ /**
463
+ * Get a single webhook endpoint by id.
464
+ */
465
+ get(endpointId: string): Promise<WebhookEndpoint>;
466
+ /**
467
+ * Create (subscribe) a webhook endpoint. The returned object includes the
468
+ * `signingSecret` — store it now, it is never returned again.
469
+ */
470
+ create(data: CreateWebhookRequest): Promise<WebhookEndpointWithSecret>;
471
+ /**
472
+ * Update a webhook endpoint (url, description, subscribed events, or enable/
473
+ * disable via `isActive`).
474
+ */
475
+ update(endpointId: string, data: UpdateWebhookRequest): Promise<WebhookEndpoint>;
476
+ /**
477
+ * Delete (unsubscribe) a webhook endpoint.
478
+ */
479
+ delete(endpointId: string): Promise<void>;
480
+ /**
481
+ * List recent delivery attempts for an endpoint (audit / debugging).
482
+ */
483
+ listDeliveries(endpointId: string, params?: ListWebhookDeliveriesParams): Promise<WebhookDelivery[]>;
484
+ }
485
+
443
486
  /**
444
487
  * Neo-EDI SDK Client
445
488
  */
@@ -529,6 +572,10 @@ declare class NeoEdiClient {
529
572
  * GraphQL query operations
530
573
  */
531
574
  readonly graphql: GraphQLResource;
575
+ /**
576
+ * Webhook subscription operations
577
+ */
578
+ readonly webhooks: WebhooksResource;
532
579
  constructor(config: NeoEdiClientConfig);
533
580
  }
534
581
 
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.19",
66
+ version: "1.0.20",
67
67
  description: "TypeScript SDK for the Neo-EDI platform",
68
68
  main: "./dist/index.js",
69
69
  module: "./dist/index.mjs",
@@ -786,6 +786,84 @@ var Queries = {
786
786
  `
787
787
  };
788
788
 
789
+ // src/resources/webhooks.ts
790
+ var WebhooksResource = class {
791
+ constructor(http) {
792
+ this.http = http;
793
+ }
794
+ /**
795
+ * List webhook endpoints for a trading partner.
796
+ */
797
+ async list(partnerId) {
798
+ const response = await this.http.get(
799
+ "/api/v1/webhooks",
800
+ { partnerId }
801
+ );
802
+ if (!response.success) {
803
+ throw new Error(response.error);
804
+ }
805
+ return response.data;
806
+ }
807
+ /**
808
+ * Get a single webhook endpoint by id.
809
+ */
810
+ async get(endpointId) {
811
+ const response = await this.http.get(
812
+ `/api/v1/webhooks/${encodeURIComponent(endpointId)}`
813
+ );
814
+ if (!response.success) {
815
+ throw new Error(response.error);
816
+ }
817
+ return response.data;
818
+ }
819
+ /**
820
+ * Create (subscribe) a webhook endpoint. The returned object includes the
821
+ * `signingSecret` — store it now, it is never returned again.
822
+ */
823
+ async create(data) {
824
+ const response = await this.http.post("/api/v1/webhooks", data);
825
+ if (!response.success) {
826
+ throw new Error(response.error);
827
+ }
828
+ return response.data;
829
+ }
830
+ /**
831
+ * Update a webhook endpoint (url, description, subscribed events, or enable/
832
+ * disable via `isActive`).
833
+ */
834
+ async update(endpointId, data) {
835
+ const response = await this.http.patch(
836
+ `/api/v1/webhooks/${encodeURIComponent(endpointId)}`,
837
+ data
838
+ );
839
+ if (!response.success) {
840
+ throw new Error(response.error);
841
+ }
842
+ return response.data;
843
+ }
844
+ /**
845
+ * Delete (unsubscribe) a webhook endpoint.
846
+ */
847
+ async delete(endpointId) {
848
+ await this.http.delete(
849
+ `/api/v1/webhooks/${encodeURIComponent(endpointId)}`
850
+ );
851
+ }
852
+ /**
853
+ * List recent delivery attempts for an endpoint (audit / debugging).
854
+ */
855
+ async listDeliveries(endpointId, params) {
856
+ const response = await this.http.get(
857
+ `/api/v1/webhooks/${encodeURIComponent(endpointId)}/deliveries`,
858
+ params
859
+ );
860
+ if (!response.success) {
861
+ throw new Error(response.error);
862
+ }
863
+ return response.data;
864
+ }
865
+ };
866
+
789
867
  // src/client.ts
790
868
  var NeoEdiClient = class {
791
869
  constructor(config) {
@@ -803,6 +881,7 @@ var NeoEdiClient = class {
803
881
  this.mappingTemplates = new MappingTemplatesResource(this.http);
804
882
  this.ingest = new IngestResource(this.http);
805
883
  this.graphql = new GraphQLResource(this.http);
884
+ this.webhooks = new WebhooksResource(this.http);
806
885
  }
807
886
  };
808
887
  // Annotate the CommonJS export names for ESM import in node:
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.19",
35
+ version: "1.0.20",
36
36
  description: "TypeScript SDK for the Neo-EDI platform",
37
37
  main: "./dist/index.js",
38
38
  module: "./dist/index.mjs",
@@ -755,6 +755,84 @@ var Queries = {
755
755
  `
756
756
  };
757
757
 
758
+ // src/resources/webhooks.ts
759
+ var WebhooksResource = class {
760
+ constructor(http) {
761
+ this.http = http;
762
+ }
763
+ /**
764
+ * List webhook endpoints for a trading partner.
765
+ */
766
+ async list(partnerId) {
767
+ const response = await this.http.get(
768
+ "/api/v1/webhooks",
769
+ { partnerId }
770
+ );
771
+ if (!response.success) {
772
+ throw new Error(response.error);
773
+ }
774
+ return response.data;
775
+ }
776
+ /**
777
+ * Get a single webhook endpoint by id.
778
+ */
779
+ async get(endpointId) {
780
+ const response = await this.http.get(
781
+ `/api/v1/webhooks/${encodeURIComponent(endpointId)}`
782
+ );
783
+ if (!response.success) {
784
+ throw new Error(response.error);
785
+ }
786
+ return response.data;
787
+ }
788
+ /**
789
+ * Create (subscribe) a webhook endpoint. The returned object includes the
790
+ * `signingSecret` — store it now, it is never returned again.
791
+ */
792
+ async create(data) {
793
+ const response = await this.http.post("/api/v1/webhooks", data);
794
+ if (!response.success) {
795
+ throw new Error(response.error);
796
+ }
797
+ return response.data;
798
+ }
799
+ /**
800
+ * Update a webhook endpoint (url, description, subscribed events, or enable/
801
+ * disable via `isActive`).
802
+ */
803
+ async update(endpointId, data) {
804
+ const response = await this.http.patch(
805
+ `/api/v1/webhooks/${encodeURIComponent(endpointId)}`,
806
+ data
807
+ );
808
+ if (!response.success) {
809
+ throw new Error(response.error);
810
+ }
811
+ return response.data;
812
+ }
813
+ /**
814
+ * Delete (unsubscribe) a webhook endpoint.
815
+ */
816
+ async delete(endpointId) {
817
+ await this.http.delete(
818
+ `/api/v1/webhooks/${encodeURIComponent(endpointId)}`
819
+ );
820
+ }
821
+ /**
822
+ * List recent delivery attempts for an endpoint (audit / debugging).
823
+ */
824
+ async listDeliveries(endpointId, params) {
825
+ const response = await this.http.get(
826
+ `/api/v1/webhooks/${encodeURIComponent(endpointId)}/deliveries`,
827
+ params
828
+ );
829
+ if (!response.success) {
830
+ throw new Error(response.error);
831
+ }
832
+ return response.data;
833
+ }
834
+ };
835
+
758
836
  // src/client.ts
759
837
  var NeoEdiClient = class {
760
838
  constructor(config) {
@@ -772,6 +850,7 @@ var NeoEdiClient = class {
772
850
  this.mappingTemplates = new MappingTemplatesResource(this.http);
773
851
  this.ingest = new IngestResource(this.http);
774
852
  this.graphql = new GraphQLResource(this.http);
853
+ this.webhooks = new WebhooksResource(this.http);
775
854
  }
776
855
  };
777
856
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo-edi/sdk",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
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.19"
19
+ "@neo-edi/types": "1.0.20"
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.19"
27
+ "@neo-edi/types": "1.0.20"
28
28
  },
29
29
  "scripts": {
30
30
  "build": "tsup src/index.ts --format cjs,esm --dts",