@twin.org/blob-storage-models 0.0.1-next.3 → 0.0.1-next.30
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/dist/cjs/index.cjs +136 -0
- package/dist/esm/index.mjs +134 -1
- package/dist/types/dataTypes/blobStorageDataTypes.d.ts +9 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/models/IBlobStorageComponent.d.ts +32 -15
- package/dist/types/models/IBlobStorageEntry.d.ts +56 -0
- package/dist/types/models/IBlobStorageEntryList.d.ts +29 -0
- package/dist/types/models/api/IBlobStorageCreateRequest.d.ts +2 -2
- package/dist/types/models/api/IBlobStorageGetRequest.d.ts +7 -0
- package/dist/types/models/api/IBlobStorageGetResponse.d.ts +9 -19
- package/dist/types/models/api/IBlobStorageListRequest.d.ts +39 -0
- package/dist/types/models/api/IBlobStorageListResponse.d.ts +17 -0
- package/dist/types/models/api/IBlobStorageUpdateRequest.d.ts +2 -2
- package/dist/types/models/blobStorageContexts.d.ts +17 -0
- package/dist/types/models/blobStorageTypes.d.ts +17 -0
- package/docs/changelog.md +15 -1
- package/docs/reference/classes/BlobStorageDataTypes.md +25 -0
- package/docs/reference/index.md +15 -0
- package/docs/reference/interfaces/IBlobStorageComponent.md +142 -35
- package/docs/reference/interfaces/IBlobStorageConnector.md +11 -5
- package/docs/reference/interfaces/IBlobStorageCreateRequest.md +4 -4
- package/docs/reference/interfaces/IBlobStorageEntry.md +91 -0
- package/docs/reference/interfaces/IBlobStorageEntryList.md +35 -0
- package/docs/reference/interfaces/IBlobStorageGetRequest.md +12 -0
- package/docs/reference/interfaces/IBlobStorageGetResponse.md +9 -21
- package/docs/reference/interfaces/IBlobStorageListRequest.md +53 -0
- package/docs/reference/interfaces/IBlobStorageListResponse.md +23 -0
- package/docs/reference/interfaces/IBlobStorageUpdateRequest.md +4 -4
- package/docs/reference/type-aliases/BlobStorageContexts.md +5 -0
- package/docs/reference/type-aliases/BlobStorageTypes.md +5 -0
- package/docs/reference/variables/BlobStorageContexts.md +19 -0
- package/docs/reference/variables/BlobStorageTypes.md +19 -0
- package/package.json +8 -31
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,7 +1,123 @@
|
|
|
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
|
+
* Represents blob storage entry.
|
|
15
|
+
*/
|
|
16
|
+
Entry: "BlobStorageEntry",
|
|
17
|
+
/**
|
|
18
|
+
* Represents blob storage entry list.
|
|
19
|
+
*/
|
|
20
|
+
EntryList: "BlobStorageEntryList"
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
var type = "object";
|
|
24
|
+
var properties = {
|
|
25
|
+
"@context": {
|
|
26
|
+
type: "array",
|
|
27
|
+
minItems: 2,
|
|
28
|
+
items: [
|
|
29
|
+
{
|
|
30
|
+
type: "string",
|
|
31
|
+
"const": "https://schema.twindev.org/blob-storage/"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
type: "string",
|
|
35
|
+
"const": "https://schema.twindev.org/common/"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
additionalItems: {
|
|
39
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
|
|
40
|
+
},
|
|
41
|
+
description: "JSON-LD Context."
|
|
42
|
+
},
|
|
43
|
+
type: {
|
|
44
|
+
type: "string",
|
|
45
|
+
"const": "BlobStorageEntry",
|
|
46
|
+
description: "JSON-LD Type."
|
|
47
|
+
},
|
|
48
|
+
id: {
|
|
49
|
+
type: "string",
|
|
50
|
+
description: "The id for the blob."
|
|
51
|
+
},
|
|
52
|
+
dateCreated: {
|
|
53
|
+
type: "string",
|
|
54
|
+
description: "The date/time when the entry was created."
|
|
55
|
+
},
|
|
56
|
+
dateModified: {
|
|
57
|
+
type: "string",
|
|
58
|
+
description: "The date/time when the entry was modified."
|
|
59
|
+
},
|
|
60
|
+
blobSize: {
|
|
61
|
+
type: "number",
|
|
62
|
+
description: "The size of the data in the blob."
|
|
63
|
+
},
|
|
64
|
+
blobHash: {
|
|
65
|
+
type: "string",
|
|
66
|
+
description: "The hash of the data in the blob."
|
|
67
|
+
},
|
|
68
|
+
encodingFormat: {
|
|
69
|
+
type: "string",
|
|
70
|
+
description: "The mime type for the blob."
|
|
71
|
+
},
|
|
72
|
+
fileExtension: {
|
|
73
|
+
type: "string",
|
|
74
|
+
description: "The extension."
|
|
75
|
+
},
|
|
76
|
+
metadata: {
|
|
77
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
|
|
78
|
+
description: "The metadata for the blob as JSON-LD."
|
|
79
|
+
},
|
|
80
|
+
blob: {
|
|
81
|
+
type: "string",
|
|
82
|
+
description: "The blob in base64 format, included if the includeContent flag was set in the request."
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
var required = [
|
|
86
|
+
"@context",
|
|
87
|
+
"type",
|
|
88
|
+
"id",
|
|
89
|
+
"dateCreated",
|
|
90
|
+
"blobSize",
|
|
91
|
+
"blobHash"
|
|
92
|
+
];
|
|
93
|
+
var additionalProperties = false;
|
|
94
|
+
var description = "Interface describing a blob storage entry.";
|
|
95
|
+
var BlobStorageEntrySchema = {
|
|
96
|
+
type: type,
|
|
97
|
+
properties: properties,
|
|
98
|
+
required: required,
|
|
99
|
+
additionalProperties: additionalProperties,
|
|
100
|
+
description: description
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// Copyright 2024 IOTA Stiftung.
|
|
104
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
105
|
+
/**
|
|
106
|
+
* Handle all the data types for blob storage.
|
|
107
|
+
*/
|
|
108
|
+
class BlobStorageDataTypes {
|
|
109
|
+
/**
|
|
110
|
+
* Register all the data types.
|
|
111
|
+
*/
|
|
112
|
+
static registerTypes() {
|
|
113
|
+
dataCore.DataTypeHandlerFactory.register(BlobStorageTypes.Entry, () => ({
|
|
114
|
+
type: BlobStorageTypes.Entry,
|
|
115
|
+
defaultValue: {},
|
|
116
|
+
jsonSchema: async () => BlobStorageEntrySchema
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
5
121
|
// Copyright 2024 IOTA Stiftung.
|
|
6
122
|
// SPDX-License-Identifier: Apache-2.0.
|
|
7
123
|
/**
|
|
@@ -10,4 +126,24 @@ var core = require('@twin.org/core');
|
|
|
10
126
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11
127
|
const BlobStorageConnectorFactory = core.Factory.createFactory("blob-storage");
|
|
12
128
|
|
|
129
|
+
// Copyright 2024 IOTA Stiftung.
|
|
130
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
131
|
+
/**
|
|
132
|
+
* The contexts of blob storage data.
|
|
133
|
+
*/
|
|
134
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
135
|
+
const BlobStorageContexts = {
|
|
136
|
+
/**
|
|
137
|
+
* The context root for the blob storage types.
|
|
138
|
+
*/
|
|
139
|
+
ContextRoot: "https://schema.twindev.org/blob-storage/",
|
|
140
|
+
/**
|
|
141
|
+
* The context root for the common types.
|
|
142
|
+
*/
|
|
143
|
+
ContextRootCommon: "https://schema.twindev.org/common/"
|
|
144
|
+
};
|
|
145
|
+
|
|
13
146
|
exports.BlobStorageConnectorFactory = BlobStorageConnectorFactory;
|
|
147
|
+
exports.BlobStorageContexts = BlobStorageContexts;
|
|
148
|
+
exports.BlobStorageDataTypes = BlobStorageDataTypes;
|
|
149
|
+
exports.BlobStorageTypes = BlobStorageTypes;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,5 +1,121 @@
|
|
|
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
|
+
* Represents blob storage entry.
|
|
13
|
+
*/
|
|
14
|
+
Entry: "BlobStorageEntry",
|
|
15
|
+
/**
|
|
16
|
+
* Represents blob storage entry list.
|
|
17
|
+
*/
|
|
18
|
+
EntryList: "BlobStorageEntryList"
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
var type = "object";
|
|
22
|
+
var properties = {
|
|
23
|
+
"@context": {
|
|
24
|
+
type: "array",
|
|
25
|
+
minItems: 2,
|
|
26
|
+
items: [
|
|
27
|
+
{
|
|
28
|
+
type: "string",
|
|
29
|
+
"const": "https://schema.twindev.org/blob-storage/"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
type: "string",
|
|
33
|
+
"const": "https://schema.twindev.org/common/"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
additionalItems: {
|
|
37
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
|
|
38
|
+
},
|
|
39
|
+
description: "JSON-LD Context."
|
|
40
|
+
},
|
|
41
|
+
type: {
|
|
42
|
+
type: "string",
|
|
43
|
+
"const": "BlobStorageEntry",
|
|
44
|
+
description: "JSON-LD Type."
|
|
45
|
+
},
|
|
46
|
+
id: {
|
|
47
|
+
type: "string",
|
|
48
|
+
description: "The id for the blob."
|
|
49
|
+
},
|
|
50
|
+
dateCreated: {
|
|
51
|
+
type: "string",
|
|
52
|
+
description: "The date/time when the entry was created."
|
|
53
|
+
},
|
|
54
|
+
dateModified: {
|
|
55
|
+
type: "string",
|
|
56
|
+
description: "The date/time when the entry was modified."
|
|
57
|
+
},
|
|
58
|
+
blobSize: {
|
|
59
|
+
type: "number",
|
|
60
|
+
description: "The size of the data in the blob."
|
|
61
|
+
},
|
|
62
|
+
blobHash: {
|
|
63
|
+
type: "string",
|
|
64
|
+
description: "The hash of the data in the blob."
|
|
65
|
+
},
|
|
66
|
+
encodingFormat: {
|
|
67
|
+
type: "string",
|
|
68
|
+
description: "The mime type for the blob."
|
|
69
|
+
},
|
|
70
|
+
fileExtension: {
|
|
71
|
+
type: "string",
|
|
72
|
+
description: "The extension."
|
|
73
|
+
},
|
|
74
|
+
metadata: {
|
|
75
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
|
|
76
|
+
description: "The metadata for the blob as JSON-LD."
|
|
77
|
+
},
|
|
78
|
+
blob: {
|
|
79
|
+
type: "string",
|
|
80
|
+
description: "The blob in base64 format, included if the includeContent flag was set in the request."
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
var required = [
|
|
84
|
+
"@context",
|
|
85
|
+
"type",
|
|
86
|
+
"id",
|
|
87
|
+
"dateCreated",
|
|
88
|
+
"blobSize",
|
|
89
|
+
"blobHash"
|
|
90
|
+
];
|
|
91
|
+
var additionalProperties = false;
|
|
92
|
+
var description = "Interface describing a blob storage entry.";
|
|
93
|
+
var BlobStorageEntrySchema = {
|
|
94
|
+
type: type,
|
|
95
|
+
properties: properties,
|
|
96
|
+
required: required,
|
|
97
|
+
additionalProperties: additionalProperties,
|
|
98
|
+
description: description
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// Copyright 2024 IOTA Stiftung.
|
|
102
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
103
|
+
/**
|
|
104
|
+
* Handle all the data types for blob storage.
|
|
105
|
+
*/
|
|
106
|
+
class BlobStorageDataTypes {
|
|
107
|
+
/**
|
|
108
|
+
* Register all the data types.
|
|
109
|
+
*/
|
|
110
|
+
static registerTypes() {
|
|
111
|
+
DataTypeHandlerFactory.register(BlobStorageTypes.Entry, () => ({
|
|
112
|
+
type: BlobStorageTypes.Entry,
|
|
113
|
+
defaultValue: {},
|
|
114
|
+
jsonSchema: async () => BlobStorageEntrySchema
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
3
119
|
// Copyright 2024 IOTA Stiftung.
|
|
4
120
|
// SPDX-License-Identifier: Apache-2.0.
|
|
5
121
|
/**
|
|
@@ -8,4 +124,21 @@ import { Factory } from '@twin.org/core';
|
|
|
8
124
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
9
125
|
const BlobStorageConnectorFactory = Factory.createFactory("blob-storage");
|
|
10
126
|
|
|
11
|
-
|
|
127
|
+
// Copyright 2024 IOTA Stiftung.
|
|
128
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
129
|
+
/**
|
|
130
|
+
* The contexts of blob storage data.
|
|
131
|
+
*/
|
|
132
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
133
|
+
const BlobStorageContexts = {
|
|
134
|
+
/**
|
|
135
|
+
* The context root for the blob storage types.
|
|
136
|
+
*/
|
|
137
|
+
ContextRoot: "https://schema.twindev.org/blob-storage/",
|
|
138
|
+
/**
|
|
139
|
+
* The context root for the common types.
|
|
140
|
+
*/
|
|
141
|
+
ContextRootCommon: "https://schema.twindev.org/common/"
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export { BlobStorageConnectorFactory, BlobStorageContexts, BlobStorageDataTypes, BlobStorageTypes };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
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";
|
|
4
5
|
export * from "./models/api/IBlobStorageGetContentResponse";
|
|
5
6
|
export * from "./models/api/IBlobStorageGetRequest";
|
|
6
7
|
export * from "./models/api/IBlobStorageGetResponse";
|
|
8
|
+
export * from "./models/api/IBlobStorageListRequest";
|
|
9
|
+
export * from "./models/api/IBlobStorageListResponse";
|
|
7
10
|
export * from "./models/api/IBlobStorageRemoveRequest";
|
|
8
11
|
export * from "./models/api/IBlobStorageUpdateRequest";
|
|
12
|
+
export * from "./models/blobStorageContexts";
|
|
13
|
+
export * from "./models/blobStorageTypes";
|
|
9
14
|
export * from "./models/IBlobStorageComponent";
|
|
10
15
|
export * from "./models/IBlobStorageConnector";
|
|
16
|
+
export * from "./models/IBlobStorageEntry";
|
|
17
|
+
export * from "./models/IBlobStorageEntryList";
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { IComponent } from "@twin.org/core";
|
|
2
2
|
import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
3
|
+
import type { EntityCondition, SortDirection } from "@twin.org/entity";
|
|
4
|
+
import type { IBlobStorageEntry } from "./IBlobStorageEntry";
|
|
5
|
+
import type { IBlobStorageEntryList } from "./IBlobStorageEntryList";
|
|
3
6
|
/**
|
|
4
7
|
* Interface describing an blob storage component.
|
|
5
8
|
*/
|
|
@@ -7,43 +10,57 @@ export interface IBlobStorageComponent extends IComponent {
|
|
|
7
10
|
/**
|
|
8
11
|
* Create the blob with some metadata.
|
|
9
12
|
* @param blob The data for the blob in base64 format.
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
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.
|
|
12
15
|
* @param metadata Data for the custom metadata as JSON-LD.
|
|
13
16
|
* @param namespace The namespace to use for storing, defaults to component configured namespace.
|
|
14
|
-
* @param
|
|
17
|
+
* @param userIdentity The user identity to use with storage operations.
|
|
18
|
+
* @param nodeIdentity The node identity to use with storage operations.
|
|
15
19
|
* @returns The id of the stored blob in urn format.
|
|
16
20
|
*/
|
|
17
|
-
create(blob: string,
|
|
21
|
+
create(blob: string, encodingFormat?: string, fileExtension?: string, metadata?: IJsonLdNodeObject, namespace?: string, userIdentity?: string, nodeIdentity?: string): Promise<string>;
|
|
18
22
|
/**
|
|
19
23
|
* Get the blob and metadata.
|
|
20
24
|
* @param id The id of the blob to get in urn format.
|
|
21
25
|
* @param includeContent Include the content, or just get the metadata.
|
|
22
|
-
* @param
|
|
26
|
+
* @param userIdentity The user identity to use with storage operations.
|
|
27
|
+
* @param nodeIdentity The node identity to use with storage operations.
|
|
23
28
|
* @returns The data and metadata for the blob if it can be found.
|
|
24
29
|
* @throws Not found error if the blob cannot be found.
|
|
25
30
|
*/
|
|
26
|
-
get(id: string, includeContent: boolean, nodeIdentity?: string): Promise<
|
|
27
|
-
blob?: string;
|
|
28
|
-
mimeType?: string;
|
|
29
|
-
extension?: string;
|
|
30
|
-
metadata?: IJsonLdNodeObject;
|
|
31
|
-
}>;
|
|
31
|
+
get(id: string, includeContent: boolean, userIdentity?: string, nodeIdentity?: string): Promise<IBlobStorageEntry>;
|
|
32
32
|
/**
|
|
33
33
|
* Update the blob with metadata.
|
|
34
34
|
* @param id The id of the blob metadata to update.
|
|
35
|
-
* @param
|
|
36
|
-
* @param
|
|
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.
|
|
37
37
|
* @param metadata Data for the custom metadata as JSON-LD.
|
|
38
|
+
* @param userIdentity The user identity to use with storage operations.
|
|
39
|
+
* @param nodeIdentity The node identity to use with storage operations.
|
|
38
40
|
* @returns Nothing.
|
|
39
41
|
* @throws Not found error if the blob cannot be found.
|
|
40
42
|
*/
|
|
41
|
-
update(id: string,
|
|
43
|
+
update(id: string, encodingFormat?: string, fileExtension?: string, metadata?: IJsonLdNodeObject, userIdentity?: string, nodeIdentity?: string): Promise<void>;
|
|
42
44
|
/**
|
|
43
45
|
* Remove the blob.
|
|
44
46
|
* @param id The id of the blob to remove in urn format.
|
|
47
|
+
* @param userIdentity The user identity to use with storage operations.
|
|
48
|
+
* @param nodeIdentity The node identity to use with storage operations.
|
|
45
49
|
* @returns Nothing.
|
|
46
50
|
* @throws Not found error if the blob cannot be found.
|
|
47
51
|
*/
|
|
48
|
-
remove(id: string): Promise<void>;
|
|
52
|
+
remove(id: string, userIdentity?: string, nodeIdentity?: string): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Query all the blob storage entries which match the conditions.
|
|
55
|
+
* @param conditions The conditions to match for the entries.
|
|
56
|
+
* @param orderBy The order for the results, defaults to created.
|
|
57
|
+
* @param orderByDirection The direction for the order, defaults to descending.
|
|
58
|
+
* @param cursor The cursor to request the next page of entries.
|
|
59
|
+
* @param pageSize The suggested number of entries to return in each chunk, in some scenarios can return a different amount.
|
|
60
|
+
* @param userIdentity The user identity to use with storage operations.
|
|
61
|
+
* @param nodeIdentity The node identity to use with storage operations.
|
|
62
|
+
* @returns All the entries for the storage matching the conditions,
|
|
63
|
+
* and a cursor which can be used to request more entities.
|
|
64
|
+
*/
|
|
65
|
+
query(conditions?: EntityCondition<IBlobStorageEntry>, orderBy?: keyof Pick<IBlobStorageEntry, "dateCreated" | "dateModified">, orderByDirection?: SortDirection, cursor?: string, pageSize?: number, userIdentity?: string, nodeIdentity?: string): Promise<IBlobStorageEntryList>;
|
|
49
66
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { IJsonLdContextDefinitionElement, IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
|
+
import type { BlobStorageContexts } from "./blobStorageContexts";
|
|
3
|
+
import type { BlobStorageTypes } from "./blobStorageTypes";
|
|
4
|
+
/**
|
|
5
|
+
* Interface describing a blob storage entry.
|
|
6
|
+
*/
|
|
7
|
+
export interface IBlobStorageEntry {
|
|
8
|
+
/**
|
|
9
|
+
* JSON-LD Context.
|
|
10
|
+
*/
|
|
11
|
+
"@context": [
|
|
12
|
+
typeof BlobStorageContexts.ContextRoot,
|
|
13
|
+
typeof BlobStorageContexts.ContextRootCommon,
|
|
14
|
+
...IJsonLdContextDefinitionElement[]
|
|
15
|
+
];
|
|
16
|
+
/**
|
|
17
|
+
* JSON-LD Type.
|
|
18
|
+
*/
|
|
19
|
+
type: typeof BlobStorageTypes.Entry;
|
|
20
|
+
/**
|
|
21
|
+
* The id for the blob.
|
|
22
|
+
*/
|
|
23
|
+
id: string;
|
|
24
|
+
/**
|
|
25
|
+
* The date/time when the entry was created.
|
|
26
|
+
*/
|
|
27
|
+
dateCreated: string;
|
|
28
|
+
/**
|
|
29
|
+
* The date/time when the entry was modified.
|
|
30
|
+
*/
|
|
31
|
+
dateModified?: string;
|
|
32
|
+
/**
|
|
33
|
+
* The size of the data in the blob.
|
|
34
|
+
*/
|
|
35
|
+
blobSize: number;
|
|
36
|
+
/**
|
|
37
|
+
* The hash of the data in the blob.
|
|
38
|
+
*/
|
|
39
|
+
blobHash: string;
|
|
40
|
+
/**
|
|
41
|
+
* The mime type for the blob.
|
|
42
|
+
*/
|
|
43
|
+
encodingFormat?: string;
|
|
44
|
+
/**
|
|
45
|
+
* The extension.
|
|
46
|
+
*/
|
|
47
|
+
fileExtension?: string;
|
|
48
|
+
/**
|
|
49
|
+
* The metadata for the blob as JSON-LD.
|
|
50
|
+
*/
|
|
51
|
+
metadata?: IJsonLdNodeObject;
|
|
52
|
+
/**
|
|
53
|
+
* The blob in base64 format, included if the includeContent flag was set in the request.
|
|
54
|
+
*/
|
|
55
|
+
blob?: string;
|
|
56
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { IJsonLdContextDefinitionElement } from "@twin.org/data-json-ld";
|
|
2
|
+
import type { BlobStorageContexts } from "./blobStorageContexts";
|
|
3
|
+
import type { BlobStorageTypes } from "./blobStorageTypes";
|
|
4
|
+
import type { IBlobStorageEntry } from "./IBlobStorageEntry";
|
|
5
|
+
/**
|
|
6
|
+
* Interface describing an blob storage entry list.
|
|
7
|
+
*/
|
|
8
|
+
export interface IBlobStorageEntryList {
|
|
9
|
+
/**
|
|
10
|
+
* JSON-LD Context.
|
|
11
|
+
*/
|
|
12
|
+
"@context": [
|
|
13
|
+
typeof BlobStorageContexts.ContextRoot,
|
|
14
|
+
typeof BlobStorageContexts.ContextRootCommon,
|
|
15
|
+
...IJsonLdContextDefinitionElement[]
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* JSON-LD Type.
|
|
19
|
+
*/
|
|
20
|
+
type: typeof BlobStorageTypes.EntryList;
|
|
21
|
+
/**
|
|
22
|
+
* The list of entries.
|
|
23
|
+
*/
|
|
24
|
+
entries: IBlobStorageEntry[];
|
|
25
|
+
/**
|
|
26
|
+
* The cursor to get the next chunk of entries.
|
|
27
|
+
*/
|
|
28
|
+
cursor?: string;
|
|
29
|
+
}
|
|
@@ -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
|
-
|
|
17
|
+
encodingFormat?: string;
|
|
18
18
|
/**
|
|
19
19
|
* The extension of the blob, will be detected if left undefined.
|
|
20
20
|
*/
|
|
21
|
-
|
|
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 {
|
|
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
|
|
8
|
+
* The headers which can be used to determine the response data type.
|
|
8
9
|
*/
|
|
9
|
-
|
|
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
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { SortDirection } from "@twin.org/entity";
|
|
2
|
+
import type { HeaderTypes, MimeTypes } from "@twin.org/web";
|
|
3
|
+
import type { IBlobStorageEntry } from "../IBlobStorageEntry";
|
|
4
|
+
/**
|
|
5
|
+
* Query the entries from blob storage.
|
|
6
|
+
*/
|
|
7
|
+
export interface IBlobStorageListRequest {
|
|
8
|
+
/**
|
|
9
|
+
* The headers which can be used to determine the response data type.
|
|
10
|
+
*/
|
|
11
|
+
headers?: {
|
|
12
|
+
[HeaderTypes.Accept]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The parameters from the query.
|
|
16
|
+
*/
|
|
17
|
+
query?: {
|
|
18
|
+
/**
|
|
19
|
+
* The condition for the query as JSON version of EntityCondition type.
|
|
20
|
+
*/
|
|
21
|
+
conditions?: string;
|
|
22
|
+
/**
|
|
23
|
+
* The order for the results, default to created.
|
|
24
|
+
*/
|
|
25
|
+
orderBy?: keyof Pick<IBlobStorageEntry, "dateCreated" | "dateModified">;
|
|
26
|
+
/**
|
|
27
|
+
* The direction for the order, defaults to desc.
|
|
28
|
+
*/
|
|
29
|
+
orderByDirection?: SortDirection;
|
|
30
|
+
/**
|
|
31
|
+
* The number of entries to return per page.
|
|
32
|
+
*/
|
|
33
|
+
pageSize?: number;
|
|
34
|
+
/**
|
|
35
|
+
* The cursor to get next chunk of data, returned in previous response.
|
|
36
|
+
*/
|
|
37
|
+
cursor?: string;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { HeaderTypes, MimeTypes } from "@twin.org/web";
|
|
2
|
+
import type { IBlobStorageEntryList } from "../IBlobStorageEntryList";
|
|
3
|
+
/**
|
|
4
|
+
* Response to getting the list of entries from a query.
|
|
5
|
+
*/
|
|
6
|
+
export interface IBlobStorageListResponse {
|
|
7
|
+
/**
|
|
8
|
+
* The headers which can be used to determine the response data type.
|
|
9
|
+
*/
|
|
10
|
+
headers?: {
|
|
11
|
+
[HeaderTypes.ContentType]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The list of entries from the query.
|
|
15
|
+
*/
|
|
16
|
+
body: IBlobStorageEntryList;
|
|
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
|
-
|
|
22
|
+
encodingFormat?: string;
|
|
23
23
|
/**
|
|
24
24
|
* The extension of the blob, will be detected if left undefined.
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
fileExtension?: string;
|
|
27
27
|
/**
|
|
28
28
|
* Custom metadata to associate with the blob as JSON-LD.
|
|
29
29
|
*/
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The contexts of blob storage data.
|
|
3
|
+
*/
|
|
4
|
+
export declare const BlobStorageContexts: {
|
|
5
|
+
/**
|
|
6
|
+
* The context root for the blob storage types.
|
|
7
|
+
*/
|
|
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/";
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The contexts of blob storage data.
|
|
16
|
+
*/
|
|
17
|
+
export type BlobStorageContexts = (typeof BlobStorageContexts)[keyof typeof BlobStorageContexts];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The types of blob storage data.
|
|
3
|
+
*/
|
|
4
|
+
export declare const BlobStorageTypes: {
|
|
5
|
+
/**
|
|
6
|
+
* Represents blob storage entry.
|
|
7
|
+
*/
|
|
8
|
+
readonly Entry: "BlobStorageEntry";
|
|
9
|
+
/**
|
|
10
|
+
* Represents blob storage entry list.
|
|
11
|
+
*/
|
|
12
|
+
readonly EntryList: "BlobStorageEntryList";
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The types of blob storage data.
|
|
16
|
+
*/
|
|
17
|
+
export type BlobStorageTypes = (typeof BlobStorageTypes)[keyof typeof BlobStorageTypes];
|