@twin.org/rights-management-plugins 0.0.3-next.9 → 0.9.0

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 (150) hide show
  1. package/README.md +11 -3
  2. package/dist/es/index.js +20 -10
  3. package/dist/es/index.js.map +1 -1
  4. package/dist/es/models/IAutomationPolicyExecutionActionConfig.js +4 -0
  5. package/dist/es/models/IAutomationPolicyExecutionActionConfig.js.map +1 -0
  6. package/dist/es/models/IAutomationPolicyExecutionActionConstructorOptions.js +2 -0
  7. package/dist/es/models/IAutomationPolicyExecutionActionConstructorOptions.js.map +1 -0
  8. package/dist/es/models/{IExamplePolicyArbiterConstructorOptions.js → IDefaultPolicyArbiterConfig.js} +1 -1
  9. package/dist/es/models/IDefaultPolicyArbiterConfig.js.map +1 -0
  10. package/dist/es/models/{IExamplePolicyRequesterConstructorOptions.js → IDefaultPolicyArbiterConstructorOptions.js} +1 -1
  11. package/dist/es/models/IDefaultPolicyArbiterConstructorOptions.js.map +1 -0
  12. package/dist/es/models/{IExamplePolicyEnforcementProcessorConstructorOptions.js → IDefaultPolicyEnforcementProcessorConstructorOptions.js} +1 -1
  13. package/dist/es/models/IDefaultPolicyEnforcementProcessorConstructorOptions.js.map +1 -0
  14. package/dist/es/models/IIdentityPolicyInformationSourceConstructorOptions.js.map +1 -1
  15. package/dist/es/models/IIdentityProfilePolicyInformationSourceConstructorOptions.js +4 -0
  16. package/dist/es/models/IIdentityProfilePolicyInformationSourceConstructorOptions.js.map +1 -0
  17. package/dist/es/models/ILoggingPolicyExecutionActionConfig.js.map +1 -1
  18. package/dist/es/models/ILoggingPolicyExecutionActionConstructorOptions.js.map +1 -1
  19. package/dist/es/models/{IExampleDataAccessHandlerConstructorOptions.js → IPassThroughPolicyArbiterConstructorOptions.js} +1 -1
  20. package/dist/es/models/IPassThroughPolicyArbiterConstructorOptions.js.map +1 -0
  21. package/dist/es/models/IPassThroughPolicyEnforcementProcessorConstructorOptions.js +4 -0
  22. package/dist/es/models/IPassThroughPolicyEnforcementProcessorConstructorOptions.js.map +1 -0
  23. package/dist/es/models/IPassThroughPolicyNegotiatorConstructorOptions.js +4 -0
  24. package/dist/es/models/IPassThroughPolicyNegotiatorConstructorOptions.js.map +1 -0
  25. package/dist/es/models/IPassThroughPolicyObligationEnforcerConstructorOptions.js +4 -0
  26. package/dist/es/models/IPassThroughPolicyObligationEnforcerConstructorOptions.js.map +1 -0
  27. package/dist/es/models/{IExamplePolicyNegotiatorConstructorOptions.js → IPassThroughPolicyRequesterConstructorOptions.js} +1 -1
  28. package/dist/es/models/IPassThroughPolicyRequesterConstructorOptions.js.map +1 -0
  29. package/dist/es/models/IStaticPolicyInformationSource.js.map +1 -1
  30. package/dist/es/models/IStaticPolicyInformationSourceConstructorOptions.js.map +1 -1
  31. package/dist/es/policyArbiters/defaultPolicyArbiter.js +1790 -0
  32. package/dist/es/policyArbiters/defaultPolicyArbiter.js.map +1 -0
  33. package/dist/es/policyArbiters/passThroughPolicyArbiter.js +59 -0
  34. package/dist/es/policyArbiters/passThroughPolicyArbiter.js.map +1 -0
  35. package/dist/es/policyEnforcementProcessor/defaultPolicyEnforcementProcessor.js +147 -0
  36. package/dist/es/policyEnforcementProcessor/defaultPolicyEnforcementProcessor.js.map +1 -0
  37. package/dist/es/policyEnforcementProcessor/passThroughPolicyEnforcementProcessor.js +54 -0
  38. package/dist/es/policyEnforcementProcessor/passThroughPolicyEnforcementProcessor.js.map +1 -0
  39. package/dist/es/policyExecutionActions/automationPolicyExecutionAction.js +77 -0
  40. package/dist/es/policyExecutionActions/automationPolicyExecutionAction.js.map +1 -0
  41. package/dist/es/policyExecutionActions/loggingPolicyExecutionAction.js +22 -18
  42. package/dist/es/policyExecutionActions/loggingPolicyExecutionAction.js.map +1 -1
  43. package/dist/es/policyInformationSources/identityPolicyInformationSource.js +44 -32
  44. package/dist/es/policyInformationSources/identityPolicyInformationSource.js.map +1 -1
  45. package/dist/es/policyInformationSources/identityProfilePolicyInformationSource.js +112 -0
  46. package/dist/es/policyInformationSources/identityProfilePolicyInformationSource.js.map +1 -0
  47. package/dist/es/policyInformationSources/staticPolicyInformationSource.js +18 -16
  48. package/dist/es/policyInformationSources/staticPolicyInformationSource.js.map +1 -1
  49. package/dist/es/policyNegotiators/passThroughPolicyNegotiator.js +88 -0
  50. package/dist/es/policyNegotiators/passThroughPolicyNegotiator.js.map +1 -0
  51. package/dist/es/policyObligationEnforcers/passThroughPolicyObligationEnforcer.js +56 -0
  52. package/dist/es/policyObligationEnforcers/passThroughPolicyObligationEnforcer.js.map +1 -0
  53. package/dist/es/policyRequesters/passThroughPolicyRequester.js +103 -0
  54. package/dist/es/policyRequesters/passThroughPolicyRequester.js.map +1 -0
  55. package/dist/types/index.d.ts +20 -10
  56. package/dist/types/models/IAutomationPolicyExecutionActionConfig.d.ts +9 -0
  57. package/dist/types/models/IAutomationPolicyExecutionActionConstructorOptions.d.ts +15 -0
  58. package/dist/types/models/IDefaultPolicyArbiterConfig.d.ts +10 -0
  59. package/dist/types/models/IDefaultPolicyArbiterConstructorOptions.d.ts +19 -0
  60. package/dist/types/models/IDefaultPolicyEnforcementProcessorConstructorOptions.d.ts +9 -0
  61. package/dist/types/models/IIdentityPolicyInformationSourceConstructorOptions.d.ts +0 -1
  62. package/dist/types/models/IIdentityProfilePolicyInformationSourceConstructorOptions.d.ts +14 -0
  63. package/dist/types/models/ILoggingPolicyExecutionActionConfig.d.ts +2 -2
  64. package/dist/types/models/ILoggingPolicyExecutionActionConstructorOptions.d.ts +0 -1
  65. package/dist/types/models/IPassThroughPolicyArbiterConstructorOptions.d.ts +9 -0
  66. package/dist/types/models/IPassThroughPolicyEnforcementProcessorConstructorOptions.d.ts +9 -0
  67. package/dist/types/models/IPassThroughPolicyNegotiatorConstructorOptions.d.ts +9 -0
  68. package/dist/types/models/IPassThroughPolicyObligationEnforcerConstructorOptions.d.ts +9 -0
  69. package/dist/types/models/IPassThroughPolicyRequesterConstructorOptions.d.ts +9 -0
  70. package/dist/types/models/IStaticPolicyInformationSource.d.ts +8 -5
  71. package/dist/types/models/IStaticPolicyInformationSourceConstructorOptions.d.ts +0 -1
  72. package/dist/types/policyArbiters/defaultPolicyArbiter.d.ts +38 -0
  73. package/dist/types/policyArbiters/passThroughPolicyArbiter.d.ts +32 -0
  74. package/dist/types/policyEnforcementProcessor/defaultPolicyEnforcementProcessor.d.ts +32 -0
  75. package/dist/types/policyEnforcementProcessor/passThroughPolicyEnforcementProcessor.d.ts +32 -0
  76. package/dist/types/policyExecutionActions/automationPolicyExecutionAction.d.ts +45 -0
  77. package/dist/types/policyExecutionActions/loggingPolicyExecutionAction.d.ts +6 -18
  78. package/dist/types/policyInformationSources/identityPolicyInformationSource.d.ts +5 -6
  79. package/dist/types/policyInformationSources/identityProfilePolicyInformationSource.d.ts +31 -0
  80. package/dist/types/policyInformationSources/staticPolicyInformationSource.d.ts +5 -6
  81. package/dist/types/policyNegotiators/passThroughPolicyNegotiator.d.ts +47 -0
  82. package/dist/types/policyObligationEnforcers/passThroughPolicyObligationEnforcer.d.ts +32 -0
  83. package/dist/types/policyRequesters/passThroughPolicyRequester.d.ts +48 -0
  84. package/docs/changelog.md +1230 -10
  85. package/docs/examples.md +295 -1
  86. package/docs/reference/classes/AutomationPolicyExecutionAction.md +143 -0
  87. package/docs/reference/classes/DefaultPolicyArbiter.md +113 -0
  88. package/docs/reference/classes/DefaultPolicyEnforcementProcessor.md +107 -0
  89. package/docs/reference/classes/IdentityPolicyInformationSource.md +14 -14
  90. package/docs/reference/classes/IdentityProfilePolicyInformationSource.md +103 -0
  91. package/docs/reference/classes/LoggingPolicyExecutionAction.md +20 -20
  92. package/docs/reference/classes/PassThroughPolicyArbiter.md +103 -0
  93. package/docs/reference/classes/PassThroughPolicyEnforcementProcessor.md +107 -0
  94. package/docs/reference/classes/{ExamplePolicyNegotiator.md → PassThroughPolicyNegotiator.md} +27 -21
  95. package/docs/reference/classes/PassThroughPolicyObligationEnforcer.md +109 -0
  96. package/docs/reference/classes/{ExamplePolicyRequester.md → PassThroughPolicyRequester.md} +22 -40
  97. package/docs/reference/classes/StaticPolicyInformationSource.md +15 -15
  98. package/docs/reference/index.md +20 -10
  99. package/docs/reference/interfaces/IAutomationPolicyExecutionActionConfig.md +11 -0
  100. package/docs/reference/interfaces/IAutomationPolicyExecutionActionConstructorOptions.md +25 -0
  101. package/docs/reference/interfaces/IDefaultPolicyArbiterConfig.md +17 -0
  102. package/docs/reference/interfaces/IDefaultPolicyArbiterConstructorOptions.md +33 -0
  103. package/docs/reference/interfaces/IDefaultPolicyEnforcementProcessorConstructorOptions.md +11 -0
  104. package/docs/reference/interfaces/IIdentityPolicyInformationSourceConstructorOptions.md +4 -10
  105. package/docs/reference/interfaces/IIdentityProfilePolicyInformationSourceConstructorOptions.md +25 -0
  106. package/docs/reference/interfaces/ILoggingPolicyExecutionActionConfig.md +9 -9
  107. package/docs/reference/interfaces/ILoggingPolicyExecutionActionConstructorOptions.md +4 -10
  108. package/docs/reference/interfaces/IPassThroughPolicyArbiterConstructorOptions.md +11 -0
  109. package/docs/reference/interfaces/IPassThroughPolicyEnforcementProcessorConstructorOptions.md +11 -0
  110. package/docs/reference/interfaces/IPassThroughPolicyNegotiatorConstructorOptions.md +11 -0
  111. package/docs/reference/interfaces/IPassThroughPolicyObligationEnforcerConstructorOptions.md +11 -0
  112. package/docs/reference/interfaces/IPassThroughPolicyRequesterConstructorOptions.md +11 -0
  113. package/docs/reference/interfaces/IStaticPolicyInformationSource.md +21 -6
  114. package/docs/reference/interfaces/IStaticPolicyInformationSourceConfig.md +2 -2
  115. package/docs/reference/interfaces/IStaticPolicyInformationSourceConstructorOptions.md +4 -10
  116. package/locales/en.json +65 -6
  117. package/package.json +14 -11
  118. package/dist/es/dataAccessHandlers/examplePolicyRequester.js +0 -82
  119. package/dist/es/dataAccessHandlers/examplePolicyRequester.js.map +0 -1
  120. package/dist/es/models/IExampleDataAccessHandlerConstructorOptions.js.map +0 -1
  121. package/dist/es/models/IExamplePolicyArbiterConstructorOptions.js.map +0 -1
  122. package/dist/es/models/IExamplePolicyEnforcementProcessorConstructorOptions.js.map +0 -1
  123. package/dist/es/models/IExamplePolicyNegotiatorConstructorOptions.js.map +0 -1
  124. package/dist/es/models/IExamplePolicyRequesterConstructorOptions.js.map +0 -1
  125. package/dist/es/policyArbiters/examplePolicyArbiter.js +0 -50
  126. package/dist/es/policyArbiters/examplePolicyArbiter.js.map +0 -1
  127. package/dist/es/policyEnforcementProcessor/examplePolicyEnforcementProcessor.js +0 -42
  128. package/dist/es/policyEnforcementProcessor/examplePolicyEnforcementProcessor.js.map +0 -1
  129. package/dist/es/policyNegotiators/examplePolicyNegotiator.js +0 -61
  130. package/dist/es/policyNegotiators/examplePolicyNegotiator.js.map +0 -1
  131. package/dist/es/policyRequesters/examplePolicyRequester.js +0 -69
  132. package/dist/es/policyRequesters/examplePolicyRequester.js.map +0 -1
  133. package/dist/types/dataAccessHandlers/examplePolicyRequester.d.ts +0 -68
  134. package/dist/types/models/IExampleDataAccessHandlerConstructorOptions.d.ts +0 -10
  135. package/dist/types/models/IExamplePolicyArbiterConstructorOptions.d.ts +0 -10
  136. package/dist/types/models/IExamplePolicyEnforcementProcessorConstructorOptions.d.ts +0 -10
  137. package/dist/types/models/IExamplePolicyNegotiatorConstructorOptions.d.ts +0 -10
  138. package/dist/types/models/IExamplePolicyRequesterConstructorOptions.d.ts +0 -10
  139. package/dist/types/policyArbiters/examplePolicyArbiter.d.ts +0 -36
  140. package/dist/types/policyEnforcementProcessor/examplePolicyEnforcementProcessor.d.ts +0 -29
  141. package/dist/types/policyNegotiators/examplePolicyNegotiator.d.ts +0 -45
  142. package/dist/types/policyRequesters/examplePolicyRequester.d.ts +0 -53
  143. package/docs/reference/classes/ExampleDataAccessHandler.md +0 -243
  144. package/docs/reference/classes/ExamplePolicyArbiter.md +0 -121
  145. package/docs/reference/classes/ExamplePolicyEnforcementProcessor.md +0 -101
  146. package/docs/reference/interfaces/IExampleDataAccessHandlerConstructorOptions.md +0 -17
  147. package/docs/reference/interfaces/IExamplePolicyArbiterConstructorOptions.md +0 -17
  148. package/docs/reference/interfaces/IExamplePolicyEnforcementProcessorConstructorOptions.md +0 -17
  149. package/docs/reference/interfaces/IExamplePolicyNegotiatorConstructorOptions.md +0 -17
  150. package/docs/reference/interfaces/IExamplePolicyRequesterConstructorOptions.md +0 -17
