@twin.org/blob-storage-models 0.0.2-next.5 → 0.0.3-next.2
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/es/dataTypes/blobStorageDataTypes.js +30 -0
- package/dist/es/dataTypes/blobStorageDataTypes.js.map +1 -0
- package/dist/es/factories/blobStorageConnectorFactory.js +9 -0
- package/dist/es/factories/blobStorageConnectorFactory.js.map +1 -0
- package/dist/es/index.js +21 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/models/IBlobStorageComponent.js +2 -0
- package/dist/es/models/IBlobStorageComponent.js.map +1 -0
- package/dist/es/models/IBlobStorageConnector.js +2 -0
- package/dist/es/models/IBlobStorageConnector.js.map +1 -0
- package/dist/es/models/IBlobStorageEntry.js +2 -0
- package/dist/es/models/IBlobStorageEntry.js.map +1 -0
- package/dist/es/models/IBlobStorageEntryList.js +2 -0
- package/dist/es/models/IBlobStorageEntryList.js.map +1 -0
- package/dist/es/models/api/IBlobStorageCreateRequest.js +2 -0
- package/dist/es/models/api/IBlobStorageCreateRequest.js.map +1 -0
- package/dist/es/models/api/IBlobStorageGetContentRequest.js +4 -0
- package/dist/es/models/api/IBlobStorageGetContentRequest.js.map +1 -0
- package/dist/es/models/api/IBlobStorageGetContentResponse.js +4 -0
- package/dist/es/models/api/IBlobStorageGetContentResponse.js.map +1 -0
- package/dist/es/models/api/IBlobStorageGetRequest.js +2 -0
- package/dist/es/models/api/IBlobStorageGetRequest.js.map +1 -0
- package/dist/es/models/api/IBlobStorageGetResponse.js +2 -0
- package/dist/es/models/api/IBlobStorageGetResponse.js.map +1 -0
- package/dist/es/models/api/IBlobStorageListRequest.js +2 -0
- package/dist/es/models/api/IBlobStorageListRequest.js.map +1 -0
- package/dist/es/models/api/IBlobStorageListResponse.js +2 -0
- package/dist/es/models/api/IBlobStorageListResponse.js.map +1 -0
- package/dist/es/models/api/IBlobStorageRemoveRequest.js +4 -0
- package/dist/es/models/api/IBlobStorageRemoveRequest.js.map +1 -0
- package/dist/es/models/api/IBlobStorageUpdateRequest.js +2 -0
- package/dist/es/models/api/IBlobStorageUpdateRequest.js.map +1 -0
- package/dist/es/models/blobStorageCompressionType.js +17 -0
- package/dist/es/models/blobStorageCompressionType.js.map +1 -0
- package/dist/es/models/blobStorageContexts.js +17 -0
- package/dist/es/models/blobStorageContexts.js.map +1 -0
- package/dist/es/models/blobStorageTypes.js +17 -0
- package/dist/es/models/blobStorageTypes.js.map +1 -0
- package/dist/es/schemas/BlobStorageCompressionType.json +10 -0
- package/dist/es/schemas/BlobStorageEntry.json +84 -0
- package/dist/types/factories/blobStorageConnectorFactory.d.ts +1 -1
- package/dist/types/index.d.ts +18 -18
- package/dist/types/models/IBlobStorageComponent.d.ts +8 -15
- package/dist/types/models/IBlobStorageEntry.d.ts +5 -5
- package/dist/types/models/IBlobStorageEntryList.d.ts +5 -5
- package/dist/types/models/api/IBlobStorageCreateRequest.d.ts +1 -1
- package/dist/types/models/api/IBlobStorageGetContentRequest.d.ts +2 -2
- package/dist/types/models/api/IBlobStorageGetRequest.d.ts +2 -2
- package/dist/types/models/api/IBlobStorageGetResponse.d.ts +1 -1
- package/dist/types/models/api/IBlobStorageListRequest.d.ts +1 -1
- package/dist/types/models/api/IBlobStorageListResponse.d.ts +1 -1
- package/dist/types/models/blobStorageContexts.d.ts +2 -2
- package/docs/changelog.md +31 -0
- package/docs/reference/interfaces/IBlobStorageComponent.md +5 -55
- package/docs/reference/interfaces/IBlobStorageConnector.md +2 -10
- package/docs/reference/interfaces/IBlobStorageGetContentRequest.md +2 -2
- package/docs/reference/interfaces/IBlobStorageGetRequest.md +2 -2
- package/docs/reference/variables/BlobStorageContexts.md +4 -4
- package/package.json +5 -7
- package/dist/cjs/index.cjs +0 -201
- package/dist/esm/index.mjs +0 -195
package/dist/esm/index.mjs
DELETED
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import { DataTypeHandlerFactory } from '@twin.org/data-core';
|
|
2
|
-
import { Factory } from '@twin.org/core';
|
|
3
|
-
|
|
4
|
-
// Copyright 2024 IOTA Stiftung.
|
|
5
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
6
|
-
/**
|
|
7
|
-
* The contexts of blob storage data.
|
|
8
|
-
*/
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10
|
-
const BlobStorageContexts = {
|
|
11
|
-
/**
|
|
12
|
-
* The context root for the blob storage types.
|
|
13
|
-
*/
|
|
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/"
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
// Copyright 2024 IOTA Stiftung.
|
|
22
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
23
|
-
/**
|
|
24
|
-
* The types of blob storage data.
|
|
25
|
-
*/
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
27
|
-
const BlobStorageTypes = {
|
|
28
|
-
/**
|
|
29
|
-
* Represents blob storage entry.
|
|
30
|
-
*/
|
|
31
|
-
Entry: "BlobStorageEntry",
|
|
32
|
-
/**
|
|
33
|
-
* Represents blob storage entry compression.
|
|
34
|
-
*/
|
|
35
|
-
CompressionType: "BlobStorageCompressionType"
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
var $schema$1 = "https://json-schema.org/draft/2020-12/schema";
|
|
39
|
-
var $id$1 = "https://schema.twindev.org/blob-storage/BlobStorageCompressionType";
|
|
40
|
-
var description$1 = "The types of compression for blob storage data.";
|
|
41
|
-
var type$1 = "string";
|
|
42
|
-
var BlobStorageCompressionTypeSchema = {
|
|
43
|
-
$schema: $schema$1,
|
|
44
|
-
$id: $id$1,
|
|
45
|
-
description: description$1,
|
|
46
|
-
type: type$1,
|
|
47
|
-
"enum": [
|
|
48
|
-
"gzip",
|
|
49
|
-
"deflate"
|
|
50
|
-
]
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
var $schema = "https://json-schema.org/draft/2020-12/schema";
|
|
54
|
-
var $id = "https://schema.twindev.org/blob-storage/BlobStorageEntry";
|
|
55
|
-
var description = "Interface describing a blob storage entry.";
|
|
56
|
-
var type = "object";
|
|
57
|
-
var properties = {
|
|
58
|
-
"@context": {
|
|
59
|
-
type: "array",
|
|
60
|
-
minItems: 2,
|
|
61
|
-
items: {
|
|
62
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
|
|
63
|
-
},
|
|
64
|
-
description: "JSON-LD Context.",
|
|
65
|
-
prefixItems: [
|
|
66
|
-
{
|
|
67
|
-
type: "string",
|
|
68
|
-
"const": "https://schema.twindev.org/blob-storage/"
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
type: "string",
|
|
72
|
-
"const": "https://schema.twindev.org/common/"
|
|
73
|
-
}
|
|
74
|
-
]
|
|
75
|
-
},
|
|
76
|
-
type: {
|
|
77
|
-
type: "string",
|
|
78
|
-
"const": "BlobStorageEntry",
|
|
79
|
-
description: "JSON-LD Type."
|
|
80
|
-
},
|
|
81
|
-
id: {
|
|
82
|
-
type: "string",
|
|
83
|
-
description: "The id for the blob."
|
|
84
|
-
},
|
|
85
|
-
dateCreated: {
|
|
86
|
-
type: "string",
|
|
87
|
-
description: "The date/time when the entry was created."
|
|
88
|
-
},
|
|
89
|
-
dateModified: {
|
|
90
|
-
type: "string",
|
|
91
|
-
description: "The date/time when the entry was modified."
|
|
92
|
-
},
|
|
93
|
-
blobSize: {
|
|
94
|
-
type: "number",
|
|
95
|
-
description: "The size of the data in the blob."
|
|
96
|
-
},
|
|
97
|
-
blobHash: {
|
|
98
|
-
type: "string",
|
|
99
|
-
description: "The hash of the data in the blob."
|
|
100
|
-
},
|
|
101
|
-
encodingFormat: {
|
|
102
|
-
type: "string",
|
|
103
|
-
description: "The mime type for the blob."
|
|
104
|
-
},
|
|
105
|
-
isEncrypted: {
|
|
106
|
-
type: "boolean",
|
|
107
|
-
description: "Indicates if the blob is encrypted."
|
|
108
|
-
},
|
|
109
|
-
compression: {
|
|
110
|
-
$ref: "https://schema.twindev.org/blob-storage/BlobStorageCompressionType",
|
|
111
|
-
description: "The type of compression used for the blob, if not set it is not stored with compression."
|
|
112
|
-
},
|
|
113
|
-
fileExtension: {
|
|
114
|
-
type: "string",
|
|
115
|
-
description: "The extension."
|
|
116
|
-
},
|
|
117
|
-
metadata: {
|
|
118
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
|
|
119
|
-
description: "The metadata for the blob as JSON-LD."
|
|
120
|
-
},
|
|
121
|
-
blob: {
|
|
122
|
-
type: "string",
|
|
123
|
-
description: "The blob in base64 format, included if the includeContent flag was set in the request."
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
var required = [
|
|
127
|
-
"@context",
|
|
128
|
-
"type",
|
|
129
|
-
"id",
|
|
130
|
-
"dateCreated",
|
|
131
|
-
"blobSize",
|
|
132
|
-
"blobHash"
|
|
133
|
-
];
|
|
134
|
-
var additionalProperties = false;
|
|
135
|
-
var BlobStorageEntrySchema = {
|
|
136
|
-
$schema: $schema,
|
|
137
|
-
$id: $id,
|
|
138
|
-
description: description,
|
|
139
|
-
type: type,
|
|
140
|
-
properties: properties,
|
|
141
|
-
required: required,
|
|
142
|
-
additionalProperties: additionalProperties
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
// Copyright 2024 IOTA Stiftung.
|
|
146
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
147
|
-
/**
|
|
148
|
-
* Handle all the data types for blob storage.
|
|
149
|
-
*/
|
|
150
|
-
class BlobStorageDataTypes {
|
|
151
|
-
/**
|
|
152
|
-
* Register all the data types.
|
|
153
|
-
*/
|
|
154
|
-
static registerTypes() {
|
|
155
|
-
DataTypeHandlerFactory.register(`${BlobStorageContexts.ContextRoot}${BlobStorageTypes.Entry}`, () => ({
|
|
156
|
-
context: BlobStorageContexts.ContextRoot,
|
|
157
|
-
type: BlobStorageTypes.Entry,
|
|
158
|
-
defaultValue: {},
|
|
159
|
-
jsonSchema: async () => BlobStorageEntrySchema
|
|
160
|
-
}));
|
|
161
|
-
DataTypeHandlerFactory.register(`${BlobStorageContexts.ContextRoot}${BlobStorageTypes.CompressionType}`, () => ({
|
|
162
|
-
context: BlobStorageContexts.ContextRoot,
|
|
163
|
-
type: BlobStorageTypes.CompressionType,
|
|
164
|
-
defaultValue: {},
|
|
165
|
-
jsonSchema: async () => BlobStorageCompressionTypeSchema
|
|
166
|
-
}));
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// Copyright 2024 IOTA Stiftung.
|
|
171
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
172
|
-
/**
|
|
173
|
-
* Factory for creating blob storage connectors.
|
|
174
|
-
*/
|
|
175
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
176
|
-
const BlobStorageConnectorFactory = Factory.createFactory("blob-storage");
|
|
177
|
-
|
|
178
|
-
// Copyright 2024 IOTA Stiftung.
|
|
179
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
180
|
-
/**
|
|
181
|
-
* The types of compression for blob storage data.
|
|
182
|
-
*/
|
|
183
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
184
|
-
const BlobStorageCompressionType = {
|
|
185
|
-
/**
|
|
186
|
-
* Gzip.
|
|
187
|
-
*/
|
|
188
|
-
Gzip: "gzip",
|
|
189
|
-
/**
|
|
190
|
-
* Deflate.
|
|
191
|
-
*/
|
|
192
|
-
Deflate: "deflate"
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
export { BlobStorageCompressionType, BlobStorageConnectorFactory, BlobStorageContexts, BlobStorageDataTypes, BlobStorageTypes };
|