@tsg-dsp/tsg-sdk 0.0.0-stage → 0.20.1

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 (190) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +273 -2
  3. package/dist/.generated/control-plane.d.ts +7882 -0
  4. package/dist/.generated/sso-bridge.d.ts +3062 -0
  5. package/dist/.generated/wallet.d.ts +6350 -0
  6. package/dist/auth/auth.provider.d.ts +45 -0
  7. package/dist/auth/auth.provider.d.ts.map +1 -0
  8. package/dist/auth/auth.provider.js +158 -0
  9. package/dist/auth/auth.provider.js.map +1 -0
  10. package/dist/auth/auth.types.d.ts +27 -0
  11. package/dist/auth/auth.types.d.ts.map +1 -0
  12. package/dist/auth/auth.types.js +2 -0
  13. package/dist/auth/auth.types.js.map +1 -0
  14. package/dist/auth/index.d.ts +3 -0
  15. package/dist/auth/index.d.ts.map +1 -0
  16. package/dist/auth/index.js +3 -0
  17. package/dist/auth/index.js.map +1 -0
  18. package/dist/browser.d.ts +1243 -0
  19. package/dist/browser.d.ts.map +1 -0
  20. package/dist/browser.js +215 -0
  21. package/dist/browser.js.map +1 -0
  22. package/dist/catalog/catalog.sdk.d.ts +149 -0
  23. package/dist/catalog/catalog.sdk.d.ts.map +1 -0
  24. package/dist/catalog/catalog.sdk.js +155 -0
  25. package/dist/catalog/catalog.sdk.js.map +1 -0
  26. package/dist/catalog/index.d.ts +2 -0
  27. package/dist/catalog/index.d.ts.map +1 -0
  28. package/dist/catalog/index.js +2 -0
  29. package/dist/catalog/index.js.map +1 -0
  30. package/dist/client.d.ts +43 -0
  31. package/dist/client.d.ts.map +1 -0
  32. package/dist/client.js +107 -0
  33. package/dist/client.js.map +1 -0
  34. package/dist/config/index.d.ts +2 -0
  35. package/dist/config/index.d.ts.map +1 -0
  36. package/dist/config/index.js +2 -0
  37. package/dist/config/index.js.map +1 -0
  38. package/dist/config/sdk.config.d.ts +81 -0
  39. package/dist/config/sdk.config.d.ts.map +1 -0
  40. package/dist/config/sdk.config.js +2 -0
  41. package/dist/config/sdk.config.js.map +1 -0
  42. package/dist/index.d.ts +17 -0
  43. package/dist/index.d.ts.map +1 -0
  44. package/dist/index.js +24 -0
  45. package/dist/index.js.map +1 -0
  46. package/dist/metadata/index.d.ts +2 -0
  47. package/dist/metadata/index.d.ts.map +1 -0
  48. package/dist/metadata/index.js +2 -0
  49. package/dist/metadata/index.js.map +1 -0
  50. package/dist/metadata/metadata.sdk.d.ts +111 -0
  51. package/dist/metadata/metadata.sdk.d.ts.map +1 -0
  52. package/dist/metadata/metadata.sdk.js +142 -0
  53. package/dist/metadata/metadata.sdk.js.map +1 -0
  54. package/dist/negotiations/index.d.ts +2 -0
  55. package/dist/negotiations/index.d.ts.map +1 -0
  56. package/dist/negotiations/index.js +2 -0
  57. package/dist/negotiations/index.js.map +1 -0
  58. package/dist/negotiations/negotiations.sdk.d.ts +113 -0
  59. package/dist/negotiations/negotiations.sdk.d.ts.map +1 -0
  60. package/dist/negotiations/negotiations.sdk.js +146 -0
  61. package/dist/negotiations/negotiations.sdk.js.map +1 -0
  62. package/dist/requirements/index.d.ts +2 -0
  63. package/dist/requirements/index.d.ts.map +1 -0
  64. package/dist/requirements/index.js +2 -0
  65. package/dist/requirements/index.js.map +1 -0
  66. package/dist/requirements/requirements.sdk.d.ts +52 -0
  67. package/dist/requirements/requirements.sdk.d.ts.map +1 -0
  68. package/dist/requirements/requirements.sdk.js +123 -0
  69. package/dist/requirements/requirements.sdk.js.map +1 -0
  70. package/dist/sso/index.d.ts +3 -0
  71. package/dist/sso/index.d.ts.map +1 -0
  72. package/dist/sso/index.js +3 -0
  73. package/dist/sso/index.js.map +1 -0
  74. package/dist/sso/sso-management.sdk.d.ts +96 -0
  75. package/dist/sso/sso-management.sdk.d.ts.map +1 -0
  76. package/dist/sso/sso-management.sdk.js +152 -0
  77. package/dist/sso/sso-management.sdk.js.map +1 -0
  78. package/dist/sso/sso.sdk.d.ts +75 -0
  79. package/dist/sso/sso.sdk.d.ts.map +1 -0
  80. package/dist/sso/sso.sdk.js +147 -0
  81. package/dist/sso/sso.sdk.js.map +1 -0
  82. package/dist/transfers/index.d.ts +2 -0
  83. package/dist/transfers/index.d.ts.map +1 -0
  84. package/dist/transfers/index.js +2 -0
  85. package/dist/transfers/index.js.map +1 -0
  86. package/dist/transfers/transfers.sdk.d.ts +155 -0
  87. package/dist/transfers/transfers.sdk.d.ts.map +1 -0
  88. package/dist/transfers/transfers.sdk.js +186 -0
  89. package/dist/transfers/transfers.sdk.js.map +1 -0
  90. package/dist/tsg-sdk.d.ts +65 -0
  91. package/dist/tsg-sdk.d.ts.map +1 -0
  92. package/dist/tsg-sdk.js +128 -0
  93. package/dist/tsg-sdk.js.map +1 -0
  94. package/dist/utils/errors.d.ts +67 -0
  95. package/dist/utils/errors.d.ts.map +1 -0
  96. package/dist/utils/errors.js +79 -0
  97. package/dist/utils/errors.js.map +1 -0
  98. package/dist/utils/index.d.ts +4 -0
  99. package/dist/utils/index.d.ts.map +1 -0
  100. package/dist/utils/index.js +4 -0
  101. package/dist/utils/index.js.map +1 -0
  102. package/dist/utils/polling.d.ts +20 -0
  103. package/dist/utils/polling.d.ts.map +1 -0
  104. package/dist/utils/polling.js +35 -0
  105. package/dist/utils/polling.js.map +1 -0
  106. package/dist/utils/shape-validation.d.ts +59 -0
  107. package/dist/utils/shape-validation.d.ts.map +1 -0
  108. package/dist/utils/shape-validation.js +85 -0
  109. package/dist/utils/shape-validation.js.map +1 -0
  110. package/dist/utils/validate.d.ts +47 -0
  111. package/dist/utils/validate.d.ts.map +1 -0
  112. package/dist/utils/validate.js +68 -0
  113. package/dist/utils/validate.js.map +1 -0
  114. package/dist/vendor/common-dtos/abac.policy.d.ts +60 -0
  115. package/dist/vendor/common-dtos/abac.policy.js +2 -0
  116. package/dist/vendor/common-dtos/audit.types.d.ts +74 -0
  117. package/dist/vendor/common-dtos/audit.types.js +9 -0
  118. package/dist/vendor/common-dtos/credential-requirements.d.ts +19 -0
  119. package/dist/vendor/common-dtos/credential-requirements.dto.d.ts +47 -0
  120. package/dist/vendor/common-dtos/credential-requirements.dto.js +251 -0
  121. package/dist/vendor/common-dtos/credential-requirements.js +181 -0
  122. package/dist/vendor/common-dtos/dataplane.dto.d.ts +6 -0
  123. package/dist/vendor/common-dtos/dataplane.dto.js +29 -0
  124. package/dist/vendor/common-dtos/dcp.dto.d.ts +90 -0
  125. package/dist/vendor/common-dtos/dcp.dto.js +490 -0
  126. package/dist/vendor/common-dtos/dcql.dto.d.ts +89 -0
  127. package/dist/vendor/common-dtos/dcql.dto.js +450 -0
  128. package/dist/vendor/common-dtos/did.schemas.d.ts +40 -0
  129. package/dist/vendor/common-dtos/did.schemas.js +260 -0
  130. package/dist/vendor/common-dtos/index.d.ts +19 -0
  131. package/dist/vendor/common-dtos/index.js +19 -0
  132. package/dist/vendor/common-dtos/metadata.dto.d.ts +6 -0
  133. package/dist/vendor/common-dtos/metadata.dto.js +30 -0
  134. package/dist/vendor/common-dtos/negotiations.dto.d.ts +29 -0
  135. package/dist/vendor/common-dtos/negotiations.dto.js +205 -0
  136. package/dist/vendor/common-dtos/permissions.d.ts +237 -0
  137. package/dist/vendor/common-dtos/permissions.js +337 -0
  138. package/dist/vendor/common-dtos/presentation.request.dto.d.ts +9 -0
  139. package/dist/vendor/common-dtos/presentation.request.dto.js +55 -0
  140. package/dist/vendor/common-dtos/presentation.status.dto.d.ts +13 -0
  141. package/dist/vendor/common-dtos/presentation.status.dto.js +83 -0
  142. package/dist/vendor/common-dtos/presentationdefinition.dto.d.ts +75 -0
  143. package/dist/vendor/common-dtos/presentationdefinition.dto.js +448 -0
  144. package/dist/vendor/common-dtos/signatures.dto.d.ts +32 -0
  145. package/dist/vendor/common-dtos/signatures.dto.js +210 -0
  146. package/dist/vendor/common-dtos/transfer.dto.d.ts +17 -0
  147. package/dist/vendor/common-dtos/transfer.dto.js +102 -0
  148. package/dist/vendor/common-dtos/utils.swagger.d.ts +13 -0
  149. package/dist/vendor/common-dtos/utils.swagger.js +63 -0
  150. package/dist/vendor/control-plane-dtos/index.d.ts +5 -0
  151. package/dist/vendor/control-plane-dtos/index.js +5 -0
  152. package/dist/vendor/control-plane-dtos/registry/registry.dto.d.ts +5 -0
  153. package/dist/vendor/control-plane-dtos/registry/registry.dto.js +26 -0
  154. package/dist/vendor/control-plane-dtos/registry/registry.search.dto.d.ts +29 -0
  155. package/dist/vendor/control-plane-dtos/registry/registry.search.dto.js +127 -0
  156. package/dist/vendor/control-plane-dtos/ssi/verifiablePresentations.dto.d.ts +10 -0
  157. package/dist/vendor/control-plane-dtos/ssi/verifiablePresentations.dto.js +44 -0
  158. package/dist/vendor/control-plane-dtos/status/status.dto.d.ts +38 -0
  159. package/dist/vendor/control-plane-dtos/status/status.dto.js +173 -0
  160. package/dist/vendor/sso-bridge-dtos/clients.dto.d.ts +22 -0
  161. package/dist/vendor/sso-bridge-dtos/clients.dto.js +113 -0
  162. package/dist/vendor/sso-bridge-dtos/grants.d.ts +3 -0
  163. package/dist/vendor/sso-bridge-dtos/grants.js +2 -0
  164. package/dist/vendor/sso-bridge-dtos/index.d.ts +5 -0
  165. package/dist/vendor/sso-bridge-dtos/index.js +5 -0
  166. package/dist/vendor/sso-bridge-dtos/users.dto.d.ts +24 -0
  167. package/dist/vendor/sso-bridge-dtos/users.dto.js +90 -0
  168. package/dist/vendor/wallet-dtos/clients.dto.d.ts +22 -0
  169. package/dist/vendor/wallet-dtos/clients.dto.js +14 -0
  170. package/dist/vendor/wallet-dtos/credentials.dto.d.ts +32 -0
  171. package/dist/vendor/wallet-dtos/credentials.dto.js +47 -0
  172. package/dist/vendor/wallet-dtos/index.d.ts +7 -0
  173. package/dist/vendor/wallet-dtos/index.js +7 -0
  174. package/dist/vendor/wallet-dtos/issuance.dto.d.ts +238 -0
  175. package/dist/vendor/wallet-dtos/issuance.dto.js +1140 -0
  176. package/dist/vendor/wallet-dtos/scopes.dto.d.ts +25 -0
  177. package/dist/vendor/wallet-dtos/scopes.dto.js +152 -0
  178. package/dist/vendor/wallet-dtos/status.dto.d.ts +36 -0
  179. package/dist/vendor/wallet-dtos/status.dto.js +170 -0
  180. package/dist/vendor/wallet-dtos/utils/schema-converter.d.ts +14 -0
  181. package/dist/vendor/wallet-dtos/utils/schema-converter.js +43 -0
  182. package/dist/wallet/index.d.ts +2 -0
  183. package/dist/wallet/index.d.ts.map +1 -0
  184. package/dist/wallet/index.js +2 -0
  185. package/dist/wallet/index.js.map +1 -0
  186. package/dist/wallet/wallet.sdk.d.ts +285 -0
  187. package/dist/wallet/wallet.sdk.d.ts.map +1 -0
  188. package/dist/wallet/wallet.sdk.js +384 -0
  189. package/dist/wallet/wallet.sdk.js.map +1 -0
  190. package/package.json +78 -3
