@twin.org/blob-storage-models 0.0.1-next.22 → 0.0.1-next.24

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.
@@ -11,9 +11,13 @@ var core = require('@twin.org/core');
11
11
  // eslint-disable-next-line @typescript-eslint/naming-convention
12
12
  const BlobStorageTypes = {
13
13
  /**
14
- * The context root for the auditable item blob storage types.
14
+ * The context root for the blob storage types.
15
15
  */
16
16
  ContextRoot: "https://schema.twindev.org/blob-storage/",
17
+ /**
18
+ * The context root for the common types.
19
+ */
20
+ ContextRootCommon: "https://schema.twindev.org/common/",
17
21
  /**
18
22
  * Represents blob storage entry.
19
23
  */
@@ -27,25 +31,21 @@ const BlobStorageTypes = {
27
31
  var type = "object";
28
32
  var properties = {
29
33
  "@context": {
30
- anyOf: [
34
+ type: "array",
35
+ minItems: 2,
36
+ items: [
31
37
  {
32
38
  type: "string",
33
39
  "const": "https://schema.twindev.org/blob-storage/"
34
40
  },
35
41
  {
36
- type: "array",
37
- minItems: 1,
38
- items: [
39
- {
40
- type: "string",
41
- "const": "https://schema.twindev.org/blob-storage/"
42
- }
43
- ],
44
- additionalItems: {
45
- $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
46
- }
42
+ type: "string",
43
+ "const": "https://schema.twindev.org/common/"
47
44
  }
48
45
  ],
46
+ additionalItems: {
47
+ $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
48
+ },
49
49
  description: "JSON-LD Context."
50
50
  },
51
51
  type: {
@@ -69,6 +69,10 @@ var properties = {
69
69
  type: "number",
70
70
  description: "The size of the data in the blob."
71
71
  },
72
+ blobHash: {
73
+ type: "string",
74
+ description: "The hash of the data in the blob."
75
+ },
72
76
  encodingFormat: {
73
77
  type: "string",
74
78
  description: "The mime type for the blob."
@@ -77,9 +81,9 @@ var properties = {
77
81
  type: "string",
78
82
  description: "The extension."
79
83
  },
80
- metadata: {
84
+ annotationObject: {
81
85
  $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
82
- description: "The metadata for the blob as JSON-LD."
86
+ description: "The annotation object for the blob as JSON-LD."
83
87
  },
84
88
  blob: {
85
89
  type: "string",
@@ -91,7 +95,8 @@ var required = [
91
95
  "type",
92
96
  "id",
93
97
  "dateCreated",
94
- "blobSize"
98
+ "blobSize",
99
+ "blobHash"
95
100
  ];
96
101
  var additionalProperties = false;
97
102
  var description = "Interface describing a blob storage entry.";
@@ -9,9 +9,13 @@ import { Factory } from '@twin.org/core';
9
9
  // eslint-disable-next-line @typescript-eslint/naming-convention
10
10
  const BlobStorageTypes = {
11
11
  /**
12
- * The context root for the auditable item blob storage types.
12
+ * The context root for the blob storage types.
13
13
  */
14
14
  ContextRoot: "https://schema.twindev.org/blob-storage/",
15
+ /**
16
+ * The context root for the common types.
17
+ */
18
+ ContextRootCommon: "https://schema.twindev.org/common/",
15
19
  /**
16
20
  * Represents blob storage entry.
17
21
  */
@@ -25,25 +29,21 @@ const BlobStorageTypes = {
25
29
  var type = "object";
26
30
  var properties = {
27
31
  "@context": {
28
- anyOf: [
32
+ type: "array",
33
+ minItems: 2,
34
+ items: [
29
35
  {
30
36
  type: "string",
31
37
  "const": "https://schema.twindev.org/blob-storage/"
32
38
  },
33
39
  {
34
- type: "array",
35
- minItems: 1,
36
- items: [
37
- {
38
- type: "string",
39
- "const": "https://schema.twindev.org/blob-storage/"
40
- }
41
- ],
42
- additionalItems: {
43
- $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
44
- }
40
+ type: "string",
41
+ "const": "https://schema.twindev.org/common/"
45
42
  }
46
43
  ],
44
+ additionalItems: {
45
+ $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
46
+ },
47
47
  description: "JSON-LD Context."
48
48
  },
49
49
  type: {
@@ -67,6 +67,10 @@ var properties = {
67
67
  type: "number",
68
68
  description: "The size of the data in the blob."
69
69
  },
70
+ blobHash: {
71
+ type: "string",
72
+ description: "The hash of the data in the blob."
73
+ },
70
74
  encodingFormat: {
71
75
  type: "string",
72
76
  description: "The mime type for the blob."
@@ -75,9 +79,9 @@ var properties = {
75
79
  type: "string",
76
80
  description: "The extension."
77
81
  },
78
- metadata: {
82
+ annotationObject: {
79
83
  $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
80
- description: "The metadata for the blob as JSON-LD."
84
+ description: "The annotation object for the blob as JSON-LD."
81
85
  },
82
86
  blob: {
83
87
  type: "string",
@@ -89,7 +93,8 @@ var required = [
89
93
  "type",
90
94
  "id",
91
95
  "dateCreated",
92
- "blobSize"
96
+ "blobSize",
97
+ "blobHash"
93
98
  ];
94
99
  var additionalProperties = false;
95
100
  var description = "Interface describing a blob storage entry.";
@@ -8,39 +8,39 @@ import type { IBlobStorageEntryList } from "./IBlobStorageEntryList";
8
8
  */
9
9
  export interface IBlobStorageComponent extends IComponent {
10
10
  /**
11
- * Create the blob with some metadata.
11
+ * Create the blob with some annotation.
12
12
  * @param blob The data for the blob in base64 format.
13
13
  * @param encodingFormat Mime type for the blob, will be detected if left undefined.
14
14
  * @param fileExtension Extension for the blob, will be detected if left undefined.
15
- * @param metadata Data for the custom metadata as JSON-LD.
15
+ * @param annotationObject Data for the custom annotation as JSON-LD.
16
16
  * @param namespace The namespace to use for storing, defaults to component configured namespace.
17
17
  * @param userIdentity The user identity to use with storage operations.
18
18
  * @param nodeIdentity The node identity to use with storage operations.
19
19
  * @returns The id of the stored blob in urn format.
20
20
  */
21
- create(blob: string, encodingFormat?: string, fileExtension?: string, metadata?: IJsonLdNodeObject, namespace?: string, userIdentity?: string, nodeIdentity?: string): Promise<string>;
21
+ create(blob: string, encodingFormat?: string, fileExtension?: string, annotationObject?: IJsonLdNodeObject, namespace?: string, userIdentity?: string, nodeIdentity?: string): Promise<string>;
22
22
  /**
23
- * Get the blob and metadata.
23
+ * Get the blob and annotation.
24
24
  * @param id The id of the blob to get in urn format.
25
- * @param includeContent Include the content, or just get the metadata.
25
+ * @param includeContent Include the content, or just get the annotation.
26
26
  * @param userIdentity The user identity to use with storage operations.
27
27
  * @param nodeIdentity The node identity to use with storage operations.
28
- * @returns The data and metadata for the blob if it can be found.
28
+ * @returns The data and annotation for the blob if it can be found.
29
29
  * @throws Not found error if the blob cannot be found.
30
30
  */
31
31
  get(id: string, includeContent: boolean, userIdentity?: string, nodeIdentity?: string): Promise<IBlobStorageEntry>;
32
32
  /**
33
- * Update the blob with metadata.
34
- * @param id The id of the blob metadata to update.
33
+ * Update the blob with annotation.
34
+ * @param id The id of the blob annotation to update.
35
35
  * @param encodingFormat Mime type for the blob, will be detected if left undefined.
36
36
  * @param fileExtension Extension for the blob, will be detected if left undefined.
37
- * @param metadata Data for the custom metadata as JSON-LD.
37
+ * @param annotationObject Data for the custom annotation object as JSON-LD.
38
38
  * @param userIdentity The user identity to use with storage operations.
39
39
  * @param nodeIdentity The node identity to use with storage operations.
40
40
  * @returns Nothing.
41
41
  * @throws Not found error if the blob cannot be found.
42
42
  */
43
- update(id: string, encodingFormat?: string, fileExtension?: string, metadata?: IJsonLdNodeObject, userIdentity?: string, nodeIdentity?: string): Promise<void>;
43
+ update(id: string, encodingFormat?: string, fileExtension?: string, annotationObject?: IJsonLdNodeObject, userIdentity?: string, nodeIdentity?: string): Promise<void>;
44
44
  /**
45
45
  * Remove the blob.
46
46
  * @param id The id of the blob to remove in urn format.
@@ -7,7 +7,11 @@ export interface IBlobStorageEntry {
7
7
  /**
8
8
  * JSON-LD Context.
9
9
  */
10
- "@context": typeof BlobStorageTypes.ContextRoot | [typeof BlobStorageTypes.ContextRoot, ...IJsonLdContextDefinitionElement[]];
10
+ "@context": [
11
+ typeof BlobStorageTypes.ContextRoot,
12
+ typeof BlobStorageTypes.ContextRootCommon,
13
+ ...IJsonLdContextDefinitionElement[]
14
+ ];
11
15
  /**
12
16
  * JSON-LD Type.
13
17
  */
@@ -28,6 +32,10 @@ export interface IBlobStorageEntry {
28
32
  * The size of the data in the blob.
29
33
  */
30
34
  blobSize: number;
35
+ /**
36
+ * The hash of the data in the blob.
37
+ */
38
+ blobHash: string;
31
39
  /**
32
40
  * The mime type for the blob.
33
41
  */
@@ -37,9 +45,9 @@ export interface IBlobStorageEntry {
37
45
  */
38
46
  fileExtension?: string;
39
47
  /**
40
- * The metadata for the blob as JSON-LD.
48
+ * The annotation object for the blob as JSON-LD.
41
49
  */
42
- metadata?: IJsonLdNodeObject;
50
+ annotationObject?: IJsonLdNodeObject;
43
51
  /**
44
52
  * The blob in base64 format, included if the includeContent flag was set in the request.
45
53
  */
@@ -8,7 +8,11 @@ export interface IBlobStorageEntryList {
8
8
  /**
9
9
  * JSON-LD Context.
10
10
  */
11
- "@context": typeof BlobStorageTypes.ContextRoot | [typeof BlobStorageTypes.ContextRoot, ...IJsonLdContextDefinitionElement[]];
11
+ "@context": [
12
+ typeof BlobStorageTypes.ContextRoot,
13
+ typeof BlobStorageTypes.ContextRootCommon,
14
+ ...IJsonLdContextDefinitionElement[]
15
+ ];
12
16
  /**
13
17
  * JSON-LD Type.
14
18
  */
@@ -20,9 +20,9 @@ export interface IBlobStorageCreateRequest {
20
20
  */
21
21
  fileExtension?: string;
22
22
  /**
23
- * Custom metadata to associate with the blob as JSON-LD.
23
+ * Custom annotation object to associate with the blob as JSON-LD.
24
24
  */
25
- metadata?: IJsonLdNodeObject;
25
+ annotationObject?: IJsonLdNodeObject;
26
26
  /**
27
27
  * The namespace to store the data in, defaults to component configured namespace.
28
28
  */
@@ -23,7 +23,7 @@ export interface IBlobStorageGetRequest {
23
23
  */
24
24
  query?: {
25
25
  /**
26
- * Include the content in the response, otherwise only metadata is returned.
26
+ * Include the content in the response, otherwise only annotation is returned.
27
27
  * @default false
28
28
  */
29
29
  includeContent?: boolean;
@@ -25,8 +25,8 @@ export interface IBlobStorageUpdateRequest {
25
25
  */
26
26
  fileExtension?: string;
27
27
  /**
28
- * Custom metadata to associate with the blob as JSON-LD.
28
+ * Custom annotation to associate with the blob as JSON-LD.
29
29
  */
30
- metadata?: IJsonLdNodeObject;
30
+ annotationObject?: IJsonLdNodeObject;
31
31
  };
32
32
  }
@@ -3,9 +3,13 @@
3
3
  */
4
4
  export declare const BlobStorageTypes: {
5
5
  /**
6
- * The context root for the auditable item blob storage types.
6
+ * The context root for the blob storage types.
7
7
  */
8
8
  readonly ContextRoot: "https://schema.twindev.org/blob-storage/";
9
+ /**
10
+ * The context root for the common types.
11
+ */
12
+ readonly ContextRootCommon: "https://schema.twindev.org/common/";
9
13
  /**
10
14
  * Represents blob storage entry.
11
15
  */
package/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/blob-storage-models - Changelog
2
2
 
3
- ## v0.0.1-next.22
3
+ ## v0.0.1-next.24
4
4
 
5
5
  - Initial Release
@@ -10,9 +10,9 @@ Interface describing an blob storage component.
10
10
 
11
11
  ### create()
12
12
 
13
- > **create**(`blob`, `encodingFormat`?, `fileExtension`?, `metadata`?, `namespace`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`string`\>
13
+ > **create**(`blob`, `encodingFormat`?, `fileExtension`?, `annotationObject`?, `namespace`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`string`\>
14
14
 
15
- Create the blob with some metadata.
15
+ Create the blob with some annotation.
16
16
 
17
17
  #### Parameters
18
18
 
@@ -34,11 +34,11 @@ Mime type for the blob, will be detected if left undefined.
34
34
 
35
35
  Extension for the blob, will be detected if left undefined.
36
36
 
37
- ##### metadata?
37
+ ##### annotationObject?
38
38
 
39
39
  `IJsonLdNodeObject`
40
40
 
41
- Data for the custom metadata as JSON-LD.
41
+ Data for the custom annotation as JSON-LD.
42
42
 
43
43
  ##### namespace?
44
44
 
@@ -70,7 +70,7 @@ The id of the stored blob in urn format.
70
70
 
71
71
  > **get**(`id`, `includeContent`, `userIdentity`?, `nodeIdentity`?): `Promise`\<[`IBlobStorageEntry`](IBlobStorageEntry.md)\>
72
72
 
73
- Get the blob and metadata.
73
+ Get the blob and annotation.
74
74
 
75
75
  #### Parameters
76
76
 
@@ -84,7 +84,7 @@ The id of the blob to get in urn format.
84
84
 
85
85
  `boolean`
86
86
 
87
- Include the content, or just get the metadata.
87
+ Include the content, or just get the annotation.
88
88
 
89
89
  ##### userIdentity?
90
90
 
@@ -102,7 +102,7 @@ The node identity to use with storage operations.
102
102
 
103
103
  `Promise`\<[`IBlobStorageEntry`](IBlobStorageEntry.md)\>
104
104
 
105
- The data and metadata for the blob if it can be found.
105
+ The data and annotation for the blob if it can be found.
106
106
 
107
107
  #### Throws
108
108
 
@@ -112,9 +112,9 @@ Not found error if the blob cannot be found.
112
112
 
113
113
  ### update()
114
114
 
115
- > **update**(`id`, `encodingFormat`?, `fileExtension`?, `metadata`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`void`\>
115
+ > **update**(`id`, `encodingFormat`?, `fileExtension`?, `annotationObject`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`void`\>
116
116
 
117
- Update the blob with metadata.
117
+ Update the blob with annotation.
118
118
 
119
119
  #### Parameters
120
120
 
@@ -122,7 +122,7 @@ Update the blob with metadata.
122
122
 
123
123
  `string`
124
124
 
125
- The id of the blob metadata to update.
125
+ The id of the blob annotation to update.
126
126
 
127
127
  ##### encodingFormat?
128
128
 
@@ -136,11 +136,11 @@ Mime type for the blob, will be detected if left undefined.
136
136
 
137
137
  Extension for the blob, will be detected if left undefined.
138
138
 
139
- ##### metadata?
139
+ ##### annotationObject?
140
140
 
141
141
  `IJsonLdNodeObject`
142
142
 
143
- Data for the custom metadata as JSON-LD.
143
+ Data for the custom annotation object as JSON-LD.
144
144
 
145
145
  ##### userIdentity?
146
146
 
@@ -28,11 +28,11 @@ The mime type of the blob, will be detected if left undefined.
28
28
 
29
29
  The extension of the blob, will be detected if left undefined.
30
30
 
31
- #### metadata?
31
+ #### annotationObject?
32
32
 
33
- > `optional` **metadata**: `IJsonLdNodeObject`
33
+ > `optional` **annotationObject**: `IJsonLdNodeObject`
34
34
 
35
- Custom metadata to associate with the blob as JSON-LD.
35
+ Custom annotation object to associate with the blob as JSON-LD.
36
36
 
37
37
  #### namespace?
38
38
 
@@ -6,7 +6,7 @@ Interface describing a blob storage entry.
6
6
 
7
7
  ### @context
8
8
 
9
- > **@context**: `"https://schema.twindev.org/blob-storage/"` \| \[`"https://schema.twindev.org/blob-storage/"`, `...IJsonLdContextDefinitionElement[]`\]
9
+ > **@context**: \[`"https://schema.twindev.org/blob-storage/"`, `"https://schema.twindev.org/common/"`, `...IJsonLdContextDefinitionElement[]`\]
10
10
 
11
11
  JSON-LD Context.
12
12
 
@@ -52,6 +52,14 @@ The size of the data in the blob.
52
52
 
53
53
  ***
54
54
 
55
+ ### blobHash
56
+
57
+ > **blobHash**: `string`
58
+
59
+ The hash of the data in the blob.
60
+
61
+ ***
62
+
55
63
  ### encodingFormat?
56
64
 
57
65
  > `optional` **encodingFormat**: `string`
@@ -68,11 +76,11 @@ The extension.
68
76
 
69
77
  ***
70
78
 
71
- ### metadata?
79
+ ### annotationObject?
72
80
 
73
- > `optional` **metadata**: `IJsonLdNodeObject`
81
+ > `optional` **annotationObject**: `IJsonLdNodeObject`
74
82
 
75
- The metadata for the blob as JSON-LD.
83
+ The annotation object for the blob as JSON-LD.
76
84
 
77
85
  ***
78
86
 
@@ -6,7 +6,7 @@ Interface describing an blob storage entry list.
6
6
 
7
7
  ### @context
8
8
 
9
- > **@context**: `"https://schema.twindev.org/blob-storage/"` \| \[`"https://schema.twindev.org/blob-storage/"`, `...IJsonLdContextDefinitionElement[]`\]
9
+ > **@context**: \[`"https://schema.twindev.org/blob-storage/"`, `"https://schema.twindev.org/common/"`, `...IJsonLdContextDefinitionElement[]`\]
10
10
 
11
11
  JSON-LD Context.
12
12
 
@@ -40,7 +40,7 @@ The query parameters.
40
40
 
41
41
  > `optional` **includeContent**: `boolean`
42
42
 
43
- Include the content in the response, otherwise only metadata is returned.
43
+ Include the content in the response, otherwise only annotation is returned.
44
44
 
45
45
  ##### Default
46
46
 
@@ -36,8 +36,8 @@ The mime type of the blob, will be detected if left undefined.
36
36
 
37
37
  The extension of the blob, will be detected if left undefined.
38
38
 
39
- #### metadata?
39
+ #### annotationObject?
40
40
 
41
- > `optional` **metadata**: `IJsonLdNodeObject`
41
+ > `optional` **annotationObject**: `IJsonLdNodeObject`
42
42
 
43
- Custom metadata to associate with the blob as JSON-LD.
43
+ Custom annotation to associate with the blob as JSON-LD.
@@ -10,7 +10,13 @@ The types of blob storage data.
10
10
 
11
11
  > `readonly` **ContextRoot**: `"https://schema.twindev.org/blob-storage/"` = `"https://schema.twindev.org/blob-storage/"`
12
12
 
13
- The context root for the auditable item blob storage types.
13
+ The context root for the blob storage types.
14
+
15
+ ### ContextRootCommon
16
+
17
+ > `readonly` **ContextRootCommon**: `"https://schema.twindev.org/common/"` = `"https://schema.twindev.org/common/"`
18
+
19
+ The context root for the common types.
14
20
 
15
21
  ### Entry
16
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/blob-storage-models",
3
- "version": "0.0.1-next.22",
3
+ "version": "0.0.1-next.24",
4
4
  "description": "Models which define the structure of the blob storage contracts and connectors",
5
5
  "repository": {
6
6
  "type": "git",