@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 +48 -48
- package/dist/client.d.ts +2 -2
- package/dist/client.js +31 -31
- package/dist/definition.d.ts +3 -3
- package/dist/definition.js +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +14 -18
- package/dist/openapi.d.ts +3302 -3162
- package/dist/openapi.json +3783 -3739
- package/dist/schema-model.d.ts +11 -11
- package/dist/schema-model.js +12 -12
- package/package-lock.json +18779 -18779
- package/package.json +61 -61
- package/tsconfig.json +23 -23
- package/.gitignore +0 -3
- package/dist/client.js.map +0 -1
- package/dist/definition.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/schema-model.js.map +0 -1
- package/jest.config.ts +0 -13
- package/src/client.test.ts +0 -19
- package/src/client.ts +0 -21
- package/src/definition.ts +0 -5
- package/src/index.ts +0 -4
- package/src/openapi.d.ts +0 -3944
- package/src/openapi.json +0 -3739
- package/src/schema-model.ts +0 -30
- package/webpack.config.js +0 -28
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
|
package/dist/definition.d.ts
CHANGED
|
@@ -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;
|