@epilot/erp-integration-client 0.15.0 → 0.15.1

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.
@@ -1 +1 @@
1
- (()=>{"use strict";var e={330:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(466));t.default=o.default},466:e=>{e.exports=JSON.parse('{"openapi":"3.0.3","info":{"title":"","version":""},"servers":[{"url":"https://erp-integration-api.sls.epilot.io"}],"paths":{"/v1/erp/tracking/acknowledgement":{"post":{"operationId":"acknowledgeTracking","requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v1/erp/trigger":{"post":{"operationId":"triggerErp","requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/erp/updates/events":{"post":{"operationId":"processErpUpdatesEvents","requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v2/erp/updates/events":{"post":{"operationId":"processErpUpdatesEventsV2","requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v2/erp/updates/mapping_simulation":{"post":{"operationId":"simulateMappingV2","requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/erp/updates/mapping_simulation":{"post":{"operationId":"simulateMapping","requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/integrations":{"get":{"operationId":"listIntegrations","responses":{}},"post":{"operationId":"createIntegration","requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/integrations/{integrationId}":{"get":{"operationId":"getIntegration","parameters":[{"name":"integrationId","in":"path","required":true}],"responses":{}},"put":{"operationId":"updateIntegration","parameters":[{"name":"integrationId","in":"path","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}},"delete":{"operationId":"deleteIntegration","parameters":[{"name":"integrationId","in":"path","required":true}],"responses":{}}},"/v1/integrations/{integrationId}/events":{"post":{"operationId":"queryEvents","parameters":[{"name":"integrationId","in":"path","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/integrations/{integrationId}/events/replay":{"post":{"operationId":"replayEvents","parameters":[{"name":"integrationId","in":"path","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/integrations/{integrationId}/use-cases":{"get":{"operationId":"listUseCases","parameters":[{"name":"integrationId","in":"path","required":true}],"responses":{}},"post":{"operationId":"createUseCase","parameters":[{"name":"integrationId","in":"path","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/integrations/{integrationId}/use-cases/{useCaseId}":{"get":{"operationId":"getUseCase","parameters":[{"name":"integrationId","in":"path","required":true},{"name":"useCaseId","in":"path","required":true}],"responses":{}},"put":{"operationId":"updateUseCase","parameters":[{"name":"integrationId","in":"path","required":true},{"name":"useCaseId","in":"path","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}},"delete":{"operationId":"deleteUseCase","parameters":[{"name":"integrationId","in":"path","required":true},{"name":"useCaseId","in":"path","required":true}],"responses":{}}},"/v1/integrations/{integrationId}/use-cases/{useCaseId}/history":{"get":{"operationId":"listUseCaseHistory","parameters":[{"name":"integrationId","in":"path","required":true},{"name":"useCaseId","in":"path","required":true},{"name":"cursor","in":"query","required":false}],"responses":{}}},"/v1/integrations/{integrationId}/app-mapping":{"put":{"operationId":"setIntegrationAppMapping","parameters":[{"name":"integrationId","in":"path","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}},"delete":{"operationId":"deleteIntegrationAppMapping","parameters":[{"name":"integrationId","in":"path","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}}},"components":{"responses":{"BadRequest":{"content":{"application/json":{}}},"NotFound":{"content":{"application/json":{}}},"Unauthorized":{"content":{"application/json":{}}},"InternalServerError":{"content":{"application/json":{}}},"ReplayEventsResponse":{"content":{"application/json":{}}},"ERPUpdatesResponse":{"content":{"application/json":{}}},"TriggerWebhookResponse":{"content":{"application/json":{}}},"QueryEventsResponse":{"content":{"application/json":{}}}}}}')}},t={},n=function n(r){var o=t[r];if(void 0!==o)return o.exports;var s=t[r]={exports:{}};return e[r].call(s.exports,s,s.exports,n),s.exports}(330),r=exports;for(var o in n)r[o]=n[o];n.__esModule&&Object.defineProperty(r,"__esModule",{value:!0})})();
1
+ (()=>{"use strict";var e={390:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(466));t.default=o.default},466:e=>{e.exports=JSON.parse('{"openapi":"3.0.3","info":{"title":"","version":""},"servers":[{"url":"https://erp-integration-api.sls.epilot.io"}],"paths":{"/v1/erp/tracking/acknowledgement":{"post":{"operationId":"acknowledgeTracking","requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v1/erp/trigger":{"post":{"operationId":"triggerErp","requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/erp/updates/events":{"post":{"operationId":"processErpUpdatesEvents","requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v2/erp/updates/events":{"post":{"operationId":"processErpUpdatesEventsV2","requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v2/erp/updates/mapping_simulation":{"post":{"operationId":"simulateMappingV2","requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/erp/updates/mapping_simulation":{"post":{"operationId":"simulateMapping","requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/integrations":{"get":{"operationId":"listIntegrations","responses":{}},"post":{"operationId":"createIntegration","requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/integrations/{integrationId}":{"get":{"operationId":"getIntegration","parameters":[{"name":"integrationId","in":"path","required":true}],"responses":{}},"put":{"operationId":"updateIntegration","parameters":[{"name":"integrationId","in":"path","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}},"delete":{"operationId":"deleteIntegration","parameters":[{"name":"integrationId","in":"path","required":true}],"responses":{}}},"/v1/integrations/{integrationId}/events":{"post":{"operationId":"queryEvents","parameters":[{"name":"integrationId","in":"path","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/integrations/{integrationId}/events/replay":{"post":{"operationId":"replayEvents","parameters":[{"name":"integrationId","in":"path","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/integrations/{integrationId}/use-cases":{"get":{"operationId":"listUseCases","parameters":[{"name":"integrationId","in":"path","required":true}],"responses":{}},"post":{"operationId":"createUseCase","parameters":[{"name":"integrationId","in":"path","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/integrations/{integrationId}/use-cases/{useCaseId}":{"get":{"operationId":"getUseCase","parameters":[{"name":"integrationId","in":"path","required":true},{"name":"useCaseId","in":"path","required":true}],"responses":{}},"put":{"operationId":"updateUseCase","parameters":[{"name":"integrationId","in":"path","required":true},{"name":"useCaseId","in":"path","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}},"delete":{"operationId":"deleteUseCase","parameters":[{"name":"integrationId","in":"path","required":true},{"name":"useCaseId","in":"path","required":true}],"responses":{}}},"/v1/integrations/{integrationId}/use-cases/{useCaseId}/history":{"get":{"operationId":"listUseCaseHistory","parameters":[{"name":"integrationId","in":"path","required":true},{"name":"useCaseId","in":"path","required":true},{"name":"cursor","in":"query","required":false}],"responses":{}}},"/v2/integrations":{"get":{"operationId":"listIntegrationsV2","responses":{}}},"/v2/integrations/{integrationId}":{"get":{"operationId":"getIntegrationV2","parameters":[{"name":"integrationId","in":"path","required":true}],"responses":{}},"put":{"operationId":"upsertIntegrationV2","parameters":[{"name":"integrationId","in":"path","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}},"delete":{"operationId":"deleteIntegrationV2","parameters":[{"name":"integrationId","in":"path","required":true}],"responses":{}}},"/v1/integrations/{integrationId}/app-mapping":{"put":{"operationId":"setIntegrationAppMapping","parameters":[{"name":"integrationId","in":"path","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}},"delete":{"operationId":"deleteIntegrationAppMapping","parameters":[{"name":"integrationId","in":"path","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}}},"components":{"responses":{"BadRequest":{"content":{"application/json":{}}},"NotFound":{"content":{"application/json":{}}},"Unauthorized":{"content":{"application/json":{}}},"InternalServerError":{"content":{"application/json":{}}},"ReplayEventsResponse":{"content":{"application/json":{}}},"ERPUpdatesResponse":{"content":{"application/json":{}}},"TriggerWebhookResponse":{"content":{"application/json":{}}},"QueryEventsResponse":{"content":{"application/json":{}}}}}}')}},t={},n=function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}(390),r=exports;for(var o in n)r[o]=n[o];n.__esModule&&Object.defineProperty(r,"__esModule",{value:!0})})();
@@ -283,6 +283,53 @@
283
283
  "responses": {}
