@3sixty/rights-management-plugins 0.20.0-next.0 → 0.20.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/es/index.js.map +1 -1
  2. package/dist/es/models/IAutomationPolicyExecutionActionConfig.js.map +1 -1
  3. package/dist/es/models/IAutomationPolicyExecutionActionConstructorOptions.js.map +1 -1
  4. package/dist/es/models/IDefaultPolicyArbiterConfig.js.map +1 -1
  5. package/dist/es/models/IDefaultPolicyArbiterConstructorOptions.js.map +1 -1
  6. package/dist/es/models/IDefaultPolicyEnforcementProcessorConfig.js.map +1 -1
  7. package/dist/es/models/IDefaultPolicyEnforcementProcessorConstructorOptions.js.map +1 -1
  8. package/dist/es/models/IIdentityPolicyInformationSourceConstructorOptions.js.map +1 -1
  9. package/dist/es/models/IIdentityProfilePolicyInformationSourceConstructorOptions.js.map +1 -1
  10. package/dist/es/models/ILoggingPolicyExecutionActionConfig.js.map +1 -1
  11. package/dist/es/models/ILoggingPolicyExecutionActionConstructorOptions.js.map +1 -1
  12. package/dist/es/models/IPassThroughPolicyArbiterConstructorOptions.js.map +1 -1
  13. package/dist/es/models/IPassThroughPolicyEnforcementProcessorConstructorOptions.js.map +1 -1
  14. package/dist/es/models/IPassThroughPolicyNegotiatorConfig.js.map +1 -1
  15. package/dist/es/models/IPassThroughPolicyNegotiatorConstructorOptions.js.map +1 -1
  16. package/dist/es/models/IPassThroughPolicyObligationEnforcerConstructorOptions.js.map +1 -1
  17. package/dist/es/models/IPassThroughPolicyRequesterConstructorOptions.js.map +1 -1
  18. package/dist/es/models/IStaticPolicyInformationSource.js.map +1 -1
  19. package/dist/es/models/IStaticPolicyInformationSourceConfig.js.map +1 -1
  20. package/dist/es/models/IStaticPolicyInformationSourceConstructorOptions.js.map +1 -1
  21. package/dist/es/policyArbiters/defaultPolicyArbiter.js.map +1 -1
  22. package/dist/es/policyArbiters/passThroughPolicyArbiter.js.map +1 -1
  23. package/dist/es/policyEnforcementProcessor/defaultPolicyEnforcementProcessor.js.map +1 -1
  24. package/dist/es/policyEnforcementProcessor/passThroughPolicyEnforcementProcessor.js.map +1 -1
  25. package/dist/es/policyExecutionActions/automationPolicyExecutionAction.js.map +1 -1
  26. package/dist/es/policyExecutionActions/loggingPolicyExecutionAction.js.map +1 -1
  27. package/dist/es/policyInformationSources/identityPolicyInformationSource.js.map +1 -1
  28. package/dist/es/policyInformationSources/identityProfilePolicyInformationSource.js.map +1 -1
  29. package/dist/es/policyInformationSources/staticPolicyInformationSource.js.map +1 -1
  30. package/dist/es/policyNegotiators/passThroughPolicyNegotiator.js.map +1 -1
  31. package/dist/es/policyObligationEnforcers/passThroughPolicyObligationEnforcer.js.map +1 -1
  32. package/dist/es/policyRequesters/passThroughPolicyRequester.js.map +1 -1
  33. package/docs/changelog.md +24 -0
  34. package/docs/reference/classes/AutomationPolicyExecutionAction.md +1 -1
  35. package/docs/reference/classes/DefaultPolicyArbiter.md +1 -1
  36. package/docs/reference/classes/DefaultPolicyEnforcementProcessor.md +2 -2
  37. package/docs/reference/classes/IdentityPolicyInformationSource.md +1 -1
  38. package/docs/reference/classes/IdentityProfilePolicyInformationSource.md +1 -1
  39. package/docs/reference/classes/LoggingPolicyExecutionAction.md +1 -1
  40. package/docs/reference/classes/PassThroughPolicyArbiter.md +1 -1
  41. package/docs/reference/classes/PassThroughPolicyEnforcementProcessor.md +2 -2
  42. package/docs/reference/classes/PassThroughPolicyObligationEnforcer.md +1 -1
  43. package/docs/reference/classes/StaticPolicyInformationSource.md +1 -1
  44. 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,cAAc,CAAC;AAGxD,OAAO,EACN,gBAAgB,EAChB,cAAc,EAId,MAAM,kCAAkC,CAAC;AAK1C;;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 \"@3sixty/core\";\nimport type { ILoggingComponent } from \"@3sixty/logging-models\";\nimport { nameof } from \"@3sixty/nameof\";\nimport {\n\tOdrlPolicyHelper,\n\tPolicyDecision,\n\ttype IPolicyArbiter,\n\ttype IPolicyDecision,\n\ttype IRightsManagementInformation\n} from \"@3sixty/rights-management-models\";\nimport type { IDataspaceProtocolAgreement } from \"@3sixty/standards-dataspace-protocol\";\nimport type { OdrlActionType } from \"@3sixty/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
