@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
@@ -1,68 +0,0 @@
1
- import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
- import type { EntityCondition } from "@twin.org/entity";
3
- import type { IDataAccessHandler } from "@twin.org/rights-management-models";
4
- import type { IExampleDataAccessHandlerConstructorOptions } from "../models/IExampleDataAccessHandlerConstructorOptions.js";
5
- /**
6
- * Example Data Access Handler.
7
- */
8
- export declare class ExampleDataAccessHandler implements IDataAccessHandler {
9
- /**
10
- * The class name of the Example Data Access Handler.
11
- */
12
- static readonly CLASS_NAME: string;
13
- /**
14
- * Create a new instance of ExampleDataAccessHandler.
15
- * @param options The options for the example policy Requester.
16
- */
17
- constructor(options?: IExampleDataAccessHandlerConstructorOptions);
18
- /**
19
- * Returns the class name of the component.
20
- * @returns The class name of the component.
21
- */
22
- className(): string;
23
- /**
24
- * The asset types supported by this handler.
25
- * @returns The supported asset types.
26
- */
27
- supportedAssetTypes(): string[];
28
- /**
29
- * Create an item.
30
- * @param assetType The type of the item to create.
31
- * @param item The item to create.
32
- * @returns The id of the item created, for some items this is supplied in the `item`.
33
- */
34
- create(assetType: string, item: IJsonLdNodeObject): Promise<string>;
35
- /**
36
- * Get an item.
37
- * @param assetType The type of the item to retrieve.
38
- * @param id The ID of the item to retrieve.
39
- * @returns The item retrieved if the policies allow it.
40
- */
41
- get(assetType: string, id: string): Promise<IJsonLdNodeObject>;
42
- /**
43
- * Update an item.
44
- * @param assetType The type of the item to update.
45
- * @param item The item to update.
46
- * @returns Nothing.
47
- */
48
- update(assetType: string, item: IJsonLdNodeObject): Promise<void>;
49
- /**
50
- * Remove an item.
51
- * @param assetType The type of the item to remove.
52
- * @param id The id of the item to remove.
53
- * @returns Nothing.
54
- */
55
- remove(assetType: string, id: string): Promise<void>;
56
- /**
57
- * Query for items.
58
- * @param assetType The type of the item to query.
59
- * @param conditions The conditions to apply to the query.
60
- * @param cursor The cursor for pagination.
61
- * @param options Additional options which might be supported by the handler.
62
- * @returns The items matching the query and cursor if there are more items.
63
- */
64
- query(assetType: string, conditions: EntityCondition<IJsonLdNodeObject> | undefined, cursor: string | undefined, options: unknown | undefined): Promise<{
65
- items: IJsonLdNodeObject[];
66
- cursor?: string;
67
- }>;
68
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * Options for the Example Data Access Handler.
3
- */
4
- export interface IExampleDataAccessHandlerConstructorOptions {
5
- /**
6
- * The logging component for data access handler.
7
- * @default logging
8
- */
9
- loggingComponentType?: string;
10
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * Options for the Example Policy Arbiter.
3
- */
4
- export interface IExamplePolicyArbiterConstructorOptions {
5
- /**
6
- * The logging component for policy arbiter.
7
- * @default logging
8
- */
9
- loggingComponentType?: string;
10
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * Options for the Example Policy Enforcement Processor.
3
- */
4
- export interface IExamplePolicyEnforcementProcessorConstructorOptions {
5
- /**
6
- * The logging component for policy enforcement processor.
7
- * @default logging
8
- */
9
- loggingComponentType?: string;
10
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * Options for the Example Policy Negotiator.
3
- */
4
- export interface IExamplePolicyNegotiatorConstructorOptions {
5
- /**
6
- * The logging component for policy negotiator.
7
- * @default logging
8
- */
9
- loggingComponentType?: string;
10
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * Options for the Example Policy Requester.
3
- */
4
- export interface IExamplePolicyRequesterConstructorOptions {
5
- /**
6
- * The logging component for policy requester.
7
- * @default logging
8
- */
9
- loggingComponentType?: string;
10
- }
@@ -1,36 +0,0 @@
1
- import type { IPolicyArbiter, IPolicyDecision, IPolicyInformation, IPolicyLocator } from "@twin.org/rights-management-models";
2
- import type { IOdrlPolicy } from "@twin.org/standards-w3c-odrl";
3
- import type { IExamplePolicyArbiterConstructorOptions } from "../models/IExamplePolicyArbiterConstructorOptions.js";
4
- /**
5
- * Example Policy Arbiter.
6
- */
7
- export declare class ExamplePolicyArbiter implements IPolicyArbiter {
8
- /**
9
- * The class name of the Example Policy Arbiter.
10
- */
11
- static readonly CLASS_NAME: string;
12
- /**
13
- * Create a new instance of ExamplePolicyArbiter.
14
- * @param options The options for the example policy arbiter.
15
- */
16
- constructor(options?: IExamplePolicyArbiterConstructorOptions);
17
- /**
18
- * Returns the class name of the component.
19
- * @returns The class name of the component.
20
- */
21
- className(): string;
22
- /**
23
- * The policies supported by this arbiter.
24
- * @returns The supported policies, if empty can be used for all.
25
- */
26
- supportedPolicies(): IPolicyLocator[];
27
- /**
28
- * Makes decisions regarding policy access to data.
29
- * @param locator The locator to find relevant policies.
30
- * @param information Information provided by the requester to determine if a policy can be created.
31
- * @param policies The policies that apply to the data.
32
- * @param data The data to make a decision on.
33
- * @returns The decisions about access to the data.
34
- */
35
- decide<D = unknown>(locator: IPolicyLocator, information?: IPolicyInformation, policies?: IOdrlPolicy[], data?: D): Promise<IPolicyDecision[]>;
36
- }
@@ -1,29 +0,0 @@
1
- import type { IPolicyDecision, IPolicyEnforcementProcessor, IPolicyLocator } from "@twin.org/rights-management-models";
2
- import type { IExamplePolicyEnforcementProcessorConstructorOptions } from "../models/IExamplePolicyEnforcementProcessorConstructorOptions.js";
3
- /**
4
- * Example Policy Enforcement Processor.
5
- */
6
- export declare class ExamplePolicyEnforcementProcessor implements IPolicyEnforcementProcessor {
7
- /**
8
- * The class name of the Example Policy Enforcement Processor.
9
- */
10
- static readonly CLASS_NAME: string;
11
- /**
12
- * Create a new instance of ExamplePolicyEnforcementProcessor.
13
- * @param options The options for the example policy enforcement processor.
14
- */
15
- constructor(options?: IExamplePolicyEnforcementProcessorConstructorOptions);
16
- /**
17
- * Returns the class name of the component.
18
- * @returns The class name of the component.
19
- */
20
- className(): string;
21
- /**
22
- * Process the response from the policy decision point.
23
- * @param locator The locator to find relevant policies.
24
- * @param decisions The decisions made by the policy decision point.
25
- * @param data The data to process.
26
- * @returns The data after processing.
27
- */
28
- process<D = unknown, R = D>(locator: IPolicyLocator, decisions: IPolicyDecision[], data?: D): Promise<R>;
29
- }
@@ -1,45 +0,0 @@
1
- import type { IPolicyInformation, IPolicyNegotiator } from "@twin.org/rights-management-models";
2
- import type { IOdrlAgreement, IOdrlOffer } from "@twin.org/standards-w3c-odrl";
3
- import type { IExamplePolicyNegotiatorConstructorOptions } from "../models/IExamplePolicyNegotiatorConstructorOptions.js";
4
- /**
5
- * Example Policy Negotiator.
6
- */
7
- export declare class ExamplePolicyNegotiator implements IPolicyNegotiator {
8
- /**
9
- * The class name of the Example Policy Negotiator.
10
- */
11
- static readonly CLASS_NAME: string;
12
- /**
13
- * Create a new instance of ExamplePolicyNegotiator.
14
- * @param options The options for the example policy negotiator.
15
- */
16
- constructor(options?: IExamplePolicyNegotiatorConstructorOptions);
17
- /**
18
- * Returns the class name of the component.
19
- * @returns The class name of the component.
20
- */
21
- className(): string;
22
- /**
23
- * Determines if the negotiator supports the given offer.
24
- * @param offer The offer to check.
25
- * @returns Sets the supports flag if it can be offered, and the interventionRequired flag if manual agreement is needed.
26
- */
27
- supportsOffer(offer: IOdrlOffer): boolean;
28
- /**
29
- * Handle the offer.
30
- * @param offer The offer to check.
31
- * @param information Information provided by the requester to determine if a policy can be created.
32
- * @returns Sets the accepted flag if it can be offered, and the interventionRequired flag if manual agreement is needed.
33
- */
34
- handleOffer(offer: IOdrlOffer, information?: IPolicyInformation): Promise<{
35
- accepted: boolean;
36
- interventionRequired: boolean;
37
- }>;
38
- /**
39
- * Create an agreement based on the offer.
40
- * @param offer The offer to create the agreement from.
41
- * @param information Information provided by the requester to aid in the creation of the agreement.
42
- * @returns The agreement created from the offer or undefined if an agreement could not be created.
43
- */
44
- createAgreement(offer: IOdrlOffer, information?: IPolicyInformation): Promise<IOdrlAgreement | undefined>;
45
- }
@@ -1,53 +0,0 @@
1
- import type { IPolicyRequester } from "@twin.org/rights-management-models";
2
- import type { IOdrlAgreement, IOdrlOffer } from "@twin.org/standards-w3c-odrl";
3
- import type { IExamplePolicyRequesterConstructorOptions } from "../models/IExamplePolicyRequesterConstructorOptions.js";
4
- /**
5
- * Example Policy Requester.
6
- */
7
- export declare class ExamplePolicyRequester implements IPolicyRequester {
8
- /**
9
- * The class name of the Example Policy Requester.
10
- */
11
- static readonly CLASS_NAME: string;
12
- /**
13
- * Create a new instance of ExamplePolicyRequester.
14
- * @param options The options for the example policy Requester.
15
- */
16
- constructor(options?: IExamplePolicyRequesterConstructorOptions);
17
- /**
18
- * Returns the class name of the component.
19
- * @returns The class name of the component.
20
- */
21
- className(): string;
22
- /**
23
- * The unique id of the requester.
24
- * @returns The requester id.
25
- */
26
- requesterId(): string;
27
- /**
28
- * A policy has been offered by a provider, let the requester know about it.
29
- * @param negotiationId The id of the negotiation.
30
- * @param offer The offer sent by the provider.
31
- * @returns True if the offer was accepted, false otherwise.
32
- */
33
- offer(negotiationId: string, offer: IOdrlOffer): Promise<boolean>;
34
- /**
35
- * A policy agreement has been sent by a provider, let the requester know about it.
36
- * @param negotiationId The id of the negotiation.
37
- * @param agreement The agreement sent by the provider.
38
- * @returns True if the agreement was accepted, false otherwise.
39
- */
40
- agreement(negotiationId: string, agreement: IOdrlAgreement): Promise<boolean>;
41
- /**
42
- * A policy finalisation has been sent by a provider, let the requester know about it.
43
- * @param negotiationId The id of the negotiation.
44
- * @returns Nothing.
45
- */
46
- finalised(negotiationId: string): Promise<void>;
47
- /**
48
- * A policy termination has been sent by a provider, let the requester know about it.
49
- * @param negotiationId The id of the negotiation.
50
- * @returns Nothing.
51
- */
52
- terminated(negotiationId: string): Promise<void>;
53
- }
@@ -1,243 +0,0 @@
1
- # Class: ExampleDataAccessHandler
2
-
3
- Example Data Access Handler.
4
-
5
- ## Implements
6
-
7
- - `IDataAccessHandler`
8
-
9
- ## Constructors
10
-
11
- ### Constructor
12
-
13
- > **new ExampleDataAccessHandler**(`options?`): `ExampleDataAccessHandler`
14
-
15
- Create a new instance of ExampleDataAccessHandler.
16
-
17
- #### Parameters
18
-
19
- ##### options?
20
-
21
- [`IExampleDataAccessHandlerConstructorOptions`](../interfaces/IExampleDataAccessHandlerConstructorOptions.md)
22
-
23
- The options for the example policy Requester.
24
-
25
- #### Returns
26
-
27
- `ExampleDataAccessHandler`
28
-
29
- ## Properties
30
-
31
- ### CLASS\_NAME
32
-
33
- > `readonly` `static` **CLASS\_NAME**: `string`
34
-
35
- The class name of the Example Data Access Handler.
36
-
37
- ## Methods
38
-
39
- ### 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
- `IDataAccessHandler.className`
54
-
55
- ***
56
-
57
- ### supportedAssetTypes()
58
-
59
- > **supportedAssetTypes**(): `string`[]
60
-
61
- The asset types supported by this handler.
62
-
63
- #### Returns
64
-
65
- `string`[]
66
-
67
- The supported asset types.
68
-
69
- #### Implementation of
70
-
71
- `IDataAccessHandler.supportedAssetTypes`
72
-
73
- ***
74
-
75
- ### create()
76
-
77
- > **create**(`assetType`, `item`): `Promise`\<`string`\>
78
-
79
- Create an item.
80
-
81
- #### Parameters
82
-
83
- ##### assetType
84
-
85
- `string`
86
-
87
- The type of the item to create.
88
-
89
- ##### item
90
-
91
- `IJsonLdNodeObject`
92
-
93
- The item to create.
94
-
95
- #### Returns
96
-
97
- `Promise`\<`string`\>
98
-
99
- The id of the item created, for some items this is supplied in the `item`.
100
-
101
- #### Implementation of
102
-
103
- `IDataAccessHandler.create`
104
-
105
- ***
106
-
107
- ### get()
108
-
109
- > **get**(`assetType`, `id`): `Promise`\<`IJsonLdNodeObject`\>
110
-
111
- Get an item.
112
-
113
- #### Parameters
114
-
115
- ##### assetType
116
-
117
- `string`
118
-
119
- The type of the item to retrieve.
120
-
121
- ##### id
122
-
123
- `string`
124
-
125
- The ID of the item to retrieve.
126
-
127
- #### Returns
128
-
129
- `Promise`\<`IJsonLdNodeObject`\>
130
-
131
- The item retrieved if the policies allow it.
132
-
133
- #### Implementation of
134
-
135
- `IDataAccessHandler.get`
136
-
137
- ***
138
-
139
- ### update()
140
-
141
- > **update**(`assetType`, `item`): `Promise`\<`void`\>
142
-
143
- Update an item.
144
-
145
- #### Parameters
146
-
147
- ##### assetType
148
-
149
- `string`
150
-
151
- The type of the item to update.
152
-
153
- ##### item
154
-
155
- `IJsonLdNodeObject`
156
-
157
- The item to update.
158
-
159
- #### Returns
160
-
161
- `Promise`\<`void`\>
162
-
163
- Nothing.
164
-
165
- #### Implementation of
166
-
167
- `IDataAccessHandler.update`
168
-
169
- ***
170
-
171
- ### remove()
172
-
173
- > **remove**(`assetType`, `id`): `Promise`\<`void`\>
174
-
175
- Remove an item.
176
-
177
- #### Parameters
178
-
179
- ##### assetType
180
-
181
- `string`
182
-
183
- The type of the item to remove.
184
-
185
- ##### id
186
-
187
- `string`
188
-
189
- The id of the item to remove.
190
-
191
- #### Returns
192
-
193
- `Promise`\<`void`\>
194
-
195
- Nothing.
196
-
197
- #### Implementation of
198
-
199
- `IDataAccessHandler.remove`
200
-
201
- ***
202
-
203
- ### query()
204
-
205
- > **query**(`assetType`, `conditions`, `cursor`, `options`): `Promise`\<\{ `items`: `IJsonLdNodeObject`[]; `cursor?`: `string`; \}\>
206
-
207
- Query for items.
208
-
209
- #### Parameters
210
-
211
- ##### assetType
212
-
213
- `string`
214
-
215
- The type of the item to query.
216
-
217
- ##### conditions
218
-
219
- The conditions to apply to the query.
220
-
221
- `EntityCondition`\<`IJsonLdNodeObject`\> | `undefined`
222
-
223
- ##### cursor
224
-
225
- The cursor for pagination.
226
-
227
- `string` | `undefined`
228
-
229
- ##### options
230
-
231
- `unknown`
232
-
233
- Additional options which might be supported by the handler.
234
-
235
- #### Returns
236
-
237
- `Promise`\<\{ `items`: `IJsonLdNodeObject`[]; `cursor?`: `string`; \}\>
238
-
239
- The items matching the query and cursor if there are more items.
240
-
241
- #### Implementation of
242
-
243
- `IDataAccessHandler.query`
@@ -1,121 +0,0 @@
1
- # Class: ExamplePolicyArbiter
2
-
3
- Example Policy Arbiter.
4
-
5
- ## Implements
6
-
7
- - `IPolicyArbiter`
8
-
9
- ## Constructors
10
-
11
- ### Constructor
12
-
13
- > **new ExamplePolicyArbiter**(`options?`): `ExamplePolicyArbiter`
14
-
15
- Create a new instance of ExamplePolicyArbiter.
16
-
17
- #### Parameters
18
-
19
- ##### options?
20
-
21
- [`IExamplePolicyArbiterConstructorOptions`](../interfaces/IExamplePolicyArbiterConstructorOptions.md)
22
-
23
- The options for the example policy arbiter.
24
-
25
- #### Returns
26
-
27
- `ExamplePolicyArbiter`
28
-
29
- ## Properties
30
-
31
- ### CLASS\_NAME
32
-
33
- > `readonly` `static` **CLASS\_NAME**: `string`
34
-
35
- The class name of the Example Policy Arbiter.
36
-
37
- ## Methods
38
-
39
- ### 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
- `IPolicyArbiter.className`
54
-
55
- ***
56
-
57
- ### supportedPolicies()
58
-
59
- > **supportedPolicies**(): `IPolicyLocator`[]
60
-
61
- The policies supported by this arbiter.
62
-
63
- #### Returns
64
-
65
- `IPolicyLocator`[]
66
-
67
- The supported policies, if empty can be used for all.
68
-
69
- #### Implementation of
70
-
71
- `IPolicyArbiter.supportedPolicies`
72
-
73
- ***
74
-
75
- ### decide()
76
-
77
- > **decide**\<`D`\>(`locator`, `information?`, `policies?`, `data?`): `Promise`\<`IPolicyDecision`[]\>
78
-
79
- Makes decisions regarding policy access to data.
80
-
81
- #### Type Parameters
82
-
83
- ##### D
84
-
85
- `D` = `unknown`
86
-
87
- #### Parameters
88
-
89
- ##### locator
90
-
91
- `IPolicyLocator`
92
-
93
- The locator to find relevant policies.
94
-
95
- ##### information?
96
-
97
- `IPolicyInformation`
98
-
99
- Information provided by the requester to determine if a policy can be created.
100
-
101
- ##### policies?
102
-
103
- `IOdrlPolicy`[]
104
-
105
- The policies that apply to the data.
106
-
107
- ##### data?
108
-
109
- `D`
110
-
111
- The data to make a decision on.
112
-
113
- #### Returns
114
-
115
- `Promise`\<`IPolicyDecision`[]\>
116
-
117
- The decisions about access to the data.
118
-
119
- #### Implementation of
120
-
121
- `IPolicyArbiter.decide`