@twin.org/document-management-models 0.0.1-next.14 → 0.0.1-next.15

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.
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ var dataCore = require('@twin.org/data-core');
4
+
3
5
  // Copyright 2024 IOTA Stiftung.
4
6
  // SPDX-License-Identifier: Apache-2.0.
5
7
  /**
@@ -34,5 +36,151 @@ const DocumentTypes = {
34
36
  DocumentAttestation: "DocumentAttestation"
35
37
  };
36
38
 
39
+ var type = "object";
40
+ var properties = {
41
+ "@context": {
42
+ type: "array",
43
+ minItems: 3,
44
+ items: [
45
+ {
46
+ type: "string",
47
+ "const": "https://schema.twindev.org/documents/"
48
+ },
49
+ {
50
+ type: "string",
51
+ "const": "https://schema.twindev.org/common/"
52
+ },
53
+ {
54
+ type: "string",
55
+ "const": "https://schema.org"
56
+ }
57
+ ],
58
+ additionalItems: {
59
+ $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
60
+ },
61
+ description: "JSON-LD Context."
62
+ },
63
+ type: {
64
+ type: "string",
65
+ "const": "Document",
66
+ description: "JSON-LD Type."
67
+ },
68
+ id: {
69
+ type: "string",
70
+ description: "The full id of the document."
71
+ },
72
+ documentId: {
73
+ type: "string",
74
+ description: "The id of the document."
75
+ },
76
+ documentIdFormat: {
77
+ type: "string",
78
+ description: "The format of the document id."
79
+ },
80
+ documentCode: {
81
+ $ref: "https://vocabulary.uncefact.org/DocumentCodeList",
82
+ description: "The code for the document type."
83
+ },
84
+ documentRevision: {
85
+ type: "number",
86
+ description: "The revision of the document as a 0 based index."
87
+ },
88
+ annotationObject: {
89
+ $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
90
+ description: "Additional annotation information for the document."
91
+ },
92
+ blobStorageId: {
93
+ type: "string",
94
+ description: "The blob storage id for the document."
95
+ },
96
+ blobHash: {
97
+ type: "string",
98
+ description: "The hash of the blob data."
99
+ },
100
+ blobStorageEntry: {
101
+ $ref: "https://schema.twindev.org/blob-storage/BlobStorageEntry",
102
+ description: "The additional JSON-LD for blob storage if it was requested."
103
+ },
104
+ extractedData: {
105
+ description: "The data extracted from the document using data extraction services."
106
+ },
107
+ attestationId: {
108
+ type: "string",
109
+ description: "The attestation for the document if one was created."
110
+ },
111
+ attestationInformation: {
112
+ $ref: "https://schema.twindev.org/attestation/AttestationInformation",
113
+ description: "The additional JSON-LD for attestation storage if it was requested."
114
+ },
115
+ dateCreated: {
116
+ type: "string",
117
+ description: "The date/time of when the document was created."
118
+ },
119
+ dateModified: {
120
+ type: "string",
121
+ description: "The date/time of when the document was modified."
122
+ },
123
+ dateDeleted: {
124
+ type: "string",
125
+ description: "The date/time of when the document was deleted, as we never actually remove items."
126
+ },
127
+ nodeIdentity: {
128
+ type: "string",
129
+ description: "The node which added the document to the graph."
130
+ },
131
+ userIdentity: {
132
+ type: "string",
133
+ description: "The user who added the document to the graph."
134
+ }
135
+ };
136
+ var required = [
137
+ "@context",
138
+ "type",
139
+ "id",
140
+ "documentId",
141
+ "documentCode",
142
+ "documentRevision",
143
+ "blobStorageId",
144
+ "blobHash",
145
+ "dateCreated",
146
+ "nodeIdentity",
147
+ "userIdentity"
148
+ ];
149
+ var additionalProperties = false;
150
+ var description = "Interface describing a document.";
151
+ var DocumentSchema = {
152
+ type: type,
153
+ properties: properties,
154
+ required: required,
155
+ additionalProperties: additionalProperties,
156
+ description: description
157
+ };
158
+
159
+ // Copyright 2024 IOTA Stiftung.
160
+ // SPDX-License-Identifier: Apache-2.0.
161
+ /**
162
+ * Handle all the data types for document management.
163
+ */
164
+ class DocumentManagementDataTypes {
165
+ /**
166
+ * Register all the data types.
167
+ */
168
+ static registerTypes() {
169
+ dataCore.DataTypeHandlerFactory.register(`${DocumentContexts.ContextRoot}${DocumentTypes.Document}`, () => ({
170
+ context: DocumentContexts.ContextRoot,
171
+ type: DocumentTypes.Document,
172
+ defaultValue: {},
173
+ jsonSchema: async () => DocumentSchema
174
+ }));
175
+ dataCore.DataTypeHandlerFactory.register(`${DocumentContexts.ContextRoot}${DocumentTypes.DocumentAttestation}`, () => ({
176
+ context: DocumentContexts.ContextRoot,
177
+ type: DocumentTypes.DocumentAttestation,
178
+ defaultValue: {},
179
+ jsonSchema: async () => DocumentSchema
180
+ }));
181
+ }
182
+ }
183
+
37
184
  exports.DocumentContexts = DocumentContexts;
