@epilot/erp-integration-client 0.1.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.
package/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # @epilot/erp-integration-client
2
+
3
+ [![CI](https://github.com/epilot-dev/sdk-js/workflows/CI/badge.svg)](https://github.com/epilot-dev/sdk-js/actions?query=workflow%3ACI)
4
+ [![npm version](https://img.shields.io/npm/v/@epilot/erp-integration-client.svg)](https://www.npmjs.com/package/@epilot/erp-integration-client)
5
+ [![bundle size](https://img.shields.io/bundlephobia/minzip/@epilot/erp-integration-client?label=gzip%20bundle)](https://bundlephobia.com/package/@epilot/erp-integration-client)
6
+ [![License](http://img.shields.io/:license-mit-blue.svg)](https://github.com/epilot-dev/sdk-js/blob/main/LICENSE)
7
+
8
+ Client library for epilot [ERP Integration API](https://docs.api.epilot.io/erp-integration/)
9
+
10
+ Uses [`openapi-client-axios`](https://github.com/openapistack/openapi-client-axios)
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install --save @epilot/erp-integration-client
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ ```typescript
21
+ import { getClient } from '@epilot/erp-integration-client';
22
+
23
+ const erpIntegrationClient = getClient();
24
+ const res = await erpIntegrationClient.acknowledgeTracking({ack_id: '123e4567-e89b-12d3-a456-426614174000'});
25
+ ```
26
+
27
+ ## Documentation
28
+
29
+ https://docs.api.epilot.io/erp-integration/
@@ -0,0 +1,3 @@
1
+ import { Client } from './openapi';
2
+ export declare const getClient: () => Client;
3
+ export declare const createClient: () => Client;
package/dist/client.js ADDED
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.createClient = exports.getClient = void 0;
18
+ var lambda_powertools_correlation_ids_1 = __importDefault(require("@dazn/lambda-powertools-correlation-ids"));
19
+ var openapi_client_axios_1 = __importDefault(require("openapi-client-axios"));
20
+ var definition_1 = __importDefault(require("./definition"));
21
+ var client;
22
+ var getClient = function () {
23
+ if (!client) {
24
+ client = (0, exports.createClient)();
25
+ }
26
+ return client;
27
+ };
28
+ exports.getClient = getClient;
29
+ var createClient = function () {
30
+ var _a;
31
+ var api = new openapi_client_axios_1.default({ definition: definition_1.default, quick: true });
32
+ var apiClient = api.initSync();
33
+ apiClient.defaults.headers.common = __assign(__assign({}, ((_a = apiClient.defaults.headers.common) !== null && _a !== void 0 ? _a : {})), (lambda_powertools_correlation_ids_1.default.get() || {}));
34
+ return apiClient;
35
+ };
36
+ exports.createClient = createClient;
37
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1,3 @@
1
+ import type { Document } from 'openapi-client-axios';
2
+ declare const _default: Document;
3
+ export default _default;
@@ -0,0 +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})})();
@@ -0,0 +1,3 @@
1
+ export type { OpenAPIClient, OpenAPIClientAxios, Document } from 'openapi-client-axios';
2
+ export * from './client';
3
+ export * from './openapi';
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,26 @@
1
+ {
2
+ "openapi": "3.0.3",
3
+ "info": {
4
+ "title": "",
5
+ "version": ""
6
+ },
7
+ "paths": {
8
+ "/v1/erp/tracking/acknowledgement": {
9
+ "post": {
10
+ "operationId": "acknowledgeTracking",
11
+ "requestBody": {
12
+ "content": {
13
+ "application/json": {}
14
+ }
15
+ },
16
+ "responses": {}
17
+ }
18
+ }
19
+ },
20
+ "components": {},
21
+ "servers": [
22
+ {
23
+ "url": "https://erp-integration-api.sls.epilot.io"
24
+ }
25
+ ]
26
+ }
@@ -0,0 +1,67 @@
1
+ /* eslint-disable */
2
+
3
+ import type {
4
+ OpenAPIClient,
5
+ Parameters,
6
+ UnknownParamsObject,
7
+ OperationResponse,
8
+ AxiosRequestConfig,
9
+ } from 'openapi-client-axios';
10
+
11
+ declare namespace Paths {
12
+ namespace AcknowledgeTracking {
13
+ export interface RequestBody {
14
+ /**
15
+ * Unique identifier of the ERP tracking record to acknowledge
16
+ */
17
+ ack_id: string;
18
+ }
19
+ namespace Responses {
20
+ export interface $200 {
21
+ message?: string;
22
+ }
23
+ export interface $400 {
24
+ }
25
+ export interface $401 {
26
+ }
27
+ export interface $404 {
28
+ }
29
+ export interface $500 {
30
+ }
31
+ }
32
+ }
33
+ }
34
+
35
+
36
+ export interface OperationMethods {
37
+ /**
38
+ * acknowledgeTracking - Acknowledge receival of ERP tracking record
39
+ *
40
+ * Acknowledges an ERP tracking record by removing it from the tracking table, requires public authentication
41
+ */
42
+ 'acknowledgeTracking'(
43
+ parameters?: Parameters<UnknownParamsObject> | null,
44
+ data?: Paths.AcknowledgeTracking.RequestBody,
45
+ config?: AxiosRequestConfig
46
+ ): OperationResponse<Paths.AcknowledgeTracking.Responses.$200>
47
+ }
48
+
49
+ export interface PathsDictionary {
50
+ ['/v1/erp/tracking/acknowledgement']: {
51
+ /**
52
+ * acknowledgeTracking - Acknowledge receival of ERP tracking record
53
+ *
54
+ * Acknowledges an ERP tracking record by removing it from the tracking table, requires public authentication
55
+ */
56
+ 'post'(
57
+ parameters?: Parameters<UnknownParamsObject> | null,
58
+ data?: Paths.AcknowledgeTracking.RequestBody,
59
+ config?: AxiosRequestConfig
60
+ ): OperationResponse<Paths.AcknowledgeTracking.Responses.$200>
61
+ }
62
+ }
63
+
64
+ export type Client = OpenAPIClient<OperationMethods, PathsDictionary>
65
+
66
+
67
+
@@ -0,0 +1,101 @@
1
+ {
2
+ "openapi": "3.0.3",
3
+ "info": {
4
+ "title": "ERP Integration API",
5
+ "version": "1.0.0"
6
+ },
7
+ "tags": [
8
+ {
9
+ "name": "erp",
10
+ "description": "ERP integration endpoints"
11
+ }
12
+ ],
13
+ "security": [
14
+ {
15
+ "EpilotAuth": []
16
+ }
17
+ ],
18
+ "paths": {
19
+ "/v1/erp/tracking/acknowledgement": {
20
+ "post": {
21
+ "operationId": "acknowledgeTracking",
22
+ "summary": "Acknowledge receival of ERP tracking record",
23
+ "description": "Acknowledges an ERP tracking record by removing it from the tracking table, requires public authentication",
24
+ "tags": [
25
+ "erp"
26
+ ],
27
+ "requestBody": {
28
+ "content": {
29
+ "application/json": {
30
+ "schema": {
31
+ "type": "object",
32
+ "required": [
33
+ "ack_id"
34
+ ],
35
+ "properties": {
36
+ "ack_id": {
37
+ "type": "string",
38
+ "description": "Unique identifier of the ERP tracking record to acknowledge"
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
44
+ },
45
+ "responses": {
46
+ "200": {
47
+ "description": "Acknowledgment successful",
48
+ "content": {
49
+ "application/json": {
50
+ "schema": {
51
+ "type": "object",
52
+ "properties": {
53
+ "message": {
54
+ "type": "string"
55
+ }
56
+ }
57
+ }
58
+ }
59
+ }
60
+ },
61
+ "400": {
62
+ "description": "Bad request - missing ack_id"
63
+ },
64
+ "401": {
65
+ "description": "Unauthorized - invalid or missing token"
66
+ },
67
+ "404": {
68
+ "description": "Record not found"
69
+ },
70
+ "500": {
71
+ "description": "Server error processing the request"
72
+ }
73
+ }
74
+ }
75
+ }
76
+ },
77
+ "components": {
78
+ "securitySchemes": {
79
+ "EpilotAuth": {
80
+ "type": "http",
81
+ "scheme": "bearer",
82
+ "description": "Authorization header with epilot OAuth2 bearer token",
83
+ "bearerFormat": "JWT"
84
+ },
85
+ "EpilotPublicAuth": {
86
+ "type": "http",
87
+ "scheme": "bearer",
88
+ "description": "Authorization header with epilot public access token",
89
+ "bearerFormat": "JWT"
90
+ }
91
+ }
92
+ },
93
+ "servers": [
94
+ {
95
+ "url": "https://erp-integration-api.sls.epilot.io"
96
+ },
97
+ {
98
+ "url": "https://erp-integration-api.sls.epilot.io"
99
+ }
100
+ ]
101
+ }
package/package.json ADDED
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "@epilot/erp-integration-client",
3
+ "version": "0.1.0",
4
+ "description": "Client library for ePilot ERP Integration API",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "author": "epilot GmbH",
8
+ "license": "MIT",
9
+ "private": false,
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/epilot-dev/sdk-js.git",
13
+ "directory": "clients/erp-integration-client"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/epilot-dev/sdk-js/issues"
17
+ },
18
+ "homepage": "https://github.com/epilot-dev/sdk-js/tree/main/clients/erp-integration-client#readme",
19
+ "keywords": [
20
+ "epilot",
21
+ "sdk",
22
+ "erp",
23
+ "integration"
24
+ ],
25
+ "scripts": {
26
+ "test": "jest",
27
+ "typescript": "tsc",
28
+ "bundle-definition": "webpack",
29
+ "openapi": "node ../../scripts/update-openapi.js https://docs.api.epilot.io/erp-integration.yaml",
30
+ "typegen": "openapi typegen src/openapi.json --client -b '/* eslint-disable */' > src/openapi.d.ts",
31
+ "build": "tsc && npm run build:patch && npm run bundle-definition",
32
+ "build:patch": "sed -i'' -e '/^__exportStar.*openapi.*$/d' dist/index.js",
33
+ "build:watch": "npm run build && tsc -w",
34
+ "prepublishOnly": "npm run typegen && npm run build",
35
+ "lint": "../../node_modules/eslint/bin/eslint.js src"
36
+ },
37
+ "files": [
38
+ "*.js",
39
+ "*.d.ts",
40
+ "**/*.js",
41
+ "**/*.d.ts",
42
+ "**/*.json",
43
+ "!*.test.*",
44
+ "!**/*.test.*",
45
+ "!node_modules",
46
+ "!src",
47
+ "!src/**",
48
+ "!*.config.js"
49
+ ],
50
+ "peerDependencies": {
51
+ "axios": "^1.6.2"
52
+ },
53
+ "dependencies": {
54
+ "@dazn/lambda-powertools-correlation-ids": "^1.28.1",
55
+ "buffer": "^6.0.3",
56
+ "https-browserify": "^1.0.0",
57
+ "openapi-client-axios": "^7.5.1",
58
+ "stream-http": "^3.1.1",
59
+ "url": "^0.11.0",
60
+ "util": "^0.12.3"
61
+ },
62
+ "devDependencies": {
63
+ "@types/jest": "^26.0.20",
64
+ "axios": "^1.6.2",
65
+ "copy-webpack-plugin": "^7.0.0",
66
+ "jest": "^26.6.3",
67
+ "json-loader": "^0.5.7",
68
+ "openapicmd": "^2.6.0",
69
+ "ts-jest": "^26.5.0",
70
+ "ts-loader": "^8.0.14",
71
+ "ts-node": "^10.9.1",
72
+ "typescript": "^4.1.3",
73
+ "webpack": "^5.18.0",
74
+ "webpack-cli": "^4.4.0"
75
+ }
76
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "compilerOptions": {
3
+ "strict": true,
4
+ "target": "es5",
5
+ "module": "commonjs",
6
+ "moduleResolution": "node",
7
+ "lib": ["esnext", "dom"],
8
+ "experimentalDecorators": true,
9
+ "emitDecoratorMetadata": true,
10
+ "esModuleInterop": true,
11
+ "noImplicitAny": true,
12
+ "strictPropertyInitialization": false,
13
+ "strictNullChecks": false,
14
+ "resolveJsonModule": true,
15
+ "baseUrl": ".",
16
+ "rootDir": "src",
17
+ "outDir": "dist",
18
+ "sourceMap": true,
19
+ "declaration": true
20
+ },
21
+ "include": ["src/**/*"],
22
+ "exclude": ["**/*.test.ts"]
23
+ }