@twin.org/rights-management-plugins 0.0.3-next.50 → 0.0.3-next.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/es/index.js CHANGED
@@ -6,6 +6,7 @@ export * from "./models/IDefaultPolicyArbiterConfig.js";
6
6
  export * from "./models/IDefaultPolicyArbiterConstructorOptions.js";
7
7
  export * from "./models/IDefaultPolicyEnforcementProcessorConstructorOptions.js";
8
8
  export * from "./models/IIdentityPolicyInformationSourceConstructorOptions.js";
9
+ export * from "./models/IIdentityProfilePolicyInformationSourceConstructorOptions.js";
9
10
  export * from "./models/ILoggingPolicyExecutionActionConfig.js";
10
11
  export * from "./models/ILoggingPolicyExecutionActionConstructorOptions.js";
11
12
  export * from "./models/IPassThroughPolicyArbiterConstructorOptions.js";
@@ -23,6 +24,7 @@ export * from "./policyEnforcementProcessor/passThroughPolicyEnforcementProcesso
23
24
  export * from "./policyExecutionActions/automationPolicyExecutionAction.js";
24
25
  export * from "./policyExecutionActions/loggingPolicyExecutionAction.js";
25
26
  export * from "./policyInformationSources/identityPolicyInformationSource.js";
27
+ export * from "./policyInformationSources/identityProfilePolicyInformationSource.js";
26
28
  export * from "./policyInformationSources/staticPolicyInformationSource.js";
27
29
  export * from "./policyNegotiators/passThroughPolicyNegotiator.js";