284
284
  }
285
285
  },
286
+ "/v2/integrations": {
287
+ "get": {
288
+ "operationId": "listIntegrationsV2",
289
+ "responses": {}
290
+ }
291
+ },
292
+ "/v2/integrations/{integrationId}": {
293
+ "get": {
294
+ "operationId": "getIntegrationV2",
295
+ "parameters": [
296
+ {
297
+ "name": "integrationId",
298
+ "in": "path",
299
+ "required": true
300
+ }
301
+ ],
302
+ "responses": {}
303
+ },
304
+ "put": {
305
+ "operationId": "upsertIntegrationV2",
306
+ "parameters": [
307
+ {
308
+ "name": "integrationId",
309
+ "in": "path",
310
+ "required": true
311
+ }
312
+ ],
313
+ "requestBody": {
314
+ "required": true,
315
+ "content": {
316
+ "application/json": {}
317
+ }
318
+ },
319
+ "responses": {}
320
+ },
321
+ "delete": {
322
+ "operationId": "deleteIntegrationV2",
323
+ "parameters": [
324
+ {
325
+ "name": "integrationId",
326
+ "in": "path",
327
+ "required": true
328
+ }
329
+ ],
330
+ "responses": {}
331
+ }
332
+ },
286
333
  "/v1/integrations/{integrationId}/app-mapping": {
287
334
  "put": {
288
335
  "operationId": "setIntegrationAppMapping",
package/dist/openapi.d.ts CHANGED
@@ -124,6 +124,83 @@ declare namespace Components {
124
124
  */
125
125
  component_id: string; // uuid
126
126
  }
127
+ export interface EmbeddedInboundUseCaseRequest {
128
+ /**
129
+ * Optional use case ID for update matching.
130
+ * - If provided and matches an existing use case, that use case is updated
131
+ * - If provided but no match, a new use case with this ID is created
132
+ * - If omitted, a new use case with auto-generated ID is created
133
+ *
134
+ */
135
+ id?: string; // uuid
136
+ /**
137
+ * Use case name
138
+ */
139
+ name: string;
140
+ /**
141
+ * Whether the use case is enabled
142
+ */
143
+ enabled: boolean;
144
+ /**
145
+ * Optional description of this change (like a commit message)
146
+ */
147
+ change_description?: string;
148
+ /**
149
+ * Use case type
150
+ */
151
+ type: "inbound";
152
+ configuration?: /* Configuration for inbound use cases (ERP to epilot) */ InboundIntegrationEventConfiguration;
153
+ }
154
+ export interface EmbeddedOutboundUseCaseRequest {
155
+ /**
156
+ * Optional use case ID for update matching.
157
+ * - If provided and matches an existing use case, that use case is updated
158
+ * - If provided but no match, a new use case with this ID is created
159
+ * - If omitted, a new use case with auto-generated ID is created
160
+ *
161
+ */
162
+ id?: string; // uuid
163
+ /**
164
+ * Use case name
165
+ */
166
+ name: string;
167
+ /**
168
+ * Whether the use case is enabled
169
+ */
170
+ enabled: boolean;
171
+ /**
172
+ * Optional description of this change (like a commit message)
173
+ */
174
+ change_description?: string;
175
+ /**
176
+ * Use case type
177
+ */
178
+ type: "outbound";
179
+ configuration?: /* Configuration for outbound use cases (epilot to ERP). Structure TBD. */ OutboundIntegrationEventConfiguration;
180
+ }
181
+ export type EmbeddedUseCaseRequest = EmbeddedInboundUseCaseRequest | EmbeddedOutboundUseCaseRequest;
182
+ export interface EmbeddedUseCaseRequestBase {
183
+ /**
184
+ * Optional use case ID for update matching.
185
+ * - If provided and matches an existing use case, that use case is updated
186
+ * - If provided but no match, a new use case with this ID is created
187
+ * - If omitted, a new use case with auto-generated ID is created
188
+ *
189
+ */
190
+ id?: string; // uuid
191
+ /**
192
+ * Use case name
193
+ */
194
+ name: string;
195
+ /**
196
+ * Whether the use case is enabled
197
+ */
198
+ enabled: boolean;
199
+ /**
200
+ * Optional description of this change (like a commit message)
201
+ */
202
+ change_description?: string;
203
+ }
127
204
  export interface EntityUpdate {
128
205
  /**
129
206
  * The entity type slug
@@ -401,9 +478,12 @@ declare namespace Components {
401
478
  }
402
479
  export interface IntegrationMeterReading {
403
480
  /**
404
- * JSONata expression to extract meter reading items from the event data
481
+ * Optional JSONata expression to extract meter reading items from the event data.
482
+ * If not provided, the entire payload is used as the reading data.
483
+ * Useful when you need to extract an array of readings from a nested structure (e.g., "$.readings").
484
+ *
405
485
  */
406
- jsonataExpression: string;
486
+ jsonataExpression?: string;
407
487
  /**
408
488
  * Strategy for matching incoming readings against existing readings.
409
489
  * - 'external_id': Match readings by external_id attribute (default behavior)
@@ -433,6 +513,39 @@ declare namespace Components {
433
513
  */
434
514
  fields: IntegrationFieldV1[];
435
515
  }
516
+ /**
517
+ * Integration with embedded use cases for atomic CRUD operations
518
+ */
519
+ export interface IntegrationWithUseCases {
520
+ /**
521
+ * Unique identifier for the integration
522
+ */
523
+ id: string; // uuid
524
+ /**
525
+ * Organization ID
526
+ */
527
+ orgId: string;
528
+ /**
529
+ * Integration name
530
+ */
531
+ name: string;
532
+ /**
533
+ * Optional description of the integration
534
+ */
535
+ description?: string;
536
+ /**
537
+ * All use cases belonging to this integration
538
+ */
539
+ use_cases: UseCase[];
540
+ /**
541
+ * ISO-8601 timestamp when the integration was created
542
+ */
543
+ created_at: string; // date-time
544
+ /**
545
+ * ISO-8601 timestamp when the integration was last updated
546
+ */
547
+ updated_at: string; // date-time
548
+ }
436
549
  export interface MappingSimulationRequest {
437
550
  mapping_configuration: IntegrationConfigurationV1 | IntegrationConfigurationV2;
438
551
  /**
@@ -976,6 +1089,29 @@ declare namespace Components {
976
1089
  */
977
1090
  change_description?: string;
978
1091
  }
1092
+ /**
1093
+ * Request to create or update an integration with embedded use cases (upsert).
1094
+ * This is a declarative operation - the request represents the desired state.
1095
+ *
1096
+ */
1097
+ export interface UpsertIntegrationWithUseCasesRequest {
1098
+ /**
1099
+ * Integration name
1100
+ */
1101
+ name: string;
1102
+ /**
1103
+ * Optional description of the integration
1104
+ */
1105
+ description?: string;
1106
+ /**
1107
+ * Full list of use cases (declarative). This replaces ALL existing use cases.
1108
+ * - Use cases with an `id` field matching an existing use case will be updated
1109
+ * - Use cases without an `id` or with a non-matching `id` will be created
1110
+ * - Existing use cases not in this list will be deleted
1111
+ *
1112
+ */
1113
+ use_cases?: EmbeddedUseCaseRequest[];
1114
+ }
979
1115
  export type UseCase = {
980
1116
  /**
981
1117
  * Unique identifier for the use case
@@ -1135,6 +1271,23 @@ declare namespace Paths {
1135
1271
  export type $500 = Components.Responses.InternalServerError;
1136
1272
  }
1137
1273
  }
1274
+ namespace DeleteIntegrationV2 {
1275
+ namespace Parameters {
1276
+ export type IntegrationId = string; // uuid
1277
+ }
1278
+ export interface PathParameters {
1279
+ integrationId: Parameters.IntegrationId /* uuid */;
1280
+ }
1281
+ namespace Responses {
1282
+ export interface $200 {
1283
+ message?: string;
1284
+ }
1285
+ export type $401 = Components.Responses.Unauthorized;
1286
+ export interface $404 {
1287
+ }
1288
+ export type $500 = Components.Responses.InternalServerError;
1289
+ }
1290
+ }
1138
1291
  namespace DeleteUseCase {
1139
1292
  namespace Parameters {
1140
1293
  export type IntegrationId = string; // uuid
@@ -1169,6 +1322,21 @@ declare namespace Paths {
1169
1322
  export type $500 = Components.Responses.InternalServerError;
1170
1323
  }
1171
1324
  }
1325
+ namespace GetIntegrationV2 {
1326
+ namespace Parameters {
1327
+ export type IntegrationId = string; // uuid
1328
+ }
1329
+ export interface PathParameters {
1330
+ integrationId: Parameters.IntegrationId /* uuid */;
1331
+ }
1332
+ namespace Responses {
1333
+ export type $200 = /* Integration with embedded use cases for atomic CRUD operations */ Components.Schemas.IntegrationWithUseCases;
1334
+ export type $401 = Components.Responses.Unauthorized;
1335
+ export interface $404 {
1336
+ }
1337
+ export type $500 = Components.Responses.InternalServerError;
1338
+ }
1339
+ }
1172
1340
  namespace GetUseCase {
1173
1341
  namespace Parameters {
1174
1342
  export type IntegrationId = string; // uuid
@@ -1195,6 +1363,15 @@ declare namespace Paths {
1195
1363
  export type $500 = Components.Responses.InternalServerError;
1196
1364
  }
1197
1365
  }
1366
+ namespace ListIntegrationsV2 {
1367
+ namespace Responses {
1368
+ export interface $200 {
1369
+ integrations: /* Integration with embedded use cases for atomic CRUD operations */ Components.Schemas.IntegrationWithUseCases[];
1370
+ }
1371
+ export type $401 = Components.Responses.Unauthorized;
1372
+ export type $500 = Components.Responses.InternalServerError;
1373
+ }
1374
+ }
1198
1375
  namespace ListUseCaseHistory {
1199
1376
  namespace Parameters {
1200
1377
  export type Cursor = string;
@@ -1406,6 +1583,26 @@ declare namespace Paths {
1406
1583
  export type $500 = Components.Responses.InternalServerError;
1407
1584
  }
1408
1585
  }
1586
+ namespace UpsertIntegrationV2 {
1587
+ namespace Parameters {
1588
+ export type IntegrationId = string; // uuid
1589
+ }
1590
+ export interface PathParameters {
1591
+ integrationId: Parameters.IntegrationId /* uuid */;
1592
+ }
1593
+ export type RequestBody = /**
1594
+ * Request to create or update an integration with embedded use cases (upsert).
1595
+ * This is a declarative operation - the request represents the desired state.
1596
+ *
1597
+ */
1598
+ Components.Schemas.UpsertIntegrationWithUseCasesRequest;
1599
+ namespace Responses {
1600
+ export type $200 = /* Integration with embedded use cases for atomic CRUD operations */ Components.Schemas.IntegrationWithUseCases;
1601
+ export type $400 = Components.Responses.BadRequest;
1602
+ export type $401 = Components.Responses.Unauthorized;
1603
+ export type $500 = Components.Responses.InternalServerError;
1604
+ }
1605
+ }
1409
1606
  }
1410
1607
 
1411
1608
 
@@ -1616,6 +1813,53 @@ export interface OperationMethods {
1616
1813
  data?: any,
1617
1814
  config?: AxiosRequestConfig
1618
1815
  ): OperationResponse<Paths.ListUseCaseHistory.Responses.$200>
1816
+ /**
1817
+ * listIntegrationsV2 - listIntegrationsV2
1818
+ *
1819
+ * Retrieve all integrations with embedded use cases for the authenticated organization
1820
+ */
1821
+ 'listIntegrationsV2'(
1822
+ parameters?: Parameters<UnknownParamsObject> | null,
1823
+ data?: any,
1824
+ config?: AxiosRequestConfig
1825
+ ): OperationResponse<Paths.ListIntegrationsV2.Responses.$200>
1826
+ /**
1827
+ * getIntegrationV2 - getIntegrationV2
1828
+ *
1829
+ * Retrieve a specific integration with all its embedded use cases
1830
+ */
1831
+ 'getIntegrationV2'(
1832
+ parameters?: Parameters<Paths.GetIntegrationV2.PathParameters> | null,
1833
+ data?: any,
1834
+ config?: AxiosRequestConfig
1835
+ ): OperationResponse<Paths.GetIntegrationV2.Responses.$200>
1836
+ /**
1837
+ * upsertIntegrationV2 - upsertIntegrationV2
1838
+ *
1839
+ * Create or update an integration with embedded use cases (upsert).
1840
+ * If the integration does not exist, it will be created with the specified ID.
1841
+ * If it exists, it will be updated declaratively:
1842
+ * - Use cases in the request with matching IDs are updated
1843
+ * - Use cases in the request without matching IDs are created
1844
+ * - Existing use cases not in the request are deleted
1845
+ * This is ideal for Infrastructure-as-Code tools like Terraform.
1846
+ *
1847
+ */
1848
+ 'upsertIntegrationV2'(
1849
+ parameters?: Parameters<Paths.UpsertIntegrationV2.PathParameters> | null,
1850
+ data?: Paths.UpsertIntegrationV2.RequestBody,
1851
+ config?: AxiosRequestConfig
1852
+ ): OperationResponse<Paths.UpsertIntegrationV2.Responses.$200>
1853
+ /**
1854
+ * deleteIntegrationV2 - deleteIntegrationV2
1855
+ *
1856
+ * Delete an integration and all its use cases
1857
+ */
1858
+ 'deleteIntegrationV2'(
1859
+ parameters?: Parameters<Paths.DeleteIntegrationV2.PathParameters> | null,
1860
+ data?: any,
1861
+ config?: AxiosRequestConfig
1862
+ ): OperationResponse<Paths.DeleteIntegrationV2.Responses.$200>
1619
1863
  /**
1620
1864
  * setIntegrationAppMapping - setIntegrationAppMapping
1621
1865
  *
@@ -1875,6 +2119,57 @@ export interface PathsDictionary {
1875
2119
  config?: AxiosRequestConfig
1876
2120
  ): OperationResponse<Paths.ListUseCaseHistory.Responses.$200>
1877
2121
  }
2122
+ ['/v2/integrations']: {
2123
+ /**
2124
+ * listIntegrationsV2 - listIntegrationsV2
2125
+ *
2126
+ * Retrieve all integrations with embedded use cases for the authenticated organization
2127
+ */
2128
+ 'get'(
2129
+ parameters?: Parameters<UnknownParamsObject> | null,
2130
+ data?: any,
2131
+ config?: AxiosRequestConfig
2132
+ ): OperationResponse<Paths.ListIntegrationsV2.Responses.$200>
2133
+ }
2134
+ ['/v2/integrations/{integrationId}']: {
2135
+ /**
2136
+ * getIntegrationV2 - getIntegrationV2
2137
+ *
2138
+ * Retrieve a specific integration with all its embedded use cases
2139
+ */
2140
+ 'get'(
2141
+ parameters?: Parameters<Paths.GetIntegrationV2.PathParameters> | null,
2142
+ data?: any,
2143
+ config?: AxiosRequestConfig
2144
+ ): OperationResponse<Paths.GetIntegrationV2.Responses.$200>
2145
+ /**
2146
+ * upsertIntegrationV2 - upsertIntegrationV2
2147
+ *
2148
+ * Create or update an integration with embedded use cases (upsert).
2149
+ * If the integration does not exist, it will be created with the specified ID.
2150
+ * If it exists, it will be updated declaratively:
2151
+ * - Use cases in the request with matching IDs are updated
2152
+ * - Use cases in the request without matching IDs are created
2153
+ * - Existing use cases not in the request are deleted
2154
+ * This is ideal for Infrastructure-as-Code tools like Terraform.
2155
+ *
2156
+ */
2157
+ 'put'(
2158
+ parameters?: Parameters<Paths.UpsertIntegrationV2.PathParameters> | null,
2159
+ data?: Paths.UpsertIntegrationV2.RequestBody,
2160
+ config?: AxiosRequestConfig
2161
+ ): OperationResponse<Paths.UpsertIntegrationV2.Responses.$200>
2162
+ /**
2163
+ * deleteIntegrationV2 - deleteIntegrationV2
2164
+ *
2165
+ * Delete an integration and all its use cases
2166
+ */
2167
+ 'delete'(
2168
+ parameters?: Parameters<Paths.DeleteIntegrationV2.PathParameters> | null,
2169
+ data?: any,
2170
+ config?: AxiosRequestConfig
2171
+ ): OperationResponse<Paths.DeleteIntegrationV2.Responses.$200>
2172
+ }
1878
2173
  ['/v1/integrations/{integrationId}/app-mapping']: {
1879
2174
  /**
1880
2175
  * setIntegrationAppMapping - setIntegrationAppMapping
@@ -1912,6 +2207,10 @@ export type CreateOutboundUseCaseRequest = Components.Schemas.CreateOutboundUseC
1912
2207
  export type CreateUseCaseRequest = Components.Schemas.CreateUseCaseRequest;
1913
2208
  export type CreateUseCaseRequestBase = Components.Schemas.CreateUseCaseRequestBase;
1914
2209
  export type DeleteIntegrationAppMappingRequest = Components.Schemas.DeleteIntegrationAppMappingRequest;
2210
+ export type EmbeddedInboundUseCaseRequest = Components.Schemas.EmbeddedInboundUseCaseRequest;
2211
+ export type EmbeddedOutboundUseCaseRequest = Components.Schemas.EmbeddedOutboundUseCaseRequest;
2212
+ export type EmbeddedUseCaseRequest = Components.Schemas.EmbeddedUseCaseRequest;
2213
+ export type EmbeddedUseCaseRequestBase = Components.Schemas.EmbeddedUseCaseRequestBase;
1915
2214
  export type EntityUpdate = Components.Schemas.EntityUpdate;
1916
2215
  export type ErpEvent = Components.Schemas.ErpEvent;
1917
2216
  export type ErpUpdatesEventsV2Request = Components.Schemas.ErpUpdatesEventsV2Request;
@@ -1928,6 +2227,7 @@ export type IntegrationEntityField = Components.Schemas.IntegrationEntityField;
1928
2227
  export type IntegrationFieldV1 = Components.Schemas.IntegrationFieldV1;
1929
2228
  export type IntegrationMeterReading = Components.Schemas.IntegrationMeterReading;
1930
2229
  export type IntegrationObjectV1 = Components.Schemas.IntegrationObjectV1;
2230
+ export type IntegrationWithUseCases = Components.Schemas.IntegrationWithUseCases;
1931
2231
  export type MappingSimulationRequest = Components.Schemas.MappingSimulationRequest;
1932
2232
  export type MappingSimulationResponse = Components.Schemas.MappingSimulationResponse;
1933
2233
  export type MappingSimulationV2Request = Components.Schemas.MappingSimulationV2Request;
@@ -1953,6 +2253,7 @@ export type UpdateIntegrationRequest = Components.Schemas.UpdateIntegrationReque
1953
2253
  export type UpdateOutboundUseCaseRequest = Components.Schemas.UpdateOutboundUseCaseRequest;
1954
2254
  export type UpdateUseCaseRequest = Components.Schemas.UpdateUseCaseRequest;
1955
2255
  export type UpdateUseCaseRequestBase = Components.Schemas.UpdateUseCaseRequestBase;
2256
+ export type UpsertIntegrationWithUseCasesRequest = Components.Schemas.UpsertIntegrationWithUseCasesRequest;
1956
2257
  export type UseCase = Components.Schemas.UseCase;
1957
2258
  export type UseCaseHistoryEntry = Components.Schemas.UseCaseHistoryEntry;
1958
2259
  export type UseCaseHistoryEntryBase = Components.Schemas.UseCaseHistoryEntryBase;
package/dist/openapi.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.0.3",
3
3
  "info": {
4
4
  "title": "ERP Integration API",
5
- "version": "0.17.2",
5
+ "version": "0.18.0",
6
6
  "description": "API for integrating with ERP systems, handling tracking acknowledgments, triggering ERP processes, and processing ERP updates."
7
7
  },
8
8
  "tags": [
@@ -20,9 +20,6 @@
20
20
  }
21
21
  ],
22
22
  "servers": [
23
- {
24
- "url": "https://erp-integration-api.sls.epilot.io"
25
- },
26
23
  {
27
24
  "url": "https://erp-integration-api.sls.epilot.io"
28
25
  }
@@ -1560,6 +1557,185 @@
1560
1557
  }
1561
1558
  }
1562
1559
  },
1560
+ "/v2/integrations": {
1561
+ "get": {
1562
+ "operationId": "listIntegrationsV2",
1563
+ "summary": "listIntegrationsV2",
1564
+ "description": "Retrieve all integrations with embedded use cases for the authenticated organization",
1565
+ "tags": [
1566
+ "integrations"
1567
+ ],
1568
+ "responses": {
1569
+ "200": {
1570
+ "description": "Successfully retrieved integrations with use cases",
1571
+ "content": {
1572
+ "application/json": {
1573
+ "schema": {
1574
+ "type": "object",
1575
+ "required": [
1576
+ "integrations"
1577
+ ],
1578
+ "properties": {
1579
+ "integrations": {
1580
+ "type": "array",
1581
+ "items": {
1582
+ "$ref": "#/components/schemas/IntegrationWithUseCases"
1583
+ }
1584
+ }
1585
+ }
1586
+ }
1587
+ }
1588
+ }
1589
+ },
1590
+ "401": {
1591
+ "$ref": "#/components/responses/Unauthorized"
1592
+ },
1593
+ "500": {
1594
+ "$ref": "#/components/responses/InternalServerError"
1595
+ }
1596
+ }
1597
+ }
1598
+ },
1599
+ "/v2/integrations/{integrationId}": {
1600
+ "get": {
1601
+ "operationId": "getIntegrationV2",
1602
+ "summary": "getIntegrationV2",
1603
+ "description": "Retrieve a specific integration with all its embedded use cases",
1604
+ "tags": [
1605
+ "integrations"
1606
+ ],
1607
+ "parameters": [
1608
+ {
1609
+ "name": "integrationId",
1610
+ "in": "path",
1611
+ "required": true,
1612
+ "description": "The integration ID",
1613
+ "schema": {
1614
+ "type": "string",
1615
+ "format": "uuid"
1616
+ }
1617
+ }
1618
+ ],
1619
+ "responses": {
1620
+ "200": {
1621
+ "description": "Successfully retrieved integration with use cases",
1622
+ "content": {
1623
+ "application/json": {
1624
+ "schema": {
1625
+ "$ref": "#/components/schemas/IntegrationWithUseCases"
1626
+ }
1627
+ }
1628
+ }
1629
+ },
1630
+ "401": {
1631
+ "$ref": "#/components/responses/Unauthorized"
1632
+ },
1633
+ "404": {
1634
+ "description": "Integration not found"
1635
+ },
1636
+ "500": {
1637
+ "$ref": "#/components/responses/InternalServerError"
1638
+ }
1639
+ }
1640
+ },
1641
+ "put": {
1642
+ "operationId": "upsertIntegrationV2",
1643
+ "summary": "upsertIntegrationV2",
1644
+ "description": "Create or update an integration with embedded use cases (upsert).\nIf the integration does not exist, it will be created with the specified ID.\nIf it exists, it will be updated declaratively:\n- Use cases in the request with matching IDs are updated\n- Use cases in the request without matching IDs are created\n- Existing use cases not in the request are deleted\nThis is ideal for Infrastructure-as-Code tools like Terraform.\n",
1645
+ "tags": [
1646
+ "integrations"
1647
+ ],
1648
+ "parameters": [
1649
+ {
1650
+ "name": "integrationId",
1651
+ "in": "path",
1652
+ "required": true,
1653
+ "description": "The integration ID (client-provided)",
1654
+ "schema": {
1655
+ "type": "string",
1656
+ "format": "uuid"
1657
+ }
1658
+ }
1659
+ ],
1660
+ "requestBody": {
1661
+ "required": true,
1662
+ "content": {
1663
+ "application/json": {
1664
+ "schema": {
1665
+ "$ref": "#/components/schemas/UpsertIntegrationWithUseCasesRequest"
1666
+ }
1667
+ }
1668
+ }
1669
+ },
1670
+ "responses": {
1671
+ "200": {
1672
+ "description": "Integration created or updated successfully with use cases",
1673
+ "content": {
1674
+ "application/json": {
1675
+ "schema": {
1676
+ "$ref": "#/components/schemas/IntegrationWithUseCases"
1677
+ }
1678
+ }
1679
+ }
1680
+ },
1681
+ "400": {
1682
+ "$ref": "#/components/responses/BadRequest"
1683
+ },
1684
+ "401": {
1685
+ "$ref": "#/components/responses/Unauthorized"
1686
+ },
1687
+ "500": {
1688
+ "$ref": "#/components/responses/InternalServerError"
1689
+ }
1690
+ }
1691
+ },
1692
+ "delete": {
1693
+ "operationId": "deleteIntegrationV2",
1694
+ "summary": "deleteIntegrationV2",
1695
+ "description": "Delete an integration and all its use cases",
1696
+ "tags": [
1697
+ "integrations"
1698
+ ],
1699
+ "parameters": [
1700
+ {
1701
+ "name": "integrationId",
1702
+ "in": "path",
1703
+ "required": true,
1704
+ "description": "The integration ID",
1705
+ "schema": {
1706
+ "type": "string",
1707
+ "format": "uuid"
1708
+ }
1709
+ }
1710
+ ],
1711
+ "responses": {
1712
+ "200": {
1713
+ "description": "Integration deleted successfully",
1714
+ "content": {
1715
+ "application/json": {
1716
+ "schema": {
1717
+ "type": "object",
1718
+ "properties": {
1719
+ "message": {
1720
+ "type": "string"
1721
+ }
1722
+ }
1723
+ }
1724
+ }
1725
+ }
1726
+ },
1727
+ "401": {
1728
+ "$ref": "#/components/responses/Unauthorized"
1729
+ },
1730
+ "404": {
1731
+ "description": "Integration not found"
1732
+ },
1733
+ "500": {
1734
+ "$ref": "#/components/responses/InternalServerError"
1735
+ }
1736
+ }
1737
+ }
1738
+ },
1563
1739
  "/v1/integrations/{integrationId}/app-mapping": {
1564
1740
  "put": {
1565
1741
  "operationId": "setIntegrationAppMapping",
@@ -2777,14 +2953,13 @@
2777
2953
  "IntegrationMeterReading": {
2778
2954
  "type": "object",
2779
2955
  "required": [
2780
- "jsonataExpression",
2781
2956
  "meter",
2782
2957
  "fields"
2783
2958
  ],
2784
2959
  "properties": {
2785
2960
  "jsonataExpression": {
2786
2961
  "type": "string",
2787
- "description": "JSONata expression to extract meter reading items from the event data"
2962
+ "description": "Optional JSONata expression to extract meter reading items from the event data.\nIf not provided, the entire payload is used as the reading data.\nUseful when you need to extract an array of readings from a nested structure (e.g., \"$.readings\").\n"
2788
2963
  },
2789
2964
  "reading_matching": {
2790
2965
  "type": "string",
@@ -3050,6 +3225,178 @@
3050
3225
  ],
3051
3226
  "description": "Type hint for repeatable fields that require special search handling.\nThese fields are stored as arrays of objects (e.g., email: [{ email: \"value\" }]).\n"
3052
3227
  },
3228
+ "IntegrationWithUseCases": {
3229
+ "type": "object",
3230
+ "description": "Integration with embedded use cases for atomic CRUD operations",
3231
+ "required": [
3232
+ "id",
3233
+ "orgId",
3234
+ "name",
3235
+ "use_cases",
3236
+ "created_at",
3237
+ "updated_at"
3238
+ ],
3239
+ "properties": {
3240
+ "id": {
3241
+ "type": "string",
3242
+ "format": "uuid",
3243
+ "description": "Unique identifier for the integration"
3244
+ },
3245
+ "orgId": {
3246
+ "type": "string",
3247
+ "description": "Organization ID"
3248
+ },
3249
+ "name": {
3250
+ "type": "string",
3251
+ "description": "Integration name"
3252
+ },
3253
+ "description": {
3254
+ "type": "string",
3255
+ "description": "Optional description of the integration"
3256
+ },
3257
+ "use_cases": {
3258
+ "type": "array",
3259
+ "description": "All use cases belonging to this integration",
3260
+ "items": {
3261
+ "$ref": "#/components/schemas/UseCase"
3262
+ }
3263
+ },
3264
+ "created_at": {
3265
+ "type": "string",
3266
+ "format": "date-time",
3267
+ "description": "ISO-8601 timestamp when the integration was created"
3268
+ },
3269
+ "updated_at": {
3270
+ "type": "string",
3271
+ "format": "date-time",
3272
+ "description": "ISO-8601 timestamp when the integration was last updated"
3273
+ }
3274
+ }
3275
+ },
3276
+ "UpsertIntegrationWithUseCasesRequest": {
3277
+ "type": "object",
3278
+ "description": "Request to create or update an integration with embedded use cases (upsert).\nThis is a declarative operation - the request represents the desired state.\n",
3279
+ "required": [
3280
+ "name"
3281
+ ],
3282
+ "properties": {
3283
+ "name": {
3284
+ "type": "string",
3285
+ "minLength": 1,
3286
+ "maxLength": 255,
3287
+ "description": "Integration name"
3288
+ },
3289
+ "description": {
3290
+ "type": "string",
3291
+ "maxLength": 1000,
3292
+ "description": "Optional description of the integration"
3293
+ },
3294
+ "use_cases": {
3295
+ "type": "array",
3296
+ "description": "Full list of use cases (declarative). This replaces ALL existing use cases.\n- Use cases with an `id` field matching an existing use case will be updated\n- Use cases without an `id` or with a non-matching `id` will be created\n- Existing use cases not in this list will be deleted\n",
3297
+ "items": {
3298
+ "$ref": "#/components/schemas/EmbeddedUseCaseRequest"
3299
+ }
3300
+ }
3301
+ }
3302
+ },
3303
+ "EmbeddedUseCaseRequest": {
3304
+ "oneOf": [
3305
+ {
3306
+ "$ref": "#/components/schemas/EmbeddedInboundUseCaseRequest"
3307
+ },
3308
+ {
3309
+ "$ref": "#/components/schemas/EmbeddedOutboundUseCaseRequest"
3310
+ }
3311
+ ],
3312
+ "discriminator": {
3313
+ "propertyName": "type",
3314
+ "mapping": {
3315
+ "inbound": "#/components/schemas/EmbeddedInboundUseCaseRequest",
3316
+ "outbound": "#/components/schemas/EmbeddedOutboundUseCaseRequest"
3317
+ }
3318
+ }
3319
+ },
3320
+ "EmbeddedUseCaseRequestBase": {
3321
+ "type": "object",
3322
+ "required": [
3323
+ "name",
3324
+ "type",
3325
+ "enabled"
3326
+ ],
3327
+ "properties": {
3328
+ "id": {
3329
+ "type": "string",
3330
+ "format": "uuid",
3331
+ "description": "Optional use case ID for update matching.\n- If provided and matches an existing use case, that use case is updated\n- If provided but no match, a new use case with this ID is created\n- If omitted, a new use case with auto-generated ID is created\n"
3332
+ },
3333
+ "name": {
3334
+ "type": "string",
3335
+ "minLength": 1,
3336
+ "maxLength": 255,
3337
+ "description": "Use case name"
3338
+ },
3339
+ "enabled": {
3340
+ "type": "boolean",
3341
+ "description": "Whether the use case is enabled"
3342
+ },
3343
+ "change_description": {
3344
+ "type": "string",
3345
+ "maxLength": 2000,
3346
+ "description": "Optional description of this change (like a commit message)"
3347
+ }
3348
+ }
3349
+ },
3350
+ "EmbeddedInboundUseCaseRequest": {
3351
+ "allOf": [
3352
+ {
3353
+ "$ref": "#/components/schemas/EmbeddedUseCaseRequestBase"
3354
+ },
3355
+ {
3356
+ "type": "object",
3357
+ "required": [
3358
+ "type"
3359
+ ],
3360
+ "properties": {
3361
+ "type": {
3362
+ "type": "string",
3363
+ "enum": [
3364
+ "inbound"
3365
+ ],
3366
+ "description": "Use case type"
3367
+ },
3368
+ "configuration": {
3369
+ "$ref": "#/components/schemas/InboundIntegrationEventConfiguration"
3370
+ }
3371
+ }
3372
+ }
3373
+ ]
3374
+ },
3375
+ "EmbeddedOutboundUseCaseRequest": {
3376
+ "allOf": [
3377
+ {
3378
+ "$ref": "#/components/schemas/EmbeddedUseCaseRequestBase"
3379
+ },
3380
+ {
3381
+ "type": "object",
3382
+ "required": [
3383
+ "type"
3384
+ ],
3385
+ "properties": {
3386
+ "type": {
3387
+ "type": "string",
3388
+ "enum": [
3389
+ "outbound"
3390
+ ],
3391
+ "description": "Use case type"
3392
+ },
3393
+ "configuration": {
3394
+ "$ref": "#/components/schemas/OutboundIntegrationEventConfiguration"
3395
+ }
3396
+ }
3397
+ }
3398
+ ]
3399
+ },
3053
3400
  "ReplayEventsRequest": {
3054
3401
  "type": "object",
3055
3402
  "required": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/erp-integration-client",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "description": "Client library for ePilot ERP Integration API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",