@twin.org/rights-management-plugins 0.0.3-next.4

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 (86) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +21 -0
  3. package/dist/es/dataAccessHandlers/examplePolicyRequester.js +82 -0
  4. package/dist/es/dataAccessHandlers/examplePolicyRequester.js.map +1 -0
  5. package/dist/es/index.js +22 -0
  6. package/dist/es/index.js.map +1 -0
  7. package/dist/es/models/IExampleDataAccessHandlerConstructorOptions.js +4 -0
  8. package/dist/es/models/IExampleDataAccessHandlerConstructorOptions.js.map +1 -0
  9. package/dist/es/models/IExamplePolicyArbiterConstructorOptions.js +4 -0
  10. package/dist/es/models/IExamplePolicyArbiterConstructorOptions.js.map +1 -0
  11. package/dist/es/models/IExamplePolicyEnforcementProcessorConstructorOptions.js +4 -0
  12. package/dist/es/models/IExamplePolicyEnforcementProcessorConstructorOptions.js.map +1 -0
  13. package/dist/es/models/IExamplePolicyNegotiatorConstructorOptions.js +4 -0
  14. package/dist/es/models/IExamplePolicyNegotiatorConstructorOptions.js.map +1 -0
  15. package/dist/es/models/IExamplePolicyRequesterConstructorOptions.js +4 -0
  16. package/dist/es/models/IExamplePolicyRequesterConstructorOptions.js.map +1 -0
  17. package/dist/es/models/IIdentityPolicyInformationSourceConstructorOptions.js +4 -0
  18. package/dist/es/models/IIdentityPolicyInformationSourceConstructorOptions.js.map +1 -0
  19. package/dist/es/models/ILoggingPolicyExecutionActionConfig.js +2 -0
  20. package/dist/es/models/ILoggingPolicyExecutionActionConfig.js.map +1 -0
  21. package/dist/es/models/ILoggingPolicyExecutionActionConstructorOptions.js +2 -0
  22. package/dist/es/models/ILoggingPolicyExecutionActionConstructorOptions.js.map +1 -0
  23. package/dist/es/models/IStaticPolicyInformationSource.js +2 -0
  24. package/dist/es/models/IStaticPolicyInformationSource.js.map +1 -0
  25. package/dist/es/models/IStaticPolicyInformationSourceConfig.js +2 -0
  26. package/dist/es/models/IStaticPolicyInformationSourceConfig.js.map +1 -0
  27. package/dist/es/models/IStaticPolicyInformationSourceConstructorOptions.js +2 -0
  28. package/dist/es/models/IStaticPolicyInformationSourceConstructorOptions.js.map +1 -0
  29. package/dist/es/policyArbiters/examplePolicyArbiter.js +50 -0
  30. package/dist/es/policyArbiters/examplePolicyArbiter.js.map +1 -0
  31. package/dist/es/policyEnforcementProcessor/examplePolicyEnforcementProcessor.js +42 -0
  32. package/dist/es/policyEnforcementProcessor/examplePolicyEnforcementProcessor.js.map +1 -0
  33. package/dist/es/policyExecutionActions/loggingPolicyExecutionAction.js +117 -0
  34. package/dist/es/policyExecutionActions/loggingPolicyExecutionAction.js.map +1 -0
  35. package/dist/es/policyInformationSources/identityPolicyInformationSource.js +79 -0
  36. package/dist/es/policyInformationSources/identityPolicyInformationSource.js.map +1 -0
  37. package/dist/es/policyInformationSources/staticPolicyInformationSource.js +94 -0
  38. package/dist/es/policyInformationSources/staticPolicyInformationSource.js.map +1 -0
  39. package/dist/es/policyNegotiators/examplePolicyNegotiator.js +61 -0
  40. package/dist/es/policyNegotiators/examplePolicyNegotiator.js.map +1 -0
  41. package/dist/es/policyRequesters/examplePolicyRequester.js +69 -0
  42. package/dist/es/policyRequesters/examplePolicyRequester.js.map +1 -0
  43. package/dist/types/dataAccessHandlers/examplePolicyRequester.d.ts +68 -0
  44. package/dist/types/index.d.ts +19 -0
  45. package/dist/types/models/IExampleDataAccessHandlerConstructorOptions.d.ts +10 -0
  46. package/dist/types/models/IExamplePolicyArbiterConstructorOptions.d.ts +10 -0
  47. package/dist/types/models/IExamplePolicyEnforcementProcessorConstructorOptions.d.ts +10 -0
  48. package/dist/types/models/IExamplePolicyNegotiatorConstructorOptions.d.ts +10 -0
  49. package/dist/types/models/IExamplePolicyRequesterConstructorOptions.d.ts +10 -0
  50. package/dist/types/models/IIdentityPolicyInformationSourceConstructorOptions.d.ts +15 -0
  51. package/dist/types/models/ILoggingPolicyExecutionActionConfig.d.ts +25 -0
  52. package/dist/types/models/ILoggingPolicyExecutionActionConstructorOptions.d.ts +15 -0
  53. package/dist/types/models/IStaticPolicyInformationSource.d.ts +20 -0
  54. package/dist/types/models/IStaticPolicyInformationSourceConfig.d.ts +10 -0
  55. package/dist/types/models/IStaticPolicyInformationSourceConstructorOptions.d.ts +15 -0
  56. package/dist/types/policyArbiters/examplePolicyArbiter.d.ts +36 -0
  57. package/dist/types/policyEnforcementProcessor/examplePolicyEnforcementProcessor.d.ts +29 -0
  58. package/dist/types/policyExecutionActions/loggingPolicyExecutionAction.d.ts +49 -0
  59. package/dist/types/policyInformationSources/identityPolicyInformationSource.d.ts +32 -0
  60. package/dist/types/policyInformationSources/staticPolicyInformationSource.d.ts +38 -0
  61. package/dist/types/policyNegotiators/examplePolicyNegotiator.d.ts +45 -0
  62. package/dist/types/policyRequesters/examplePolicyRequester.d.ts +53 -0
  63. package/docs/changelog.md +17 -0
  64. package/docs/examples.md +1 -0
  65. package/docs/reference/classes/ExampleDataAccessHandler.md +243 -0
  66. package/docs/reference/classes/ExamplePolicyArbiter.md +121 -0
  67. package/docs/reference/classes/ExamplePolicyEnforcementProcessor.md +101 -0
  68. package/docs/reference/classes/ExamplePolicyNegotiator.md +143 -0
  69. package/docs/reference/classes/ExamplePolicyRequester.md +187 -0
  70. package/docs/reference/classes/IdentityPolicyInformationSource.md +103 -0
  71. package/docs/reference/classes/LoggingPolicyExecutionAction.md +127 -0
  72. package/docs/reference/classes/StaticPolicyInformationSource.md +123 -0
  73. package/docs/reference/index.md +26 -0
  74. package/docs/reference/interfaces/IExampleDataAccessHandlerConstructorOptions.md +17 -0
  75. package/docs/reference/interfaces/IExamplePolicyArbiterConstructorOptions.md +17 -0
  76. package/docs/reference/interfaces/IExamplePolicyEnforcementProcessorConstructorOptions.md +17 -0
  77. package/docs/reference/interfaces/IExamplePolicyNegotiatorConstructorOptions.md +17 -0
  78. package/docs/reference/interfaces/IExamplePolicyRequesterConstructorOptions.md +17 -0
  79. package/docs/reference/interfaces/IIdentityPolicyInformationSourceConstructorOptions.md +31 -0
  80. package/docs/reference/interfaces/ILoggingPolicyExecutionActionConfig.md +53 -0
  81. package/docs/reference/interfaces/ILoggingPolicyExecutionActionConstructorOptions.md +25 -0
  82. package/docs/reference/interfaces/IStaticPolicyInformationSource.md +28 -0
  83. package/docs/reference/interfaces/IStaticPolicyInformationSourceConfig.md +11 -0
  84. package/docs/reference/interfaces/IStaticPolicyInformationSourceConstructorOptions.md +25 -0
  85. package/locales/en.json +20 -0
  86. package/package.json +57 -0
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Options for the Identity Policy Information Source Component.
3
+ */
4
+ export interface IIdentityPolicyInformationSourceConstructorOptions {
5
+ /**
6
+ * The logging component for logging policy source.
7
+ * @default logging
8
+ */
9
+ loggingComponentType?: string;
10
+ /**
11
+ * The component for resolving identities.
12
+ * @default identity-resolver
13
+ */
14
+ identityResolverComponentType?: string;
15
+ }
@@ -0,0 +1,25 @@
1
+ import type { PolicyDecisionStage } from "@twin.org/rights-management-models";
2
+ /**
3
+ * Options for the Logging Policy Execution Action Component.
4
+ */
5
+ export interface ILoggingPolicyExecutionActionConfig {
6
+ /**
7
+ * The policy decision stages to log, if undefined defaults to all.
8
+ */
9
+ stages?: PolicyDecisionStage[];
10
+ /**
11
+ * Whether to include the data in the log.
12
+ * @default false
13
+ */
14
+ includeData?: boolean;
15
+ /**
16
+ * Whether to include the policies in the log.
17
+ * @default false
18
+ */
19
+ includePolicies?: boolean;
20
+ /**
21
+ * Whether to include the decisions in the log.
22
+ * @default false
23
+ */
24
+ includeDecisions?: boolean;
25
+ }
@@ -0,0 +1,15 @@
1
+ import type { ILoggingPolicyExecutionActionConfig } from "./ILoggingPolicyExecutionActionConfig.js";
2
+ /**
3
+ * Options for the Logging Policy Execution Action.
4
+ */
5
+ export interface ILoggingPolicyExecutionActionConstructorOptions {
6
+ /**
7
+ * The logging component for logging policy execution.
8
+ * @default logging
9
+ */
10
+ loggingComponentType?: string;
11
+ /**
12
+ * The configuration for the logging policy execution.
13
+ */
14
+ config?: ILoggingPolicyExecutionActionConfig;
15
+ }
@@ -0,0 +1,20 @@
1
+ import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
+ import type { IPolicyLocator, PolicyInformationAccessMode } from "@twin.org/rights-management-models";
3
+ /**
4
+ * Configuration for the Static Policy Information Source Component.
5
+ */
6
+ export interface IStaticPolicyInformationSource {
7
+ /**
8
+ * Is the information public, if so it will be shared with negotiation requests.
9
+ */
10
+ accessMode: PolicyInformationAccessMode;
11
+ /**
12
+ * Information is only provided for the specified locator combination.
13
+ * If undefined is provided matches all resources.
14
+ */
15
+ matchLocators?: IPolicyLocator[];
16
+ /**
17
+ * The objects containing the information.
18
+ */
19
+ objects: IJsonLdNodeObject[];
20
+ }
@@ -0,0 +1,10 @@
1
+ import type { IStaticPolicyInformationSource } from "./IStaticPolicyInformationSource.js";
2
+ /**
3
+ * Configuration for the Static Policy Information Source Component.
4
+ */
5
+ export interface IStaticPolicyInformationSourceConfig {
6
+ /**
7
+ * The information to return from the PIP.
8
+ */
9
+ information?: IStaticPolicyInformationSource[];
10
+ }
@@ -0,0 +1,15 @@
1
+ import type { IStaticPolicyInformationSourceConfig } from "./IStaticPolicyInformationSourceConfig.js";
2
+ /**
3
+ * Options for the Static Policy Information Source Component.
4
+ */
5
+ export interface IStaticPolicyInformationSourceConstructorOptions {
6
+ /**
7
+ * The logging component for logging policy source.
8
+ * @default logging
9
+ */
10
+ loggingComponentType?: string;
11
+ /**
12
+ * The configuration.
13
+ */
14
+ config?: IStaticPolicyInformationSourceConfig;
15
+ }
@@ -0,0 +1,36 @@
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
+ }
@@ -0,0 +1,29 @@
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
+ }
@@ -0,0 +1,49 @@
1
+ import { type IPolicyDecision, type IPolicyExecutionAction, type IPolicyLocator, PolicyDecisionStage } from "@twin.org/rights-management-models";
2
+ import type { IOdrlPolicy } from "@twin.org/standards-w3c-odrl";
3
+ import type { ILoggingPolicyExecutionActionConstructorOptions } from "../models/ILoggingPolicyExecutionActionConstructorOptions.js";
4
+ /**
5
+ * Logging Policy Execution Action to send decisions to logging.
6
+ */
7
+ export declare class LoggingPolicyExecutionAction implements IPolicyExecutionAction {
8
+ /**
9
+ * The class name of the Logging Policy Execution Action.
10
+ */
11
+ static readonly CLASS_NAME: string;
12
+ /**
13
+ * Whether to include the data in the log.
14
+ */
15
+ private readonly _includeData;
16
+ /**
17
+ * Whether to include the policies in the log.
18
+ */
19
+ private readonly _includePolicies;
20
+ /**
21
+ * Whether to include the decisions in the log.
22
+ */
23
+ private readonly _includeDecisions;
24
+ /**
25
+ * Create a new instance of LoggingPolicyExecutionAction.
26
+ * @param options The options for the logging policy execution action.
27
+ */
28
+ constructor(options?: ILoggingPolicyExecutionActionConstructorOptions);
29
+ /**
30
+ * Returns the class name of the component.
31
+ * @returns The class name of the component.
32
+ */
33
+ className(): string;
34
+ /**
35
+ * Which stages should the action be executed at.
36
+ * @returns List of stages.
37
+ */
38
+ supportedStages(): PolicyDecisionStage[];
39
+ /**
40
+ * Execute function type for policy actions.
41
+ * @param stage The stage of the policy decision.
42
+ * @param locator The locator to find relevant policies.
43
+ * @param policies The policies that apply to the data.
44
+ * @param decisions The decisions made by the PDP.
45
+ * @param data The data to process.
46
+ * @returns A promise that resolves when the action is complete.
47
+ */
48
+ execute<D = unknown>(stage: PolicyDecisionStage, locator: IPolicyLocator, policies?: IOdrlPolicy[], decisions?: IPolicyDecision[], data?: D): Promise<void>;
49
+ }
@@ -0,0 +1,32 @@
1
+ import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
+ import { type IPolicyInformationSource, type IPolicyLocator, PolicyInformationAccessMode } from "@twin.org/rights-management-models";
3
+ import type { IOdrlPolicy } from "@twin.org/standards-w3c-odrl";
4
+ import type { IIdentityPolicyInformationSourceConstructorOptions } from "../models/IIdentityPolicyInformationSourceConstructorOptions.js";
5
+ /**
6
+ * Policy information source which retrieves the identity information.
7
+ */
8
+ export declare class IdentityPolicyInformationSource implements IPolicyInformationSource {
9
+ /**
10
+ * The class name of the Identity Policy Information Source.
11
+ */
12
+ static readonly CLASS_NAME: string;
13
+ /**
14
+ * Create a new instance of IdentityPolicyInformationSource.
15
+ * @param options The options for the logging policy source.
16
+ */
17
+ constructor(options?: IIdentityPolicyInformationSourceConstructorOptions);
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 locator The locator to find relevant policies.
26
+ * @param accessMode The access mode to use for the retrieval.
27
+ * @param policies The policies that apply to the data.
28
+ * @param data The data to process.
29
+ * @returns The objects containing relevant information or undefined if nothing relevant is found.
30
+ */
31
+ retrieve<D = unknown>(locator: IPolicyLocator, accessMode: PolicyInformationAccessMode, policies: IOdrlPolicy[], data?: D): Promise<IJsonLdNodeObject[] | undefined>;
32
+ }
@@ -0,0 +1,38 @@
1
+ import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
+ import { PolicyInformationAccessMode, type IPolicyInformationSource, type IPolicyLocator } from "@twin.org/rights-management-models";
3
+ import type { IOdrlPolicy } from "@twin.org/standards-w3c-odrl";
4
+ import type { IStaticPolicyInformationSource } from "../models/IStaticPolicyInformationSource.js";
5
+ import type { IStaticPolicyInformationSourceConstructorOptions } from "../models/IStaticPolicyInformationSourceConstructorOptions.js";
6
+ /**
7
+ * Policy information source which retrieves static information.
8
+ */
9
+ export declare class StaticPolicyInformationSource implements IPolicyInformationSource {
10
+ /**
11
+ * The class name of the Static Policy Information Source.
12
+ */
13
+ static readonly CLASS_NAME: string;
14
+ /**
15
+ * Create a new instance of StaticPolicyInformationSource.
16
+ * @param options The options for the logging policy source.
17
+ */
18
+ constructor(options?: IStaticPolicyInformationSourceConstructorOptions);
19
+ /**
20
+ * Returns the class name of the component.
21
+ * @returns The class name of the component.
22
+ */
23
+ className(): string;
24
+ /**
25
+ * Retrieve information from the sources.
26
+ * @param locator The locator to find relevant policies.
27
+ * @param accessMode The access mode to use for the retrieval.
28
+ * @param policies The policies that apply to the data.
29
+ * @param data The data to process.
30
+ * @returns The objects containing relevant information or undefined if nothing relevant is found.
31
+ */
32
+ retrieve<D = unknown>(locator: IPolicyLocator, accessMode: PolicyInformationAccessMode, policies: IOdrlPolicy[], data?: D): Promise<IJsonLdNodeObject[] | undefined>;
33
+ /**
34
+ * Add static policy information.
35
+ * @param info The static policy information to add.
36
+ */
37
+ addInformation(info: IStaticPolicyInformationSource): void;
38
+ }
@@ -0,0 +1,45 @@
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
+ }
@@ -0,0 +1,53 @@
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
+ }
@@ -0,0 +1,17 @@
1
+ # Changelog
2
+
3
+ ## [0.0.3-next.4](https://github.com/twinfoundation/rights-management/compare/rights-management-plugins-v0.0.3-next.3...rights-management-plugins-v0.0.3-next.4) (2025-12-04)
4
+
5
+
6
+ ### Features
7
+
8
+ * add factory pattern ([d26b4c0](https://github.com/twinfoundation/rights-management/commit/d26b4c08a2f3ba5758df66a1c48203b8d8e3638e))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/rights-management-models bumped from 0.0.3-next.3 to 0.0.3-next.4
16
+
17
+ ## @twin.org/rights-management-plugins - Changelog
@@ -0,0 +1 @@
1
+ # @twin.org/rights-management-plugins - Examples
@@ -0,0 +1,243 @@
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`