@twin.org/rights-management-plugins 0.0.3-next.53 → 0.0.3-next.55

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 (29) hide show
  1. package/dist/es/models/IStaticPolicyInformationSource.js.map +1 -1
  2. package/dist/es/policyArbiters/defaultPolicyArbiter.js +126 -8
  3. package/dist/es/policyArbiters/defaultPolicyArbiter.js.map +1 -1
  4. package/dist/es/policyArbiters/passThroughPolicyArbiter.js.map +1 -1
  5. package/dist/es/policyInformationSources/identityPolicyInformationSource.js.map +1 -1
  6. package/dist/es/policyInformationSources/identityProfilePolicyInformationSource.js +4 -4
  7. package/dist/es/policyInformationSources/identityProfilePolicyInformationSource.js.map +1 -1
  8. package/dist/es/policyInformationSources/staticPolicyInformationSource.js.map +1 -1
  9. package/dist/es/policyNegotiators/passThroughPolicyNegotiator.js.map +1 -1
  10. package/dist/es/policyObligationEnforcers/passThroughPolicyObligationEnforcer.js.map +1 -1
  11. package/dist/types/models/IStaticPolicyInformationSource.d.ts +2 -5
  12. package/dist/types/policyArbiters/defaultPolicyArbiter.d.ts +2 -5
  13. package/dist/types/policyArbiters/passThroughPolicyArbiter.d.ts +2 -5
  14. package/dist/types/policyInformationSources/identityPolicyInformationSource.d.ts +2 -5
  15. package/dist/types/policyInformationSources/identityProfilePolicyInformationSource.d.ts +2 -5
  16. package/dist/types/policyInformationSources/staticPolicyInformationSource.d.ts +2 -5
  17. package/dist/types/policyNegotiators/passThroughPolicyNegotiator.d.ts +3 -8
  18. package/dist/types/policyObligationEnforcers/passThroughPolicyObligationEnforcer.d.ts +2 -5
  19. package/docs/changelog.md +44 -0
  20. package/docs/reference/classes/DefaultPolicyArbiter.md +2 -0
  21. package/docs/reference/classes/IdentityPolicyInformationSource.md +2 -2
  22. package/docs/reference/classes/IdentityProfilePolicyInformationSource.md +2 -2
  23. package/docs/reference/classes/PassThroughPolicyArbiter.md +2 -0
  24. package/docs/reference/classes/PassThroughPolicyNegotiator.md +4 -0
  25. package/docs/reference/classes/PassThroughPolicyObligationEnforcer.md +2 -0
  26. package/docs/reference/classes/StaticPolicyInformationSource.md +2 -2
  27. package/docs/reference/interfaces/IStaticPolicyInformationSource.md +1 -5
  28. package/locales/en.json +2 -1
  29. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"passThroughPolicyArbiter.js","sourceRoot":"","sources":["../../../src/policyArbiters/passThroughPolicyArbiter.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAI1D,OAAO,EACN,gBAAgB,EAChB,cAAc,EAGd,MAAM,oCAAoC,CAAC;AAK5C;;GAEG;AACH,MAAM,OAAO,wBAAwB;IACpC;;OAEG;IACI,MAAM,CAAU,UAAU,8BAA8C;IAE/E;;;OAGG;IACc,QAAQ,CAAqB;IAE9C;;;OAGG;IACH,YAAY,OAAqD;QAChE,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,WAAW,CAAoB,OAAO,EAAE,oBAAoB,CAAC,CAAC;IAChG,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,wBAAwB,CAAC,UAAU,CAAC;IAC5C,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,MAAM,CAClB,SAAsC,EACtC,WAAiD,EACjD,IAAQ,EACR,MAAgC;QAEhC,MAAM,CAAC,MAAM,CACZ,wBAAwB,CAAC,UAAU,eAEnC,SAAS,CACT,CAAC;QAEF,MAAM,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;YACxB,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,wBAAwB,CAAC,UAAU;YAC3C,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;YACd,OAAO,EAAE,gBAAgB;YACzB,IAAI,EAAE;gBACL,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE;aAClD;SACD,CAAC,CAAC;QAEH,OAAO;YACN;gBACC,MAAM,EAAE,GAAG;gBACX,QAAQ,EAAE,cAAc,CAAC,OAAO;aAChC;SACD,CAAC;IACH,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, Guards } 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\tPolicyDecision,\n\ttype IPolicyArbiter,\n\ttype IPolicyDecision\n} from \"@twin.org/rights-management-models\";\nimport type { IDataspaceProtocolAgreement } from \"@twin.org/standards-dataspace-protocol\";\nimport type { OdrlActionType } from \"@twin.org/standards-w3c-odrl\";\nimport type { IPassThroughPolicyArbiterConstructorOptions } from \"../models/IPassThroughPolicyArbiterConstructorOptions.js\";\n\n/**\n * Pass Through Policy Arbiter.\n */\nexport class PassThroughPolicyArbiter implements IPolicyArbiter {\n\t/**\n\t * The class name of the Pass Through Policy Arbiter.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<PassThroughPolicyArbiter>();\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 PassThroughPolicyArbiter.\n\t * @param options The options for the pass through policy arbiter.\n\t */\n\tconstructor(options?: IPassThroughPolicyArbiterConstructorOptions) {\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 PassThroughPolicyArbiter.CLASS_NAME;\n\t}\n\n\t/**\n\t * Makes decisions regarding policy access to data.\n\t * @param agreement The agreement to evaluate.\n\t * @param information Information provided by the requester to determine if a policy can be created.\n\t * @param data The data to make a decision on.\n\t * @param action Optional action to make a decision on, if not provided, the arbiter will evaluate all actions in the agreement.\n\t * @returns The decisions about access to the data.\n\t */\n\tpublic async decide<D = unknown>(\n\t\tagreement: IDataspaceProtocolAgreement,\n\t\tinformation?: { [id: string]: IJsonLdNodeObject },\n\t\tdata?: D,\n\t\taction?: OdrlActionType | string\n\t): Promise<IPolicyDecision[]> {\n\t\tGuards.object<IDataspaceProtocolAgreement>(\n\t\t\tPassThroughPolicyArbiter.CLASS_NAME,\n\t\t\tnameof(agreement),\n\t\t\tagreement\n\t\t);\n\n\t\tawait this._logging?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: PassThroughPolicyArbiter.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"decidingPolicy\",\n\t\t\tdata: {\n\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(agreement) ?? \"\"\n\t\t\t}\n\t\t});\n\n\t\treturn [\n\t\t\t{\n\t\t\t\ttarget: \"$\",\n\t\t\t\tdecision: PolicyDecision.Granted\n\t\t\t}\n\t\t];\n\t}\n}\n"]}
