@virtru/dsp-sdk 0.1.10-pr604.7ef7a158

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.
Files changed (77) hide show
  1. package/.prettierrc +3 -0
  2. package/.rush/temp/operation/_phase_build/state.json +3 -0
  3. package/.rush/temp/package-deps__phase_build.json +41 -0
  4. package/.rush/temp/shrinkwrap-deps.json +329 -0
  5. package/CHANGELOG.json +103 -0
  6. package/CHANGELOG.md +53 -0
  7. package/README.md +98 -0
  8. package/dist/src/gen/buf/validate/validate_pb.d.ts +4517 -0
  9. package/dist/src/gen/buf/validate/validate_pb.js +484 -0
  10. package/dist/src/gen/config/v1/config_pb.d.ts +88 -0
  11. package/dist/src/gen/config/v1/config_pb.js +46 -0
  12. package/dist/src/gen/config/v1/meta_pb.d.ts +37 -0
  13. package/dist/src/gen/config/v1/meta_pb.js +33 -0
  14. package/dist/src/gen/config/v1/tagging_pb.d.ts +264 -0
  15. package/dist/src/gen/config/v1/tagging_pb.js +188 -0
  16. package/dist/src/gen/google/api/annotations_pb.d.ts +13 -0
  17. package/dist/src/gen/google/api/annotations_pb.js +30 -0
  18. package/dist/src/gen/google/api/http_pb.d.ts +440 -0
  19. package/dist/src/gen/google/api/http_pb.js +41 -0
  20. package/dist/src/gen/policyimportexport/v1/policy_import_export_pb.d.ts +241 -0
  21. package/dist/src/gen/policyimportexport/v1/policy_import_export_pb.js +89 -0
  22. package/dist/src/gen/shared/v1/shared_pb.d.ts +172 -0
  23. package/dist/src/gen/shared/v1/shared_pb.js +92 -0
  24. package/dist/src/gen/tagging/pdp/v2/tagging_pb.d.ts +872 -0
  25. package/dist/src/gen/tagging/pdp/v2/tagging_pb.js +274 -0
  26. package/dist/src/gen/version/v1/version_pb.d.ts +96 -0
  27. package/dist/src/gen/version/v1/version_pb.js +37 -0
  28. package/dist/src/index.d.ts +21 -0
  29. package/dist/src/index.js +28 -0
  30. package/dist/src/lib/client.d.ts +33 -0
  31. package/dist/src/lib/client.js +60 -0
  32. package/dist/src/lib/dsp.d.ts +18 -0
  33. package/dist/src/lib/dsp.js +44 -0
  34. package/dist/src/lib/utils.d.ts +15 -0
  35. package/dist/src/lib/utils.js +35 -0
  36. package/dist/tests/dsp-client.test.d.ts +1 -0
  37. package/dist/tests/dsp-client.test.js +49 -0
  38. package/dist/tests/dsp.test.d.ts +1 -0
  39. package/dist/tests/dsp.test.js +71 -0
  40. package/dist/tests/mocks/create-export-artifacts.d.ts +2 -0
  41. package/dist/tests/mocks/create-export-artifacts.js +13 -0
  42. package/dist/tests/mocks/tagging-pdp-tag.d.ts +2 -0
  43. package/dist/tests/mocks/tagging-pdp-tag.js +11 -0
  44. package/dist/tests/mocks/well-known-configuration.d.ts +2 -0
  45. package/dist/tests/mocks/well-known-configuration.js +12 -0
  46. package/dist/tests/setup-msw.d.ts +9 -0
  47. package/dist/tests/setup-msw.js +30 -0
  48. package/eslint.config.mjs +28 -0
  49. package/package.json +47 -0
  50. package/src/gen/buf/validate/validate_pb.ts +4879 -0
  51. package/src/gen/config/formatters/testdata/v1/test_pb.ts +287 -0
  52. package/src/gen/config/v1/config_pb.ts +137 -0
  53. package/src/gen/config/v1/meta_pb.ts +72 -0
  54. package/src/gen/config/v1/tagging_pb.ts +355 -0
  55. package/src/gen/google/api/annotations_pb.ts +43 -0
  56. package/src/gen/google/api/http_pb.ts +486 -0
  57. package/src/gen/helloworld/v1/helloworld_pb.ts +98 -0
  58. package/src/gen/policyimportexport/v1/policy_import_export_pb.ts +324 -0
  59. package/src/gen/shared/v1/shared_pb.ts +240 -0
  60. package/src/gen/shared/v2/shared_pb.ts +122 -0
  61. package/src/gen/tagging/pdp/v2/externalprocessors/processor_pb.ts +709 -0
  62. package/src/gen/tagging/pdp/v2/stanag/stanag_pb.ts +953 -0
  63. package/src/gen/tagging/pdp/v2/tagging_pb.ts +1064 -0
  64. package/src/gen/version/v1/version_pb.ts +143 -0
  65. package/src/index.ts +49 -0
  66. package/src/lib/client.ts +83 -0
  67. package/src/lib/dsp.ts +65 -0
  68. package/src/lib/utils.ts +43 -0
  69. package/src/vite-env.d.ts +7 -0
  70. package/tests/dsp-client.test.ts +67 -0
  71. package/tests/dsp.test.ts +95 -0
  72. package/tests/mocks/create-export-artifacts.ts +16 -0
  73. package/tests/mocks/tagging-pdp-tag.ts +13 -0
  74. package/tests/mocks/well-known-configuration.ts +15 -0
  75. package/tests/setup-msw.ts +35 -0
  76. package/tsconfig.json +32 -0
  77. package/vitest.config.ts +42 -0
