@twin.org/blob-storage-models 0.0.1-next.10 → 0.0.1-next.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/cjs/index.cjs +121 -0
  2. package/dist/esm/index.mjs +120 -1
  3. package/dist/types/dataTypes/blobStorageDataTypes.d.ts +9 -0
  4. package/dist/types/index.d.ts +3 -0
  5. package/dist/types/models/IBlobStorageComponent.d.ts +10 -23
  6. package/dist/types/models/IBlobStorageEntry.d.ts +27 -2
  7. package/dist/types/models/IBlobStorageEntryList.d.ts +23 -0
  8. package/dist/types/models/api/IBlobStorageCreateRequest.d.ts +2 -2
  9. package/dist/types/models/api/IBlobStorageGetRequest.d.ts +7 -0
  10. package/dist/types/models/api/IBlobStorageGetResponse.d.ts +9 -19
  11. package/dist/types/models/api/IBlobStorageListRequest.d.ts +7 -0
  12. package/dist/types/models/api/IBlobStorageListResponse.d.ts +9 -11
  13. package/dist/types/models/api/IBlobStorageUpdateRequest.d.ts +2 -2
  14. package/dist/types/models/blobStorageTypes.d.ts +21 -0
  15. package/docs/changelog.md +1 -1
  16. package/docs/reference/classes/BlobStorageDataTypes.md +25 -0
  17. package/docs/reference/index.md +10 -0
  18. package/docs/reference/interfaces/IBlobStorageComponent.md +10 -38
  19. package/docs/reference/interfaces/IBlobStorageCreateRequest.md +4 -4
  20. package/docs/reference/interfaces/IBlobStorageEntry.md +52 -4
  21. package/docs/reference/interfaces/IBlobStorageEntryList.md +35 -0
  22. package/docs/reference/interfaces/IBlobStorageGetRequest.md +12 -0
  23. package/docs/reference/interfaces/IBlobStorageGetResponse.md +9 -21
  24. package/docs/reference/interfaces/IBlobStorageListRequest.md +12 -0
  25. package/docs/reference/interfaces/IBlobStorageListResponse.md +9 -9
  26. package/docs/reference/interfaces/IBlobStorageUpdateRequest.md +4 -4
  27. package/docs/reference/type-aliases/BlobStorageTypes.md +5 -0
  28. package/docs/reference/variables/BlobStorageTypes.md +25 -0
  29. package/package.json +4 -2
@@ -1,7 +1,126 @@
1
1
  'use strict';
2
2
 
3
+ var dataCore = require('@twin.org/data-core');
3
4
  var core = require('@twin.org/core');
4
5
 
6
+ // Copyright 2024 IOTA Stiftung.
7
+ // SPDX-License-Identifier: Apache-2.0.
8
+ /**
9
+ * The types of blob storage data.
10
+ */
11
+ // eslint-disable-next-line @typescript-eslint/naming-convention
12
+ const BlobStorageTypes = {
13
+ /**
14
+ * The context root for the auditable item blob storage types.
15
+ */
16
+ ContextRoot: "https://schema.twindev.org/blob-storage/",
17
+ /**
18
+ * Represents blob storage entry.
19
+ */
20
+ Entry: "BlobStorageEntry",
21
+ /**
22
+ * Represents blob storage entry list.
23
+ */
24
+ EntryList: "BlobStorageEntryList"
25
+ };
26
+
27
+ var type = "object";
28
+ var properties = {
29
+ "@context": {
30
+ anyOf: [
31
+ {
32
+ type: "string",
33
+ "const": "https://schema.twindev.org/blob-storage/"
34
+ },
35
+ {
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
+ type: "string"
46
+ }
47
+ }
48
+ ],
49
+ description: "JSON-LD Context."
50
+ },
51
+ type: {
52
+ type: "string",
53
+ "const": "BlobStorageEntry",
54
+ description: "JSON-LD Type."
55
+ },
56
+ id: {
57
+ type: "string",
58
+ description: "The id for the blob."
59
+ },
60
+ dateCreated: {
61
+ type: "string",
62
+ description: "The date/time when the entry was created."
63
+ },
64
+ dateModified: {
65
+ type: "string",
66
+ description: "The date/time when the entry was modified."
67
+ },
68
+ blobSize: {
69
+ type: "number",
70
+ description: "The size of the data in the blob."
71
+ },
72
+ encodingFormat: {
73
+ type: "string",
74
+ description: "The mime type for the blob."
75
+ },
76
+ fileExtension: {
77
+ type: "string",
78
+ description: "The extension."
79
+ },
80
+ metadata: {
81
+ $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
82
+ description: "The metadata for the blob as JSON-LD."
83
+ },
84
+ blob: {
85
+ type: "string",
86
+ description: "The blob in base64 format, if the includeContent flag was set in the request."
87
+ }
88
+ };
89
+ var required = [
90
+ "@context",
91
+ "type",
92
+ "id",
93
+ "dateCreated",
94
+ "blobSize"
95
+ ];
96
+ var additionalProperties = false;
97
+ var description = "Interface describing a blob storage entry.";
98
+ var BlobStorageEntrySchema = {
99
+ type: type,
100
+ properties: properties,
101
+ required: required,
102
+ additionalProperties: additionalProperties,
103
+ description: description
104
+ };
105
+
106
+ // Copyright 2024 IOTA Stiftung.
107
+ // SPDX-License-Identifier: Apache-2.0.
108
+ /**
109
+ * Handle all the data types for blob storage.
110
+ */
111
+ class BlobStorageDataTypes {
112
+ /**
113
+ * Register all the data types.
114
+ */
115
+ static registerTypes() {
116
+ dataCore.DataTypeHandlerFactory.register(BlobStorageTypes.Entry, () => ({
117
+ type: BlobStorageTypes.Entry,
118
+ defaultValue: {},
119
+ jsonSchema: async () => BlobStorageEntrySchema
120
+ }));
121
+ }
122
+ }
123
+
5
124
  // Copyright 2024 IOTA Stiftung.
