@chift/chift-nodejs 1.0.28 → 1.0.29
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/dist/src/modules/api.d.ts +9 -1
- package/dist/src/modules/consumer.d.ts +1 -0
- package/dist/src/modules/consumer.js +2 -0
- package/dist/src/modules/consumers.d.ts +6 -1
- package/dist/src/modules/consumers.js +2 -2
- package/dist/src/modules/sync.d.ts +4 -0
- package/dist/test/modules/consumers.test.js +14 -0
- package/package.json +1 -1
|
@@ -5,7 +5,10 @@ export declare class API {
|
|
|
5
5
|
token?: string;
|
|
6
6
|
internalApi?: any;
|
|
7
7
|
Consumers: {
|
|
8
|
-
getConsumers: (
|
|
8
|
+
getConsumers: (params?: {
|
|
9
|
+
search?: string | null | undefined;
|
|
10
|
+
internal_reference?: string | null | undefined;
|
|
11
|
+
} | undefined) => Promise<{
|
|
9
12
|
consumerId: string;
|
|
10
13
|
getConnections: () => Promise<{
|
|
11
14
|
connectionid: string;
|
|
@@ -79,6 +82,7 @@ export declare class API {
|
|
|
79
82
|
name: string;
|
|
80
83
|
redirect_url: string | null | undefined;
|
|
81
84
|
email: string | null | undefined;
|
|
85
|
+
internal_reference: string | null | undefined;
|
|
82
86
|
pos: import("../types/api").ApiFor<{
|
|
83
87
|
getLocations(options?: import("../types/api").RawDataOption | undefined): import("../types/api").RequestData<{
|
|
84
88
|
id: string;
|
|
@@ -5241,6 +5245,7 @@ export declare class API {
|
|
|
5241
5245
|
name: string;
|
|
5242
5246
|
redirect_url: string | null | undefined;
|
|
5243
5247
|
email: string | null | undefined;
|
|
5248
|
+
internal_reference: string | null | undefined;
|
|
5244
5249
|
pos: import("../types/api").ApiFor<{
|
|
5245
5250
|
getLocations(options?: import("../types/api").RawDataOption | undefined): import("../types/api").RequestData<{
|
|
5246
5251
|
id: string;
|
|
@@ -10398,6 +10403,7 @@ export declare class API {
|
|
|
10398
10403
|
name: string;
|
|
10399
10404
|
redirect_url: string | null | undefined;
|
|
10400
10405
|
email: string | null | undefined;
|
|
10406
|
+
internal_reference: string | null | undefined;
|
|
10401
10407
|
pos: import("../types/api").ApiFor<{
|
|
10402
10408
|
getLocations(options?: import("../types/api").RawDataOption | undefined): import("../types/api").RequestData<{
|
|
10403
10409
|
id: string;
|
|
@@ -15555,6 +15561,7 @@ export declare class API {
|
|
|
15555
15561
|
name: string;
|
|
15556
15562
|
redirect_url: string | null | undefined;
|
|
15557
15563
|
email: string | null | undefined;
|
|
15564
|
+
internal_reference: string | null | undefined;
|
|
15558
15565
|
pos: import("../types/api").ApiFor<{
|
|
15559
15566
|
getLocations(options?: import("../types/api").RawDataOption | undefined): import("../types/api").RequestData<{
|
|
15560
15567
|
id: string;
|
|
@@ -20717,6 +20724,7 @@ export declare class API {
|
|
|
20717
20724
|
name: string;
|
|
20718
20725
|
redirect_url: string | null | undefined;
|
|
20719
20726
|
email: string | null | undefined;
|
|
20727
|
+
internal_reference: string | null | undefined;
|
|
20720
20728
|
pos: import("../types/api").ApiFor<{
|
|
20721
20729
|
getLocations(options?: import("../types/api").RawDataOption | undefined): import("../types/api").RequestData<{
|
|
20722
20730
|
id: string;
|
|
@@ -45,6 +45,7 @@ declare const Consumer: (internalApi: InternalAPI, body: operations[chiftOperati
|
|
|
45
45
|
name: string;
|
|
46
46
|
redirect_url: string | null | undefined;
|
|
47
47
|
email: string | null | undefined;
|
|
48
|
+
internal_reference: string | null | undefined;
|
|
48
49
|
pos: import("../types/api").ApiFor<{
|
|
49
50
|
getLocations(options?: import("../types/api").RawDataOption | undefined): import("../types/api").RequestData<{
|
|
50
51
|
id: string;
|
|
@@ -26,6 +26,7 @@ const Consumer = (internalApi, body) => {
|
|
|
26
26
|
const name = data.name;
|
|
27
27
|
const redirect_url = data.redirect_url;
|
|
28
28
|
const email = data.email;
|
|
29
|
+
const internal_reference = data.internal_reference;
|
|
29
30
|
const pos = (0, openapi_1.createApiFor)(pos_1.posFactory, _internalApi, data.name, consumerId);
|
|
30
31
|
const pms = (0, openapi_1.createApiFor)(pms_1.pmsFactory, _internalApi, data.name, consumerId);
|
|
31
32
|
const payment = (0, openapi_1.createApiFor)(payment_1.paymentFactory, _internalApi, data.name, consumerId);
|
|
@@ -135,6 +136,7 @@ const Consumer = (internalApi, body) => {
|
|
|
135
136
|
name,
|
|
136
137
|
redirect_url,
|
|
137
138
|
email,
|
|
139
|
+
internal_reference,
|
|
138
140
|
pos,
|
|
139
141
|
pms,
|
|
140
142
|
payment,
|
|
@@ -2,7 +2,7 @@ import { operations } from '../types/public-api/schema';
|
|
|
2
2
|
import { InternalAPI } from './internalApi';
|
|
3
3
|
import { chiftOperations } from '../types/public-api/mappings';
|
|
4
4
|
declare const Consumers: (internalApi: InternalAPI) => {
|
|
5
|
-
getConsumers: () => Promise<{
|
|
5
|
+
getConsumers: (params?: operations['consumers_get_consumers']['parameters']['query']) => Promise<{
|
|
6
6
|
consumerId: string;
|
|
7
7
|
getConnections: () => Promise<{
|
|
8
8
|
connectionid: string;
|
|
@@ -76,6 +76,7 @@ declare const Consumers: (internalApi: InternalAPI) => {
|
|
|
76
76
|
name: string;
|
|
77
77
|
redirect_url: string | null | undefined;
|
|
78
78
|
email: string | null | undefined;
|
|
79
|
+
internal_reference: string | null | undefined;
|
|
79
80
|
pos: import("../types/api").ApiFor<{
|
|
80
81
|
getLocations(options?: import("../types/api").RawDataOption | undefined): import("../types/api").RequestData<{
|
|
81
82
|
id: string;
|
|
@@ -5233,6 +5234,7 @@ declare const Consumers: (internalApi: InternalAPI) => {
|
|
|
5233
5234
|
name: string;
|
|
5234
5235
|
redirect_url: string | null | undefined;
|
|
5235
5236
|
email: string | null | undefined;
|
|
5237
|
+
internal_reference: string | null | undefined;
|
|
5236
5238
|
pos: import("../types/api").ApiFor<{
|
|
5237
5239
|
getLocations(options?: import("../types/api").RawDataOption | undefined): import("../types/api").RequestData<{
|
|
5238
5240
|
id: string;
|
|
@@ -10390,6 +10392,7 @@ declare const Consumers: (internalApi: InternalAPI) => {
|
|
|
10390
10392
|
name: string;
|
|
10391
10393
|
redirect_url: string | null | undefined;
|
|
10392
10394
|
email: string | null | undefined;
|
|
10395
|
+
internal_reference: string | null | undefined;
|
|
10393
10396
|
pos: import("../types/api").ApiFor<{
|
|
10394
10397
|
getLocations(options?: import("../types/api").RawDataOption | undefined): import("../types/api").RequestData<{
|
|
10395
10398
|
id: string;
|
|
@@ -15547,6 +15550,7 @@ declare const Consumers: (internalApi: InternalAPI) => {
|
|
|
15547
15550
|
name: string;
|
|
15548
15551
|
redirect_url: string | null | undefined;
|
|
15549
15552
|
email: string | null | undefined;
|
|
15553
|
+
internal_reference: string | null | undefined;
|
|
15550
15554
|
pos: import("../types/api").ApiFor<{
|
|
15551
15555
|
getLocations(options?: import("../types/api").RawDataOption | undefined): import("../types/api").RequestData<{
|
|
15552
15556
|
id: string;
|
|
@@ -20704,6 +20708,7 @@ declare const Consumers: (internalApi: InternalAPI) => {
|
|
|
20704
20708
|
name: string;
|
|
20705
20709
|
redirect_url: string | null | undefined;
|
|
20706
20710
|
email: string | null | undefined;
|
|
20711
|
+
internal_reference: string | null | undefined;
|
|
20707
20712
|
pos: import("../types/api").ApiFor<{
|
|
20708
20713
|
getLocations(options?: import("../types/api").RawDataOption | undefined): import("../types/api").RequestData<{
|
|
20709
20714
|
id: string;
|
|
@@ -13,8 +13,8 @@ exports.Consumers = void 0;
|
|
|
13
13
|
const consumer_1 = require("./consumer");
|
|
14
14
|
const Consumers = (internalApi) => {
|
|
15
15
|
const _internalApi = internalApi;
|
|
16
|
-
const getConsumers = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
-
const { data, } = yield _internalApi.get('/consumers');
|
|
16
|
+
const getConsumers = (params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
const { data, } = yield _internalApi.get('/consumers', { params });
|
|
18
18
|
return data.map((consumer) => (0, consumer_1.Consumer)(_internalApi, consumer));
|
|
19
19
|
});
|
|
20
20
|
const createConsumer = (body) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -97,6 +97,7 @@ declare const Sync: (internalApi: InternalAPI, body: components['schemas']['Read
|
|
|
97
97
|
name: string;
|
|
98
98
|
redirect_url: string | null | undefined;
|
|
99
99
|
email: string | null | undefined;
|
|
100
|
+
internal_reference: string | null | undefined;
|
|
100
101
|
pos: import("../types/api").ApiFor<{
|
|
101
102
|
getLocations(options?: import("../types/api").RawDataOption | undefined): import("../types/api").RequestData<{
|
|
102
103
|
id: string;
|
|
@@ -5277,6 +5278,7 @@ declare const Sync: (internalApi: InternalAPI, body: components['schemas']['Read
|
|
|
5277
5278
|
name: string;
|
|
5278
5279
|
redirect_url: string | null | undefined;
|
|
5279
5280
|
email: string | null | undefined;
|
|
5281
|
+
internal_reference: string | null | undefined;
|
|
5280
5282
|
pos: import("../types/api").ApiFor<{
|
|
5281
5283
|
getLocations(options?: import("../types/api").RawDataOption | undefined): import("../types/api").RequestData<{
|
|
5282
5284
|
id: string;
|
|
@@ -10457,6 +10459,7 @@ declare const Sync: (internalApi: InternalAPI, body: components['schemas']['Read
|
|
|
10457
10459
|
name: string;
|
|
10458
10460
|
redirect_url: string | null | undefined;
|
|
10459
10461
|
email: string | null | undefined;
|
|
10462
|
+
internal_reference: string | null | undefined;
|
|
10460
10463
|
pos: import("../types/api").ApiFor<{
|
|
10461
10464
|
getLocations(options?: import("../types/api").RawDataOption | undefined): import("../types/api").RequestData<{
|
|
10462
10465
|
id: string;
|
|
@@ -15637,6 +15640,7 @@ declare const Sync: (internalApi: InternalAPI, body: components['schemas']['Read
|
|
|
15637
15640
|
name: string;
|
|
15638
15641
|
redirect_url: string | null | undefined;
|
|
15639
15642
|
email: string | null | undefined;
|
|
15643
|
+
internal_reference: string | null | undefined;
|
|
15640
15644
|
pos: import("../types/api").ApiFor<{
|
|
15641
15645
|
getLocations(options?: import("../types/api").RawDataOption | undefined): import("../types/api").RequestData<{
|
|
15642
15646
|
id: string;
|
|
@@ -49,12 +49,14 @@ const client = new chift.API({
|
|
|
49
49
|
const consumerName = 'test consumer';
|
|
50
50
|
const email = 'support@chift.eu';
|
|
51
51
|
const redirect_url = 'https://chift.eu';
|
|
52
|
+
const internalReference = 'test-internal-ref';
|
|
52
53
|
let consumer;
|
|
53
54
|
(0, globals_1.beforeAll)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
54
55
|
consumer = yield client.Consumers.createConsumer({
|
|
55
56
|
email,
|
|
56
57
|
redirect_url,
|
|
57
58
|
name: consumerName,
|
|
59
|
+
internal_reference: internalReference,
|
|
58
60
|
});
|
|
59
61
|
}));
|
|
60
62
|
(0, globals_1.test)('createConsumer', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -77,6 +79,18 @@ let consumer;
|
|
|
77
79
|
const consumers = yield client.Consumers.getConsumers();
|
|
78
80
|
(0, globals_1.expect)(consumers).toBeInstanceOf(Array);
|
|
79
81
|
}));
|
|
82
|
+
(0, globals_1.test)('getConsumers with search param', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
83
|
+
const withSearch = yield client.Consumers.getConsumers({ search: consumerName });
|
|
84
|
+
(0, globals_1.expect)(withSearch).toBeInstanceOf(Array);
|
|
85
|
+
}));
|
|
86
|
+
(0, globals_1.test)('getConsumers with internal_reference param', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
87
|
+
const withInternalRef = yield client.Consumers.getConsumers({
|
|
88
|
+
internal_reference: internalReference,
|
|
89
|
+
});
|
|
90
|
+
(0, globals_1.expect)(withInternalRef).toBeInstanceOf(Array);
|
|
91
|
+
(0, globals_1.expect)(withInternalRef.length).toBeGreaterThanOrEqual(1);
|
|
92
|
+
(0, globals_1.expect)(withInternalRef[0].internal_reference).toBe(internalReference);
|
|
93
|
+
}));
|
|
80
94
|
(0, globals_1.test)('getConsumersByName', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
81
95
|
const consumersWithName = yield client.Consumers.getConsumersByName(consumerName);
|
|
82
96
|
(0, globals_1.expect)(consumersWithName).toBeInstanceOf(Array);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chift/chift-nodejs",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.29",
|
|
4
4
|
"description": "The Chift NodeJS library provides convenient access to the Chift API from applications written in the NodeJS language (Javascript/Typescript).",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|