@twin.org/standards-w3c-odrl 0.0.1-next.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +21 -0
- package/dist/cjs/index.cjs +911 -0
- package/dist/esm/index.mjs +897 -0
- package/dist/types/index.d.ts +26 -0
- package/dist/types/models/IOdrlAction.d.ts +33 -0
- package/dist/types/models/IOdrlAsset.d.ts +27 -0
- package/dist/types/models/IOdrlAssetCollection.d.ts +21 -0
- package/dist/types/models/IOdrlConstraint.d.ts +49 -0
- package/dist/types/models/IOdrlDuty.d.ts +33 -0
- package/dist/types/models/IOdrlLogicalConstraint.d.ts +45 -0
- package/dist/types/models/IOdrlParty.d.ts +35 -0
- package/dist/types/models/IOdrlPartyCollection.d.ts +18 -0
- package/dist/types/models/IOdrlPermission.d.ts +14 -0
- package/dist/types/models/IOdrlPolicy.d.ts +81 -0
- package/dist/types/models/IOdrlPolicyMetadata.d.ts +58 -0
- package/dist/types/models/IOdrlProhibition.d.ts +11 -0
- package/dist/types/models/IOdrlRule.d.ts +41 -0
- package/dist/types/models/odrlContexts.d.ts +29 -0
- package/dist/types/models/types/actionTypes.d.ts +214 -0
- package/dist/types/models/types/conflictStrategyTypes.d.ts +21 -0
- package/dist/types/models/types/dataTypes.d.ts +37 -0
- package/dist/types/models/types/leftOperandTypes.d.ts +137 -0
- package/dist/types/models/types/logicalConstraintType.d.ts +25 -0
- package/dist/types/models/types/odrlTypes.d.ts +69 -0
- package/dist/types/models/types/operatorTypes.d.ts +65 -0
- package/dist/types/models/types/policyTypes.d.ts +25 -0
- package/dist/types/models/types/rightOperandTypes.d.ts +13 -0
- package/dist/types/models/types/ruleTypes.d.ts +21 -0
- package/dist/types/models/types/statusTypes.d.ts +25 -0
- package/dist/types/models/types/uriActionTypes.d.ts +215 -0
- package/docs/changelog.md +5 -0
- package/docs/examples.md +1 -0
- package/docs/reference/index.md +49 -0
- package/docs/reference/interfaces/IOdrlAction.md +61 -0
- package/docs/reference/interfaces/IOdrlAsset.md +55 -0
- package/docs/reference/interfaces/IOdrlAssetCollection.md +85 -0
- package/docs/reference/interfaces/IOdrlConstraint.md +76 -0
- package/docs/reference/interfaces/IOdrlDuty.md +144 -0
- package/docs/reference/interfaces/IOdrlLogicalConstraint.md +70 -0
- package/docs/reference/interfaces/IOdrlParty.md +67 -0
- package/docs/reference/interfaces/IOdrlPartyCollection.md +98 -0
- package/docs/reference/interfaces/IOdrlPermission.md +108 -0
- package/docs/reference/interfaces/IOdrlPolicy.md +136 -0
- package/docs/reference/interfaces/IOdrlPolicyMetadata.md +86 -0
- package/docs/reference/interfaces/IOdrlProhibition.md +105 -0
- package/docs/reference/interfaces/IOdrlRule.md +75 -0
- package/docs/reference/type-aliases/ActionType.md +5 -0
- package/docs/reference/type-aliases/ConflictStrategyType.md +5 -0
- package/docs/reference/type-aliases/DataType.md +5 -0
- package/docs/reference/type-aliases/LeftOperandType.md +5 -0
- package/docs/reference/type-aliases/LogicalConstraintType.md +5 -0
- package/docs/reference/type-aliases/OdrlContexts.md +5 -0
- package/docs/reference/type-aliases/OdrlTypes.md +5 -0
- package/docs/reference/type-aliases/OperatorType.md +5 -0
- package/docs/reference/type-aliases/PolicyType.md +5 -0
- package/docs/reference/type-aliases/RightOperandType.md +5 -0
- package/docs/reference/type-aliases/RuleType.md +5 -0
- package/docs/reference/type-aliases/StatusType.md +5 -0
- package/docs/reference/type-aliases/UriActionType.md +6 -0
- package/docs/reference/variables/ActionTypes.md +314 -0
- package/docs/reference/variables/ConflictStrategyTypes.md +25 -0
- package/docs/reference/variables/DataType.md +49 -0
- package/docs/reference/variables/LeftOperandType.md +199 -0
- package/docs/reference/variables/LogicalConstraintType.md +31 -0
- package/docs/reference/variables/OdrlContexts.md +37 -0
- package/docs/reference/variables/OdrlTypes.md +97 -0
- package/docs/reference/variables/OperatorType.md +91 -0
- package/docs/reference/variables/PolicyType.md +31 -0
- package/docs/reference/variables/RightOperandTypes.md +13 -0
- package/docs/reference/variables/RuleType.md +25 -0
- package/docs/reference/variables/StatusType.md +31 -0
- package/docs/reference/variables/UriActionTypes.md +314 -0
- package/locales/en.json +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export * from "./models/odrlContexts";
|
|
2
|
+
export * from "./models/types/odrlTypes";
|
|
3
|
+
export * from "./models/IOdrlRule";
|
|
4
|
+
export * from "./models/IOdrlPolicy";
|
|
5
|
+
export * from "./models/IOdrlAsset";
|
|
6
|
+
export * from "./models/IOdrlParty";
|
|
7
|
+
export * from "./models/IOdrlAction";
|
|
8
|
+
export * from "./models/IOdrlConstraint";
|
|
9
|
+
export * from "./models/IOdrlPermission";
|
|
10
|
+
export * from "./models/IOdrlProhibition";
|
|
11
|
+
export * from "./models/IOdrlDuty";
|
|
12
|
+
export * from "./models/IOdrlPolicyMetadata";
|
|
13
|
+
export * from "./models/IOdrlAssetCollection";
|
|
14
|
+
export * from "./models/IOdrlLogicalConstraint";
|
|
15
|
+
export * from "./models/IOdrlPartyCollection";
|
|
16
|
+
export * from "./models/types/policyTypes";
|
|
17
|
+
export * from "./models/types/ruleTypes";
|
|
18
|
+
export * from "./models/types/conflictStrategyTypes";
|
|
19
|
+
export * from "./models/types/statusTypes";
|
|
20
|
+
export * from "./models/types/operatorTypes";
|
|
21
|
+
export * from "./models/types/logicalConstraintType";
|
|
22
|
+
export * from "./models/types/actionTypes";
|
|
23
|
+
export * from "./models/types/dataTypes";
|
|
24
|
+
export * from "./models/types/leftOperandTypes";
|
|
25
|
+
export * from "./models/types/uriActionTypes";
|
|
26
|
+
export * from "./models/types/rightOperandTypes";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
|
+
import type { IOdrlConstraint } from "./IOdrlConstraint";
|
|
3
|
+
import type { IOdrlLogicalConstraint } from "./IOdrlLogicalConstraint";
|
|
4
|
+
import type { ActionType } from "./types/actionTypes";
|
|
5
|
+
/**
|
|
6
|
+
* Interface for ODRL Actions.
|
|
7
|
+
*/
|
|
8
|
+
export interface IOdrlAction extends IJsonLdNodeObject {
|
|
9
|
+
/**
|
|
10
|
+
* The value/identifier of the action.
|
|
11
|
+
* Used in complex action definitions.
|
|
12
|
+
*/
|
|
13
|
+
"rdf:value"?: {
|
|
14
|
+
"@id": string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Direct action identifier.
|
|
18
|
+
* Used in simple action references.
|
|
19
|
+
*/
|
|
20
|
+
"@id"?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Refinements applied to the action.
|
|
23
|
+
*/
|
|
24
|
+
refinement?: IOdrlConstraint | IOdrlLogicalConstraint | (IOdrlConstraint | IOdrlLogicalConstraint)[];
|
|
25
|
+
/**
|
|
26
|
+
* Reference to the action this action is included in.
|
|
27
|
+
*/
|
|
28
|
+
includedIn?: ActionType;
|
|
29
|
+
/**
|
|
30
|
+
* References to actions this action implies.
|
|
31
|
+
*/
|
|
32
|
+
implies?: ActionType[];
|
|
33
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
|
+
import type { IOdrlAssetCollection } from "./IOdrlAssetCollection";
|
|
3
|
+
/**
|
|
4
|
+
* Interface for ODRL Assets.
|
|
5
|
+
*/
|
|
6
|
+
export interface IOdrlAsset extends IJsonLdNodeObject {
|
|
7
|
+
/**
|
|
8
|
+
* The unique identifier for the asset.
|
|
9
|
+
* Should be an IRI.
|
|
10
|
+
*/
|
|
11
|
+
uid?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The type of the asset.
|
|
14
|
+
* Can be used to specify additional type information.
|
|
15
|
+
*/
|
|
16
|
+
"@type"?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Reference to the asset collection this asset is part of.
|
|
19
|
+
* Used to identify an AssetCollection that this Asset is a member of.
|
|
20
|
+
*/
|
|
21
|
+
partOf?: string | IOdrlAssetCollection;
|
|
22
|
+
/**
|
|
23
|
+
* Reference to the policy that governs this asset.
|
|
24
|
+
* Used to identify the Policy that governs this Asset.
|
|
25
|
+
*/
|
|
26
|
+
hasPolicy?: string;
|
|
27
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { IOdrlAsset } from "./IOdrlAsset";
|
|
2
|
+
import type { IOdrlConstraint } from "./IOdrlConstraint";
|
|
3
|
+
/**
|
|
4
|
+
* Interface for ODRL Asset Collections.
|
|
5
|
+
* An AssetCollection is a single resource representing a set of member resources,
|
|
6
|
+
* where all members of the set will be the subject of the Rule.
|
|
7
|
+
*/
|
|
8
|
+
export interface IOdrlAssetCollection extends IOdrlAsset {
|
|
9
|
+
/**
|
|
10
|
+
* Reference to the source of the asset collection.
|
|
11
|
+
* Must be an IRI that references the AssetCollection.
|
|
12
|
+
*/
|
|
13
|
+
source: string;
|
|
14
|
+
/**
|
|
15
|
+
* Refinements applied to the asset collection.
|
|
16
|
+
* Used to specify the refinement context under which to identify individual Asset(s)
|
|
17
|
+
* of the complete collection. The refinement applies to the characteristics of each
|
|
18
|
+
* member of the collection (not the resource as a whole).
|
|
19
|
+
*/
|
|
20
|
+
refinement?: IOdrlConstraint[];
|
|
21
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
|
+
import type { DataType } from "./types/dataTypes";
|
|
3
|
+
import type { LeftOperandType } from "./types/leftOperandTypes";
|
|
4
|
+
import type { OperatorType } from "./types/operatorTypes";
|
|
5
|
+
import type { StatusType } from "./types/statusTypes";
|
|
6
|
+
/**
|
|
7
|
+
* Interface for ODRL Constraints.
|
|
8
|
+
*/
|
|
9
|
+
export interface IOdrlConstraint extends IJsonLdNodeObject {
|
|
10
|
+
/**
|
|
11
|
+
* Optional unique identifier for the constraint.
|
|
12
|
+
*/
|
|
13
|
+
uid?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The left operand of the constraint.
|
|
16
|
+
*/
|
|
17
|
+
leftOperand: string | LeftOperandType;
|
|
18
|
+
/**
|
|
19
|
+
* The operator of the constraint.
|
|
20
|
+
*/
|
|
21
|
+
operator: OperatorType;
|
|
22
|
+
/**
|
|
23
|
+
* The right operand of the constraint.
|
|
24
|
+
* value with optional @type is used for literal values (like "5.00" with type "xsd:decimal")
|
|
25
|
+
* id is used when referencing a URI/identifier (like odrl:policyUsage)
|
|
26
|
+
*/
|
|
27
|
+
rightOperand?: string | {
|
|
28
|
+
"@value": string;
|
|
29
|
+
"@type"?: DataType;
|
|
30
|
+
} | {
|
|
31
|
+
"@id": string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Reference to the right operand.
|
|
35
|
+
*/
|
|
36
|
+
rightOperandReference?: string;
|
|
37
|
+
/**
|
|
38
|
+
* The data type of the right operand.
|
|
39
|
+
*/
|
|
40
|
+
dataType?: DataType;
|
|
41
|
+
/**
|
|
42
|
+
* The unit for the right operand value.
|
|
43
|
+
*/
|
|
44
|
+
unit?: string;
|
|
45
|
+
/**
|
|
46
|
+
* The status value for comparison.
|
|
47
|
+
*/
|
|
48
|
+
status?: StatusType;
|
|
49
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { IOdrlRule } from "./IOdrlRule";
|
|
2
|
+
/**
|
|
3
|
+
* Interface for Duty Rules.
|
|
4
|
+
* A Duty is the obligation to exercise an action, with all refinements satisfied.
|
|
5
|
+
* A Duty is fulfilled if all constraints are satisfied and if its action has been exercised.
|
|
6
|
+
*/
|
|
7
|
+
export interface IOdrlDuty extends IOdrlRule {
|
|
8
|
+
/**
|
|
9
|
+
* The party to be attributed
|
|
10
|
+
* Used when the duty involves attribution
|
|
11
|
+
*/
|
|
12
|
+
attributedParty?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The party performing the tracking
|
|
15
|
+
* Used when the duty involves tracking
|
|
16
|
+
*/
|
|
17
|
+
trackingParty?: string;
|
|
18
|
+
/**
|
|
19
|
+
* The consequences if the duty is not fulfilled.
|
|
20
|
+
* Only applicable when the Duty is referenced by a Rule with duty or obligation
|
|
21
|
+
* properties.
|
|
22
|
+
*/
|
|
23
|
+
consequence?: IOdrlDuty[];
|
|
24
|
+
/**
|
|
25
|
+
* The remedies that may be fulfilled to cure the violation.
|
|
26
|
+
*/
|
|
27
|
+
remedy?: IOdrlDuty[];
|
|
28
|
+
/**
|
|
29
|
+
* The party to be compensated
|
|
30
|
+
* Used when the duty involves compensation
|
|
31
|
+
*/
|
|
32
|
+
compensatedParty?: string;
|
|
33
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
|
+
/**
|
|
3
|
+
* Interface for ODRL Logical Constraints.
|
|
4
|
+
* A Logical Constraint compares two or more existing Constraints by one logical operator.
|
|
5
|
+
* If the comparison returns a logical match, then the Logical Constraint is satisfied.
|
|
6
|
+
*/
|
|
7
|
+
export interface IOdrlLogicalConstraint extends IJsonLdNodeObject {
|
|
8
|
+
/**
|
|
9
|
+
* Optional unique identifier for the logical constraint.
|
|
10
|
+
* Must be an IRI.
|
|
11
|
+
*/
|
|
12
|
+
uid?: string;
|
|
13
|
+
/**
|
|
14
|
+
* AND operator - all constraints must be satisfied.
|
|
15
|
+
*/
|
|
16
|
+
and?: {
|
|
17
|
+
"@list": {
|
|
18
|
+
"@id": string;
|
|
19
|
+
}[];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* OR operator - at least one constraint must be satisfied.
|
|
23
|
+
*/
|
|
24
|
+
or?: {
|
|
25
|
+
"@list": {
|
|
26
|
+
"@id": string;
|
|
27
|
+
}[];
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* XOR operator - exactly one constraint must be satisfied.
|
|
31
|
+
*/
|
|
32
|
+
xone?: {
|
|
33
|
+
"@list": {
|
|
34
|
+
"@id": string;
|
|
35
|
+
}[];
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* AND Sequence operator - all constraints must be satisfied in order.
|
|
39
|
+
*/
|
|
40
|
+
andSequence?: {
|
|
41
|
+
"@list": {
|
|
42
|
+
"@id": string;
|
|
43
|
+
}[];
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
|
+
import type { IOdrlPartyCollection } from "./IOdrlPartyCollection";
|
|
3
|
+
/**
|
|
4
|
+
* Interface for ODRL Parties.
|
|
5
|
+
*/
|
|
6
|
+
export interface IOdrlParty extends IJsonLdNodeObject {
|
|
7
|
+
/**
|
|
8
|
+
* The unique identifier for the party.
|
|
9
|
+
* Must be an IRI.
|
|
10
|
+
*/
|
|
11
|
+
uid?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The type of the party.
|
|
14
|
+
* Can be used to specify additional type information (e.g., "Party",
|
|
15
|
+
* "vcard:Organization", "vcard:Individual").
|
|
16
|
+
*/
|
|
17
|
+
"@type"?: string | string[];
|
|
18
|
+
/**
|
|
19
|
+
* Reference to the party collection this party is part of.
|
|
20
|
+
* Used to identify a PartyCollection that a Party entity is a member of.
|
|
21
|
+
*/
|
|
22
|
+
partOf?: string | IOdrlPartyCollection;
|
|
23
|
+
/**
|
|
24
|
+
* Reference to a policy where this party is an assignee.
|
|
25
|
+
* When assigneeOf is asserted, the Party MUST be inferred to undertake
|
|
26
|
+
* the assignee functional role of all the Rules of that Policy.
|
|
27
|
+
*/
|
|
28
|
+
assigneeOf?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Reference to a policy where this party is an assigner.
|
|
31
|
+
* When assignerOf is asserted, the Party MUST be inferred to undertake
|
|
32
|
+
* the assigner functional role of all the Rules of that Policy.
|
|
33
|
+
*/
|
|
34
|
+
assignerOf?: string;
|
|
35
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { IOdrlConstraint } from "./IOdrlConstraint";
|
|
2
|
+
import type { IOdrlParty } from "./IOdrlParty";
|
|
3
|
+
/**
|
|
4
|
+
* Interface for ODRL Party Collections.
|
|
5
|
+
* A PartyCollection identifies a collection of entities and is a subclass of Party.
|
|
6
|
+
*/
|
|
7
|
+
export interface IOdrlPartyCollection extends IOdrlParty {
|
|
8
|
+
/**
|
|
9
|
+
* Reference to the source of the party collection.
|
|
10
|
+
* Used to identify the origin or location of the collection.
|
|
11
|
+
*/
|
|
12
|
+
source: string;
|
|
13
|
+
/**
|
|
14
|
+
* Refinements applied to the party collection.
|
|
15
|
+
* Used to specify constraints that apply to all members of the collection.
|
|
16
|
+
*/
|
|
17
|
+
refinement?: IOdrlConstraint[];
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IOdrlDuty } from "./IOdrlDuty";
|
|
2
|
+
import type { IOdrlRule } from "./IOdrlRule";
|
|
3
|
+
/**
|
|
4
|
+
* Interface for Permission Rules.
|
|
5
|
+
* A Permission allows an action to be exercised on an Asset
|
|
6
|
+
* if all constraints are satisfied and if all duties are fulfilled.
|
|
7
|
+
*/
|
|
8
|
+
export interface IOdrlPermission extends IOdrlRule {
|
|
9
|
+
/**
|
|
10
|
+
* The duties that must be fulfilled before the permission can be exercised.
|
|
11
|
+
* A Permission MAY have none, one, or more duty property values.
|
|
12
|
+
*/
|
|
13
|
+
duty?: IOdrlDuty[];
|
|
14
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { IJsonLdContextDefinition, IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
|
+
import type { IOdrlAction } from "./IOdrlAction";
|
|
3
|
+
import type { IOdrlAsset } from "./IOdrlAsset";
|
|
4
|
+
import type { IOdrlDuty } from "./IOdrlDuty";
|
|
5
|
+
import type { IOdrlParty } from "./IOdrlParty";
|
|
6
|
+
import type { IOdrlPermission } from "./IOdrlPermission";
|
|
7
|
+
import type { IOdrlProhibition } from "./IOdrlProhibition";
|
|
8
|
+
import type { OdrlContexts } from "./odrlContexts";
|
|
9
|
+
import type { ActionType } from "./types/actionTypes";
|
|
10
|
+
import type { ConflictStrategyType } from "./types/conflictStrategyTypes";
|
|
11
|
+
import type { PolicyType } from "./types/policyTypes";
|
|
12
|
+
/**
|
|
13
|
+
* Interface representing an ODRL Policy.
|
|
14
|
+
*/
|
|
15
|
+
export interface IOdrlPolicy extends IJsonLdNodeObject {
|
|
16
|
+
/**
|
|
17
|
+
* The context for the policy.
|
|
18
|
+
* Must include "https://www.w3.org/ns/odrl.jsonld"
|
|
19
|
+
*/
|
|
20
|
+
"@context": typeof OdrlContexts.Context | [typeof OdrlContexts.Context, IJsonLdContextDefinition] | IJsonLdContextDefinition;
|
|
21
|
+
/**
|
|
22
|
+
* The type of policy.
|
|
23
|
+
* Must be one of: "Set", "Offer", "Agreement"
|
|
24
|
+
*/
|
|
25
|
+
"@type": PolicyType;
|
|
26
|
+
/**
|
|
27
|
+
* The unique identifier for the policy.
|
|
28
|
+
* Must be an IRI.
|
|
29
|
+
*/
|
|
30
|
+
uid: string;
|
|
31
|
+
/**
|
|
32
|
+
* The profile(s) this policy conforms to.
|
|
33
|
+
* IRIs identifying the ODRL Profile(s).
|
|
34
|
+
*/
|
|
35
|
+
profile?: string | string[];
|
|
36
|
+
/**
|
|
37
|
+
* The assigner of the policy.
|
|
38
|
+
* Applies to all rules unless overridden at rule level.
|
|
39
|
+
*/
|
|
40
|
+
assigner?: string | IOdrlParty;
|
|
41
|
+
/**
|
|
42
|
+
* The assignee of the policy.
|
|
43
|
+
* Applies to all rules unless overridden at rule level.
|
|
44
|
+
*/
|
|
45
|
+
assignee?: string | IOdrlParty;
|
|
46
|
+
/**
|
|
47
|
+
* The target asset for the rule.
|
|
48
|
+
*/
|
|
49
|
+
target?: string | IOdrlAsset | (string | IOdrlAsset)[];
|
|
50
|
+
/**
|
|
51
|
+
* The action associated with the rule.
|
|
52
|
+
*/
|
|
53
|
+
action?: ActionType | IOdrlAction | (ActionType | IOdrlAction)[];
|
|
54
|
+
/**
|
|
55
|
+
* The parent policy(ies) this policy inherits from.
|
|
56
|
+
* IRIs identifying the parent Policy(ies).
|
|
57
|
+
*/
|
|
58
|
+
inheritFrom?: string | string[];
|
|
59
|
+
/**
|
|
60
|
+
* The conflict resolution strategy.
|
|
61
|
+
* - perm: Permissions override Prohibitions
|
|
62
|
+
* - prohibit: Prohibitions override Permissions
|
|
63
|
+
* - invalid: Policy is void if conflicts exist (default)
|
|
64
|
+
*/
|
|
65
|
+
conflict?: ConflictStrategyType;
|
|
66
|
+
/**
|
|
67
|
+
* The permissions in the policy.
|
|
68
|
+
* At least one of permission, prohibition, or obligation must be present.
|
|
69
|
+
*/
|
|
70
|
+
permission?: IOdrlPermission[];
|
|
71
|
+
/**
|
|
72
|
+
* The prohibitions in the policy.
|
|
73
|
+
* At least one of permission, prohibition, or obligation must be present.
|
|
74
|
+
*/
|
|
75
|
+
prohibition?: IOdrlProhibition[];
|
|
76
|
+
/**
|
|
77
|
+
* The obligations in the policy.
|
|
78
|
+
* At least one of permission, prohibition, or obligation must be present.
|
|
79
|
+
*/
|
|
80
|
+
obligation?: IOdrlDuty[];
|
|
81
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for ODRL Policy Metadata using Dublin Core terms.
|
|
3
|
+
* While these aren't explicitly defined in the ODRL spec, they are valid and useful metadata properties that follow Dublin Core standards.
|
|
4
|
+
*/
|
|
5
|
+
export interface IOdrlPolicyMetadata {
|
|
6
|
+
/**
|
|
7
|
+
* The individual, agent, or organisation that authored the Policy.
|
|
8
|
+
* Note: String values may not be normalized and should not be used for direct comparison.
|
|
9
|
+
*/
|
|
10
|
+
"dc:creator"?: string | string[];
|
|
11
|
+
/**
|
|
12
|
+
* A human-readable representation or summary of the Policy.
|
|
13
|
+
* Note: String values may not be normalized and should not be used for direct comparison.
|
|
14
|
+
*/
|
|
15
|
+
"dc:description"?: string | string[];
|
|
16
|
+
/**
|
|
17
|
+
* The date (and time) the Policy was first issued.
|
|
18
|
+
* Note: String values may not be normalized and should not be used for direct comparison.
|
|
19
|
+
*/
|
|
20
|
+
"dc:issued"?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The date (and time) the Policy was updated.
|
|
23
|
+
* Note: String values may not be normalized and should not be used for direct comparison.
|
|
24
|
+
*/
|
|
25
|
+
"dc:modified"?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The publisher of the Policy.
|
|
28
|
+
* Note: String values may not be normalized and should not be used for direct comparison.
|
|
29
|
+
*/
|
|
30
|
+
"dc:publisher"?: string;
|
|
31
|
+
/**
|
|
32
|
+
* The subject of the Policy.
|
|
33
|
+
* Note: String values may not be normalized and should not be used for direct comparison.
|
|
34
|
+
*/
|
|
35
|
+
"dc:subject"?: string | string[];
|
|
36
|
+
/**
|
|
37
|
+
* The jurisdiction under which the Policy is relevant.
|
|
38
|
+
* Note: When using string values, they may not be normalized and should not be used for direct comparison.
|
|
39
|
+
* Using "@id" references is preferred for comparison purposes.
|
|
40
|
+
*/
|
|
41
|
+
"dc:coverage"?: string | {
|
|
42
|
+
"@id": string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* The identifier of a Policy that this Policy supersedes.
|
|
46
|
+
* Using "@id" references is preferred for comparison purposes.
|
|
47
|
+
*/
|
|
48
|
+
"dc:replaces"?: string | {
|
|
49
|
+
"@id": string;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* The identifier of a Policy that supersedes this Policy.
|
|
53
|
+
* Using "@id" references is preferred for comparison purposes.
|
|
54
|
+
*/
|
|
55
|
+
"dc:isReplacedBy"?: string | {
|
|
56
|
+
"@id": string;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IOdrlDuty } from "./IOdrlDuty";
|
|
2
|
+
import type { IOdrlRule } from "./IOdrlRule";
|
|
3
|
+
/**
|
|
4
|
+
* Interface for Prohibition Rules.
|
|
5
|
+
*/
|
|
6
|
+
export interface IOdrlProhibition extends IOdrlRule {
|
|
7
|
+
/**
|
|
8
|
+
* The remedies that must be fulfilled if prohibition is violated.
|
|
9
|
+
*/
|
|
10
|
+
remedy?: IOdrlDuty[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
|
+
import type { IOdrlAction } from "./IOdrlAction";
|
|
3
|
+
import type { IOdrlAsset } from "./IOdrlAsset";
|
|
4
|
+
import type { IOdrlConstraint } from "./IOdrlConstraint";
|
|
5
|
+
import type { IOdrlParty } from "./IOdrlParty";
|
|
6
|
+
import type { ActionType } from "./types/actionTypes";
|
|
7
|
+
/**
|
|
8
|
+
* Base interface for ODRL Rules.
|
|
9
|
+
*/
|
|
10
|
+
export interface IOdrlRule extends IJsonLdNodeObject {
|
|
11
|
+
/**
|
|
12
|
+
* Optional unique identifier for the rule.
|
|
13
|
+
*/
|
|
14
|
+
uid?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The action associated with the rule.
|
|
17
|
+
*/
|
|
18
|
+
action?: ActionType | IOdrlAction | (ActionType | IOdrlAction)[];
|
|
19
|
+
/**
|
|
20
|
+
* The target asset for the rule.
|
|
21
|
+
*/
|
|
22
|
+
target?: string | IOdrlAsset | (string | IOdrlAsset)[];
|
|
23
|
+
/**
|
|
24
|
+
* The assigner of the rule.
|
|
25
|
+
*/
|
|
26
|
+
assigner?: string | IOdrlParty;
|
|
27
|
+
/**
|
|
28
|
+
* The assignee of the rule.
|
|
29
|
+
*/
|
|
30
|
+
assignee?: string | IOdrlParty;
|
|
31
|
+
/**
|
|
32
|
+
* Constraints applied to the rule.
|
|
33
|
+
*/
|
|
34
|
+
constraint?: IOdrlConstraint[];
|
|
35
|
+
/**
|
|
36
|
+
* Additional relation sub-properties as defined in ODRL profiles.
|
|
37
|
+
* For example, 'summary' in profile "http://example.com/odrl:profile:03"
|
|
38
|
+
* indicates where the output should be stored.
|
|
39
|
+
*/
|
|
40
|
+
summary?: string;
|
|
41
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The contexts for ODRL.
|
|
3
|
+
*/
|
|
4
|
+
export declare const OdrlContexts: {
|
|
5
|
+
/**
|
|
6
|
+
* The context root for ODRL.
|
|
7
|
+
*/
|
|
8
|
+
readonly Context: "https://www.w3.org/ns/odrl.jsonld";
|
|
9
|
+
/**
|
|
10
|
+
* The context root for ODRL vocabulary.
|
|
11
|
+
*/
|
|
12
|
+
readonly ContextVocabulary: "https://www.w3.org/ns/odrl/2/";
|
|
13
|
+
/**
|
|
14
|
+
* The context root for Dublin Core Terms.
|
|
15
|
+
*/
|
|
16
|
+
readonly ContextDcTerms: "https://purl.org/dc/terms/";
|
|
17
|
+
/**
|
|
18
|
+
* The context root for RDF.
|
|
19
|
+
*/
|
|
20
|
+
readonly ContextRdf: "https://www.w3.org/1999/02/22-rdf-syntax-ns#";
|
|
21
|
+
/**
|
|
22
|
+
* The context root for XSD.
|
|
23
|
+
*/
|
|
24
|
+
readonly ContextXsd: "https://www.w3.org/2001/XMLSchema#";
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* The contexts for ODRL.
|
|
28
|
+
*/
|
|
29
|
+
export type OdrlContexts = (typeof OdrlContexts)[keyof typeof OdrlContexts];
|