185
+ exports.DocumentManagementDataTypes = DocumentManagementDataTypes;
38
186
  exports.DocumentTypes = DocumentTypes;
@@ -1,3 +1,5 @@
1
+ import { DataTypeHandlerFactory } from '@twin.org/data-core';
2
+
1
3
  // Copyright 2024 IOTA Stiftung.
2
4
  // SPDX-License-Identifier: Apache-2.0.
3
5
  /**
@@ -32,4 +34,149 @@ const DocumentTypes = {
32
34
  DocumentAttestation: "DocumentAttestation"
33
35
  };
34
36
 
35
- export { DocumentContexts, DocumentTypes };
37
+ var type = "object";
38
+ var properties = {
39
+ "@context": {
40
+ type: "array",
41
+ minItems: 3,
42
+ items: [
43
+ {
44
+ type: "string",
45
+ "const": "https://schema.twindev.org/documents/"
46
+ },
47
+ {
48
+ type: "string",
49
+ "const": "https://schema.twindev.org/common/"
50
+ },
51
+ {
52
+ type: "string",
53
+ "const": "https://schema.org"
54
+ }
55
+ ],
56
+ additionalItems: {
57
+ $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
58
+ },
59
+ description: "JSON-LD Context."
60
+ },
61
+ type: {
62
+ type: "string",
63
+ "const": "Document",
64
+ description: "JSON-LD Type."
65
+ },
66
+ id: {
67
+ type: "string",
68
+ description: "The full id of the document."
69
+ },
70
+ documentId: {
71
+ type: "string",
72
+ description: "The id of the document."
73
+ },
74
+ documentIdFormat: {
75
+ type: "string",
76
+ description: "The format of the document id."
77
+ },
78
+ documentCode: {
79
+ $ref: "https://vocabulary.uncefact.org/DocumentCodeList",
80
+ description: "The code for the document type."
81
+ },
82
+ documentRevision: {
83
+ type: "number",
84
+ description: "The revision of the document as a 0 based index."
85
+ },
86
+ annotationObject: {
87
+ $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
88
+ description: "Additional annotation information for the document."
89
+ },
90
+ blobStorageId: {
91
+ type: "string",
92
+ description: "The blob storage id for the document."
93
+ },
94
+ blobHash: {
95
+ type: "string",
96
+ description: "The hash of the blob data."
97
+ },
98
+ blobStorageEntry: {
99
+ $ref: "https://schema.twindev.org/blob-storage/BlobStorageEntry",
100
+ description: "The additional JSON-LD for blob storage if it was requested."
101
+ },
102
+ extractedData: {
103
+ description: "The data extracted from the document using data extraction services."
104
+ },
105
+ attestationId: {
106
+ type: "string",
107
+ description: "The attestation for the document if one was created."
108
+ },
109
+ attestationInformation: {
110
+ $ref: "https://schema.twindev.org/attestation/AttestationInformation",
111
+ description: "The additional JSON-LD for attestation storage if it was requested."
112
+ },
113
+ dateCreated: {
114
+ type: "string",
115
+ description: "The date/time of when the document was created."
116
+ },
117
+ dateModified: {
118
+ type: "string",
119
+ description: "The date/time of when the document was modified."
120
+ },
121
+ dateDeleted: {
122
+ type: "string",
123
+ description: "The date/time of when the document was deleted, as we never actually remove items."
124
+ },
125
+ nodeIdentity: {
126
+ type: "string",
127
+ description: "The node which added the document to the graph."
128
+ },
129
+ userIdentity: {
130
+ type: "string",
131
+ description: "The user who added the document to the graph."
132
+ }
133
+ };
134
+ var required = [
135
+ "@context",
136
+ "type",
137
+ "id",
138
+ "documentId",
139
+ "documentCode",
140
+ "documentRevision",
141
+ "blobStorageId",
142
+ "blobHash",
143
+ "dateCreated",
144
+ "nodeIdentity",
145
+ "userIdentity"
146
+ ];
147
+ var additionalProperties = false;
148
+ var description = "Interface describing a document.";
149
+ var DocumentSchema = {
150
+ type: type,
151
+ properties: properties,
152
+ required: required,
153
+ additionalProperties: additionalProperties,
154
+ description: description
155
+ };
156
+
157
+ // Copyright 2024 IOTA Stiftung.
158
+ // SPDX-License-Identifier: Apache-2.0.
159
+ /**
160
+ * Handle all the data types for document management.
161
+ */
162
+ class DocumentManagementDataTypes {
163
+ /**
164
+ * Register all the data types.
165
+ */
166
+ static registerTypes() {
167
+ DataTypeHandlerFactory.register(`${DocumentContexts.ContextRoot}${DocumentTypes.Document}`, () => ({
168
+ context: DocumentContexts.ContextRoot,
169
+ type: DocumentTypes.Document,
170
+ defaultValue: {},
171
+ jsonSchema: async () => DocumentSchema
172
+ }));
173
+ DataTypeHandlerFactory.register(`${DocumentContexts.ContextRoot}${DocumentTypes.DocumentAttestation}`, () => ({
174
+ context: DocumentContexts.ContextRoot,
175
+ type: DocumentTypes.DocumentAttestation,
176
+ defaultValue: {},
177
+ jsonSchema: async () => DocumentSchema
178
+ }));
179
+ }
180
+ }
181
+
182
+ export { DocumentContexts, DocumentManagementDataTypes, DocumentTypes };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Handle all the data types for document management.
3
+ */
4
+ export declare class DocumentManagementDataTypes {
5
+ /**
6
+ * Register all the data types.
7
+ */
8
+ static registerTypes(): void;
9
+ }
@@ -1,3 +1,4 @@
1
+ export * from "./dataTypes/documentManagementDataTypes";
1
2
  export * from "./models/api/IDocumentManagementCreateRequest";