@@ -0,0 +1,11 @@
1
+ # Interface: IPassThroughPolicyRequesterConstructorOptions
2
+
3
+ Options for the Pass Through Policy Requester.
4
+
5
+ ## Properties
6
+
7
+ ### loggingComponentType? {#loggingcomponenttype}
8
+
9
+ > `optional` **loggingComponentType?**: `string`
10
+
11
+ The logging component for policy requester.
@@ -4,7 +4,7 @@ Configuration for the Static Policy Information Source Component.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### accessMode
7
+ ### accessMode {#accessmode}
8
8
 
9
9
  > **accessMode**: `PolicyInformationAccessMode`
10
10
 
@@ -12,17 +12,32 @@ Is the information public, if so it will be shared with negotiation requests.
12
12
 
13
13
  ***
14
14
 
15
- ### matchLocators?
15
+ ### matchLocators? {#matchlocators}
16
16
 
17
- > `optional` **matchLocators**: `IPolicyLocator`[]
17
+ > `optional` **matchLocators?**: `object`[]
18
18
 
19
19
  Information is only provided for the specified locator combination.
20
- If undefined is provided matches all resources.
20
+
21
+ #### assignee?
22
+
23
+ > `optional` **assignee?**: `string`
24
+
25
+ #### assigner?
26
+
27
+ > `optional` **assigner?**: `string`
28
+
29
+ #### target?
30
+
31
+ > `optional` **target?**: `string`
32
+
33
+ #### action?
34
+
35
+ > `optional` **action?**: `string`
21
36
 
