@epilot/entity-client 3.0.11 → 3.0.14

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
@@ -1,48 +1,48 @@
1
- # `@epilot/entity-client`
2
-
3
- JavaScript client library for the epilot Core Entity API
4
-
5
- Uses [`openapi-client-axios`](https://github.com/anttiviljami/openapi-client-axios)
6
-
7
- ## Getting Started
8
-
9
- Install the package:
10
-
11
- ```bash
12
- npm install --save-dev @epilot/entity-client
13
- ```
14
-
15
- Import the package:
16
-
17
- ```typescript
18
- import { getClient } from '@epilot/entity-client';
19
- ```
20
-
21
- Use the client:
22
- ```typescript
23
- // get typed client
24
- const client = await getClient();
25
-
26
- // call operations
27
- const createRes = await client.createEntity(null, { name: "viljami" });
28
- const { id } = creteRes.data;
29
-
30
- const getRes = await client.getEntity(id);
31
- const { entity } = getRes.data;
32
- ```
33
-
34
- ## BaseURL & Authorization
35
-
36
- To pass an authorization header and set up the API url, you can use axios
37
- defaults:
38
-
39
- ```typescript
40
- const client = getClient();
41
- client.defaults.baseURL = config.ENTITY_API_URL;
42
- client.defaults.headers.common['authorization'] = `Bearer ${token}`;
43
- ```
44
-
45
- ## API Docs:
46
-
47
- https://docs.api.epilot.io/entity
48
-
1
+ # `@epilot/entity-client`
2
+
3
+ JavaScript client library for the epilot Core Entity API
4
+
5
+ Uses [`openapi-client-axios`](https://github.com/anttiviljami/openapi-client-axios)
6
+
7
+ ## Getting Started
8
+
9
+ Install the package:
10
+
11
+ ```bash
12
+ npm install --save-dev @epilot/entity-client
13
+ ```
14
+
15
+ Import the package:
16
+
17
+ ```typescript
18
+ import { getClient } from '@epilot/entity-client';
19
+ ```
20
+
21
+ Use the client:
22
+ ```typescript
23
+ // get typed client
24
+ const client = await getClient();
25
+
26
+ // call operations
27
+ const createRes = await client.createEntity(null, { name: "viljami" });
28
+ const { id } = creteRes.data;
29
+
30
+ const getRes = await client.getEntity(id);
31
+ const { entity } = getRes.data;
32
+ ```
33
+
34
+ ## BaseURL & Authorization
35
+
36
+ To pass an authorization header and set up the API url, you can use axios
37
+ defaults:
38
+
39
+ ```typescript
40
+ const client = getClient();
41
+ client.defaults.baseURL = config.ENTITY_API_URL;
42
+ client.defaults.headers.common['authorization'] = `Bearer ${token}`;
43
+ ```
44
+
45
+ ## API Docs:
46
+
47
+ https://docs.api.epilot.io/entity
48
+
package/dist/client.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { Client } from './openapi';
2
- export declare const getClient: () => Client;
1
+ import { Client } from './openapi';
2
+ export declare const getClient: () => Client;
package/dist/client.js CHANGED
@@ -1,32 +1,32 @@
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.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 getClient = function () {
22
- var api = new openapi_client_axios_1.default({ definition: definition_1.default, quick: true });
23
- var apiClient = api.initSync();
24
- apiClient.interceptors.request.use(function (config) {
25
- var correlationHeaders = lambda_powertools_correlation_ids_1.default.get() || {};
26
- config.headers = __assign(__assign({}, (config.headers || {})), correlationHeaders);
27
- return config;
28
- });
29
- return apiClient;
30
- };
31
- exports.getClient = getClient;
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.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 getClient = function () {
22
+ var api = new openapi_client_axios_1.default({ definition: definition_1.default, quick: true });
23
+ var apiClient = api.initSync();
24
+ apiClient.interceptors.request.use(function (config) {
25
+ var correlationHeaders = lambda_powertools_correlation_ids_1.default.get() || {};
26
+ config.headers = __assign(__assign({}, (config.headers || {})), correlationHeaders);
27
+ return config;
28
+ });
29
+ return apiClient;
30
+ };
31
+ exports.getClient = getClient;
32
32
  //# sourceMappingURL=client.js.map
@@ -1,3 +1,3 @@
1
- import type { Document } from 'openapi-client-axios';
2
- declare const _default: Document;
3
- export default _default;
1
+ import type { Document } from 'openapi-client-axios';
2
+ declare const _default: Document;
3
+ export default _default;