package/dist/client.js ADDED
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Typed API clients powered by openapi-fetch and generated OpenAPI types.
3
+ *
4
+ * The generated types in `.generated/` contain all path definitions, request
5
+ * parameters, and response schemas derived from the NestJS controller OpenAPI
6
+ * specs. openapi-fetch uses those types to provide compile-time validation of
7
+ * every HTTP call the SDK makes.
8
+ */
9
+ import createClient from "openapi-fetch";
10
+ import { createRequestError } from "./utils/errors.js";
11
+ // ── Middleware ──────────────────────────────────────────────────────────────
12
+ /**
13
+ * Creates middleware that attaches an `Authorization: Bearer <token>` header
14
+ * to every outgoing request using the given {@link AuthProvider}.
15
+ * @param authProvider - Provider that supplies access tokens.
16
+ * @returns An openapi-fetch {@link Middleware} instance.
17
+ * @internal
18
+ */
19
+ function authMiddleware(authProvider) {
20
+ return {
21
+ async onRequest({ request }) {
22
+ const headers = await authProvider.getAuthHeaders();
23
+ for (const [key, value] of Object.entries(headers)) {
24
+ request.headers.set(key, value);
25
+ }
26
+ return request;
27
+ }
28
+ };
29
+ }
30
+ /**
31
+ * Creates middleware that sets the `X-Tenant-Slug` header on every request, so
32
+ * the control plane / wallet scopes it to the given tenant.
33
+ * @param tenantSlug - Slug of the tenant to address.
34
+ * @returns An openapi-fetch {@link Middleware} instance.
35
+ * @internal
36
+ */
37
+ function tenantMiddleware(tenantSlug) {
38
+ return {
39
+ async onRequest({ request }) {
40
+ request.headers.set("X-Tenant-Slug", tenantSlug);
41
+ return request;
42
+ }
43
+ };
44
+ }
45
+ /**
46
+ * Middleware that intercepts non-OK HTTP responses and converts them into
47
+ * typed {@link SdkError} instances with the appropriate {@link SdkErrorCode}.
48
+ * @internal
49
+ */
50
+ const errorMiddleware = {
51
+ async onResponse({ response }) {
52
+ if (!response.ok) {
53
+ const body = await response
54
+ .clone()
55
+ .text()
56
+ .catch(() => "");
57
+ throw createRequestError(`Request failed (${response.status}): ${body}`, response.status);
58
+ }
59
+ return response;
60
+ }
61
+ };
62
+ // ── Client factories ───────────────────────────────────────────────────────
63
+ /**
64
+ * Create a typed HTTP client for the TSG Control Plane API.
65
+ * @param baseUrl - Base URL of the control plane (e.g. `"http://localhost:3501"`).
66
+ * @param authProvider - Provider that supplies access tokens for authenticated requests.
67
+ * @param tenantSlug - Optional tenant slug sent as `X-Tenant-Slug` on every request.
68
+ * @returns A fully typed openapi-fetch client bound to the control plane OpenAPI schema.
69
+ */
70
+ export function createControlPlaneClient(baseUrl, authProvider, tenantSlug) {
71
+ const client = createClient({ baseUrl });
72
+ client.use(authMiddleware(authProvider));
73
+ if (tenantSlug) {
74
+ client.use(tenantMiddleware(tenantSlug));
75
+ }
76
+ client.use(errorMiddleware);
77
+ return client;
78
+ }
79
+ /**
80
+ * Create a typed HTTP client for the TSG Wallet API.
81
+ * @param baseUrl - Base URL of the wallet (e.g. `"http://localhost:3500"`).
82
+ * @param authProvider - Provider that supplies access tokens for authenticated requests.
83
+ * @param tenantSlug - Optional tenant slug sent as `X-Tenant-Slug` on every request.
84
+ * @returns A fully typed openapi-fetch client bound to the wallet OpenAPI schema.
85
+ */
86
+ export function createWalletClient(baseUrl, authProvider, tenantSlug) {
87
+ const client = createClient({ baseUrl });
88
+ client.use(authMiddleware(authProvider));
89
+ if (tenantSlug) {
90
+ client.use(tenantMiddleware(tenantSlug));
91
+ }
92
+ client.use(errorMiddleware);
93
+ return client;
94
+ }
95
+ /**
96
+ * Create a typed HTTP client for the TSG SSO Bridge API.
97
+ * @param baseUrl - Base URL of the SSO bridge (e.g. `"http://localhost:3700"`).
98
+ * @param authProvider - Provider that supplies access tokens for authenticated requests.
99
+ * @returns A fully typed openapi-fetch client bound to the SSO bridge OpenAPI schema.
100
+ */
101
+ export function createSsoBridgeClient(baseUrl, authProvider) {
102
+ const client = createClient({ baseUrl });
103
+ client.use(authMiddleware(authProvider));
104
+ client.use(errorMiddleware);
105
+ return client;
106
+ }
107
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,YAA8C,MAAM,eAAe,CAAC;AAM3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,+EAA+E;AAE/E;;;;;;GAMG;AACH,SAAS,cAAc,CAAC,YAA0B;IAChD,OAAO;QACL,KAAK,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE;YACzB,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,cAAc,EAAE,CAAC;YACpD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;gBACnD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YAClC,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,SAAS,gBAAgB,CAAC,UAAkB;IAC1C,OAAO;QACL,KAAK,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE;YACzB,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;YACjD,OAAO,OAA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IACD,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAC5B,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAAe,EACf,YAA0B;IAE1B,MAAM,MAAM,GAAG,YAAY,CAAiB,EAAE,OAAO,EAAE,CAAC,CAAC;IACzD,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,CAAC;IACzC,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAC5B,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./sdk.config.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./sdk.config.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Configuration for creating a {@link TsgSdk} instance.
3
+ *
4
+ * Only `controlPlaneBaseUrl` is required. Provide `walletBaseUrl` and/or
5
+ * `ssoBridgeBaseUrl` to enable the corresponding SDK modules.
6
+ * @example
7
+ * ```ts
8
+ * const config: TsgSdkConfig = {
9
+ * controlPlaneBaseUrl: "http://localhost:3501",
10
+ * walletBaseUrl: "http://localhost:3500",
11
+ * ssoBridgeBaseUrl: "http://localhost:3700",
12
+ * tenantSlug: "default",
13
+ * auth: {
14
+ * method: "client_secret_post",
15
+ * clientId: "my-client",
16
+ * clientSecret: "my-secret",
17
+ * },
18
+ * };
19
+ * ```
20
+ */
21
+ export interface TsgSdkConfig {
22
+ /** Base URL of the control plane (e.g. "http://localhost:3501" or "http://localhost:3501/api" when the /api prefix is enabled) */
23
+ controlPlaneBaseUrl: string;
24
+ /**
25
+ * Tenant to address on the control plane and wallet. Sent as the
26
+ * `X-Tenant-Slug` header on every request. Required unless the deployment
27
+ * resolves the tenant another way (e.g. a browser session).
28
+ */
29
+ tenantSlug?: string;
30
+ /** Base URL of the wallet (e.g. "http://localhost:3500" or "http://localhost:3500/api"). Optional - wallet features disabled if not provided. */
31
+ walletBaseUrl?: string;
32
+ /** Base URL of the SSO bridge (e.g. "http://localhost:3700" or "http://localhost:3700/api"). Required for auth. OpenID discovery preserves the deployment path and removes a trailing /api. */
33
+ ssoBridgeBaseUrl?: string;
34
+ /** Authentication configuration. If omitted, requests are sent without auth. */
35
+ auth?: TsgSdkAuthConfig;
36
+ }
37
+ /**
38
+ * Authentication configuration for the SDK.
39
+ *
40
+ * Exactly one of the following strategies must be chosen:
41
+ * - {@link ClientSecretAuthConfig} — OAuth 2.0 client credentials with a client secret.
42
+ * - {@link PrivateKeyJwtAuthConfig} — OAuth 2.0 client credentials using a private key JWT assertion.
43
+ * - {@link AccessTokenAuthConfig} — A pre-obtained bearer token.
44
+ */
45
+ export type TsgSdkAuthConfig = ClientSecretAuthConfig | PrivateKeyJwtAuthConfig | AccessTokenAuthConfig;
46
+ /**
47
+ * Authenticate using the OAuth 2.0 `client_credentials` grant with a
48
+ * client ID and client secret sent via POST body.
49
+ */
50
+ export interface ClientSecretAuthConfig {
51
+ method: "client_secret_post";
52
+ clientId: string;
53
+ clientSecret: string;
54
+ /** OpenID configuration URL. Defaults to `${ssoBridgeBaseUrl}/.well-known/openid-configuration` */
55
+ openIdConfigurationUrl?: string;
56
+ }
57
+ /**
58
+ * Authenticate using the OAuth 2.0 `client_credentials` grant with a
59
+ * signed JWT assertion (`private_key_jwt` client authentication method).
60
+ *
61
+ * Supported key types: EC (P-256 / P-384), OKP (Ed25519), and RSA.
62
+ */
63
+ export interface PrivateKeyJwtAuthConfig {
64
+ method: "private_key_jwt";
65
+ clientId: string;
66
+ privateKeyJwk: JsonWebKey;
67
+ /** OpenID configuration URL. Defaults to `${ssoBridgeBaseUrl}/.well-known/openid-configuration` */
68
+ openIdConfigurationUrl?: string;
69
+ }
70
+ /**
71
+ * Skip token acquisition and use a pre-obtained access token directly.
72
+ *
73
+ * Useful for short-lived scripts or when tokens are managed externally.
74
+ * The SDK will not attempt to refresh the token when it expires.
75
+ */
76
+ export interface AccessTokenAuthConfig {
77
+ method: "access_token";
78
+ /** A pre-obtained access token to use directly */
79
+ accessToken: string;
80
+ }
81
+ //# sourceMappingURL=sdk.config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.config.d.ts","sourceRoot":"","sources":["../../src/config/sdk.config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,YAAY;IAC3B,kIAAkI;IAClI,mBAAmB,EAAE,MAAM,CAAC;IAE5B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,iJAAiJ;IACjJ,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,+LAA+L;IAC/L,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,gFAAgF;IAChF,IAAI,CAAC,EAAE,gBAAgB,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAC1B,sBAAsB,GAAG,uBAAuB,GAAG,qBAAqB,CAAC;AAE3E;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,oBAAoB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,mGAAmG;IACnG,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,UAAU,CAAC;IAC1B,mGAAmG;IACnG,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,cAAc,CAAC;IACvB,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;CACrB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sdk.config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.config.js","sourceRoot":"","sources":["../../src/config/sdk.config.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ export { TsgSdk } from "./tsg-sdk.js";
2
+ export * from "./config/index.js";
3
+ export * from "./client.js";
4
+ export * from "./auth/index.js";
5
+ export { AssetConfigDto, CatalogSchema, ContractNegotiationSchema, DataPlaneDetailsDto, DatasetDto, DatasetManagementStateDto, DatasetSchema, DatasetStateUpdateDto, DatasetSubmissionDto, DatasetSubmissionResponseDto, defaultContext, TransferDetailDto, TransferProcessSchema } from "@tsg-dsp/common-dsp";
6
+ export { CredentialClaimConstraint, CredentialRequirement, CredentialRequirementSet, CredentialRequirementSetCreate, DIDDocumentDto, NegotiationDetailDto, NegotiationStatusDto, ProfileRef, RequirementEvaluation, ServiceDto, SignedJwtResponse, VersionedRef } from "./vendor/common-dtos/index.js";
7
+ export { ChangePasswordDto, ClientDto, CreateClientDto, CreateUserDto, UpdateClientDto, UpdateUserDto, UserDto, UserWithPasswordDto } from "./vendor/sso-bridge-dtos/index.js";
8
+ export { CredentialOffer, CredentialOfferStatus, KeyInfo } from "./vendor/wallet-dtos/index.js";
9
+ export * from "./catalog/index.js";
10
+ export * from "./metadata/index.js";
11
+ export * from "./negotiations/index.js";
12
+ export * from "./requirements/index.js";
13
+ export * from "./sso/index.js";
14
+ export * from "./transfers/index.js";
15
+ export * from "./wallet/index.js";
16
+ export * from "./utils/index.js";
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,aAAa,CAAC;AAG5B,cAAc,iBAAiB,CAAC;AAGhC,OAAO,EACL,cAAc,EACd,aAAa,EACb,yBAAyB,EACzB,mBAAmB,EACnB,UAAU,EACV,yBAAyB,EACzB,aAAa,EACb,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,EAC5B,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,wBAAwB,EACxB,8BAA8B,EAC9B,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,UAAU,EACV,qBAAqB,EACrB,UAAU,EACV,iBAAiB,EACjB,YAAY,EACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,aAAa,EACb,eAAe,EACf,aAAa,EACb,OAAO,EACP,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,OAAO,EACR,MAAM,sBAAsB,CAAC;AAG9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,24 @@
1
+ // Main facade
2
+ export { TsgSdk } from "./tsg-sdk.js";
3
+ // Configuration
4
+ export * from "./config/index.js";
5
+ // Typed API clients
6
+ export * from "./client.js";
7
+ // Auth
8
+ export * from "./auth/index.js";
9
+ // Re-export DTOs from monorepo packages used for validation
10
+ export { AssetConfigDto, CatalogSchema, ContractNegotiationSchema, DataPlaneDetailsDto, DatasetManagementStateDto, DatasetSchema, DatasetStateUpdateDto, DatasetSubmissionDto, DatasetSubmissionResponseDto, defaultContext, TransferDetailDto, TransferProcessSchema } from "@tsg-dsp/common-dsp";
11
+ export { CredentialClaimConstraint, CredentialRequirement, CredentialRequirementSet, CredentialRequirementSetCreate, DIDDocumentDto, NegotiationDetailDto, NegotiationStatusDto, ProfileRef, RequirementEvaluation, ServiceDto, SignedJwtResponse, VersionedRef } from "./vendor/common-dtos/index.js";
12
+ export { ChangePasswordDto, ClientDto, CreateClientDto, CreateUserDto, UpdateClientDto, UpdateUserDto, UserDto, UserWithPasswordDto } from "./vendor/sso-bridge-dtos/index.js";
13
+ export { CredentialOffer, CredentialOfferStatus, KeyInfo } from "./vendor/wallet-dtos/index.js";
14
+ // SDK modules
15
+ export * from "./catalog/index.js";
16
+ export * from "./metadata/index.js";
17
+ export * from "./negotiations/index.js";
18
+ export * from "./requirements/index.js";
19
+ export * from "./sso/index.js";
20
+ export * from "./transfers/index.js";
21
+ export * from "./wallet/index.js";
22
+ // Utilities
23
+ export * from "./utils/index.js";
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,gBAAgB;AAChB,cAAc,mBAAmB,CAAC;AAElC,oBAAoB;AACpB,cAAc,aAAa,CAAC;AAE5B,OAAO;AACP,cAAc,iBAAiB,CAAC;AAEhC,4DAA4D;AAC5D,OAAO,EACL,cAAc,EACd,aAAa,EACb,yBAAyB,EACzB,mBAAmB,EAEnB,yBAAyB,EACzB,aAAa,EACb,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,EAC5B,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,wBAAwB,EACxB,8BAA8B,EAC9B,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,UAAU,EACV,qBAAqB,EACrB,UAAU,EACV,iBAAiB,EACjB,YAAY,EACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,aAAa,EACb,eAAe,EACf,aAAa,EACb,OAAO,EACP,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,OAAO,EACR,MAAM,sBAAsB,CAAC;AAE9B,cAAc;AACd,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAElC,YAAY;AACZ,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./metadata.sdk.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/metadata/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./metadata.sdk.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/metadata/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,111 @@
1
+ import { AssetConfigDto, Dataset, DatasetDto, DatasetManagementStateDto, DatasetStateUpdateDto, DatasetSubmissionResponseDto } from "@tsg-dsp/common-dsp";
2
+ import type { VersionedRef } from "../vendor/common-dtos/index.js";
3
+ import type { ControlPlaneClient } from "../client.js";
4
+ /**
5
+ * Input for publishing or updating a dataset.
6
+ *
7
+ * Mirrors the control plane `DatasetSubmissionDto`: public DCAT-AP metadata is
8
+ * published to the catalog while the private {@link AssetConfigDto | asset
9
+ * configuration} (backend URL + authorization) is stored privately and never
10
+ * exposed through the catalog. It is forwarded to the serving data plane only
11
+ * at dataflow `prepare` time.
12
+ */
13
+ export interface DatasetSubmission {
14
+ /** Identifier of the data plane that will serve the dataset. */
15
+ dataPlaneId: string;
16
+ /**
17
+ * DCAT-AP dataset metadata, either as a {@link Dataset} class instance or an
18
+ * already-serialized JSON-LD {@link DatasetDto}.
19
+ */
20
+ dataset: Dataset | DatasetDto;
21
+ /**
22
+ * Private execution configuration withheld from the public catalog.
23
+ * Omission during update clears the previous configuration.
24
+ */
25
+ assetConfig?: AssetConfigDto;
26
+ /** Immutable consumer credential requirements referenced by the ODRL offer. */
27
+ requirementSetRef?: VersionedRef;
28
+ }
29
+ /**
30
+ * Publish and manage datasets through the control plane management API.
31
+ *
32
+ * The metadata module decouples dataset creation from the data plane: an
33
+ * application decides *what* datasets exist — their DCAT-AP metadata, ODRL
34
+ * policies and backend configuration — and submits them to the control plane,
35
+ * which records which data plane serves each dataset. The data plane itself
36
+ * only receives execution configuration just-in-time during a transfer.
37
+ * @example
38
+ * ```ts
39
+ * const { datasetId } = await sdk.metadata.publishDataset({
40
+ * dataPlaneId: "urn:uuid:dp-1",
41
+ * dataset: new Dataset({ id: "urn:uuid:ds-1", title: ["Sales"] }),
42
+ * assetConfig: {
43
+ * backendUrl: "http://backend.internal/api",
44
+ * authorization: "Bearer secret",
45
+ * },
46
+ * });
47
+ * ```
48
+ */
49
+ export declare class MetadataSdk {
50
+ private readonly client;
51
+ constructor(client: ControlPlaneClient);
52
+ /**
53
+ * Build the request body, serializing the dataset to a JSON-LD DTO when a
54
+ * {@link Dataset} class instance is supplied and passing through an
55
+ * already-serialized DTO unchanged.
56
+ * @param submission - The dataset submission input.
57
+ * @returns The request body shaped for the generated client.
58
+ * @internal
59
+ */
60
+ private toBody;
61
+ /**
62
+ * Publish a new dataset: submit its DCAT metadata plus private asset
63
+ * configuration and record which data plane serves it.
64
+ * @param submission - The dataset metadata, serving data plane, and asset configuration.
65
+ * @returns The id assigned to the published dataset.
66
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.REQUEST_FAILED} if the submission is rejected.
67
+ */
68
+ publishDataset(submission: DatasetSubmission): Promise<DatasetSubmissionResponseDto>;
69
+ /**
70
+ * Update an existing dataset's metadata and asset configuration.
71
+ * @param id - The dataset identifier.
72
+ * @param submission - The updated dataset metadata, serving data plane, and asset configuration.
73
+ * @returns The id of the updated dataset.
74
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.NOT_FOUND} if the dataset does not exist.
75
+ */
76
+ updateDataset(id: string, submission: DatasetSubmission): Promise<DatasetSubmissionResponseDto>;
77
+ /**
78
+ * Update public metadata without replacing private backend configuration,
79
+ * the owning data plane or credential requirements. Existing dataflows keep
80
+ * their prepare-time configuration, including after explicit replacements.
81
+ * @param id - The existing dataset identifier.
82
+ * @param dataset - The complete updated public metadata.
83
+ * @returns The updated public dataset.
84
+ */
85
+ updateDatasetMetadata(id: string, dataset: Dataset | DatasetDto): Promise<DatasetDto>;
86
+ /**
87
+ * Remove a dataset from the catalog and delete its stored asset configuration.
88
+ * @param id - The dataset identifier.
89
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.NOT_FOUND} if the dataset does not exist.
90
+ */
91
+ removeDataset(id: string): Promise<void>;
92
+ /**
93
+ * List all published datasets.
94
+ * @param returnDto - When `true`, returns raw JSON-LD {@link DatasetDto} objects instead of deserialized {@link Dataset} instances.
95
+ * @returns The published datasets.
96
+ */
97
+ listDatasets(returnDto: true): Promise<DatasetDto[]>;
98
+ listDatasets(returnDto?: false): Promise<Dataset[]>;
99
+ /**
100
+ * Fetch a single published dataset by id.
101
+ * @param id - The dataset identifier.
102
+ * @param returnDto - When `true`, returns the raw JSON-LD {@link DatasetDto} instead of a deserialized {@link Dataset} instance.
103
+ * @returns The requested dataset.
104
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.NOT_FOUND} if the dataset does not exist.
105
+ */
106
+ getDataset(id: string, returnDto: true): Promise<DatasetDto>;
107
+ getDataset(id: string, returnDto?: false): Promise<Dataset>;
108
+ getDatasetState(id: string): Promise<DatasetManagementStateDto>;
109
+ updateDatasetState(id: string, update: DatasetStateUpdateDto): Promise<DatasetManagementStateDto>;
110
+ }
111
+ //# sourceMappingURL=metadata.sdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata.sdk.d.ts","sourceRoot":"","sources":["../../src/metadata/metadata.sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,OAAO,EACP,UAAU,EACV,yBAAyB,EACzB,qBAAqB,EACrB,4BAA4B,EAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAavD;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC,gEAAgE;IAChE,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,OAAO,EAAE,OAAO,GAAG,UAAU,CAAC;IAC9B;;;OAGG;IACH,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,+EAA+E;IAC/E,iBAAiB,CAAC,EAAE,YAAY,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,kBAAkB;IAEvD;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM;IAcd;;;;;;OAMG;IACG,cAAc,CAClB,UAAU,EAAE,iBAAiB,GAC5B,OAAO,CAAC,4BAA4B,CAAC;IAaxC;;;;;;OAMG;IACG,aAAa,CACjB,EAAE,EAAE,MAAM,EACV,UAAU,EAAE,iBAAiB,GAC5B,OAAO,CAAC,4BAA4B,CAAC;IAcxC;;;;;;;OAOG;IACG,qBAAqB,CACzB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,OAAO,GAAG,UAAU,GAC5B,OAAO,CAAC,UAAU,CAAC;IAetB;;;;OAIG;IACG,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM9C;;;;OAIG;IACG,YAAY,CAAC,SAAS,EAAE,IAAI,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IACpD,YAAY,CAAC,SAAS,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IASzD;;;;;;OAMG;IACG,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC;IAC5D,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC;IAQ3D,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAa/D,kBAAkB,CACtB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,yBAAyB,CAAC;CAatC"}
@@ -0,0 +1,142 @@
1
+ import { Dataset } from "@tsg-dsp/common-dsp";
2
+ import { SdkError, SdkErrorCode } from "../utils/errors.js";
3
+ import { validateJsonLD } from "../utils/validate.js";
4
+ /**
5
+ * Publish and manage datasets through the control plane management API.
6
+ *
7
+ * The metadata module decouples dataset creation from the data plane: an
8
+ * application decides *what* datasets exist — their DCAT-AP metadata, ODRL
9
+ * policies and backend configuration — and submits them to the control plane,
10
+ * which records which data plane serves each dataset. The data plane itself
11
+ * only receives execution configuration just-in-time during a transfer.
12
+ * @example
13
+ * ```ts
14
+ * const { datasetId } = await sdk.metadata.publishDataset({
15
+ * dataPlaneId: "urn:uuid:dp-1",
16
+ * dataset: new Dataset({ id: "urn:uuid:ds-1", title: ["Sales"] }),
17
+ * assetConfig: {
18
+ * backendUrl: "http://backend.internal/api",
19
+ * authorization: "Bearer secret",
20
+ * },
21
+ * });
22
+ * ```
23
+ */
24
+ export class MetadataSdk {
25
+ client;
26
+ constructor(client) {
27
+ this.client = client;
28
+ }
29
+ /**
30
+ * Build the request body, serializing the dataset to a JSON-LD DTO when a
31
+ * {@link Dataset} class instance is supplied and passing through an
32
+ * already-serialized DTO unchanged.
33
+ * @param submission - The dataset submission input.
34
+ * @returns The request body shaped for the generated client.
35
+ * @internal
36
+ */
37
+ toBody(submission) {
38
+ const dataset = submission.dataset instanceof Dataset
39
+ ? submission.dataset.serialize()
40
+ : submission.dataset;
41
+ return {
42
+ dataPlaneId: submission.dataPlaneId,
43
+ // Cast to bridge the strict generated schema vs. the JSON-LD DatasetDto.
44
+ dataset: dataset,
45
+ assetConfig: submission.assetConfig,
46
+ requirementSetRef: submission.requirementSetRef
47
+ };
48
+ }
49
+ /**
50
+ * Publish a new dataset: submit its DCAT metadata plus private asset
51
+ * configuration and record which data plane serves it.
52
+ * @param submission - The dataset metadata, serving data plane, and asset configuration.
53
+ * @returns The id assigned to the published dataset.
54
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.REQUEST_FAILED} if the submission is rejected.
55
+ */
56
+ async publishDataset(submission) {
57
+ const { data } = await this.client.POST("/management/datasets", {
58
+ body: this.toBody(submission)
59
+ });
60
+ if (!data) {
61
+ throw new SdkError("Dataset submission returned no response body", SdkErrorCode.REQUEST_FAILED);
62
+ }
63
+ return data;
64
+ }
65
+ /**
66
+ * Update an existing dataset's metadata and asset configuration.
67
+ * @param id - The dataset identifier.
68
+ * @param submission - The updated dataset metadata, serving data plane, and asset configuration.
69
+ * @returns The id of the updated dataset.
70
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.NOT_FOUND} if the dataset does not exist.
71
+ */
72
+ async updateDataset(id, submission) {
73
+ const { data } = await this.client.PUT("/management/datasets/{id}", {
74
+ params: { path: { id } },
75
+ body: this.toBody(submission)
76
+ });
77
+ if (!data) {
78
+ throw new SdkError("Dataset update returned no response body", SdkErrorCode.REQUEST_FAILED);
79
+ }
80
+ return data;
81
+ }
82
+ /**
83
+ * Update public metadata without replacing private backend configuration,
84
+ * the owning data plane or credential requirements. Existing dataflows keep
85
+ * their prepare-time configuration, including after explicit replacements.
86
+ * @param id - The existing dataset identifier.
87
+ * @param dataset - The complete updated public metadata.
88
+ * @returns The updated public dataset.
89
+ */
90
+ async updateDatasetMetadata(id, dataset) {
91
+ const { data } = await this.client.PUT("/management/catalog/dataset/{id}", {
92
+ params: { path: { id } },
93
+ body: (dataset instanceof Dataset
94
+ ? dataset.serialize()
95
+ : dataset)
96
+ });
97
+ if (!data)
98
+ throw new SdkError("Dataset metadata update returned no response body", SdkErrorCode.REQUEST_FAILED);
99
+ return data;
100
+ }
101
+ /**
102
+ * Remove a dataset from the catalog and delete its stored asset configuration.
103
+ * @param id - The dataset identifier.
104
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.NOT_FOUND} if the dataset does not exist.
105
+ */
106
+ async removeDataset(id) {
107
+ await this.client.DELETE("/management/datasets/{id}", {
108
+ params: { path: { id } }
109
+ });
110
+ }
111
+ async listDatasets(returnDto = false) {
112
+ const { data } = await this.client.GET("/management/datasets");
113
+ const datasets = data ?? [];
114
+ return Promise.all(datasets.map((dataset) => validateJsonLD(dataset, returnDto)));
115
+ }
116
+ async getDataset(id, returnDto = false) {
117
+ const { data } = await this.client.GET("/management/datasets/{id}", {
118
+ params: { path: { id } }
119
+ });
120
+ return validateJsonLD(data, returnDto);
121
+ }
122
+ async getDatasetState(id) {
123
+ const { data } = await this.client.GET("/management/datasets/{id}/state", {
124
+ params: { path: { id } }
125
+ });
126
+ if (!data) {
127
+ throw new SdkError(`Dataset ${id} management state was not returned`, SdkErrorCode.NOT_FOUND);
128
+ }
129
+ return data;
130
+ }
131
+ async updateDatasetState(id, update) {
132
+ const { data } = await this.client.PUT("/management/datasets/{id}/state", {
133
+ params: { path: { id } },
134
+ body: update
135
+ });
136
+ if (!data) {
137
+ throw new SdkError(`Dataset ${id} management state update returned no body`, SdkErrorCode.REQUEST_FAILED);
138
+ }
139
+ return data;
140
+ }
141
+ }
142
+ //# sourceMappingURL=metadata.sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata.sdk.js","sourceRoot":"","sources":["../../src/metadata/metadata.sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,OAAO,EAKR,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAqCtD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,WAAW;IACO;IAA7B,YAA6B,MAA0B;QAA1B,WAAM,GAAN,MAAM,CAAoB;IAAG,CAAC;IAE3D;;;;;;;OAOG;IACK,MAAM,CAAC,UAA6B;QAC1C,MAAM,OAAO,GACX,UAAU,CAAC,OAAO,YAAY,OAAO;YACnC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,SAAS,EAAE;YAChC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC;QACzB,OAAO;YACL,WAAW,EAAE,UAAU,CAAC,WAAW;YACnC,yEAAyE;YACzE,OAAO,EAAE,OAA2C;YACpD,WAAW,EAAE,UAAU,CAAC,WAAW;YACnC,iBAAiB,EAAE,UAAU,CAAC,iBAAiB;SACvB,CAAC;IAC7B,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,cAAc,CAClB,UAA6B;QAE7B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,EAAE;YAC9D,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;SAC9B,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,QAAQ,CAChB,8CAA8C,EAC9C,YAAY,CAAC,cAAc,CAC5B,CAAC;QACJ,CAAC;QACD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AAE,CAAC;YACV,MAAM,IAAI,QAAQ,CAChB,WAAW,EAAE,2CAA2C,EACxD,YAAY,CAAC,cAAc,CAC5B,CAAC;QACJ,CAAC;QACD,OAAO,IAAiC,CAAC;IAC3C,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export * from "./negotiations.sdk.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/negotiations/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./negotiations.sdk.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/negotiations/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}