2
3
  export * from "./models/api/IDocumentManagementGetRequest";
3
4
  export * from "./models/api/IDocumentManagementGetResponse";
package/docs/changelog.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @twin.org/document-management-models - Changelog
2
2
 
3
+ ## [0.0.1-next.15](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.14...document-management-models-v0.0.1-next.15) (2025-05-28)
4
+
5
+
6
+ ### Features
7
+
8
+ * data type registration use fully qualified names ([18d27d0](https://github.com/twinfoundation/document-management/commit/18d27d0c21d0f652b7df4b409bb2d3c66cf22f84))
9
+
3
10
  ## [0.0.1-next.14](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.13...document-management-models-v0.0.1-next.14) (2025-05-08)
4
11
 
5
12
 
@@ -0,0 +1,25 @@
1
+ # Class: DocumentManagementDataTypes
2
+
3
+ Handle all the data types for document management.
4
+
5
+ ## Constructors
6
+
7
+ ### Constructor
8
+
9
+ > **new DocumentManagementDataTypes**(): `DocumentManagementDataTypes`
10
+
11
+ #### Returns
12
+
13
+ `DocumentManagementDataTypes`
14
+
15
+ ## Methods
16
+
17
+ ### registerTypes()
18
+
19
+ > `static` **registerTypes**(): `void`
20
+
21
+ Register all the data types.
22
+
23
+ #### Returns
24
+
25
+ `void`
@@ -1,5 +1,9 @@
1
1
  # @twin.org/document-management-models
2
2
 
3
+ ## Classes
4
+
5
+ - [DocumentManagementDataTypes](classes/DocumentManagementDataTypes.md)
6
+
3
7
  ## Interfaces
4
8
 
5
9
  - [IDocument](interfaces/IDocument.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/document-management-models",
3
- "version": "0.0.1-next.14",
3
+ "version": "0.0.1-next.15",
4
4
  "description": "Models which define the structure of the document management connectors and services",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,6 +18,7 @@
18
18
  "@twin.org/auditable-item-graph-models": "next",
19
19
  "@twin.org/blob-storage-models": "next",
20
20
  "@twin.org/core": "next",
21
+ "@twin.org/data-core": "next",
21
22
  "@twin.org/data-json-ld": "next",
22
23
  "@twin.org/nameof": "next",
23
24
  "@twin.org/standards-schema-org": "next",