@epilot/erp-integration-client 0.1.0 → 0.3.0

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={187:function(e,t,r){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var n=o(r(466));t.default=n.default},466:e=>{e.exports=JSON.parse('{"openapi":"3.0.3","info":{"title":"","version":""},"paths":{"/v1/erp/tracking/acknowledgement":{"post":{"operationId":"acknowledgeTracking","requestBody":{"content":{"application/json":{}}},"responses":{}}}},"components":{},"servers":[{"url":"https://erp-integration-api.sls.epilot.io"}]}')}},t={},r=function r(o){var n=t[o];if(void 0!==n)return n.exports;var s=t[o]={exports:{}};return e[o].call(s.exports,s,s.exports,r),s.exports}(187),o=exports;for(var n in r)o[n]=r[n];r.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})();
1
+ (()=>{"use strict";var e={187:function(e,t,o){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var r=n(o(466));t.default=r.default},466:e=>{e.exports=JSON.parse('{"openapi":"3.0.3","info":{"title":"","version":""},"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":{}}}},"components":{"responses":{"BadRequest":{"content":{"application/json":{}}},"Unauthorized":{"content":{"application/json":{}}},"NotFound":{"content":{"application/json":{}}},"InternalServerError":{"content":{"application/json":{}}},"ERPUpdatesResponse":{"content":{"application/json":{}}}}},"servers":[{"url":"https://erp-integration-api.sls.epilot.io"}]}')}},t={},o=function o(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,o),s.exports}(187),n=exports;for(var r in o)n[r]=o[r];o.__esModule&&Object.defineProperty(n,"__esModule",{value:!0})})();
@@ -15,9 +15,60 @@
15
15
  },
16
16
  "responses": {}
17
17
  }
18
+ },
19
+ "/v1/erp/trigger": {
20
+ "post": {
21
+ "operationId": "triggerErp",
22
+ "requestBody": {
23
+ "required": true,
24
+ "content": {
25
+ "application/json": {}
26
+ }
27
+ },
28
+ "responses": {}
29
+ }
30
+ },
31
+ "/v1/erp/updates/events": {
32
+ "post": {
33
+ "operationId": "processErpUpdatesEvents",
34
+ "requestBody": {
35
+ "content": {
36
+ "application/json": {}
37
+ }
38
+ },
39
+ "responses": {}
40
+ }
41
+ }
42
+ },
43
+ "components": {
44
+ "responses": {
45
+ "BadRequest": {
46
+ "content": {
47
+ "application/json": {}
48
+ }
49
+ },
50
+ "Unauthorized": {
51
+ "content": {
52
+ "application/json": {}
53
+ }
54
+ },
55
+ "NotFound": {
56
+ "content": {
57
+ "application/json": {}
58
+ }
59
+ },
60
+ "InternalServerError": {
61
+ "content": {
62
+ "application/json": {}
63
+ }
64
+ },
65
+ "ERPUpdatesResponse": {
66
+ "content": {
67
+ "application/json": {}
68
+ }
69
+ }
18
70
  }
19
71
  },