22
37
  ***
23
38
 
24
- ### objects
39
+ ### objects {#objects}
25
40
 
26
- > **objects**: `IJsonLdNodeObject`[]
41
+ > **objects**: `IRightsManagementInformation`
27
42
 
28
43
  The objects containing the information.
@@ -4,8 +4,8 @@ Configuration for the Static Policy Information Source Component.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### information?
7
+ ### information? {#information}
8
8
 
9
- > `optional` **information**: [`IStaticPolicyInformationSource`](IStaticPolicyInformationSource.md)[]
9
+ > `optional` **information?**: [`IStaticPolicyInformationSource`](IStaticPolicyInformationSource.md)[]
10
10
 
11
11
  The information to return from the PIP.
@@ -4,22 +4,16 @@ Options for the Static Policy Information Source Component.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### loggingComponentType?
7
+ ### loggingComponentType? {#loggingcomponenttype}
8
8
 
9
- > `optional` **loggingComponentType**: `string`
9
+ > `optional` **loggingComponentType?**: `string`
10
10
 
11
11
  The logging component for logging policy source.
12
12
 
13
- #### Default
14
-
15
- ```ts
16
- logging
17
- ```
18
-
19
13
  ***
20
14
 
21
- ### config?
15
+ ### config? {#config}
22
16
 
23
- > `optional` **config**: [`IStaticPolicyInformationSourceConfig`](IStaticPolicyInformationSourceConfig.md)
17
+ > `optional` **config?**: [`IStaticPolicyInformationSourceConfig`](IStaticPolicyInformationSourceConfig.md)
24
18
 
25
19
  The configuration.
