@3sixty/document-management-models 0.0.0-stage → 0.20.0-next.1
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 +24 -2
- package/dist/es/compiled/validators.js +600 -0
- package/dist/es/compiled/validators.js.map +1 -0
- package/dist/es/dataTypes/documentManagementDataTypes.js +59 -0
- package/dist/es/dataTypes/documentManagementDataTypes.js.map +1 -0
- package/dist/es/index.js +25 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/models/IDocument.js +2 -0
- package/dist/es/models/IDocument.js.map +1 -0
- package/dist/es/models/IDocumentAttestation.js +2 -0
- package/dist/es/models/IDocumentAttestation.js.map +1 -0
- package/dist/es/models/IDocumentBase.js +2 -0
- package/dist/es/models/IDocumentBase.js.map +1 -0
- package/dist/es/models/IDocumentHydrated.js +2 -0
- package/dist/es/models/IDocumentHydrated.js.map +1 -0
- package/dist/es/models/IDocumentList.js +2 -0
- package/dist/es/models/IDocumentList.js.map +1 -0
- package/dist/es/models/IDocumentManagementComponent.js +2 -0
- package/dist/es/models/IDocumentManagementComponent.js.map +1 -0
- package/dist/es/models/IDocumentManagementEdgeEntry.js +2 -0
- package/dist/es/models/IDocumentManagementEdgeEntry.js.map +1 -0
- package/dist/es/models/api/IDocumentManagementCreateRequest.js +2 -0
- package/dist/es/models/api/IDocumentManagementCreateRequest.js.map +1 -0
- package/dist/es/models/api/IDocumentManagementGetRequest.js +2 -0
- package/dist/es/models/api/IDocumentManagementGetRequest.js.map +1 -0
- package/dist/es/models/api/IDocumentManagementGetResponse.js +2 -0
- package/dist/es/models/api/IDocumentManagementGetResponse.js.map +1 -0
- package/dist/es/models/api/IDocumentManagementGetRevisionRequest.js +2 -0
- package/dist/es/models/api/IDocumentManagementGetRevisionRequest.js.map +1 -0
- package/dist/es/models/api/IDocumentManagementGetRevisionResponse.js +2 -0
- package/dist/es/models/api/IDocumentManagementGetRevisionResponse.js.map +1 -0
- package/dist/es/models/api/IDocumentManagementQueryRequest.js +2 -0
- package/dist/es/models/api/IDocumentManagementQueryRequest.js.map +1 -0
- package/dist/es/models/api/IDocumentManagementQueryResponse.js +2 -0
- package/dist/es/models/api/IDocumentManagementQueryResponse.js.map +1 -0
- package/dist/es/models/api/IDocumentManagementRemoveRequest.js +4 -0
- package/dist/es/models/api/IDocumentManagementRemoveRequest.js.map +1 -0
- package/dist/es/models/api/IDocumentManagementUpdatePartialRequest.js +2 -0
- package/dist/es/models/api/IDocumentManagementUpdatePartialRequest.js.map +1 -0
- package/dist/es/models/documentContexts.js +33 -0
- package/dist/es/models/documentContexts.js.map +1 -0
- package/dist/es/models/documentManagementMetricIds.js +29 -0
- package/dist/es/models/documentManagementMetricIds.js.map +1 -0
- package/dist/es/models/documentManagementMetrics.js +36 -0
- package/dist/es/models/documentManagementMetrics.js.map +1 -0
- package/dist/es/models/documentTypes.js +25 -0
- package/dist/es/models/documentTypes.js.map +1 -0
- package/dist/es/schemas/Document.json +86 -0
- package/dist/es/schemas/DocumentAttestation.json +60 -0
- package/dist/es/schemas/DocumentBase.json +29 -0
- package/dist/es/schemas/DocumentHydrated.json +25 -0
- package/dist/es/schemas/DocumentList.json +51 -0
- package/dist/types/compiled/validators.d.ts +21 -0
- package/dist/types/dataTypes/documentManagementDataTypes.d.ts +9 -0
- package/dist/types/index.d.ts +22 -0
- package/dist/types/models/IDocument.d.ts +72 -0
- package/dist/types/models/IDocumentAttestation.d.ts +46 -0
- package/dist/types/models/IDocumentBase.d.ts +27 -0
- package/dist/types/models/IDocumentHydrated.d.ts +23 -0
- package/dist/types/models/IDocumentList.d.ts +32 -0
- package/dist/types/models/IDocumentManagementComponent.d.ts +123 -0
- package/dist/types/models/IDocumentManagementEdgeEntry.d.ts +18 -0
- package/dist/types/models/api/IDocumentManagementCreateRequest.d.ts +42 -0
- package/dist/types/models/api/IDocumentManagementGetRequest.d.ts +68 -0
- package/dist/types/models/api/IDocumentManagementGetResponse.d.ts +18 -0
- package/dist/types/models/api/IDocumentManagementGetRevisionRequest.d.ts +53 -0
- package/dist/types/models/api/IDocumentManagementGetRevisionResponse.d.ts +17 -0
- package/dist/types/models/api/IDocumentManagementQueryRequest.d.ts +29 -0
- package/dist/types/models/api/IDocumentManagementQueryResponse.d.ts +18 -0
- package/dist/types/models/api/IDocumentManagementRemoveRequest.d.ts +18 -0
- package/dist/types/models/api/IDocumentManagementUpdatePartialRequest.d.ts +61 -0
- package/dist/types/models/documentContexts.d.ts +33 -0
- package/dist/types/models/documentManagementMetricIds.d.ts +29 -0
- package/dist/types/models/documentManagementMetrics.d.ts +5 -0
- package/dist/types/models/documentTypes.d.ts +25 -0
- package/docs/changelog.md +9 -0
- package/docs/examples.md +23 -0
- package/docs/reference/classes/DocumentManagementDataTypes.md +25 -0
- package/docs/reference/index.md +42 -0
- package/docs/reference/interfaces/IDocument.md +155 -0
- package/docs/reference/interfaces/IDocumentAttestation.md +59 -0
- package/docs/reference/interfaces/IDocumentBase.md +39 -0
- package/docs/reference/interfaces/IDocumentHydrated.md +223 -0
- package/docs/reference/interfaces/IDocumentList.md +35 -0
- package/docs/reference/interfaces/IDocumentManagementComponent.md +348 -0
- package/docs/reference/interfaces/IDocumentManagementCreateRequest.md +53 -0
- package/docs/reference/interfaces/IDocumentManagementEdgeEntry.md +27 -0
- package/docs/reference/interfaces/IDocumentManagementGetRequest.md +127 -0
- package/docs/reference/interfaces/IDocumentManagementGetResponse.md +27 -0
- package/docs/reference/interfaces/IDocumentManagementGetRevisionRequest.md +91 -0
- package/docs/reference/interfaces/IDocumentManagementGetRevisionResponse.md +23 -0
- package/docs/reference/interfaces/IDocumentManagementQueryRequest.md +41 -0
- package/docs/reference/interfaces/IDocumentManagementQueryResponse.md +27 -0
- package/docs/reference/interfaces/IDocumentManagementRemoveRequest.md +23 -0
- package/docs/reference/interfaces/IDocumentManagementUpdatePartialRequest.md +80 -0
- package/docs/reference/type-aliases/DocumentContexts.md +5 -0
- package/docs/reference/type-aliases/DocumentManagementMetricIds.md +5 -0
- package/docs/reference/type-aliases/DocumentTypes.md +5 -0
- package/docs/reference/variables/CompiledDocument.md +5 -0
- package/docs/reference/variables/CompiledDocumentAttestation.md +5 -0
- package/docs/reference/variables/CompiledDocumentBase.md +5 -0
- package/docs/reference/variables/CompiledDocumentHydrated.md +5 -0
- package/docs/reference/variables/CompiledDocumentList.md +5 -0
- package/docs/reference/variables/DocumentContexts.md +43 -0
- package/docs/reference/variables/DocumentManagementMetricIds.md +37 -0
- package/docs/reference/variables/DocumentManagementMetrics.md +5 -0
- package/docs/reference/variables/DocumentTypes.md +31 -0
- package/locales/en.json +3 -0
- package/package.json +63 -5
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://schema.3sixty.global/documents/Document",
|
|
4
|
+
"title": "Document",
|
|
5
|
+
"description": "Interface describing a document.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"@context": {
|
|
9
|
+
"type": "array",
|
|
10
|
+
"prefixItems": [
|
|
11
|
+
{
|
|
12
|
+
"const": "https://schema.org"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"const": "https://schema.3sixty.global/documents/"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"const": "https://schema.3sixty.global/common/"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"items": {
|
|
22
|
+
"$ref": "https://schema.3sixty.global/json-ld/JsonLdContextDefinitionElement"
|
|
23
|
+
},
|
|
24
|
+
"minItems": 3,
|
|
25
|
+
"description": "JSON-LD Context."
|
|
26
|
+
},
|
|
27
|
+
"type": {
|
|
28
|
+
"const": "Document",
|
|
29
|
+
"description": "JSON-LD Type."
|
|
30
|
+
},
|
|
31
|
+
"id": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "The full id of the document."
|
|
34
|
+
},
|
|
35
|
+
"documentRevision": {
|
|
36
|
+
"type": "number",
|
|
37
|
+
"description": "The revision of the document as a 0 based index."
|
|
38
|
+
},
|
|
39
|
+
"blobStorageId": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"description": "The blob storage id for the document."
|
|
42
|
+
},
|
|
43
|
+
"integrity": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"description": "The integrity of the blob data."
|
|
46
|
+
},
|
|
47
|
+
"attestationId": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"description": "The attestation for the document if one was created."
|
|
50
|
+
},
|
|
51
|
+
"dateCreated": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"description": "The date/time of when the document was created."
|
|
54
|
+
},
|
|
55
|
+
"dateModified": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"description": "The date/time of when the document was modified."
|
|
58
|
+
},
|
|
59
|
+
"dateDeleted": {
|
|
60
|
+
"type": "string",
|
|
61
|
+
"description": "The date/time of when the document was deleted, as we never actually remove items."
|
|
62
|
+
},
|
|
63
|
+
"organizationIdentity": {
|
|
64
|
+
"type": "string",
|
|
65
|
+
"description": "The organization which added the document to the graph."
|
|
66
|
+
},
|
|
67
|
+
"userIdentity": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"description": "The user who added the document to the graph."
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"required": [
|
|
73
|
+
"@context",
|
|
74
|
+
"type",
|
|
75
|
+
"id",
|
|
76
|
+
"documentRevision",
|
|
77
|
+
"blobStorageId",
|
|
78
|
+
"integrity",
|
|
79
|
+
"dateCreated"
|
|
80
|
+
],
|
|
81
|
+
"allOf": [
|
|
82
|
+
{
|
|
83
|
+
"$ref": "https://schema.3sixty.global/documents/DocumentBase"
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://schema.3sixty.global/documents/DocumentAttestation",
|
|
4
|
+
"title": "DocumentAttestation",
|
|
5
|
+
"description": "Interface describing a document attestation.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"@context": {
|
|
9
|
+
"type": "array",
|
|
10
|
+
"prefixItems": [
|
|
11
|
+
{
|
|
12
|
+
"const": "https://schema.org"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"const": "https://schema.3sixty.global/documents/"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"const": "https://schema.3sixty.global/common/"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"items": false,
|
|
22
|
+
"minItems": 3,
|
|
23
|
+
"maxItems": 3,
|
|
24
|
+
"description": "JSON-LD Context."
|
|
25
|
+
},
|
|
26
|
+
"type": {
|
|
27
|
+
"const": "DocumentAttestation",
|
|
28
|
+
"description": "JSON-LD Type."
|
|
29
|
+
},
|
|
30
|
+
"documentId": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"description": "The id of the document."
|
|
33
|
+
},
|
|
34
|
+
"documentCode": {
|
|
35
|
+
"$ref": "https://schema.3sixty.global/unece/UneceDocumentCodeList",
|
|
36
|
+
"description": "The code for the document type."
|
|
37
|
+
},
|
|
38
|
+
"documentRevision": {
|
|
39
|
+
"type": "number",
|
|
40
|
+
"description": "The revision of the document as a 0 based index."
|
|
41
|
+
},
|
|
42
|
+
"dateCreated": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"description": "The date/time of when the document was created."
|
|
45
|
+
},
|
|
46
|
+
"integrity": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"description": "The integrity of the document being attested."
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"required": [
|
|
52
|
+
"@context",
|
|
53
|
+
"type",
|
|
54
|
+
"documentId",
|
|
55
|
+
"documentCode",
|
|
56
|
+
"documentRevision",
|
|
57
|
+
"dateCreated",
|
|
58
|
+
"integrity"
|
|
59
|
+
]
|
|
60
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://schema.3sixty.global/documents/DocumentBase",
|
|
4
|
+
"title": "DocumentBase",
|
|
5
|
+
"description": "Interface describing a document base.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"documentId": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The id of the document."
|
|
11
|
+
},
|
|
12
|
+
"documentIdFormat": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "The format of the document id."
|
|
15
|
+
},
|
|
16
|
+
"documentCode": {
|
|
17
|
+
"$ref": "https://schema.3sixty.global/unece/UneceDocumentCodeList",
|
|
18
|
+
"description": "The code for the document type."
|
|
19
|
+
},
|
|
20
|
+
"annotationObject": {
|
|
21
|
+
"$ref": "https://schema.3sixty.global/json-ld/JsonLdNodeObject",
|
|
22
|
+
"description": "Additional annotation information for the document."
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"required": [
|
|
26
|
+
"documentId",
|
|
27
|
+
"documentCode"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://schema.3sixty.global/documents/DocumentHydrated",
|
|
4
|
+
"title": "DocumentHydrated",
|
|
5
|
+
"description": "Interface describing a hydrated document which includes additional information that can be optionally requested when retrieving a document.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"blobStorageEntry": {
|
|
9
|
+
"$ref": "https://schema.3sixty.global/blob-storage/BlobStorageEntry",
|
|
10
|
+
"description": "The additional JSON-LD for blob storage if it was requested."
|
|
11
|
+
},
|
|
12
|
+
"extractedData": {
|
|
13
|
+
"description": "The data extracted from the document using data extraction services."
|
|
14
|
+
},
|
|
15
|
+
"attestationInformation": {
|
|
16
|
+
"$ref": "https://schema.3sixty.global/attestation/AttestationInformation",
|
|
17
|
+
"description": "The additional JSON-LD for attestation storage if it was requested."
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"allOf": [
|
|
21
|
+
{
|
|
22
|
+
"$ref": "https://schema.3sixty.global/documents/Document"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://schema.3sixty.global/documents/DocumentList",
|
|
4
|
+
"title": "DocumentList",
|
|
5
|
+
"description": "Interface describing a list of document entries.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"@context": {
|
|
9
|
+
"type": "array",
|
|
10
|
+
"prefixItems": [
|
|
11
|
+
{
|
|
12
|
+
"const": "https://schema.org"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"const": "https://schema.3sixty.global/documents/"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"const": "https://schema.3sixty.global/common/"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"items": {
|
|
22
|
+
"$ref": "https://schema.3sixty.global/json-ld/JsonLdContextDefinitionElement"
|
|
23
|
+
},
|
|
24
|
+
"minItems": 3,
|
|
25
|
+
"description": "JSON-LD Context."
|
|
26
|
+
},
|
|
27
|
+
"type": {
|
|
28
|
+
"const": "ItemList",
|
|
29
|
+
"description": "JSON-LD Type."
|
|
30
|
+
},
|
|
31
|
+
"itemListElement": {
|
|
32
|
+
"type": "array",
|
|
33
|
+
"items": {
|
|
34
|
+
"$ref": "https://schema.3sixty.global/documents/DocumentHydrated"
|
|
35
|
+
},
|
|
36
|
+
"description": "The list of documents."
|
|
37
|
+
},
|
|
38
|
+
"edges": {
|
|
39
|
+
"type": "array",
|
|
40
|
+
"items": {
|
|
41
|
+
"type": "string"
|
|
42
|
+
},
|
|
43
|
+
"description": "The ids of the other vertices which are connected to the document."
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"required": [
|
|
47
|
+
"@context",
|
|
48
|
+
"type",
|
|
49
|
+
"itemListElement"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ICompiledValidator } from "@3sixty/data-core";
|
|
2
|
+
/**
|
|
3
|
+
* Compiled validator for the Document schema.
|
|
4
|
+
*/
|
|
5
|
+
export declare const CompiledDocument: ICompiledValidator;
|
|
6
|
+
/**
|
|
7
|
+
* Compiled validator for the DocumentAttestation schema.
|
|
8
|
+
*/
|
|
9
|
+
export declare const CompiledDocumentAttestation: ICompiledValidator;
|
|
10
|
+
/**
|
|
11
|
+
* Compiled validator for the DocumentBase schema.
|
|
12
|
+
*/
|
|
13
|
+
export declare const CompiledDocumentBase: ICompiledValidator;
|
|
14
|
+
/**
|
|
15
|
+
* Compiled validator for the DocumentHydrated schema.
|
|
16
|
+
*/
|
|
17
|
+
export declare const CompiledDocumentHydrated: ICompiledValidator;
|
|
18
|
+
/**
|
|
19
|
+
* Compiled validator for the DocumentList schema.
|
|
20
|
+
*/
|
|
21
|
+
export declare const CompiledDocumentList: ICompiledValidator;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export * from "./compiled/validators.js";
|
|
2
|
+
export * from "./dataTypes/documentManagementDataTypes.js";
|
|
3
|
+
export * from "./models/api/IDocumentManagementCreateRequest.js";
|
|
4
|
+
export * from "./models/api/IDocumentManagementGetRequest.js";
|
|
5
|
+
export * from "./models/api/IDocumentManagementGetResponse.js";
|
|
6
|
+
export * from "./models/api/IDocumentManagementGetRevisionRequest.js";
|
|
7
|
+
export * from "./models/api/IDocumentManagementGetRevisionResponse.js";
|
|
8
|
+
export * from "./models/api/IDocumentManagementQueryRequest.js";
|
|
9
|
+
export * from "./models/api/IDocumentManagementQueryResponse.js";
|
|
10
|
+
export * from "./models/api/IDocumentManagementRemoveRequest.js";
|
|
11
|
+
export * from "./models/api/IDocumentManagementUpdatePartialRequest.js";
|
|
12
|
+
export * from "./models/documentContexts.js";
|
|
13
|
+
export * from "./models/documentTypes.js";
|
|
14
|
+
export * from "./models/IDocument.js";
|
|
15
|
+
export * from "./models/IDocumentBase.js";
|
|
16
|
+
export * from "./models/IDocumentHydrated.js";
|
|
17
|
+
export * from "./models/IDocumentAttestation.js";
|
|
18
|
+
export * from "./models/IDocumentList.js";
|
|
19
|
+
export * from "./models/IDocumentManagementComponent.js";
|
|
20
|
+
export * from "./models/IDocumentManagementEdgeEntry.js";
|
|
21
|
+
export * from "./models/documentManagementMetricIds.js";
|
|
22
|
+
export * from "./models/documentManagementMetrics.js";
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { IJsonLdContextDefinitionElement } from "@3sixty/data-json-ld";
|
|
2
|
+
import type { SchemaOrgContexts } from "@3sixty/standards-schema-org";
|
|
3
|
+
import type { DocumentContexts } from "./documentContexts.js";
|
|
4
|
+
import type { DocumentTypes } from "./documentTypes.js";
|
|
5
|
+
import type { IDocumentBase } from "./IDocumentBase.js";
|
|
6
|
+
/**
|
|
7
|
+
* Interface describing a document.
|
|
8
|
+
*/
|
|
9
|
+
export interface IDocument extends IDocumentBase {
|
|
10
|
+
/**
|
|
11
|
+
* JSON-LD Context.
|
|
12
|
+
*/
|
|
13
|
+
"@context": [
|
|
14
|
+
typeof SchemaOrgContexts.Context,
|
|
15
|
+
typeof DocumentContexts.Context,
|
|
16
|
+
typeof DocumentContexts.ContextCommon,
|
|
17
|
+
...IJsonLdContextDefinitionElement[]
|
|
18
|
+
];
|
|
19
|
+
/**
|
|
20
|
+
* JSON-LD Type.
|
|
21
|
+
*/
|
|
22
|
+
type: typeof DocumentTypes.Document;
|
|
23
|
+
/**
|
|
24
|
+
* The full id of the document.
|
|
25
|
+
*/
|
|
26
|
+
id: string;
|
|
27
|
+
/**
|
|
28
|
+
* The revision of the document as a 0 based index.
|
|
29
|
+
* @json-ld type:schema:Integer
|
|
30
|
+
*/
|
|
31
|
+
documentRevision: number;
|
|
32
|
+
/**
|
|
33
|
+
* The blob storage id for the document.
|
|
34
|
+
* @json-ld type:schema:identifier
|
|
35
|
+
*/
|
|
36
|
+
blobStorageId: string;
|
|
37
|
+
/**
|
|
38
|
+
* The integrity of the blob data.
|
|
39
|
+
* @json-ld namespace:twin-common
|
|
40
|
+
*/
|
|
41
|
+
integrity: string;
|
|
42
|
+
/**
|
|
43
|
+
* The attestation for the document if one was created.
|
|
44
|
+
* @json-ld type:schema:identifier
|
|
45
|
+
*/
|
|
46
|
+
attestationId?: string;
|
|
47
|
+
/**
|
|
48
|
+
* The date/time of when the document was created.
|
|
49
|
+
* @json-ld namespace:schema
|
|
50
|
+
*/
|
|
51
|
+
dateCreated: string;
|
|
52
|
+
/**
|
|
53
|
+
* The date/time of when the document was modified.
|
|
54
|
+
* @json-ld namespace:schema
|
|
55
|
+
*/
|
|
56
|
+
dateModified?: string;
|
|
57
|
+
/**
|
|
58
|
+
* The date/time of when the document was deleted, as we never actually remove items.
|
|
59
|
+
* @json-ld namespace:schema
|
|
60
|
+
*/
|
|
61
|
+
dateDeleted?: string;
|
|
62
|
+
/**
|
|
63
|
+
* The organization which added the document to the graph.
|
|
64
|
+
* @json-ld namespace:twin-common
|
|
65
|
+
*/
|
|
66
|
+
organizationIdentity?: string;
|
|
67
|
+
/**
|
|
68
|
+
* The user who added the document to the graph.
|
|
69
|
+
* @json-ld namespace:twin-common
|
|
70
|
+
*/
|
|
71
|
+
userIdentity?: string;
|
|
72
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { SchemaOrgContexts } from "@3sixty/standards-schema-org";
|
|
2
|
+
import type { UneceDocumentCodeList } from "@3sixty/standards-unece";
|
|
3
|
+
import type { DocumentContexts } from "./documentContexts.js";
|
|
4
|
+
import type { DocumentTypes } from "./documentTypes.js";
|
|
5
|
+
/**
|
|
6
|
+
* Interface describing a document attestation.
|
|
7
|
+
*/
|
|
8
|
+
export interface IDocumentAttestation {
|
|
9
|
+
/**
|
|
10
|
+
* JSON-LD Context.
|
|
11
|
+
*/
|
|
12
|
+
"@context": [
|
|
13
|
+
typeof SchemaOrgContexts.Context,
|
|
14
|
+
typeof DocumentContexts.Context,
|
|
15
|
+
typeof DocumentContexts.ContextCommon
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* JSON-LD Type.
|
|
19
|
+
*/
|
|
20
|
+
type: typeof DocumentTypes.DocumentAttestation;
|
|
21
|
+
/**
|
|
22
|
+
* The id of the document.
|
|
23
|
+
* @json-ld type:schema:identifier
|
|
24
|
+
*/
|
|
25
|
+
documentId: string;
|
|
26
|
+
/**
|
|
27
|
+
* The code for the document type.
|
|
28
|
+
* @json-ld type:schema:identifier
|
|
29
|
+
*/
|
|
30
|
+
documentCode: UneceDocumentCodeList;
|
|
31
|
+
/**
|
|
32
|
+
* The revision of the document as a 0 based index.
|
|
33
|
+
* @json-ld type:schema:Integer
|
|
34
|
+
*/
|
|
35
|
+
documentRevision: number;
|
|
36
|
+
/**
|
|
37
|
+
* The date/time of when the document was created.
|
|
38
|
+
* @json-ld namespace:schema
|
|
39
|
+
*/
|
|
40
|
+
dateCreated: string;
|
|
41
|
+
/**
|
|
42
|
+
* The integrity of the document being attested.
|
|
43
|
+
* @json-ld namespace:twin-common
|
|
44
|
+
*/
|
|
45
|
+
integrity: string;
|
|
46
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { IJsonLdNodeObject } from "@3sixty/data-json-ld";
|
|
2
|
+
import type { UneceDocumentCodeList } from "@3sixty/standards-unece";
|
|
3
|
+
/**
|
|
4
|
+
* Interface describing a document base.
|
|
5
|
+
*/
|
|
6
|
+
export interface IDocumentBase {
|
|
7
|
+
/**
|
|
8
|
+
* The id of the document.
|
|
9
|
+
* @json-ld type:schema:identifier
|
|
10
|
+
*/
|
|
11
|
+
documentId: string;
|
|
12
|
+
/**
|
|
13
|
+
* The format of the document id.
|
|
14
|
+
* @json-ld type:schema:Text
|
|
15
|
+
*/
|
|
16
|
+
documentIdFormat?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The code for the document type.
|
|
19
|
+
* @json-ld type:schema:identifier
|
|
20
|
+
*/
|
|
21
|
+
documentCode: UneceDocumentCodeList;
|
|
22
|
+
/**
|
|
23
|
+
* Additional annotation information for the document.
|
|
24
|
+
* @json-ld namespace:twin-common
|
|
25
|
+
*/
|
|
26
|
+
annotationObject?: IJsonLdNodeObject;
|
|
27
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { IAttestationInformation } from "@3sixty/attestation-models";
|
|
2
|
+
import type { IBlobStorageEntry } from "@3sixty/blob-storage-models";
|
|
3
|
+
import type { IDocument } from "./IDocument.js";
|
|
4
|
+
/**
|
|
5
|
+
* Interface describing a hydrated document which includes additional information that can be optionally requested when retrieving a document.
|
|
6
|
+
*/
|
|
7
|
+
export interface IDocumentHydrated extends IDocument {
|
|
8
|
+
/**
|
|
9
|
+
* The additional JSON-LD for blob storage if it was requested.
|
|
10
|
+
* @json-ld id
|
|
11
|
+
*/
|
|
12
|
+
blobStorageEntry?: IBlobStorageEntry;
|
|
13
|
+
/**
|
|
14
|
+
* The data extracted from the document using data extraction services.
|
|
15
|
+
* @json-ld type:json
|
|
16
|
+
*/
|
|
17
|
+
extractedData?: unknown;
|
|
18
|
+
/**
|
|
19
|
+
* The additional JSON-LD for attestation storage if it was requested.
|
|
20
|
+
* @json-ld id
|
|
21
|
+
*/
|
|
22
|
+
attestationInformation?: IAttestationInformation;
|
|
23
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { IJsonLdContextDefinitionElement } from "@3sixty/data-json-ld";
|
|
2
|
+
import type { SchemaOrgContexts, SchemaOrgTypes } from "@3sixty/standards-schema-org";
|
|
3
|
+
import type { DocumentContexts } from "./documentContexts.js";
|
|
4
|
+
import type { IDocumentHydrated } from "./IDocumentHydrated.js";
|
|
5
|
+
/**
|
|
6
|
+
* Interface describing a list of document entries.
|
|
7
|
+
*/
|
|
8
|
+
export interface IDocumentList {
|
|
9
|
+
/**
|
|
10
|
+
* JSON-LD Context.
|
|
11
|
+
*/
|
|
12
|
+
"@context": [
|
|
13
|
+
typeof SchemaOrgContexts.Context,
|
|
14
|
+
typeof DocumentContexts.Context,
|
|
15
|
+
typeof DocumentContexts.ContextCommon,
|
|
16
|
+
...IJsonLdContextDefinitionElement[]
|
|
17
|
+
];
|
|
18
|
+
/**
|
|
19
|
+
* JSON-LD Type.
|
|
20
|
+
*/
|
|
21
|
+
type: typeof SchemaOrgTypes.ItemList;
|
|
22
|
+
/**
|
|
23
|
+
* The list of documents.
|
|
24
|
+
* @json-ld namespace:schema
|
|
25
|
+
*/
|
|
26
|
+
[SchemaOrgTypes.ItemListElement]: IDocumentHydrated[];
|
|
27
|
+
/**
|
|
28
|
+
* The ids of the other vertices which are connected to the document.
|
|
29
|
+
* @json-ld container:set
|
|
30
|
+
*/
|
|
31
|
+
edges?: string[];
|
|
32
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { IAuditableItemGraphVertexList } from "@3sixty/auditable-item-graph-models";
|
|
2
|
+
import type { IComponent } from "@3sixty/core";
|
|
3
|
+
import type { IJsonLdNodeObject } from "@3sixty/data-json-ld";
|
|
4
|
+
import type { IDocumentBase } from "./IDocumentBase.js";
|
|
5
|
+
import type { IDocumentHydrated } from "./IDocumentHydrated.js";
|
|
6
|
+
import type { IDocumentList } from "./IDocumentList.js";
|
|
7
|
+
import type { IDocumentManagementEdgeEntry } from "./IDocumentManagementEdgeEntry.js";
|
|
8
|
+
/**
|
|
9
|
+
* Interface describing a document management contract.
|
|
10
|
+
*/
|
|
11
|
+
export interface IDocumentManagementComponent extends IComponent {
|
|
12
|
+
/**
|
|
13
|
+
* Create a document as an auditable item graph vertex and add its content to blob storage.
|
|
14
|
+
* If the document id already exists and the blob data is different a new revision will be created.
|
|
15
|
+
* For any other changes the current revision will be updated.
|
|
16
|
+
* @param document The document base properties.
|
|
17
|
+
* @param blob The data to create the document with as bytes, or an existing blob storage entry id.
|
|
18
|
+
* @param auditableItemGraphEdges The auditable item graph vertices to connect the document to.
|
|
19
|
+
* @param options Additional options for the set operation.
|
|
20
|
+
* @param options.includeAttestation Flag to create an attestation for the document, defaults to false.
|
|
21
|
+
* @param options.includeAlias Flag to add the document id as an alias to the aig vertex, defaults to true.
|
|
22
|
+
* @param options.aliasAnnotationObject Annotation object for the alias.
|
|
23
|
+
* @returns The auditable item graph vertex created for the document including its revision.
|
|
24
|
+
*/
|
|
25
|
+
create(document: IDocumentBase, blob: Uint8Array | string, auditableItemGraphEdges?: IDocumentManagementEdgeEntry[], options?: {
|
|
26
|
+
includeAttestation?: boolean;
|
|
27
|
+
includeAlias?: boolean;
|
|
28
|
+
aliasAnnotationObject?: IJsonLdNodeObject;
|
|
29
|
+
}): Promise<string>;
|
|
30
|
+
/**
|
|
31
|
+
* Update a document as an auditable item graph vertex and add its content to blob storage.
|
|
32
|
+
* If the blob data is different a new revision will be created.
|
|
33
|
+
* For any other changes the current revision will be updated.
|
|
34
|
+
* @param auditableItemGraphDocumentId The auditable item graph vertex id which contains the document.
|
|
35
|
+
* @param document The document base properties to update. annotationObject, documentIdFormat and documentCode are applied in-place to the current revision.
|
|
36
|
+
* @param blob The data to update the document with as bytes, or an existing blob storage entry id.
|
|
37
|
+
* @param auditableItemGraphEdges Explicit edge delta to apply. If undefined, existing connections
|
|
38
|
+
* are retained unchanged. Use `add` to create new connections and `remove` to disconnect existing
|
|
39
|
+
* ones by their target vertex id. To update alias metadata on an already-connected vertex, include
|
|
40
|
+
* it in `add` with the updated `aliasAnnotationObject` - AIG's alias patch is an upsert, so the
|
|
41
|
+
* alias is updated in place without creating a duplicate back-edge.
|
|
42
|
+
* @param auditableItemGraphEdges.add Connections to add; each creates a back-edge on the connected vertex.
|
|
43
|
+
* @param auditableItemGraphEdges.remove Target vertex IDs to disconnect; their back-edges are removed.
|
|
44
|
+
* @param options Additional options for the update operation.
|
|
45
|
+
* @param options.includeAttestation Set to true to start attesting the document (even if originally created without attestation), or false to remove the existing attestation. Omit (undefined) to leave attestation state unchanged.
|
|
46
|
+
* @param options.includeAlias Set to true to add the document id as an alias on the aig vertex, or false to remove it. Omit to leave alias state unchanged.
|
|
47
|
+
* @param options.aliasAnnotationObject Annotation object for the alias when adding.
|
|
48
|
+
* @returns A promise that resolves when the document has been updated.
|
|
49
|
+
*/
|
|
50
|
+
updatePartial(auditableItemGraphDocumentId: string, document?: Partial<Pick<IDocumentBase, "annotationObject" | "documentIdFormat" | "documentCode">>, blob?: Uint8Array | string, auditableItemGraphEdges?: {
|
|
51
|
+
add?: IDocumentManagementEdgeEntry[];
|
|
52
|
+
remove?: string[];
|
|
53
|
+
}, options?: {
|
|
54
|
+
includeAttestation?: boolean;
|
|
55
|
+
includeAlias?: boolean;
|
|
56
|
+
aliasAnnotationObject?: IJsonLdNodeObject;
|
|
57
|
+
}): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Get a document using it's auditable item graph vertex id and optional revision.
|
|
60
|
+
* @param auditableItemGraphDocumentId The auditable item graph vertex id which contains the document.
|
|
61
|
+
* @param options Additional options for the get operation.
|
|
62
|
+
* @param options.includeBlobStorageMetadata Flag to include the blob storage metadata for the document, defaults to false.
|
|
63
|
+
* @param options.includeBlobStorageData Flag to include the blob storage data for the document, defaults to false.
|
|
64
|
+
* @param options.includeAttestation Flag to include the attestation information for the document, defaults to false.
|
|
65
|
+
* @param options.includeRemoved Flag to include deleted documents, defaults to false.
|
|
66
|
+
* @param options.includeDeletedEdges Flag to include soft-deleted edges in the response, defaults to false.
|
|
67
|
+
* @param options.extractRuleGroupId If provided will extract data from the document using the specified rule group id.
|
|
68
|
+
* @param options.extractMimeType By default extraction will auto detect the mime type of the document, this can be used to override the detection.
|
|
69
|
+
* @param cursor The cursor to get the next chunk of revisions.
|
|
70
|
+
* @param limit Limit the number of items to return, defaults to 1 so only most recent is returned.
|
|
71
|
+
* @returns The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
|
|
72
|
+
*/
|
|
73
|
+
get(auditableItemGraphDocumentId: string, options?: {
|
|
74
|
+
includeBlobStorageMetadata?: boolean;
|
|
75
|
+
includeBlobStorageData?: boolean;
|
|
76
|
+
includeAttestation?: boolean;
|
|
77
|
+
includeRemoved?: boolean;
|
|
78
|
+
includeDeletedEdges?: boolean;
|
|
79
|
+
extractRuleGroupId?: string;
|
|
80
|
+
extractMimeType?: string;
|
|
81
|
+
}, cursor?: string, limit?: number): Promise<{
|
|
82
|
+
entries: IDocumentList;
|
|
83
|
+
cursor?: string;
|
|
84
|
+
}>;
|
|
85
|
+
/**
|
|
86
|
+
* Get a document revision using it's auditable item graph vertex id.
|
|
87
|
+
* @param auditableItemGraphDocumentId The auditable item graph vertex id which contains the document.
|
|
88
|
+
* @param revision The revision id of the document to get.
|
|
89
|
+
* @param options Additional options for the get operation.
|
|
90
|
+
* @param options.includeBlobStorageMetadata Flag to include the blob storage metadata for the document, defaults to false.
|
|
91
|
+
* @param options.includeBlobStorageData Flag to include the blob storage data for the document, defaults to false.
|
|
92
|
+
* @param options.includeAttestation Flag to include the attestation information for the document, defaults to false.
|
|
93
|
+
* @param options.extractRuleGroupId If provided will extract data from the document using the specified rule group id.
|
|
94
|
+
* @param options.extractMimeType By default extraction will auto detect the mime type of the document, this can be used to override the detection.
|
|
95
|
+
* @returns The document for the specified revision.
|
|
96
|
+
*/
|
|
97
|
+
getRevision(auditableItemGraphDocumentId: string, revision: number, options?: {
|
|
98
|
+
includeBlobStorageMetadata?: boolean;
|
|
99
|
+
includeBlobStorageData?: boolean;
|
|
100
|
+
includeAttestation?: boolean;
|
|
101
|
+
extractRuleGroupId?: string;
|
|
102
|
+
extractMimeType?: string;
|
|
103
|
+
}): Promise<IDocumentHydrated>;
|
|
104
|
+
/**
|
|
105
|
+
* Remove an auditable item graph vertex using it's id.
|
|
106
|
+
* The document dateDeleted will be set, but can still be queried with the includeRemoved flag.
|
|
107
|
+
* @param auditableItemGraphDocumentId The auditable item graph vertex id which contains the document.
|
|
108
|
+
* @param revision The revision of the document to remove.
|
|
109
|
+
* @returns A promise that resolves when the revision has been removed.
|
|
110
|
+
*/
|
|
111
|
+
removeRevision(auditableItemGraphDocumentId: string, revision: number): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Find all the document with a specific id.
|
|
114
|
+
* @param documentId The document id to find in the graph.
|
|
115
|
+
* @param cursor The cursor to get the next chunk of documents.
|
|
116
|
+
* @param limit The limit to get the next chunk of documents.
|
|
117
|
+
* @returns The graph vertices that contain documents referencing the specified document id.
|
|
118
|
+
*/
|
|
119
|
+
query(documentId: string, cursor?: string, limit?: number): Promise<{
|
|
120
|
+
entries: IAuditableItemGraphVertexList;
|
|
121
|
+
cursor?: string;
|
|
122
|
+
}>;
|
|
123
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { IJsonLdNodeObject } from "@3sixty/data-json-ld";
|
|
2
|
+
/**
|
|
3
|
+
* A single edge entry used when connecting a document to an AIG vertex.
|
|
4
|
+
*/
|
|
5
|
+
export interface IDocumentManagementEdgeEntry {
|
|
6
|
+
/**
|
|
7
|
+
* The target AIG vertex id to connect to.
|
|
8
|
+
*/
|
|
9
|
+
targetId: string;
|
|
10
|
+
/**
|
|
11
|
+
* Whether to add the document id as an alias on the connected vertex, defaults to false.
|
|
12
|
+
*/
|
|
13
|
+
includeAlias?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Annotation object for the alias, if includeAlias is true.
|
|
16
|
+
*/
|
|
17
|
+
aliasAnnotationObject?: IJsonLdNodeObject;
|
|
18
|
+
}
|