6
125
  // SPDX-License-Identifier: Apache-2.0.
7
126
  /**
@@ -11,3 +130,5 @@ var core = require('@twin.org/core');
11
130
  const BlobStorageConnectorFactory = core.Factory.createFactory("blob-storage");
12
131
 
13
132
  exports.BlobStorageConnectorFactory = BlobStorageConnectorFactory;
133
+ exports.BlobStorageDataTypes = BlobStorageDataTypes;
134
+ exports.BlobStorageTypes = BlobStorageTypes;
@@ -1,5 +1,124 @@
1
+ import { DataTypeHandlerFactory } from '@twin.org/data-core';
1
2
  import { Factory } from '@twin.org/core';
2
3
 
4
+ // Copyright 2024 IOTA Stiftung.
5
+ // SPDX-License-Identifier: Apache-2.0.
6
+ /**
7
+ * The types of blob storage data.
8
+ */
9
+ // eslint-disable-next-line @typescript-eslint/naming-convention
10
+ const BlobStorageTypes = {
11
+ /**
12
+ * The context root for the auditable item blob storage types.
13
+ */
14
+ ContextRoot: "https://schema.twindev.org/blob-storage/",
15
+ /**
16
+ * Represents blob storage entry.
17
+ */
18
+ Entry: "BlobStorageEntry",
19
+ /**
20
+ * Represents blob storage entry list.
21
+ */
22
+ EntryList: "BlobStorageEntryList"
23
+ };
24
+
25
+ var type = "object";
26
+ var properties = {
27
+ "@context": {
28
+ anyOf: [
29
+ {
30
+ type: "string",
31
+ "const": "https://schema.twindev.org/blob-storage/"
32
+ },
33
+ {
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
+ type: "string"
44
+ }
45
+ }
46
+ ],
47
+ description: "JSON-LD Context."
48
+ },
49
+ type: {
50
+ type: "string",
51
+ "const": "BlobStorageEntry",
52
+ description: "JSON-LD Type."
53
+ },
54
+ id: {
55
+ type: "string",
56
+ description: "The id for the blob."
57
+ },
58
+ dateCreated: {
59
+ type: "string",
60
+ description: "The date/time when the entry was created."
61
+ },
62
+ dateModified: {
63
+ type: "string",
64
+ description: "The date/time when the entry was modified."
65
+ },
66
+ blobSize: {
67
+ type: "number",
68
+ description: "The size of the data in the blob."
69
+ },
70
+ encodingFormat: {
71
+ type: "string",
72
+ description: "The mime type for the blob."
73
+ },
74
+ fileExtension: {
75
+ type: "string",
76
+ description: "The extension."
77
+ },
78
+ metadata: {
79
+ $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
80
+ description: "The metadata for the blob as JSON-LD."
81
+ },
82
+ blob: {
83
+ type: "string",
84
+ description: "The blob in base64 format, if the includeContent flag was set in the request."
85
+ }
86
+ };
87
+ var required = [
88
+ "@context",
89
+ "type",
90
+ "id",
91
+ "dateCreated",
92
+ "blobSize"
93
+ ];
94
+ var additionalProperties = false;
95
+ var description = "Interface describing a blob storage entry.";
96
+ var BlobStorageEntrySchema = {
97
+ type: type,
98
+ properties: properties,
99
+ required: required,
100
+ additionalProperties: additionalProperties,
101
+ description: description
102
+ };
103
+
104
+ // Copyright 2024 IOTA Stiftung.
105
+ // SPDX-License-Identifier: Apache-2.0.
106
+ /**
107
+ * Handle all the data types for blob storage.
108
+ */
109
+ class BlobStorageDataTypes {
110
+ /**
111
+ * Register all the data types.
112
+ */
113
+ static registerTypes() {
114
+ DataTypeHandlerFactory.register(BlobStorageTypes.Entry, () => ({
115
+ type: BlobStorageTypes.Entry,
116
+ defaultValue: {},
117
+ jsonSchema: async () => BlobStorageEntrySchema
118
+ }));
119
+ }
120
+ }
121
+
3
122
  // Copyright 2024 IOTA Stiftung.