package/locales/en.json CHANGED
@@ -1,20 +1,79 @@
1
1
  {
2
2
  "error": {
3
3
  "identityPolicyInformationSource": {
4
- "identityRetrievalFailed": "Failed to retrieve identity information for locator: \"{locator}\""
4
+ "identityRetrievalFailed": "Failed to retrieve identity \"{id}\" information for policy id: \"{policyId}\""
5
+ },
6
+ "identityProfilePolicyInformationSource": {
7
+ "profileRetrievalFailed": "Failed to retrieve identity profile \"{id}\" information for policy id: \"{policyId}\""
8
+ },
9
+ "defaultPolicyArbiter": {
10
+ "ruleTargetNotSupported": "Rule target \"{target}\" is not supported. Only twin:<object>:<jsonPath> targets are currently supported.",
11
+ "multipleTargetsNotSupported": "Multiple targets in a single permission are not supported.",
12
+ "circularInheritanceDetected": "Circular inheritance detected: policy \"{policyId}\" inherits from \"{inheritFromId}\" which creates a cycle.",
13
+ "logicalConstraintOperandNotUnique": "Logical constraint operand is not unique within the policy, each operand must be unique.",
14
+ "inheritedPolicyNotFound": "The inherited policy with id \"{inheritFromId}\" could not be found in the Policy Administration Point.",
15
+ "assetCollectionSourceNotSupported": "AssetCollection source \"{source}\" is not supported. It must be a twin:jsonPath target.",
16
+ "partyCollectionSourceNotSupported": "PartyCollection source \"{source}\" is not supported.",
17
+ "assetHasPolicyNotSupported": "Asset hasPolicy is not supported. Policies must be referenced through the agreement directly.",
18
+ "assetPartOfNotSupported": "Asset partOf is not supported. AssetCollection membership is resolved through the agreement directly.",
19
+ "partyAssignerOfNotSupported": "Party assignerOf is not supported. Assigner roles must be specified directly on individual rules or the agreement.",
20
+ "partyAssigneeOfNotSupported": "Party assigneeOf is not supported. Assignee roles must be specified directly on individual rules or the agreement.",
21
+ "partyPartOfNotSupported": "Party partOf is not supported. PartyCollection membership is resolved through the agreement directly.",
22
+ "noObligationEnforcersRegistered": "No Policy Obligation Enforcers are registered and they are required to enforce duties.",
23
+ "maxInheritanceDepthExceeded": "The maximum inheritance depth of {maxInheritanceDepth} has been exceeded when processing policy \"{policyId}\".",
24
+ "rightOperandReferenceNotSupported": "Constraint rightOperandReference is not supported. Use rightOperand with a typed JSONPath value instead.",
25
+ "constraintDataTypeNotSupported": "Constraint dataType is not supported. Value coercion based on dataType is not implemented.",
26
+ "constraintUnitNotSupported": "Constraint unit is not supported. Unit-aware comparison is not implemented.",
27
+ "constraintStatusNotSupported": "Constraint status is not supported. State-based evaluation is not implemented.",
28
+ "jsonPathExpressionMissing": "Canonical JSONPath expression is missing for \"{operand}\". Provide twin:jsonPathExpression.",
29
+ "policyProfileNotSupported": "Policy \"{policyId}\" declares unsupported profile \"{unsupportedProfile}\". Only known profiles are supported.",
30
+ "inheritedPolicyProfileNotSupported": "Inherited policy \"{policyId}\" declares an unsupported profile. All policies in the inheritFrom chain must declare only supported profiles.",
31
+ "leftOperandNotSupported": "Constraint leftOperand \"{leftOperand}\" is a recognised ODRL built-in but is not yet supported by this arbiter."
32
+ },
33
+ "defaultPolicyEnforcementProcessor": {
34
+ "targetNotJsonPath": "The policy decision target \"{target}\" is not a valid JSON-path string, it should be a minimum of $.",
35
+ "replaceValueMissing": "The policy decision replaceValue was not provided for target \"{target}\"."
5
36
  }
6
37
  },
7
38
  "info": {
8
39
  "identityPolicyInformationSource": {
9
- "identityRetrieving": "Retrieving identity information for locator: \"{locator}\""
40
+ "identityRetrieving": "Retrieving identity \"{id}\" information for policy id: \"{policyId}\""
41
+ },
42
+ "identityProfilePolicyInformationSource": {
43
+ "profileRetrieving": "Retrieving identity profile \"{id}\" information for policy id: \"{policyId}\""
10
44
  },
11
45
  "staticPolicyInformationSource": {
12
- "staticRetrieving": "Retrieving static policy information for locator \"{locator}\" with access mode: \"{accessMode}\"",
13
- "staticRetrieved": "Retrieved static policy information for locator: \"{locator}\" with access mode: \"{accessMode}\", item count: {itemCount}"
46
+ "staticRetrieving": "Retrieving static policy information for policy id: \"{policyId}\" with access mode: \"{accessMode}\"",
47
+ "staticRetrieved": "Retrieved static policy information for policy id: \"{policyId}\" with access mode: \"{accessMode}\", item count: {itemCount}"
14
48
  },
15
49
  "loggingPolicyExecutionAction": {
16
- "policyActionExecutedBefore": "Policy executed for locator: \"{locator}\", stage: \"{stage}\", data: \"{data}\", policies: \"{policies}\"",
17
- "policyActionExecutedAfter": "Policy executed for locator: \"{locator}\", stage: \"{stage}\", data: \"{data}\", policies: \"{policies}\", decisions: \"{decisions}\""
50
+ "policyActionExecutedBefore": "Policy executed for policyId: \"{policyId}\", stage: \"{stage}\", data: \"{data}\", policy: \"{policy}\", decisions: \"{decisions}\"",
51
+ "policyActionExecutedAfter": "Policy executed for policyId: \"{policyId}\", stage: \"{stage}\", data: \"{data}\", policy: \"{policy}\", decisions: \"{decisions}\""
52
+ },
53
+ "passThroughPolicyEnforcementProcessor": {
54
+ "processingPolicy": "Processing policy enforcement for policy id: \"{policyId}\""
55
+ },
56
+ "defaultPolicyEnforcementProcessor": {
57
+ "processingPolicy": "Processing policy enforcement for policy id: \"{policyId}\""
58
+ },
59
+ "passThroughPolicyArbiter": {
60
+ "decidingPolicy": "Deciding policy for policy id: \"{policyId}\""
61
+ },
62
+ "defaultPolicyArbiter": {
63
+ "decidingPolicy": "Deciding policy for policy id: \"{policyId}\""
64
+ },
65
+ "passThroughPolicyNegotiator": {
66
+ "handlingOffer": "Handling offer negotiation for offer id: \"{offerId}\"",
67
+ "createAgreement": "Creating agreement for policy id: \"{offerId}\""
68
+ },
69
+ "passThroughPolicyRequester": {
70
+ "offer": "Logging offer request for offer id: \"{offerId}\", negotiation id: \"{negotiationId}\"",
71
+ "agreement": "Logging agreement request for agreement id: \"{agreementId}\", negotiation id: \"{negotiationId}\"",
72
+ "finalised": "Logging finalised request for negotiation id: \"{negotiationId}\"",
73
+ "terminated": "Logging terminated request for negotiation id: \"{negotiationId}\""
74
+ },
75
+ "passThroughPolicyObligationEnforcer": {
76
+ "enforcingDuty": "Enforcing duty for policy id: \"{policyId}\""
18
77
  }
19
78
  }
20
79
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@twin.org/rights-management-plugins",
3
- "version": "0.0.3-next.9",
4
- "description": "Rights management plugin implementations",
3
+ "version": "0.9.0",
4
+ "description": "Plugin implementations for extending rights management behaviour across components.",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "git+https://github.com/twinfoundation/rights-management.git",
7
+ "url": "git+https://github.com/iotaledger/twin-rights-management.git",
8
8
  "directory": "packages/rights-management-plugins"
9
9
  },
10
10
  "contributors": [
@@ -18,13 +18,16 @@
18
18
  "node": ">=20.0.0"
19
19
  },
20
20
  "dependencies": {
21
- "@twin.org/context": "next",
22
- "@twin.org/core": "next",
23
- "@twin.org/data-json-ld": "next",
24
- "@twin.org/logging-models": "next",
25
- "@twin.org/nameof": "next",
26
- "@twin.org/rights-management-models": "0.0.3-next.9",
27
- "@twin.org/standards-w3c-odrl": "next"
21
+ "@twin.org/automation-models": "^0.9.0",
22
+ "@twin.org/context": "^0.9.0",
23
+ "@twin.org/core": "^0.9.0",
24
+ "@twin.org/data-json-ld": "^0.9.0",
25
+ "@twin.org/data-json-path": "^0.9.0",
26
+ "@twin.org/identity-models": "^0.9.0-next.1",
27
+ "@twin.org/logging-models": "^0.9.0",
28
+ "@twin.org/nameof": "^0.9.0",
29
+ "@twin.org/rights-management-models": "^0.9.0",
30
+ "@twin.org/standards-w3c-odrl": "^0.9.0"
28
31
  },
29
32
  "main": "./dist/es/index.js",
30
33
  "types": "./dist/types/index.d.ts",
@@ -51,7 +54,7 @@
51
54
  "rights-management"
52
55
  ],
53
56
  "bugs": {
54
- "url": "git+https://github.com/twinfoundation/rights-management/issues"
57
+ "url": "git+https://github.com/iotaledger/twin-rights-management/issues"
55
58
  },
56
59
  "homepage": "https://twindev.org"
57
60
  }