20
- "components": {},
21
72
  "servers": [
22
73
  {
23
74
  "url": "https://erp-integration-api.sls.epilot.io"
package/dist/openapi.d.ts CHANGED
@@ -8,6 +8,88 @@ import type {
8
8
  AxiosRequestConfig,
9
9
  } from 'openapi-client-axios';
10
10
 
11
+ declare namespace Components {
12
+ namespace Responses {
13
+ export type BadRequest = Schemas.ErrorResponseBase;
14
+ export interface ERPUpdatesResponse {
15
+ results?: {
16
+ /**
17
+ * ID of the processed event
18
+ */
19
+ event_id: string;
20
+ /**
21
+ * Processing status for the event
22
+ */
23
+ status: "success" | "error";
24
+ /**
25
+ * Information about the processing status
26
+ */
27
+ message?: string;
28
+ }[];
29
+ }
30
+ export type InternalServerError = Schemas.ErrorResponseBase;
31
+ export type NotFound = Schemas.ErrorResponseBase;
32
+ export type Unauthorized = Schemas.ErrorResponseBase;
33
+ }
34
+ namespace Schemas {
35
+ export interface ErrorResponseBase {
36
+ /**
37
+ * Computer-readable error code
38
+ */
39
+ code?: string;
40
+ /**
41
+ * Error message
42
+ */
43
+ message?: string;
44
+ }
45
+ export interface TriggerErpActionRequest {
46
+ /**
47
+ * Unique identifier of the ERP Toolkit manifest
48
+ */
49
+ manifest_id: string;
50
+ /**
51
+ * Unique identifier of the current automation execution
52
+ */
53
+ execution_id: string;
54
+ /**
55
+ * Identifier of the organization where the automation is executed
56
+ */
57
+ org_id: string;
58
+ /**
59
+ * Identifier of the self-service webhook configuration
60
+ */
61
+ webhook_id: string;
62
+ /**
63
+ * Identifier of the automation flow that triggered the action
64
+ */
65
+ flow_id: string;
66
+ /**
67
+ * ISO-8601 timestamp when the webhook event was created
68
+ */
69
+ created_at: string; // date-time
70
+ /**
71
+ * Identifier of the automation action being executed
72
+ */
73
+ action_id: string;
74
+ /**
75
+ * Identifier of the specific automation flow action instance
76
+ */
77
+ flow_action_id: string;
78
+ /**
79
+ * Human readable name of the automation flow
80
+ */
81
+ flow_name: string;
82
+ /**
83
+ * Identifier of the entity activity related to this trigger
84
+ */
85
+ activity_id: string;
86
+ /**
87
+ * Identifier of the entity referenced by the activity
88
+ */
89
+ entity_id: string;
90
+ }
91
+ }
92
+ }
11
93
  declare namespace Paths {
12
94
  namespace AcknowledgeTracking {
13
95
  export interface RequestBody {
@@ -30,6 +112,74 @@ declare namespace Paths {
30
112
  }
31
113
  }
32
114
  }
115
+ namespace ProcessErpUpdatesEvents {
116
+ export interface RequestBody {
117
+ /**
118
+ * UUID that identifies the specific integration app instance
119
+ */
120
+ app_id: string; // uuid
121
+ /**
122
+ * UUID that identifies the specific integration app component instance
123
+ */
124
+ component_id: string; // uuid
125
+ /**
126
+ * Metadata to be passed along with the events
127
+ */
128
+ meta: {
129
+ [name: string]: any;
130
+ /**
131
+ * ID that identifies the specific request for debugging purposes
132
+ */
133
+ correlation_id?: string;
134
+ };
135
+ /**
136
+ * List of ERP events to process
137
+ */
138
+ events: {
139
+ /**
140
+ * Type of event (create, update, delete)
141
+ */
142
+ event_type: "CREATE" | "UPDATE" | "DELETE";
143
+ /**
144
+ * Type of the object being updated (business_partner, contract_account, etc.)
145
+ */
146
+ object_type: string;
147
+ /**
148
+ * Timestamp when the event occurred
149
+ */
150
+ timestamp: string; // date-time
151
+ /**
152
+ * Format of the payload data
153
+ */
154
+ format: "json" | "xml";
155
+ /**
156
+ * The serialized object data payload (JSON, XML, etc.) as a string
157
+ */
158
+ payload: string;
159
+ }[];
160
+ }
161
+ namespace Responses {
162
+ export type $200 = Components.Responses.ERPUpdatesResponse;
163
+ export type $400 = Components.Responses.BadRequest;
164
+ export type $401 = Components.Responses.Unauthorized;
165
+ export type $422 = Components.Responses.ERPUpdatesResponse;
166
+ export type $500 = Components.Responses.InternalServerError;
167
+ }
168
+ }
169
+ namespace TriggerErp {
170
+ export type RequestBody = Components.Schemas.TriggerErpActionRequest;
171
+ namespace Responses {
172
+ export interface $200 {
173
+ message?: string;
174
+ }
175
+ export interface $400 {
176
+ }
177
+ export interface $401 {
178
+ }
179
+ export interface $500 {
180
+ }
181
+ }
182
+ }
33
183
  }
34
184
 
35
185
 
@@ -44,6 +194,26 @@ export interface OperationMethods {
44
194
  data?: Paths.AcknowledgeTracking.RequestBody,
45
195
  config?: AxiosRequestConfig
46
196
  ): OperationResponse<Paths.AcknowledgeTracking.Responses.$200>
197
+ /**
198
+ * triggerErp - Trigger ERP integration
199
+ *
200
+ * Triggers the ERP integration process
201
+ */
202
+ 'triggerErp'(
203
+ parameters?: Parameters<UnknownParamsObject> | null,
204
+ data?: Paths.TriggerErp.RequestBody,
205
+ config?: AxiosRequestConfig
206
+ ): OperationResponse<Paths.TriggerErp.Responses.$200>
207
+ /**
208
+ * processErpUpdatesEvents - Process ERP system updates
209
+ *
210
+ * Handles updates from ERP systems and tracks them appropriately
211
+ */
212
+ 'processErpUpdatesEvents'(
213
+ parameters?: Parameters<UnknownParamsObject> | null,
214
+ data?: Paths.ProcessErpUpdatesEvents.RequestBody,
215
+ config?: AxiosRequestConfig
216
+ ): OperationResponse<Paths.ProcessErpUpdatesEvents.Responses.$200>
47
217
  }
48
218
 
49
219
  export interface PathsDictionary {
@@ -59,9 +229,34 @@ export interface PathsDictionary {
59
229
  config?: AxiosRequestConfig
60
230
  ): OperationResponse<Paths.AcknowledgeTracking.Responses.$200>
61
231
  }
232
+ ['/v1/erp/trigger']: {
233
+ /**
234
+ * triggerErp - Trigger ERP integration
235
+ *
236
+ * Triggers the ERP integration process
237
+ */
238
+ 'post'(
239
+ parameters?: Parameters<UnknownParamsObject> | null,
240
+ data?: Paths.TriggerErp.RequestBody,
241
+ config?: AxiosRequestConfig
242
+ ): OperationResponse<Paths.TriggerErp.Responses.$200>
243
+ }
244
+ ['/v1/erp/updates/events']: {
245
+ /**
246
+ * processErpUpdatesEvents - Process ERP system updates
247
+ *
248
+ * Handles updates from ERP systems and tracks them appropriately
249
+ */
250
+ 'post'(
251
+ parameters?: Parameters<UnknownParamsObject> | null,
252
+ data?: Paths.ProcessErpUpdatesEvents.RequestBody,
253
+ config?: AxiosRequestConfig
254
+ ): OperationResponse<Paths.ProcessErpUpdatesEvents.Responses.$200>
255
+ }
62
256
  }