+ {"version":3,"file":"passThroughPolicyArbiter.js","sources":["../../../src/policyArbiters/passThroughPolicyArbiter.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGxD,OAAO,EACN,gBAAgB,EAChB,cAAc,EAId,MAAM,kCAAkC,CAAC;AAK1C;;GAEG;AACH,MAAM,OAAO,wBAAwB;IACpC;;OAEG;IACI,MAAM,CAAU,UAAU,GAAW,0BAA0B,CAAC;IAEvE;;;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,EACnC,WAAW,EACX,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;CACD","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, Guards } from \"@3sixty/core\";\nimport type { ILoggingComponent } from \"@3sixty/logging-models\";\n\nimport {\n\tOdrlPolicyHelper,\n\tPolicyDecision,\n\ttype IPolicyArbiter,\n\ttype IPolicyDecision,\n\ttype IRightsManagementInformation\n} from \"@3sixty/rights-management-models\";\nimport type { IDataspaceProtocolAgreement } from \"@3sixty/standards-dataspace-protocol\";\nimport type { OdrlActionType } from \"@3sixty/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 = \"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\t\"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":"defaultPolicyEnforcementProcessor.js","sourceRoot":"","sources":["../../../src/policyEnforcementProcessor/defaultPolicyEnforcementProcessor.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD,OAAO,EACN,gBAAgB,EAChB,cAAc,EAGd,MAAM,kCAAkC,CAAC;AAK1C;;GAEG;AACH,MAAM,OAAO,iCAAiC;IAC7C;;OAEG;IACI,MAAM,CAAU,UAAU,uCAAuD;IAExF;;OAEG;IACI,MAAM,CAAU,uBAAuB,GAAa;QAC1D,UAAU;QACV,OAAO;QACP,KAAK;QACL,MAAM;QACN,IAAI;KACJ,CAAC;IAEF;;;OAGG;IACc,QAAQ,CAAqB;IAE9C;;;OAGG;IACc,eAAe,CAAW;IAE3C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cesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, GeneralError, Guards, Is, ObjectHelper } from \"@3sixty/core\";\nimport { JsonPathHelper } from \"@3sixty/data-json-path\";\nimport type { ILoggingComponent } from \"@3sixty/logging-models\";\nimport { nameof } from \"@3sixty/nameof\";\nimport {\n\tOdrlPolicyHelper,\n\tPolicyDecision,\n\ttype IPolicyDecision,\n\ttype IPolicyEnforcementProcessor\n} from \"@3sixty/rights-management-models\";\nimport type { IDataspaceProtocolAgreement } from \"@3sixty/standards-dataspace-protocol\";\nimport type { OdrlActionType } from \"@3sixty/standards-w3c-odrl\";\nimport type { IDefaultPolicyEnforcementProcessorConstructorOptions } from \"../models/IDefaultPolicyEnforcementProcessorConstructorOptions.js\";\n\n/**\n * Default Policy Enforcement Processor.\n */\nexport class DefaultPolicyEnforcementProcessor implements IPolicyEnforcementProcessor {\n\t/**\n\t * The class name of the Default Policy Enforcement Processor.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<DefaultPolicyEnforcementProcessor>();\n\n\t/**\n\t * Default set of top-level keys treated as document-structural fields.\n\t */\n\tpublic static readonly DEFAULT_STRUCTURAL_KEYS: string[] = [\n\t\t\"@context\",\n\t\t\"@type\",\n\t\t\"@id\",\n\t\t\"type\",\n\t\t\"id\"\n\t];\n\n\t/**\n\t * The logging component.\n\t * @internal\n\t */\n\tprivate readonly _logging?: ILoggingComponent;\n\n\t/**\n\t * Keys unconditionally passed through from source to output.\n\t * @internal\n\t */\n\tprivate readonly _structuralKeys: string[];\n\n\t/**\n\t * Create a new instance of DefaultPolicyEnforcementProcessor.\n\t * @param options The options for the default policy enforcement processor.\n\t */\n\tconstructor(options?: IDefaultPolicyEnforcementProcessorConstructorOptions) {\n\t\tthis._logging = ComponentFactory.getIfExists<ILoggingComponent>(options?.loggingComponentType);\n\t\tthis._structuralKeys =\n\t\t\toptions?.config?.structuralKeys ?? DefaultPolicyEnforcementProcessor.DEFAULT_STRUCTURAL_KEYS;\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 DefaultPolicyEnforcementProcessor.CLASS_NAME;\n\t}\n\n\t/**\n\t * Process the response from the policy decision point.\n\t * @param agreement The agreement to process.\n\t * @param decisions The decisions made by the policy decision point.\n\t * @param data The data to process.\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 data after processing.\n\t */\n\tpublic async process<D = unknown, R = D>(\n\t\tagreement: IDataspaceProtocolAgreement,\n\t\tdecisions: IPolicyDecision[],\n\t\tdata?: D,\n\t\taction?: OdrlActionType | string\n\t): Promise<R> {\n\t\tGuards.object<IDataspaceProtocolAgreement>(\n\t\t\tDefaultPolicyEnforcementProcessor.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: DefaultPolicyEnforcementProcessor.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"processingPolicy\",\n\t\t\tdata: {\n\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(agreement) ?? \"\"\n\t\t\t}\n\t\t});\n\n\t\tconst isOriginalEmpty = Is.empty(data);\n\t\tconst outputObject: R = (Is.arrayValue(data) ? [] : {}) as unknown as R;\n\n\t\tif (Is.arrayValue(decisions)) {\n\t\t\t// If this is a single simple decision with no values, handle that quickly.\n\t\t\tif (decisions.length === 1 && decisions[0].target === \"$\") {\n\t\t\t\tif (!Is.stringValue(decisions[0].target)) {\n\t\t\t\t\tthrow new GeneralError(\n\t\t\t\t\t\tDefaultPolicyEnforcementProcessor.CLASS_NAME,\n\t\t\t\t\t\t\"targetNotJsonPath\",\n\t\t\t\t\t\t{ target: decisions[0].target }\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (decisions[0].decision === PolicyDecision.Granted) {\n\t\t\t\t\t// Object granted, if original data is an object return it, otherwise return true.\n\t\t\t\t\treturn isOriginalEmpty ? (true as R) : (data as unknown as R);\n\t\t\t\t} else if (\n\t\t\t\t\tdecisions[0].decision === PolicyDecision.Replace &&\n\t\t\t\t\tIs.object(decisions[0].replaceValue)\n\t\t\t\t) {\n\t\t\t\t\t// Object replaced, return the replace value.\n\t\t\t\t\treturn decisions[0].replaceValue as R;\n\t\t\t\t}\n\n\t\t\t\t// Object denied, or replace with no value\n\t\t\t\t// if original data is an object return empty object, otherwise return false.\n\t\t\t\treturn isOriginalEmpty ? (false as R) : ({} as unknown as R);\n\t\t\t}\n\n\t\t\tfor (const policyDecision of decisions) {\n\t\t\t\tif (!Is.stringValue(policyDecision.target)) {\n\t\t\t\t\tthrow new GeneralError(\n\t\t\t\t\t\tDefaultPolicyEnforcementProcessor.CLASS_NAME,\n\t\t\t\t\t\t\"targetNotJsonPath\",\n\t\t\t\t\t\t{ target: policyDecision.target }\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tpolicyDecision.decision === PolicyDecision.Replace &&\n\t\t\t\t\tIs.undefined(policyDecision.replaceValue)\n\t\t\t\t) {\n\t\t\t\t\tthrow new GeneralError(\n\t\t\t\t\t\tDefaultPolicyEnforcementProcessor.CLASS_NAME,\n\t\t\t\t\t\t\"replaceValueMissing\",\n\t\t\t\t\t\t{ target: policyDecision.target }\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthis.processDecision<D, R>(data, outputObject, policyDecision);\n\t\t\t}\n\t\t\tthis.compactArrays(outputObject);\n\n\t\t\t// Well-known JSON-LD envelope fields carry document structure, not\n\t\t\t// access-controlled data. Pass them through unconditionally so that a policy\n\t\t\t// targeting only a nested array does not strip @context / type from the root.\n\t\t\tif (!isOriginalEmpty && Is.object(data) && Is.object(outputObject)) {\n\t\t\t\tfor (const structuralKey of this._structuralKeys) {\n\t\t\t\t\tconst structuralData = ObjectHelper.propertyGet(data, structuralKey);\n\t\t\t\t\tif (!Is.empty(structuralData)) {\n\t\t\t\t\t\tObjectHelper.propertySet(outputObject, structuralKey, structuralData);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn outputObject;\n\t}\n\n\t/**\n\t * Remove undefined holes left by deleteAtLocation from every array in the object tree.\n\t * @param obj The object to compact in place.\n\t * @internal\n\t */\n\tprivate compactArrays(obj: unknown): void {\n\t\tif (Is.array(obj)) {\n\t\t\tfor (let i = obj.length - 1; i >= 0; i--) {\n\t\t\t\tif (Is.undefined(obj[i])) {\n\t\t\t\t\tobj.splice(i, 1);\n\t\t\t\t} else {\n\t\t\t\t\tthis.compactArrays(obj[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (Is.object(obj)) {\n\t\t\tfor (const value of Object.values(obj)) {\n\t\t\t\tthis.compactArrays(value);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Process a single policy decision.\n\t * @param sourceObject The data to process.\n\t * @param outputObject The currently processed object.\n\t * @param policyDecision The policy decision to process.\n\t * @throws GeneralError When replaceValue is missing or invalid.\n\t * @internal\n\t */\n\tprivate processDecision<D = unknown, R = D>(\n\t\tsourceObject: D | undefined,\n\t\toutputObject: R,\n\t\tpolicyDecision: IPolicyDecision\n\t): void {\n\t\t// If the target is \"$\" assume we are using the entire source object.\n\t\tif (policyDecision.target === \"$\") {\n\t\t\tconst sourceKeys = Object.keys(sourceObject ?? {});\n\t\t\tconst outputKeys = Object.keys(outputObject ?? {});\n\n\t\t\tif (policyDecision.decision === PolicyDecision.Granted) {\n\t\t\t\tfor (const key of sourceKeys) {\n\t\t\t\t\tObjectHelper.propertySet(outputObject, key, ObjectHelper.propertyGet(sourceObject, key));\n\t\t\t\t}\n\t\t\t} else if (policyDecision.decision === PolicyDecision.Replace) {\n\t\t\t\t// Replace everything, first remove all the current keys.\n\t\t\t\tfor (const key of outputKeys) {\n\t\t\t\t\tObjectHelper.propertyDelete(outputObject, key);\n\t\t\t\t}\n\t\t\t\tif (Is.objectValue(policyDecision.replaceValue)) {\n\t\t\t\t\tconst replaceKeys = Object.keys(policyDecision.replaceValue);\n\t\t\t\t\tfor (const key of replaceKeys) {\n\t\t\t\t\t\tObjectHelper.propertySet(\n\t\t\t\t\t\t\toutputObject,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tObjectHelper.propertyGet(policyDecision.replaceValue, key)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Denied everything, so remove all the properties.\n\t\t\t\tfor (const key of sourceKeys) {\n\t\t\t\t\tObjectHelper.propertyDelete(outputObject, key);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (policyDecision.decision === PolicyDecision.Granted) {\n\t\t\t// We have a specific granted target (JSONPath), so copy all matching values into the output.\n\t\t\tconst results = JsonPathHelper.query(policyDecision.target, sourceObject ?? {});\n\t\t\tfor (const result of results) {\n\t\t\t\tJsonPathHelper.setAtLocation(outputObject, result.location, result.value);\n\t\t\t}\n\t\t} else if (policyDecision.decision === PolicyDecision.Replace) {\n\t\t\t// We have a specific replace target (JSONPath), so write replaceValue into all matching locations.\n\t\t\tconst results = JsonPathHelper.query(policyDecision.target, sourceObject ?? {});\n\t\t\tfor (const result of results) {\n\t\t\t\tJsonPathHelper.setAtLocation(outputObject, result.location, policyDecision.replaceValue);\n\t\t\t}\n\t\t} else {\n\t\t\t// We have a specific denied target (JSONPath), so remove all matching values from the output.\n\t\t\tconst results = JsonPathHelper.query(policyDecision.target, outputObject);\n\t\t\tfor (const result of results) {\n\t\t\t\tJsonPathHelper.deleteAtLocation(outputObject, result.location);\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"defaultPolicyEnforcementProcessor.js","sources":["../../../src/policyEnforcementProcessor/defaultPolicyEnforcementProcessor.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAg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E,YAAY,IAAI,EAAE,CAAC,CAAC;YAChF,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;gBAC9B,cAAc,CAAC,aAAa,CAAC,YAAY,EAAE,MAAM,CAAC,QAAQ,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;YAC1F,CAAC;QACF,CAAC;aAAM,CAAC;YACP,8FAA8F;YAC9F,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;YAC1E,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;gBAC9B,cAAc,CAAC,gBAAgB,CAAC,YAAY,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;YAChE,CAAC;QACF,CAAC;IACF,CAAC;CACD","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, GeneralError, Guards, Is, ObjectHelper } from \"@3sixty/core\";\nimport { JsonPathHelper } from \"@3sixty/data-json-path\";\nimport type { ILoggingComponent } from \"@3sixty/logging-models\";\n\nimport {\n\tOdrlPolicyHelper,\n\tPolicyDecision,\n\ttype IPolicyDecision,\n\ttype IPolicyEnforcementProcessor\n} from \"@3sixty/rights-management-models\";\nimport type { IDataspaceProtocolAgreement } from \"@3sixty/standards-dataspace-protocol\";\nimport type { OdrlActionType } from \"@3sixty/standards-w3c-odrl\";\nimport type { IDefaultPolicyEnforcementProcessorConstructorOptions } from \"../models/IDefaultPolicyEnforcementProcessorConstructorOptions.js\";\n\n/**\n * Default Policy Enforcement Processor.\n */\nexport class DefaultPolicyEnforcementProcessor implements IPolicyEnforcementProcessor {\n\t/**\n\t * The class name of the Default Policy Enforcement Processor.\n\t */\n\tpublic static readonly CLASS_NAME: string = \"DefaultPolicyEnforcementProcessor\";\n\n\t/**\n\t * Default set of top-level keys treated as document-structural fields.\n\t */\n\tpublic static readonly DEFAULT_STRUCTURAL_KEYS: string[] = [\n\t\t\"@context\",\n\t\t\"@type\",\n\t\t\"@id\",\n\t\t\"type\",\n\t\t\"id\"\n\t];\n\n\t/**\n\t * The logging component.\n\t * @internal\n\t */\n\tprivate readonly _logging?: ILoggingComponent;\n\n\t/**\n\t * Keys unconditionally passed through from source to output.\n\t * @internal\n\t */\n\tprivate readonly _structuralKeys: string[];\n\n\t/**\n\t * Create a new instance of DefaultPolicyEnforcementProcessor.\n\t * @param options The options for the default policy enforcement processor.\n\t */\n\tconstructor(options?: IDefaultPolicyEnforcementProcessorConstructorOptions) {\n\t\tthis._logging = ComponentFactory.getIfExists<ILoggingComponent>(options?.loggingComponentType);\n\t\tthis._structuralKeys =\n\t\t\toptions?.config?.structuralKeys ?? DefaultPolicyEnforcementProcessor.DEFAULT_STRUCTURAL_KEYS;\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 DefaultPolicyEnforcementProcessor.CLASS_NAME;\n\t}\n\n\t/**\n\t * Process the response from the policy decision point.\n\t * @param agreement The agreement to process.\n\t * @param decisions The decisions made by the policy decision point.\n\t * @param data The data to process.\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 data after processing.\n\t */\n\tpublic async process<D = unknown, R = D>(\n\t\tagreement: IDataspaceProtocolAgreement,\n\t\tdecisions: IPolicyDecision[],\n\t\tdata?: D,\n\t\taction?: OdrlActionType | string\n\t): Promise<R> {\n\t\tGuards.object<IDataspaceProtocolAgreement>(\n\t\t\tDefaultPolicyEnforcementProcessor.CLASS_NAME,\n\t\t\t\"agreement\",\n\t\t\tagreement\n\t\t);\n\n\t\tawait this._logging?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DefaultPolicyEnforcementProcessor.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"processingPolicy\",\n\t\t\tdata: {\n\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(agreement) ?? \"\"\n\t\t\t}\n\t\t});\n\n\t\tconst isOriginalEmpty = Is.empty(data);\n\t\tconst outputObject: R = (Is.arrayValue(data) ? [] : {}) as unknown as R;\n\n\t\tif (Is.arrayValue(decisions)) {\n\t\t\t// If this is a single simple decision with no values, handle that quickly.\n\t\t\tif (decisions.length === 1 && decisions[0].target === \"$\") {\n\t\t\t\tif (!Is.stringValue(decisions[0].target)) {\n\t\t\t\t\tthrow new GeneralError(\n\t\t\t\t\t\tDefaultPolicyEnforcementProcessor.CLASS_NAME,\n\t\t\t\t\t\t\"targetNotJsonPath\",\n\t\t\t\t\t\t{ target: decisions[0].target }\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (decisions[0].decision === PolicyDecision.Granted) {\n\t\t\t\t\t// Object granted, if original data is an object return it, otherwise return true.\n\t\t\t\t\treturn isOriginalEmpty ? (true as R) : (data as unknown as R);\n\t\t\t\t} else if (\n\t\t\t\t\tdecisions[0].decision === PolicyDecision.Replace &&\n\t\t\t\t\tIs.object(decisions[0].replaceValue)\n\t\t\t\t) {\n\t\t\t\t\t// Object replaced, return the replace value.\n\t\t\t\t\treturn decisions[0].replaceValue as R;\n\t\t\t\t}\n\n\t\t\t\t// Object denied, or replace with no value\n\t\t\t\t// if original data is an object return empty object, otherwise return false.\n\t\t\t\treturn isOriginalEmpty ? (false as R) : ({} as unknown as R);\n\t\t\t}\n\n\t\t\tfor (const policyDecision of decisions) {\n\t\t\t\tif (!Is.stringValue(policyDecision.target)) {\n\t\t\t\t\tthrow new GeneralError(\n\t\t\t\t\t\tDefaultPolicyEnforcementProcessor.CLASS_NAME,\n\t\t\t\t\t\t\"targetNotJsonPath\",\n\t\t\t\t\t\t{ target: policyDecision.target }\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tpolicyDecision.decision === PolicyDecision.Replace &&\n\t\t\t\t\tIs.undefined(policyDecision.replaceValue)\n\t\t\t\t) {\n\t\t\t\t\tthrow new GeneralError(\n\t\t\t\t\t\tDefaultPolicyEnforcementProcessor.CLASS_NAME,\n\t\t\t\t\t\t\"replaceValueMissing\",\n\t\t\t\t\t\t{ target: policyDecision.target }\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthis.processDecision<D, R>(data, outputObject, policyDecision);\n\t\t\t}\n\t\t\tthis.compactArrays(outputObject);\n\n\t\t\t// Well-known JSON-LD envelope fields carry document structure, not\n\t\t\t// access-controlled data. Pass them through unconditionally so that a policy\n\t\t\t// targeting only a nested array does not strip @context / type from the root.\n\t\t\tif (!isOriginalEmpty && Is.object(data) && Is.object(outputObject)) {\n\t\t\t\tfor (const structuralKey of this._structuralKeys) {\n\t\t\t\t\tconst structuralData = ObjectHelper.propertyGet(data, structuralKey);\n\t\t\t\t\tif (!Is.empty(structuralData)) {\n\t\t\t\t\t\tObjectHelper.propertySet(outputObject, structuralKey, structuralData);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn outputObject;\n\t}\n\n\t/**\n\t * Remove undefined holes left by deleteAtLocation from every array in the object tree.\n\t * @param obj The object to compact in place.\n\t * @internal\n\t */\n\tprivate compactArrays(obj: unknown): void {\n\t\tif (Is.array(obj)) {\n\t\t\tfor (let i = obj.length - 1; i >= 0; i--) {\n\t\t\t\tif (Is.undefined(obj[i])) {\n\t\t\t\t\tobj.splice(i, 1);\n\t\t\t\t} else {\n\t\t\t\t\tthis.compactArrays(obj[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (Is.object(obj)) {\n\t\t\tfor (const value of Object.values(obj)) {\n\t\t\t\tthis.compactArrays(value);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Process a single policy decision.\n\t * @param sourceObject The data to process.\n\t * @param outputObject The currently processed object.\n\t * @param policyDecision The policy decision to process.\n\t * @throws GeneralError When replaceValue is missing or invalid.\n\t * @internal\n\t */\n\tprivate processDecision<D = unknown, R = D>(\n\t\tsourceObject: D | undefined,\n\t\toutputObject: R,\n\t\tpolicyDecision: IPolicyDecision\n\t): void {\n\t\t// If the target is \"$\" assume we are using the entire source object.\n\t\tif (policyDecision.target === \"$\") {\n\t\t\tconst sourceKeys = Object.keys(sourceObject ?? {});\n\t\t\tconst outputKeys = Object.keys(outputObject ?? {});\n\n\t\t\tif (policyDecision.decision === PolicyDecision.Granted) {\n\t\t\t\tfor (const key of sourceKeys) {\n\t\t\t\t\tObjectHelper.propertySet(outputObject, key, ObjectHelper.propertyGet(sourceObject, key));\n\t\t\t\t}\n\t\t\t} else if (policyDecision.decision === PolicyDecision.Replace) {\n\t\t\t\t// Replace everything, first remove all the current keys.\n\t\t\t\tfor (const key of outputKeys) {\n\t\t\t\t\tObjectHelper.propertyDelete(outputObject, key);\n\t\t\t\t}\n\t\t\t\tif (Is.objectValue(policyDecision.replaceValue)) {\n\t\t\t\t\tconst replaceKeys = Object.keys(policyDecision.replaceValue);\n\t\t\t\t\tfor (const key of replaceKeys) {\n\t\t\t\t\t\tObjectHelper.propertySet(\n\t\t\t\t\t\t\toutputObject,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tObjectHelper.propertyGet(policyDecision.replaceValue, key)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Denied everything, so remove all the properties.\n\t\t\t\tfor (const key of sourceKeys) {\n\t\t\t\t\tObjectHelper.propertyDelete(outputObject, key);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (policyDecision.decision === PolicyDecision.Granted) {\n\t\t\t// We have a specific granted target (JSONPath), so copy all matching values into the output.\n\t\t\tconst results = JsonPathHelper.query(policyDecision.target, sourceObject ?? {});\n\t\t\tfor (const result of results) {\n\t\t\t\tJsonPathHelper.setAtLocation(outputObject, result.location, result.value);\n\t\t\t}\n\t\t} else if (policyDecision.decision === PolicyDecision.Replace) {\n\t\t\t// We have a specific replace target (JSONPath), so write replaceValue into all matching locations.\n\t\t\tconst results = JsonPathHelper.query(policyDecision.target, sourceObject ?? {});\n\t\t\tfor (const result of results) {\n\t\t\t\tJsonPathHelper.setAtLocation(outputObject, result.location, policyDecision.replaceValue);\n\t\t\t}\n\t\t} else {\n\t\t\t// We have a specific denied target (JSONPath), so remove all matching values from the output.\n\t\t\tconst results = JsonPathHelper.query(policyDecision.target, outputObject);\n\t\t\tfor (const result of results) {\n\t\t\t\tJsonPathHelper.deleteAtLocation(outputObject, result.location);\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"passThroughPolicyEnforcementProcessor.js","sourceRoot":"","sources":["../../../src/policyEnforcementProcessor/passThroughPolicyEnforcementProcessor.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGxD,OAAO,EACN,gBAAgB,EAGhB,MAAM,kCAAkC,CAAC;AAK1C;;GAEG;AACH,MAAM,OAAO,qCAAqC;IACjD;;OAEG;IACI,MAAM,CAAU,UAAU,2CAA2D;IAE5F;;;OAGG;IACc,QAAQ,CAAqB;IAE9C;;;OAGG;IACH,YAAY,OAAkE;QAC7E,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,WAAW,CAAoB,OAAO,EAAE,oBAAoB,CAAC,CAAC;IAChG,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,qCAAqC,CAAC,UAAU,CAAC;IACzD,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,OAAO,CACnB,SAAsC,EACtC,SAA4B,EAC5B,IAAQ,EACR,MAAgC;QAEhC,MAAM,CAAC,MAAM,CACZ,qCAAqC,CAAC,UAAU,eAEhD,SAAS,CACT,CAAC;QAEF,MAAM,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;YACxB,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,qCAAqC,CAAC,UAAU;YACxD,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;YACd,OAAO,EAAE,kBAAkB;YAC3B,IAAI,EAAE;gBACL,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE;aAClD;SACD,CAAC,CAAC;QAEH,OAAO,IAAoB,CAAC;IAC7B,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, Guards } from \"@3sixty/core\";\nimport type { ILoggingComponent } from \"@3sixty/logging-models\";\nimport { nameof } from \"@3sixty/nameof\";\nimport {\n\tOdrlPolicyHelper,\n\ttype IPolicyDecision,\n\ttype IPolicyEnforcementProcessor\n} from \"@3sixty/rights-management-models\";\nimport type { IDataspaceProtocolAgreement } from \"@3sixty/standards-dataspace-protocol\";\nimport type { OdrlActionType } from \"@3sixty/standards-w3c-odrl\";\nimport type { IPassThroughPolicyEnforcementProcessorConstructorOptions } from \"../models/IPassThroughPolicyEnforcementProcessorConstructorOptions.js\";\n\n/**\n * Pass Through Policy Enforcement Processor.\n */\nexport class PassThroughPolicyEnforcementProcessor implements IPolicyEnforcementProcessor {\n\t/**\n\t * The class name of the Pass Through Policy Enforcement Processor.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<PassThroughPolicyEnforcementProcessor>();\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 PassThroughPolicyEnforcementProcessor.\n\t * @param options The options for the pass through policy enforcement processor.\n\t */\n\tconstructor(options?: IPassThroughPolicyEnforcementProcessorConstructorOptions) {\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 PassThroughPolicyEnforcementProcessor.CLASS_NAME;\n\t}\n\n\t/**\n\t * Process the response from the policy decision point.\n\t * @param agreement The agreement to process.\n\t * @param decisions The decisions made by the policy decision point.\n\t * @param data The data to process.\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 data after processing.\n\t */\n\tpublic async process<D = unknown, R = D>(\n\t\tagreement: IDataspaceProtocolAgreement,\n\t\tdecisions: IPolicyDecision[],\n\t\tdata?: D,\n\t\taction?: OdrlActionType | string\n\t): Promise<R> {\n\t\tGuards.object<IDataspaceProtocolAgreement>(\n\t\t\tPassThroughPolicyEnforcementProcessor.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: PassThroughPolicyEnforcementProcessor.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"processingPolicy\",\n\t\t\tdata: {\n\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(agreement) ?? \"\"\n\t\t\t}\n\t\t});\n\n\t\treturn data as unknown as R;\n\t}\n}\n"]}
1
+ {"version":3,"file":"passThroughPolicyEnforcementProcessor.js","sources":["../../../src/policyEnforcementProcessor/passThroughPolicyEnforcementProcessor.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGxD,OAAO,EACN,gBAAgB,EAGhB,MAAM,kCAAkC,CAAC;AAK1C;;GAEG;AACH,MAAM,OAAO,qCAAqC;IACjD;;OAEG;IACI,MAAM,CAAU,UAAU,GAAW,uCAAuC,CAAC;IAEpF;;;OAGG;IACc,QAAQ,CAAqB;IAE9C;;;OAGG;IACH,YAAY,OAAkE;QAC7E,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,WAAW,CAAoB,OAAO,EAAE,oBAAoB,CAAC,CAAC;IAChG,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,qCAAqC,CAAC,UAAU,CAAC;IACzD,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,OAAO,CACnB,SAAsC,EACtC,SAA4B,EAC5B,IAAQ,EACR,MAAgC;QAEhC,MAAM,CAAC,MAAM,CACZ,qCAAqC,CAAC,UAAU,EAChD,WAAW,EACX,SAAS,CACT,CAAC;QAEF,MAAM,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;YACxB,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,qCAAqC,CAAC,UAAU;YACxD,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;YACd,OAAO,EAAE,kBAAkB;YAC3B,IAAI,EAAE;gBACL,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE;aAClD;SACD,CAAC,CAAC;QAEH,OAAO,IAAoB,CAAC;IAC7B,CAAC;CACD","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, Guards } from \"@3sixty/core\";\nimport type { ILoggingComponent } from \"@3sixty/logging-models\";\n\nimport {\n\tOdrlPolicyHelper,\n\ttype IPolicyDecision,\n\ttype IPolicyEnforcementProcessor\n} from \"@3sixty/rights-management-models\";\nimport type { IDataspaceProtocolAgreement } from \"@3sixty/standards-dataspace-protocol\";\nimport type { OdrlActionType } from \"@3sixty/standards-w3c-odrl\";\nimport type { IPassThroughPolicyEnforcementProcessorConstructorOptions } from \"../models/IPassThroughPolicyEnforcementProcessorConstructorOptions.js\";\n\n/**\n * Pass Through Policy Enforcement Processor.\n */\nexport class PassThroughPolicyEnforcementProcessor implements IPolicyEnforcementProcessor {\n\t/**\n\t * The class name of the Pass Through Policy Enforcement Processor.\n\t */\n\tpublic static readonly CLASS_NAME: string = \"PassThroughPolicyEnforcementProcessor\";\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 PassThroughPolicyEnforcementProcessor.\n\t * @param options The options for the pass through policy enforcement processor.\n\t */\n\tconstructor(options?: IPassThroughPolicyEnforcementProcessorConstructorOptions) {\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 PassThroughPolicyEnforcementProcessor.CLASS_NAME;\n\t}\n\n\t/**\n\t * Process the response from the policy decision point.\n\t * @param agreement The agreement to process.\n\t * @param decisions The decisions made by the policy decision point.\n\t * @param data The data to process.\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 data after processing.\n\t */\n\tpublic async process<D = unknown, R = D>(\n\t\tagreement: IDataspaceProtocolAgreement,\n\t\tdecisions: IPolicyDecision[],\n\t\tdata?: D,\n\t\taction?: OdrlActionType | string\n\t): Promise<R> {\n\t\tGuards.object<IDataspaceProtocolAgreement>(\n\t\t\tPassThroughPolicyEnforcementProcessor.CLASS_NAME,\n\t\t\t\"agreement\",\n\t\t\tagreement\n\t\t);\n\n\t\tawait this._logging?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: PassThroughPolicyEnforcementProcessor.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"processingPolicy\",\n\t\t\tdata: {\n\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(agreement) ?? \"\"\n\t\t\t}\n\t\t});\n\n\t\treturn data as unknown as R;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"automationPolicyExecutionAction.js","sourceRoot":"","sources":["../../../src/policyExecutionActions/automationPolicyExecutionAction.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAE5D,OAAO,EAIN,mBAAmB,EACnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAG5D;;GAEG;AACH,MAAM,OAAO,+BAA+B;IAC3C;;OAEG;I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+BAA+B,CAAC,kBAAkB,EACrD;gBACC,MAAM;gBACN,SAAS;gBACT,IAAI;gBACJ,MAAM;aACN,CACD,CAAC;QACH,CAAC;IACF,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IAutomationComponent } from \"@3sixty/automation-models\";\nimport { ComponentFactory, Guards, Is } from \"@3sixty/core\";\nimport { nameof } from \"@3sixty/nameof\";\nimport {\n\ttype IPolicyDecision,\n\ttype IPolicyExecutionAction,\n\ttype IRightsManagementPolicy,\n\tPolicyDecisionStage\n} from \"@3sixty/rights-management-models\";\nimport { OdrlActionType } from \"@3sixty/standards-w3c-odrl\";\nimport type { IAutomationPolicyExecutionActionConstructorOptions } from \"../models/IAutomationPolicyExecutionActionConstructorOptions.js\";\n\n/**\n * Automation Policy Execution Action to execute automation policies.\n */\nexport class AutomationPolicyExecutionAction implements IPolicyExecutionAction {\n\t/**\n\t * The class name of the Automation Policy Execution Action.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<AutomationPolicyExecutionAction>();\n\n\t/**\n\t * The before automation trigger name.\n\t */\n\tpublic static readonly BEFORE_TRIGGER_NAME: string = \"rights-management:pxp:before\";\n\n\t/**\n\t * The after automation trigger name.\n\t */\n\tpublic static readonly AFTER_TRIGGER_NAME: string = \"rights-management:pxp:after\";\n\n\t/**\n\t * The automation component.\n\t * @internal\n\t */\n\tprivate readonly _automation: IAutomationComponent;\n\n\t/**\n\t * The policy decision stages to trigger the automation actions, if undefined defaults to \"inform\".\n\t * @internal\n\t */\n\tprivate readonly _triggerActions: string[];\n\n\t/**\n\t * Create a new instance of AutomationPolicyExecutionAction.\n\t * @param options The options for the automation policy execution action.\n\t */\n\tconstructor(options?: IAutomationPolicyExecutionActionConstructorOptions) {\n\t\tthis._automation = ComponentFactory.get<IAutomationComponent>(\n\t\t\toptions?.automationComponentType ?? \"automation\"\n\t\t);\n\t\tthis._triggerActions = Is.arrayValue(options?.config?.triggerActions)\n\t\t\t? options?.config?.triggerActions\n\t\t\t: [OdrlActionType.Inform];\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 AutomationPolicyExecutionAction.CLASS_NAME;\n\t}\n\n\t/**\n\t * Which stages should the action be executed at.\n\t * @returns List of stages.\n\t */\n\tpublic supportedStages(): PolicyDecisionStage[] {\n\t\treturn [PolicyDecisionStage.Before, PolicyDecisionStage.After];\n\t}\n\n\t/**\n\t * Execute function type for policy actions.\n\t * @param policy The policy that applied to the data.\n\t * @param decisions The decisions made by the PDP.\n\t * @param data The data to process.\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 * @param stage The stage of the policy decision.\n\t * @returns A promise that resolves when the action is complete.\n\t */\n\tpublic async execute<D = unknown>(\n\t\tpolicy: IRightsManagementPolicy,\n\t\tdecisions: IPolicyDecision[],\n\t\tdata: D | undefined,\n\t\taction: OdrlActionType | string | undefined,\n\t\tstage: PolicyDecisionStage\n\t): Promise<void> {\n\t\tGuards.arrayOneOf(\n\t\t\tAutomationPolicyExecutionAction.CLASS_NAME,\n\t\t\tnameof(stage),\n\t\t\tstage,\n\t\t\tObject.values(PolicyDecisionStage)\n\t\t);\n\n\t\tif (Is.stringValue(action) && this._triggerActions.includes(action)) {\n\t\t\tawait this._automation.trigger(\n\t\t\t\tstage === PolicyDecisionStage.Before\n\t\t\t\t\t? AutomationPolicyExecutionAction.BEFORE_TRIGGER_NAME\n\t\t\t\t\t: AutomationPolicyExecutionAction.AFTER_TRIGGER_NAME,\n\t\t\t\t{\n\t\t\t\t\tpolicy,\n\t\t\t\t\tdecisions,\n\t\t\t\t\tdata,\n\t\t\t\t\taction\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"automationPolicyExecutionAction.js","sources":["../../../src/policyExecutionActions/automationPolicyExecutionAction.ts"],"names":[],"mappings":"AAGA,OAAO,EA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AE,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YACrE,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAC7B,KAAK,KAAK,mBAAmB,CAAC,MAAM;gBACnC,CAAC,CAAC,+BAA+B,CAAC,mBAAmB;gBACrD,CAAC,CAAC,+BAA+B,CAAC,kBAAkB,EACrD;gBACC,MAAM;gBACN,SAAS;gBACT,IAAI;gBACJ,MAAM;aACN,CACD,CAAC;QACH,CAAC;IACF,CAAC;CACD","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IAutomationComponent } from \"@3sixty/automation-models\";\nimport { ComponentFactory, Guards, Is } from \"@3sixty/core\";\n\nimport {\n\ttype IPolicyDecision,\n\ttype IPolicyExecutionAction,\n\ttype IRightsManagementPolicy,\n\tPolicyDecisionStage\n} from \"@3sixty/rights-management-models\";\nimport { OdrlActionType } from \"@3sixty/standards-w3c-odrl\";\nimport type { IAutomationPolicyExecutionActionConstructorOptions } from \"../models/IAutomationPolicyExecutionActionConstructorOptions.js\";\n\n/**\n * Automation Policy Execution Action to execute automation policies.\n */\nexport class AutomationPolicyExecutionAction implements IPolicyExecutionAction {\n\t/**\n\t * The class name of the Automation Policy Execution Action.\n\t */\n\tpublic static readonly CLASS_NAME: string = \"AutomationPolicyExecutionAction\";\n\n\t/**\n\t * The before automation trigger name.\n\t */\n\tpublic static readonly BEFORE_TRIGGER_NAME: string = \"rights-management:pxp:before\";\n\n\t/**\n\t * The after automation trigger name.\n\t */\n\tpublic static readonly AFTER_TRIGGER_NAME: string = \"rights-management:pxp:after\";\n\n\t/**\n\t * The automation component.\n\t * @internal\n\t */\n\tprivate readonly _automation: IAutomationComponent;\n\n\t/**\n\t * The policy decision stages to trigger the automation actions, if undefined defaults to \"inform\".\n\t * @internal\n\t */\n\tprivate readonly _triggerActions: string[];\n\n\t/**\n\t * Create a new instance of AutomationPolicyExecutionAction.\n\t * @param options The options for the automation policy execution action.\n\t */\n\tconstructor(options?: IAutomationPolicyExecutionActionConstructorOptions) {\n\t\tthis._automation = ComponentFactory.get<IAutomationComponent>(\n\t\t\toptions?.automationComponentType ?? \"automation\"\n\t\t);\n\t\tthis._triggerActions = Is.arrayValue(options?.config?.triggerActions)\n\t\t\t? options?.config?.triggerActions\n\t\t\t: [OdrlActionType.Inform];\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 AutomationPolicyExecutionAction.CLASS_NAME;\n\t}\n\n\t/**\n\t * Which stages should the action be executed at.\n\t * @returns List of stages.\n\t */\n\tpublic supportedStages(): PolicyDecisionStage[] {\n\t\treturn [PolicyDecisionStage.Before, PolicyDecisionStage.After];\n\t}\n\n\t/**\n\t * Execute function type for policy actions.\n\t * @param policy The policy that applied to the data.\n\t * @param decisions The decisions made by the PDP.\n\t * @param data The data to process.\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 * @param stage The stage of the policy decision.\n\t * @returns A promise that resolves when the action is complete.\n\t */\n\tpublic async execute<D = unknown>(\n\t\tpolicy: IRightsManagementPolicy,\n\t\tdecisions: IPolicyDecision[],\n\t\tdata: D | undefined,\n\t\taction: OdrlActionType | string | undefined,\n\t\tstage: PolicyDecisionStage\n\t): Promise<void> {\n\t\tGuards.arrayOneOf(\n\t\t\tAutomationPolicyExecutionAction.CLASS_NAME,\n\t\t\t\"stage\",\n\t\t\tstage,\n\t\t\tObject.values(PolicyDecisionStage)\n\t\t);\n\n\t\tif (Is.stringValue(action) && this._triggerActions.includes(action)) {\n\t\t\tawait this._automation.trigger(\n\t\t\t\tstage === PolicyDecisionStage.Before\n\t\t\t\t\t? AutomationPolicyExecutionAction.BEFORE_TRIGGER_NAME\n\t\t\t\t\t: AutomationPolicyExecutionAction.AFTER_TRIGGER_NAME,\n\t\t\t\t{\n\t\t\t\t\tpolicy,\n\t\t\t\t\tdecisions,\n\t\t\t\t\tdata,\n\t\t\t\t\taction\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"loggingPolicyExecutionAction.js","sourceRoot":"","sources":["../../../src/policyExecutionActions/loggingPolicyExecutionAction.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAG5D,OAAO,EAIN,gBAAgB,EAChB,mBAAmB,EACnB,MAAM,kCAAkC,CAAC;AAI1C;;GAEG;AACH,MAAM,OAAO,4BAA4B;IACxC;;OAEG;IACI,MAAM,CAAU,UAAU,kCAAkD;IAEnF;;;OAGG;IACc,QAAQ,CAAqB;IAE9C;;;OAGG;IACc,OAAO,CAAwB;IAEhD;;;OAGG;IACc,YAAY,CAAU;IAEvC;;;OAGG;IACc,cAAc,CAAU;IAEzC;;;OAGG;IACc,iBAAiB,CAAU;IAE5C;;;OAGG;IACH,YAAY,OAAyD;QACpE,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,WAAW,CAAoB,OAAO,EAAE,oBAAoB,CAAC,CAAC;QAE/F,IAAI,CAAC,OAAO,GAAG,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI;YACzC,mBAAmB,CAAC,MAAM;YAC1B,mBAAmB,CAAC,KAAK;SACzB,CAAC;QACF,IAAI,CAAC,YAAY,GAAG,OAAO,EAAE,MAAM,EAAE,WAAW,IAAI,KAAK,CAAC;QAC1D,IAAI,CAAC,cAAc,GAAG,OAAO,EAAE,MAAM,EAAE,aAAa,IAAI,KAAK,CAAC;QAC9D,IAAI,CAAC,iBAAiB,GAAG,OAAO,EAAE,MAAM,EAAE,gBAAgB,IAAI,KAAK,CAAC;IACrE,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,4BAA4B,CAAC,UAAU,CAAC;IA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,KAAK;qBACL;iBACD,CAAC,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACP,MAAM,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;oBACxB,KAAK,EAAE,MAAM;oBACb,MAAM,EAAE,4BAA4B,CAAC,UAAU;oBAC/C,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;oBACd,OAAO,EAAE,2BAA2B;oBACpC,IAAI,EAAE;wBACL,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;wBAC/C,IAAI,EAAE,OAAO;wBACb,MAAM,EAAE,SAAS;wBACjB,SAAS,EAAE,YAAY;wBACvB,MAAM;wBACN,KAAK;qBACL;iBACD,CAAC,CAAC;YACJ,CAAC;QACF,CAAC;IACF,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, Guards, Is } from \"@3sixty/core\";\nimport type { ILoggingComponent } from \"@3sixty/logging-models\";\nimport { nameof } from \"@3sixty/nameof\";\nimport {\n\ttype IPolicyDecision,\n\ttype IPolicyExecutionAction,\n\ttype IRightsManagementPolicy,\n\tOdrlPolicyHelper,\n\tPolicyDecisionStage\n} from \"@3sixty/rights-management-models\";\nimport type { OdrlActionType } from \"@3sixty/standards-w3c-odrl\";\nimport type { ILoggingPolicyExecutionActionConstructorOptions } from \"../models/ILoggingPolicyExecutionActionConstructorOptions.js\";\n\n/**\n * Logging Policy Execution Action to send decisions to logging.\n */\nexport class LoggingPolicyExecutionAction implements IPolicyExecutionAction {\n\t/**\n\t * The class name of the Logging Policy Execution Action.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<LoggingPolicyExecutionAction>();\n\n\t/**\n\t * The logging component.\n\t * @internal\n\t */\n\tprivate readonly _logging?: ILoggingComponent;\n\n\t/**\n\t * The policy decision stages to log, if undefined defaults to all.\n\t * @internal\n\t */\n\tprivate readonly _stages: PolicyDecisionStage[];\n\n\t/**\n\t * Whether to include the data in the log.\n\t * @internal\n\t */\n\tprivate readonly _includeData: boolean;\n\n\t/**\n\t * Whether to include the policy in the log.\n\t * @internal\n\t */\n\tprivate readonly _includePolicy: boolean;\n\n\t/**\n\t * Whether to include the decisions in the log.\n\t * @internal\n\t */\n\tprivate readonly _includeDecisions: boolean;\n\n\t/**\n\t * Create a new instance of LoggingPolicyExecutionAction.\n\t * @param options The options for the logging policy execution action.\n\t */\n\tconstructor(options?: ILoggingPolicyExecutionActionConstructorOptions) {\n\t\tthis._logging = ComponentFactory.getIfExists<ILoggingComponent>(options?.loggingComponentType);\n\n\t\tthis._stages = options?.config?.stages ?? [\n\t\t\tPolicyDecisionStage.Before,\n\t\t\tPolicyDecisionStage.After\n\t\t];\n\t\tthis._includeData = options?.config?.includeData ?? false;\n\t\tthis._includePolicy = options?.config?.includePolicy ?? false;\n\t\tthis._includeDecisions = options?.config?.includeDecisions ?? false;\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 LoggingPolicyExecutionAction.CLASS_NAME;\n\t}\n\n\t/**\n\t * Which stages should the action be executed at.\n\t * @returns List of stages.\n\t */\n\tpublic supportedStages(): PolicyDecisionStage[] {\n\t\treturn this._stages;\n\t}\n\n\t/**\n\t * Execute function type for policy actions.\n\t * @param policy The policy that applied to the data.\n\t * @param decisions The decisions made by the PDP.\n\t * @param data The data to process.\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 * @param stage The stage of the policy decision.\n\t * @returns A promise that resolves when the action is complete.\n\t */\n\tpublic async execute<D = unknown>(\n\t\tpolicy: IRightsManagementPolicy,\n\t\tdecisions: IPolicyDecision[],\n\t\tdata: D | undefined,\n\t\taction: OdrlActionType | string | undefined,\n\t\tstage: PolicyDecisionStage\n\t): Promise<void> {\n\t\tGuards.arrayOneOf(\n\t\t\tLoggingPolicyExecutionAction.CLASS_NAME,\n\t\t\tnameof(stage),\n\t\t\tstage,\n\t\t\tObject.values(PolicyDecisionStage)\n\t\t);\n\n\t\tif (this._stages.includes(stage)) {\n\t\t\t// Even if we don't have the options to include data or include policy we\n\t\t\t// still create dummy entries, as the logging string still has them embedded\n\t\t\tlet logData;\n\t\t\tif (!Is.empty(data)) {\n\t\t\t\tlogData = this._includeData ? data : \"{...}\";\n\t\t\t}\n\t\t\tconst logPolicy = this._includePolicy ? policy : \"{}\";\n\t\t\tconst logDecisions = this._includeDecisions ? decisions : \"[...]\";\n\n\t\t\tif (stage === PolicyDecisionStage.Before) {\n\t\t\t\tawait this._logging?.log({\n\t\t\t\t\tlevel: \"info\",\n\t\t\t\t\tsource: LoggingPolicyExecutionAction.CLASS_NAME,\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tmessage: \"policyActionExecutedBefore\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(policy) ?? \"\",\n\t\t\t\t\t\tdata: logData,\n\t\t\t\t\t\tpolicy: logPolicy,\n\t\t\t\t\t\tdecisions: logDecisions,\n\t\t\t\t\t\taction,\n\t\t\t\t\t\tstage\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tawait this._logging?.log({\n\t\t\t\t\tlevel: \"info\",\n\t\t\t\t\tsource: LoggingPolicyExecutionAction.CLASS_NAME,\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tmessage: \"policyActionExecutedAfter\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(policy) ?? \"\",\n\t\t\t\t\t\tdata: logData,\n\t\t\t\t\t\tpolicy: logPolicy,\n\t\t\t\t\t\tdecisions: logDecisions,\n\t\t\t\t\t\taction,\n\t\t\t\t\t\tstage\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"loggingPolicyExecutionAction.js","sources":["../../../src/policyExecutionActions/loggingPolicyExecution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,IAAI,CAAC,GAAG,EAAE;oBACd,OAAO,EAAE,2BAA2B;oBACpC,IAAI,EAAE;wBACL,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;wBAC/C,IAAI,EAAE,OAAO;wBACb,MAAM,EAAE,SAAS;wBACjB,SAAS,EAAE,YAAY;wBACvB,MAAM;wBACN,KAAK;qBACL;iBACD,CAAC,CAAC;YACJ,CAAC;QACF,CAAC;IACF,CAAC;CACD","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, Guards, Is } from \"@3sixty/core\";\nimport type { ILoggingComponent } from \"@3sixty/logging-models\";\n\nimport {\n\ttype IPolicyDecision,\n\ttype IPolicyExecutionAction,\n\ttype IRightsManagementPolicy,\n\tOdrlPolicyHelper,\n\tPolicyDecisionStage\n} from \"@3sixty/rights-management-models\";\nimport type { OdrlActionType } from \"@3sixty/standards-w3c-odrl\";\nimport type { ILoggingPolicyExecutionActionConstructorOptions } from \"../models/ILoggingPolicyExecutionActionConstructorOptions.js\";\n\n/**\n * Logging Policy Execution Action to send decisions to logging.\n */\nexport class LoggingPolicyExecutionAction implements IPolicyExecutionAction {\n\t/**\n\t * The class name of the Logging Policy Execution Action.\n\t */\n\tpublic static readonly CLASS_NAME: string = \"LoggingPolicyExecutionAction\";\n\n\t/**\n\t * The logging component.\n\t * @internal\n\t */\n\tprivate readonly _logging?: ILoggingComponent;\n\n\t/**\n\t * The policy decision stages to log, if undefined defaults to all.\n\t * @internal\n\t */\n\tprivate readonly _stages: PolicyDecisionStage[];\n\n\t/**\n\t * Whether to include the data in the log.\n\t * @internal\n\t */\n\tprivate readonly _includeData: boolean;\n\n\t/**\n\t * Whether to include the policy in the log.\n\t * @internal\n\t */\n\tprivate readonly _includePolicy: boolean;\n\n\t/**\n\t * Whether to include the decisions in the log.\n\t * @internal\n\t */\n\tprivate readonly _includeDecisions: boolean;\n\n\t/**\n\t * Create a new instance of LoggingPolicyExecutionAction.\n\t * @param options The options for the logging policy execution action.\n\t */\n\tconstructor(options?: ILoggingPolicyExecutionActionConstructorOptions) {\n\t\tthis._logging = ComponentFactory.getIfExists<ILoggingComponent>(options?.loggingComponentType);\n\n\t\tthis._stages = options?.config?.stages ?? [\n\t\t\tPolicyDecisionStage.Before,\n\t\t\tPolicyDecisionStage.After\n\t\t];\n\t\tthis._includeData = options?.config?.includeData ?? false;\n\t\tthis._includePolicy = options?.config?.includePolicy ?? false;\n\t\tthis._includeDecisions = options?.config?.includeDecisions ?? false;\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 LoggingPolicyExecutionAction.CLASS_NAME;\n\t}\n\n\t/**\n\t * Which stages should the action be executed at.\n\t * @returns List of stages.\n\t */\n\tpublic supportedStages(): PolicyDecisionStage[] {\n\t\treturn this._stages;\n\t}\n\n\t/**\n\t * Execute function type for policy actions.\n\t * @param policy The policy that applied to the data.\n\t * @param decisions The decisions made by the PDP.\n\t * @param data The data to process.\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 * @param stage The stage of the policy decision.\n\t * @returns A promise that resolves when the action is complete.\n\t */\n\tpublic async execute<D = unknown>(\n\t\tpolicy: IRightsManagementPolicy,\n\t\tdecisions: IPolicyDecision[],\n\t\tdata: D | undefined,\n\t\taction: OdrlActionType | string | undefined,\n\t\tstage: PolicyDecisionStage\n\t): Promise<void> {\n\t\tGuards.arrayOneOf(\n\t\t\tLoggingPolicyExecutionAction.CLASS_NAME,\n\t\t\t\"stage\",\n\t\t\tstage,\n\t\t\tObject.values(PolicyDecisionStage)\n\t\t);\n\n\t\tif (this._stages.includes(stage)) {\n\t\t\t// Even if we don't have the options to include data or include policy we\n\t\t\t// still create dummy entries, as the logging string still has them embedded\n\t\t\tlet logData;\n\t\t\tif (!Is.empty(data)) {\n\t\t\t\tlogData = this._includeData ? data : \"{...}\";\n\t\t\t}\n\t\t\tconst logPolicy = this._includePolicy ? policy : \"{}\";\n\t\t\tconst logDecisions = this._includeDecisions ? decisions : \"[...]\";\n\n\t\t\tif (stage === PolicyDecisionStage.Before) {\n\t\t\t\tawait this._logging?.log({\n\t\t\t\t\tlevel: \"info\",\n\t\t\t\t\tsource: LoggingPolicyExecutionAction.CLASS_NAME,\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tmessage: \"policyActionExecutedBefore\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(policy) ?? \"\",\n\t\t\t\t\t\tdata: logData,\n\t\t\t\t\t\tpolicy: logPolicy,\n\t\t\t\t\t\tdecisions: logDecisions,\n\t\t\t\t\t\taction,\n\t\t\t\t\t\tstage\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tawait this._logging?.log({\n\t\t\t\t\tlevel: \"info\",\n\t\t\t\t\tsource: LoggingPolicyExecutionAction.CLASS_NAME,\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tmessage: \"policyActionExecutedAfter\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(policy) ?? \"\",\n\t\t\t\t\t\tdata: logData,\n\t\t\t\t\t\tpolicy: logPolicy,\n\t\t\t\t\t\tdecisions: logDecisions,\n\t\t\t\t\t\taction,\n\t\t\t\t\t\tstage\n\t\t\t\t\t}\n\t\t\t\t});\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,gBAAgB,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAIpD,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C;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 \"@3sixty/core\";\nimport { JsonLdHelper } from \"@3sixty/data-json-ld\";\nimport type { IIdentityResolverComponent } from \"@3sixty/identity-models\";\nimport type { ILoggingComponent } from \"@3sixty/logging-models\";\nimport { nameof } from \"@3sixty/nameof\";\nimport {\n\ttype IPolicyInformationSource,\n\ttype IRightsManagementInformation,\n\ttype IRightsManagementPolicy,\n\tOdrlPolicyHelper,\n\tPolicyInformationAccessMode\n} from \"@3sixty/rights-management-models\";\nimport type { OdrlActionType } from \"@3sixty/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"]}
1
+ {"version":3,"file":"identityPolicyInformationSource.js","s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ACD","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseError, ComponentFactory, Guards, Is } from \"@3sixty/core\";\nimport { JsonLdHelper } from \"@3sixty/data-json-ld\";\nimport type { IIdentityResolverComponent } from \"@3sixty/identity-models\";\nimport type { ILoggingComponent } from \"@3sixty/logging-models\";\n\nimport {\n\ttype IPolicyInformationSource,\n\ttype IRightsManagementInformation,\n\ttype IRightsManagementPolicy,\n\tOdrlPolicyHelper,\n\tPolicyInformationAccessMode\n} from \"@3sixty/rights-management-models\";\nimport type { OdrlActionType } from \"@3sixty/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 = \"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\t\"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"]}
@@ -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,cAAc,CAAC;AACtF,OAAO,EAA0B,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAI5E,OAAO,EACN,gBAAgB,EAChB,2BAA2B,EAI3B,MAAM,kCAAkC,CAAC;AAI1C;;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;IACI,SAAS;QACf,OAAO,sCAAsC,CAAC,UAAU,CAAC;IAC1D,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,QAAQ,CACpB,MAA2C,EAC3C,UAAuC,EACvC,IAAQ,EACR,MAAgC;QAEhC,MAAM,CAAC,UAAU,CAChB,sCAAsC,CAAC,UAAU,gBAEjD,UAAU,EACV,MAAM,CAAC,MAAM,CAAC,2BAA2B,CA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FoundError } from \"@3sixty/core\";\nimport { type IJsonLdNodeObject, JsonLdHelper } from \"@3sixty/data-json-ld\";\nimport type { IIdentityProfileComponent } from \"@3sixty/identity-models\";\nimport type { ILoggingComponent } from \"@3sixty/logging-models\";\nimport { nameof } from \"@3sixty/nameof\";\nimport {\n\tOdrlPolicyHelper,\n\tPolicyInformationAccessMode,\n\ttype IPolicyInformationSource,\n\ttype IRightsManagementInformation,\n\ttype IRightsManagementPolicy\n} from \"@3sixty/rights-management-models\";\nimport type { OdrlActionType } from \"@3sixty/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
+ {"version":3,"file":"identityProfilePolicyInformationSource.js","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,cAAc,CAAC;AACtF,OAAO,EAA0B,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAI5E,OAAO,EACN,gBAAgB,EAChB,2BAA2B,EAI3B,MAAM,kCAAkC,CAAC;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GAAG,OAAO,CAAC;gBAC/B,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;CACD","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseError, ComponentFactory, Guards, Is, NotFoundError } from \"@3sixty/core\";\nimport { type IJsonLdNodeObject, JsonLdHelper } from \"@3sixty/data-json-ld\";\nimport type { IIdentityProfileComponent } from \"@3sixty/identity-models\";\nimport type { ILoggingComponent } from \"@3sixty/logging-models\";\n\nimport {\n\tOdrlPolicyHelper,\n\tPolicyInformationAccessMode,\n\ttype IPolicyInformationSource,\n\ttype IRightsManagementInformation,\n\ttype IRightsManagementPolicy\n} from \"@3sixty/rights-management-models\";\nimport type { OdrlActionType } from \"@3sixty/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 = \"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\t\"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/staticPolicyInformationSource.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAG5D,OAAO,EACN,gBAAgB,EAChB,2BAA2B,EAI3B,MAAM,kCAAkC,CAAC;AAK1C;;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;;;OAGG;IACI,SAAS;QACf,OAAO,6BAA6B,CAAC,UAAU,CAAC;IACjD,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,QAAQ,CACpB,MAA2C,EAC3C,UAAuC,EACvC,IAAQ,EACR,MAAgC;QAEhC,MAAM,CAAC,UAAU,CAChB,6BAA6B,CAAC,UAAU,gBAExC,UAAU,EACV,MAAM,CAA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AM,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 \"@3sixty/core\";\nimport type { ILoggingComponent } from \"@3sixty/logging-models\";\nimport { nameof } from \"@3sixty/nameof\";\nimport {\n\tOdrlPolicyHelper,\n\tPolicyInformationAccessMode,\n\ttype IPolicyInformationSource,\n\ttype IRightsManagementInformation,\n\ttype IRightsManagementPolicy\n} from \"@3sixty/rights-management-models\";\nimport type { OdrlActionType } from \"@3sixty/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
+ {"version":3,"file":"staticPolicyInformationSource.js","sources":["../../../src/policyInformationSources/staticPolicyInformationSource.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAG5D,OAAO,EACN,gBAAgB,EAChB,2BAA2B,EAI3B,MAAM,kCAAkC,CAAC;AAK1C;;GAEG;AACH,MAAM,OAAO,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.\nimport { ComponentFactory, Guards, Is } from \"@3sixty/core\";\nimport type { ILoggingComponent } from \"@3sixty/logging-models\";\n\nimport {\n\tOdrlPolicyHelper,\n\tPolicyInformationAccessMode,\n\ttype IPolicyInformationSource,\n\ttype IRightsManagementInformation,\n\ttype IRightsManagementPolicy\n} from \"@3sixty/rights-management-models\";\nimport type { OdrlActionType } from \"@3sixty/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 = \"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\t\"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\t\"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\t\"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.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,cAAc,CAAC;AAG3E,OAAO,EACN,gBAAgB,EAChB,0BAA0B,EAG1B,MAAM,kCAAkC,CAAC;AAM1C,OAAO,EAAE,cAAc,EAAmB,MAAM,4BAA4B,CAAC;AAG7E;;GAEG;AACH,MAAM,OAAO,2BAA2B;IACvC;;OAEG;IACI,MAAM,CAAU,UAAU,iCAAiD;IAElF;;;OAGG;IACc,QAAQ,CAAqB;IAE9C;;;OAGG;IACc,gBAAgB,CAAU;IAE3C;;;OAGG;IACH,YAAY,OAAwD;QACnE,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,WAAW,CAAoB,OAAO,EAAE,oBAAoB,CAAC,CAAC;QAC/F,IAAI,CAAC,gBAAgB,GAAG,OAAO,EAAE,MAAM,EAAE,eAAe,IAAI,KAAK,CAAC;IACnE,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,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AAQ,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 \"@3sixty/core\";\nimport type { ILoggingComponent } from \"@3sixty/logging-models\";\nimport { nameof } from \"@3sixty/nameof\";\nimport {\n\tOdrlPolicyHelper,\n\tRightsManagementNamespaces,\n\ttype IPolicyNegotiator,\n\ttype IRightsManagementInformation\n} from \"@3sixty/rights-management-models\";\nimport type {\n\tIDataspaceProtocolAgreement,\n\tIDataspaceProtocolOffer,\n\tIDataspaceProtocolPolicy\n} from \"@3sixty/standards-dataspace-protocol\";\nimport { OdrlPolicyType, type IOdrlParty } from \"@3sixty/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 * Whether handleOffer() signals directAgreement.\n\t * @internal\n\t */\n\tprivate readonly _directAgreement: boolean;\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\tthis._directAgreement = options?.config?.directAgreement ?? false;\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, the interventionRequired flag if manual agreement is needed, and directAgreement per the constructor's directAgreement option (default true).\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\tdirectAgreement?: 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\tdirectAgreement: this._directAgreement\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
+ {"version":3,"file":"passThroughPolicyNegotiator.js","sources":["../../../src/policyNegotiators/passThroughPolicyNegotiator.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAG3E,OAAO,EACN,gBAAgB,EAChB,0BAA0B,EAG1B,MAAM,kCAAkC,CAAC;AAM1C,OAAO,EAAE,cAAc,EAAmB,MAAM,4BAA4B,CAAC;AAG7E;;GAEG;AACH,MAAM,OAAO,2BAA2B;IACvC;;OAEG;IACI,MAAM,CAAU,UAAU,GAAW,6BAA6B,CAAC;IAE1E;;;OAGG;IACc,QAAQ,CAAqB;IAE9C;;;OAGG;IACc,gBAAgB,CAAU;IAE3C;;;OAGG;IACH,YAAY,OAAwD;QACnE,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,WAAW,CAAoB,OAAO,EAAE,oBAAoB,CAAC,CAAC;QAC/F,IAAI,CAAC,gBAAgB,GAAG,OAAO,EAAE,MAAM,EAAE,eAAe,IAAI,KAAK,CAAC;IACnE,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,2BAA2B,CAAC,UAAU,CAAC;IAC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C;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;CACD","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, Guards, ObjectHelper, Urn } from \"@3sixty/core\";\nimport type { ILoggingComponent } from \"@3sixty/logging-models\";\n\nimport {\n\tOdrlPolicyHelper,\n\tRightsManagementNamespaces,\n\ttype IPolicyNegotiator,\n\ttype IRightsManagementInformation\n} from \"@3sixty/rights-management-models\";\nimport type {\n\tIDataspaceProtocolAgreement,\n\tIDataspaceProtocolOffer,\n\tIDataspaceProtocolPolicy\n} from \"@3sixty/standards-dataspace-protocol\";\nimport { OdrlPolicyType, type IOdrlParty } from \"@3sixty/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 = \"PassThroughPolicyNegotiator\";\n\n\t/**\n\t * The logging component.\n\t * @internal\n\t */\n\tprivate readonly _logging?: ILoggingComponent;\n\n\t/**\n\t * Whether handleOffer() signals directAgreement.\n\t * @internal\n\t */\n\tprivate readonly _directAgreement: boolean;\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\tthis._directAgreement = options?.config?.directAgreement ?? false;\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, the interventionRequired flag if manual agreement is needed, and directAgreement per the constructor's directAgreement option (default true).\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\tdirectAgreement?: boolean;\n\t}> {\n\t\tGuards.object<IDataspaceProtocolOffer>(\n\t\t\tPassThroughPolicyNegotiator.CLASS_NAME,\n\t\t\t\"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\tdirectAgreement: this._directAgreement\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\t\"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,cAAc,CAAC;AAGxD,OAAO,EACN,gBAAgB,EAIhB,MAAM,kCAAkC,CAAC;AAI1C;;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 \"@3sixty/core\";\nimport type { ILoggingComponent } from \"@3sixty/logging-models\";\nimport { nameof } from \"@3sixty/nameof\";\nimport {\n\tOdrlPolicyHelper,\n\ttype IPolicyObligationEnforcer,\n\ttype IRightsManagementInformation,\n\ttype IRightsManagementPolicy\n} from \"@3sixty/rights-management-models\";\nimport type { OdrlActionType, IOdrlDuty } from \"@3sixty/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
+ {"version":3,"file":"passThroughPolicyObligationEnforcer.js","sources":["../../../src/policyObligationEnforcers/passThroughPolicyObligationEnforcer.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGxD,OAAO,EACN,gBAAgB,EAIhB,MAAM,kCAAkC,CAAC;AAI1C;;GAEG;AACH,MAAM,OAAO,mCAAmC;IAC/C;;OAEG;IACI,MAAM,CAAU,UAAU,GAAW,qCAAqC,CAAC;IAElF;;;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,EAC9C,QAAQ,EACR,MAAM,CACN,CAAC;QACF,MAAM,CAAC,MAAM,CAAY,mCAAmC,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAEvF,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;CACD","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, Guards } from \"@3sixty/core\";\nimport type { ILoggingComponent } from \"@3sixty/logging-models\";\n\nimport {\n\tOdrlPolicyHelper,\n\ttype IPolicyObligationEnforcer,\n\ttype IRightsManagementInformation,\n\ttype IRightsManagementPolicy\n} from \"@3sixty/rights-management-models\";\nimport type { OdrlActionType, IOdrlDuty } from \"@3sixty/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 = \"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\t\"policy\",\n\t\t\tpolicy\n\t\t);\n\t\tGuards.object<IOdrlDuty>(PassThroughPolicyObligationEnforcer.CLASS_NAME, \"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 +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,cAAc,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAyB,MAAM,kCAAkC,CAAC;AAO3F;;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,CAAC,aAAqB,EAAE,KAA8B;QACvE,MAAM,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;YACxB,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,0BAA0B,CAAC,UAAU;YAC7C,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;YACd,OAAO,EAAE,OAAO;YAChB,IAAI,EAAE;gBACL,aAAa;gBACb,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE;aAC7C;SACD,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,SAAS,CACrB,aAAqB,EACrB,SAAsC;QAEtC,MAAM,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;YACxB,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,0BAA0B,CAAC,UAAU;YAC7C,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;YACd,OAAO,EAAE,WAAW;YACpB,IAAI,EAAE;gBACL,aAAa;gBACb,WAAW,EAAE,gBAAgB,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE;aACrD;SACD,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,SAAS,CAAC,aAAqB;QAC3C,MAAM,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;YACxB,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,0BAA0B,CAAC,UAAU;YAC7C,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;YACd,OAAO,EAAE,WAAW;YACpB,IAAI,EAAE;gBACL,aAAa;aACb;SACD,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,UAAU,CAAC,aAAqB;QAC5C,MAAM,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;YACxB,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 \"@3sixty/core\";\nimport type { ILoggingComponent } from \"@3sixty/logging-models\";\nimport { nameof } from \"@3sixty/nameof\";\nimport { OdrlPolicyHelper, type IPolicyRequester } from \"@3sixty/rights-management-models\";\nimport type {\n\tIDataspaceProtocolAgreement,\n\tIDataspaceProtocolOffer\n} from \"@3sixty/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"]}
1
+ {"version":3,"file":"passThroughPolicyRequester.js","sources":["../../../src/policyRequesters/passThroughPolicyRequester.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAyB,MAAM,kCAAkC,CAAC;AAO3F;;GAEG;AACH,MAAM,OAAO,0BAA0B;IACtC;;OAEG;IACI,MAAM,CAAU,UA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YAC7C,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;YACd,OAAO,EAAE,WAAW;YACpB,IAAI,EAAE;gBACL,aAAa;aACb;SACD,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,UAAU,CAAC,aAAqB;QAC5C,MAAM,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;YACxB,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;CACD","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory } from \"@3sixty/core\";\nimport type { ILoggingComponent } from \"@3sixty/logging-models\";\n\nimport { OdrlPolicyHelper, type IPolicyRequester } from \"@3sixty/rights-management-models\";\nimport type {\n\tIDataspaceProtocolAgreement,\n\tIDataspaceProtocolOffer\n} from \"@3sixty/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 = \"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"]}
package/docs/changelog.md CHANGED
@@ -0,0 +1,24 @@
1
+ # Changelog
2
+
3
+ ## [0.20.0-next.1](https://github.com/3sixtyglobal/rights-management/compare/rights-management-plugins-v0.20.0-next.0...rights-management-plugins-v0.20.0-next.1) (2026-10-23)
4
+
5
+
6
+ ### Features
7
+
8
+ * publish packages under the [@3sixty](https://github.com/3sixty) namespace ([05c4884](https://github.com/3sixtyglobal/rights-management/commit/05c4884e770c2f740cacff2681b5633415e63271))
9
+ * updated ts compile ([2ad622d](https://github.com/3sixtyglobal/rights-management/commit/2ad622dd285cfd901fef97d9905b1ed9939008bc))
10
+
11
+
12
+ ### Dependencies
13
+
14
+ * The following workspace dependencies were updated
15
+ * dependencies
16
+ * @3sixty/rights-management-models bumped from 0.20.0-next.0 to 0.20.0-next.1
17
+ * devDependencies
18
+ * @3sixty/rights-management-pap-service bumped from 0.20.0-next.0 to 0.20.0-next.1
19
+ * @3sixty/rights-management-pdp-service bumped from 0.20.0-next.0 to 0.20.0-next.1
20
+ * @3sixty/rights-management-pep-service bumped from 0.20.0-next.0 to 0.20.0-next.1
21
+ * @3sixty/rights-management-pip-service bumped from 0.20.0-next.0 to 0.20.0-next.1
22
+ * @3sixty/rights-management-pmp-service bumped from 0.20.0-next.0 to 0.20.0-next.1
23
+ * @3sixty/rights-management-pnp-service bumped from 0.20.0-next.0 to 0.20.0-next.1
24
+ * @3sixty/rights-management-pxp-service bumped from 0.20.0-next.0 to 0.20.0-next.1
@@ -96,7 +96,7 @@ Execute function type for policy actions.
96
96
 
97
97
  #### Type Parameters
98
98
 
99
- ##### D
99
+ ##### D {#d}
100
100
 
101
101
  `D` = `unknown`
102
102
 
@@ -72,7 +72,7 @@ Makes decisions regarding policy access to data.
72
72
 
73
73
  #### Type Parameters
74
74
 
75
- ##### D
75
+ ##### D {#d}
76
76
 
77
77
  `D` = `unknown`
78
78
 
@@ -70,11 +70,11 @@ Process the response from the policy decision point.
70
70
 
71
71
  #### Type Parameters
72
72
 
73
- ##### D
73
+ ##### D {#d}
74
74
 
75
75
  `D` = `unknown`
76
76
 
77
- ##### R
77
+ ##### R {#r}
78
78
 
79
79
  `R` = `D`
80
80
 
@@ -62,7 +62,7 @@ Retrieve information from the sources.
62
62
 
63
63
  #### Type Parameters
64
64
 
65
- ##### D
65
+ ##### D {#d}
66
66
 
67
67
  `D` = `unknown`
68
68
 
@@ -62,7 +62,7 @@ Retrieve information from the sources.
62
62
 
63
63
  #### Type Parameters
64
64
 
65
- ##### D
65
+ ##### D {#d}
66
66
 
67
67
  `D` = `unknown`
68
68
 
@@ -80,7 +80,7 @@ Execute function type for policy actions.
80
80
 
81
81
  #### Type Parameters
82
82
 
83
- ##### D
83
+ ##### D {#d}
84
84
 
85
85
  `D` = `unknown`
86
86
 
@@ -62,7 +62,7 @@ Makes decisions regarding policy access to data.
62
62
 
63
63
  #### Type Parameters
64
64
 
65
- ##### D
65
+ ##### D {#d}
66
66
 
67
67
  `D` = `unknown`
68
68
 
@@ -62,11 +62,11 @@ Process the response from the policy decision point.
62
62
 
63
63
  #### Type Parameters
64
64
 
65
- ##### D
65
+ ##### D {#d}
66
66
 
67
67
  `D` = `unknown`
68
68
 
69
- ##### R
69
+ ##### R {#r}
70
70
 
71
71
  `R` = `D`
72
72
 
@@ -62,7 +62,7 @@ Enforces obligations regarding policy access to data.
62
62
 
63
63
  #### Type Parameters
64
64
 
65
- ##### D
65
+ ##### D {#d}
66
66
 
67
67
  `D` = `unknown`
68
68
 
@@ -62,7 +62,7 @@ Retrieve information from the sources.
62
62
 
63
63
  #### Type Parameters
64
64
 
65
- ##### D
65
+ ##### D {#d}
66
66
 
67
67
  `D` = `unknown`
68
68
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@3sixty/rights-management-plugins",
3
- "version": "0.20.0-next.0",
3
+ "version": "0.20.0-next.1",
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
  "@3sixty/identity-models": "next",
27
27
  "@3sixty/logging-models": "next",
28
28
  "@3sixty/nameof": "next",
29
- "@3sixty/rights-management-models": "0.20.0-next.0",
29
+ "@3sixty/rights-management-models": "0.20.0-next.1",
30
30
  "@3sixty/standards-dataspace-protocol": "next",
31
31
  "@3sixty/standards-w3c-odrl": "next"
32
32
  },