@twin.org/rights-management-plugins 0.0.3-next.46 → 0.0.3-next.48
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/policyNegotiators/passThroughPolicyNegotiator.js +1 -1
- package/dist/es/policyNegotiators/passThroughPolicyNegotiator.js.map +1 -1
- package/dist/es/policyRequesters/passThroughPolicyRequester.js +2 -2
- package/dist/es/policyRequesters/passThroughPolicyRequester.js.map +1 -1
- package/dist/types/policyNegotiators/passThroughPolicyNegotiator.d.ts +1 -1
- package/dist/types/policyRequesters/passThroughPolicyRequester.d.ts +2 -2
- package/docs/changelog.md +44 -0
- package/docs/reference/classes/PassThroughPolicyNegotiator.md +1 -1
- package/docs/reference/classes/PassThroughPolicyRequester.md +2 -2
- package/package.json +2 -2
|
@@ -33,7 +33,7 @@ export class PassThroughPolicyNegotiator {
|
|
|
33
33
|
/**
|
|
34
34
|
* Determines if the negotiator supports the given offer.
|
|
35
35
|
* @param offer The offer to check.
|
|
36
|
-
* @returns
|
|
36
|
+
* @returns True if the negotiator supports the given offer.
|
|
37
37
|
*/
|
|
38
38
|
supportsOffer(offer) {
|
|
39
39
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passThroughPolicyNegotiator.js","sourceRoot":"","sources":["../../../src/policyNegotiators/passThroughPolicyNegotiator.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAI7E,OAAO,EACN,gBAAgB,EAChB,0BAA0B,EAE1B,MAAM,oCAAoC,CAAC;AAM5C,OAAO,EAAE,cAAc,EAAmB,MAAM,8BAA8B,CAAC;AAG/E;;GAEG;AACH,MAAM,OAAO,2BAA2B;IACvC;;OAEG;IACI,MAAM,CAAU,UAAU,iCAAiD;IAElF;;;OAGG;IACc,QAAQ,CAAqB;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;SACD,CAAC,CAAC;QAEH,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAA2B,KAAK,CAAC,CAAC;QAEtE,SAAS,CAAC,OAAO,CAAC,GAAG,cAAc,CAAC,SAAS,CAAC;QAC9C,SAAS,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,cAAc,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACzF,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAE9B,OAAO,SAAwC,CAAC;IACjD,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, Guards, ObjectHelper, Urn } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type { ILoggingComponent } from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\tOdrlPolicyHelper,\n\tRightsManagementNamespaces,\n\ttype IPolicyNegotiator\n} from \"@twin.org/rights-management-models\";\nimport type {\n\tIDataspaceProtocolAgreement,\n\tIDataspaceProtocolOffer,\n\tIDataspaceProtocolPolicy\n} from \"@twin.org/standards-dataspace-protocol\";\nimport { OdrlPolicyType, type IOdrlParty } from \"@twin.org/standards-w3c-odrl\";\nimport type { IPassThroughPolicyNegotiatorConstructorOptions } from \"../models/IPassThroughPolicyNegotiatorConstructorOptions.js\";\n\n/**\n * Pass Through Policy Negotiator.\n */\nexport class PassThroughPolicyNegotiator implements IPolicyNegotiator {\n\t/**\n\t * The class name of the Pass Through Policy Negotiator.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<PassThroughPolicyNegotiator>();\n\n\t/**\n\t * The logging component.\n\t * @internal\n\t */\n\tprivate readonly _logging?: ILoggingComponent;\n\n\t/**\n\t * Create a new instance of PassThroughPolicyNegotiator.\n\t * @param options The options for the pass through policy negotiator.\n\t */\n\tconstructor(options?: IPassThroughPolicyNegotiatorConstructorOptions) {\n\t\tthis._logging = ComponentFactory.getIfExists<ILoggingComponent>(options?.loggingComponentType);\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn PassThroughPolicyNegotiator.CLASS_NAME;\n\t}\n\n\t/**\n\t * Determines if the negotiator supports the given offer.\n\t * @param offer The offer to check.\n\t * @returns
|
|
1
|
+
{"version":3,"file":"passThroughPolicyNegotiator.js","sourceRoot":"","sources":["../../../src/policyNegotiators/passThroughPolicyNegotiator.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAI7E,OAAO,EACN,gBAAgB,EAChB,0BAA0B,EAE1B,MAAM,oCAAoC,CAAC;AAM5C,OAAO,EAAE,cAAc,EAAmB,MAAM,8BAA8B,CAAC;AAG/E;;GAEG;AACH,MAAM,OAAO,2BAA2B;IACvC;;OAEG;IACI,MAAM,CAAU,UAAU,iCAAiD;IAElF;;;OAGG;IACc,QAAQ,CAAqB;IAE9C;;;OAGG;IACH,YAAY,OAAwD;QACnE,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,WAAW,CAAoB,OAAO,EAAE,oBAAoB,CAAC,CAAC;IAChG,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,2BAA2B,CAAC,UAAU,CAAC;IAC/C,CAAC;IAED;;;;OAIG;IACI,aAAa,CAAC,KAA8B;QAClD,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,WAAW,CACvB,KAA8B,EAC9B,WAAiD;QAKjD,MAAM,CAAC,MAAM,CACZ,2BAA2B,CAAC,UAAU,WAEtC,KAAK,CACL,CAAC;QAEF,MAAM,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;YACxB,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,2BAA2B,CAAC,UAAU;YAC9C,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;YACd,OAAO,EAAE,eAAe;YACxB,IAAI,EAAE;gBACL,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE;aAC7C;SACD,CAAC,CAAC;QAEH,OAAO;YACN,QAAQ,EAAE,IAAI;YACd,oBAAoB,EAAE,KAAK;SAC3B,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,eAAe,CAC3B,KAA8B,EAC9B,QAA6B,EAC7B,WAAiD;QAEjD,MAAM,CAAC,MAAM,CACZ,2BAA2B,CAAC,UAAU,WAEtC,KAAK,CACL,CAAC;QAEF,MAAM,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;YACxB,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,2BAA2B,CAAC,UAAU;YAC9C,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;YACd,OAAO,EAAE,iBAAiB;YAC1B,IAAI,EAAE;gBACL,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE;aAC7C;SACD,CAAC,CAAC;QAEH,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAA2B,KAAK,CAAC,CAAC;QAEtE,SAAS,CAAC,OAAO,CAAC,GAAG,cAAc,CAAC,SAAS,CAAC;QAC9C,SAAS,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,cAAc,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACzF,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAE9B,OAAO,SAAwC,CAAC;IACjD,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, Guards, ObjectHelper, Urn } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type { ILoggingComponent } from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\tOdrlPolicyHelper,\n\tRightsManagementNamespaces,\n\ttype IPolicyNegotiator\n} from \"@twin.org/rights-management-models\";\nimport type {\n\tIDataspaceProtocolAgreement,\n\tIDataspaceProtocolOffer,\n\tIDataspaceProtocolPolicy\n} from \"@twin.org/standards-dataspace-protocol\";\nimport { OdrlPolicyType, type IOdrlParty } from \"@twin.org/standards-w3c-odrl\";\nimport type { IPassThroughPolicyNegotiatorConstructorOptions } from \"../models/IPassThroughPolicyNegotiatorConstructorOptions.js\";\n\n/**\n * Pass Through Policy Negotiator.\n */\nexport class PassThroughPolicyNegotiator implements IPolicyNegotiator {\n\t/**\n\t * The class name of the Pass Through Policy Negotiator.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<PassThroughPolicyNegotiator>();\n\n\t/**\n\t * The logging component.\n\t * @internal\n\t */\n\tprivate readonly _logging?: ILoggingComponent;\n\n\t/**\n\t * Create a new instance of PassThroughPolicyNegotiator.\n\t * @param options The options for the pass through policy negotiator.\n\t */\n\tconstructor(options?: IPassThroughPolicyNegotiatorConstructorOptions) {\n\t\tthis._logging = ComponentFactory.getIfExists<ILoggingComponent>(options?.loggingComponentType);\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn PassThroughPolicyNegotiator.CLASS_NAME;\n\t}\n\n\t/**\n\t * Determines if the negotiator supports the given offer.\n\t * @param offer The offer to check.\n\t * @returns True if the negotiator supports the given offer.\n\t */\n\tpublic supportsOffer(offer: IDataspaceProtocolOffer): boolean {\n\t\treturn true;\n\t}\n\n\t/**\n\t * Handle the offer.\n\t * @param offer The offer to check.\n\t * @param information Information provided by the requester to determine if a policy can be created.\n\t * @returns Sets the accepted flag if it can be offered, and the interventionRequired flag if manual agreement is needed.\n\t */\n\tpublic async handleOffer(\n\t\toffer: IDataspaceProtocolOffer,\n\t\tinformation?: { [id: string]: IJsonLdNodeObject }\n\t): Promise<{\n\t\taccepted: boolean;\n\t\tinterventionRequired: boolean;\n\t}> {\n\t\tGuards.object<IDataspaceProtocolOffer>(\n\t\t\tPassThroughPolicyNegotiator.CLASS_NAME,\n\t\t\tnameof(offer),\n\t\t\toffer\n\t\t);\n\n\t\tawait this._logging?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: PassThroughPolicyNegotiator.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"handlingOffer\",\n\t\t\tdata: {\n\t\t\t\tofferId: OdrlPolicyHelper.getUid(offer) ?? \"\"\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\taccepted: true,\n\t\t\tinterventionRequired: false\n\t\t};\n\t}\n\n\t/**\n\t * Create an agreement based on the offer.\n\t * @param offer The offer to create the agreement from.\n\t * @param assignee The assignee of the agreement.\n\t * @param information Information provided by the requester to aid in the creation of the agreement.\n\t * @returns The agreement created from the offer or undefined if an agreement could not be created.\n\t */\n\tpublic async createAgreement(\n\t\toffer: IDataspaceProtocolOffer,\n\t\tassignee: string | IOdrlParty,\n\t\tinformation?: { [id: string]: IJsonLdNodeObject }\n\t): Promise<IDataspaceProtocolAgreement | undefined> {\n\t\tGuards.object<IDataspaceProtocolOffer>(\n\t\t\tPassThroughPolicyNegotiator.CLASS_NAME,\n\t\t\tnameof(offer),\n\t\t\toffer\n\t\t);\n\n\t\tawait this._logging?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: PassThroughPolicyNegotiator.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"createAgreement\",\n\t\t\tdata: {\n\t\t\t\tofferId: OdrlPolicyHelper.getUid(offer) ?? \"\"\n\t\t\t}\n\t\t});\n\n\t\tconst agreement = ObjectHelper.clone<IDataspaceProtocolPolicy>(offer);\n\n\t\tagreement[\"@type\"] = OdrlPolicyType.Agreement;\n\t\tagreement[\"@id\"] = Urn.generateRandom(RightsManagementNamespaces.Policy).toString(false);\n\t\tagreement.assignee = assignee;\n\n\t\treturn agreement as IDataspaceProtocolAgreement;\n\t}\n}\n"]}
|
|
@@ -70,7 +70,7 @@ export class PassThroughPolicyRequester {
|
|
|
70
70
|
/**
|
|
71
71
|
* A policy finalisation has been sent by a provider, let the request handler know about it.
|
|
72
72
|
* @param negotiationId The id of the negotiation.
|
|
73
|
-
* @returns
|
|
73
|
+
* @returns A promise that resolves when the finalisation has been processed.
|
|
74
74
|
*/
|
|
75
75
|
async finalised(negotiationId) {
|
|
76
76
|
await this._logging?.log({
|
|
@@ -86,7 +86,7 @@ export class PassThroughPolicyRequester {
|
|
|
86
86
|
/**
|
|
87
87
|
* A policy termination has been sent by a provider, let the request handler know about it.
|
|
88
88
|
* @param negotiationId The id of the negotiation.
|
|
89
|
-
* @returns
|
|
89
|
+
* @returns A promise that resolves when the termination has been processed.
|
|
90
90
|
*/
|
|
91
91
|
async terminated(negotiationId) {
|
|
92
92
|
await this._logging?.log({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passThroughPolicyRequester.js","sourceRoot":"","sources":["../../../src/policyRequesters/passThroughPolicyRequester.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlD,OAAO,EAAE,gBAAgB,EAAyB,MAAM,oCAAoC,CAAC;AAO7F;;GAEG;AACH,MAAM,OAAO,0BAA0B;IACtC;;OAEG;IACI,MAAM,CAAU,UAAU,gCAAgD;IAEjF;;;OAGG;IACc,QAAQ,CAAqB;IAE9C;;;OAGG;IACH,YAAY,OAAuD;QAClE,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,WAAW,CAAoB,OAAO,EAAE,oBAAoB,CAAC,CAAC;IAChG,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,0BAA0B,CAAC,UAAU,CAAC;IAC9C,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,KAAK,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E,IAAI,CAAC,GAAG,EAAE;YACd,OAAO,EAAE,YAAY;YACrB,IAAI,EAAE;gBACL,aAAa;aACb;SACD,CAAC,CAAC;IACJ,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory } from \"@twin.org/core\";\nimport type { ILoggingComponent } from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { OdrlPolicyHelper, type IPolicyRequester } from \"@twin.org/rights-management-models\";\nimport type {\n\tIDataspaceProtocolAgreement,\n\tIDataspaceProtocolOffer\n} from \"@twin.org/standards-dataspace-protocol\";\nimport type { IPassThroughPolicyRequesterConstructorOptions } from \"../models/IPassThroughPolicyRequesterConstructorOptions.js\";\n\n/**\n * Pass Through Policy Requester.\n */\nexport class PassThroughPolicyRequester implements IPolicyRequester {\n\t/**\n\t * The class name of the Pass Through Policy Requester.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<PassThroughPolicyRequester>();\n\n\t/**\n\t * The logging component.\n\t * @internal\n\t */\n\tprivate readonly _logging?: ILoggingComponent;\n\n\t/**\n\t * Create a new instance of PassThroughPolicyRequester.\n\t * @param options The options for the pass through policy Requester.\n\t */\n\tconstructor(options?: IPassThroughPolicyRequesterConstructorOptions) {\n\t\tthis._logging = ComponentFactory.getIfExists<ILoggingComponent>(options?.loggingComponentType);\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn PassThroughPolicyRequester.CLASS_NAME;\n\t}\n\n\t/**\n\t * A policy has been offered by a provider, let the request handler know about it.\n\t * @param negotiationId The id of the negotiation.\n\t * @param offer The offer sent by the provider.\n\t * @returns True if the offer was accepted, false otherwise.\n\t */\n\tpublic async offer(negotiationId: string, offer: IDataspaceProtocolOffer): Promise<boolean> {\n\t\tawait this._logging?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: PassThroughPolicyRequester.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"offer\",\n\t\t\tdata: {\n\t\t\t\tnegotiationId,\n\t\t\t\tofferId: OdrlPolicyHelper.getUid(offer) ?? \"\"\n\t\t\t}\n\t\t});\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * A policy agreement has been sent by a provider, let the request handler know about it.\n\t * @param negotiationId The id of the negotiation.\n\t * @param agreement The agreement sent by the provider.\n\t * @returns True if the agreement was accepted, false otherwise.\n\t */\n\tpublic async agreement(\n\t\tnegotiationId: string,\n\t\tagreement: IDataspaceProtocolAgreement\n\t): Promise<boolean> {\n\t\tawait this._logging?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: PassThroughPolicyRequester.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"agreement\",\n\t\t\tdata: {\n\t\t\t\tnegotiationId,\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement) ?? \"\"\n\t\t\t}\n\t\t});\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * A policy finalisation has been sent by a provider, let the request handler know about it.\n\t * @param negotiationId The id of the negotiation.\n\t * @returns
|
|
1
|
+
{"version":3,"file":"passThroughPolicyRequester.js","sourceRoot":"","sources":["../../../src/policyRequesters/passThroughPolicyRequester.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlD,OAAO,EAAE,gBAAgB,EAAyB,MAAM,oCAAoC,CAAC;AAO7F;;GAEG;AACH,MAAM,OAAO,0BAA0B;IACtC;;OAEG;IACI,MAAM,CAAU,UAAU,gCAAgD;IAEjF;;;OAGG;IACc,QAAQ,CAAqB;IAE9C;;;OAGG;IACH,YAAY,OAAuD;QAClE,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,WAAW,CAAoB,OAAO,EAAE,oBAAoB,CAAC,CAAC;IAChG,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,0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ACxB,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,0BAA0B,CAAC,UAAU;YAC7C,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;YACd,OAAO,EAAE,YAAY;YACrB,IAAI,EAAE;gBACL,aAAa;aACb;SACD,CAAC,CAAC;IACJ,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory } from \"@twin.org/core\";\nimport type { ILoggingComponent } from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { OdrlPolicyHelper, type IPolicyRequester } from \"@twin.org/rights-management-models\";\nimport type {\n\tIDataspaceProtocolAgreement,\n\tIDataspaceProtocolOffer\n} from \"@twin.org/standards-dataspace-protocol\";\nimport type { IPassThroughPolicyRequesterConstructorOptions } from \"../models/IPassThroughPolicyRequesterConstructorOptions.js\";\n\n/**\n * Pass Through Policy Requester.\n */\nexport class PassThroughPolicyRequester implements IPolicyRequester {\n\t/**\n\t * The class name of the Pass Through Policy Requester.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<PassThroughPolicyRequester>();\n\n\t/**\n\t * The logging component.\n\t * @internal\n\t */\n\tprivate readonly _logging?: ILoggingComponent;\n\n\t/**\n\t * Create a new instance of PassThroughPolicyRequester.\n\t * @param options The options for the pass through policy Requester.\n\t */\n\tconstructor(options?: IPassThroughPolicyRequesterConstructorOptions) {\n\t\tthis._logging = ComponentFactory.getIfExists<ILoggingComponent>(options?.loggingComponentType);\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn PassThroughPolicyRequester.CLASS_NAME;\n\t}\n\n\t/**\n\t * A policy has been offered by a provider, let the request handler know about it.\n\t * @param negotiationId The id of the negotiation.\n\t * @param offer The offer sent by the provider.\n\t * @returns True if the offer was accepted, false otherwise.\n\t */\n\tpublic async offer(negotiationId: string, offer: IDataspaceProtocolOffer): Promise<boolean> {\n\t\tawait this._logging?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: PassThroughPolicyRequester.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"offer\",\n\t\t\tdata: {\n\t\t\t\tnegotiationId,\n\t\t\t\tofferId: OdrlPolicyHelper.getUid(offer) ?? \"\"\n\t\t\t}\n\t\t});\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * A policy agreement has been sent by a provider, let the request handler know about it.\n\t * @param negotiationId The id of the negotiation.\n\t * @param agreement The agreement sent by the provider.\n\t * @returns True if the agreement was accepted, false otherwise.\n\t */\n\tpublic async agreement(\n\t\tnegotiationId: string,\n\t\tagreement: IDataspaceProtocolAgreement\n\t): Promise<boolean> {\n\t\tawait this._logging?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: PassThroughPolicyRequester.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"agreement\",\n\t\t\tdata: {\n\t\t\t\tnegotiationId,\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement) ?? \"\"\n\t\t\t}\n\t\t});\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * A policy finalisation has been sent by a provider, let the request handler know about it.\n\t * @param negotiationId The id of the negotiation.\n\t * @returns A promise that resolves when the finalisation has been processed.\n\t */\n\tpublic async finalised(negotiationId: string): Promise<void> {\n\t\tawait this._logging?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: PassThroughPolicyRequester.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"finalised\",\n\t\t\tdata: {\n\t\t\t\tnegotiationId\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * A policy termination has been sent by a provider, let the request handler know about it.\n\t * @param negotiationId The id of the negotiation.\n\t * @returns A promise that resolves when the termination has been processed.\n\t */\n\tpublic async terminated(negotiationId: string): Promise<void> {\n\t\tawait this._logging?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: PassThroughPolicyRequester.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"terminated\",\n\t\t\tdata: {\n\t\t\t\tnegotiationId\n\t\t\t}\n\t\t});\n\t}\n}\n"]}
|
|
@@ -24,7 +24,7 @@ export declare class PassThroughPolicyNegotiator implements IPolicyNegotiator {
|
|
|
24
24
|
/**
|
|
25
25
|
* Determines if the negotiator supports the given offer.
|
|
26
26
|
* @param offer The offer to check.
|
|
27
|
-
* @returns
|
|
27
|
+
* @returns True if the negotiator supports the given offer.
|
|
28
28
|
*/
|
|
29
29
|
supportsOffer(offer: IDataspaceProtocolOffer): boolean;
|
|
30
30
|
/**
|
|
@@ -36,13 +36,13 @@ export declare class PassThroughPolicyRequester implements IPolicyRequester {
|
|
|
36
36
|
/**
|
|
37
37
|
* A policy finalisation has been sent by a provider, let the request handler know about it.
|
|
38
38
|
* @param negotiationId The id of the negotiation.
|
|
39
|
-
* @returns
|
|
39
|
+
* @returns A promise that resolves when the finalisation has been processed.
|
|
40
40
|
*/
|
|
41
41
|
finalised(negotiationId: string): Promise<void>;
|
|
42
42
|
/**
|
|
43
43
|
* A policy termination has been sent by a provider, let the request handler know about it.
|
|
44
44
|
* @param negotiationId The id of the negotiation.
|
|
45
|
-
* @returns
|
|
45
|
+
* @returns A promise that resolves when the termination has been processed.
|
|
46
46
|
*/
|
|
47
47
|
terminated(negotiationId: string): Promise<void>;
|
|
48
48
|
}
|
package/docs/changelog.md
CHANGED
|
@@ -6,6 +6,50 @@
|
|
|
6
6
|
|
|
7
7
|
* remove EcosystemPolicy-related examples/assumptions; plugins now target standard ODRL policy types for v2.
|
|
8
8
|
|
|
9
|
+
## [0.0.3-next.48](https://github.com/iotaledger/twin-rights-management/compare/rights-management-plugins-v0.0.3-next.47...rights-management-plugins-v0.0.3-next.48) (2026-06-15)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* use async getStore in tests ([61b9951](https://github.com/iotaledger/twin-rights-management/commit/61b99512f90faa26d22d57b6fbd3186a5cb53672))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Dependencies
|
|
18
|
+
|
|
19
|
+
* The following workspace dependencies were updated
|
|
20
|
+
* dependencies
|
|
21
|
+
* @twin.org/rights-management-models bumped from 0.0.3-next.47 to 0.0.3-next.48
|
|
22
|
+
* devDependencies
|
|
23
|
+
* @twin.org/rights-management-pap-service bumped from 0.0.3-next.47 to 0.0.3-next.48
|
|
24
|
+
* @twin.org/rights-management-pdp-service bumped from 0.0.3-next.47 to 0.0.3-next.48
|
|
25
|
+
* @twin.org/rights-management-pep-service bumped from 0.0.3-next.47 to 0.0.3-next.48
|
|
26
|
+
* @twin.org/rights-management-pip-service bumped from 0.0.3-next.47 to 0.0.3-next.48
|
|
27
|
+
* @twin.org/rights-management-pmp-service bumped from 0.0.3-next.47 to 0.0.3-next.48
|
|
28
|
+
* @twin.org/rights-management-pnp-service bumped from 0.0.3-next.47 to 0.0.3-next.48
|
|
29
|
+
* @twin.org/rights-management-pxp-service bumped from 0.0.3-next.47 to 0.0.3-next.48
|
|
30
|
+
|
|
31
|
+
## [0.0.3-next.47](https://github.com/iotaledger/twin-rights-management/compare/rights-management-plugins-v0.0.3-next.46...rights-management-plugins-v0.0.3-next.47) (2026-06-12)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Miscellaneous Chores
|
|
35
|
+
|
|
36
|
+
* **rights-management-plugins:** Synchronize repo versions
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Dependencies
|
|
40
|
+
|
|
41
|
+
* The following workspace dependencies were updated
|
|
42
|
+
* dependencies
|
|
43
|
+
* @twin.org/rights-management-models bumped from 0.0.3-next.46 to 0.0.3-next.47
|
|
44
|
+
* devDependencies
|
|
45
|
+
* @twin.org/rights-management-pap-service bumped from 0.0.3-next.46 to 0.0.3-next.47
|
|
46
|
+
* @twin.org/rights-management-pdp-service bumped from 0.0.3-next.46 to 0.0.3-next.47
|
|
47
|
+
* @twin.org/rights-management-pep-service bumped from 0.0.3-next.46 to 0.0.3-next.47
|
|
48
|
+
* @twin.org/rights-management-pip-service bumped from 0.0.3-next.46 to 0.0.3-next.47
|
|
49
|
+
* @twin.org/rights-management-pmp-service bumped from 0.0.3-next.46 to 0.0.3-next.47
|
|
50
|
+
* @twin.org/rights-management-pnp-service bumped from 0.0.3-next.46 to 0.0.3-next.47
|
|
51
|
+
* @twin.org/rights-management-pxp-service bumped from 0.0.3-next.46 to 0.0.3-next.47
|
|
52
|
+
|
|
9
53
|
## [0.0.3-next.46](https://github.com/iotaledger/twin-rights-management/compare/rights-management-plugins-v0.0.3-next.45...rights-management-plugins-v0.0.3-next.46) (2026-06-11)
|
|
10
54
|
|
|
11
55
|
|
|
@@ -136,7 +136,7 @@ The id of the negotiation.
|
|
|
136
136
|
|
|
137
137
|
`Promise`\<`void`\>
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
A promise that resolves when the finalisation has been processed.
|
|
140
140
|
|
|
141
141
|
#### Implementation of
|
|
142
142
|
|
|
@@ -162,7 +162,7 @@ The id of the negotiation.
|
|
|
162
162
|
|
|
163
163
|
`Promise`\<`void`\>
|
|
164
164
|
|
|
165
|
-
|
|
165
|
+
A promise that resolves when the termination has been processed.
|
|
166
166
|
|
|
167
167
|
#### Implementation of
|
|
168
168
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/rights-management-plugins",
|
|
3
|
-
"version": "0.0.3-next.
|
|
3
|
+
"version": "0.0.3-next.48",
|
|
4
4
|
"description": "Plugin implementations for extending rights management behaviour across components.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@twin.org/data-json-path": "next",
|
|
26
26
|
"@twin.org/logging-models": "next",
|
|
27
27
|
"@twin.org/nameof": "next",
|
|
28
|
-
"@twin.org/rights-management-models": "0.0.3-next.
|
|
28
|
+
"@twin.org/rights-management-models": "0.0.3-next.48",
|
|
29
29
|
"@twin.org/standards-w3c-odrl": "next"
|
|
30
30
|
},
|
|
31
31
|
"main": "./dist/es/index.js",
|