4
123
  // SPDX-License-Identifier: Apache-2.0.
5
124
  /**
@@ -8,4 +127,4 @@ import { Factory } from '@twin.org/core';
8
127
  // eslint-disable-next-line @typescript-eslint/naming-convention
9
128
  const BlobStorageConnectorFactory = Factory.createFactory("blob-storage");
10
129
 
11
- export { BlobStorageConnectorFactory };
130
+ export { BlobStorageConnectorFactory, BlobStorageDataTypes, BlobStorageTypes };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Handle all the data types for blob storage.
3
+ */
4
+ export declare class BlobStorageDataTypes {
5
+ /**
6
+ * Register all the data types.
7
+ */
8
+ static registerTypes(): void;
9
+ }
@@ -1,3 +1,4 @@
1
+ export * from "./dataTypes/blobStorageDataTypes";
1
2
  export * from "./factories/blobStorageConnectorFactory";
2
3
  export * from "./models/api/IBlobStorageCreateRequest";
3
4
  export * from "./models/api/IBlobStorageGetContentRequest";
@@ -8,6 +9,8 @@ export * from "./models/api/IBlobStorageListRequest";
8
9
  export * from "./models/api/IBlobStorageListResponse";
9
10
  export * from "./models/api/IBlobStorageRemoveRequest";
10
11
  export * from "./models/api/IBlobStorageUpdateRequest";
12
+ export * from "./models/blobStorageTypes";
11
13
  export * from "./models/IBlobStorageComponent";
12
14
  export * from "./models/IBlobStorageConnector";
13
15
  export * from "./models/IBlobStorageEntry";
16
+ export * from "./models/IBlobStorageEntryList";
@@ -2,6 +2,7 @@ import type { IComponent } from "@twin.org/core";
2
2
  import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
3
3
  import type { EntityCondition, SortDirection } from "@twin.org/entity";
4
4
  import type { IBlobStorageEntry } from "./IBlobStorageEntry";
5
+ import type { IBlobStorageEntryList } from "./IBlobStorageEntryList";
5
6
  /**
6
7
  * Interface describing an blob storage component.
7
8
  */
@@ -9,15 +10,15 @@ export interface IBlobStorageComponent extends IComponent {
9
10
  /**
10
11
  * Create the blob with some metadata.
11
12
  * @param blob The data for the blob in base64 format.
12
- * @param mimeType Mime type for the blob, will be detected if left undefined.
13
- * @param extension Extension for the blob, will be detected if left undefined.
13
+ * @param encodingFormat Mime type for the blob, will be detected if left undefined.
14
+ * @param fileExtension Extension for the blob, will be detected if left undefined.
14
15
  * @param metadata Data for the custom metadata as JSON-LD.
15
16
  * @param namespace The namespace to use for storing, defaults to component configured namespace.
16
17
  * @param userIdentity The user identity to use with storage operations.
17
18
  * @param nodeIdentity The node identity to use with storage operations.
18
19
  * @returns The id of the stored blob in urn format.
19
20
  */
20
- create(blob: string, mimeType?: string, extension?: string, metadata?: IJsonLdNodeObject, namespace?: string, userIdentity?: string, nodeIdentity?: string): Promise<string>;
21
+ create(blob: string, encodingFormat?: string, fileExtension?: string, metadata?: IJsonLdNodeObject, namespace?: string, userIdentity?: string, nodeIdentity?: string): Promise<string>;
21
22
  /**
22
23
  * Get the blob and metadata.
23
24
  * @param id The id of the blob to get in urn format.
@@ -27,24 +28,19 @@ export interface IBlobStorageComponent extends IComponent {
27
28
  * @returns The data and metadata for the blob if it can be found.
28
29
  * @throws Not found error if the blob cannot be found.
29
30
  */
30
- get(id: string, includeContent: boolean, userIdentity?: string, nodeIdentity?: string): Promise<{
31
- blob?: string;
32
- mimeType?: string;
33
- extension?: string;
34
- metadata?: IJsonLdNodeObject;
35
- }>;
31
+ get(id: string, includeContent: boolean, userIdentity?: string, nodeIdentity?: string): Promise<IBlobStorageEntry>;
36
32
  /**
37
33
  * Update the blob with metadata.
38
34
  * @param id The id of the blob metadata to update.
39
- * @param mimeType Mime type for the blob, will be detected if left undefined.
40
- * @param extension Extension for the blob, will be detected if left undefined.
35
+ * @param encodingFormat Mime type for the blob, will be detected if left undefined.
36
+ * @param fileExtension Extension for the blob, will be detected if left undefined.
41
37
  * @param metadata Data for the custom metadata as JSON-LD.
42
38
  * @param userIdentity The user identity to use with storage operations.
43
39
  * @param nodeIdentity The node identity to use with storage operations.
44
40
  * @returns Nothing.
45
41
  * @throws Not found error if the blob cannot be found.
46
42
  */
47
- update(id: string, mimeType?: string, extension?: string, metadata?: IJsonLdNodeObject, userIdentity?: string, nodeIdentity?: string): Promise<void>;
43
+ update(id: string, encodingFormat?: string, fileExtension?: string, metadata?: IJsonLdNodeObject, userIdentity?: string, nodeIdentity?: string): Promise<void>;
48
44
  /**
49
45
  * Remove the blob.
50
46
  * @param id The id of the blob to remove in urn format.
@@ -66,16 +62,7 @@ export interface IBlobStorageComponent extends IComponent {
66
62
  * and a cursor which can be used to request more entities.
67
63
  */
68
64
  query(conditions?: EntityCondition<IBlobStorageEntry>, sortProperties?: {
69
- property: keyof IBlobStorageEntry;
65
+ property: keyof Pick<IBlobStorageEntry, "dateCreated" | "dateModified">;
70
66
  sortDirection: SortDirection;
71
- }[], cursor?: string, pageSize?: number, userIdentity?: string, nodeIdentity?: string): Promise<{
72
- /**
73
- * The entities.
74
- */
75
- entities: IBlobStorageEntry[];
76
- /**
77
- * An optional cursor, when defined can be used to call find to get more entities.
78
- */
79
- cursor?: string;
80
- }>;
67
+ }[], cursor?: string, pageSize?: number, userIdentity?: string, nodeIdentity?: string): Promise<IBlobStorageEntryList>;
81
68
  }