@@ -0,0 +1,274 @@
1
+ /*
2
+ * Copyright (c) Virtru Corporation. All rights reserved.
3
+ *
4
+ * Your use of this file is governed by the Virtu Terms of Service <https://www.virtru.com/terms-of-service/>.
5
+ */
6
+ import { enumDesc, fileDesc, messageDesc, serviceDesc, } from '@bufbuild/protobuf/codegenv1';
7
+ import { file_google_api_annotations } from '../../../google/api/annotations_pb';
8
+ import { file_google_protobuf_any, file_google_protobuf_timestamp, } from '@bufbuild/protobuf/wkt';
9
+ /**
10
+ * Describes the file tagging/pdp/v2/tagging.proto.
11
+ */
12
+ export const file_tagging_pdp_v2_tagging =
13
+ /*@__PURE__*/
14
+ fileDesc('Chx0YWdnaW5nL3BkcC92Mi90YWdnaW5nLnByb3RvEg50YWdnaW5nLnBkcC52MiKBAQoeU3RyZWFtaW5nVGFnZ2luZ1BEUFJlcXVlc3REZXNjEhEKBHR5cGUYASABKAlIAIgBARI3CgdvcHRpb25zGAMgASgLMiEudGFnZ2luZy5wZHAudjIuVGFnUmVxdWVzdE9wdGlvbnNIAYgBAUIHCgVfdHlwZUIKCghfb3B0aW9ucyKzAQoaU3RyZWFtaW5nVGFnZ2luZ1BEUFJlcXVlc3QSQQoHcmVxRGVzYxgBIAEoCzIuLnRhZ2dpbmcucGRwLnYyLlN0cmVhbWluZ1RhZ2dpbmdQRFBSZXF1ZXN0RGVzY0gAEjMKCGl0ZW1EZXNjGAIgASgLMh8udGFnZ2luZy5wZHAudjIuQ29udGVudEl0ZW1EZX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file_google_protobuf_any,
17
+ file_google_protobuf_timestamp,
18
+ ]);
19
+ /**
20
+ * Describes the message tagging.pdp.v2.StreamingTaggingPDPRequestDesc.
21
+ * Use `create(StreamingTaggingPDPRequestDescSchema)` to create a new message.
22
+ */
23
+ export const StreamingTaggingPDPRequestDescSchema =
24
+ /*@__PURE__*/
25
+ messageDesc(file_tagging_pdp_v2_tagging, 0);
26
+ /**
27
+ * Describes the message tagging.pdp.v2.StreamingTaggingPDPRequest.
28
+ * Use `create(StreamingTaggingPDPRequestSchema)` to create a new message.
29
+ */
30
+ export const StreamingTaggingPDPRequestSchema =
31
+ /*@__PURE__*/
32
+ messageDesc(file_tagging_pdp_v2_tagging, 1);
33
+ /**
34
+ * Describes the message tagging.pdp.v2.TaggingPDPRequest.
35
+ * Use `create(TaggingPDPRequestSchema)` to create a new message.
36
+ */
37
+ export const TaggingPDPRequestSchema =
38
+ /*@__PURE__*/
39
+ messageDesc(file_tagging_pdp_v2_tagging, 2);
40
+ /**
41
+ * Describes the message tagging.pdp.v2.ProcessTagsRequest.
42
+ * Use `create(ProcessTagsRequestSchema)` to create a new message.
43
+ */
44
+ export const ProcessTagsRequestSchema =
45
+ /*@__PURE__*/
46
+ messageDesc(file_tagging_pdp_v2_tagging, 3);
47
+ /**
48
+ * Describes the message tagging.pdp.v2.ProcessingEvent.
49
+ * Use `create(ProcessingEventSchema)` to create a new message.
50
+ */
51
+ export const ProcessingEventSchema =
52
+ /*@__PURE__*/
53
+ messageDesc(file_tagging_pdp_v2_tagging, 4);
54
+ /**
55
+ * @generated from enum tagging.pdp.v2.ProcessingEvent.Level
56
+ */
57
+ export var ProcessingEvent_Level;
58
+ (function (ProcessingEvent_Level) {
59
+ /**
60
+ * @generated from enum value: ERROR = 0;
61
+ */
62
+ ProcessingEvent_Level[ProcessingEvent_Level["ERROR"] = 0] = "ERROR";
63
+ /**
64
+ * @generated from enum value: WARN = 1;
65
+ */
66
+ ProcessingEvent_Level[ProcessingEvent_Level["WARN"] = 1] = "WARN";
67
+ })(ProcessingEvent_Level || (ProcessingEvent_Level = {}));
68
+ /**
69
+ * Describes the enum tagging.pdp.v2.ProcessingEvent.Level.
70
+ */
71
+ export const ProcessingEvent_LevelSchema =
72
+ /*@__PURE__*/
73
+ enumDesc(file_tagging_pdp_v2_tagging, 4, 0);
74
+ /**
75
+ * Describes the message tagging.pdp.v2.ProcessTagsResponse.
76
+ * Use `create(ProcessTagsResponseSchema)` to create a new message.
77
+ */
78
+ export const ProcessTagsResponseSchema =
79
+ /*@__PURE__*/
80
+ messageDesc(file_tagging_pdp_v2_tagging, 5);
81
+ /**
82
+ * Describes the message tagging.pdp.v2.ProcessTagOptions.
83
+ * Use `create(ProcessTagOptionsSchema)` to create a new message.
84
+ */
85
+ export const ProcessTagOptionsSchema =
86
+ /*@__PURE__*/
87
+ messageDesc(file_tagging_pdp_v2_tagging, 6);
88
+ /**
89
+ * @generated from enum tagging.pdp.v2.ProcessTagOptions.Mode
90
+ */
91
+ export var ProcessTagOptions_Mode;
92
+ (function (ProcessTagOptions_Mode) {
93
+ /**
94
+ * @generated from enum value: ALL = 0;
95
+ */
96
+ ProcessTagOptions_Mode[ProcessTagOptions_Mode["ALL"] = 0] = "ALL";
97
+ /**
98
+ * @generated from enum value: PROCESS = 1;
99
+ */
100
+ ProcessTagOptions_Mode[ProcessTagOptions_Mode["PROCESS"] = 1] = "PROCESS";
101
+ })(ProcessTagOptions_Mode || (ProcessTagOptions_Mode = {}));
102
+ /**
103
+ * Describes the enum tagging.pdp.v2.ProcessTagOptions.Mode.
104
+ */
105
+ export const ProcessTagOptions_ModeSchema =
106
+ /*@__PURE__*/
107
+ enumDesc(file_tagging_pdp_v2_tagging, 6, 0);
108
+ /**
109
+ * Describes the message tagging.pdp.v2.AssertionOptions.
110
+ * Use `create(AssertionOptionsSchema)` to create a new message.
111
+ */
112
+ export const AssertionOptionsSchema =
113
+ /*@__PURE__*/
114
+ messageDesc(file_tagging_pdp_v2_tagging, 7);
115
+ /**
116
+ * Describes the message tagging.pdp.v2.TagRequestOptions.
117
+ * Use `create(TagRequestOptionsSchema)` to create a new message.
118
+ */
119
+ export const TagRequestOptionsSchema =
120
+ /*@__PURE__*/
121
+ messageDesc(file_tagging_pdp_v2_tagging, 8);
122
+ /**
123
+ * @generated from enum tagging.pdp.v2.TagRequestOptions.Mode
124
+ */
125
+ export var TagRequestOptions_Mode;
126
+ (function (TagRequestOptions_Mode) {
127
+ /**
128
+ * Process all stages
129
+ *
130
+ * @generated from enum value: ALL = 0;
131
+ */
132
+ TagRequestOptions_Mode[TagRequestOptions_Mode["ALL"] = 0] = "ALL";
133
+ /**
134
+ * Process Content Contraction + Tag Extraction Stages
135
+ *
136
+ * @generated from enum value: TAG_EXTRACT = 1;
137
+ */
138
+ TagRequestOptions_Mode[TagRequestOptions_Mode["TAG_EXTRACT"] = 1] = "TAG_EXTRACT";
139
+ /**
140
+ * Process Content Extraction , Tag Extraction and Tag Processing States
141
+ *
142
+ * @generated from enum value: TAG_EXTRACT_AND_PROCESS = 2;
143
+ */
144
+ TagRequestOptions_Mode[TagRequestOptions_Mode["TAG_EXTRACT_AND_PROCESS"] = 2] = "TAG_EXTRACT_AND_PROCESS";
145
+ /**
146
+ * *
147
+ * Process Content Extraction + Token Tag Generation.
148
+ * Use this mode if you only need encrypted tokens generated.
149
+ * The other modes can trigger encrypted token generation by
150
+ * adding generateTokens = true on the ContentItemDesc.
151
+ *
152
+ * 05 bc in-between 0-1
153
+ *
154
+ * @generated from enum value: EXTRACT_GENERATE_TOKENS = 5;
155
+ */
156
+ TagRequestOptions_Mode[TagRequestOptions_Mode["EXTRACT_GENERATE_TOKENS"] = 5] = "EXTRACT_GENERATE_TOKENS";
157
+ })(TagRequestOptions_Mode || (TagRequestOptions_Mode = {}));
158
+ /**
159
+ * Describes the enum tagging.pdp.v2.TagRequestOptions.Mode.
160
+ */
161
+ export const TagRequestOptions_ModeSchema =
162
+ /*@__PURE__*/
163
+ enumDesc(file_tagging_pdp_v2_tagging, 8, 0);
164
+ /**
165
+ * Describes the message tagging.pdp.v2.TaggingPDPResponse.
166
+ * Use `create(TaggingPDPResponseSchema)` to create a new message.
167
+ */
168
+ export const TaggingPDPResponseSchema =
169
+ /*@__PURE__*/
170
+ messageDesc(file_tagging_pdp_v2_tagging, 9);
171
+ /**
172
+ * Describes the message tagging.pdp.v2.TagsForContentItem.
173
+ * Use `create(TagsForContentItemSchema)` to create a new message.
174
+ */
175
+ export const TagsForContentItemSchema =
176
+ /*@__PURE__*/
177
+ messageDesc(file_tagging_pdp_v2_tagging, 10);
178
+ /**
179
+ * Describes the message tagging.pdp.v2.TagPerContentResponse.
180
+ * Use `create(TagPerContentResponseSchema)` to create a new message.
181
+ */
182
+ export const TagPerContentResponseSchema =
183
+ /*@__PURE__*/
184
+ messageDesc(file_tagging_pdp_v2_tagging, 11);
185
+ /**
186
+ * Describes the message tagging.pdp.v2.TagProperties.
187
+ * Use `create(TagPropertiesSchema)` to create a new message.
188
+ */
189
+ export const TagPropertiesSchema =
190
+ /*@__PURE__*/
191
+ messageDesc(file_tagging_pdp_v2_tagging, 12);
192
+ /**
193
+ * Describes the message tagging.pdp.v2.TagMetadata.
194
+ * Use `create(TagMetadataSchema)` to create a new message.
195
+ */
196
+ export const TagMetadataSchema =
197
+ /*@__PURE__*/
198
+ messageDesc(file_tagging_pdp_v2_tagging, 13);
199
+ /**
200
+ * Describes the message tagging.pdp.v2.DataAttributeTag.
201
+ * Use `create(DataAttributeTagSchema)` to create a new message.
202
+ */
203
+ export const DataAttributeTagSchema =
204
+ /*@__PURE__*/
205
+ messageDesc(file_tagging_pdp_v2_tagging, 14);
206
+ /**
207
+ * Describes the message tagging.pdp.v2.AssertionTag.
208
+ * Use `create(AssertionTagSchema)` to create a new message.
209
+ */
210
+ export const AssertionTagSchema =
211
+ /*@__PURE__*/
212
+ messageDesc(file_tagging_pdp_v2_tagging, 15);
213
+ /**
214
+ * Describes the message tagging.pdp.v2.EncryptedSearchTokenTag.
215
+ * Use `create(EncryptedSearchTokenTagSchema)` to create a new message.
216
+ */
217
+ export const EncryptedSearchTokenTagSchema =
218
+ /*@__PURE__*/
219
+ messageDesc(file_tagging_pdp_v2_tagging, 16);
220
+ /**
221
+ * Describes the message tagging.pdp.v2.Tag.
222
+ * Use `create(TagSchema)` to create a new message.
223
+ */
224
+ export const TagSchema =
225
+ /*@__PURE__*/
226
+ messageDesc(file_tagging_pdp_v2_tagging, 17);
227
+ /**
228
+ * Describes the message tagging.pdp.v2.TagProvenanceSourceDesc.
229
+ * Use `create(TagProvenanceSourceDescSchema)` to create a new message.
230
+ */
231
+ export const TagProvenanceSourceDescSchema =
232
+ /*@__PURE__*/
233
+ messageDesc(file_tagging_pdp_v2_tagging, 18);
234
+ /**
235
+ * Describes the message tagging.pdp.v2.ContentProvenanceSourceDesc.
236
+ * Use `create(ContentProvenanceSourceDescSchema)` to create a new message.
237
+ */
238
+ export const ContentProvenanceSourceDescSchema =
239
+ /*@__PURE__*/
240
+ messageDesc(file_tagging_pdp_v2_tagging, 19);
241
+ /**
242
+ * Describes the message tagging.pdp.v2.TagProvenanceSource.
243
+ * Use `create(TagProvenanceSourceSchema)` to create a new message.
244
+ */
245
+ export const TagProvenanceSourceSchema =
246
+ /*@__PURE__*/
247
+ messageDesc(file_tagging_pdp_v2_tagging, 20);
248
+ /**
249
+ * Describes the message tagging.pdp.v2.TagProvenance.
250
+ * Use `create(TagProvenanceSchema)` to create a new message.
251
+ */
252
+ export const TagProvenanceSchema =
253
+ /*@__PURE__*/
254
+ messageDesc(file_tagging_pdp_v2_tagging, 21);
255
+ /**
256
+ * Describes the message tagging.pdp.v2.ContentItemDesc.
257
+ * Use `create(ContentItemDescSchema)` to create a new message.
258
+ */
259
+ export const ContentItemDescSchema =
260
+ /*@__PURE__*/
261
+ messageDesc(file_tagging_pdp_v2_tagging, 22);
262
+ /**
263
+ * Describes the message tagging.pdp.v2.ContentItem.
264
+ * Use `create(ContentItemSchema)` to create a new message.
265
+ */
266
+ export const ContentItemSchema =
267
+ /*@__PURE__*/
268
+ messageDesc(file_tagging_pdp_v2_tagging, 23);
269
+ /**
270
+ * Tagging PDP Service
271
+ *
272
+ * @generated from service tagging.pdp.v2.TaggingPDPService
273
+ */
274
+ export const TaggingPDPService = /*@__PURE__*/ serviceDesc(file_tagging_pdp_v2_tagging, 0);
@@ -0,0 +1,96 @@
1
+ import type { GenFile, GenMessage, GenService } from '@bufbuild/protobuf/codegenv1';
2
+ import type { Message } from '@bufbuild/protobuf';
3
+ /**
4
+ * Describes the file version/v1/version.proto.
5
+ */
6
+ export declare const file_version_v1_version: GenFile;
7
+ /**
8
+ * @generated from message version.v1.GetVersionRequest
9
+ */
10
+ export type GetVersionRequest = Message<'version.v1.GetVersionRequest'> & {};
11
+ /**
12
+ * Describes the message version.v1.GetVersionRequest.
13
+ * Use `create(GetVersionRequestSchema)` to create a new message.
14
+ */
15
+ export declare const GetVersionRequestSchema: GenMessage<GetVersionRequest>;
16
+ /**
17
+ * @generated from message version.v1.DependencyInfo
18
+ */
19
+ export type DependencyInfo = Message<'version.v1.DependencyInfo'> & {
20
+ /**
21
+ * @generated from field: string name = 1;
22
+ */
23
+ name: string;
24
+ /**
25
+ * @generated from field: string version = 2;
26
+ */
27
+ version: string;
28
+ };
29
+ /**
30
+ * Describes the message version.v1.DependencyInfo.
31
+ * Use `create(DependencyInfoSchema)` to create a new message.
32
+ */
33
+ export declare const DependencyInfoSchema: GenMessage<DependencyInfo>;
34
+ /**
35
+ * @generated from message version.v1.GetVersionResponse
36
+ */
37
+ export type GetVersionResponse = Message<'version.v1.GetVersionResponse'> & {
38
+ /**
39
+ * @generated from field: string name = 1;
40
+ */
41
+ name: string;
42
+ /**
43
+ * @generated from field: string version = 2;
44
+ */
45
+ version: string;
46
+ /**
47
+ * @generated from field: string git_commit = 3;
48
+ */
49
+ gitCommit: string;
50
+ /**
51
+ * @generated from field: string build_date = 4;
52
+ */
53
+ buildDate: string;
54
+ /**
55
+ * @generated from field: string go_version = 5;
56
+ */
57
+ goVersion: string;
58
+ /**
59
+ * @generated from field: string os_arch = 6;
60
+ */
61
+ osArch: string;
62
+ /**
63
+ * @generated from field: version.v1.DependencyInfo opentdf_service_version = 7;
64
+ */
65
+ opentdfServiceVersion?: DependencyInfo;
66
+ /**
67
+ * @generated from field: version.v1.DependencyInfo opentdf_sdk_version = 8;
68
+ */
69
+ opentdfSdkVersion?: DependencyInfo;
70
+ /**
71
+ * @generated from field: version.v1.DependencyInfo opentdf_protobuf_version = 9;
72
+ */
73
+ opentdfProtobufVersion?: DependencyInfo;
74
+ /**
75
+ * @generated from field: repeated version.v1.DependencyInfo opentdf_libs_versions = 10;
76
+ */
77
+ opentdfLibsVersions: DependencyInfo[];
78
+ };
79
+ /**
80
+ * Describes the message version.v1.GetVersionResponse.
81
+ * Use `create(GetVersionResponseSchema)` to create a new message.
82
+ */
83
+ export declare const GetVersionResponseSchema: GenMessage<GetVersionResponse>;
84
+ /**
85
+ * @generated from service version.v1.VersionService
86
+ */
87
+ export declare const VersionService: GenService<{
88
+ /**
89
+ * @generated from rpc version.v1.VersionService.GetVersion
90
+ */
91
+ getVersion: {
92
+ methodKind: 'unary';
93
+ input: typeof GetVersionRequestSchema;
94
+ output: typeof GetVersionResponseSchema;
95
+ };
96
+ }>;
@@ -0,0 +1,37 @@
1
+ /*
2
+ * Copyright (c) Virtru Corporation. All rights reserved.
3
+ *
4
+ * Your use of this file is governed by the Virtu Terms of Service <https://www.virtru.com/terms-of-service/>.
5
+ */
6
+ import { fileDesc, messageDesc, serviceDesc, } from '@bufbuild/protobuf/codegenv1';
7
+ /**
8
+ * Describes the file version/v1/version.proto.
9
+ */
10
+ export const file_version_v1_version =
11
+ /*@__PURE__*/
12
+ fileDesc('Chh2ZXJzaW9uL3YxL3ZlcnNpb24ucHJvdG8SCnZlcnNpb24udjEiEwoRR2V0VmVyc2lvblJlcXVlc3QiLwoORGVwZW5kZW5jeUluZm8SDAoEbmFtZRgBIAEoCRIPCgd2ZXJzaW9uGAIgASgJIu8CChJHZXRWZXJzaW9uUmVzcG9uc2USDAoEbmFtZRgBIAEoCRIPCgd2ZXJzaW9uGAIgASgJEhIKCmdpdF9jb21taXQYAyABKAkSEgoKYnVpbGRfZGF0ZRgEIAEoCRISCgpnb192ZXJzaW9uGAUgASgJEg8KB29zX2FyY2gYBiABKAkSOwoXb3BlbnRkZl9zZXJ2aWNlX3ZlcnNpb24YByABKAsyGi52ZXJzaW9uLnYxLkRlcGVuZGVuY3lJbmZvEjcKE29wZW50ZGZfc2RrX3ZlcnNpb24YCCABKAsyGi52ZXJzaW9uLnYxLkRlcGVuZGVuY3lJbmZvEjwKGG9wZW50ZGZfcHJvdG9idWZfdmVyc2lvbhgJIAEoCzIaLnZlcnNpb24udjEuRGVwZW5kZW5jeUluZm8SOQoVb3BlbnRkZl9saWJzX3ZlcnNpb25zGAogAygLMhoudmVyc2lvbi52MS5EZXBlbmRlbmN5SW5mbzJdCg5WZXJzaW9uU2VydmljZRJLCgpHZXRWZXJzaW9uEh0udmVyc2lvbi52MS5HZXRWZXJzaW9uUmVxdWVzdBoeLnZlcnNpb24udjEuR2V0VmVyc2lvblJlc3BvbnNlQrYBCg5jb20udmVyc2lvbi52MUIMVmVyc2lvblByb3RvUAFaTWdpdGh1Yi5jb20vdmlydHJ1LWNvcnAvZGF0YS1zZWN1cml0eS1wbGF0Zm9ybS9zZGsvdjIvZ2VuL3ZlcnNpb24vdjE7dmVyc2lvbnYxogIDVlhYqgIKVmVyc2lvbi5WMcoCClZlcnNpb25cVjHiAhZWZXJzaW9uXFYxXEdQQk1ldGFkYXRh6gILVmVyc2lvbjo6VjFiBnByb3RvMw');
13
+ /**
14
+ * Describes the message version.v1.GetVersionRequest.
15
+ * Use `create(GetVersionRequestSchema)` to create a new message.
16
+ */
17
+ export const GetVersionRequestSchema =
18
+ /*@__PURE__*/
19
+ messageDesc(file_version_v1_version, 0);
20
+ /**
21
+ * Describes the message version.v1.DependencyInfo.
22
+ * Use `create(DependencyInfoSchema)` to create a new message.
23
+ */
24
+ export const DependencyInfoSchema =
25
+ /*@__PURE__*/
26
+ messageDesc(file_version_v1_version, 1);
27
+ /**
28
+ * Describes the message version.v1.GetVersionResponse.
29
+ * Use `create(GetVersionResponseSchema)` to create a new message.
30
+ */
31
+ export const GetVersionResponseSchema =
32
+ /*@__PURE__*/
33
+ messageDesc(file_version_v1_version, 2);
34
+ /**
35
+ * @generated from service version.v1.VersionService
36
+ */
37
+ export const VersionService = /*@__PURE__*/ serviceDesc(file_version_v1_version, 0);
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Exports Connect RPC and Connect Web RPC
3
+ */
4
+ export { platformConnect as dspConnect, platformConnectWeb as dspConnectWeb, } from '@opentdf/sdk/platform';
5
+ /**
6
+ * Exports the platform client
7
+ */
8
+ export { type DSPClientServicesV1 as DSPServicesV1, type DSPClientServicesV2 as DSPServicesV2, type DSPClientOptions, DSPClient, } from './lib/client';
9
+ export { PlatformClient } from '@opentdf/sdk/platform';
10
+ export { createAuthInterceptor, type Interceptor } from './lib/utils';
11
+ /**
12
+ * Exports the DSP wrapper of OpenTDF
13
+ */
14
+ export { DSP, createDSP } from './lib/dsp';
15
+ /**
16
+ * Exports components of OpenTDF
17
+ */
18
+ export { version, clientType, tdfSpecVersion, type DecoratedStream, type CreateZTDFOptions, } from '@opentdf/sdk';
19
+ export { AuthProviders, type AuthProvider } from '@opentdf/sdk';
20
+ export * as singlecontainer from '@opentdf/sdk/singlecontainer';
21
+ export * as nano from '@opentdf/sdk/nano';
@@ -0,0 +1,28 @@
1
+ /*
2
+ * Copyright (c) Virtru Corporation. All rights reserved.
3
+ *
4
+ * Your use of this file is governed by the Virtu Terms of Service <https://www.virtru.com/terms-of-service/>.
5
+ */
6
+ /**
7
+ * Exports Connect RPC and Connect Web RPC
8
+ */
9
+ export { platformConnect as dspConnect, platformConnectWeb as dspConnectWeb, } from '@opentdf/sdk/platform';
10
+ /**
11
+ * Exports the platform client
12
+ */
13
+ export { DSPClient, } from './lib/client';
14
+ export { PlatformClient } from '@opentdf/sdk/platform';
15
+ export { createAuthInterceptor } from './lib/utils';
16
+ /**
17
+ * Exports the DSP wrapper of OpenTDF
18
+ */
19
+ export { DSP, createDSP } from './lib/dsp';
20
+ /**
21
+ * Exports components of OpenTDF
22
+ */
23
+ export { version, clientType, tdfSpecVersion, } from '@opentdf/sdk';
24
+ // export AuthProvider during transition period
25
+ // TODO: remove this export once the SDK is updated to deprecate the AuthProvider
26
+ export { AuthProviders } from '@opentdf/sdk';
27
+ export * as singlecontainer from '@opentdf/sdk/singlecontainer';
28
+ export * as nano from '@opentdf/sdk/nano';
@@ -0,0 +1,33 @@
1
+ import type { AuthProvider } from '@opentdf/sdk';
2
+ import { type Client, type Interceptor } from '@connectrpc/connect';
3
+ import { ConfigService } from '../gen/config/v1/config_pb';
4
+ import { PolicyArtifactService } from '../gen/policyimportexport/v1/policy_import_export_pb';
5
+ import { SharedService } from '../gen/shared/v1/shared_pb';
6
+ import { TaggingPDPService } from '../gen/tagging/pdp/v2/tagging_pb';
7
+ import { VersionService } from '../gen/version/v1/version_pb';
8
+ export interface DSPClientServicesV1 {
9
+ configService: Client<typeof ConfigService>;
10
+ policyArtifactService: Client<typeof PolicyArtifactService>;
11
+ sharedService: Client<typeof SharedService>;
12
+ versionService: Client<typeof VersionService>;
13
+ }
14
+ export interface DSPClientServicesV2 {
15
+ taggingPDPService: Client<typeof TaggingPDPService>;
16
+ }
17
+ export interface DSPClientOptions {
18
+ platformUrl: string;
19
+ interceptors?: Interceptor[];
20
+ authProvider?: AuthProvider;
21
+ }
22
+ /**
23
+ * A client for interacting with the DSP using the Connect RPC framework.
24
+ *
25
+ * This client supports custom interceptors, which can be used to add
26
+ * authentication headers or other custom logic to outgoing requests.
27
+ *
28
+ */
29
+ export declare class DSPClient {
30
+ readonly v1: DSPClientServicesV1;
31
+ readonly v2: DSPClientServicesV2;
32
+ constructor(options: DSPClientOptions);
33
+ }
@@ -0,0 +1,60 @@
1
+ /*
2
+ * Copyright (c) Virtru Corporation. All rights reserved.
3
+ *
4
+ * Your use of this file is governed by the Virtu Terms of Service <https://www.virtru.com/terms-of-service/>.
5
+ */
6
+ import { createClient } from '@connectrpc/connect';
7
+ import { createConnectTransport } from '@connectrpc/connect-web';
8
+ import { ConfigService } from '../gen/config/v1/config_pb';
9
+ import { PolicyArtifactService } from '../gen/policyimportexport/v1/policy_import_export_pb';
10
+ import { SharedService } from '../gen/shared/v1/shared_pb';
11
+ import { TaggingPDPService } from '../gen/tagging/pdp/v2/tagging_pb';
12
+ import { VersionService } from '../gen/version/v1/version_pb';
13
+ import { createAuthInterceptor } from './utils';
14
+ /**
15
+ * A client for interacting with the DSP using the Connect RPC framework.
16
+ *
17
+ * This client supports custom interceptors, which can be used to add
18
+ * authentication headers or other custom logic to outgoing requests.
19
+ *
20
+ */
21
+ export class DSPClient {
22
+ constructor(options) {
23
+ Object.defineProperty(this, "v1", {
24
+ enumerable: true,
25
+ configurable: true,
26
+ writable: true,
27
+ value: void 0
28
+ });
29
+ Object.defineProperty(this, "v2", {
30
+ enumerable: true,
31
+ configurable: true,
32
+ writable: true,
33
+ value: void 0
34
+ });
35
+ const interceptors = [];
36
+ if (!options.platformUrl) {
37
+ throw new Error('platformUrl is required for DSP client');
38
+ }
39
+ if (options.authProvider) {
40
+ const authInterceptor = createAuthInterceptor(options.authProvider);
41
+ interceptors.push(authInterceptor);
42
+ }
43
+ if (options.interceptors?.length) {
44
+ interceptors.push(...options.interceptors);
45
+ }
46
+ const transport = createConnectTransport({
47
+ baseUrl: options.platformUrl,
48
+ interceptors,
49
+ });
50
+ this.v1 = {
51
+ configService: createClient(ConfigService, transport),
52
+ policyArtifactService: createClient(PolicyArtifactService, transport),
53
+ sharedService: createClient(SharedService, transport),
54
+ versionService: createClient(VersionService, transport),
55
+ };
56
+ this.v2 = {
57
+ taggingPDPService: createClient(TaggingPDPService, transport),
58
+ };
59
+ }
60
+ }
@@ -0,0 +1,18 @@
1
+ import { OpenTDF, type OpenTDFOptions } from '@opentdf/sdk';
2
+ import { type PlatformServices } from '@opentdf/sdk/platform';
3
+ import { type DSPClientServicesV1, type DSPClientServicesV2 } from './client';
4
+ import type { Interceptor } from '@connectrpc/connect';
5
+ export type DSPServicesV1 = DSPClientServicesV1 & PlatformServices;
6
+ export type DSPServicesV2 = DSPClientServicesV2;
7
+ export interface DSPOptions extends OpenTDFOptions {
8
+ platformUrl: string;
9
+ interceptors?: Interceptor[];
10
+ }
11
+ export declare class DSP extends OpenTDF {
12
+ readonly services: {
13
+ v1: DSPServicesV1;
14
+ v2: DSPServicesV2;
15
+ };
16
+ constructor(options: DSPOptions);
17
+ }
18
+ export declare function createDSP(options: DSPOptions): DSP;
@@ -0,0 +1,44 @@
1
+ /*
2
+ * Copyright (c) Virtru Corporation. All rights reserved.
3
+ *
4
+ * Your use of this file is governed by the Virtu Terms of Service <https://www.virtru.com/terms-of-service/>.
5
+ */
6
+ import { OpenTDF } from '@opentdf/sdk';
7
+ import { PlatformClient } from '@opentdf/sdk/platform';
8
+ import { DSPClient, } from './client';
9
+ export class DSP extends OpenTDF {
10
+ constructor(options) {
11
+ super(options);
12
+ Object.defineProperty(this, "services", {
13
+ enumerable: true,
14
+ configurable: true,
15
+ writable: true,
16
+ value: void 0
17
+ });
18
+ if (!options.platformUrl) {
19
+ throw new Error('platformUrl is required for DSP client');
20
+ }
21
+ const dspClient = new DSPClient({
22
+ platformUrl: options.platformUrl,
23
+ interceptors: options.interceptors,
24
+ authProvider: options.authProvider,
25
+ });
26
+ const platformClient = new PlatformClient({
27
+ platformUrl: options.platformUrl,
28
+ interceptors: options.interceptors,
29
+ authProvider: options.authProvider,
30
+ });
31
+ this.services = {
32
+ v1: {
33
+ ...platformClient.v1,
34
+ ...dspClient.v1,
35
+ },
36
+ v2: {
37
+ ...dspClient.v2,
38
+ },
39
+ };
40
+ }
41
+ }
42
+ export function createDSP(options) {
43
+ return new DSP(options);
44
+ }
@@ -0,0 +1,15 @@
1
+ import type { AuthProvider } from '@opentdf/sdk';
2
+ import type { Interceptor as Inter } from '@connectrpc/connect';
3
+ export type Interceptor = Inter;
4
+ /**
5
+ * Creates an interceptor that adds authentication headers to outgoing requests.
6
+ *
7
+ * This function uses the provided `AuthProvider` to generate authentication credentials
8
+ * for each request. The `AuthProvider` is expected to implement a `withCreds` method
9
+ * that returns an object containing authentication headers. These headers are then
10
+ * added to the request before it is sent to the server.
11
+ *
12
+ * @param authProvider - An instance of `AuthProvider` used to generate authentication credentials.
13
+ * @returns An `Interceptor` function that modifies requests to include authentication headers.
14
+ */
15
+ export declare function createAuthInterceptor(authProvider: AuthProvider): Interceptor;
@@ -0,0 +1,35 @@
1
+ /*
2
+ * Copyright (c) Virtru Corporation. All rights reserved.
3
+ *
4
+ * Your use of this file is governed by the Virtu Terms of Service <https://www.virtru.com/terms-of-service/>.
5
+ */
6
+ /**
7
+ * Creates an interceptor that adds authentication headers to outgoing requests.
8
+ *
9
+ * This function uses the provided `AuthProvider` to generate authentication credentials
10
+ * for each request. The `AuthProvider` is expected to implement a `withCreds` method
11
+ * that returns an object containing authentication headers. These headers are then
12
+ * added to the request before it is sent to the server.
13
+ *
14
+ * @param authProvider - An instance of `AuthProvider` used to generate authentication credentials.
15
+ * @returns An `Interceptor` function that modifies requests to include authentication headers.
16
+ */
17
+ export function createAuthInterceptor(authProvider) {
18
+ const authInterceptor = (next) => async (req) => {
19
+ const url = new URL(req.url);
20
+ const pathOnly = url.pathname;
21
+ // Signs only the path of the url in the request
22
+ const token = await authProvider.withCreds({
23
+ url: pathOnly,
24
+ method: 'POST',
25
+ headers: {
26
+ 'Content-Type': 'application/json',
27
+ },
28
+ });
29
+ Object.entries(token.headers).forEach(([key, value]) => {
30
+ req.header.set(key, value);
31
+ });
32
+ return await next(req);
33
+ };
34
+ return authInterceptor;
35
+ }