63
257
 
64
258
  export type Client = OpenAPIClient<OperationMethods, PathsDictionary>
65
259
 
66
260
 
67
-
261
+ export type ErrorResponseBase = Components.Schemas.ErrorResponseBase;
262
+ export type TriggerErpActionRequest = Components.Schemas.TriggerErpActionRequest;
package/dist/openapi.json CHANGED
@@ -72,6 +72,185 @@
72
72
  }
73
73
  }
74
74
  }
75
+ },
76
+ "/v1/erp/trigger": {
77
+ "post": {
78
+ "operationId": "triggerErp",
79
+ "summary": "Trigger ERP integration",
80
+ "description": "Triggers the ERP integration process",
81
+ "tags": [
82
+ "erp",
83
+ "trigger"
84
+ ],
85
+ "requestBody": {
86
+ "required": true,
87
+ "content": {
88
+ "application/json": {
89
+ "schema": {
90
+ "$ref": "#/components/schemas/TriggerErpActionRequest"
91
+ }
92
+ }
93
+ }
94
+ },
95
+ "responses": {
96
+ "200": {
97
+ "description": "Success - if the ERP Toolkit was triggered successfully",
98
+ "content": {
99
+ "application/json": {
100
+ "schema": {
101
+ "type": "object",
102
+ "properties": {
103
+ "message": {
104
+ "type": "string"
105
+ }
106
+ }
107
+ }
108
+ }
109
+ }
110
+ },
111
+ "400": {
112
+ "description": "Bad request - invalid or missing parameters"
113
+ },
114
+ "401": {
115
+ "description": "Unauthorized - invalid or missing token"
116
+ },
117
+ "500": {
118
+ "description": "Server error processing the request"
119
+ }
120
+ }
121
+ }
122
+ },
123
+ "/v1/erp/updates/events": {
124
+ "post": {
125
+ "operationId": "processErpUpdatesEvents",
126
+ "summary": "Process ERP system updates",
127
+ "description": "Handles updates from ERP systems and tracks them appropriately",
128
+ "tags": [
129
+ "erp"
130
+ ],
131
+ "requestBody": {
132
+ "content": {
133
+ "application/json": {
134
+ "schema": {
135
+ "type": "object",
136
+ "required": [
137
+ "app_id",
138
+ "component_id",
139
+ "meta",
140
+ "events"
141
+ ],
142
+ "properties": {
143
+ "app_id": {
144
+ "type": "string",
145
+ "format": "uuid",
146
+ "description": "UUID that identifies the specific integration app instance"
147
+ },
148
+ "component_id": {
149
+ "type": "string",
150
+ "format": "uuid",
151
+ "description": "UUID that identifies the specific integration app component instance"
152
+ },
153
+ "meta": {
154
+ "type": "object",
155
+ "description": "Metadata to be passed along with the events",
156
+ "additionalProperties": true,
157
+ "properties": {
158
+ "correlation_id": {
159
+ "type": "string",
160
+ "description": "ID that identifies the specific request for debugging purposes"
161
+ }
162
+ }
163
+ },
164
+ "events": {
165
+ "type": "array",
166
+ "description": "List of ERP events to process",
167
+ "items": {
168
+ "type": "object",
169
+ "required": [
170
+ "event_type",
171
+ "object_type",
172
+ "timestamp",
173
+ "format",
174
+ "payload"
175
+ ],
176
+ "properties": {
177
+ "event_type": {
178
+ "type": "string",
179
+ "enum": [
180
+ "CREATE",
181
+ "UPDATE",
182
+ "DELETE"
183
+ ],
184
+ "description": "Type of event (create, update, delete)"
185
+ },
186
+ "object_type": {
187
+ "type": "string",
188
+ "description": "Type of the object being updated (business_partner, contract_account, etc.)"
189
+ },
190
+ "timestamp": {
191
+ "type": "string",
192
+ "format": "date-time",
193
+ "description": "Timestamp when the event occurred"
194
+ },
195
+ "format": {
196
+ "type": "string",
197
+ "enum": [
198
+ "json",
199
+ "xml"
200
+ ],
201
+ "default": "json",
202
+ "description": "Format of the payload data"
203
+ },
204
+ "payload": {
205
+ "type": "string",
206
+ "description": "The serialized object data payload (JSON, XML, etc.) as a string"
207
+ }
208
+ }
209
+ }
210
+ }
211
+ }
212
+ },
213
+ "example": {
214
+ "app_id": "123e4567-e89b-12d3-a456-426614174000",
215
+ "component_id": "123e4567-e89b-12d3-a456-426614174000",
216
+ "events": [
217
+ {
218
+ "event_type": "CREATE",
219
+ "object_type": "business_partner",
220
+ "timestamp": "2025-05-01T08:30:00Z",
221
+ "format": "json",
222
+ "payload": "{\"id\":\"BP10001\",\"name\":\"Acme Corporation\",\"type\":\"organization\",\"tax_id\":\"DE123456789\",\"status\":\"active\"}"
223
+ },
224
+ {
225
+ "event_type": "UPDATE",
226
+ "object_type": "contract_account",
227
+ "timestamp": "2025-05-01T08:35:00Z",
228
+ "format": "json",
229
+ "payload": "{\"id\":\"CA20001\",\"business_partner_id\":\"BP10001\",\"status\":\"active\",\"payment_method\":\"direct_debit\"}"
230
+ }
231
+ ]
232
+ }
233
+ }
234
+ }
235
+ },
236
+ "responses": {
237
+ "200": {
238
+ "$ref": "#/components/responses/ERPUpdatesResponse"
239
+ },
240
+ "400": {
241
+ "$ref": "#/components/responses/BadRequest"
242
+ },
243
+ "401": {
244
+ "$ref": "#/components/responses/Unauthorized"
245
+ },
246
+ "422": {
247
+ "$ref": "#/components/responses/ERPUpdatesResponse"
248
+ },
249
+ "500": {
250
+ "$ref": "#/components/responses/InternalServerError"
251
+ }
252
+ }
253
+ }
75
254
  }