@@ -1,22 +1,47 @@
1
1
  import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
+ import type { BlobStorageTypes } from "./blobStorageTypes";
2
3
  /**
3
4
  * Interface describing a blob storage entry.
4
5
  */
5
6
  export interface IBlobStorageEntry {
7
+ /**
8
+ * JSON-LD Context.
9
+ */
10
+ "@context": typeof BlobStorageTypes.ContextRoot | [typeof BlobStorageTypes.ContextRoot, ...string[]];
11
+ /**
12
+ * JSON-LD Type.
13
+ */
14
+ type: typeof BlobStorageTypes.Entry;
6
15
  /**
7
16
  * The id for the blob.
8
17
  */
9
18
  id: string;
19
+ /**
20
+ * The date/time when the entry was created.
21
+ */
22
+ dateCreated: string;
23
+ /**
24
+ * The date/time when the entry was modified.
25
+ */
26
+ dateModified?: string;
27
+ /**
28
+ * The size of the data in the blob.
29
+ */
30
+ blobSize: number;
10
31
  /**
11
32
  * The mime type for the blob.
12
33
  */
13
- mimeType?: string;
34
+ encodingFormat?: string;
14
35
  /**
15
36
  * The extension.
16
37
  */
17
- extension?: string;
38
+ fileExtension?: string;
18
39
  /**
19
40
  * The metadata for the blob as JSON-LD.
20
41
  */
21
42
  metadata?: IJsonLdNodeObject;
43
+ /**
44
+ * The blob in base64 format, if the includeContent flag was set in the request.
45
+ */
46
+ blob?: string;
22
47
  }