1
+ {"version":3,"file":"passThroughPolicyArbiter.js","sourceRoot":"","sources":["../../../src/policyArbiters/passThroughPolicyArbiter.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAG1D,OAAO,EACN,gBAAgB,EAChB,cAAc,EAId,MAAM,oCAAoC,CAAC;AAK5C;;GAEG;AACH,MAAM,OAAO,wBAAwB;IACpC;;OAEG;IACI,MAAM,CAAU,UAAU,8BAA8C;IAE/E;;;OAGG;IACc,QAAQ,CAAqB;IAE9C;;;OAGG;IACH,YAAY,OAAqD;QAChE,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,WAAW,CAAoB,OAAO,EAAE,oBAAoB,CAAC,CAAC;IAChG,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,wBAAwB,CAAC,UAAU,CAAC;IAC5C,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,MAAM,CAClB,SAAsC,EACtC,WAA0C,EAC1C,IAAQ,EACR,MAAgC;QAEhC,MAAM,CAAC,MAAM,CACZ,wBAAwB,CAAC,UAAU,eAEnC,SAAS,CACT,CAAC;QAEF,MAAM,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;YACxB,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,wBAAwB,CAAC,UAAU;YAC3C,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;YACd,OAAO,EAAE,gBAAgB;YACzB,IAAI,EAAE;gBACL,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE;aAClD;SACD,CAAC,CAAC;QAEH,OAAO;YACN;gBACC,MAAM,EAAE,GAAG;gBACX,QAAQ,EAAE,cAAc,CAAC,OAAO;aAChC;SACD,CAAC;IACH,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, Guards } from \"@twin.org/core\";\nimport type { ILoggingComponent } from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\tOdrlPolicyHelper,\n\tPolicyDecision,\n\ttype IPolicyArbiter,\n\ttype IPolicyDecision,\n\ttype IRightsManagementInformation\n} from \"@twin.org/rights-management-models\";\nimport type { IDataspaceProtocolAgreement } from \"@twin.org/standards-dataspace-protocol\";\nimport type { OdrlActionType } from \"@twin.org/standards-w3c-odrl\";\nimport type { IPassThroughPolicyArbiterConstructorOptions } from \"../models/IPassThroughPolicyArbiterConstructorOptions.js\";\n\n/**\n * Pass Through Policy Arbiter.\n */\nexport class PassThroughPolicyArbiter implements IPolicyArbiter {\n\t/**\n\t * The class name of the Pass Through Policy Arbiter.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<PassThroughPolicyArbiter>();\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 PassThroughPolicyArbiter.\n\t * @param options The options for the pass through policy arbiter.\n\t */\n\tconstructor(options?: IPassThroughPolicyArbiterConstructorOptions) {\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 PassThroughPolicyArbiter.CLASS_NAME;\n\t}\n\n\t/**\n\t * Makes decisions regarding policy access to data.\n\t * @param agreement The agreement to evaluate.\n\t * @param information Information provided by the requester to determine if a policy can be created.\n\t * @param data The data to make a decision on.\n\t * @param action Optional action to make a decision on, if not provided, the arbiter will evaluate all actions in the agreement.\n\t * @returns The decisions about access to the data.\n\t */\n\tpublic async decide<D = unknown>(\n\t\tagreement: IDataspaceProtocolAgreement,\n\t\tinformation?: IRightsManagementInformation,\n\t\tdata?: D,\n\t\taction?: OdrlActionType | string\n\t): Promise<IPolicyDecision[]> {\n\t\tGuards.object<IDataspaceProtocolAgreement>(\n\t\t\tPassThroughPolicyArbiter.CLASS_NAME,\n\t\t\tnameof(agreement),\n\t\t\tagreement\n\t\t);\n\n\t\tawait this._logging?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: PassThroughPolicyArbiter.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"decidingPolicy\",\n\t\t\tdata: {\n\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(agreement) ?? \"\"\n\t\t\t}\n\t\t});\n\n\t\treturn [\n\t\t\t{\n\t\t\t\ttarget: \"$\",\n\t\t\t\tdecision: PolicyDecision.Granted\n\t\t\t}\n\t\t];\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"identityPolicyInformationSource.js","sourceRoot":"","sources":["../../../src/policyInformationSources/identityPolicyInformationSource.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,SAAS,EAAE,g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ACrC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC3B,CAAC;YAED,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;gBACtB,IAAI,CAAC;oBACJ,MAAM,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;wBACxB,KAAK,EAAE,MAAM;wBACb,MAAM,EAAE,+BAA+B,CAAC,UAAU;wBAClD,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;wBACd,OAAO,EAAE,oBAAoB;wBAC7B,IAAI,EAAE;4BACL,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;4BAC/C,EAAE;yBACF;qBACD,CAAC,CAAC;oBACH,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;oBAC/D,WAAW,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;gBACpD,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACd,MAAM,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;wBACxB,KAAK,EAAE,OAAO;wBACd,MAAM,EAAE,+BAA+B,CAAC,UAAU;wBAClD,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;wBACd,OAAO,EAAE,yBAAyB;wBAClC,IAAI,EAAE;4BACL,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;4BAC/C,EAAE;yBACF;wBACD,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC;qBAC/B,CAAC,CAAC;gBACJ,CAAC;YACF,CAAC;QACF,CAAC;QAED,OAAO,WAAW,CAAC;IACpB,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseError, ComponentFactory, Guards, Is } from \"@twin.org/core\";\nimport { type IJsonLdNodeObject, JsonLdHelper } from \"@twin.org/data-json-ld\";\nimport type { IIdentityResolverComponent } from \"@twin.org/identity-models\";\nimport type { ILoggingComponent } from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\ttype IPolicyInformationSource,\n\ttype IRightsManagementPolicy,\n\tOdrlPolicyHelper,\n\tPolicyInformationAccessMode\n} from \"@twin.org/rights-management-models\";\nimport type { OdrlActionType } from \"@twin.org/standards-w3c-odrl\";\nimport type { IIdentityPolicyInformationSourceConstructorOptions } from \"../models/IIdentityPolicyInformationSourceConstructorOptions.js\";\n\n/**\n * Policy information source which retrieves the identity information.\n */\nexport class IdentityPolicyInformationSource implements IPolicyInformationSource {\n\t/**\n\t * The class name of the Identity Policy Information Source.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<IdentityPolicyInformationSource>();\n\n\t/**\n\t * The logging component.\n\t * @internal\n\t */\n\tprivate readonly _logging?: ILoggingComponent;\n\n\t/**\n\t * The identity resolver component.\n\t * @internal\n\t */\n\tprivate readonly _identityResolver: IIdentityResolverComponent;\n\n\t/**\n\t * Create a new instance of IdentityPolicyInformationSource.\n\t * @param options The options for the logging policy source.\n\t */\n\tconstructor(options?: IIdentityPolicyInformationSourceConstructorOptions) {\n\t\tthis._logging = ComponentFactory.getIfExists<ILoggingComponent>(options?.loggingComponentType);\n\t\tthis._identityResolver = ComponentFactory.get(\n\t\t\toptions?.identityResolverComponentType ?? \"identity-resolver\"\n\t\t);\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 IdentityPolicyInformationSource.CLASS_NAME;\n\t}\n\n\t/**\n\t * Retrieve information from the sources.\n\t * @param policy The policy to retrieve information for if available.\n\t * @param accessMode The access mode to use for the retrieval.\n\t * @param data The data to process.\n\t * @param action The action that was evaluated.\n\t * @returns The objects containing relevant information or undefined if nothing relevant is found.\n\t */\n\tpublic async retrieve<D = unknown>(\n\t\tpolicy: IRightsManagementPolicy | undefined,\n\t\taccessMode: PolicyInformationAccessMode,\n\t\tdata?: D,\n\t\taction?: OdrlActionType | string\n\t): Promise<{ [id: string]: IJsonLdNodeObject } | undefined> {\n\t\tGuards.arrayOneOf(\n\t\t\tIdentityPolicyInformationSource.CLASS_NAME,\n\t\t\tnameof(accessMode),\n\t\t\taccessMode,\n\t\t\tObject.values(PolicyInformationAccessMode)\n\t\t);\n\n\t\tconst information: { [id: string]: IJsonLdNodeObject } = {};\n\n\t\tif (Is.object<IRightsManagementPolicy>(policy)) {\n\t\t\tconst ids = [];\n\n\t\t\tif (Is.stringValue(policy.assignee)) {\n\t\t\t\tids.push(policy.assignee);\n\t\t\t}\n\t\t\tif (Is.stringValue(policy.assigner)) {\n\t\t\t\tids.push(policy.assigner);\n\t\t\t}\n\n\t\t\tfor (const id of ids) {\n\t\t\t\ttry {\n\t\t\t\t\tawait this._logging?.log({\n\t\t\t\t\t\tlevel: \"info\",\n\t\t\t\t\t\tsource: IdentityPolicyInformationSource.CLASS_NAME,\n\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\tmessage: \"identityRetrieving\",\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(policy) ?? \"\",\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\tconst idDoc = await this._identityResolver.identityResolve(id);\n\t\t\t\t\tinformation[id] = JsonLdHelper.toNodeObject(idDoc);\n\t\t\t\t} catch (err) {\n\t\t\t\t\tawait this._logging?.log({\n\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\tsource: IdentityPolicyInformationSource.CLASS_NAME,\n\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\tmessage: \"identityRetrievalFailed\",\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(policy) ?? \"\",\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t},\n\t\t\t\t\t\terror: BaseError.fromError(err)\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn information;\n\t}\n}\n"]}
1
+ {"version":3,"file":"identityPolicyInformationSource.js","sourceRoot":"","sources":["../../../src/policyInformationSources/identityPolicyInformationSource.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAItD,OAAO,EAIN,gBAAgB,EAChB,2BAA2B,EAC3B,MAAM,oCAAoC,CAAC;AAI5C;;GAEG;AACH,MAAM,OAAO,+BAA+B;IAC3C;;OAEG;IACI,MAAM,CAAU,UAAU,qCAAqD;IAEtF;;;OAGG;IACc,QAAQ,CAAqB;IAE9C;;;OAGG;IACc,iBAAiB,CAA6B;IAE/D;;;OAGG;IACH,YAAY,OAA4D;QACvE,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,WAAW,CAAoB,OAAO,EAAE,oBAAoB,CAAC,CAAC;QAC/F,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC,GAAG,CAC5C,OAAO,EAAE,6BAA6B,IAAI,mBAAmB,CAC7D,CAAC;IACH,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,+BAA+B,CAAC,UAAU,CAAC;IACnD,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,QAAQ,CACpB,MAA2C,EAC3C,UAAuC,EACvC,IAAQ,EACR,MAAgC;QAEhC,MAAM,CAAC,UAAU,CAChB,+BAA+B,CAAC,UAAU,gBAE1C,UAAU,EACV,MAAM,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAC1C,CAAC;QAEF,MAAM,WAAW,GAAiC,EAAE,CAAC;QAErD,IAAI,EAAE,CAAC,MAAM,CAA0B,MAAM,CAAC,EAAE,CAAC;YAChD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AS,CAAC,SAAS,CAAC,GAAG,CAAC;qBAC/B,CAAC,CAAC;gBACJ,CAAC;YACF,CAAC;QACF,CAAC;QAED,OAAO,WAAW,CAAC;IACpB,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseError, ComponentFactory, Guards, Is } from \"@twin.org/core\";\nimport { JsonLdHelper } from \"@twin.org/data-json-ld\";\nimport type { IIdentityResolverComponent } from \"@twin.org/identity-models\";\nimport type { ILoggingComponent } from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\ttype IPolicyInformationSource,\n\ttype IRightsManagementInformation,\n\ttype IRightsManagementPolicy,\n\tOdrlPolicyHelper,\n\tPolicyInformationAccessMode\n} from \"@twin.org/rights-management-models\";\nimport type { OdrlActionType } from \"@twin.org/standards-w3c-odrl\";\nimport type { IIdentityPolicyInformationSourceConstructorOptions } from \"../models/IIdentityPolicyInformationSourceConstructorOptions.js\";\n\n/**\n * Policy information source which retrieves the identity information.\n */\nexport class IdentityPolicyInformationSource implements IPolicyInformationSource {\n\t/**\n\t * The class name of the Identity Policy Information Source.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<IdentityPolicyInformationSource>();\n\n\t/**\n\t * The logging component.\n\t * @internal\n\t */\n\tprivate readonly _logging?: ILoggingComponent;\n\n\t/**\n\t * The identity resolver component.\n\t * @internal\n\t */\n\tprivate readonly _identityResolver: IIdentityResolverComponent;\n\n\t/**\n\t * Create a new instance of IdentityPolicyInformationSource.\n\t * @param options The options for the logging policy source.\n\t */\n\tconstructor(options?: IIdentityPolicyInformationSourceConstructorOptions) {\n\t\tthis._logging = ComponentFactory.getIfExists<ILoggingComponent>(options?.loggingComponentType);\n\t\tthis._identityResolver = ComponentFactory.get(\n\t\t\toptions?.identityResolverComponentType ?? \"identity-resolver\"\n\t\t);\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 IdentityPolicyInformationSource.CLASS_NAME;\n\t}\n\n\t/**\n\t * Retrieve information from the sources.\n\t * @param policy The policy to retrieve information for if available.\n\t * @param accessMode The access mode to use for the retrieval.\n\t * @param data The data to process.\n\t * @param action The action that was evaluated.\n\t * @returns The objects containing relevant information or undefined if nothing relevant is found.\n\t */\n\tpublic async retrieve<D = unknown>(\n\t\tpolicy: IRightsManagementPolicy | undefined,\n\t\taccessMode: PolicyInformationAccessMode,\n\t\tdata?: D,\n\t\taction?: OdrlActionType | string\n\t): Promise<IRightsManagementInformation | undefined> {\n\t\tGuards.arrayOneOf(\n\t\t\tIdentityPolicyInformationSource.CLASS_NAME,\n\t\t\tnameof(accessMode),\n\t\t\taccessMode,\n\t\t\tObject.values(PolicyInformationAccessMode)\n\t\t);\n\n\t\tconst information: IRightsManagementInformation = {};\n\n\t\tif (Is.object<IRightsManagementPolicy>(policy)) {\n\t\t\tconst ids = [];\n\n\t\t\tif (Is.stringValue(policy.assignee)) {\n\t\t\t\tids.push(policy.assignee);\n\t\t\t}\n\t\t\tif (Is.stringValue(policy.assigner)) {\n\t\t\t\tids.push(policy.assigner);\n\t\t\t}\n\n\t\t\tfor (const id of ids) {\n\t\t\t\ttry {\n\t\t\t\t\tawait this._logging?.log({\n\t\t\t\t\t\tlevel: \"info\",\n\t\t\t\t\t\tsource: IdentityPolicyInformationSource.CLASS_NAME,\n\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\tmessage: \"identityRetrieving\",\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(policy) ?? \"\",\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\tconst idDoc = await this._identityResolver.identityResolve(id);\n\t\t\t\t\tinformation[id] = JsonLdHelper.toNodeObject(idDoc);\n\t\t\t\t} catch (err) {\n\t\t\t\t\tawait this._logging?.log({\n\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\tsource: IdentityPolicyInformationSource.CLASS_NAME,\n\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\tmessage: \"identityRetrievalFailed\",\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(policy) ?? \"\",\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t},\n\t\t\t\t\t\terror: BaseError.fromError(err)\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn information;\n\t}\n}\n"]}
@@ -67,10 +67,10 @@ export class IdentityProfilePolicyInformationSource {
67
67
  id
68
68
  }