76
255
  },
77
256
  "components": {
@@ -88,6 +267,166 @@
88
267
  "description": "Authorization header with epilot public access token",
89
268
  "bearerFormat": "JWT"
90
269
  }
270
+ },
271
+ "schemas": {
272
+ "ErrorResponseBase": {
273
+ "type": "object",
274
+ "properties": {
275
+ "code": {
276
+ "type": "string",
277
+ "description": "Computer-readable error code"
278
+ },
279
+ "message": {
280
+ "type": "string",
281
+ "description": "Error message"
282
+ }
283
+ }
284
+ },
285
+ "TriggerErpActionRequest": {
286
+ "type": "object",
287
+ "required": [
288
+ "manifest_id",
289
+ "execution_id",
290
+ "org_id",
291
+ "webhook_id",
292
+ "flow_id",
293
+ "created_at",
294
+ "action_id",
295
+ "flow_action_id",
296
+ "flow_name",
297
+ "activity_id",
298
+ "entity_id"
299
+ ],
300
+ "properties": {
301
+ "manifest_id": {
302
+ "type": "string",
303
+ "description": "Unique identifier of the ERP Toolkit manifest"
304
+ },
305
+ "execution_id": {
306
+ "type": "string",
307
+ "description": "Unique identifier of the current automation execution"
308
+ },
309
+ "org_id": {
310
+ "type": "string",
311
+ "description": "Identifier of the organization where the automation is executed"
312
+ },
313
+ "webhook_id": {
314
+ "type": "string",
315
+ "description": "Identifier of the self-service webhook configuration"
316
+ },
317
+ "flow_id": {
318
+ "type": "string",
319
+ "description": "Identifier of the automation flow that triggered the action"
320
+ },
321
+ "created_at": {
322
+ "type": "string",
323
+ "format": "date-time",
324
+ "description": "ISO-8601 timestamp when the webhook event was created"
325
+ },
326
+ "action_id": {
327
+ "type": "string",
328
+ "description": "Identifier of the automation action being executed"
329
+ },
330
+ "flow_action_id": {
331
+ "type": "string",
332
+ "description": "Identifier of the specific automation flow action instance"
333
+ },
334
+ "flow_name": {
335
+ "type": "string",
336
+ "description": "Human readable name of the automation flow"
337
+ },
338
+ "activity_id": {
339
+ "type": "string",
340
+ "description": "Identifier of the entity activity related to this trigger"
341
+ },
342
+ "entity_id": {
343
+ "type": "string",
344
+ "description": "Identifier of the entity referenced by the activity"
345
+ }
346
+ }
347
+ }
348
+ },
349
+ "responses": {
350
+ "BadRequest": {
351
+ "description": "Bad request",
352
+ "content": {
353
+ "application/json": {
354
+ "schema": {
355
+ "$ref": "#/components/schemas/ErrorResponseBase"
356
+ }
357
+ }
358
+ }
359
+ },
360
+ "Unauthorized": {
361
+ "description": "Unauthorized request",
362
+ "content": {
363
+ "application/json": {
364
+ "schema": {
365
+ "$ref": "#/components/schemas/ErrorResponseBase"
366
+ }
367
+ }
368
+ }
369
+ },
370
+ "NotFound": {
371
+ "description": "The specified resource was not found",
372
+ "content": {
373
+ "application/json": {
374
+ "schema": {
375
+ "$ref": "#/components/schemas/ErrorResponseBase"
376
+ }
377
+ }
378
+ }
379
+ },
380
+ "InternalServerError": {
381
+ "description": "Internal Server Error",
382
+ "content": {
383
+ "application/json": {
384
+ "schema": {
385
+ "$ref": "#/components/schemas/ErrorResponseBase"
386
+ }
387
+ }
388
+ }
389
+ },
390
+ "ERPUpdatesResponse": {
391
+ "description": "Some events failed to process",
392
+ "content": {
393
+ "application/json": {
394
+ "schema": {
395
+ "type": "object",
396
+ "properties": {
397
+ "results": {
398
+ "type": "array",
399
+ "items": {
400
+ "type": "object",
401
+ "required": [
402
+ "event_id",
403
+ "status"
404
+ ],
405
+ "properties": {
406
+ "event_id": {
407
+ "type": "string",
408
+ "description": "ID of the processed event"
409
+ },
410
+ "status": {
411
+ "type": "string",
412
+ "enum": [
413
+ "success",
414
+ "error"
415
+ ],
416
+ "description": "Processing status for the event"
417
+ },
418
+ "message": {
419
+ "type": "string",
420
+ "description": "Information about the processing status"
421
+ }
422
+ }
423
+ }
424
+ }
425
+ }
426
+ }
427
+ }
428
+ }
429
+ }
91
430
  }