28
30
  export * from "./policyObligationEnforcers/passThroughPolicyObligationEnforcer.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,oDAAoD,CAAC;AACnE,cAAc,gEAAgE,CAAC;AAC/E,cAAc,yCAAyC,CAAC;AACxD,cAAc,qDAAqD,CAAC;AACpE,cAAc,kEAAkE,CAAC;AACjF,cAAc,gEAAgE,CAAC;AAC/E,cAAc,iDAAiD,CAAC;AAChE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,yDAAyD,CAAC;AACxE,cAAc,sEAAsE,CAAC;AACrF,cAAc,4DAA4D,CAAC;AAC3E,cAAc,oEAAoE,CAAC;AACnF,cAAc,2DAA2D,CAAC;AAC1E,cAAc,4CAA4C,CAAC;AAC3D,cAAc,kDAAkD,CAAC;AACjE,cAAc,8DAA8D,CAAC;AAC7E,cAAc,0CAA0C,CAAC;AACzD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,mEAAmE,CAAC;AAClF,cAAc,uEAAuE,CAAC;AACtF,cAAc,6DAA6D,CAAC;AAC5E,cAAc,0DAA0D,CAAC;AACzE,cAAc,+DAA+D,CAAC;AAC9E,cAAc,6DAA6D,CAAC;AAC5E,cAAc,oDAAoD,CAAC;AACnE,cAAc,oEAAoE,CAAC;AACnF,cAAc,kDAAkD,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./models/IAutomationPolicyExecutionActionConfig.js\";\nexport * from \"./models/IAutomationPolicyExecutionActionConstructorOptions.js\";\nexport * from \"./models/IDefaultPolicyArbiterConfig.js\";\nexport * from \"./models/IDefaultPolicyArbiterConstructorOptions.js\";\nexport * from \"./models/IDefaultPolicyEnforcementProcessorConstructorOptions.js\";\nexport * from \"./models/IIdentityPolicyInformationSourceConstructorOptions.js\";\nexport * from \"./models/ILoggingPolicyExecutionActionConfig.js\";\nexport * from \"./models/ILoggingPolicyExecutionActionConstructorOptions.js\";\nexport * from \"./models/IPassThroughPolicyArbiterConstructorOptions.js\";\nexport * from \"./models/IPassThroughPolicyEnforcementProcessorConstructorOptions.js\";\nexport * from \"./models/IPassThroughPolicyNegotiatorConstructorOptions.js\";\nexport * from \"./models/IPassThroughPolicyObligationEnforcerConstructorOptions.js\";\nexport * from \"./models/IPassThroughPolicyRequesterConstructorOptions.js\";\nexport * from \"./models/IStaticPolicyInformationSource.js\";\nexport * from \"./models/IStaticPolicyInformationSourceConfig.js\";\nexport * from \"./models/IStaticPolicyInformationSourceConstructorOptions.js\";\nexport * from \"./policyArbiters/defaultPolicyArbiter.js\";\nexport * from \"./policyArbiters/passThroughPolicyArbiter.js\";\nexport * from \"./policyEnforcementProcessor/defaultPolicyEnforcementProcessor.js\";\nexport * from \"./policyEnforcementProcessor/passThroughPolicyEnforcementProcessor.js\";\nexport * from \"./policyExecutionActions/automationPolicyExecutionAction.js\";\nexport * from \"./policyExecutionActions/loggingPolicyExecutionAction.js\";\nexport * from \"./policyInformationSources/identityPolicyInformationSource.js\";\nexport * from \"./policyInformationSources/staticPolicyInformationSource.js\";\nexport * from \"./policyNegotiators/passThroughPolicyNegotiator.js\";\nexport * from \"./policyObligationEnforcers/passThroughPolicyObligationEnforcer.js\";\nexport * from \"./policyRequesters/passThroughPolicyRequester.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,oDAAoD,CAAC;AACnE,cAAc,gEAAgE,CAAC;AAC/E,cAAc,yCAAyC,CAAC;AACxD,cAAc,qDAAqD,CAAC;AACpE,cAAc,kEAAkE,CAAC;AACjF,cAAc,gEAAgE,CAAC;AAC/E,cAAc,uEAAuE,CAAC;AACtF,cAAc,iDAAiD,CAAC;AAChE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,yDAAyD,CAAC;AACxE,cAAc,sEAAsE,CAAC;AACrF,cAAc,4DAA4D,CAAC;AAC3E,cAAc,oEAAoE,CAAC;AACnF,cAAc,2DAA2D,CAAC;AAC1E,cAAc,4CAA4C,CAAC;AAC3D,cAAc,kDAAkD,CAAC;AACjE,cAAc,8DAA8D,CAAC;AAC7E,cAAc,0CAA0C,CAAC;AACzD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,mEAAmE,CAAC;AAClF,cAAc,uEAAuE,CAAC;AACtF,cAAc,6DAA6D,CAAC;AAC5E,cAAc,0DAA0D,CAAC;AACzE,cAAc,+DAA+D,CAAC;AAC9E,cAAc,sEAAsE,CAAC;AACrF,cAAc,6DAA6D,CAAC;AAC5E,cAAc,oDAAoD,CAAC;AACnE,cAAc,oEAAoE,CAAC;AACnF,cAAc,kDAAkD,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./models/IAutomationPolicyExecutionActionConfig.js\";\nexport * from \"./models/IAutomationPolicyExecutionActionConstructorOptions.js\";\nexport * from \"./models/IDefaultPolicyArbiterConfig.js\";\nexport * from \"./models/IDefaultPolicyArbiterConstructorOptions.js\";\nexport * from \"./models/IDefaultPolicyEnforcementProcessorConstructorOptions.js\";\nexport * from \"./models/IIdentityPolicyInformationSourceConstructorOptions.js\";\nexport * from \"./models/IIdentityProfilePolicyInformationSourceConstructorOptions.js\";\nexport * from \"./models/ILoggingPolicyExecutionActionConfig.js\";\nexport * from \"./models/ILoggingPolicyExecutionActionConstructorOptions.js\";\nexport * from \"./models/IPassThroughPolicyArbiterConstructorOptions.js\";\nexport * from \"./models/IPassThroughPolicyEnforcementProcessorConstructorOptions.js\";\nexport * from \"./models/IPassThroughPolicyNegotiatorConstructorOptions.js\";\nexport * from \"./models/IPassThroughPolicyObligationEnforcerConstructorOptions.js\";\nexport * from \"./models/IPassThroughPolicyRequesterConstructorOptions.js\";\nexport * from \"./models/IStaticPolicyInformationSource.js\";\nexport * from \"./models/IStaticPolicyInformationSourceConfig.js\";\nexport * from \"./models/IStaticPolicyInformationSourceConstructorOptions.js\";\nexport * from \"./policyArbiters/defaultPolicyArbiter.js\";\nexport * from \"./policyArbiters/passThroughPolicyArbiter.js\";\nexport * from \"./policyEnforcementProcessor/defaultPolicyEnforcementProcessor.js\";\nexport * from \"./policyEnforcementProcessor/passThroughPolicyEnforcementProcessor.js\";\nexport * from \"./policyExecutionActions/automationPolicyExecutionAction.js\";\nexport * from \"./policyExecutionActions/loggingPolicyExecutionAction.js\";\nexport * from \"./policyInformationSources/identityPolicyInformationSource.js\";\nexport * from \"./policyInformationSources/identityProfilePolicyInformationSource.js\";\nexport * from \"./policyInformationSources/staticPolicyInformationSource.js\";\nexport * from \"./policyNegotiators/passThroughPolicyNegotiator.js\";\nexport * from \"./policyObligationEnforcers/passThroughPolicyObligationEnforcer.js\";\nexport * from \"./policyRequesters/passThroughPolicyRequester.js\";\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2025 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export {};