@@ -1,82 +0,0 @@
1
- // Copyright 2025 IOTA Stiftung.
2
- // SPDX-License-Identifier: Apache-2.0.
3
- import { ComponentFactory } from "@twin.org/core";
4
- /**
5
- * Example Data Access Handler.
6
- */
7
- export class ExampleDataAccessHandler {
8
- /**
9
- * The class name of the Example Data Access Handler.
10
- */
11
- static CLASS_NAME = "ExampleDataAccessHandler";
12
- /**
13
- * The logging component.
14
- * @internal
15
- */
16
- _logging;
17
- /**
18
- * Create a new instance of ExampleDataAccessHandler.
19
- * @param options The options for the example policy Requester.
20
- */
21
- constructor(options) {
22
- this._logging = ComponentFactory.get(options?.loggingComponentType ?? "logging");
23
- }
24
- /**
25
- * Returns the class name of the component.
26
- * @returns The class name of the component.
27
- */
28
- className() {
29
- return ExampleDataAccessHandler.CLASS_NAME;
30
- }
31
- /**
32
- * The asset types supported by this handler.
33
- * @returns The supported asset types.
34
- */
35
- supportedAssetTypes() {
36
- return [];
37
- }
38
- /**
39
- * Create an item.
40
- * @param assetType The type of the item to create.
41
- * @param item The item to create.
42
- * @returns The id of the item created, for some items this is supplied in the `item`.
43
- */
44
- async create(assetType, item) {
45
- return "";
46
- }
47
- /**
48
- * Get an item.
49
- * @param assetType The type of the item to retrieve.
50
- * @param id The ID of the item to retrieve.
51
- * @returns The item retrieved if the policies allow it.
52
- */
53
- async get(assetType, id) {
54
- return {};
55
- }
56
- /**
57
- * Update an item.
58
- * @param assetType The type of the item to update.
59
- * @param item The item to update.
60
- * @returns Nothing.
61
- */
62
- async update(assetType, item) { }
63
- /**
64
- * Remove an item.
65
- * @param assetType The type of the item to remove.
66
- * @param id The id of the item to remove.
67
- * @returns Nothing.
68
- */
69
- async remove(assetType, id) { }
70
- /**
71
- * Query for items.
72
- * @param assetType The type of the item to query.
73
- * @param conditions The conditions to apply to the query.
74
- * @param cursor The cursor for pagination.
75
- * @param options Additional options which might be supported by the handler.
76
- * @returns The items matching the query and cursor if there are more items.
77
- */
78
- async query(assetType, conditions, cursor, options) {
79
- return { items: [] };
80
- }
81
- }
82
- //# sourceMappingURL=examplePolicyRequester.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"examplePolicyRequester.js","sourceRoot":"","sources":["../../../src/dataAccessHandlers/examplePolicyRequester.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAQlD;;GAEG;AACH,MAAM,OAAO,wBAAwB;IACpC;;OAEG;IACI,MAAM,CAAU,UAAU,8BAA8C;IAE/E;;;OAGG;IACc,QAAQ,CAAoB;IAE7C;;;OAGG;IACH,YAAY,OAAqD;QAChE,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,GAAG,CACnC,OAAO,EAAE,oBAAoB,IAAI,SAAS,CAC1C,CAAC;IACH,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,wBAAwB,CAAC,UAAU,CAAC;IAC5C,CAAC;IAED;;;OAGG;IACI,mBAAmB;QACzB,OAAO,EAAE,CAAC;IACX,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,MAAM,CAAC,SAAiB,EAAE,IAAuB;QAC7D,OAAO,EAAE,CAAC;IACX,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,GAAG,CAAC,SAAiB,EAAE,EAAU;QAC7C,OAAO,EAAE,CAAC;IACX,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,MAAM,CAAC,SAAiB,EAAE,IAAuB,IAAkB,CAAC;IAEjF;;;;;OAKG;IACI,KAAK,CAAC,MAAM,CAAC,SAAiB,EAAE,EAAU,IAAkB,CAAC;IAEpE;;;;;;;OAOG;IACI,KAAK,CAAC,KAAK,CACjB,SAAiB,EACjB,UAA0D,EAC1D,MAA0B,EAC1B,OAA4B;QAK5B,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IACtB,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type { EntityCondition } from \"@twin.org/entity\";\nimport type { ILoggingComponent } from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport type { IDataAccessHandler } from \"@twin.org/rights-management-models\";\nimport type { IExampleDataAccessHandlerConstructorOptions } from \"../models/IExampleDataAccessHandlerConstructorOptions.js\";\n\n/**\n * Example Data Access Handler.\n */\nexport class ExampleDataAccessHandler implements IDataAccessHandler {\n\t/**\n\t * The class name of the Example Data Access Handler.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<ExampleDataAccessHandler>();\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 ExampleDataAccessHandler.\n\t * @param options The options for the example policy Requester.\n\t */\n\tconstructor(options?: IExampleDataAccessHandlerConstructorOptions) {\n\t\tthis._logging = ComponentFactory.get<ILoggingComponent>(\n\t\t\toptions?.loggingComponentType ?? \"logging\"\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 ExampleDataAccessHandler.CLASS_NAME;\n\t}\n\n\t/**\n\t * The asset types supported by this handler.\n\t * @returns The supported asset types.\n\t */\n\tpublic supportedAssetTypes(): string[] {\n\t\treturn [];\n\t}\n\n\t/**\n\t * Create an item.\n\t * @param assetType The type of the item to create.\n\t * @param item The item to create.\n\t * @returns The id of the item created, for some items this is supplied in the `item`.\n\t */\n\tpublic async create(assetType: string, item: IJsonLdNodeObject): Promise<string> {\n\t\treturn \"\";\n\t}\n\n\t/**\n\t * Get an item.\n\t * @param assetType The type of the item to retrieve.\n\t * @param id The ID of the item to retrieve.\n\t * @returns The item retrieved if the policies allow it.\n\t */\n\tpublic async get(assetType: string, id: string): Promise<IJsonLdNodeObject> {\n\t\treturn {};\n\t}\n\n\t/**\n\t * Update an item.\n\t * @param assetType The type of the item to update.\n\t * @param item The item to update.\n\t * @returns Nothing.\n\t */\n\tpublic async update(assetType: string, item: IJsonLdNodeObject): Promise<void> {}\n\n\t/**\n\t * Remove an item.\n\t * @param assetType The type of the item to remove.\n\t * @param id The id of the item to remove.\n\t * @returns Nothing.\n\t */\n\tpublic async remove(assetType: string, id: string): Promise<void> {}\n\n\t/**\n\t * Query for items.\n\t * @param assetType The type of the item to query.\n\t * @param conditions The conditions to apply to the query.\n\t * @param cursor The cursor for pagination.\n\t * @param options Additional options which might be supported by the handler.\n\t * @returns The items matching the query and cursor if there are more items.\n\t */\n\tpublic async query(\n\t\tassetType: string,\n\t\tconditions: EntityCondition<IJsonLdNodeObject> | undefined,\n\t\tcursor: string | undefined,\n\t\toptions: unknown | undefined\n\t): Promise<{\n\t\titems: IJsonLdNodeObject[];\n\t\tcursor?: string;\n\t}> {\n\t\treturn { items: [] };\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"IExampleDataAccessHandlerConstructorOptions.js","sourceRoot":"","sources":["../../../src/models/IExampleDataAccessHandlerConstructorOptions.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 Example Data Access Handler.\n */\nexport interface IExampleDataAccessHandlerConstructorOptions {\n\t/**\n\t * The logging component for data access handler.\n\t * @default logging\n\t */\n\tloggingComponentType?: string;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"IExamplePolicyArbiterConstructorOptions.js","sourceRoot":"","sources":["../../../src/models/IExamplePolicyArbiterConstructorOptions.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 Example Policy Arbiter.\n */\nexport interface IExamplePolicyArbiterConstructorOptions {\n\t/**\n\t * The logging component for policy arbiter.\n\t * @default logging\n\t */\n\tloggingComponentType?: string;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"IExamplePolicyEnforcementProcessorConstructorOptions.js","sourceRoot":"","sources":["../../../src/models/IExamplePolicyEnforcementProcessorConstructorOptions.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 Example Policy Enforcement Processor.\n */\nexport interface IExamplePolicyEnforcementProcessorConstructorOptions {\n\t/**\n\t * The logging component for policy enforcement processor.\n\t * @default logging\n\t */\n\tloggingComponentType?: string;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"IExamplePolicyNegotiatorConstructorOptions.js","sourceRoot":"","sources":["../../../src/models/IExamplePolicyNegotiatorConstructorOptions.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 Example Policy Negotiator.\n */\nexport interface IExamplePolicyNegotiatorConstructorOptions {\n\t/**\n\t * The logging component for policy negotiator.\n\t * @default logging\n\t */\n\tloggingComponentType?: string;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"IExamplePolicyRequesterConstructorOptions.js","sourceRoot":"","sources":["../../../src/models/IExamplePolicyRequesterConstructorOptions.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 Example Policy Requester.\n */\nexport interface IExamplePolicyRequesterConstructorOptions {\n\t/**\n\t * The logging component for policy requester.\n\t * @default logging\n\t */\n\tloggingComponentType?: string;\n}\n"]}
@@ -1,50 +0,0 @@
1
- // Copyright 2025 IOTA Stiftung.
2
- // SPDX-License-Identifier: Apache-2.0.
3
- import { ComponentFactory } from "@twin.org/core";
4
- /**
5
- * Example Policy Arbiter.
6
- */
7
- export class ExamplePolicyArbiter {
8
- /**
9
- * The class name of the Example Policy Arbiter.
10
- */
11
- static CLASS_NAME = "ExamplePolicyArbiter";
12
- /**
13
- * The logging component.
14
- * @internal
15
- */
16
- _logging;
17
- /**
18
- * Create a new instance of ExamplePolicyArbiter.
19
- * @param options The options for the example policy arbiter.
20
- */
21
- constructor(options) {
22
- this._logging = ComponentFactory.get(options?.loggingComponentType ?? "logging");
23
- }
24
- /**
25
- * Returns the class name of the component.
26
- * @returns The class name of the component.
27
- */
28
- className() {
29
- return ExamplePolicyArbiter.CLASS_NAME;
30
- }
31
- /**
32
- * The policies supported by this arbiter.
33
- * @returns The supported policies, if empty can be used for all.
34
- */
35
- supportedPolicies() {
36
- return [];
37
- }
38
- /**
39
- * Makes decisions regarding policy access to data.
40
- * @param locator The locator to find relevant policies.
41
- * @param information Information provided by the requester to determine if a policy can be created.
42
- * @param policies The policies that apply to the data.
43
- * @param data The data to make a decision on.
44
- * @returns The decisions about access to the data.
45
- */
46
- async decide(locator, information, policies, data) {
47
- return [];
48
- }
49
- }
50
- //# sourceMappingURL=examplePolicyArbiter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"examplePolicyArbiter.js","sourceRoot":"","sources":["../../../src/policyArbiters/examplePolicyArbiter.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAYlD;;GAEG;AACH,MAAM,OAAO,oBAAoB;IAChC;;OAEG;IACI,MAAM,CAAU,UAAU,0BAA0C;IAE3E;;;OAGG;IACc,QAAQ,CAAoB;IAE7C;;;OAGG;IACH,YAAY,OAAiD;QAC5D,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,GAAG,CACnC,OAAO,EAAE,oBAAoB,IAAI,SAAS,CAC1C,CAAC;IACH,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,oBAAoB,CAAC,UAAU,CAAC;IACxC,CAAC;IAED;;;OAGG;IACI,iBAAiB;QACvB,OAAO,EAAE,CAAC;IACX,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,MAAM,CAClB,OAAuB,EACvB,WAAgC,EAChC,QAAwB,EACxB,IAAQ;QAER,OAAO,EAAE,CAAC;IACX,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory } from \"@twin.org/core\";\nimport type { ILoggingComponent } from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport type {\n\tIPolicyArbiter,\n\tIPolicyDecision,\n\tIPolicyInformation,\n\tIPolicyLocator\n} from \"@twin.org/rights-management-models\";\nimport type { IOdrlPolicy } from \"@twin.org/standards-w3c-odrl\";\nimport type { IExamplePolicyArbiterConstructorOptions } from \"../models/IExamplePolicyArbiterConstructorOptions.js\";\n\n/**\n * Example Policy Arbiter.\n */\nexport class ExamplePolicyArbiter implements IPolicyArbiter {\n\t/**\n\t * The class name of the Example Policy Arbiter.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<ExamplePolicyArbiter>();\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 ExamplePolicyArbiter.\n\t * @param options The options for the example policy arbiter.\n\t */\n\tconstructor(options?: IExamplePolicyArbiterConstructorOptions) {\n\t\tthis._logging = ComponentFactory.get<ILoggingComponent>(\n\t\t\toptions?.loggingComponentType ?? \"logging\"\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 ExamplePolicyArbiter.CLASS_NAME;\n\t}\n\n\t/**\n\t * The policies supported by this arbiter.\n\t * @returns The supported policies, if empty can be used for all.\n\t */\n\tpublic supportedPolicies(): IPolicyLocator[] {\n\t\treturn [];\n\t}\n\n\t/**\n\t * Makes decisions regarding policy access to data.\n\t * @param locator The locator to find relevant policies.\n\t * @param information Information provided by the requester to determine if a policy can be created.\n\t * @param policies The policies that apply to the data.\n\t * @param data The data to make a decision on.\n\t * @returns The decisions about access to the data.\n\t */\n\tpublic async decide<D = unknown>(\n\t\tlocator: IPolicyLocator,\n\t\tinformation?: IPolicyInformation,\n\t\tpolicies?: IOdrlPolicy[],\n\t\tdata?: D\n\t): Promise<IPolicyDecision[]> {\n\t\treturn [];\n\t}\n}\n"]}
@@ -1,42 +0,0 @@
1
- // Copyright 2025 IOTA Stiftung.
2
- // SPDX-License-Identifier: Apache-2.0.
3
- import { ComponentFactory } from "@twin.org/core";
4
- /**
5
- * Example Policy Enforcement Processor.
6
- */
7
- export class ExamplePolicyEnforcementProcessor {
8
- /**
9
- * The class name of the Example Policy Enforcement Processor.
10
- */
11
- static CLASS_NAME = "ExamplePolicyEnforcementProcessor";
12
- /**
13
- * The logging component.
14
- * @internal
15
- */
16
- _logging;
17
- /**
18
- * Create a new instance of ExamplePolicyEnforcementProcessor.
19
- * @param options The options for the example policy enforcement processor.
20
- */
21
- constructor(options) {
22
- this._logging = ComponentFactory.get(options?.loggingComponentType ?? "logging");
23
- }
24
- /**
25
- * Returns the class name of the component.
26
- * @returns The class name of the component.
27
- */
28
- className() {
29
- return ExamplePolicyEnforcementProcessor.CLASS_NAME;
30
- }
31
- /**
32
- * Process the response from the policy decision point.
33
- * @param locator The locator to find relevant policies.
34
- * @param decisions The decisions made by the policy decision point.
35
- * @param data The data to process.
36
- * @returns The data after processing.
37
- */
38
- async process(locator, decisions, data) {
39
- return data;
40
- }
41
- }
42
- //# sourceMappingURL=examplePolicyEnforcementProcessor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"examplePolicyEnforcementProcessor.js","sourceRoot":"","sources":["../../../src/policyEnforcementProcessor/examplePolicyEnforcementProcessor.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAUlD;;GAEG;AACH,MAAM,OAAO,iCAAiC;IAC7C;;OAEG;IACI,MAAM,CAAU,UAAU,uCAAuD;IAExF;;;OAGG;IACc,QAAQ,CAAoB;IAE7C;;;OAGG;IACH,YAAY,OAA8D;QACzE,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,GAAG,CACnC,OAAO,EAAE,oBAAoB,IAAI,SAAS,CAC1C,CAAC;IACH,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,iCAAiC,CAAC,UAAU,CAAC;IACrD,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,OAAO,CACnB,OAAuB,EACvB,SAA4B,EAC5B,IAAQ;QAER,OAAO,IAAoB,CAAC;IAC7B,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory } from \"@twin.org/core\";\nimport type { ILoggingComponent } from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport type {\n\tIPolicyDecision,\n\tIPolicyEnforcementProcessor,\n\tIPolicyLocator\n} from \"@twin.org/rights-management-models\";\nimport type { IExamplePolicyEnforcementProcessorConstructorOptions } from \"../models/IExamplePolicyEnforcementProcessorConstructorOptions.js\";\n\n/**\n * Example Policy Enforcement Processor.\n */\nexport class ExamplePolicyEnforcementProcessor implements IPolicyEnforcementProcessor {\n\t/**\n\t * The class name of the Example Policy Enforcement Processor.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<ExamplePolicyEnforcementProcessor>();\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 ExamplePolicyEnforcementProcessor.\n\t * @param options The options for the example policy enforcement processor.\n\t */\n\tconstructor(options?: IExamplePolicyEnforcementProcessorConstructorOptions) {\n\t\tthis._logging = ComponentFactory.get<ILoggingComponent>(\n\t\t\toptions?.loggingComponentType ?? \"logging\"\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 ExamplePolicyEnforcementProcessor.CLASS_NAME;\n\t}\n\n\t/**\n\t * Process the response from the policy decision point.\n\t * @param locator The locator to find relevant policies.\n\t * @param decisions The decisions made by the policy decision point.\n\t * @param data The data to process.\n\t * @returns The data after processing.\n\t */\n\tpublic async process<D = unknown, R = D>(\n\t\tlocator: IPolicyLocator,\n\t\tdecisions: IPolicyDecision[],\n\t\tdata?: D\n\t): Promise<R> {\n\t\treturn data as unknown as R;\n\t}\n}\n"]}
@@ -1,61 +0,0 @@
1
- // Copyright 2025 IOTA Stiftung.
2
- // SPDX-License-Identifier: Apache-2.0.
3
- import { ComponentFactory } from "@twin.org/core";
4
- /**
5
- * Example Policy Negotiator.
6
- */
7
- export class ExamplePolicyNegotiator {
8
- /**
9
- * The class name of the Example Policy Negotiator.
10
- */
11
- static CLASS_NAME = "ExamplePolicyNegotiator";
12
- /**
13
- * The logging component.
14
- * @internal
15
- */
16
- _logging;
17
- /**
18
- * Create a new instance of ExamplePolicyNegotiator.
19
- * @param options The options for the example policy negotiator.
20
- */
21
- constructor(options) {
22
- this._logging = ComponentFactory.get(options?.loggingComponentType ?? "logging");
23
- }
24
- /**
25
- * Returns the class name of the component.
26
- * @returns The class name of the component.
27
- */
28
- className() {
29
- return ExamplePolicyNegotiator.CLASS_NAME;
30
- }
31
- /**
32
- * Determines if the negotiator supports the given offer.
33
- * @param offer The offer to check.
34
- * @returns Sets the supports flag if it can be offered, and the interventionRequired flag if manual agreement is needed.
35
- */
36
- supportsOffer(offer) {
37
- return true;
38
- }
39
- /**
40
- * Handle the offer.
41
- * @param offer The offer to check.
42
- * @param information Information provided by the requester to determine if a policy can be created.
43
- * @returns Sets the accepted flag if it can be offered, and the interventionRequired flag if manual agreement is needed.
44
- */
45
- async handleOffer(offer, information) {
46
- return {
47
- accepted: true,
48
- interventionRequired: false
49
- };
50
- }
51
- /**
52
- * Create an agreement based on the offer.
53
- * @param offer The offer to create the agreement from.
54
- * @param information Information provided by the requester to aid in the creation of the agreement.
55
- * @returns The agreement created from the offer or undefined if an agreement could not be created.
56
- */
57
- async createAgreement(offer, information) {
58
- return undefined;
59
- }
60
- }
61
- //# sourceMappingURL=examplePolicyNegotiator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"examplePolicyNegotiator.js","sourceRoot":"","sources":["../../../src/policyNegotiators/examplePolicyNegotiator.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAOlD;;GAEG;AACH,MAAM,OAAO,uBAAuB;IACnC;;OAEG;IACI,MAAM,CAAU,UAAU,6BAA6C;IAE9E;;;OAGG;IACc,QAAQ,CAAoB;IAE7C;;;OAGG;IACH,YAAY,OAAoD;QAC/D,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,GAAG,CACnC,OAAO,EAAE,oBAAoB,IAAI,SAAS,CAC1C,CAAC;IACH,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,uBAAuB,CAAC,UAAU,CAAC;IAC3C,CAAC;IAED;;;;OAIG;IACI,aAAa,CAAC,KAAiB;QACrC,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,WAAW,CACvB,KAAiB,EACjB,WAAgC;QAKhC,OAAO;YACN,QAAQ,EAAE,IAAI;YACd,oBAAoB,EAAE,KAAK;SAC3B,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,eAAe,CAC3B,KAAiB,EACjB,WAAgC;QAEhC,OAAO,SAAS,CAAC;IAClB,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory } from \"@twin.org/core\";\nimport type { ILoggingComponent } from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport type { IPolicyInformation, IPolicyNegotiator } from \"@twin.org/rights-management-models\";\nimport type { IOdrlAgreement, IOdrlOffer } from \"@twin.org/standards-w3c-odrl\";\nimport type { IExamplePolicyNegotiatorConstructorOptions } from \"../models/IExamplePolicyNegotiatorConstructorOptions.js\";\n\n/**\n * Example Policy Negotiator.\n */\nexport class ExamplePolicyNegotiator implements IPolicyNegotiator {\n\t/**\n\t * The class name of the Example Policy Negotiator.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<ExamplePolicyNegotiator>();\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 ExamplePolicyNegotiator.\n\t * @param options The options for the example policy negotiator.\n\t */\n\tconstructor(options?: IExamplePolicyNegotiatorConstructorOptions) {\n\t\tthis._logging = ComponentFactory.get<ILoggingComponent>(\n\t\t\toptions?.loggingComponentType ?? \"logging\"\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 ExamplePolicyNegotiator.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 Sets the supports flag if it can be offered, and the interventionRequired flag if manual agreement is needed.\n\t */\n\tpublic supportsOffer(offer: IOdrlOffer): boolean {\n\t\treturn true;\n\t}\n\n\t/**\n\t * Handle the offer.\n\t * @param offer The offer to check.\n\t * @param information Information provided by the requester to determine if a policy can be created.\n\t * @returns Sets the accepted flag if it can be offered, and the interventionRequired flag if manual agreement is needed.\n\t */\n\tpublic async handleOffer(\n\t\toffer: IOdrlOffer,\n\t\tinformation?: IPolicyInformation\n\t): Promise<{\n\t\taccepted: boolean;\n\t\tinterventionRequired: boolean;\n\t}> {\n\t\treturn {\n\t\t\taccepted: true,\n\t\t\tinterventionRequired: false\n\t\t};\n\t}\n\n\t/**\n\t * Create an agreement based on the offer.\n\t * @param offer The offer to create the agreement from.\n\t * @param 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: IOdrlOffer,\n\t\tinformation?: IPolicyInformation\n\t): Promise<IOdrlAgreement | undefined> {\n\t\treturn undefined;\n\t}\n}\n"]}
@@ -1,69 +0,0 @@
1
- // Copyright 2025 IOTA Stiftung.
2
- // SPDX-License-Identifier: Apache-2.0.
3
- import { ComponentFactory } from "@twin.org/core";
4
- /**
5
- * Example Policy Requester.
6
- */
7
- export class ExamplePolicyRequester {
8
- /**
9
- * The class name of the Example Policy Requester.
10
- */
11
- static CLASS_NAME = "ExamplePolicyRequester";
12
- /**
13
- * The logging component.
14
- * @internal
15
- */
16
- _logging;
17
- /**
18
- * Create a new instance of ExamplePolicyRequester.
19
- * @param options The options for the example policy Requester.
20
- */
21
- constructor(options) {
22
- this._logging = ComponentFactory.get(options?.loggingComponentType ?? "logging");
23
- }
24
- /**
25
- * Returns the class name of the component.
26
- * @returns The class name of the component.
27
- */
28
- className() {
29
- return ExamplePolicyRequester.CLASS_NAME;
30
- }
31
- /**
32
- * The unique id of the requester.
33
- * @returns The requester id.
34
- */
35
- requesterId() {
36
- return "";
37
- }
38
- /**
39
- * A policy has been offered by a provider, let the requester know about it.
40
- * @param negotiationId The id of the negotiation.
41
- * @param offer The offer sent by the provider.
42
- * @returns True if the offer was accepted, false otherwise.
43
- */
44
- async offer(negotiationId, offer) {
45
- return true;
46
- }
47
- /**
48
- * A policy agreement has been sent by a provider, let the requester know about it.
49
- * @param negotiationId The id of the negotiation.
50
- * @param agreement The agreement sent by the provider.
51
- * @returns True if the agreement was accepted, false otherwise.
52
- */
53
- async agreement(negotiationId, agreement) {
54
- return true;
55
- }
56
- /**
57
- * A policy finalisation has been sent by a provider, let the requester know about it.
58
- * @param negotiationId The id of the negotiation.
59
- * @returns Nothing.
60
- */
61
- async finalised(negotiationId) { }
62
- /**
63
- * A policy termination has been sent by a provider, let the requester know about it.
64
- * @param negotiationId The id of the negotiation.
65
- * @returns Nothing.
66
- */
67
- async terminated(negotiationId) { }
68
- }
69
- //# sourceMappingURL=examplePolicyRequester.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"examplePolicyRequester.js","sourceRoot":"","sources":["../../../src/policyRequesters/examplePolicyRequester.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAOlD;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAClC;;OAEG;IACI,MAAM,CAAU,UAAU,4BAA4C;IAE7E;;;OAGG;IACc,QAAQ,CAAoB;IAE7C;;;OAGG;IACH,YAAY,OAAmD;QAC9D,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,GAAG,CACnC,OAAO,EAAE,oBAAoB,IAAI,SAAS,CAC1C,CAAC;IACH,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,sBAAsB,CAAC,UAAU,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACI,WAAW;QACjB,OAAO,EAAE,CAAC;IACX,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,KAAK,CAAC,aAAqB,EAAE,KAAiB;QAC1D,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,SAAS,CAAC,aAAqB,EAAE,SAAyB;QACtE,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,SAAS,CAAC,aAAqB,IAAkB,CAAC;IAE/D;;;;OAIG;IACI,KAAK,CAAC,UAAU,CAAC,aAAqB,IAAkB,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory } from \"@twin.org/core\";\nimport type { ILoggingComponent } from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport type { IPolicyRequester } from \"@twin.org/rights-management-models\";\nimport type { IOdrlAgreement, IOdrlOffer } from \"@twin.org/standards-w3c-odrl\";\nimport type { IExamplePolicyRequesterConstructorOptions } from \"../models/IExamplePolicyRequesterConstructorOptions.js\";\n\n/**\n * Example Policy Requester.\n */\nexport class ExamplePolicyRequester implements IPolicyRequester {\n\t/**\n\t * The class name of the Example Policy Requester.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<ExamplePolicyRequester>();\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 ExamplePolicyRequester.\n\t * @param options The options for the example policy Requester.\n\t */\n\tconstructor(options?: IExamplePolicyRequesterConstructorOptions) {\n\t\tthis._logging = ComponentFactory.get<ILoggingComponent>(\n\t\t\toptions?.loggingComponentType ?? \"logging\"\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 ExamplePolicyRequester.CLASS_NAME;\n\t}\n\n\t/**\n\t * The unique id of the requester.\n\t * @returns The requester id.\n\t */\n\tpublic requesterId(): string {\n\t\treturn \"\";\n\t}\n\n\t/**\n\t * A policy has been offered by a provider, let the requester 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: IOdrlOffer): Promise<boolean> {\n\t\treturn true;\n\t}\n\n\t/**\n\t * A policy agreement has been sent by a provider, let the requester 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(negotiationId: string, agreement: IOdrlAgreement): Promise<boolean> {\n\t\treturn true;\n\t}\n\n\t/**\n\t * A policy finalisation has been sent by a provider, let the requester know about it.\n\t * @param negotiationId The id of the negotiation.\n\t * @returns Nothing.\n\t */\n\tpublic async finalised(negotiationId: string): Promise<void> {}\n\n\t/**\n\t * A policy termination has been sent by a provider, let the requester know about it.\n\t * @param negotiationId The id of the negotiation.\n\t * @returns Nothing.\n\t */\n\tpublic async terminated(negotiationId: string): Promise<void> {}\n}\n"]}