@twin.org/dataspace-control-plane-service 0.0.3-next.44 → 0.0.3-next.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/dataspaceControlPlanePolicyRequester.js +2 -2
- package/dist/es/dataspaceControlPlanePolicyRequester.js.map +1 -1
- package/dist/es/dataspaceControlPlaneRoutes.js +2 -1
- package/dist/es/dataspaceControlPlaneRoutes.js.map +1 -1
- package/dist/es/dataspaceControlPlaneService.js +227 -34
- package/dist/es/dataspaceControlPlaneService.js.map +1 -1
- package/dist/es/models/IDataspaceControlPlaneServiceConfig.js.map +1 -1
- package/dist/es/restEntryPoints.js +1 -2
- package/dist/es/restEntryPoints.js.map +1 -1
- package/dist/es/utils/transferErrorUtils.js +3 -3
- package/dist/es/utils/transferErrorUtils.js.map +1 -1
- package/dist/types/dataspaceControlPlanePolicyRequester.d.ts +2 -2
- package/dist/types/dataspaceControlPlaneService.d.ts +14 -3
- package/dist/types/models/IDataspaceControlPlaneServiceConfig.d.ts +8 -0
- package/dist/types/restEntryPoints.d.ts +1 -2
- package/dist/types/utils/transferErrorUtils.d.ts +3 -3
- package/docs/changelog.md +29 -0
- package/docs/reference/classes/DataspaceControlPlanePolicyRequester.md +2 -2
- package/docs/reference/classes/DataspaceControlPlaneService.md +43 -5
- package/docs/reference/interfaces/IDataspaceControlPlaneServiceConfig.md +12 -0
- package/docs/reference/variables/restEntryPoints.md +1 -2
- package/locales/en.json +6 -2
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IDataspaceControlPlaneServiceConfig.js","sourceRoot":"","sources":["../../../src/models/IDataspaceControlPlaneServiceConfig.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Dataspace Control Plane service configuration.\n */\nexport interface IDataspaceControlPlaneServiceConfig {\n\t/**\n\t * Override the default trust generator type for token generation.\n\t * If not specified, the default trust generator configured in the trust component will be used.\n\t */\n\toverrideTrustGeneratorType?: string;\n\n\t/**\n\t * Data plane endpoint path for PULL transfers (path only, not full URL).\n\t * Will be combined with the public origin from the hosting component.\n\t *\n\t * REQUIRED if PULL transfers are supported.\n\t * If not specified, PULL transfers will not be available.\n\t *\n\t * Example: \"data-plane/data\" or \"api/data-plane/data\"\n\t */\n\tdataPlanePath?: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IDataspaceControlPlaneServiceConfig.js","sourceRoot":"","sources":["../../../src/models/IDataspaceControlPlaneServiceConfig.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Dataspace Control Plane service configuration.\n */\nexport interface IDataspaceControlPlaneServiceConfig {\n\t/**\n\t * Override the default trust generator type for token generation.\n\t * If not specified, the default trust generator configured in the trust component will be used.\n\t */\n\toverrideTrustGeneratorType?: string;\n\n\t/**\n\t * Data plane endpoint path for PULL transfers (path only, not full URL).\n\t * Will be combined with the public origin from the hosting component.\n\t *\n\t * REQUIRED if PULL transfers are supported.\n\t * If not specified, PULL transfers will not be available.\n\t *\n\t * Example: \"data-plane/data\" or \"api/data-plane/data\"\n\t */\n\tdataPlanePath?: string;\n\n\t/**\n\t * Control plane callback mount path (path only). Combined with this node's public origin to form the\n\t * consumer callbackAddress a provider POSTs DSP transfer messages back to (e.g.\n\t * `<origin>/<callbackPath>/transfers/:pid/start`), with `?organization=` appended for tenant routing.\n\t *\n\t * Example: \"dataspace\" or \"api/dataspace\".\n\t */\n\tcallbackPath?: string;\n}\n"]}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { generateRestRoutesDataspaceControlPlane, tagsDataspaceControlPlane } from "./dataspaceControlPlaneRoutes.js";
|
|
2
2
|
/**
|
|
3
3
|
* Entry points for the REST API.
|
|
4
|
-
* Defines REST routes for DSP
|
|
5
|
-
* Resolver methods (IDataspaceControlPlaneResolverComponent).
|
|
4
|
+
* Defines REST routes for DSP Transfer Process and Contract Negotiation Protocol.
|
|
6
5
|
*/
|
|
7
6
|
export const restEntryPoints = [
|
|
8
7
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restEntryPoints.js","sourceRoot":"","sources":["../../src/restEntryPoints.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,uCAAuC,EACvC,yBAAyB,EACzB,MAAM,kCAAkC,CAAC;AAE1C
|
|
1
|
+
{"version":3,"file":"restEntryPoints.js","sourceRoot":"","sources":["../../src/restEntryPoints.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,uCAAuC,EACvC,yBAAyB,EACzB,MAAM,kCAAkC,CAAC;AAE1C;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAA2B;IACtD;QACC,IAAI,EAAE,yBAAyB;QAC/B,gBAAgB,EAAE,yBAAyB;QAC3C,IAAI,EAAE,yBAAyB;QAC/B,cAAc,EAAE,uCAAuC;KACvD;CACD,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IRestRouteEntryPoint } from \"@twin.org/api-models\";\nimport {\n\tgenerateRestRoutesDataspaceControlPlane,\n\ttagsDataspaceControlPlane\n} from \"./dataspaceControlPlaneRoutes.js\";\n\n/**\n * Entry points for the REST API.\n * Defines REST routes for DSP Transfer Process and Contract Negotiation Protocol.\n */\nexport const restEntryPoints: IRestRouteEntryPoint[] = [\n\t{\n\t\tname: \"dataspace-control-plane\",\n\t\tdefaultBaseRoute: \"dataspace-control-plane\",\n\t\ttags: tagsDataspaceControlPlane,\n\t\tgenerateRoutes: generateRestRoutesDataspaceControlPlane\n\t}\n];\n"]}
|
|
@@ -68,9 +68,9 @@ export function isCatalogErrorName(error, errorName) {
|
|
|
68
68
|
return error.code?.includes(errorName) ?? false;
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
72
|
-
* @param error The
|
|
73
|
-
* @returns True if the
|
|
71
|
+
* Type guard that checks whether an unknown value is a DSP CatalogError.
|
|
72
|
+
* @param error The value to check.
|
|
73
|
+
* @returns True if the value has the JSON-LD type of a DSP CatalogError.
|
|
74
74
|
*/
|
|
75
75
|
export function isCatalogError(error) {
|
|
76
76
|
return getJsonLdType(error) === DataspaceProtocolCatalogTypes.CatalogError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transferErrorUtils.js","sourceRoot":"","sources":["../../../src/utils/transferErrorUtils.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAe,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EACN,6BAA6B,EAC7B,yBAAyB,EACzB,qCAAqC,EAGrC,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C;;;;GAIG;AACH,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAEtC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,wBAAwB,CACvC,KAAc,EACd,IAAqD;IAErD,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAE3C,OAAO;QACN,UAAU,EAAE,CAAC,yBAAyB,CAAC,OAAO,CAAC;QAC/C,OAAO,EAAE,qCAAqC,CAAC,aAAa;QAC5D,WAAW,EAAE,IAAI,EAAE,WAAW,IAAI,WAAW;QAC7C,WAAW,EAAE,IAAI,EAAE,WAAW,IAAI,WAAW;QAC7C,IAAI,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE;QACpD,MAAM,EAAE,SAAS;KACjB,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CAAC,MAAe;IACzD,4BAA4B;IAC5B,IACC,EAAE,CAAC,MAAM,CAAkC,MAAM,CAAC;QAClD,MAAM,CAAC,OAAO,CAAC,KAAK,qCAAqC,CAAC,aAAa,EACtE,CAAC;QACF,gDAAgD;QAChD,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YACjB,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3C,OAAO,eAAe,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,cAAc,CAAC,UAAU,CAAC;QAC9E,CAAC;QACD,OAAO,cAAc,CAAC,UAAU,CAAC;IAClC,CAAC;IAED,gBAAgB;IAChB,IAAI,EAAE,CAAC,MAAM,CAAS,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7D,OAAO,eAAe,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,cAAc,CAAC,UAAU,CAAC;IACjF,CAAC;IAED,OAAO,SAAS,CAAC;AAClB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CACjC,KAAqC,EACrC,SAAiB;IAEjB,OAAO,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC;AACjD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc;IAC5C,OAAO,aAAa,CAAC,KAAK,CAAC,KAAK,6BAA6B,CAAC,YAAY,CAAC;AAC5E,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { HttpErrorHelper } from \"@twin.org/api-models\";\nimport { BaseError, type IError, Is } from \"@twin.org/core\";\nimport { getJsonLdType } from \"@twin.org/dataspace-models\";\nimport {\n\tDataspaceProtocolCatalogTypes,\n\tDataspaceProtocolContexts,\n\tDataspaceProtocolTransferProcessTypes,\n\ttype IDataspaceProtocolCatalogError,\n\ttype IDataspaceProtocolTransferError\n} from \"@twin.org/standards-dataspace-protocol\";\nimport { HttpStatusCode } from \"@twin.org/web\";\n\n/**\n * Fallback value used when PIDs cannot be extracted from a malformed message.\n * DSP protocol requires consumerPid and providerPid in TransferError responses,\n * so we must provide a value even when the request is completely malformed.\n */\nconst UNKNOWN_PID = \"urn:dsp:unknown\";\n\n/**\n * Transform an error to DS Protocol TransferError format.\n * Used by both service and route layers to ensure consistent error responses.\n * Following the same pattern as Federated Catalogue's catalogErrorUtils.ts.\n * The code property uses semantic format \"ErrorName:message\".\n * The reason property contains the full flattened error chain for debugging.\n * @param error The error to transform.\n * @param pids Optional object containing consumerPid and/or providerPid.\n * @param pids.consumerPid Optional consumer process ID.\n * @param pids.providerPid Optional provider process ID.\n * @returns The TransferError.\n */\nexport function transformToTransferError(\n\terror: unknown,\n\tpids?: { consumerPid?: string; providerPid?: string }\n): IDataspaceProtocolTransferError {\n\tconst flattened = BaseError.flatten(error);\n\n\treturn {\n\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferError,\n\t\tconsumerPid: pids?.consumerPid ?? UNKNOWN_PID,\n\t\tproviderPid: pids?.providerPid ?? UNKNOWN_PID,\n\t\tcode: `${flattened[0].name}:${flattened[0].message}`,\n\t\treason: flattened\n\t};\n}\n\n/**\n * Transform the DS Protocol result to an HTTP status code.\n * Used by the routes layer to derive HTTP status from TransferError.\n *\n * @param result The result to transform.\n * @returns The transformed status code or undefined if no transformation was found or not an error.\n */\nexport function transformErrorToStatusCode(result: unknown): HttpStatusCode | undefined {\n\t// Is this a transfer error?\n\tif (\n\t\tIs.object<IDataspaceProtocolTransferError>(result) &&\n\t\tresult[\"@type\"] === DataspaceProtocolTransferProcessTypes.TransferError\n\t) {\n\t\t// Extract the error name to map to status codes\n\t\tif (result.code) {\n\t\t\tconst codePart = result.code.split(\":\")[0];\n\t\t\treturn HttpErrorHelper.ERROR_TYPE_MAP[codePart] ?? HttpStatusCode.badRequest;\n\t\t}\n\t\treturn HttpStatusCode.badRequest;\n\t}\n\n\t// Regular error\n\tif (Is.object<IError>(result) && !BaseError.isEmpty(result)) {\n\t\treturn HttpErrorHelper.ERROR_TYPE_MAP[result.name] ?? HttpStatusCode.badRequest;\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Check if a CatalogError contains a specific error name in its code.\n * @param error The CatalogError to check.\n * @param errorName The error name to check for (e.g., NotFoundError.CLASS_NAME).\n * @returns True if the error code contains the specified error name.\n */\nexport function isCatalogErrorName(\n\terror: IDataspaceProtocolCatalogError,\n\terrorName: string\n): boolean {\n\treturn error.code?.includes(errorName) ?? false;\n}\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"transferErrorUtils.js","sourceRoot":"","sources":["../../../src/utils/transferErrorUtils.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAe,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EACN,6BAA6B,EAC7B,yBAAyB,EACzB,qCAAqC,EAGrC,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C;;;;GAIG;AACH,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAEtC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,wBAAwB,CACvC,KAAc,EACd,IAAqD;IAErD,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAE3C,OAAO;QACN,UAAU,EAAE,CAAC,yBAAyB,CAAC,OAAO,CAAC;QAC/C,OAAO,EAAE,qCAAqC,CAAC,aAAa;QAC5D,WAAW,EAAE,IAAI,EAAE,WAAW,IAAI,WAAW;QAC7C,WAAW,EAAE,IAAI,EAAE,WAAW,IAAI,WAAW;QAC7C,IAAI,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE;QACpD,MAAM,EAAE,SAAS;KACjB,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CAAC,MAAe;IACzD,4BAA4B;IAC5B,IACC,EAAE,CAAC,MAAM,CAAkC,MAAM,CAAC;QAClD,MAAM,CAAC,OAAO,CAAC,KAAK,qCAAqC,CAAC,aAAa,EACtE,CAAC;QACF,gDAAgD;QAChD,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YACjB,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3C,OAAO,eAAe,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,cAAc,CAAC,UAAU,CAAC;QAC9E,CAAC;QACD,OAAO,cAAc,CAAC,UAAU,CAAC;IAClC,CAAC;IAED,gBAAgB;IAChB,IAAI,EAAE,CAAC,MAAM,CAAS,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7D,OAAO,eAAe,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,cAAc,CAAC,UAAU,CAAC;IACjF,CAAC;IAED,OAAO,SAAS,CAAC;AAClB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CACjC,KAAqC,EACrC,SAAiB;IAEjB,OAAO,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC;AACjD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc;IAC5C,OAAO,aAAa,CAAC,KAAK,CAAC,KAAK,6BAA6B,CAAC,YAAY,CAAC;AAC5E,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { HttpErrorHelper } from \"@twin.org/api-models\";\nimport { BaseError, type IError, Is } from \"@twin.org/core\";\nimport { getJsonLdType } from \"@twin.org/dataspace-models\";\nimport {\n\tDataspaceProtocolCatalogTypes,\n\tDataspaceProtocolContexts,\n\tDataspaceProtocolTransferProcessTypes,\n\ttype IDataspaceProtocolCatalogError,\n\ttype IDataspaceProtocolTransferError\n} from \"@twin.org/standards-dataspace-protocol\";\nimport { HttpStatusCode } from \"@twin.org/web\";\n\n/**\n * Fallback value used when PIDs cannot be extracted from a malformed message.\n * DSP protocol requires consumerPid and providerPid in TransferError responses,\n * so we must provide a value even when the request is completely malformed.\n */\nconst UNKNOWN_PID = \"urn:dsp:unknown\";\n\n/**\n * Transform an error to DS Protocol TransferError format.\n * Used by both service and route layers to ensure consistent error responses.\n * Following the same pattern as Federated Catalogue's catalogErrorUtils.ts.\n * The code property uses semantic format \"ErrorName:message\".\n * The reason property contains the full flattened error chain for debugging.\n * @param error The error to transform.\n * @param pids Optional object containing consumerPid and/or providerPid.\n * @param pids.consumerPid Optional consumer process ID.\n * @param pids.providerPid Optional provider process ID.\n * @returns The TransferError.\n */\nexport function transformToTransferError(\n\terror: unknown,\n\tpids?: { consumerPid?: string; providerPid?: string }\n): IDataspaceProtocolTransferError {\n\tconst flattened = BaseError.flatten(error);\n\n\treturn {\n\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferError,\n\t\tconsumerPid: pids?.consumerPid ?? UNKNOWN_PID,\n\t\tproviderPid: pids?.providerPid ?? UNKNOWN_PID,\n\t\tcode: `${flattened[0].name}:${flattened[0].message}`,\n\t\treason: flattened\n\t};\n}\n\n/**\n * Transform the DS Protocol result to an HTTP status code.\n * Used by the routes layer to derive HTTP status from TransferError.\n *\n * @param result The result to transform.\n * @returns The transformed status code or undefined if no transformation was found or not an error.\n */\nexport function transformErrorToStatusCode(result: unknown): HttpStatusCode | undefined {\n\t// Is this a transfer error?\n\tif (\n\t\tIs.object<IDataspaceProtocolTransferError>(result) &&\n\t\tresult[\"@type\"] === DataspaceProtocolTransferProcessTypes.TransferError\n\t) {\n\t\t// Extract the error name to map to status codes\n\t\tif (result.code) {\n\t\t\tconst codePart = result.code.split(\":\")[0];\n\t\t\treturn HttpErrorHelper.ERROR_TYPE_MAP[codePart] ?? HttpStatusCode.badRequest;\n\t\t}\n\t\treturn HttpStatusCode.badRequest;\n\t}\n\n\t// Regular error\n\tif (Is.object<IError>(result) && !BaseError.isEmpty(result)) {\n\t\treturn HttpErrorHelper.ERROR_TYPE_MAP[result.name] ?? HttpStatusCode.badRequest;\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Check if a CatalogError contains a specific error name in its code.\n * @param error The CatalogError to check.\n * @param errorName The error name to check for (e.g., NotFoundError.CLASS_NAME).\n * @returns True if the error code contains the specified error name.\n */\nexport function isCatalogErrorName(\n\terror: IDataspaceProtocolCatalogError,\n\terrorName: string\n): boolean {\n\treturn error.code?.includes(errorName) ?? false;\n}\n\n/**\n * Type guard that checks whether an unknown value is a DSP CatalogError.\n * @param error The value to check.\n * @returns True if the value has the JSON-LD type of a DSP CatalogError.\n */\nexport function isCatalogError(error: unknown): error is IDataspaceProtocolCatalogError {\n\treturn getJsonLdType(error) === DataspaceProtocolCatalogTypes.CatalogError;\n}\n"]}
|
|
@@ -67,14 +67,14 @@ export declare class DataspaceControlPlanePolicyRequester implements IPolicyRequ
|
|
|
67
67
|
* A policy finalisation has been sent by a provider.
|
|
68
68
|
* Called by PNP when provider sends a FinalizedEvent.
|
|
69
69
|
* @param negotiationId The id of the negotiation.
|
|
70
|
-
* @returns
|
|
70
|
+
* @returns A promise that resolves when all finalisation callbacks have been notified.
|
|
71
71
|
*/
|
|
72
72
|
finalised(negotiationId: string): Promise<void>;
|
|
73
73
|
/**
|
|
74
74
|
* A policy termination has been sent by a provider.
|
|
75
75
|
* Called by PNP when provider sends a TerminatedMessage or negotiation fails.
|
|
76
76
|
* @param negotiationId The id of the negotiation.
|
|
77
|
-
* @returns
|
|
77
|
+
* @returns A promise that resolves when all termination callbacks have been notified.
|
|
78
78
|
*/
|
|
79
79
|
terminated(negotiationId: string): Promise<void>;
|
|
80
80
|
}
|
|
@@ -49,27 +49,36 @@ export declare class DataspaceControlPlaneService implements IDataspaceControlPl
|
|
|
49
49
|
/**
|
|
50
50
|
* The service needs to be started when the application is initialized.
|
|
51
51
|
* @param nodeLoggingComponentType The node logging component type.
|
|
52
|
+
* @returns A promise that resolves when the federated catalogue is populated and the cleanup task is scheduled.
|
|
52
53
|
*/
|
|
53
54
|
start(nodeLoggingComponentType?: string): Promise<void>;
|
|
54
55
|
/**
|
|
55
56
|
* Stop the service.
|
|
56
57
|
* Removes the stalled negotiation cleanup task.
|
|
57
58
|
* @param nodeLoggingComponentType The node logging component type.
|
|
59
|
+
* @returns A promise that resolves when the cleanup task has been removed.
|
|
58
60
|
*/
|
|
59
61
|
stop(nodeLoggingComponentType?: string): Promise<void>;
|
|
60
62
|
/**
|
|
61
63
|
* Request a Transfer Process.
|
|
62
64
|
* Creates a new Transfer Process in REQUESTED state.
|
|
63
65
|
* @param request Transfer request message (DSP compliant).
|
|
66
|
+
* @param publicOrigin The public origin of this provider node, resolved by the REST route from the
|
|
67
|
+
* hosting component; used to build the data-plane endpoint when auto-starting.
|
|
68
|
+
* @param options Request options.
|
|
69
|
+
* @param options.autoStart When true, the provider immediately starts the requested transfer (scheduled
|
|
70
|
+
* on the next tick); when omitted/false the provider start must be triggered explicitly.
|
|
64
71
|
* @param trustPayload Trust payload containing authorization information (Base64-encoded token).
|
|
65
72
|
* @returns Transfer Process (DSP compliant) with state REQUESTED, or TransferError if the operation fails.
|
|
66
73
|
*
|
|
67
74
|
* Role Performed: Provider
|
|
68
75
|
* Called by: Consumer when it wants to request a new Transfer Process
|
|
69
76
|
*/
|
|
70
|
-
requestTransfer(request: IDataspaceProtocolTransferRequestMessage,
|
|
77
|
+
requestTransfer(request: IDataspaceProtocolTransferRequestMessage, publicOrigin: string, options: {
|
|
78
|
+
autoStart?: boolean;
|
|
79
|
+
} | undefined, trustPayload: unknown): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError>;
|
|
71
80
|
/**
|
|
72
|
-
*
|
|
81
|
+
* Prepare a data transfer as a Consumer.
|
|
73
82
|
* Generates a consumerPid, POSTs a TransferRequestMessage to the provider's DSP endpoint,
|
|
74
83
|
* and (only if the provider accepts) persists a local TransferProcess in REQUESTED state.
|
|
75
84
|
* @param agreementId The finalized agreement ID from contract negotiation.
|
|
@@ -87,7 +96,7 @@ export declare class DataspaceControlPlaneService implements IDataspaceControlPl
|
|
|
87
96
|
* registration ignores the runtime `endpoint` arg and silently POSTs to its
|
|
88
97
|
* static endpoint instead.
|
|
89
98
|
*/
|
|
90
|
-
|
|
99
|
+
prepareTransfer(agreementId: string, providerEndpoint: string, publicOrigin: string, format: string, trustPayload: unknown): Promise<{
|
|
91
100
|
consumerPid: string;
|
|
92
101
|
}>;
|
|
93
102
|
/**
|
|
@@ -212,11 +221,13 @@ export declare class DataspaceControlPlaneService implements IDataspaceControlPl
|
|
|
212
221
|
* @param id The stored dataset id.
|
|
213
222
|
* @param appId The dataspace app this dataset belongs to.
|
|
214
223
|
* @param dataset The dataset payload.
|
|
224
|
+
* @returns A promise that resolves when the dataset has been updated in storage and the catalogue.
|
|
215
225
|
*/
|
|
216
226
|
updateAppDataset(id: string, appId: string, dataset: IDataspaceProtocolDataset): Promise<void>;
|
|
217
227
|
/**
|
|
218
228
|
* Delete a dataspace app dataset owned by the calling organization.
|
|
219
229
|
* @param id The stored app dataset id.
|
|
230
|
+
* @returns A promise that resolves when the dataset has been removed from storage and the catalogue.
|
|
220
231
|
*/
|
|
221
232
|
deleteAppDataset(id: string): Promise<void>;
|
|
222
233
|
}
|
|
@@ -17,4 +17,12 @@ export interface IDataspaceControlPlaneServiceConfig {
|
|
|
17
17
|
* Example: "data-plane/data" or "api/data-plane/data"
|
|
18
18
|
*/
|
|
19
19
|
dataPlanePath?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Control plane callback mount path (path only). Combined with this node's public origin to form the
|
|
22
|
+
* consumer callbackAddress a provider POSTs DSP transfer messages back to (e.g.
|
|
23
|
+
* `<origin>/<callbackPath>/transfers/:pid/start`), with `?organization=` appended for tenant routing.
|
|
24
|
+
*
|
|
25
|
+
* Example: "dataspace" or "api/dataspace".
|
|
26
|
+
*/
|
|
27
|
+
callbackPath?: string;
|
|
20
28
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { IRestRouteEntryPoint } from "@twin.org/api-models";
|
|
2
2
|
/**
|
|
3
3
|
* Entry points for the REST API.
|
|
4
|
-
* Defines REST routes for DSP
|
|
5
|
-
* Resolver methods (IDataspaceControlPlaneResolverComponent).
|
|
4
|
+
* Defines REST routes for DSP Transfer Process and Contract Negotiation Protocol.
|
|
6
5
|
*/
|
|
7
6
|
export declare const restEntryPoints: IRestRouteEntryPoint[];
|
|
@@ -32,8 +32,8 @@ export declare function transformErrorToStatusCode(result: unknown): HttpStatusC
|
|
|
32
32
|
*/
|
|
33
33
|
export declare function isCatalogErrorName(error: IDataspaceProtocolCatalogError, errorName: string): boolean;
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
36
|
-
* @param error The
|
|
37
|
-
* @returns True if the
|
|
35
|
+
* Type guard that checks whether an unknown value is a DSP CatalogError.
|
|
36
|
+
* @param error The value to check.
|
|
37
|
+
* @returns True if the value has the JSON-LD type of a DSP CatalogError.
|
|
38
38
|
*/
|
|
39
39
|
export declare function isCatalogError(error: unknown): error is IDataspaceProtocolCatalogError;
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.3-next.46](https://github.com/iotaledger/twin-dataspace/compare/dataspace-control-plane-service-v0.0.3-next.45...dataspace-control-plane-service-v0.0.3-next.46) (2026-06-17)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* cross-node transfer callbacks and DataTransferManager auto-start ([#199](https://github.com/iotaledger/twin-dataspace/issues/199)) ([1089aa3](https://github.com/iotaledger/twin-dataspace/commit/1089aa344e3598e382f37a82ca03230c5cf6cacd))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/dataspace-models bumped from 0.0.3-next.45 to 0.0.3-next.46
|
|
16
|
+
|
|
17
|
+
## [0.0.3-next.45](https://github.com/iotaledger/twin-dataspace/compare/dataspace-control-plane-service-v0.0.3-next.44...dataspace-control-plane-service-v0.0.3-next.45) (2026-06-17)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* mock pnap ([35f21f8](https://github.com/iotaledger/twin-dataspace/commit/35f21f847d3fb9d2ffcb9191a18835093cd259b9))
|
|
23
|
+
* use async getStore in tests ([739531e](https://github.com/iotaledger/twin-dataspace/commit/739531e1a159f728301835cd39cf06eab7a7bf4a))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Dependencies
|
|
27
|
+
|
|
28
|
+
* The following workspace dependencies were updated
|
|
29
|
+
* dependencies
|
|
30
|
+
* @twin.org/dataspace-models bumped from 0.0.3-next.44 to 0.0.3-next.45
|
|
31
|
+
|
|
3
32
|
## [0.0.3-next.44](https://github.com/iotaledger/twin-dataspace/compare/dataspace-control-plane-service-v0.0.3-next.43...dataspace-control-plane-service-v0.0.3-next.44) (2026-06-12)
|
|
4
33
|
|
|
5
34
|
|
|
@@ -210,7 +210,7 @@ The id of the negotiation.
|
|
|
210
210
|
|
|
211
211
|
`Promise`\<`void`\>
|
|
212
212
|
|
|
213
|
-
|
|
213
|
+
A promise that resolves when all finalisation callbacks have been notified.
|
|
214
214
|
|
|
215
215
|
#### Implementation of
|
|
216
216
|
|
|
@@ -237,7 +237,7 @@ The id of the negotiation.
|
|
|
237
237
|
|
|
238
238
|
`Promise`\<`void`\>
|
|
239
239
|
|
|
240
|
-
|
|
240
|
+
A promise that resolves when all termination callbacks have been notified.
|
|
241
241
|
|
|
242
242
|
#### Implementation of
|
|
243
243
|
|
|
@@ -186,6 +186,8 @@ The node logging component type.
|
|
|
186
186
|
|
|
187
187
|
`Promise`\<`void`\>
|
|
188
188
|
|
|
189
|
+
A promise that resolves when the federated catalogue is populated and the cleanup task is scheduled.
|
|
190
|
+
|
|
189
191
|
#### Implementation of
|
|
190
192
|
|
|
191
193
|
`IDataspaceControlPlaneComponent.start`
|
|
@@ -211,6 +213,8 @@ The node logging component type.
|
|
|
211
213
|
|
|
212
214
|
`Promise`\<`void`\>
|
|
213
215
|
|
|
216
|
+
A promise that resolves when the cleanup task has been removed.
|
|
217
|
+
|
|
214
218
|
#### Implementation of
|
|
215
219
|
|
|
216
220
|
`IDataspaceControlPlaneComponent.stop`
|
|
@@ -219,7 +223,7 @@ The node logging component type.
|
|
|
219
223
|
|
|
220
224
|
### requestTransfer() {#requesttransfer}
|
|
221
225
|
|
|
222
|
-
> **requestTransfer**(`request`, `trustPayload`): `Promise`\<`IDataspaceProtocolTransferError` \| `IDataspaceProtocolTransferProcess`\>
|
|
226
|
+
> **requestTransfer**(`request`, `publicOrigin`, `options`, `trustPayload`): `Promise`\<`IDataspaceProtocolTransferError` \| `IDataspaceProtocolTransferProcess`\>
|
|
223
227
|
|
|
224
228
|
Request a Transfer Process.
|
|
225
229
|
Creates a new Transfer Process in REQUESTED state.
|
|
@@ -232,6 +236,36 @@ Creates a new Transfer Process in REQUESTED state.
|
|
|
232
236
|
|
|
233
237
|
Transfer request message (DSP compliant).
|
|
234
238
|
|
|
239
|
+
##### publicOrigin
|
|
240
|
+
|
|
241
|
+
`string`
|
|
242
|
+
|
|
243
|
+
The public origin of this provider node, resolved by the REST route from the
|
|
244
|
+
hosting component; used to build the data-plane endpoint when auto-starting.
|
|
245
|
+
|
|
246
|
+
##### options
|
|
247
|
+
|
|
248
|
+
\{ `autoStart?`: `boolean`; \} \| `undefined`
|
|
249
|
+
|
|
250
|
+
Request options.
|
|
251
|
+
|
|
252
|
+
###### Type Literal
|
|
253
|
+
|
|
254
|
+
\{ `autoStart?`: `boolean`; \}
|
|
255
|
+
|
|
256
|
+
Request options.
|
|
257
|
+
|
|
258
|
+
###### autoStart?
|
|
259
|
+
|
|
260
|
+
`boolean`
|
|
261
|
+
|
|
262
|
+
When true, the provider immediately starts the requested transfer (scheduled
|
|
263
|
+
on the next tick); when omitted/false the provider start must be triggered explicitly.
|
|
264
|
+
|
|
265
|
+
***
|
|
266
|
+
|
|
267
|
+
`undefined`
|
|
268
|
+
|
|
235
269
|
##### trustPayload
|
|
236
270
|
|
|
237
271
|
`unknown`
|
|
@@ -253,11 +287,11 @@ Called by: Consumer when it wants to request a new Transfer Process
|
|
|
253
287
|
|
|
254
288
|
***
|
|
255
289
|
|
|
256
|
-
###
|
|
290
|
+
### prepareTransfer() {#preparetransfer}
|
|
257
291
|
|
|
258
|
-
> **
|
|
292
|
+
> **prepareTransfer**(`agreementId`, `providerEndpoint`, `publicOrigin`, `format`, `trustPayload`): `Promise`\<\{ `consumerPid`: `string`; \}\>
|
|
259
293
|
|
|
260
|
-
|
|
294
|
+
Prepare a data transfer as a Consumer.
|
|
261
295
|
Generates a consumerPid, POSTs a TransferRequestMessage to the provider's DSP endpoint,
|
|
262
296
|
and (only if the provider accepts) persists a local TransferProcess in REQUESTED state.
|
|
263
297
|
|
|
@@ -309,7 +343,7 @@ static endpoint instead.
|
|
|
309
343
|
|
|
310
344
|
#### Implementation of
|
|
311
345
|
|
|
312
|
-
`IDataspaceControlPlaneComponent.
|
|
346
|
+
`IDataspaceControlPlaneComponent.prepareTransfer`
|
|
313
347
|
|
|
314
348
|
***
|
|
315
349
|
|
|
@@ -795,6 +829,8 @@ The dataset payload.
|
|
|
795
829
|
|
|
796
830
|
`Promise`\<`void`\>
|
|
797
831
|
|
|
832
|
+
A promise that resolves when the dataset has been updated in storage and the catalogue.
|
|
833
|
+
|
|
798
834
|
#### Implementation of
|
|
799
835
|
|
|
800
836
|
`IDataspaceControlPlaneComponent.updateAppDataset`
|
|
@@ -819,6 +855,8 @@ The stored app dataset id.
|
|
|
819
855
|
|
|
820
856
|
`Promise`\<`void`\>
|
|
821
857
|
|
|
858
|
+
A promise that resolves when the dataset has been removed from storage and the catalogue.
|
|
859
|
+
|
|
822
860
|
#### Implementation of
|
|
823
861
|
|
|
824
862
|
`IDataspaceControlPlaneComponent.deleteAppDataset`
|
|
@@ -24,3 +24,15 @@ REQUIRED if PULL transfers are supported.
|
|
|
24
24
|
If not specified, PULL transfers will not be available.
|
|
25
25
|
|
|
26
26
|
Example: "data-plane/data" or "api/data-plane/data"
|
|
27
|
+
|
|
28
|
+
***
|
|
29
|
+
|
|
30
|
+
### callbackPath? {#callbackpath}
|
|
31
|
+
|
|
32
|
+
> `optional` **callbackPath?**: `string`
|
|
33
|
+
|
|
34
|
+
Control plane callback mount path (path only). Combined with this node's public origin to form the
|
|
35
|
+
consumer callbackAddress a provider POSTs DSP transfer messages back to (e.g.
|
|
36
|
+
`<origin>/<callbackPath>/transfers/:pid/start`), with `?organization=` appended for tenant routing.
|
|
37
|
+
|
|
38
|
+
Example: "dataspace" or "api/dataspace".
|
|
@@ -3,5 +3,4 @@
|
|
|
3
3
|
> `const` **restEntryPoints**: `IRestRouteEntryPoint`[]
|
|
4
4
|
|
|
5
5
|
Entry points for the REST API.
|
|
6
|
-
Defines REST routes for DSP
|
|
7
|
-
Resolver methods (IDataspaceControlPlaneResolverComponent).
|
|
6
|
+
Defines REST routes for DSP Transfer Process and Contract Negotiation Protocol.
|
package/locales/en.json
CHANGED
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"negotiationHistoryRetrieved": "Negotiation history retrieved successfully",
|
|
24
24
|
"stalledNegotiationsCleanupComplete": "Stalled negotiations cleanup completed (cleanedUp: {cleanedUp})",
|
|
25
25
|
"pushTransferStarted": "PUSH transfer started (consumerPid: {consumerPid}, providerPid: {providerPid}, endpoint: {endpoint})",
|
|
26
|
-
"
|
|
27
|
-
"
|
|
26
|
+
"preparingTransfer": "Preparing consumer-initiated data transfer (agreementId: {agreementId}, providerEndpoint: {providerEndpoint}, format: {format})",
|
|
27
|
+
"transferPrepared": "Consumer data transfer prepared successfully (consumerPid: {consumerPid}, providerPid: {providerPid}, agreementId: {agreementId}, format: {format})"
|
|
28
28
|
},
|
|
29
29
|
"dataspaceControlPlanePolicyRequester": {
|
|
30
30
|
"offerReceived": "Offer received from provider (negotiationId: {negotiationId}, offerId: {offerId})",
|
|
@@ -53,6 +53,10 @@
|
|
|
53
53
|
},
|
|
54
54
|
"error": {
|
|
55
55
|
"dataspaceControlPlaneService": {
|
|
56
|
+
"transferCallbackRejected": "Consumer rejected a transfer state-change callback (messageKind: {messageKind}, consumerPid: {consumerPid}, providerPid: {providerPid}, callbackAddress: {callbackAddress})",
|
|
57
|
+
"transferCallbackFailed": "Failed to deliver a transfer state-change callback to the consumer (messageKind: {messageKind}, consumerPid: {consumerPid}, providerPid: {providerPid}, callbackAddress: {callbackAddress})",
|
|
58
|
+
"autoStartFailed": "Provider auto-start of a requested transfer failed (consumerPid: {consumerPid})",
|
|
59
|
+
"autoStartPublicOriginMissing": "Cannot auto-start the transfer: this node's public origin could not be resolved; holding the transfer in REQUESTED (consumerPid: {consumerPid})",
|
|
56
60
|
"transferProcessNotFound": "Transfer Process not found",
|
|
57
61
|
"pullTransfersNotSupported": "PULL transfers are not supported. Configure dataPlanePath in service configuration to enable PULL transfers.",
|
|
58
62
|
"transferProcessTerminated": "Transfer Process \"{consumerPid}\" is terminated and cannot be used",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/dataspace-control-plane-service",
|
|
3
|
-
"version": "0.0.3-next.
|
|
3
|
+
"version": "0.0.3-next.46",
|
|
4
4
|
"description": "Implements agreement negotiation and transfer process lifecycle management for control plane operations.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@twin.org/context": "next",
|
|
20
20
|
"@twin.org/core": "next",
|
|
21
21
|
"@twin.org/crypto": "next",
|
|
22
|
-
"@twin.org/dataspace-models": "0.0.3-next.
|
|
22
|
+
"@twin.org/dataspace-models": "0.0.3-next.46",
|
|
23
23
|
"@twin.org/entity": "next",
|
|
24
24
|
"@twin.org/entity-storage-models": "next",
|
|
25
25
|
"@twin.org/federated-catalogue-models": "next",
|