4
+ //# sourceMappingURL=IIdentityProfilePolicyInformationSourceConstructorOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IIdentityProfilePolicyInformationSourceConstructorOptions.js","sourceRoot":"","sources":["../../../src/models/IIdentityProfilePolicyInformationSourceConstructorOptions.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Options for the Identity Profile Policy Information Source Component.\n */\nexport interface IIdentityProfilePolicyInformationSourceConstructorOptions {\n\t/**\n\t * The logging component for logging policy source.\n\t */\n\tloggingComponentType?: string;\n\n\t/**\n\t * The component for retrieving identity profiles.\n\t * @default identity-profile\n\t */\n\tidentityProfileComponentType?: string;\n}\n"]}
@@ -0,0 +1,112 @@
1
+ // Copyright 2025 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ import { BaseError, ComponentFactory, Guards, Is, NotFoundError } from "@twin.org/core";
4
+ import { JsonLdHelper } from "@twin.org/data-json-ld";
5
+ import { OdrlPolicyHelper, PolicyInformationAccessMode } from "@twin.org/rights-management-models";
6
+ /**
7
+ * Policy information source which retrieves identity profile information.
8
+ */
9
+ export class IdentityProfilePolicyInformationSource {
10
+ /**
11
+ * The class name of the Identity Profile Policy Information Source.
12
+ */
13
+ static CLASS_NAME = "IdentityProfilePolicyInformationSource";
14
+ /**
15
+ * The logging component.
16
+ * @internal
17
+ */
18
+ _logging;
19
+ /**
20
+ * The identity profile component.
21
+ * @internal
22
+ */
23
+ _identityProfile;
24
+ /**
25
+ * Create a new instance of IdentityProfilePolicyInformationSource.
26
+ * @param options The options for the identity profile policy source.
27
+ */
28
+ constructor(options) {
29
+ this._logging = ComponentFactory.getIfExists(options?.loggingComponentType);
30
+ this._identityProfile = ComponentFactory.get(options?.identityProfileComponentType ?? "identity-profile");
31
+ }
32
+ /**
33
+ * Returns the class name of the component.
34
+ * @returns The class name of the component.
35
+ */
36
+ className() {
37
+ return IdentityProfilePolicyInformationSource.CLASS_NAME;
38
+ }
39
+ /**
40
+ * Retrieve information from the sources.
41
+ * @param policy The policy to retrieve information for if available.
42
+ * @param accessMode The access mode to use for the retrieval.
43
+ * @param data The data to process.
44
+ * @param action The action that was evaluated.
45
+ * @returns The objects containing relevant information or undefined if nothing relevant is found.
46
+ */
47
+ async retrieve(policy, accessMode, data, action) {
48
+ Guards.arrayOneOf(IdentityProfilePolicyInformationSource.CLASS_NAME, "accessMode", accessMode, Object.values(PolicyInformationAccessMode));
49
+ const information = {};
50
+ if (Is.object(policy)) {
51
+ const ids = [];
52
+ if (Is.stringValue(policy.assignee)) {
53
+ ids.push(policy.assignee);
54
+ }
55
+ if (Is.stringValue(policy.assigner)) {
56
+ ids.push(policy.assigner);
57
+ }
58
+ for (const id of ids) {
59
+ try {
60
+ await this._logging?.log({
61
+ level: "info",
62
+ source: IdentityProfilePolicyInformationSource.CLASS_NAME,
63
+ ts: Date.now(),
64
+ message: "profileRetrieving",
65
+ data: {
66
+ policyId: OdrlPolicyHelper.getUid(policy) ?? "",
67
+ id
68
+ }
69
+ });
70
+ if (accessMode === PolicyInformationAccessMode.Public) {
71
+ const publicProfile = await this._identityProfile.getPublic(id);
72
+ information.profile ??= {};
73
+ information.profile[id] = {
74
+ public: Is.object(publicProfile)
75
+ ? JsonLdHelper.toNodeObject(publicProfile)
76
+ : undefined
77
+ };
78
+ }
79
+ else {
80
+ const result = await this._identityProfile.get(undefined, undefined, id);
81
+ information.profile ??= {};
82
+ information.profile[id] = {
83
+ public: Is.object(result.publicProfile)
84
+ ? JsonLdHelper.toNodeObject(result.publicProfile)
85
+ : undefined,
86
+ private: Is.object(result.privateProfile)
87
+ ? JsonLdHelper.toNodeObject(result.privateProfile)
88
+ : undefined
89
+ };
90
+ }
91
+ }
92
+ catch (err) {
93
+ if (!BaseError.someErrorName(err, NotFoundError.CLASS_NAME)) {
94
+ await this._logging?.log({
95
+ level: "error",
96
+ source: IdentityProfilePolicyInformationSource.CLASS_NAME,
97
+ ts: Date.now(),
98
+ message: "profileRetrievalFailed",
99
+ data: {
100
+ policyId: OdrlPolicyHelper.getUid(policy) ?? "",
101
+ id
102
+ },
103
+ error: BaseError.fromError(err)
104
+ });
105
+ }
106
+ }
107
+ }
108
+ }
109
+ return information;
110
+ }
111
+ }
112
+ //# sourceMappingURL=identityProfilePolicyInformationSource.js.map
@@ -0,0 +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,gBAAgB,CAAC;AACxF,OAAO,EAAE,YAAY,EAA0B,MAAM,wBAAwB,CAAC;AAI9E,OAAO,EAGN,gBAAgB,EAChB,2BAA2B,EAC3B,MAAM,oCAAoC,CAAC;AAI5C;;GAEG;AACH,MAAM,OAAO,sCAAsC;IAClD;;OAEG;IACI,MAAM,CAAU,UAAU,4CAA4D;IAE7F;;;OAGG;IACc,QAAQ,CAAqB;IAE9C;;;OAGG;IACc,gBAAgB,CAA4B;IAE7D;;;OAGG;IACH,YAAY,OAAmE;QAC9E,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,WAAW,CAAoB,OAAO,EAAE,oBAAoB,CAAC,CAAC;QAC/F,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC,GAAG,CAC3C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AAE;gCACL,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;gCAC/C,EAAE;6BACF;4BACD,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC;yBAC/B,CAAC,CAAC;oBACJ,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;QAED,OAAO,WAAW,CAAC;IACpB,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseError, ComponentFactory, Guards, Is, NotFoundError } from \"@twin.org/core\";\nimport { JsonLdHelper, type IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type { IIdentityProfileComponent } from \"@twin.org/identity-models\";\nimport type { ILoggingComponent } from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\ttype IPolicyInformationSource,\n\ttype IRightsManagementPolicy,\n\tOdrlPolicyHelper,\n\tPolicyInformationAccessMode\n} from \"@twin.org/rights-management-models\";\nimport type { OdrlActionType } from \"@twin.org/standards-w3c-odrl\";\nimport type { IIdentityProfilePolicyInformationSourceConstructorOptions } from \"../models/IIdentityProfilePolicyInformationSourceConstructorOptions.js\";\n\n/**\n * Policy information source which retrieves identity profile information.\n */\nexport class IdentityProfilePolicyInformationSource implements IPolicyInformationSource {\n\t/**\n\t * The class name of the Identity Profile Policy Information Source.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<IdentityProfilePolicyInformationSource>();\n\n\t/**\n\t * The logging component.\n\t * @internal\n\t */\n\tprivate readonly _logging?: ILoggingComponent;\n\n\t/**\n\t * The identity profile component.\n\t * @internal\n\t */\n\tprivate readonly _identityProfile: IIdentityProfileComponent;\n\n\t/**\n\t * Create a new instance of IdentityProfilePolicyInformationSource.\n\t * @param options The options for the identity profile policy source.\n\t */\n\tconstructor(options?: IIdentityProfilePolicyInformationSourceConstructorOptions) {\n\t\tthis._logging = ComponentFactory.getIfExists<ILoggingComponent>(options?.loggingComponentType);\n\t\tthis._identityProfile = ComponentFactory.get(\n\t\t\toptions?.identityProfileComponentType ?? \"identity-profile\"\n\t\t);\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn IdentityProfilePolicyInformationSource.CLASS_NAME;\n\t}\n\n\t/**\n\t * Retrieve information from the sources.\n\t * @param policy The policy to retrieve information for if available.\n\t * @param accessMode The access mode to use for the retrieval.\n\t * @param data The data to process.\n\t * @param action The action that was evaluated.\n\t * @returns The objects containing relevant information or undefined if nothing relevant is found.\n\t */\n\tpublic async retrieve<D = unknown>(\n\t\tpolicy: IRightsManagementPolicy | undefined,\n\t\taccessMode: PolicyInformationAccessMode,\n\t\tdata?: D,\n\t\taction?: OdrlActionType | string\n\t): Promise<{ [id: string]: IJsonLdNodeObject } | undefined> {\n\t\tGuards.arrayOneOf(\n\t\t\tIdentityProfilePolicyInformationSource.CLASS_NAME,\n\t\t\tnameof(accessMode),\n\t\t\taccessMode,\n\t\t\tObject.values(PolicyInformationAccessMode)\n\t\t);\n\n\t\tconst information: { [id: string]: IJsonLdNodeObject } = {};\n\n\t\tif (Is.object<IRightsManagementPolicy>(policy)) {\n\t\t\tconst ids = [];\n\n\t\t\tif (Is.stringValue(policy.assignee)) {\n\t\t\t\tids.push(policy.assignee);\n\t\t\t}\n\t\t\tif (Is.stringValue(policy.assigner)) {\n\t\t\t\tids.push(policy.assigner);\n\t\t\t}\n\n\t\t\tfor (const id of ids) {\n\t\t\t\ttry {\n\t\t\t\t\tawait this._logging?.log({\n\t\t\t\t\t\tlevel: \"info\",\n\t\t\t\t\t\tsource: IdentityProfilePolicyInformationSource.CLASS_NAME,\n\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\tmessage: \"profileRetrieving\",\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(policy) ?? \"\",\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tif (accessMode === PolicyInformationAccessMode.Public) {\n\t\t\t\t\t\tconst publicProfile = await this._identityProfile.getPublic(id);\n\t\t\t\t\t\tinformation.profile ??= {};\n\t\t\t\t\t\tinformation.profile[id] = {\n\t\t\t\t\t\t\tpublic: Is.object(publicProfile)\n\t\t\t\t\t\t\t\t? JsonLdHelper.toNodeObject(publicProfile)\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t};\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst result = await this._identityProfile.get(undefined, undefined, id);\n\t\t\t\t\t\tinformation.profile ??= {};\n\t\t\t\t\t\tinformation.profile[id] = {\n\t\t\t\t\t\t\tpublic: Is.object(result.publicProfile)\n\t\t\t\t\t\t\t\t? JsonLdHelper.toNodeObject(result.publicProfile)\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\tprivate: Is.object(result.privateProfile)\n\t\t\t\t\t\t\t\t? JsonLdHelper.toNodeObject(result.privateProfile)\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t} catch (err) {\n\t\t\t\t\tif (!BaseError.someErrorName(err, NotFoundError.CLASS_NAME)) {\n\t\t\t\t\t\tawait this._logging?.log({\n\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\tsource: IdentityProfilePolicyInformationSource.CLASS_NAME,\n\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\tmessage: \"profileRetrievalFailed\",\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\tpolicyId: OdrlPolicyHelper.getUid(policy) ?? \"\",\n\t\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\terror: BaseError.fromError(err)\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn information;\n\t}\n}\n"]}
@@ -4,6 +4,7 @@ export * from "./models/IDefaultPolicyArbiterConfig.js";
4
4
  export * from "./models/IDefaultPolicyArbiterConstructorOptions.js";
