@or-sdk/lookup 1.18.1 → 1.19.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/CHANGELOG.md +9 -0
- package/dist/cjs/__tests__/QnA.collections.spec.js +14 -13
- package/dist/cjs/__tests__/QnA.collections.spec.js.map +1 -1
- package/dist/esm/__tests__/QnA.collections.spec.js +11 -11
- package/dist/esm/__tests__/QnA.collections.spec.js.map +1 -1
- package/package.json +11 -14
- package/src/__tests__/QnA.collections.spec.ts +18 -24
- package/{vitest.config.js → vitest.config.mts} +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.19.0](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/compare/@or-sdk/lookup@1.18.1...@or-sdk/lookup@1.19.0) (2025-05-10)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **users:** Add super admin method 'upsertMultiUser' ([448b2c9](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/commit/448b2c99e6a0a392f965f2b386c00a6d286b44ae))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
## [1.18.1](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/compare/@or-sdk/lookup@1.18.0...@or-sdk/lookup@1.18.1) (2025-05-07)
|
|
7
16
|
|
|
8
17
|
**Note:** Version bump only for package @or-sdk/lookup
|
|
@@ -55,39 +55,40 @@ var node_1 = require("msw/node");
|
|
|
55
55
|
var vitest_1 = require("vitest");
|
|
56
56
|
var __1 = require("..");
|
|
57
57
|
var collection_json_1 = __importDefault(require("./fixtures/collection.json"));
|
|
58
|
-
var server = (0, node_1.setupServer)(msw_1.
|
|
58
|
+
var server = (0, node_1.setupServer)(msw_1.http.post('https://lookup-api.svc.url/collections', function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
59
59
|
var body;
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
var request = _b.request;
|
|
61
|
+
return __generator(this, function (_c) {
|
|
62
|
+
switch (_c.label) {
|
|
62
63
|
case 0:
|
|
63
|
-
if (
|
|
64
|
-
return [2,
|
|
64
|
+
if (request.headers.get('authorization') !== 'valid-auth-token') {
|
|
65
|
+
return [2, new msw_1.HttpResponse(null, { status: 401 })];
|
|
65
66
|
}
|
|
66
|
-
return [4,
|
|
67
|
+
return [4, request.json()];
|
|
67
68
|
case 1:
|
|
68
|
-
body =
|
|
69
|
+
body = _c.sent();
|
|
69
70
|
if (body.ise === true) {
|
|
70
|
-
return [2,
|
|
71
|
+
return [2, msw_1.HttpResponse.json({
|
|
71
72
|
error: 'Some tech error message here',
|
|
72
73
|
statusCode: 500,
|
|
73
|
-
})
|
|
74
|
+
}, { status: 500 })];
|
|
74
75
|
}
|
|
75
76
|
if (typeof body.name === 'string' && body.name.length < 3) {
|
|
76
|
-
return [2,
|
|
77
|
+
return [2, msw_1.HttpResponse.json({
|
|
77
78
|
error: [
|
|
78
79
|
'name must be longer than or equal to 5 characters',
|
|
79
80
|
'Can start only with a letter.',
|
|
80
81
|
],
|
|
81
82
|
statusCode: 400,
|
|
82
|
-
})
|
|
83
|
+
}, { status: 400 })];
|
|
83
84
|
}
|
|
84
|
-
return [2,
|
|
85
|
+
return [2, msw_1.HttpResponse.json(collection_json_1.default)];
|
|
85
86
|
}
|
|
86
87
|
});
|
|
87
88
|
}); }));
|
|
88
89
|
var createLookupInstance = function (opts) {
|
|
89
90
|
if (opts === void 0) { opts = {}; }
|
|
90
|
-
return new __1.Lookup(__assign({ serviceUrl: 'https://lookup-api.svc.
|
|
91
|
+
return new __1.Lookup(__assign({ serviceUrl: 'https://lookup-api.svc.url', token: 'valid-auth-token' }, opts));
|
|
91
92
|
};
|
|
92
93
|
(0, vitest_1.describe)('Lookup', function () {
|
|
93
94
|
(0, vitest_1.beforeAll)(function () { return server.listen(); });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QnA.collections.spec.js","sourceRoot":"","sources":["../../../src/__tests__/QnA.collections.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"QnA.collections.spec.js","sourceRoot":"","sources":["../../../src/__tests__/QnA.collections.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAAyC;AACzC,iCAAuC;AACvC,iCAA8E;AAE9E,wBAA4B;AAG5B,+EAAoD;AAEpD,IAAM,MAAM,GAAG,IAAA,kBAAW,EACxB,UAAI,CAAC,IAAI,CAAC,wCAAwC,EAAE,iEAAO,EAAW;;QAAT,OAAO,aAAA;;;;gBAClE,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,kBAAkB,EAAE,CAAC;oBAChE,WAAO,IAAI,kBAAY,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAC;gBACjD,CAAC;gBACY,WAAM,OAAO,CAAC,IAAI,EAAE,EAAA;;gBAA3B,IAAI,GAAG,SAA+C;gBAC5D,IAAI,IAAI,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;oBACtB,WAAO,kBAAY,CAAC,IAAI,CAAC;4BACvB,KAAK,EAAE,8BAA8B;4BACrC,UAAU,EAAE,GAAG;yBAChB,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAC;gBACtB,CAAC;gBACD,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC1D,WAAO,kBAAY,CAAC,IAAI,CAAC;4BACvB,KAAK,EAAE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,oBAAoB,CAAC;wBAClC,KAAK,EAAE,eAAe;qBACvB,CAAC,CAAC;oBAEG,OAAO,GAAG,MAAM,CAAC,gBAAgB,CAAC;wBACtC,IAAI,EAAE,gBAAgB;qBACvB,CAAC,CAAC;oBAEH,WAAM,IAAA,eAAM,EAAC,OAAO,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;4BAC1C,MAAM,EAAE,GAAG;4BACX,OAAO,EAAE,qCAAqC;yBAC/C,CAAC,EAAA;;oBAHF,SAGE,CAAC;;;;SACJ,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,wCAAwC,EAAE;;;;;oBACrC,MAAM,GAAG,oBAAoB,EAAE,CAAC;oBAEhC,OAAO,GAAG,MAAM,CAAC,gBAAgB,CAAC;wBACtC,IAAI,EAAE,GAAG;qBACV,CAAC,CAAC;oBAEH,WAAM,IAAA,eAAM,EAAC,OAAO,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;4BAC1C,MAAM,EAAE,GAAG;4BACX,OAAO,EAAE,kFAAkF;yBAC5F,CAAC,EAAA;;oBAHF,SAGE,CAAC;;;;SACJ,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -7,35 +7,35 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { http, HttpResponse } from 'msw';
|
|
11
11
|
import { setupServer } from 'msw/node';
|
|
12
12
|
import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest';
|
|
13
13
|
import { Lookup } from '..';
|
|
14
14
|
import collection from './fixtures/collection.json';
|
|
15
|
-
const server = setupServer(
|
|
16
|
-
if (
|
|
17
|
-
return
|
|
15
|
+
const server = setupServer(http.post('https://lookup-api.svc.url/collections', (_a) => __awaiter(void 0, [_a], void 0, function* ({ request }) {
|
|
16
|
+
if (request.headers.get('authorization') !== 'valid-auth-token') {
|
|
17
|
+
return new HttpResponse(null, { status: 401 });
|
|
18
18
|
}
|
|
19
|
-
const body = yield
|
|
19
|
+
const body = yield request.json();
|
|
20
20
|
if (body.ise === true) {
|
|
21
|
-
return
|
|
21
|
+
return HttpResponse.json({
|
|
22
22
|
error: 'Some tech error message here',
|
|
23
23
|
statusCode: 500,
|
|
24
|
-
})
|
|
24
|
+
}, { status: 500 });
|
|
25
25
|
}
|
|
26
26
|
if (typeof body.name === 'string' && body.name.length < 3) {
|
|
27
|
-
return
|
|
27
|
+
return HttpResponse.json({
|
|
28
28
|
error: [
|
|
29
29
|
'name must be longer than or equal to 5 characters',
|
|
30
30
|
'Can start only with a letter.',
|
|
31
31
|
],
|
|
32
32
|
statusCode: 400,
|
|
33
|
-
})
|
|
33
|
+
}, { status: 400 });
|
|
34
34
|
}
|
|
35
|
-
return
|
|
35
|
+
return HttpResponse.json(collection);
|
|
36
36
|
})));
|
|
37
37
|
const createLookupInstance = (opts = {}) => {
|
|
38
|
-
return new Lookup(Object.assign({ serviceUrl: 'https://lookup-api.svc.
|
|
38
|
+
return new Lookup(Object.assign({ serviceUrl: 'https://lookup-api.svc.url', token: 'valid-auth-token' }, opts));
|
|
39
39
|
};
|
|
40
40
|
describe('Lookup', () => {
|
|
41
41
|
beforeAll(() => server.listen());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QnA.collections.spec.js","sourceRoot":"","sources":["../../../src/__tests__/QnA.collections.spec.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"QnA.collections.spec.js","sourceRoot":"","sources":["../../../src/__tests__/QnA.collections.spec.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,QAA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M,MAAM,GAAG,oBAAoB,EAAE,CAAC;QAEtC,MAAM,OAAO,GAAG,MAAM,CAAC,gBAAgB,CAAC;YACtC,IAAI,EAAE,GAAG;SACV,CAAC,CAAC;QAEH,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;YAC1C,MAAM,EAAE,GAAG;YACX,OAAO,EAAE,kFAAkF;SAC5F,CAAC,CAAC;IACL,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,39 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@or-sdk/lookup",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/types/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"build": "pnpm clean && pnpm
|
|
9
|
+
"build": "pnpm clean && concurrently 'pnpm:build:*(!watch)'",
|
|
10
10
|
"build:cjs": "tsc --project tsconfig.json",
|
|
11
11
|
"build:esm": "tsc --project tsconfig.esm.json",
|
|
12
12
|
"build:types": "tsc --project tsconfig.types.json",
|
|
13
|
-
"build:watch": "concurrently -r --hide 1,2
|
|
14
|
-
"build:watch:cjs": "
|
|
15
|
-
"build:watch:esm": "
|
|
16
|
-
"build:watch:types": "
|
|
13
|
+
"build:watch": "concurrently -r --hide 1,2 'pnpm:build:watch:*'",
|
|
14
|
+
"build:watch:cjs": "pnpm build:cjs -w",
|
|
15
|
+
"build:watch:esm": "pnpm build:esm -w",
|
|
16
|
+
"build:watch:types": "pnpm build:types -w",
|
|
17
17
|
"clean": "rm -rf ./dist",
|
|
18
18
|
"coverage": "vitest run --coverage",
|
|
19
19
|
"dev": "pnpm build:watch:esm",
|
|
20
|
-
"test": "vitest",
|
|
20
|
+
"test": "vitest --run",
|
|
21
21
|
"test:watch": "vitest --watch"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@or-sdk/base": "^0.
|
|
25
|
-
"lodash": "^4.17.21"
|
|
24
|
+
"@or-sdk/base": "^0.42.0"
|
|
26
25
|
},
|
|
27
26
|
"devDependencies": {
|
|
28
|
-
"@types/lodash": "^4.14.176",
|
|
29
|
-
"@vitest/coverage-c8": "^0.31.1",
|
|
30
27
|
"concurrently": "9.0.1",
|
|
31
|
-
"msw": "
|
|
28
|
+
"msw": "2.8.2",
|
|
32
29
|
"typescript": "5.6.2",
|
|
33
|
-
"vitest": "^
|
|
30
|
+
"vitest": "^3.1.3"
|
|
34
31
|
},
|
|
35
32
|
"publishConfig": {
|
|
36
33
|
"access": "public"
|
|
37
34
|
},
|
|
38
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "7c8a6a4bcd0ea2a445262dd9fc5a8cfd6974c8b0"
|
|
39
36
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { http, HttpResponse } from 'msw';
|
|
2
2
|
import { setupServer } from 'msw/node';
|
|
3
3
|
import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest';
|
|
4
4
|
|
|
@@ -8,39 +8,33 @@ import type { LookupConfig } from '..';
|
|
|
8
8
|
import collection from './fixtures/collection.json';
|
|
9
9
|
|
|
10
10
|
const server = setupServer(
|
|
11
|
-
|
|
12
|
-
if (
|
|
13
|
-
return
|
|
11
|
+
http.post('https://lookup-api.svc.url/collections', async ({ request }) => {
|
|
12
|
+
if (request.headers.get('authorization') !== 'valid-auth-token') {
|
|
13
|
+
return new HttpResponse(null, { status: 401 });
|
|
14
14
|
}
|
|
15
|
-
const body = await
|
|
15
|
+
const body = await request.json() as Record<string, unknown>;
|
|
16
16
|
if (body.ise === true) {
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
statusCode: 500,
|
|
22
|
-
})
|
|
23
|
-
);
|
|
17
|
+
return HttpResponse.json({
|
|
18
|
+
error: 'Some tech error message here',
|
|
19
|
+
statusCode: 500,
|
|
20
|
+
}, { status: 500 });
|
|
24
21
|
}
|
|
25
22
|
if (typeof body.name === 'string' && body.name.length < 3) {
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
statusCode: 400,
|
|
34
|
-
})
|
|
35
|
-
);
|
|
23
|
+
return HttpResponse.json({
|
|
24
|
+
error: [
|
|
25
|
+
'name must be longer than or equal to 5 characters',
|
|
26
|
+
'Can start only with a letter.',
|
|
27
|
+
],
|
|
28
|
+
statusCode: 400,
|
|
29
|
+
}, { status: 400 });
|
|
36
30
|
}
|
|
37
|
-
return
|
|
31
|
+
return HttpResponse.json(collection);
|
|
38
32
|
}),
|
|
39
33
|
);
|
|
40
34
|
|
|
41
35
|
const createLookupInstance = (opts: Partial<LookupConfig> = {}) => {
|
|
42
36
|
return new Lookup({
|
|
43
|
-
serviceUrl: 'https://lookup-api.svc.
|
|
37
|
+
serviceUrl: 'https://lookup-api.svc.url',
|
|
44
38
|
token: 'valid-auth-token',
|
|
45
39
|
...opts,
|
|
46
40
|
});
|