69
69
  });
70
+ const profile = information.profile ?? {};
70
71
  if (accessMode === PolicyInformationAccessMode.Public) {
71
72
  const publicProfile = await this._identityProfile.getPublic(id);
72
- information.profile ??= {};
73
- information.profile[id] = {
73
+ profile[id] = {
74
74
  public: Is.object(publicProfile)
75
75
  ? JsonLdHelper.toNodeObject(publicProfile)
76
76
  : undefined
@@ -78,8 +78,7 @@ export class IdentityProfilePolicyInformationSource {
78
78
  }
79
79
  else {
80
80
  const result = await this._identityProfile.get(undefined, undefined, id);
81
- information.profile ??= {};
82
- information.profile[id] = {
81
+ profile[id] = {
83
82
  public: Is.object(result.publicProfile)
84
83
  ? JsonLdHelper.toNodeObject(result.publicProfile)
85
84
  : undefined,
@@ -88,6 +87,7 @@ export class IdentityProfilePolicyInformationSource {
88
87
  : undefined
89
88
  };
90
89
  }
90
+ information.profile = profile;
91
91
  }
92
92
  catch (err) {
93
93
  if (!BaseError.someErrorName(err, NotFoundError.CLASS_NAME)) {
@@ -1 +1 @@
1
- {"version":3,"file":"identityProfilePolicyInformationSource.js","sourceRoot":"","sources":["../../../src/policyInformationSources/identityProfilePolicyInformationSource.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,gBA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AAM,CAAC,cAAc,CAAC;gCACxC,CAAC,CAAC,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC,cAAc,CAAC;gCAClD,CAAC,CAAC,SAAS;yBACZ,CAAC;oBACH,CAAC;gBACF,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACd,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,aAAa,CAAC,UAAU,CAAC,EAAE,CAAC;wBAC7D,MAAM,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;4BACxB,KAAK,EAAE,OAAO;4BACd,MAAM,EAAE,sCAAsC,CAAC,UAAU;4BACzD,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;4BACd,OAAO,EAAE,wBAAwB;4BACjC,IAAI,EAAE;gCACL,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;gCAC/C,EAAE;6BACF;4BACD,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC;yBAC/B,CAAC,CAAC;oBACJ,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;QAED,OAAO,WAAW,CAAC;IACpB,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseError, ComponentFactory, Guards, Is, NotFoundError } from \"@twin.org/core\";\nimport { JsonLdHelper, type IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type { IIdentityProfileComponent } from \"@twin.org/identity-models\";\nimport type { ILoggingComponent } from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\ttype IPolicyInformationSource,\n\ttype IRightsManagementPolicy,\n\tOdrlPolicyHelper,\n\tPolicyInformationAccessMode\n} from \"@twin.org/rights-management-models\";\nimport type { OdrlActionType } from \"@twin.org/standards-w3c-odrl\";\nimport type { IIdentityProfilePolicyInformationSourceConstructorOptions } from \"../models/IIdentityProfilePolicyInformationSourceConstructorOptions.js\";\n\n/**\n * Policy information source which retrieves identity profile information.\n */\nexport class IdentityProfilePolicyInformationSource implements IPolicyInformationSource {\n\t/**\n\t * The class name of the Identity Profile Policy Information Source.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<IdentityProfilePolicyInformationSource>();\n\n\t/**\n\t * The logging component.\n\t * @internal\n\t */\n\tprivate readonly _logging?: ILoggingComponent;\n\n\t/**\n\t * The identity profile component.\n\t * @internal\n\t */\n\tprivate readonly _identityProfile: IIdentityProfileComponent;\n\n\t/**\n\t * Create a new instance of IdentityProfilePolicyInformationSource.\n\t * @param options The options for the identity profile policy source.\n\t */\n\tconstructor(options?: IIdentityProfilePolicyInformationSourceConstructorOptions) {\n\t\tthis._logging = ComponentFactory.getIfExists<ILoggingComponent>(options?.loggingComponentType);\n\t\tthis._identityProfile = ComponentFactory.get(\n\t\t\toptions?.identityProfileComponentType ?? \"identity-profile\"\n\t\t);\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 IdentityProfilePolicyInformationSource.CLASS_NAME;\n\t}\n\n\t/**\n\t * Retrieve information from the sources.\n\t * @param policy The policy to retrieve information for if available.\n\t * @param accessMode The access mode to use for the retrieval.\n\t * @param data The data to process.\n\t * @param action The action that was evaluated.\n\t * @returns The objects containing relevant information or undefined if nothing relevant is found.\n\t */\n\tpublic async retrieve<D = unknown>(\n\t\tpolicy: IRightsManagementPolicy | undefined,\n\t\taccessMode: PolicyInformationAccessMode,\n\t\tdata?: D,\n\t\taction?: OdrlActionType | string\n\t): Promise<{ [id: string]: IJsonLdNodeObject } | undefined> {\n\t\tGuards.arrayOneOf(\n\t\t\tIdentityProfilePolicyInformationSource.CLASS_NAME,\n\t\t\tnameof(accessMode),\n\t\t\taccessMode,\n\t\t\tObject.values(PolicyInformationAccessMode)\n\t\t);\n\n\t\tconst information: { [id: string]: IJsonLdNodeObject } = {};\n\n\t\tif (Is.object<IRightsManagementPolicy>(policy)) {\n\t\t\tconst ids = [];\n\n\t\t\tif (Is.stringValue(policy.assignee)) {\n\t\t\t\tids.push(policy.assignee);\n\t\t\t}\n\t\t\tif (Is.stringValue(policy.assigner)) {\n\t\t\t\tids.push(policy.assigner);\n\t\t\t}\n\n\t\t\tfor (const id of ids) {\n\t\t\t\ttry {\n\t\t\t\t\tawait this._logging?.log({\n\t\t\t\t\t\tlevel: \"info\",\n\t\t\t\t\t\tsource: IdentityProfilePolicyInformationSource.CLASS_NAME,\n\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\tmessage: \"profileRetrieving\",\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(policy) ?? \"\",\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tif (accessMode === PolicyInformationAccessMode.Public) {\n\t\t\t\t\t\tconst publicProfile = await this._identityProfile.getPublic(id);\n\t\t\t\t\t\tinformation.profile ??= {};\n\t\t\t\t\t\tinformation.profile[id] = {\n\t\t\t\t\t\t\tpublic: Is.object(publicProfile)\n\t\t\t\t\t\t\t\t? JsonLdHelper.toNodeObject(publicProfile)\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t};\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst result = await this._identityProfile.get(undefined, undefined, id);\n\t\t\t\t\t\tinformation.profile ??= {};\n\t\t\t\t\t\tinformation.profile[id] = {\n\t\t\t\t\t\t\tpublic: Is.object(result.publicProfile)\n\t\t\t\t\t\t\t\t? JsonLdHelper.toNodeObject(result.publicProfile)\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\tprivate: Is.object(result.privateProfile)\n\t\t\t\t\t\t\t\t? JsonLdHelper.toNodeObject(result.privateProfile)\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t} catch (err) {\n\t\t\t\t\tif (!BaseError.someErrorName(err, NotFoundError.CLASS_NAME)) {\n\t\t\t\t\t\tawait this._logging?.log({\n\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\tsource: IdentityProfilePolicyInformationSource.CLASS_NAME,\n\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\tmessage: \"profileRetrievalFailed\",\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(policy) ?? \"\",\n\t\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\terror: BaseError.fromError(err)\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn information;\n\t}\n}\n"]}
1
+ {"version":3,"file":"identityProfilePolicyInformationSource.js","sourceRoot":"","sources":["../../../src/policyInformationSources/identityProfilePolicyInformationSource.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACxF,OAAO,EAA0B,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAI9E,OAAO,EACN,gBAAgB,EAChB,2BAA2B,EAI3B,MAAM,oCAAoC,CAAC;AAI5C;;GAEG;AACH,MAAM,OAAO,sCAAsC;IAClD;;OAEG;IACI,MAAM,CAAU,UAAU,4CAA4D;IAE7F;;;OAGG;IACc,QAAQ,CAAqB;IAE9C;;;OAGG;IACc,gBAAgB,CAA4B;IAE7D;;;OAGG;IACH,YAAY,OAAmE;QAC9E,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,WAAW,CAAoB,OAAO,EAAE,oBAAoB,CAAC,CAAC;QAC/F,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC,GAAG,CAC3C,OAAO,EAAE,4BAA4B,IAAI,kBAAkB,CAC3D,CAAC;IACH,CAAC;IAED;;;OAGG;IAC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AAE;6BACF;4BACD,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC;yBAC/B,CAAC,CAAC;oBACJ,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;QAED,OAAO,WAAW,CAAC;IACpB,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseError, ComponentFactory, Guards, Is, NotFoundError } from \"@twin.org/core\";\nimport { type IJsonLdNodeObject, JsonLdHelper } from \"@twin.org/data-json-ld\";\nimport type { IIdentityProfileComponent } from \"@twin.org/identity-models\";\nimport type { ILoggingComponent } from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\tOdrlPolicyHelper,\n\tPolicyInformationAccessMode,\n\ttype IPolicyInformationSource,\n\ttype IRightsManagementInformation,\n\ttype IRightsManagementPolicy\n} from \"@twin.org/rights-management-models\";\nimport type { OdrlActionType } from \"@twin.org/standards-w3c-odrl\";\nimport type { IIdentityProfilePolicyInformationSourceConstructorOptions } from \"../models/IIdentityProfilePolicyInformationSourceConstructorOptions.js\";\n\n/**\n * Policy information source which retrieves identity profile information.\n */\nexport class IdentityProfilePolicyInformationSource implements IPolicyInformationSource {\n\t/**\n\t * The class name of the Identity Profile Policy Information Source.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<IdentityProfilePolicyInformationSource>();\n\n\t/**\n\t * The logging component.\n\t * @internal\n\t */\n\tprivate readonly _logging?: ILoggingComponent;\n\n\t/**\n\t * The identity profile component.\n\t * @internal\n\t */\n\tprivate readonly _identityProfile: IIdentityProfileComponent;\n\n\t/**\n\t * Create a new instance of IdentityProfilePolicyInformationSource.\n\t * @param options The options for the identity profile policy source.\n\t */\n\tconstructor(options?: IIdentityProfilePolicyInformationSourceConstructorOptions) {\n\t\tthis._logging = ComponentFactory.getIfExists<ILoggingComponent>(options?.loggingComponentType);\n\t\tthis._identityProfile = ComponentFactory.get(\n\t\t\toptions?.identityProfileComponentType ?? \"identity-profile\"\n\t\t);\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 IdentityProfilePolicyInformationSource.CLASS_NAME;\n\t}\n\n\t/**\n\t * Retrieve information from the sources.\n\t * @param policy The policy to retrieve information for if available.\n\t * @param accessMode The access mode to use for the retrieval.\n\t * @param data The data to process.\n\t * @param action The action that was evaluated.\n\t * @returns The objects containing relevant information or undefined if nothing relevant is found.\n\t */\n\tpublic async retrieve<D = unknown>(\n\t\tpolicy: IRightsManagementPolicy | undefined,\n\t\taccessMode: PolicyInformationAccessMode,\n\t\tdata?: D,\n\t\taction?: OdrlActionType | string\n\t): Promise<IRightsManagementInformation | undefined> {\n\t\tGuards.arrayOneOf(\n\t\t\tIdentityProfilePolicyInformationSource.CLASS_NAME,\n\t\t\tnameof(accessMode),\n\t\t\taccessMode,\n\t\t\tObject.values(PolicyInformationAccessMode)\n\t\t);\n\n\t\tconst information: IRightsManagementInformation = {};\n\n\t\tif (Is.object<IRightsManagementPolicy>(policy)) {\n\t\t\tconst ids = [];\n\n\t\t\tif (Is.stringValue(policy.assignee)) {\n\t\t\t\tids.push(policy.assignee);\n\t\t\t}\n\t\t\tif (Is.stringValue(policy.assigner)) {\n\t\t\t\tids.push(policy.assigner);\n\t\t\t}\n\n\t\t\tfor (const id of ids) {\n\t\t\t\ttry {\n\t\t\t\t\tawait this._logging?.log({\n\t\t\t\t\t\tlevel: \"info\",\n\t\t\t\t\t\tsource: IdentityProfilePolicyInformationSource.CLASS_NAME,\n\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\tmessage: \"profileRetrieving\",\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(policy) ?? \"\",\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tconst profile = (information.profile as { [id: string]: IJsonLdNodeObject }) ?? {};\n\n\t\t\t\t\tif (accessMode === PolicyInformationAccessMode.Public) {\n\t\t\t\t\t\tconst publicProfile = await this._identityProfile.getPublic(id);\n\t\t\t\t\t\tprofile[id] = {\n\t\t\t\t\t\t\tpublic: Is.object(publicProfile)\n\t\t\t\t\t\t\t\t? JsonLdHelper.toNodeObject(publicProfile)\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t};\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst result = await this._identityProfile.get(undefined, undefined, id);\n\t\t\t\t\t\tprofile[id] = {\n\t\t\t\t\t\t\tpublic: Is.object(result.publicProfile)\n\t\t\t\t\t\t\t\t? JsonLdHelper.toNodeObject(result.publicProfile)\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\tprivate: Is.object(result.privateProfile)\n\t\t\t\t\t\t\t\t? JsonLdHelper.toNodeObject(result.privateProfile)\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\tinformation.profile = profile;\n\t\t\t\t} catch (err) {\n\t\t\t\t\tif (!BaseError.someErrorName(err, NotFoundError.CLASS_NAME)) {\n\t\t\t\t\t\tawait this._logging?.log({\n\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\tsource: IdentityProfilePolicyInformationSource.CLASS_NAME,\n\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\tmessage: \"profileRetrievalFailed\",\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(policy) ?? \"\",\n\t\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\terror: BaseError.fromError(err)\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn information;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"staticPolicyInformationSource.js","sourceRoot":"","sources":["../../../src/policyInformationSources/staticP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6B,CAAC,UAAU,kBAExC,IAAI,CAAC,OAAO,CACZ,CAAC;QACF,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, Guards, Is } 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\tPolicyInformationAccessMode,\n\ttype IPolicyInformationSource,\n\ttype IRightsManagementPolicy\n} from \"@twin.org/rights-management-models\";\nimport type { OdrlActionType } from \"@twin.org/standards-w3c-odrl\";\nimport type { IStaticPolicyInformationSource } from \"../models/IStaticPolicyInformationSource.js\";\nimport type { IStaticPolicyInformationSourceConstructorOptions } from \"../models/IStaticPolicyInformationSourceConstructorOptions.js\";\n\n/**\n * Policy information source which retrieves static information.\n */\nexport class StaticPolicyInformationSource implements IPolicyInformationSource {\n\t/**\n\t * The class name of the Static Policy Information Source.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<StaticPolicyInformationSource>();\n\n\t/**\n\t * The logging component.\n\t * @internal\n\t */\n\tprivate readonly _logging?: ILoggingComponent;\n\n\t/**\n\t * The information sources.\n\t * @internal\n\t */\n\tprivate readonly _information: IStaticPolicyInformationSource[];\n\n\t/**\n\t * Create a new instance of StaticPolicyInformationSource.\n\t * @param options The options for the logging policy source.\n\t */\n\tconstructor(options?: IStaticPolicyInformationSourceConstructorOptions) {\n\t\tthis._logging = ComponentFactory.getIfExists<ILoggingComponent>(options?.loggingComponentType);\n\t\tthis._information = options?.config?.information ?? [];\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 StaticPolicyInformationSource.CLASS_NAME;\n\t}\n\n\t/**\n\t * Retrieve information from the sources.\n\t * @param policy The policy to retrieve information for if available.\n\t * @param accessMode The access mode to use for the retrieval.\n\t * @param data The data to process.\n\t * @param action The action to get any additional information for.\n\t * @returns The objects containing relevant information or undefined if nothing relevant is found.\n\t */\n\tpublic async retrieve<D = unknown>(\n\t\tpolicy: IRightsManagementPolicy | undefined,\n\t\taccessMode: PolicyInformationAccessMode,\n\t\tdata?: D,\n\t\taction?: OdrlActionType | string\n\t): Promise<{ [id: string]: IJsonLdNodeObject } | undefined> {\n\t\tGuards.arrayOneOf(\n\t\t\tStaticPolicyInformationSource.CLASS_NAME,\n\t\t\tnameof(accessMode),\n\t\t\taccessMode,\n\t\t\tObject.values(PolicyInformationAccessMode)\n\t\t);\n\n\t\tlet information: { [id: string]: IJsonLdNodeObject } = {};\n\n\t\tawait this._logging?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: StaticPolicyInformationSource.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"staticRetrieving\",\n\t\t\tdata: {\n\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(policy) ?? \"\",\n\t\t\t\taccessMode\n\t\t\t}\n\t\t});\n\n\t\tfor (const info of this._information) {\n\t\t\tif (\n\t\t\t\tinfo.accessMode === accessMode ||\n\t\t\t\taccessMode === PolicyInformationAccessMode.Any ||\n\t\t\t\tinfo.accessMode === PolicyInformationAccessMode.Any\n\t\t\t) {\n\t\t\t\tconst matchLocators = info.matchLocators;\n\t\t\t\tif (\n\t\t\t\t\t!Is.arrayValue(matchLocators) ||\n\t\t\t\t\tmatchLocators.some(locator => OdrlPolicyHelper.matchPolicy(policy, locator))\n\t\t\t\t) {\n\t\t\t\t\tinformation = {\n\t\t\t\t\t\t...information,\n\t\t\t\t\t\t...info.objects\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tawait this._logging?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: StaticPolicyInformationSource.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"staticRetrieved\",\n\t\t\tdata: {\n\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(policy) ?? \"\",\n\t\t\t\taccessMode,\n\t\t\t\titemCount: Object.keys(information).length\n\t\t\t}\n\t\t});\n\n\t\treturn Object.keys(information).length > 0 ? information : undefined;\n\t}\n\n\t/**\n\t * Add static policy information.\n\t * @param info The static policy information to add.\n\t */\n\tpublic addInformation(info: IStaticPolicyInformationSource): void {\n\t\tGuards.arrayOneOf<string>(\n\t\t\tStaticPolicyInformationSource.CLASS_NAME,\n\t\t\tnameof(info.accessMode),\n\t\t\tinfo.accessMode,\n\t\t\tObject.values(PolicyInformationAccessMode)\n\t\t);\n\t\tGuards.objectValue<{ [id: string]: IJsonLdNodeObject }>(\n\t\t\tStaticPolicyInformationSource.CLASS_NAME,\n\t\t\tnameof(info.objects),\n\t\t\tinfo.objects\n\t\t);\n\t\tthis._information.push(info);\n\t}\n}\n"]}
1
+ {"version":3,"file":"staticPolicyInformationSource.js","sourceRoot":"","sources":["../../../src/policyInformationSources/staticPolicyInformationSource.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAG9D,OAAO,EACN,gBAAgB,EAChB,2BAA2B,EAI3B,MAAM,oCAAoC,CAAC;AAK5C;;GAEG;AACH,MAAM,OAAO,6BAA6B;IACzC;;OAEG;IACI,MAAM,CAAU,UAAU,mCAAmD;IAEpF;;;OAGG;IACc,QAAQ,CAAqB;IAE9C;;;OAGG;IACc,YAAY,CAAmC;IAEhE;;;OAGG;IACH,YAAY,OAA0D;QACrE,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,WAAW,CAAoB,OAAO,EAAE,oBAAoB,CAAC,CAAC;QAC/F,IAAI,CAAC,YAAY,GAAG,OAAO,EAAE,MAAM,EAAE,WAAW,IAAI,EAAE,CAAC;IACxD,CAAC;IAED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AK,EAAE,MAAM;YACb,MAAM,EAAE,6BAA6B,CAAC,UAAU;YAChD,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;YACd,OAAO,EAAE,iBAAiB;YAC1B,IAAI,EAAE;gBACL,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;gBAC/C,UAAU;gBACV,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM;aAC1C;SACD,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;IACtE,CAAC;IAED;;;OAGG;IACI,cAAc,CAAC,IAAoC;QACzD,MAAM,CAAC,UAAU,CAChB,6BAA6B,CAAC,UAAU,qBAExC,IAAI,CAAC,UAAU,EACf,MAAM,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAC1C,CAAC;QACF,MAAM,CAAC,WAAW,CACjB,6BAA6B,CAAC,UAAU,kBAExC,IAAI,CAAC,OAAO,CACZ,CAAC;QACF,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, Guards, Is } from \"@twin.org/core\";\nimport type { ILoggingComponent } from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\tOdrlPolicyHelper,\n\tPolicyInformationAccessMode,\n\ttype IPolicyInformationSource,\n\ttype IRightsManagementInformation,\n\ttype IRightsManagementPolicy\n} from \"@twin.org/rights-management-models\";\nimport type { OdrlActionType } from \"@twin.org/standards-w3c-odrl\";\nimport type { IStaticPolicyInformationSource } from \"../models/IStaticPolicyInformationSource.js\";\nimport type { IStaticPolicyInformationSourceConstructorOptions } from \"../models/IStaticPolicyInformationSourceConstructorOptions.js\";\n\n/**\n * Policy information source which retrieves static information.\n */\nexport class StaticPolicyInformationSource implements IPolicyInformationSource {\n\t/**\n\t * The class name of the Static Policy Information Source.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<StaticPolicyInformationSource>();\n\n\t/**\n\t * The logging component.\n\t * @internal\n\t */\n\tprivate readonly _logging?: ILoggingComponent;\n\n\t/**\n\t * The information sources.\n\t * @internal\n\t */\n\tprivate readonly _information: IStaticPolicyInformationSource[];\n\n\t/**\n\t * Create a new instance of StaticPolicyInformationSource.\n\t * @param options The options for the logging policy source.\n\t */\n\tconstructor(options?: IStaticPolicyInformationSourceConstructorOptions) {\n\t\tthis._logging = ComponentFactory.getIfExists<ILoggingComponent>(options?.loggingComponentType);\n\t\tthis._information = options?.config?.information ?? [];\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 StaticPolicyInformationSource.CLASS_NAME;\n\t}\n\n\t/**\n\t * Retrieve information from the sources.\n\t * @param policy The policy to retrieve information for if available.\n\t * @param accessMode The access mode to use for the retrieval.\n\t * @param data The data to process.\n\t * @param action The action to get any additional information for.\n\t * @returns The objects containing relevant information or undefined if nothing relevant is found.\n\t */\n\tpublic async retrieve<D = unknown>(\n\t\tpolicy: IRightsManagementPolicy | undefined,\n\t\taccessMode: PolicyInformationAccessMode,\n\t\tdata?: D,\n\t\taction?: OdrlActionType | string\n\t): Promise<IRightsManagementInformation | undefined> {\n\t\tGuards.arrayOneOf(\n\t\t\tStaticPolicyInformationSource.CLASS_NAME,\n\t\t\tnameof(accessMode),\n\t\t\taccessMode,\n\t\t\tObject.values(PolicyInformationAccessMode)\n\t\t);\n\n\t\tlet information: IRightsManagementInformation = {};\n\n\t\tawait this._logging?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: StaticPolicyInformationSource.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"staticRetrieving\",\n\t\t\tdata: {\n\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(policy) ?? \"\",\n\t\t\t\taccessMode\n\t\t\t}\n\t\t});\n\n\t\tfor (const info of this._information) {\n\t\t\tif (\n\t\t\t\tinfo.accessMode === accessMode ||\n\t\t\t\taccessMode === PolicyInformationAccessMode.Any ||\n\t\t\t\tinfo.accessMode === PolicyInformationAccessMode.Any\n\t\t\t) {\n\t\t\t\tconst matchLocators = info.matchLocators;\n\t\t\t\tif (\n\t\t\t\t\t!Is.arrayValue(matchLocators) ||\n\t\t\t\t\tmatchLocators.some(locator => OdrlPolicyHelper.matchPolicy(policy, locator))\n\t\t\t\t) {\n\t\t\t\t\tinformation = {\n\t\t\t\t\t\t...information,\n\t\t\t\t\t\t...info.objects\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tawait this._logging?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: StaticPolicyInformationSource.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"staticRetrieved\",\n\t\t\tdata: {\n\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(policy) ?? \"\",\n\t\t\t\taccessMode,\n\t\t\t\titemCount: Object.keys(information).length\n\t\t\t}\n\t\t});\n\n\t\treturn Object.keys(information).length > 0 ? information : undefined;\n\t}\n\n\t/**\n\t * Add static policy information.\n\t * @param info The static policy information to add.\n\t */\n\tpublic addInformation(info: IStaticPolicyInformationSource): void {\n\t\tGuards.arrayOneOf<string>(\n\t\t\tStaticPolicyInformationSource.CLASS_NAME,\n\t\t\tnameof(info.accessMode),\n\t\t\tinfo.accessMode,\n\t\t\tObject.values(PolicyInformationAccessMode)\n\t\t);\n\t\tGuards.objectValue<IRightsManagementInformation>(\n\t\t\tStaticPolicyInformationSource.CLASS_NAME,\n\t\t\tnameof(info.objects),\n\t\t\tinfo.objects\n\t\t);\n\t\tthis._information.push(info);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"passThroughPolicyNegotiator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;;;;;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"]}
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,gB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C,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 { ILoggingComponent } from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\tOdrlPolicyHelper,\n\tRightsManagementNamespaces,\n\ttype IPolicyNegotiator,\n\ttype IRightsManagementInformation\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?: IRightsManagementInformation\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?: IRightsManagementInformation\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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"passThroughPolicyObligationEnforcer.js","sourceRoot":"","sources":["../../../src/policyObligationEnforcers/passThroughPolicyObligationEnforcer.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAI1D,OAAO,EACN,gBAAgB,EAGhB,MAAM,oCAAoC,CAAC;AAI5C;;GAEG;AACH,MAAM,OAAO,mCAAmC;IAC/C;;OAEG;IACI,MAAM,CAAU,UAAU,yCAAyD;IAE1F;;;OAGG;IACc,QAAQ,CAAqB;IAE9C;;;OAGG;IACH,YAAY,OAAgE;QAC3E,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,WAAW,CAAoB,OAAO,EAAE,oBAAoB,CAAC,CAAC;IAChG,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,mCAAmC,CAAC,UAAU,CAAC;IACvD,CAAC;IAED;;;;;;;;OAQG;IACI,KAAK,CAAC,OAAO,CACnB,MAA+B,EAC/B,IAAe,EACf,WAAiD,EACjD,IAAQ,EACR,MAAgC;QAEhC,MAAM,CAAC,MAAM,CACZ,mCAAmC,CAAC,UAAU,YAE9C,MAAM,CACN,CAAC;QACF,MAAM,CAAC,MAAM,CAAY,mCAAmC,CAAC,UAAU,UAAgB,IAAI,CAAC,CAAC;QAE7F,MAAM,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;YACxB,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,mCAAmC,CAAC,UAAU;YACtD,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;YACd,OAAO,EAAE,eAAe;YACxB,IAAI,EAAE;gBACL,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;aAC/C;SACD,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACb,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, Guards } 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\ttype IPolicyObligationEnforcer,\n\ttype IRightsManagementPolicy\n} from \"@twin.org/rights-management-models\";\nimport type { OdrlActionType, IOdrlDuty } from \"@twin.org/standards-w3c-odrl\";\nimport type { IPassThroughPolicyObligationEnforcerConstructorOptions } from \"../models/IPassThroughPolicyObligationEnforcerConstructorOptions.js\";\n\n/**\n * Pass Through Policy Obligation Enforcer.\n */\nexport class PassThroughPolicyObligationEnforcer implements IPolicyObligationEnforcer {\n\t/**\n\t * The class name of the Pass Through Policy Obligation Enforcer.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<PassThroughPolicyObligationEnforcer>();\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 Pass Through Policy Obligation Enforcer.\n\t * @param options The options for the pass through policy obligation enforcer.\n\t */\n\tconstructor(options?: IPassThroughPolicyObligationEnforcerConstructorOptions) {\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 PassThroughPolicyObligationEnforcer.CLASS_NAME;\n\t}\n\n\t/**\n\t * Enforces obligations regarding policy access to data.\n\t * @param policy The policy to evaluate.\n\t * @param duty The duty to enforce.\n\t * @param information Information provided by the requester to determine if a policy can be created.\n\t * @param data The data to make a decision on.\n\t * @param action Optional action to make a decision on, if not provided, the enforcer will evaluate all actions in the duty.\n\t * @returns Whether the obligations were successfully enforced.\n\t */\n\tpublic async enforce<D = unknown>(\n\t\tpolicy: IRightsManagementPolicy,\n\t\tduty: IOdrlDuty,\n\t\tinformation?: { [id: string]: IJsonLdNodeObject },\n\t\tdata?: D,\n\t\taction?: OdrlActionType | string\n\t): Promise<boolean> {\n\t\tGuards.object<IRightsManagementPolicy>(\n\t\t\tPassThroughPolicyObligationEnforcer.CLASS_NAME,\n\t\t\tnameof(policy),\n\t\t\tpolicy\n\t\t);\n\t\tGuards.object<IOdrlDuty>(PassThroughPolicyObligationEnforcer.CLASS_NAME, nameof(duty), duty);\n\n\t\tawait this._logging?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: PassThroughPolicyObligationEnforcer.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"enforcingDuty\",\n\t\t\tdata: {\n\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(policy) ?? \"\"\n\t\t\t}\n\t\t});\n\n\t\treturn true;\n\t}\n}\n"]}
1
+ {"version":3,"file":"passThroughPolicyObligationEnforcer.js","sourceRoot":"","sources":["../../../src/policyObligationEnforcers/passThroughPolicyObligationEnforcer.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAG1D,OAAO,EACN,gBAAgB,EAIhB,MAAM,oCAAoC,CAAC;AAI5C;;GAEG;AACH,MAAM,OAAO,mCAAmC;IAC/C;;OAEG;IACI,MAAM,CAAU,UAAU,yCAAyD;IAE1F;;;OAGG;IACc,QAAQ,CAAqB;IAE9C;;;OAGG;IACH,YAAY,OAAgE;QAC3E,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,WAAW,CAAoB,OAAO,EAAE,oBAAoB,CAAC,CAAC;IAChG,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,mCAAmC,CAAC,UAAU,CAAC;IACvD,CAAC;IAED;;;;;;;;OAQG;IACI,KAAK,CAAC,OAAO,CACnB,MAA+B,EAC/B,IAAe,EACf,WAA0C,EAC1C,IAAQ,EACR,MAAgC;QAEhC,MAAM,CAAC,MAAM,CACZ,mCAAmC,CAAC,UAAU,YAE9C,MAAM,CACN,CAAC;QACF,MAAM,CAAC,MAAM,CAAY,mCAAmC,CAAC,UAAU,UAAgB,IAAI,CAAC,CAAC;QAE7F,MAAM,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;YACxB,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,mCAAmC,CAAC,UAAU;YACtD,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;YACd,OAAO,EAAE,eAAe;YACxB,IAAI,EAAE;gBACL,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;aAC/C;SACD,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACb,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, Guards } from \"@twin.org/core\";\nimport type { ILoggingComponent } from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\tOdrlPolicyHelper,\n\ttype IPolicyObligationEnforcer,\n\ttype IRightsManagementInformation,\n\ttype IRightsManagementPolicy\n} from \"@twin.org/rights-management-models\";\nimport type { OdrlActionType, IOdrlDuty } from \"@twin.org/standards-w3c-odrl\";\nimport type { IPassThroughPolicyObligationEnforcerConstructorOptions } from \"../models/IPassThroughPolicyObligationEnforcerConstructorOptions.js\";\n\n/**\n * Pass Through Policy Obligation Enforcer.\n */\nexport class PassThroughPolicyObligationEnforcer implements IPolicyObligationEnforcer {\n\t/**\n\t * The class name of the Pass Through Policy Obligation Enforcer.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<PassThroughPolicyObligationEnforcer>();\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 Pass Through Policy Obligation Enforcer.\n\t * @param options The options for the pass through policy obligation enforcer.\n\t */\n\tconstructor(options?: IPassThroughPolicyObligationEnforcerConstructorOptions) {\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 PassThroughPolicyObligationEnforcer.CLASS_NAME;\n\t}\n\n\t/**\n\t * Enforces obligations regarding policy access to data.\n\t * @param policy The policy to evaluate.\n\t * @param duty The duty to enforce.\n\t * @param information Information provided by the requester to determine if a policy can be created.\n\t * @param data The data to make a decision on.\n\t * @param action Optional action to make a decision on, if not provided, the enforcer will evaluate all actions in the duty.\n\t * @returns Whether the obligations were successfully enforced.\n\t */\n\tpublic async enforce<D = unknown>(\n\t\tpolicy: IRightsManagementPolicy,\n\t\tduty: IOdrlDuty,\n\t\tinformation?: IRightsManagementInformation,\n\t\tdata?: D,\n\t\taction?: OdrlActionType | string\n\t): Promise<boolean> {\n\t\tGuards.object<IRightsManagementPolicy>(\n\t\t\tPassThroughPolicyObligationEnforcer.CLASS_NAME,\n\t\t\tnameof(policy),\n\t\t\tpolicy\n\t\t);\n\t\tGuards.object<IOdrlDuty>(PassThroughPolicyObligationEnforcer.CLASS_NAME, nameof(duty), duty);\n\n\t\tawait this._logging?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: PassThroughPolicyObligationEnforcer.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"enforcingDuty\",\n\t\t\tdata: {\n\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(policy) ?? \"\"\n\t\t\t}\n\t\t});\n\n\t\treturn true;\n\t}\n}\n"]}
@@ -1,5 +1,4 @@
1
- import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
- import type { PolicyInformationAccessMode } from "@twin.org/rights-management-models";
1
+ import type { IRightsManagementInformation, PolicyInformationAccessMode } from "@twin.org/rights-management-models";
3
2
  /**
4
3
  * Configuration for the Static Policy Information Source Component.
5
4
  */
@@ -20,7 +19,5 @@ export interface IStaticPolicyInformationSource {
20
19
  /**
21
20
  * The objects containing the information.
22
21
  */
23
- objects: {
24
- [id: string]: IJsonLdNodeObject;
25
- };
22
+ objects: IRightsManagementInformation;
26
23
  }
@@ -1,5 +1,4 @@
1
- import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
- import { type IPolicyArbiter, type IPolicyDecision } from "@twin.org/rights-management-models";
1
+ import { type IPolicyArbiter, type IPolicyDecision, type IRightsManagementInformation } from "@twin.org/rights-management-models";
3
2
  import type { IDataspaceProtocolAgreement } from "@twin.org/standards-dataspace-protocol";
4
3
  import { type OdrlActionType } from "@twin.org/standards-w3c-odrl";
5
4
  import type { IDefaultPolicyArbiterConstructorOptions } from "../models/IDefaultPolicyArbiterConstructorOptions.js";
@@ -35,7 +34,5 @@ export declare class DefaultPolicyArbiter implements IPolicyArbiter {
35
34
  * @param action Optional action to make a decision on, if not provided, the arbiter will evaluate all actions in the agreement.
36
35
  * @returns The decisions about access to the data.
37
36
  */
38
- decide<D = unknown>(agreement: IDataspaceProtocolAgreement, information?: {
39
- [id: string]: IJsonLdNodeObject;
40
- }, data?: D, action?: OdrlActionType | string): Promise<IPolicyDecision[]>;
37
+ decide<D = unknown>(agreement: IDataspaceProtocolAgreement, information?: IRightsManagementInformation, data?: D, action?: OdrlActionType | string): Promise<IPolicyDecision[]>;
41
38
  }
@@ -1,5 +1,4 @@
1
- import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
- import { type IPolicyArbiter, type IPolicyDecision } from "@twin.org/rights-management-models";
1
+ import { type IPolicyArbiter, type IPolicyDecision, type IRightsManagementInformation } from "@twin.org/rights-management-models";
3
2
  import type { IDataspaceProtocolAgreement } from "@twin.org/standards-dataspace-protocol";
4
3
  import type { OdrlActionType } from "@twin.org/standards-w3c-odrl";
5
4
  import type { IPassThroughPolicyArbiterConstructorOptions } from "../models/IPassThroughPolicyArbiterConstructorOptions.js";
@@ -29,7 +28,5 @@ export declare class PassThroughPolicyArbiter implements IPolicyArbiter {
29
28
  * @param action Optional action to make a decision on, if not provided, the arbiter will evaluate all actions in the agreement.
30
29
  * @returns The decisions about access to the data.
31
30
  */
32
- decide<D = unknown>(agreement: IDataspaceProtocolAgreement, information?: {
33
- [id: string]: IJsonLdNodeObject;
34
- }, data?: D, action?: OdrlActionType | string): Promise<IPolicyDecision[]>;
31
+ decide<D = unknown>(agreement: IDataspaceProtocolAgreement, information?: IRightsManagementInformation, data?: D, action?: OdrlActionType | string): Promise<IPolicyDecision[]>;
35
32
  }
@@ -1,5 +1,4 @@
1
- import { type IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
- import { type IPolicyInformationSource, type IRightsManagementPolicy, PolicyInformationAccessMode } from "@twin.org/rights-management-models";
1
+ import { type IPolicyInformationSource, type IRightsManagementInformation, type IRightsManagementPolicy, PolicyInformationAccessMode } from "@twin.org/rights-management-models";
3
2
  import type { OdrlActionType } from "@twin.org/standards-w3c-odrl";
4
3
  import type { IIdentityPolicyInformationSourceConstructorOptions } from "../models/IIdentityPolicyInformationSourceConstructorOptions.js";
5
4
  /**
@@ -28,7 +27,5 @@ export declare class IdentityPolicyInformationSource implements IPolicyInformati
28
27
  * @param action The action that was evaluated.
29
28
  * @returns The objects containing relevant information or undefined if nothing relevant is found.
30
29
  */
31
- retrieve<D = unknown>(policy: IRightsManagementPolicy | undefined, accessMode: PolicyInformationAccessMode, data?: D, action?: OdrlActionType | string): Promise<{
32
- [id: string]: IJsonLdNodeObject;
33
- } | undefined>;
30
+ retrieve<D = unknown>(policy: IRightsManagementPolicy | undefined, accessMode: PolicyInformationAccessMode, data?: D, action?: OdrlActionType | string): Promise<IRightsManagementInformation | undefined>;
34
31
  }
@@ -1,5 +1,4 @@
1
- import { type IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
- import { type IPolicyInformationSource, type IRightsManagementPolicy, PolicyInformationAccessMode } from "@twin.org/rights-management-models";
1
+ import { PolicyInformationAccessMode, type IPolicyInformationSource, type IRightsManagementInformation, type IRightsManagementPolicy } from "@twin.org/rights-management-models";
3
2
  import type { OdrlActionType } from "@twin.org/standards-w3c-odrl";
4
3
  import type { IIdentityProfilePolicyInformationSourceConstructorOptions } from "../models/IIdentityProfilePolicyInformationSourceConstructorOptions.js";
5
4
  /**
@@ -28,7 +27,5 @@ export declare class IdentityProfilePolicyInformationSource implements IPolicyIn
28
27
  * @param action The action that was evaluated.
29
28
  * @returns The objects containing relevant information or undefined if nothing relevant is found.
30
29
  */
31
- retrieve<D = unknown>(policy: IRightsManagementPolicy | undefined, accessMode: PolicyInformationAccessMode, data?: D, action?: OdrlActionType | string): Promise<{
32
- [id: string]: IJsonLdNodeObject;
33
- } | undefined>;
30
+ retrieve<D = unknown>(policy: IRightsManagementPolicy | undefined, accessMode: PolicyInformationAccessMode, data?: D, action?: OdrlActionType | string): Promise<IRightsManagementInformation | undefined>;
34
31
  }
@@ -1,5 +1,4 @@
1
- import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
- import { PolicyInformationAccessMode, type IPolicyInformationSource, type IRightsManagementPolicy } from "@twin.org/rights-management-models";
1
+ import { PolicyInformationAccessMode, type IPolicyInformationSource, type IRightsManagementInformation, type IRightsManagementPolicy } from "@twin.org/rights-management-models";
3
2
  import type { OdrlActionType } from "@twin.org/standards-w3c-odrl";
4
3
  import type { IStaticPolicyInformationSource } from "../models/IStaticPolicyInformationSource.js";
5
4
  import type { IStaticPolicyInformationSourceConstructorOptions } from "../models/IStaticPolicyInformationSourceConstructorOptions.js";
@@ -29,9 +28,7 @@ export declare class StaticPolicyInformationSource implements IPolicyInformation
29
28
  * @param action The action to get any additional information for.
30
29
  * @returns The objects containing relevant information or undefined if nothing relevant is found.
31
30
  */
32
- retrieve<D = unknown>(policy: IRightsManagementPolicy | undefined, accessMode: PolicyInformationAccessMode, data?: D, action?: OdrlActionType | string): Promise<{
33
- [id: string]: IJsonLdNodeObject;
34
- } | undefined>;
31
+ retrieve<D = unknown>(policy: IRightsManagementPolicy | undefined, accessMode: PolicyInformationAccessMode, data?: D, action?: OdrlActionType | string): Promise<IRightsManagementInformation | undefined>;
35
32
  /**
36
33
  * Add static policy information.
37
34
  * @param info The static policy information to add.
@@ -1,5 +1,4 @@
1
- import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
- import { type IPolicyNegotiator } from "@twin.org/rights-management-models";
1
+ import { type IPolicyNegotiator, type IRightsManagementInformation } from "@twin.org/rights-management-models";
3
2
  import type { IDataspaceProtocolAgreement, IDataspaceProtocolOffer } from "@twin.org/standards-dataspace-protocol";
4
3
  import { type IOdrlParty } from "@twin.org/standards-w3c-odrl";
5
4
  import type { IPassThroughPolicyNegotiatorConstructorOptions } from "../models/IPassThroughPolicyNegotiatorConstructorOptions.js";
@@ -33,9 +32,7 @@ export declare class PassThroughPolicyNegotiator implements IPolicyNegotiator {
33
32
  * @param information Information provided by the requester to determine if a policy can be created.
34
33
  * @returns Sets the accepted flag if it can be offered, and the interventionRequired flag if manual agreement is needed.
35
34
  */
36
- handleOffer(offer: IDataspaceProtocolOffer, information?: {
37
- [id: string]: IJsonLdNodeObject;
38
- }): Promise<{
35
+ handleOffer(offer: IDataspaceProtocolOffer, information?: IRightsManagementInformation): Promise<{
39
36
  accepted: boolean;
40
37
  interventionRequired: boolean;
41
38
  }>;
@@ -46,7 +43,5 @@ export declare class PassThroughPolicyNegotiator implements IPolicyNegotiator {
46
43
  * @param information Information provided by the requester to aid in the creation of the agreement.
47
44
  * @returns The agreement created from the offer or undefined if an agreement could not be created.
48
45
  */
49
- createAgreement(offer: IDataspaceProtocolOffer, assignee: string | IOdrlParty, information?: {
50
- [id: string]: IJsonLdNodeObject;
51
- }): Promise<IDataspaceProtocolAgreement | undefined>;
46
+ createAgreement(offer: IDataspaceProtocolOffer, assignee: string | IOdrlParty, information?: IRightsManagementInformation): Promise<IDataspaceProtocolAgreement | undefined>;
52
47
  }
@@ -1,5 +1,4 @@
1
- import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
- import { type IPolicyObligationEnforcer, type IRightsManagementPolicy } from "@twin.org/rights-management-models";
1
+ import { type IPolicyObligationEnforcer, type IRightsManagementInformation, type IRightsManagementPolicy } from "@twin.org/rights-management-models";
3
2
  import type { OdrlActionType, IOdrlDuty } from "@twin.org/standards-w3c-odrl";
4
3
  import type { IPassThroughPolicyObligationEnforcerConstructorOptions } from "../models/IPassThroughPolicyObligationEnforcerConstructorOptions.js";
5
4
  /**
@@ -29,7 +28,5 @@ export declare class PassThroughPolicyObligationEnforcer implements IPolicyOblig
29
28
  * @param action Optional action to make a decision on, if not provided, the enforcer will evaluate all actions in the duty.
30
29
  * @returns Whether the obligations were successfully enforced.
31
30
  */
32
- enforce<D = unknown>(policy: IRightsManagementPolicy, duty: IOdrlDuty, information?: {
33
- [id: string]: IJsonLdNodeObject;
34
- }, data?: D, action?: OdrlActionType | string): Promise<boolean>;
31
+ enforce<D = unknown>(policy: IRightsManagementPolicy, duty: IOdrlDuty, information?: IRightsManagementInformation, data?: D, action?: OdrlActionType | string): Promise<boolean>;
35
32
  }
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.55](https://github.com/iotaledger/twin-rights-management/compare/rights-management-plugins-v0.0.3-next.54...rights-management-plugins-v0.0.3-next.55) (2026-06-18)
10
+
11
+
12
+ ### Miscellaneous Chores
13
+
14
+ * **rights-management-plugins:** Synchronize repo versions
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.54 to 0.0.3-next.55
22
+ * devDependencies
23
+ * @twin.org/rights-management-pap-service bumped from 0.0.3-next.54 to 0.0.3-next.55
24
+ * @twin.org/rights-management-pdp-service bumped from 0.0.3-next.54 to 0.0.3-next.55
25
+ * @twin.org/rights-management-pep-service bumped from 0.0.3-next.54 to 0.0.3-next.55
26
+ * @twin.org/rights-management-pip-service bumped from 0.0.3-next.54 to 0.0.3-next.55
27
+ * @twin.org/rights-management-pmp-service bumped from 0.0.3-next.54 to 0.0.3-next.55
28
+ * @twin.org/rights-management-pnp-service bumped from 0.0.3-next.54 to 0.0.3-next.55
29
+ * @twin.org/rights-management-pxp-service bumped from 0.0.3-next.54 to 0.0.3-next.55
30
+
31
+ ## [0.0.3-next.54](https://github.com/iotaledger/twin-rights-management/compare/rights-management-plugins-v0.0.3-next.53...rights-management-plugins-v0.0.3-next.54) (2026-06-18)
32
+
33
+
34
+ ### Features
35
+
36
+ * left operators ([#203](https://github.com/iotaledger/twin-rights-management/issues/203)) ([93dced6](https://github.com/iotaledger/twin-rights-management/commit/93dced6186097794ef5f3620bcf8cc86c0a77f9d))
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.53 to 0.0.3-next.54
44
+ * devDependencies
45
+ * @twin.org/rights-management-pap-service bumped from 0.0.3-next.53 to 0.0.3-next.54
46
+ * @twin.org/rights-management-pdp-service bumped from 0.0.3-next.53 to 0.0.3-next.54
47
+ * @twin.org/rights-management-pep-service bumped from 0.0.3-next.53 to 0.0.3-next.54
48
+ * @twin.org/rights-management-pip-service bumped from 0.0.3-next.53 to 0.0.3-next.54
49
+ * @twin.org/rights-management-pmp-service bumped from 0.0.3-next.53 to 0.0.3-next.54
50
+ * @twin.org/rights-management-pnp-service bumped from 0.0.3-next.53 to 0.0.3-next.54
51
+ * @twin.org/rights-management-pxp-service bumped from 0.0.3-next.53 to 0.0.3-next.54
52
+
9
53
  ## [0.0.3-next.53](https://github.com/iotaledger/twin-rights-management/compare/rights-management-plugins-v0.0.3-next.52...rights-management-plugins-v0.0.3-next.53) (2026-06-17)
10
54
 
11
55
 
@@ -86,6 +86,8 @@ The agreement to evaluate.
86
86
 
87
87
  ##### information?
88
88
 
89
+ `IRightsManagementInformation`
90
+
89
91
  Information provided by the requester to determine if a policy can be created.
90
92
 
91
93
  ##### data?
@@ -56,7 +56,7 @@ The class name of the component.
56
56
 
57
57
  ### retrieve() {#retrieve}
58
58
 
59
- > **retrieve**\<`D`\>(`policy`, `accessMode`, `data?`, `action?`): `Promise`\<\{\[`id`: `string`\]: `IJsonLdNodeObject`; \} \| `undefined`\>
59
+ > **retrieve**\<`D`\>(`policy`, `accessMode`, `data?`, `action?`): `Promise`\<`IRightsManagementInformation` \| `undefined`\>
60
60
 
61
61
  Retrieve information from the sources.
62
62
 
@@ -94,7 +94,7 @@ The action that was evaluated.
94
94
 
95
95
  #### Returns
96
96
 
97
- `Promise`\<\{\[`id`: `string`\]: `IJsonLdNodeObject`; \} \| `undefined`\>
97
+ `Promise`\<`IRightsManagementInformation` \| `undefined`\>
98
98
 
99
99
  The objects containing relevant information or undefined if nothing relevant is found.
100
100
 
@@ -56,7 +56,7 @@ The class name of the component.
56
56
 
57
57
  ### retrieve() {#retrieve}
58
58
 
59
- > **retrieve**\<`D`\>(`policy`, `accessMode`, `data?`, `action?`): `Promise`\<\{\[`id`: `string`\]: `IJsonLdNodeObject`; \} \| `undefined`\>
59
+ > **retrieve**\<`D`\>(`policy`, `accessMode`, `data?`, `action?`): `Promise`\<`IRightsManagementInformation` \| `undefined`\>
60
60
 
61
61
  Retrieve information from the sources.
62
62
 
@@ -94,7 +94,7 @@ The action that was evaluated.
94
94
 
95
95
  #### Returns
96
96
 
97
- `Promise`\<\{\[`id`: `string`\]: `IJsonLdNodeObject`; \} \| `undefined`\>
97
+ `Promise`\<`IRightsManagementInformation` \| `undefined`\>
98
98
 
99
99
  The objects containing relevant information or undefined if nothing relevant is found.
100
100
 
@@ -76,6 +76,8 @@ The agreement to evaluate.
76
76
 
77
77
  ##### information?
78
78
 
79
+ `IRightsManagementInformation`
80
+
79
81
  Information provided by the requester to determine if a policy can be created.
80
82
 
81
83
  ##### data?
@@ -96,6 +96,8 @@ The offer to check.
96
96
 
97
97
  ##### information?
98
98
 
99
+ `IRightsManagementInformation`
100
+
99
101
  Information provided by the requester to determine if a policy can be created.
100
102
 
101
103
  #### Returns
@@ -132,6 +134,8 @@ The assignee of the agreement.
132
134
 
133
135
  ##### information?
134
136
 
137
+ `IRightsManagementInformation`
138
+
135
139
  Information provided by the requester to aid in the creation of the agreement.
136
140
 
137
141
  #### Returns
@@ -82,6 +82,8 @@ The duty to enforce.
82
82
 
83
83
  ##### information?
84
84
 
85
+ `IRightsManagementInformation`
86
+
85
87
  Information provided by the requester to determine if a policy can be created.
86
88
 
87
89
  ##### data?
@@ -56,7 +56,7 @@ The class name of the component.
56
56
 
57
57
  ### retrieve() {#retrieve}
58
58
 
59
- > **retrieve**\<`D`\>(`policy`, `accessMode`, `data?`, `action?`): `Promise`\<\{\[`id`: `string`\]: `IJsonLdNodeObject`; \} \| `undefined`\>
59
+ > **retrieve**\<`D`\>(`policy`, `accessMode`, `data?`, `action?`): `Promise`\<`IRightsManagementInformation` \| `undefined`\>
60
60
 
61
61
  Retrieve information from the sources.
62
62
 
@@ -94,7 +94,7 @@ The action to get any additional information for.
94
94
 
95
95
  #### Returns
96
96
 
97
- `Promise`\<\{\[`id`: `string`\]: `IJsonLdNodeObject`; \} \| `undefined`\>
97
+ `Promise`\<`IRightsManagementInformation` \| `undefined`\>
98
98
 
99
99
  The objects containing relevant information or undefined if nothing relevant is found.
100
100
 
@@ -38,10 +38,6 @@ Information is only provided for the specified locator combination.
38
38
 
39
39
  ### objects {#objects}
40
40
 
41
- > **objects**: `object`
41
+ > **objects**: `IRightsManagementInformation`
42
42
 
43
43
  The objects containing the information.
44
-
45
- #### Index Signature
46
-
47
- \[`id`: `string`\]: `IJsonLdNodeObject`
package/locales/en.json CHANGED
@@ -27,7 +27,8 @@
27
27
  "constraintStatusNotSupported": "Constraint status is not supported. State-based evaluation is not implemented.",
28
28
  "jsonPathExpressionMissing": "Canonical JSONPath expression is missing for \"{operand}\". Provide twin:jsonPathExpression.",
29
29
  "policyProfileNotSupported": "Policy \"{policyId}\" declares unsupported profile \"{unsupportedProfile}\". Only known profiles are supported.",
30
- "inheritedPolicyProfileNotSupported": "Inherited policy \"{policyId}\" declares an unsupported profile. All policies in the inheritFrom chain must declare only supported profiles."
30
+ "inheritedPolicyProfileNotSupported": "Inherited policy \"{policyId}\" declares an unsupported profile. All policies in the inheritFrom chain must declare only supported profiles.",
31
+ "leftOperandNotSupported": "Constraint leftOperand \"{leftOperand}\" is a recognised ODRL built-in but is not yet supported by this arbiter."
31
32
  },
32
33
  "defaultPolicyEnforcementProcessor": {
33
34
  "targetNotJsonPath": "The policy decision target \"{target}\" is not a valid JSON-path string, it should be a minimum of $.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/rights-management-plugins",
3
- "version": "0.0.3-next.53",
3
+ "version": "0.0.3-next.55",
4
4
  "description": "Plugin implementations for extending rights management behaviour across components.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,7 +26,7 @@
26
26
  "@twin.org/identity-models": "next",
27
27
  "@twin.org/logging-models": "next",
28
28
  "@twin.org/nameof": "next",
29
- "@twin.org/rights-management-models": "0.0.3-next.53",
29
+ "@twin.org/rights-management-models": "0.0.3-next.55",
30
30
  "@twin.org/standards-w3c-odrl": "next"
31
31
  },
32
32
  "main": "./dist/es/index.js",