5
5
  export * from "./models/IDefaultPolicyEnforcementProcessorConstructorOptions.js";
6
6
  export * from "./models/IIdentityPolicyInformationSourceConstructorOptions.js";
7
+ export * from "./models/IIdentityProfilePolicyInformationSourceConstructorOptions.js";
7
8
  export * from "./models/ILoggingPolicyExecutionActionConfig.js";
8
9
  export * from "./models/ILoggingPolicyExecutionActionConstructorOptions.js";
9
10
  export * from "./models/IPassThroughPolicyArbiterConstructorOptions.js";
@@ -21,6 +22,7 @@ export * from "./policyEnforcementProcessor/passThroughPolicyEnforcementProcesso
21
22
  export * from "./policyExecutionActions/automationPolicyExecutionAction.js";
22
23
  export * from "./policyExecutionActions/loggingPolicyExecutionAction.js";
23
24
  export * from "./policyInformationSources/identityPolicyInformationSource.js";
25
+ export * from "./policyInformationSources/identityProfilePolicyInformationSource.js";
24
26
  export * from "./policyInformationSources/staticPolicyInformationSource.js";
25
27
  export * from "./policyNegotiators/passThroughPolicyNegotiator.js";
26
28
  export * from "./policyObligationEnforcers/passThroughPolicyObligationEnforcer.js";
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Options for the Identity Profile Policy Information Source Component.
3
+ */
4
+ export interface IIdentityProfilePolicyInformationSourceConstructorOptions {
5
+ /**
6
+ * The logging component for logging policy source.
7
+ */
8
+ loggingComponentType?: string;
9
+ /**
10
+ * The component for retrieving identity profiles.
11
+ * @default identity-profile
12
+ */
13
+ identityProfileComponentType?: string;
14
+ }
@@ -0,0 +1,34 @@
1
+ import { type IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
+ import { type IPolicyInformationSource, type IRightsManagementPolicy, PolicyInformationAccessMode } from "@twin.org/rights-management-models";
3
+ import type { OdrlActionType } from "@twin.org/standards-w3c-odrl";
4
+ import type { IIdentityProfilePolicyInformationSourceConstructorOptions } from "../models/IIdentityProfilePolicyInformationSourceConstructorOptions.js";
5
+ /**
6
+ * Policy information source which retrieves identity profile information.
7
+ */
8
+ export declare class IdentityProfilePolicyInformationSource implements IPolicyInformationSource {
9
+ /**
10
+ * The class name of the Identity Profile Policy Information Source.
11
+ */
12
+ static readonly CLASS_NAME: string;
13
+ /**
14
+ * Create a new instance of IdentityProfilePolicyInformationSource.
15
+ * @param options The options for the identity profile policy source.
16
+ */
17
+ constructor(options?: IIdentityProfilePolicyInformationSourceConstructorOptions);
18
+ /**
19
+ * Returns the class name of the component.
20
+ * @returns The class name of the component.
21
+ */
22
+ className(): string;
23
+ /**
24
+ * Retrieve information from the sources.
25
+ * @param policy The policy to retrieve information for if available.
26
+ * @param accessMode The access mode to use for the retrieval.
27
+ * @param data The data to process.
28
+ * @param action The action that was evaluated.
29
+ * @returns The objects containing relevant information or undefined if nothing relevant is found.
30
+ */
31
+ retrieve<D = unknown>(policy: IRightsManagementPolicy | undefined, accessMode: PolicyInformationAccessMode, data?: D, action?: OdrlActionType | string): Promise<{
32
+ [id: string]: IJsonLdNodeObject;
33
+ } | undefined>;
34
+ }
package/docs/changelog.md CHANGED
@@ -6,6 +6,28 @@
6
6
 
7
7
  * remove EcosystemPolicy-related examples/assumptions; plugins now target standard ODRL policy types for v2.
8
8
 
9
+ ## [0.0.3-next.51](https://github.com/iotaledger/twin-rights-management/compare/rights-management-plugins-v0.0.3-next.50...rights-management-plugins-v0.0.3-next.51) (2026-06-16)
10
+
11
+
12
+ ### Features
13
+
14
+ * identity profile information source ([#194](https://github.com/iotaledger/twin-rights-management/issues/194)) ([c17bd14](https://github.com/iotaledger/twin-rights-management/commit/c17bd14387ab3945cac6f1d0ba2a8adb57d2302b))
15
+
16
+
17
+ ### Dependencies
18
+
19
+ * The following workspace dependencies were updated
20
+ * dependencies
21
+ * @twin.org/rights-management-models bumped from 0.0.3-next.50 to 0.0.3-next.51
22
+ * devDependencies
23
+ * @twin.org/rights-management-pap-service bumped from 0.0.3-next.50 to 0.0.3-next.51
24
+ * @twin.org/rights-management-pdp-service bumped from 0.0.3-next.50 to 0.0.3-next.51
25
+ * @twin.org/rights-management-pep-service bumped from 0.0.3-next.50 to 0.0.3-next.51
26
+ * @twin.org/rights-management-pip-service bumped from 0.0.3-next.50 to 0.0.3-next.51
27
+ * @twin.org/rights-management-pmp-service bumped from 0.0.3-next.50 to 0.0.3-next.51
28
+ * @twin.org/rights-management-pnp-service bumped from 0.0.3-next.50 to 0.0.3-next.51
29
+ * @twin.org/rights-management-pxp-service bumped from 0.0.3-next.50 to 0.0.3-next.51
30
+
9
31
  ## [0.0.3-next.50](https://github.com/iotaledger/twin-rights-management/compare/rights-management-plugins-v0.0.3-next.49...rights-management-plugins-v0.0.3-next.50) (2026-06-15)
10
32
 
11
33
 
@@ -0,0 +1,103 @@
1
+ # Class: IdentityProfilePolicyInformationSource
2
+
3
+ Policy information source which retrieves identity profile information.
4
+
5
+ ## Implements
6
+
7
+ - `IPolicyInformationSource`
8
+
9
+ ## Constructors
10
+
11
+ ### Constructor
12
+
13
+ > **new IdentityProfilePolicyInformationSource**(`options?`): `IdentityProfilePolicyInformationSource`
14
+
15
+ Create a new instance of IdentityProfilePolicyInformationSource.
16
+
17
+ #### Parameters
18
+
19
+ ##### options?
20
+
21
+ [`IIdentityProfilePolicyInformationSourceConstructorOptions`](../interfaces/IIdentityProfilePolicyInformationSourceConstructorOptions.md)
22
+
23
+ The options for the identity profile policy source.
24
+
25
+ #### Returns
26
+
27
+ `IdentityProfilePolicyInformationSource`
28
+
29
+ ## Properties
30
+
31
+ ### CLASS\_NAME {#class_name}
32
+
33
+ > `readonly` `static` **CLASS\_NAME**: `string`
34
+
35
+ The class name of the Identity Profile Policy Information Source.
36
+
37
+ ## Methods
38
+
39
+ ### className() {#classname}
40
+
41
+ > **className**(): `string`
42
+
43
+ Returns the class name of the component.
44
+
45
+ #### Returns
46
+
47
+ `string`
48
+
49
+ The class name of the component.
50
+
51
+ #### Implementation of
52
+
53
+ `IPolicyInformationSource.className`
54
+
55
+ ***
56
+
57
+ ### retrieve() {#retrieve}
58
+
59
+ > **retrieve**\<`D`\>(`policy`, `accessMode`, `data?`, `action?`): `Promise`\<\{\[`id`: `string`\]: `IJsonLdNodeObject`; \} \| `undefined`\>
60
+
61
+ Retrieve information from the sources.
62
+
63
+ #### Type Parameters
64
+
65
+ ##### D
66
+
67
+ `D` = `unknown`
68
+
69
+ #### Parameters
70
+
71
+ ##### policy
72
+
73
+ `IRightsManagementPolicy` \| `undefined`
74
+
75
+ The policy to retrieve information for if available.
76
+
77
+ ##### accessMode
78
+
79
+ `PolicyInformationAccessMode`
80
+
81
+ The access mode to use for the retrieval.
82
+
83
+ ##### data?
84
+
85
+ `D`
86
+
87
+ The data to process.
88
+
89
+ ##### action?
90
+
91
+ `string`
92
+
93
+ The action that was evaluated.
94
+
95
+ #### Returns
96
+
97
+ `Promise`\<\{\[`id`: `string`\]: `IJsonLdNodeObject`; \} \| `undefined`\>
98
+
99
+ The objects containing relevant information or undefined if nothing relevant is found.
100
+
101
+ #### Implementation of
102
+
103
+ `IPolicyInformationSource.retrieve`
@@ -9,6 +9,7 @@
9
9
  - [AutomationPolicyExecutionAction](classes/AutomationPolicyExecutionAction.md)
10
10
  - [LoggingPolicyExecutionAction](classes/LoggingPolicyExecutionAction.md)
11
11
  - [IdentityPolicyInformationSource](classes/IdentityPolicyInformationSource.md)
12
+ - [IdentityProfilePolicyInformationSource](classes/IdentityProfilePolicyInformationSource.md)
12
13
  - [StaticPolicyInformationSource](classes/StaticPolicyInformationSource.md)
13
14
  - [PassThroughPolicyNegotiator](classes/PassThroughPolicyNegotiator.md)
14
15
  - [PassThroughPolicyObligationEnforcer](classes/PassThroughPolicyObligationEnforcer.md)
@@ -22,6 +23,7 @@
22
23
  - [IDefaultPolicyArbiterConstructorOptions](interfaces/IDefaultPolicyArbiterConstructorOptions.md)
23
24
  - [IDefaultPolicyEnforcementProcessorConstructorOptions](interfaces/IDefaultPolicyEnforcementProcessorConstructorOptions.md)
24
25
  - [IIdentityPolicyInformationSourceConstructorOptions](interfaces/IIdentityPolicyInformationSourceConstructorOptions.md)
26
+ - [IIdentityProfilePolicyInformationSourceConstructorOptions](interfaces/IIdentityProfilePolicyInformationSourceConstructorOptions.md)
25
27
  - [ILoggingPolicyExecutionActionConfig](interfaces/ILoggingPolicyExecutionActionConfig.md)
26
28
  - [ILoggingPolicyExecutionActionConstructorOptions](interfaces/ILoggingPolicyExecutionActionConstructorOptions.md)
27
29
  - [IPassThroughPolicyArbiterConstructorOptions](interfaces/IPassThroughPolicyArbiterConstructorOptions.md)
@@ -0,0 +1,25 @@
1
+ # Interface: IIdentityProfilePolicyInformationSourceConstructorOptions
2
+
3
+ Options for the Identity Profile Policy Information Source Component.
4
+
5
+ ## Properties
6
+
7
+ ### loggingComponentType? {#loggingcomponenttype}
8
+
9
+ > `optional` **loggingComponentType?**: `string`
10
+
11
+ The logging component for logging policy source.
12
+
13
+ ***
14
+
15
+ ### identityProfileComponentType? {#identityprofilecomponenttype}
16
+
17
+ > `optional` **identityProfileComponentType?**: `string`
18
+
19
+ The component for retrieving identity profiles.
20
+
21
+ #### Default
22
+
23
+ ```ts
24
+ identity-profile
25
+ ```
package/locales/en.json CHANGED
@@ -3,6 +3,9 @@
3
3
  "identityPolicyInformationSource": {
4
4
  "identityRetrievalFailed": "Failed to retrieve identity \"{id}\" information for policy id: \"{policyId}\""
5
5
  },
6
+ "identityProfilePolicyInformationSource": {
7
+ "profileRetrievalFailed": "Failed to retrieve identity profile \"{id}\" information for policy id: \"{policyId}\""
8
+ },
6
9
  "defaultPolicyArbiter": {
7
10
  "ruleTargetNotSupported": "Rule target \"{target}\" is not supported. Only twin:<object>:<jsonPath> targets are currently supported.",
8
11
  "multipleTargetsNotSupported": "Multiple targets in a single permission are not supported.",
@@ -35,6 +38,9 @@
35
38
  "identityPolicyInformationSource": {
36
39
  "identityRetrieving": "Retrieving identity \"{id}\" information for policy id: \"{policyId}\""
37
40
  },
41
+ "identityProfilePolicyInformationSource": {
42
+ "profileRetrieving": "Retrieving identity profile \"{id}\" information for policy id: \"{policyId}\""
43
+ },
38
44
  "staticPolicyInformationSource": {
39
45
  "staticRetrieving": "Retrieving static policy information for policy id: \"{policyId}\" with access mode: \"{accessMode}\"",
40
46
  "staticRetrieved": "Retrieved static policy information for policy id: \"{policyId}\" with access mode: \"{accessMode}\", item count: {itemCount}"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/rights-management-plugins",
3
- "version": "0.0.3-next.50",
3
+ "version": "0.0.3-next.51",
4
4
  "description": "Plugin implementations for extending rights management behaviour across components.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,9 +23,10 @@
23
23
  "@twin.org/core": "next",
24
24
  "@twin.org/data-json-ld": "next",
25
25
  "@twin.org/data-json-path": "next",
26
+ "@twin.org/identity-models": "next",
26
27
  "@twin.org/logging-models": "next",
27
28
  "@twin.org/nameof": "next",
28
- "@twin.org/rights-management-models": "0.0.3-next.50",
29
+ "@twin.org/rights-management-models": "0.0.3-next.51",
29
30
  "@twin.org/standards-w3c-odrl": "next"
30
31
  },
31
32
  "main": "./dist/es/index.js",