92
431
  },
93
432
  "servers": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/erp-integration-client",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Client library for ePilot ERP Integration API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -32,7 +32,7 @@
32
32
  "build:patch": "sed -i'' -e '/^__exportStar.*openapi.*$/d' dist/index.js",
33
33
  "build:watch": "npm run build && tsc -w",
34
34
  "prepublishOnly": "npm run typegen && npm run build",
35
- "lint": "../../node_modules/eslint/bin/eslint.js src"
35
+ "lint": "pnpm exec eslint src"
36
36
  },
37
37
  "files": [
38
38
  "*.js",
@@ -54,7 +54,7 @@
54
54
  "@dazn/lambda-powertools-correlation-ids": "^1.28.1",
55
55
  "buffer": "^6.0.3",
56
56
  "https-browserify": "^1.0.0",
57
- "openapi-client-axios": "^7.5.1",
57
+ "openapi-client-axios": "^7.6.0",
58
58
  "stream-http": "^3.1.1",
59
59
  "url": "^0.11.0",
60
60
  "util": "^0.12.3"
@@ -65,7 +65,7 @@
65
65
  "copy-webpack-plugin": "^7.0.0",
66
66
  "jest": "^26.6.3",
67
67
  "json-loader": "^0.5.7",
68
- "openapicmd": "^2.6.0",
68
+ "openapicmd": "^2.7.0",
69
69
  "ts-jest": "^26.5.0",
70
70
  "ts-loader": "^8.0.14",
71
71
  "ts-node": "^10.9.1",