@@ -0,0 +1,23 @@
1
+ import type { BlobStorageTypes } from "./blobStorageTypes";
2
+ import type { IBlobStorageEntry } from "./IBlobStorageEntry";
3
+ /**
4
+ * Interface describing an blob storage entry list.
5
+ */
6
+ export interface IBlobStorageEntryList {
7
+ /**
8
+ * JSON-LD Context.
9
+ */
10
+ "@context": typeof BlobStorageTypes.ContextRoot | [typeof BlobStorageTypes.ContextRoot, ...string[]];
11
+ /**
12
+ * JSON-LD Type.
13
+ */
14
+ type: typeof BlobStorageTypes.EntryList;
15
+ /**
16
+ * The list of entries.
17
+ */
18
+ entries: IBlobStorageEntry[];
19
+ /**
20
+ * The cursor to get the next chunk of entries.
21
+ */
22
+ cursor?: string;
23
+ }
@@ -14,11 +14,11 @@ export interface IBlobStorageCreateRequest {
14
14
  /**
15
15
  * The mime type of the blob, will be detected if left undefined.
16
16
  */
17
- mimeType?: string;
17
+ encodingFormat?: string;
18
18
  /**
19
19
  * The extension of the blob, will be detected if left undefined.
20
20
  */
21
- extension?: string;
21
+ fileExtension?: string;
22
22
  /**
23
23
  * Custom metadata to associate with the blob as JSON-LD.
24
24
  */
@@ -1,7 +1,14 @@
1
+ import type { HeaderTypes, MimeTypes } from "@twin.org/web";
1
2
  /**
2
3
  * Request to get an entry from blob storage.
3
4
  */
4
5
  export interface IBlobStorageGetRequest {
6
+ /**
7
+ * The headers which can be used to determine the response data type.
8
+ */
9
+ headers?: {
10
+ [HeaderTypes.Accept]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;
11
+ };
5
12
  /**
6
13
  * The path parameters.
7
14
  */
@@ -1,27 +1,17 @@
1
- import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
1
+ import type { HeaderTypes, MimeTypes } from "@twin.org/web";
2
+ import type { IBlobStorageEntry } from "../IBlobStorageEntry";
2
3
  /**
3
4
  * Response to get an entry from blob storage.
4
5
  */
5
6
  export interface IBlobStorageGetResponse {
6
7
  /**
7
- * The body parameters.
8
+ * The headers which can be used to determine the response data type.
8
9
  */
9
- body: {
10
- /**
11
- * The mime type of the blob.
12
- */
13
- mimeType?: string;
14
- /**
15
- * The extension of the blob.
16
- */
17
- extension?: string;
18
- /**
19
- * Custom metadata to associate with the blob as JSON-LD.
20
- */
21
- metadata?: IJsonLdNodeObject;
22
- /**
23
- * The blob in base64 format, if the includeContent flag was set in the request.
24
- */
25
- blob?: string;
10
+ headers?: {
11
+ [HeaderTypes.ContentType]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;
26
12
  };
13
+ /**
14
+ * The body parameters.
15
+ */
16
+ body: IBlobStorageEntry;
27
17
  }
@@ -1,7 +1,14 @@
1
+ import type { HeaderTypes, MimeTypes } from "@twin.org/web";
1
2
  /**
2
3
  * Query the entries from blob storage.
3
4
  */
4
5
  export interface IBlobStorageListRequest {
6
+ /**
7
+ * The headers which can be used to determine the response data type.
8
+ */
9
+ headers?: {
10
+ [HeaderTypes.Accept]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;
11
+ };
5
12
  /**
6
13
  * The parameters from the query.
7
14
  */
@@ -1,19 +1,17 @@
1
- import type { IBlobStorageEntry } from "../IBlobStorageEntry";
1
+ import type { HeaderTypes, MimeTypes } from "@twin.org/web";
2
+ import type { IBlobStorageEntryList } from "../IBlobStorageEntryList";
2
3
  /**
3
4
  * Response to getting the list of entries from a query.
4
5
  */
5
6
  export interface IBlobStorageListResponse {
6
7
  /**
7
- * The list of entries from the query.
8
+ * The headers which can be used to determine the response data type.
8
9
  */
9
- body: {
10
- /**
11
- * The entities from the query.
12
- */
13
- entities: IBlobStorageEntry[];
14
- /**
15
- * The cursor for the next page.
16
- */
17
- cursor?: string;
10
+ headers?: {
11
+ [HeaderTypes.ContentType]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;
18
12
  };
13
+ /**
14
+ * The list of entries from the query.
15
+ */
16
+ body: IBlobStorageEntryList;
19
17
  }
@@ -19,11 +19,11 @@ export interface IBlobStorageUpdateRequest {
19
19
  /**
20
20
  * The mime type of the blob, will be detected if left undefined.
21
21
  */
22
- mimeType?: string;
22
+ encodingFormat?: string;
23
23
  /**
24
24
  * The extension of the blob, will be detected if left undefined.
25
25
  */
26
- extension?: string;
26
+ fileExtension?: string;
27
27
  /**
28
28
  * Custom metadata to associate with the blob as JSON-LD.
29
29
  */
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The types of blob storage data.
3
+ */
4
+ export declare const BlobStorageTypes: {
5
+ /**
6
+ * The context root for the auditable item blob storage types.
7
+ */
8
+ readonly ContextRoot: "https://schema.twindev.org/blob-storage/";
9
+ /**
10
+ * Represents blob storage entry.
11
+ */
12
+ readonly Entry: "BlobStorageEntry";
13
+ /**
14
+ * Represents blob storage entry list.
15
+ */
16
+ readonly EntryList: "BlobStorageEntryList";
17
+ };
18
+ /**
19
+ * The types of blob storage data.
20
+ */
21
+ export type BlobStorageTypes = (typeof BlobStorageTypes)[keyof typeof BlobStorageTypes];
package/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/blob-storage-models - Changelog
2
2
 
3
- ## v0.0.1-next.10
3
+ ## v0.0.1-next.13
4
4
 
5
5
  - Initial Release
@@ -0,0 +1,25 @@
1
+ # Class: BlobStorageDataTypes
2
+
3
+ Handle all the data types for blob storage.
4
+
5
+ ## Constructors
6
+
7
+ ### new BlobStorageDataTypes()
8
+
9
+ > **new BlobStorageDataTypes**(): [`BlobStorageDataTypes`](BlobStorageDataTypes.md)
10
+
11
+ #### Returns
12
+
13
+ [`BlobStorageDataTypes`](BlobStorageDataTypes.md)
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,10 +1,15 @@
1
1
  # @twin.org/blob-storage-models
2
2
 
3
+ ## Classes
4
+
5
+ - [BlobStorageDataTypes](classes/BlobStorageDataTypes.md)
6
+
3
7
  ## Interfaces
4
8
 
5
9
  - [IBlobStorageComponent](interfaces/IBlobStorageComponent.md)
6
10
  - [IBlobStorageConnector](interfaces/IBlobStorageConnector.md)
7
11
  - [IBlobStorageEntry](interfaces/IBlobStorageEntry.md)
12
+ - [IBlobStorageEntryList](interfaces/IBlobStorageEntryList.md)
8
13
  - [IBlobStorageCreateRequest](interfaces/IBlobStorageCreateRequest.md)
9
14
  - [IBlobStorageGetContentRequest](interfaces/IBlobStorageGetContentRequest.md)
10
15
  - [IBlobStorageGetContentResponse](interfaces/IBlobStorageGetContentResponse.md)
@@ -15,6 +20,11 @@
15
20
  - [IBlobStorageRemoveRequest](interfaces/IBlobStorageRemoveRequest.md)
16
21
  - [IBlobStorageUpdateRequest](interfaces/IBlobStorageUpdateRequest.md)
17
22
 
23
+ ## Type Aliases
24
+
25
+ - [BlobStorageTypes](type-aliases/BlobStorageTypes.md)
26
+
18
27
  ## Variables
19
28
 
20
29
  - [BlobStorageConnectorFactory](variables/BlobStorageConnectorFactory.md)
30
+ - [BlobStorageTypes](variables/BlobStorageTypes.md)
@@ -10,7 +10,7 @@ Interface describing an blob storage component.
10
10
 
11
11
  ### create()
12
12
 
13
- > **create**(`blob`, `mimeType`?, `extension`?, `metadata`?, `namespace`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`string`\>
13
+ > **create**(`blob`, `encodingFormat`?, `fileExtension`?, `metadata`?, `namespace`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`string`\>
14
14
 
15
15
  Create the blob with some metadata.
16
16
 
@@ -20,11 +20,11 @@ Create the blob with some metadata.
20
20
 
21
21
  The data for the blob in base64 format.
22
22
 
23
- • **mimeType?**: `string`
23
+ • **encodingFormat?**: `string`
24
24
 
25
25
  Mime type for the blob, will be detected if left undefined.
26
26
 
27
- • **extension?**: `string`
27
+ • **fileExtension?**: `string`
28
28
 
29
29
  Extension for the blob, will be detected if left undefined.
30
30
 
@@ -54,7 +54,7 @@ The id of the stored blob in urn format.
54
54
 
55
55
  ### get()
56
56
 
57
- > **get**(`id`, `includeContent`, `userIdentity`?, `nodeIdentity`?): `Promise`\<`object`\>
57
+ > **get**(`id`, `includeContent`, `userIdentity`?, `nodeIdentity`?): `Promise`\<[`IBlobStorageEntry`](IBlobStorageEntry.md)\>
58
58
 
59
59
  Get the blob and metadata.
60
60
 
@@ -78,26 +78,10 @@ The node identity to use with storage operations.
78
78
 
79
79
  #### Returns
80
80
 
81
- `Promise`\<`object`\>
81
+ `Promise`\<[`IBlobStorageEntry`](IBlobStorageEntry.md)\>
82
82
 
83
83
  The data and metadata for the blob if it can be found.
84
84
 
85
- ##### blob?
86
-
87
- > `optional` **blob**: `string`
88
-
89
- ##### mimeType?
90
-
91
- > `optional` **mimeType**: `string`
92
-
93
- ##### extension?
94
-
95
- > `optional` **extension**: `string`
96
-
97
- ##### metadata?
98
-
99
- > `optional` **metadata**: `IJsonLdNodeObject`
100
-
101
85
  #### Throws
102
86
 
103
87
  Not found error if the blob cannot be found.
@@ -106,7 +90,7 @@ Not found error if the blob cannot be found.
106
90
 
107
91
  ### update()
108
92
 
109
- > **update**(`id`, `mimeType`?, `extension`?, `metadata`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`void`\>
93
+ > **update**(`id`, `encodingFormat`?, `fileExtension`?, `metadata`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`void`\>
110
94
 
111
95
  Update the blob with metadata.
112
96
 
@@ -116,11 +100,11 @@ Update the blob with metadata.
116
100
 
117
101
  The id of the blob metadata to update.
118
102
 
119
- • **mimeType?**: `string`
103
+ • **encodingFormat?**: `string`
120
104
 
121
105
  Mime type for the blob, will be detected if left undefined.
122
106
 
123
- • **extension?**: `string`
107
+ • **fileExtension?**: `string`
124
108
 
125
109
  Extension for the blob, will be detected if left undefined.
126
110
 
@@ -182,7 +166,7 @@ Not found error if the blob cannot be found.
182
166
 
183
167
  ### query()
184
168
 
185
- > **query**(`conditions`?, `sortProperties`?, `cursor`?, `pageSize`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`object`\>
169
+ > **query**(`conditions`?, `sortProperties`?, `cursor`?, `pageSize`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<[`IBlobStorageEntryList`](IBlobStorageEntryList.md)\>
186
170
 
187
171
  Query all the blob storage entries which match the conditions.
188
172
 
@@ -214,19 +198,7 @@ The node identity to use with storage operations.
214
198
 
215
199
  #### Returns
216
200
 
217
- `Promise`\<`object`\>
201
+ `Promise`\<[`IBlobStorageEntryList`](IBlobStorageEntryList.md)\>
218
202
 
219
203
  All the entries for the storage matching the conditions,
220
204
  and a cursor which can be used to request more entities.
221
-
222
- ##### entities
223
-
224
- > **entities**: [`IBlobStorageEntry`](IBlobStorageEntry.md)[]
225
-
226
- The entities.
227
-
228
- ##### cursor?
229
-
230
- > `optional` **cursor**: `string`
231
-
232
- An optional cursor, when defined can be used to call find to get more entities.
@@ -16,15 +16,15 @@ The body parameters.
16
16
 
17
17
  The data to store in base64 encoding.
18
18
 
19
- #### mimeType?
19
+ #### encodingFormat?
20
20
 
21
- > `optional` **mimeType**: `string`
21
+ > `optional` **encodingFormat**: `string`
22
22
 
23
23
  The mime type of the blob, will be detected if left undefined.
24
24
 
25
- #### extension?
25
+ #### fileExtension?
26
26
 
27
- > `optional` **extension**: `string`
27
+ > `optional` **fileExtension**: `string`
28
28
 
29
29
  The extension of the blob, will be detected if left undefined.
30
30
 
@@ -4,6 +4,22 @@ Interface describing a blob storage entry.
4
4
 
5
5
  ## Properties
6
6
 
7
+ ### @context
8
+
9
+ > **@context**: `"https://schema.twindev.org/blob-storage/"` \| [`"https://schema.twindev.org/blob-storage/"`, `...string[]`]
10
+
11
+ JSON-LD Context.
12
+
13
+ ***
14
+
15
+ ### type
16
+
17
+ > **type**: `"BlobStorageEntry"`
18
+
19
+ JSON-LD Type.
20
+
21
+ ***
22
+
7
23
  ### id
8
24
 
9
25
  > **id**: `string`
@@ -12,17 +28,41 @@ The id for the blob.
12
28
 
13
29
  ***
14
30
 
15
- ### mimeType?
31
+ ### dateCreated
32
+
33
+ > **dateCreated**: `string`
34
+
35
+ The date/time when the entry was created.
36
+
37
+ ***
38
+
39
+ ### dateModified?
16
40
 
17
- > `optional` **mimeType**: `string`
41
+ > `optional` **dateModified**: `string`
42
+
43
+ The date/time when the entry was modified.
44
+
45
+ ***
46
+
47
+ ### blobSize
48
+
49
+ > **blobSize**: `number`
50
+
51
+ The size of the data in the blob.
52
+
53
+ ***
54
+
55
+ ### encodingFormat?
56
+
57
+ > `optional` **encodingFormat**: `string`
18
58
 
19
59
  The mime type for the blob.
20
60
 
21
61
  ***
22
62
 
23
- ### extension?
63
+ ### fileExtension?
24
64
 
25
- > `optional` **extension**: `string`
65
+ > `optional` **fileExtension**: `string`
26
66
 
27
67
  The extension.
28
68
 
@@ -33,3 +73,11 @@ The extension.
33
73
  > `optional` **metadata**: `IJsonLdNodeObject`
34
74
 
35
75
  The metadata for the blob as JSON-LD.
76
+
77
+ ***
78
+
79
+ ### blob?
80
+
81
+ > `optional` **blob**: `string`
82
+
83
+ The blob in base64 format, if the includeContent flag was set in the request.
@@ -0,0 +1,35 @@
1
+ # Interface: IBlobStorageEntryList
2
+
3
+ Interface describing an blob storage entry list.
4
+
5
+ ## Properties
6
+
7
+ ### @context
8
+
9
+ > **@context**: `"https://schema.twindev.org/blob-storage/"` \| [`"https://schema.twindev.org/blob-storage/"`, `...string[]`]
10
+
11
+ JSON-LD Context.
12
+
13
+ ***
14
+
15
+ ### type
16
+
17
+ > **type**: `"BlobStorageEntryList"`
18
+
19
+ JSON-LD Type.
20
+
21
+ ***
22
+
23
+ ### entries
24
+
25
+ > **entries**: [`IBlobStorageEntry`](IBlobStorageEntry.md)[]
26
+
27
+ The list of entries.
28
+
29
+ ***
30
+
31
+ ### cursor?
32
+
33
+ > `optional` **cursor**: `string`
34
+
35
+ The cursor to get the next chunk of entries.
@@ -4,6 +4,18 @@ Request to get an entry from blob storage.
4
4
 
5
5
  ## Properties
6
6
 
7
+ ### headers?
8
+
9
+ > `optional` **headers**: `object`
10
+
11
+ The headers which can be used to determine the response data type.
12
+
13
+ #### accept
14
+
15
+ > **accept**: `"application/json"` \| `"application/ld+json"`
16
+
17
+ ***
18
+
7
19
  ### pathParams
8
20
 
9
21
  > **pathParams**: `object`
@@ -4,32 +4,20 @@ Response to get an entry from blob storage.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### body
8
-
9
- > **body**: `object`
10
-
11
- The body parameters.
12
-
13
- #### mimeType?
7
+ ### headers?
14
8
 
15
- > `optional` **mimeType**: `string`
9
+ > `optional` **headers**: `object`
16
10
 
17
- The mime type of the blob.
11
+ The headers which can be used to determine the response data type.
18
12
 
19
- #### extension?
13
+ #### content-type
20
14
 
21
- > `optional` **extension**: `string`
15
+ > **content-type**: `"application/json"` \| `"application/ld+json"`
22
16
 
23
- The extension of the blob.
17
+ ***
24
18
 
25
- #### metadata?
26
-
27
- > `optional` **metadata**: `IJsonLdNodeObject`
28
-
29
- Custom metadata to associate with the blob as JSON-LD.
30
-
31
- #### blob?
19
+ ### body
32
20
 
33
- > `optional` **blob**: `string`
21
+ > **body**: [`IBlobStorageEntry`](IBlobStorageEntry.md)
34
22
 
35
- The blob in base64 format, if the includeContent flag was set in the request.
23
+ The body parameters.
@@ -4,6 +4,18 @@ Query the entries from blob storage.
4
4
 
5
5
  ## Properties
6
6
 
7
+ ### headers?
8
+
9
+ > `optional` **headers**: `object`
10
+
11
+ The headers which can be used to determine the response data type.
12
+
13
+ #### accept
14
+
15
+ > **accept**: `"application/json"` \| `"application/ld+json"`
16
+
17
+ ***
18
+
7
19
  ### query?
8
20
 
9
21
  > `optional` **query**: `object`
@@ -4,20 +4,20 @@ Response to getting the list of entries from a query.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### body
7
+ ### headers?
8
8
 
9
- > **body**: `object`
9
+ > `optional` **headers**: `object`
10
10
 
11
- The list of entries from the query.
11
+ The headers which can be used to determine the response data type.
12
12
 
13
- #### entities
13
+ #### content-type
14
14
 
15
- > **entities**: [`IBlobStorageEntry`](IBlobStorageEntry.md)[]
15
+ > **content-type**: `"application/json"` \| `"application/ld+json"`
16
16
 
17
- The entities from the query.
17
+ ***
18
18
 
19
- #### cursor?
19
+ ### body
20
20
 
21
- > `optional` **cursor**: `string`
21
+ > **body**: [`IBlobStorageEntryList`](IBlobStorageEntryList.md)
22
22
 
23
- The cursor for the next page.
23
+ The list of entries from the query.
@@ -24,15 +24,15 @@ The id of the blob to get in urn format.
24
24
 
25
25
  The body parameters.
26
26
 
27
- #### mimeType?
27
+ #### encodingFormat?
28
28
 
29
- > `optional` **mimeType**: `string`
29
+ > `optional` **encodingFormat**: `string`
30
30
 
31
31
  The mime type of the blob, will be detected if left undefined.
32
32
 
33
- #### extension?
33
+ #### fileExtension?
34
34
 
35
- > `optional` **extension**: `string`
35
+ > `optional` **fileExtension**: `string`
36
36
 
37
37
  The extension of the blob, will be detected if left undefined.
38
38
 
@@ -0,0 +1,5 @@
1
+ # Type Alias: BlobStorageTypes
2
+
3
+ > **BlobStorageTypes**: *typeof* [`BlobStorageTypes`](../variables/BlobStorageTypes.md)\[keyof *typeof* [`BlobStorageTypes`](../variables/BlobStorageTypes.md)\]
4
+
5
+ The types of blob storage data.
@@ -0,0 +1,25 @@
1
+ # Variable: BlobStorageTypes
2
+
3
+ > `const` **BlobStorageTypes**: `object`
4
+
5
+ The types of blob storage data.
6
+
7
+ ## Type declaration
8
+
9
+ ### ContextRoot
10
+
11
+ > `readonly` **ContextRoot**: `"https://schema.twindev.org/blob-storage/"` = `"https://schema.twindev.org/blob-storage/"`
12
+
13
+ The context root for the auditable item blob storage types.
14
+
15
+ ### Entry
16
+
17
+ > `readonly` **Entry**: `"BlobStorageEntry"` = `"BlobStorageEntry"`
18
+
19
+ Represents blob storage entry.
20
+
21
+ ### EntryList
22
+
23
+ > `readonly` **EntryList**: `"BlobStorageEntryList"` = `"BlobStorageEntryList"`
24
+
25
+ Represents blob storage entry list.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/blob-storage-models",
3
- "version": "0.0.1-next.10",
3
+ "version": "0.0.1-next.13",
4
4
  "description": "Models which define the structure of the blob storage contracts and connectors",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,9 +15,11 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@twin.org/core": "next",
18
+ "@twin.org/data-core": "next",
18
19
  "@twin.org/data-json-ld": "next",
19
20
  "@twin.org/entity": "next",
20
- "@twin.org/nameof": "next"
21
+ "@twin.org/nameof": "next",
22
+ "@twin.org/web": "next"
21
23
  },
22
24
  "main": "./dist/cjs/index.cjs",
23
25
  "module": "./dist/esm/index.mjs",