@virtru/dsp-sdk 0.2.1 → 0.2.3
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/.rush/temp/chunked-rush-logs/dsp-sdk._phase_build.chunks.jsonl +21 -0
- package/.rush/temp/chunked-rush-logs/dsp-sdk._phase_test.chunks.jsonl +30 -0
- package/.rush/temp/package-deps__phase_build.json +7 -7
- package/.rush/temp/shrinkwrap-deps.json +464 -327
- package/CHANGELOG.json +28 -0
- package/CHANGELOG.md +15 -1
- package/dist/tests/dsp-client.test.js +36 -12
- package/dist/tests/dsp.test.js +36 -12
- package/package.json +12 -12
- package/tests/dsp-client.test.ts +42 -14
- package/tests/dsp.test.ts +42 -14
- package/vitest.config.ts +0 -11
- package/.rush/temp/operation/_phase_build/state.json +0 -3
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@virtru/dsp-sdk",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.2.3",
|
|
6
|
+
"tag": "@virtru/dsp-sdk_v0.2.3",
|
|
7
|
+
"date": "Wed, 14 Jan 2026 21:32:11 GMT",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Update @opentdf/sdk dependency",
|
|
12
|
+
"author": "Eugene Yakhnenko <eugene.yakhnenko@virtru.com>",
|
|
13
|
+
"commit": "6e37a9084749630870675ea12bf58b9ba290bef0"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"version": "0.2.2",
|
|
20
|
+
"tag": "@virtru/dsp-sdk_v0.2.2",
|
|
21
|
+
"date": "Thu, 20 Nov 2025 15:03:47 GMT",
|
|
22
|
+
"comments": {
|
|
23
|
+
"patch": [
|
|
24
|
+
{
|
|
25
|
+
"comment": "Upgrade to support node 22",
|
|
26
|
+
"author": "Eugene Yakhnenko <eugene.yakhnenko@virtru.com>",
|
|
27
|
+
"commit": "40b0ce0977a40315dbe806864a41555df7a02170"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
},
|
|
4
32
|
{
|
|
5
33
|
"version": "0.2.1",
|
|
6
34
|
"tag": "@virtru/dsp-sdk_v0.2.1",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
# Change Log - @virtru/dsp-sdk
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 14 Jan 2026 21:32:11 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 0.2.3
|
|
6
|
+
Wed, 14 Jan 2026 21:32:11 GMT
|
|
7
|
+
|
|
8
|
+
### Patches
|
|
9
|
+
|
|
10
|
+
- Update @opentdf/sdk dependency
|
|
11
|
+
|
|
12
|
+
## 0.2.2
|
|
13
|
+
Thu, 20 Nov 2025 15:03:47 GMT
|
|
14
|
+
|
|
15
|
+
### Patches
|
|
16
|
+
|
|
17
|
+
- Upgrade to support node 22
|
|
4
18
|
|
|
5
19
|
## 0.2.1
|
|
6
20
|
Thu, 13 Nov 2025 17:06:33 GMT
|
|
@@ -3,22 +3,46 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Your use of this file is governed by the Virtu Terms of Service <https://www.virtru.com/terms-of-service/>.
|
|
5
5
|
*/
|
|
6
|
-
import { expect, test, vi } from 'vitest';
|
|
7
|
-
import { http, HttpResponse } from 'msw';
|
|
8
|
-
import { setupMSW } from './setup-msw';
|
|
6
|
+
import { expect, test, vi, beforeEach } from 'vitest';
|
|
9
7
|
import { DSPClient } from '../src/index';
|
|
10
8
|
import { mockTaggingPDPResponse } from './mocks/tagging-pdp-tag';
|
|
11
9
|
import { mockCreateExportArtifactsResponse } from './mocks/create-export-artifacts';
|
|
12
10
|
const platformUrl = 'https://dsp.example.com';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
// Mock fetch globally
|
|
12
|
+
const mockFetch = vi.fn();
|
|
13
|
+
global.fetch = mockFetch;
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
mockFetch.mockReset();
|
|
16
|
+
// Setup default mock responses
|
|
17
|
+
mockFetch.mockImplementation(async (url) => {
|
|
18
|
+
if (url.includes('/tagging.pdp.v2.TaggingPDPService/Tag')) {
|
|
19
|
+
return {
|
|
20
|
+
ok: true,
|
|
21
|
+
status: 200,
|
|
22
|
+
json: async () => mockTaggingPDPResponse(),
|
|
23
|
+
headers: new Headers({
|
|
24
|
+
'Content-Type': 'application/json',
|
|
25
|
+
}),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
if (url.includes('/policyimportexport.v1.PolicyArtifactService/CreateExportArtifacts')) {
|
|
29
|
+
return {
|
|
30
|
+
ok: true,
|
|
31
|
+
status: 200,
|
|
32
|
+
json: async () => mockCreateExportArtifactsResponse(),
|
|
33
|
+
headers: new Headers({
|
|
34
|
+
'Content-Type': 'application/json',
|
|
35
|
+
}),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
ok: false,
|
|
40
|
+
status: 404,
|
|
41
|
+
json: async () => ({}),
|
|
42
|
+
headers: new Headers(),
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
});
|
|
22
46
|
test('should create a new DSPClient instance with platformUrl', async () => {
|
|
23
47
|
const client = new DSPClient({ platformUrl });
|
|
24
48
|
expect(client).toBeInstanceOf(DSPClient);
|
package/dist/tests/dsp.test.js
CHANGED
|
@@ -3,29 +3,53 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Your use of this file is governed by the Virtu Terms of Service <https://www.virtru.com/terms-of-service/>.
|
|
5
5
|
*/
|
|
6
|
-
import { expect, test, vi } from 'vitest';
|
|
7
|
-
import { http, HttpResponse } from 'msw';
|
|
8
|
-
import { setupMSW } from './setup-msw';
|
|
6
|
+
import { expect, test, vi, beforeEach } from 'vitest';
|
|
9
7
|
import { DSP } from '../src';
|
|
10
8
|
import { mockTaggingPDPResponse } from './mocks/tagging-pdp-tag';
|
|
11
9
|
import { HttpRequest, withHeaders } from '@opentdf/sdk';
|
|
12
10
|
import { mockWellKnownConfiguration } from './mocks/well-known-configuration';
|
|
13
11
|
const platformUrl = 'https://dsp.example.com';
|
|
12
|
+
// Mock fetch globally
|
|
13
|
+
const mockFetch = vi.fn();
|
|
14
|
+
global.fetch = mockFetch;
|
|
14
15
|
const authProvider = {
|
|
15
16
|
updateClientPublicKey: async () => { },
|
|
16
17
|
withCreds: async (req) => withHeaders(req, {
|
|
17
18
|
Authorization: 'Bearer dummy auth token for testing purposes',
|
|
18
19
|
}),
|
|
19
20
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
beforeEach(() => {
|
|
22
|
+
mockFetch.mockReset();
|
|
23
|
+
// Setup default mock responses
|
|
24
|
+
mockFetch.mockImplementation(async (url) => {
|
|
25
|
+
if (url.includes('/tagging.pdp.v2.TaggingPDPService/Tag')) {
|
|
26
|
+
return {
|
|
27
|
+
ok: true,
|
|
28
|
+
status: 200,
|
|
29
|
+
json: async () => mockTaggingPDPResponse(),
|
|
30
|
+
headers: new Headers({
|
|
31
|
+
'Content-Type': 'application/json',
|
|
32
|
+
}),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
if (url.includes('/wellknownconfiguration.WellKnownService/GetWellKnownConfiguration')) {
|
|
36
|
+
return {
|
|
37
|
+
ok: true,
|
|
38
|
+
status: 200,
|
|
39
|
+
json: async () => mockWellKnownConfiguration(),
|
|
40
|
+
headers: new Headers({
|
|
41
|
+
'Content-Type': 'application/json',
|
|
42
|
+
}),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
ok: false,
|
|
47
|
+
status: 404,
|
|
48
|
+
json: async () => ({}),
|
|
49
|
+
headers: new Headers(),
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
});
|
|
29
53
|
test('should create a new DSP instance with platformUrl', () => {
|
|
30
54
|
const dsp = new DSP({ platformUrl, authProvider });
|
|
31
55
|
expect(dsp).toBeInstanceOf(DSP);
|
package/package.json
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@virtru/dsp-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
|
+
"types": "./dist/src/index.d.ts",
|
|
8
9
|
"import": "./dist/src/index.js",
|
|
9
|
-
"require": "./dist-commonjs/src/index.js"
|
|
10
|
-
"types": "./dist/src/index.d.ts"
|
|
10
|
+
"require": "./dist-commonjs/src/index.js"
|
|
11
11
|
},
|
|
12
12
|
"./platform/*": {
|
|
13
|
+
"types": "./dist/src/gen/*.d.ts",
|
|
13
14
|
"import": "./dist/src/gen/*.js",
|
|
14
|
-
"require": "./dist-commonjs/src/gen/*.js"
|
|
15
|
-
"types": "./dist/src/gen/*.d.ts"
|
|
15
|
+
"require": "./dist-commonjs/src/gen/*.js"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"engines": {
|
|
19
19
|
"node": ">=18.0.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@types/node": "^
|
|
23
|
-
"@vitest/browser": "
|
|
22
|
+
"@types/node": "^22.0.0",
|
|
23
|
+
"@vitest/browser": "~3.1.3",
|
|
24
24
|
"globals": "^16.3.0",
|
|
25
25
|
"jsdom": "^22.1.0",
|
|
26
26
|
"msw": "^2.8.4",
|
|
@@ -28,21 +28,21 @@
|
|
|
28
28
|
"vite": "^4.5.14",
|
|
29
29
|
"vite-plugin-dts": "^4.5.4",
|
|
30
30
|
"vitest": "~3.1.3",
|
|
31
|
-
"typescript": "
|
|
31
|
+
"typescript": "5.8.2"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@bufbuild/protobuf": "^2.7.0",
|
|
35
35
|
"@connectrpc/connect": "~2.0.2",
|
|
36
36
|
"@connectrpc/connect-web": "~2.0.2",
|
|
37
|
-
"@opentdf/sdk": "0.
|
|
37
|
+
"@opentdf/sdk": "0.8.0-rc.73",
|
|
38
38
|
"@rushstack/heft": "^0.50.0"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "heft build --clean",
|
|
42
42
|
"lint": "eslint .",
|
|
43
43
|
"lint:fix": "eslint . --fix",
|
|
44
|
-
"test": "npx vitest --run
|
|
45
|
-
"
|
|
46
|
-
"_phase:
|
|
44
|
+
"test": "npx vitest --run",
|
|
45
|
+
"_phase:build": "heft build --clean",
|
|
46
|
+
"_phase:test": "npm run test && heft test --no-build"
|
|
47
47
|
}
|
|
48
48
|
}
|
package/tests/dsp-client.test.ts
CHANGED
|
@@ -4,28 +4,56 @@
|
|
|
4
4
|
* Your use of this file is governed by the Virtu Terms of Service <https://www.virtru.com/terms-of-service/>.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { expect, test, vi } from 'vitest';
|
|
8
|
-
import { http, HttpResponse } from 'msw';
|
|
9
|
-
import { setupMSW } from './setup-msw';
|
|
7
|
+
import { expect, test, vi, beforeEach } from 'vitest';
|
|
10
8
|
import { DSPClient } from '../src/index';
|
|
11
9
|
import { mockTaggingPDPResponse } from './mocks/tagging-pdp-tag';
|
|
12
10
|
import { mockCreateExportArtifactsResponse } from './mocks/create-export-artifacts';
|
|
13
11
|
|
|
14
12
|
const platformUrl = 'https://dsp.example.com';
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
// Mock fetch globally
|
|
15
|
+
const mockFetch = vi.fn();
|
|
16
|
+
global.fetch = mockFetch;
|
|
17
|
+
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
mockFetch.mockReset();
|
|
20
|
+
|
|
21
|
+
// Setup default mock responses
|
|
22
|
+
mockFetch.mockImplementation(async (url: string) => {
|
|
23
|
+
if (url.includes('/tagging.pdp.v2.TaggingPDPService/Tag')) {
|
|
24
|
+
return {
|
|
25
|
+
ok: true,
|
|
26
|
+
status: 200,
|
|
27
|
+
json: async () => mockTaggingPDPResponse(),
|
|
28
|
+
headers: new Headers({
|
|
29
|
+
'Content-Type': 'application/json',
|
|
30
|
+
}),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (
|
|
35
|
+
url.includes(
|
|
36
|
+
'/policyimportexport.v1.PolicyArtifactService/CreateExportArtifacts'
|
|
37
|
+
)
|
|
38
|
+
) {
|
|
39
|
+
return {
|
|
40
|
+
ok: true,
|
|
41
|
+
status: 200,
|
|
42
|
+
json: async () => mockCreateExportArtifactsResponse(),
|
|
43
|
+
headers: new Headers({
|
|
44
|
+
'Content-Type': 'application/json',
|
|
45
|
+
}),
|
|
46
|
+
};
|
|
24
47
|
}
|
|
25
|
-
),
|
|
26
|
-
];
|
|
27
48
|
|
|
28
|
-
|
|
49
|
+
return {
|
|
50
|
+
ok: false,
|
|
51
|
+
status: 404,
|
|
52
|
+
json: async () => ({}),
|
|
53
|
+
headers: new Headers(),
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
});
|
|
29
57
|
|
|
30
58
|
test('should create a new DSPClient instance with platformUrl', async () => {
|
|
31
59
|
const client = new DSPClient({ platformUrl });
|
package/tests/dsp.test.ts
CHANGED
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
* Your use of this file is governed by the Virtu Terms of Service <https://www.virtru.com/terms-of-service/>.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { expect, test, vi } from 'vitest';
|
|
8
|
-
import { http, HttpResponse } from 'msw';
|
|
9
|
-
import { setupMSW } from './setup-msw';
|
|
7
|
+
import { expect, test, vi, beforeEach } from 'vitest';
|
|
10
8
|
import { DSP } from '../src';
|
|
11
9
|
import { mockTaggingPDPResponse } from './mocks/tagging-pdp-tag';
|
|
12
10
|
import { type AuthProvider, HttpRequest, withHeaders } from '@opentdf/sdk';
|
|
@@ -14,6 +12,10 @@ import { mockWellKnownConfiguration } from './mocks/well-known-configuration';
|
|
|
14
12
|
|
|
15
13
|
const platformUrl = 'https://dsp.example.com';
|
|
16
14
|
|
|
15
|
+
// Mock fetch globally
|
|
16
|
+
const mockFetch = vi.fn();
|
|
17
|
+
global.fetch = mockFetch;
|
|
18
|
+
|
|
17
19
|
const authProvider = <AuthProvider>{
|
|
18
20
|
updateClientPublicKey: async () => {},
|
|
19
21
|
withCreds: async (req: HttpRequest): Promise<HttpRequest> =>
|
|
@@ -22,19 +24,45 @@ const authProvider = <AuthProvider>{
|
|
|
22
24
|
}),
|
|
23
25
|
};
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
beforeEach(() => {
|
|
28
|
+
mockFetch.mockReset();
|
|
29
|
+
|
|
30
|
+
// Setup default mock responses
|
|
31
|
+
mockFetch.mockImplementation(async (url: string) => {
|
|
32
|
+
if (url.includes('/tagging.pdp.v2.TaggingPDPService/Tag')) {
|
|
33
|
+
return {
|
|
34
|
+
ok: true,
|
|
35
|
+
status: 200,
|
|
36
|
+
json: async () => mockTaggingPDPResponse(),
|
|
37
|
+
headers: new Headers({
|
|
38
|
+
'Content-Type': 'application/json',
|
|
39
|
+
}),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (
|
|
44
|
+
url.includes(
|
|
45
|
+
'/wellknownconfiguration.WellKnownService/GetWellKnownConfiguration'
|
|
46
|
+
)
|
|
47
|
+
) {
|
|
48
|
+
return {
|
|
49
|
+
ok: true,
|
|
50
|
+
status: 200,
|
|
51
|
+
json: async () => mockWellKnownConfiguration(),
|
|
52
|
+
headers: new Headers({
|
|
53
|
+
'Content-Type': 'application/json',
|
|
54
|
+
}),
|
|
55
|
+
};
|
|
33
56
|
}
|
|
34
|
-
),
|
|
35
|
-
];
|
|
36
57
|
|
|
37
|
-
|
|
58
|
+
return {
|
|
59
|
+
ok: false,
|
|
60
|
+
status: 404,
|
|
61
|
+
json: async () => ({}),
|
|
62
|
+
headers: new Headers(),
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
});
|
|
38
66
|
|
|
39
67
|
test('should create a new DSP instance with platformUrl', () => {
|
|
40
68
|
const dsp = new DSP({ platformUrl, authProvider });
|
package/vitest.config.ts
CHANGED
|
@@ -12,17 +12,6 @@ export default defineConfig({
|
|
|
12
12
|
test: {
|
|
13
13
|
environment: 'jsdom',
|
|
14
14
|
globals: true,
|
|
15
|
-
browser: {
|
|
16
|
-
headless: true,
|
|
17
|
-
provider: 'playwright',
|
|
18
|
-
enabled: true,
|
|
19
|
-
instances: [
|
|
20
|
-
{
|
|
21
|
-
browser: 'chromium',
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
viewport: { width: 640, height: 480 },
|
|
25
|
-
},
|
|
26
15
|
setupFiles: [],
|
|
27
16
|
},
|
|
28
17
|
build: {
|