@23blocks/block-files 1.0.2 → 1.0.4
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/index.d.ts +1 -0
- package/dist/index.esm.js +413 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/lib/files.block.d.ts +14 -0
- package/dist/src/lib/files.block.d.ts.map +1 -0
- package/dist/src/lib/mappers/entity-file.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/entity-file.mapper.d.ts.map +1 -0
- package/dist/src/lib/mappers/file-schema.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/file-schema.mapper.d.ts.map +1 -0
- package/dist/{lib/mappers/index.js → src/lib/mappers/index.d.ts} +1 -2
- package/dist/src/lib/mappers/index.d.ts.map +1 -0
- package/dist/src/lib/mappers/storage-file.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/storage-file.mapper.d.ts.map +1 -0
- package/dist/src/lib/mappers/utils.d.ts +29 -0
- package/dist/src/lib/mappers/utils.d.ts.map +1 -0
- package/dist/src/lib/services/entity-files.service.d.ts +15 -0
- package/dist/src/lib/services/entity-files.service.d.ts.map +1 -0
- package/dist/src/lib/services/file-schemas.service.d.ts +14 -0
- package/dist/src/lib/services/file-schemas.service.d.ts.map +1 -0
- package/dist/{lib/services/index.js → src/lib/services/index.d.ts} +1 -2
- package/dist/src/lib/services/index.d.ts.map +1 -0
- package/dist/src/lib/services/storage-files.service.d.ts +16 -0
- package/dist/src/lib/services/storage-files.service.d.ts.map +1 -0
- package/dist/src/lib/types/entity-file.d.ts +46 -0
- package/dist/src/lib/types/entity-file.d.ts.map +1 -0
- package/dist/src/lib/types/file-schema.d.ts +43 -0
- package/dist/src/lib/types/file-schema.d.ts.map +1 -0
- package/dist/{lib/types/index.js → src/lib/types/index.d.ts} +1 -2
- package/dist/src/lib/types/index.d.ts.map +1 -0
- package/dist/src/lib/types/storage-file.d.ts +69 -0
- package/dist/src/lib/types/storage-file.d.ts.map +1 -0
- package/package.json +10 -8
- package/dist/index.js +0 -7
- package/dist/index.js.map +0 -1
- package/dist/lib/files.block.js +0 -20
- package/dist/lib/files.block.js.map +0 -1
- package/dist/lib/mappers/entity-file.mapper.js +0 -25
- package/dist/lib/mappers/entity-file.mapper.js.map +0 -1
- package/dist/lib/mappers/file-schema.mapper.js +0 -22
- package/dist/lib/mappers/file-schema.mapper.js.map +0 -1
- package/dist/lib/mappers/index.js.map +0 -1
- package/dist/lib/mappers/storage-file.mapper.js +0 -30
- package/dist/lib/mappers/storage-file.mapper.js.map +0 -1
- package/dist/lib/mappers/utils.js +0 -75
- package/dist/lib/mappers/utils.js.map +0 -1
- package/dist/lib/services/entity-files.service.js +0 -86
- package/dist/lib/services/entity-files.service.js.map +0 -1
- package/dist/lib/services/file-schemas.service.js +0 -68
- package/dist/lib/services/file-schemas.service.js.map +0 -1
- package/dist/lib/services/index.js.map +0 -1
- package/dist/lib/services/storage-files.service.js +0 -111
- package/dist/lib/services/storage-files.service.js.map +0 -1
- package/dist/lib/types/entity-file.js +0 -3
- package/dist/lib/types/entity-file.js.map +0 -1
- package/dist/lib/types/file-schema.js +0 -3
- package/dist/lib/types/file-schema.js.map +0 -1
- package/dist/lib/types/index.js.map +0 -1
- package/dist/lib/types/storage-file.js +0 -3
- package/dist/lib/types/storage-file.js.map +0 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/index";
|
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
import { decodePageResult, decodeOne, decodeMany } from '@23blocks/jsonapi-codec';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Parse a string value, returning undefined for empty/undefined
|
|
5
|
+
*/ function parseString(value) {
|
|
6
|
+
if (value === null || value === undefined) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
const str = String(value);
|
|
10
|
+
return str.length > 0 ? str : undefined;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Parse a date value
|
|
14
|
+
*/ function parseDate(value) {
|
|
15
|
+
if (value === null || value === undefined) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
if (value instanceof Date) {
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
22
|
+
const date = new Date(value);
|
|
23
|
+
return isNaN(date.getTime()) ? undefined : date;
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Parse a boolean value
|
|
29
|
+
*/ function parseBoolean(value) {
|
|
30
|
+
if (typeof value === 'boolean') {
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
if (value === 'true' || value === '1' || value === 1) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Parse an array of strings
|
|
40
|
+
*/ function parseStringArray(value) {
|
|
41
|
+
if (value === null || value === undefined) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
if (Array.isArray(value)) {
|
|
45
|
+
return value.map(String);
|
|
46
|
+
}
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Parse an optional number value
|
|
51
|
+
*/ function parseOptionalNumber(value) {
|
|
52
|
+
if (value === null || value === undefined) {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
const num = Number(value);
|
|
56
|
+
return isNaN(num) ? undefined : num;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Parse entity status
|
|
60
|
+
*/ function parseStatus(value) {
|
|
61
|
+
const status = parseString(value);
|
|
62
|
+
if (status === 'active' || status === 'inactive' || status === 'pending' || status === 'archived' || status === 'deleted') {
|
|
63
|
+
return status;
|
|
64
|
+
}
|
|
65
|
+
return 'active';
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const storageFileMapper = {
|
|
69
|
+
type: 'StorageFile',
|
|
70
|
+
map: (resource)=>({
|
|
71
|
+
id: resource.id,
|
|
72
|
+
uniqueId: parseString(resource.attributes['unique_id']) || resource.id,
|
|
73
|
+
createdAt: parseDate(resource.attributes['created_at']) || new Date(),
|
|
74
|
+
updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
|
|
75
|
+
ownerUniqueId: parseString(resource.attributes['owner_unique_id']) || '',
|
|
76
|
+
ownerType: parseString(resource.attributes['owner_type']) || '',
|
|
77
|
+
fileName: parseString(resource.attributes['file_name']) || '',
|
|
78
|
+
fileType: parseString(resource.attributes['file_type']),
|
|
79
|
+
fileSize: parseOptionalNumber(resource.attributes['file_size']),
|
|
80
|
+
mimeType: parseString(resource.attributes['mime_type']),
|
|
81
|
+
contentUrl: parseString(resource.attributes['content_url']),
|
|
82
|
+
thumbnailUrl: parseString(resource.attributes['thumbnail_url']),
|
|
83
|
+
previewUrl: parseString(resource.attributes['preview_url']),
|
|
84
|
+
downloadUrl: parseString(resource.attributes['download_url']),
|
|
85
|
+
storagePath: parseString(resource.attributes['storage_path']),
|
|
86
|
+
storageProvider: parseString(resource.attributes['storage_provider']),
|
|
87
|
+
status: parseStatus(resource.attributes['status']),
|
|
88
|
+
enabled: parseBoolean(resource.attributes['enabled']),
|
|
89
|
+
payload: resource.attributes['payload'],
|
|
90
|
+
tags: parseStringArray(resource.attributes['tags']),
|
|
91
|
+
createdBy: parseString(resource.attributes['created_by']),
|
|
92
|
+
updatedBy: parseString(resource.attributes['updated_by'])
|
|
93
|
+
})
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
function createStorageFilesService(transport, _config) {
|
|
97
|
+
return {
|
|
98
|
+
async list (params) {
|
|
99
|
+
const queryParams = {};
|
|
100
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
101
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
102
|
+
if (params == null ? void 0 : params.ownerUniqueId) queryParams['owner_unique_id'] = params.ownerUniqueId;
|
|
103
|
+
if (params == null ? void 0 : params.ownerType) queryParams['owner_type'] = params.ownerType;
|
|
104
|
+
if (params == null ? void 0 : params.fileType) queryParams['file_type'] = params.fileType;
|
|
105
|
+
if (params == null ? void 0 : params.mimeType) queryParams['mime_type'] = params.mimeType;
|
|
106
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
107
|
+
if (params == null ? void 0 : params.search) queryParams['search'] = params.search;
|
|
108
|
+
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
109
|
+
const response = await transport.get('/storage_files', {
|
|
110
|
+
params: queryParams
|
|
111
|
+
});
|
|
112
|
+
return decodePageResult(response, storageFileMapper);
|
|
113
|
+
},
|
|
114
|
+
async get (uniqueId) {
|
|
115
|
+
const response = await transport.get(`/storage_files/${uniqueId}`);
|
|
116
|
+
return decodeOne(response, storageFileMapper);
|
|
117
|
+
},
|
|
118
|
+
async upload (data) {
|
|
119
|
+
const formData = new FormData();
|
|
120
|
+
formData.append('file', data.file, data.fileName);
|
|
121
|
+
formData.append('owner_unique_id', data.ownerUniqueId);
|
|
122
|
+
formData.append('owner_type', data.ownerType);
|
|
123
|
+
if (data.fileType) formData.append('file_type', data.fileType);
|
|
124
|
+
if (data.generateThumbnail !== undefined) formData.append('generate_thumbnail', String(data.generateThumbnail));
|
|
125
|
+
if (data.generatePreview !== undefined) formData.append('generate_preview', String(data.generatePreview));
|
|
126
|
+
if (data.payload) formData.append('payload', JSON.stringify(data.payload));
|
|
127
|
+
if (data.tags) formData.append('tags', JSON.stringify(data.tags));
|
|
128
|
+
const response = await transport.post('/storage_files/upload', formData, {
|
|
129
|
+
headers: {
|
|
130
|
+
'Content-Type': 'multipart/form-data'
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
return decodeOne(response, storageFileMapper);
|
|
134
|
+
},
|
|
135
|
+
async create (data) {
|
|
136
|
+
const response = await transport.post('/storage_files', {
|
|
137
|
+
data: {
|
|
138
|
+
type: 'StorageFile',
|
|
139
|
+
attributes: {
|
|
140
|
+
owner_unique_id: data.ownerUniqueId,
|
|
141
|
+
owner_type: data.ownerType,
|
|
142
|
+
file_name: data.fileName,
|
|
143
|
+
file_type: data.fileType,
|
|
144
|
+
file_size: data.fileSize,
|
|
145
|
+
mime_type: data.mimeType,
|
|
146
|
+
content_url: data.contentUrl,
|
|
147
|
+
storage_path: data.storagePath,
|
|
148
|
+
storage_provider: data.storageProvider,
|
|
149
|
+
payload: data.payload,
|
|
150
|
+
tags: data.tags
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
return decodeOne(response, storageFileMapper);
|
|
155
|
+
},
|
|
156
|
+
async update (uniqueId, data) {
|
|
157
|
+
const response = await transport.put(`/storage_files/${uniqueId}`, {
|
|
158
|
+
data: {
|
|
159
|
+
type: 'StorageFile',
|
|
160
|
+
attributes: {
|
|
161
|
+
file_name: data.fileName,
|
|
162
|
+
file_type: data.fileType,
|
|
163
|
+
content_url: data.contentUrl,
|
|
164
|
+
thumbnail_url: data.thumbnailUrl,
|
|
165
|
+
preview_url: data.previewUrl,
|
|
166
|
+
enabled: data.enabled,
|
|
167
|
+
status: data.status,
|
|
168
|
+
payload: data.payload,
|
|
169
|
+
tags: data.tags
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
return decodeOne(response, storageFileMapper);
|
|
174
|
+
},
|
|
175
|
+
async delete (uniqueId) {
|
|
176
|
+
await transport.delete(`/storage_files/${uniqueId}`);
|
|
177
|
+
},
|
|
178
|
+
async download (uniqueId) {
|
|
179
|
+
const response = await transport.get(`/storage_files/${uniqueId}/download`, {
|
|
180
|
+
responseType: 'blob'
|
|
181
|
+
});
|
|
182
|
+
return response;
|
|
183
|
+
},
|
|
184
|
+
async listByOwner (ownerUniqueId, ownerType, params) {
|
|
185
|
+
const queryParams = {
|
|
186
|
+
owner_unique_id: ownerUniqueId,
|
|
187
|
+
owner_type: ownerType
|
|
188
|
+
};
|
|
189
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
190
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
191
|
+
if (params == null ? void 0 : params.fileType) queryParams['file_type'] = params.fileType;
|
|
192
|
+
if (params == null ? void 0 : params.mimeType) queryParams['mime_type'] = params.mimeType;
|
|
193
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
194
|
+
if (params == null ? void 0 : params.search) queryParams['search'] = params.search;
|
|
195
|
+
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
196
|
+
const response = await transport.get('/storage_files', {
|
|
197
|
+
params: queryParams
|
|
198
|
+
});
|
|
199
|
+
return decodePageResult(response, storageFileMapper);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const entityFileMapper = {
|
|
205
|
+
type: 'EntityFile',
|
|
206
|
+
map: (resource)=>({
|
|
207
|
+
id: resource.id,
|
|
208
|
+
uniqueId: parseString(resource.attributes['unique_id']) || resource.id,
|
|
209
|
+
createdAt: parseDate(resource.attributes['created_at']) || new Date(),
|
|
210
|
+
updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
|
|
211
|
+
entityUniqueId: parseString(resource.attributes['entity_unique_id']) || '',
|
|
212
|
+
entityType: parseString(resource.attributes['entity_type']) || '',
|
|
213
|
+
fileUniqueId: parseString(resource.attributes['file_unique_id']) || '',
|
|
214
|
+
fileName: parseString(resource.attributes['file_name']) || '',
|
|
215
|
+
fileType: parseString(resource.attributes['file_type']),
|
|
216
|
+
fileSize: parseOptionalNumber(resource.attributes['file_size']),
|
|
217
|
+
mimeType: parseString(resource.attributes['mime_type']),
|
|
218
|
+
contentUrl: parseString(resource.attributes['content_url']),
|
|
219
|
+
thumbnailUrl: parseString(resource.attributes['thumbnail_url']),
|
|
220
|
+
displayOrder: parseOptionalNumber(resource.attributes['display_order']),
|
|
221
|
+
status: parseStatus(resource.attributes['status']),
|
|
222
|
+
enabled: parseBoolean(resource.attributes['enabled']),
|
|
223
|
+
payload: resource.attributes['payload']
|
|
224
|
+
})
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
function createEntityFilesService(transport, _config) {
|
|
228
|
+
return {
|
|
229
|
+
async list (params) {
|
|
230
|
+
const queryParams = {};
|
|
231
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
232
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
233
|
+
if (params == null ? void 0 : params.entityUniqueId) queryParams['entity_unique_id'] = params.entityUniqueId;
|
|
234
|
+
if (params == null ? void 0 : params.entityType) queryParams['entity_type'] = params.entityType;
|
|
235
|
+
if (params == null ? void 0 : params.fileType) queryParams['file_type'] = params.fileType;
|
|
236
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
237
|
+
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
238
|
+
const response = await transport.get('/entity_files', {
|
|
239
|
+
params: queryParams
|
|
240
|
+
});
|
|
241
|
+
return decodePageResult(response, entityFileMapper);
|
|
242
|
+
},
|
|
243
|
+
async get (uniqueId) {
|
|
244
|
+
const response = await transport.get(`/entity_files/${uniqueId}`);
|
|
245
|
+
return decodeOne(response, entityFileMapper);
|
|
246
|
+
},
|
|
247
|
+
async attach (data) {
|
|
248
|
+
const response = await transport.post('/entity_files', {
|
|
249
|
+
data: {
|
|
250
|
+
type: 'EntityFile',
|
|
251
|
+
attributes: {
|
|
252
|
+
entity_unique_id: data.entityUniqueId,
|
|
253
|
+
entity_type: data.entityType,
|
|
254
|
+
file_unique_id: data.fileUniqueId,
|
|
255
|
+
display_order: data.displayOrder,
|
|
256
|
+
payload: data.payload
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
return decodeOne(response, entityFileMapper);
|
|
261
|
+
},
|
|
262
|
+
async detach (uniqueId) {
|
|
263
|
+
await transport.delete(`/entity_files/${uniqueId}`);
|
|
264
|
+
},
|
|
265
|
+
async update (uniqueId, data) {
|
|
266
|
+
const response = await transport.put(`/entity_files/${uniqueId}`, {
|
|
267
|
+
data: {
|
|
268
|
+
type: 'EntityFile',
|
|
269
|
+
attributes: {
|
|
270
|
+
display_order: data.displayOrder,
|
|
271
|
+
enabled: data.enabled,
|
|
272
|
+
status: data.status,
|
|
273
|
+
payload: data.payload
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
return decodeOne(response, entityFileMapper);
|
|
278
|
+
},
|
|
279
|
+
async reorder (entityUniqueId, entityType, data) {
|
|
280
|
+
const response = await transport.put('/entity_files/reorder', {
|
|
281
|
+
data: {
|
|
282
|
+
type: 'EntityFile',
|
|
283
|
+
attributes: {
|
|
284
|
+
entity_unique_id: entityUniqueId,
|
|
285
|
+
entity_type: entityType,
|
|
286
|
+
file_orders: data.fileOrders
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
return decodeMany(response, entityFileMapper);
|
|
291
|
+
},
|
|
292
|
+
async listByEntity (entityUniqueId, entityType, params) {
|
|
293
|
+
const queryParams = {
|
|
294
|
+
entity_unique_id: entityUniqueId,
|
|
295
|
+
entity_type: entityType
|
|
296
|
+
};
|
|
297
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
298
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
299
|
+
if (params == null ? void 0 : params.fileType) queryParams['file_type'] = params.fileType;
|
|
300
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
301
|
+
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
302
|
+
const response = await transport.get('/entity_files', {
|
|
303
|
+
params: queryParams
|
|
304
|
+
});
|
|
305
|
+
return decodePageResult(response, entityFileMapper);
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
const fileSchemaMapper = {
|
|
311
|
+
type: 'FileSchema',
|
|
312
|
+
map: (resource)=>({
|
|
313
|
+
id: resource.id,
|
|
314
|
+
uniqueId: parseString(resource.attributes['unique_id']) || resource.id,
|
|
315
|
+
createdAt: parseDate(resource.attributes['created_at']) || new Date(),
|
|
316
|
+
updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
|
|
317
|
+
code: parseString(resource.attributes['code']) || '',
|
|
318
|
+
name: parseString(resource.attributes['name']) || '',
|
|
319
|
+
description: parseString(resource.attributes['description']),
|
|
320
|
+
allowedMimeTypes: parseStringArray(resource.attributes['allowed_mime_types']),
|
|
321
|
+
maxFileSize: parseOptionalNumber(resource.attributes['max_file_size']),
|
|
322
|
+
required: parseBoolean(resource.attributes['required']),
|
|
323
|
+
multiple: parseBoolean(resource.attributes['multiple']),
|
|
324
|
+
status: parseStatus(resource.attributes['status']),
|
|
325
|
+
enabled: parseBoolean(resource.attributes['enabled']),
|
|
326
|
+
payload: resource.attributes['payload']
|
|
327
|
+
})
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
function createFileSchemasService(transport, _config) {
|
|
331
|
+
return {
|
|
332
|
+
async list (params) {
|
|
333
|
+
const queryParams = {};
|
|
334
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
335
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
336
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
337
|
+
if (params == null ? void 0 : params.search) queryParams['search'] = params.search;
|
|
338
|
+
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
339
|
+
const response = await transport.get('/file_schemas', {
|
|
340
|
+
params: queryParams
|
|
341
|
+
});
|
|
342
|
+
return decodePageResult(response, fileSchemaMapper);
|
|
343
|
+
},
|
|
344
|
+
async get (uniqueId) {
|
|
345
|
+
const response = await transport.get(`/file_schemas/${uniqueId}`);
|
|
346
|
+
return decodeOne(response, fileSchemaMapper);
|
|
347
|
+
},
|
|
348
|
+
async getByCode (code) {
|
|
349
|
+
const response = await transport.get(`/file_schemas/code/${code}`);
|
|
350
|
+
return decodeOne(response, fileSchemaMapper);
|
|
351
|
+
},
|
|
352
|
+
async create (data) {
|
|
353
|
+
const response = await transport.post('/file_schemas', {
|
|
354
|
+
data: {
|
|
355
|
+
type: 'FileSchema',
|
|
356
|
+
attributes: {
|
|
357
|
+
code: data.code,
|
|
358
|
+
name: data.name,
|
|
359
|
+
description: data.description,
|
|
360
|
+
allowed_mime_types: data.allowedMimeTypes,
|
|
361
|
+
max_file_size: data.maxFileSize,
|
|
362
|
+
required: data.required,
|
|
363
|
+
multiple: data.multiple,
|
|
364
|
+
payload: data.payload
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
return decodeOne(response, fileSchemaMapper);
|
|
369
|
+
},
|
|
370
|
+
async update (uniqueId, data) {
|
|
371
|
+
const response = await transport.put(`/file_schemas/${uniqueId}`, {
|
|
372
|
+
data: {
|
|
373
|
+
type: 'FileSchema',
|
|
374
|
+
attributes: {
|
|
375
|
+
name: data.name,
|
|
376
|
+
description: data.description,
|
|
377
|
+
allowed_mime_types: data.allowedMimeTypes,
|
|
378
|
+
max_file_size: data.maxFileSize,
|
|
379
|
+
required: data.required,
|
|
380
|
+
multiple: data.multiple,
|
|
381
|
+
enabled: data.enabled,
|
|
382
|
+
status: data.status,
|
|
383
|
+
payload: data.payload
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
return decodeOne(response, fileSchemaMapper);
|
|
388
|
+
},
|
|
389
|
+
async delete (uniqueId) {
|
|
390
|
+
await transport.delete(`/file_schemas/${uniqueId}`);
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
function createFilesBlock(transport, config) {
|
|
396
|
+
return {
|
|
397
|
+
storageFiles: createStorageFilesService(transport),
|
|
398
|
+
entityFiles: createEntityFilesService(transport),
|
|
399
|
+
fileSchemas: createFileSchemasService(transport)
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
const filesBlockMetadata = {
|
|
403
|
+
name: 'files',
|
|
404
|
+
version: '0.1.0',
|
|
405
|
+
description: 'File storage, upload, download, and file management',
|
|
406
|
+
resourceTypes: [
|
|
407
|
+
'StorageFile',
|
|
408
|
+
'EntityFile',
|
|
409
|
+
'FileSchema'
|
|
410
|
+
]
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
export { createEntityFilesService, createFileSchemasService, createFilesBlock, createStorageFilesService, entityFileMapper, fileSchemaMapper, filesBlockMetadata, storageFileMapper };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createFilesBlock, filesBlockMetadata } from './lib/files.block';
|
|
2
|
+
export type { FilesBlock, FilesBlockConfig } from './lib/files.block';
|
|
3
|
+
export type { StorageFile, CreateStorageFileRequest, UpdateStorageFileRequest, ListStorageFilesParams, UploadFileRequest, EntityFile, AttachFileRequest, UpdateEntityFileRequest, ListEntityFilesParams, ReorderFilesRequest, FileSchema, CreateFileSchemaRequest, UpdateFileSchemaRequest, ListFileSchemasParams, } from './lib/types';
|
|
4
|
+
export type { StorageFilesService, EntityFilesService, FileSchemasService, } from './lib/services';
|
|
5
|
+
export { createStorageFilesService, createEntityFilesService, createFileSchemasService, } from './lib/services';
|
|
6
|
+
export { storageFileMapper, entityFileMapper, fileSchemaMapper, } from './lib/mappers';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACzE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGtE,YAAY,EAEV,WAAW,EACX,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,iBAAiB,EAEjB,UAAU,EACV,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EAEnB,UAAU,EACV,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AAGrB,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Transport, BlockConfig, BlockMetadata } from '@23blocks/contracts';
|
|
2
|
+
import { type StorageFilesService, type EntityFilesService, type FileSchemasService } from './services';
|
|
3
|
+
export interface FilesBlockConfig extends BlockConfig {
|
|
4
|
+
appId: string;
|
|
5
|
+
tenantId?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface FilesBlock {
|
|
8
|
+
storageFiles: StorageFilesService;
|
|
9
|
+
entityFiles: EntityFilesService;
|
|
10
|
+
fileSchemas: FileSchemasService;
|
|
11
|
+
}
|
|
12
|
+
export declare function createFilesBlock(transport: Transport, config: FilesBlockConfig): FilesBlock;
|
|
13
|
+
export declare const filesBlockMetadata: BlockMetadata;
|
|
14
|
+
//# sourceMappingURL=files.block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.block.d.ts","sourceRoot":"","sources":["../../../src/lib/files.block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAIL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,mBAAmB,CAAC;IAClC,WAAW,EAAE,kBAAkB,CAAC;IAChC,WAAW,EAAE,kBAAkB,CAAC;CACjC;AAED,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,gBAAgB,GACvB,UAAU,CAMZ;AAED,eAAO,MAAM,kBAAkB,EAAE,aAShC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-file.mapper.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/entity-file.mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGvD,eAAO,MAAM,gBAAgB,EAAE,cAAc,CAAC,UAAU,CAsBvD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-schema.mapper.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/file-schema.mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGvD,eAAO,MAAM,gBAAgB,EAAE,cAAc,CAAC,UAAU,CAmBvD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-file.mapper.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/storage-file.mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGzD,eAAO,MAAM,iBAAiB,EAAE,cAAc,CAAC,WAAW,CA2BzD,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse a string value, returning undefined for empty/undefined
|
|
3
|
+
*/
|
|
4
|
+
export declare function parseString(value: unknown): string | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* Parse a date value
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseDate(value: unknown): Date | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Parse a boolean value
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseBoolean(value: unknown): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Parse an array of strings
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseStringArray(value: unknown): string[] | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Parse a number value
|
|
19
|
+
*/
|
|
20
|
+
export declare function parseNumber(value: unknown): number;
|
|
21
|
+
/**
|
|
22
|
+
* Parse an optional number value
|
|
23
|
+
*/
|
|
24
|
+
export declare function parseOptionalNumber(value: unknown): number | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Parse entity status
|
|
27
|
+
*/
|
|
28
|
+
export declare function parseStatus(value: unknown): 'active' | 'inactive' | 'pending' | 'archived' | 'deleted';
|
|
29
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAM9D;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAe1D;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAQpD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS,CAQrE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAMlD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAMtE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAMtG"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Transport, PageResult } from '@23blocks/contracts';
|
|
2
|
+
import type { EntityFile, AttachFileRequest, UpdateEntityFileRequest, ListEntityFilesParams, ReorderFilesRequest } from '../types/entity-file';
|
|
3
|
+
export interface EntityFilesService {
|
|
4
|
+
list(params?: ListEntityFilesParams): Promise<PageResult<EntityFile>>;
|
|
5
|
+
get(uniqueId: string): Promise<EntityFile>;
|
|
6
|
+
attach(data: AttachFileRequest): Promise<EntityFile>;
|
|
7
|
+
detach(uniqueId: string): Promise<void>;
|
|
8
|
+
update(uniqueId: string, data: UpdateEntityFileRequest): Promise<EntityFile>;
|
|
9
|
+
reorder(entityUniqueId: string, entityType: string, data: ReorderFilesRequest): Promise<EntityFile[]>;
|
|
10
|
+
listByEntity(entityUniqueId: string, entityType: string, params?: ListEntityFilesParams): Promise<PageResult<EntityFile>>;
|
|
11
|
+
}
|
|
12
|
+
export declare function createEntityFilesService(transport: Transport, _config: {
|
|
13
|
+
appId: string;
|
|
14
|
+
}): EntityFilesService;
|
|
15
|
+
//# sourceMappingURL=entity-files.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-files.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/entity-files.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAG9B,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,MAAM,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;IACtE,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC3C,MAAM,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACrD,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC7E,OAAO,CAAC,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IACtG,YAAY,CAAC,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;CAC3H;AAED,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,kBAAkB,CAqF7G"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Transport, PageResult } from '@23blocks/contracts';
|
|
2
|
+
import type { FileSchema, CreateFileSchemaRequest, UpdateFileSchemaRequest, ListFileSchemasParams } from '../types/file-schema';
|
|
3
|
+
export interface FileSchemasService {
|
|
4
|
+
list(params?: ListFileSchemasParams): Promise<PageResult<FileSchema>>;
|
|
5
|
+
get(uniqueId: string): Promise<FileSchema>;
|
|
6
|
+
getByCode(code: string): Promise<FileSchema>;
|
|
7
|
+
create(data: CreateFileSchemaRequest): Promise<FileSchema>;
|
|
8
|
+
update(uniqueId: string, data: UpdateFileSchemaRequest): Promise<FileSchema>;
|
|
9
|
+
delete(uniqueId: string): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare function createFileSchemasService(transport: Transport, _config: {
|
|
12
|
+
appId: string;
|
|
13
|
+
}): FileSchemasService;
|
|
14
|
+
//# sourceMappingURL=file-schemas.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-schemas.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/file-schemas.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,KAAK,EACV,UAAU,EACV,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,sBAAsB,CAAC;AAG9B,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,MAAM,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;IACtE,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC3C,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC7C,MAAM,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC3D,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC7E,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzC;AAED,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,kBAAkB,CAmE7G"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Transport, PageResult } from '@23blocks/contracts';
|
|
2
|
+
import type { StorageFile, CreateStorageFileRequest, UpdateStorageFileRequest, ListStorageFilesParams, UploadFileRequest } from '../types/storage-file';
|
|
3
|
+
export interface StorageFilesService {
|
|
4
|
+
list(params?: ListStorageFilesParams): Promise<PageResult<StorageFile>>;
|
|
5
|
+
get(uniqueId: string): Promise<StorageFile>;
|
|
6
|
+
upload(data: UploadFileRequest): Promise<StorageFile>;
|
|
7
|
+
create(data: CreateStorageFileRequest): Promise<StorageFile>;
|
|
8
|
+
update(uniqueId: string, data: UpdateStorageFileRequest): Promise<StorageFile>;
|
|
9
|
+
delete(uniqueId: string): Promise<void>;
|
|
10
|
+
download(uniqueId: string): Promise<Blob>;
|
|
11
|
+
listByOwner(ownerUniqueId: string, ownerType: string, params?: ListStorageFilesParams): Promise<PageResult<StorageFile>>;
|
|
12
|
+
}
|
|
13
|
+
export declare function createStorageFilesService(transport: Transport, _config: {
|
|
14
|
+
appId: string;
|
|
15
|
+
}): StorageFilesService;
|
|
16
|
+
//# sourceMappingURL=storage-files.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-files.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/storage-files.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,KAAK,EACV,WAAW,EACX,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAG/B,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,MAAM,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;IACxE,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC5C,MAAM,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACtD,MAAM,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC7D,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC/E,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,WAAW,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;CAC1H;AAED,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,mBAAmB,CAiH/G"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { IdentityCore, EntityStatus } from '@23blocks/contracts';
|
|
2
|
+
export interface EntityFile extends IdentityCore {
|
|
3
|
+
entityUniqueId: string;
|
|
4
|
+
entityType: string;
|
|
5
|
+
fileUniqueId: string;
|
|
6
|
+
fileName: string;
|
|
7
|
+
fileType?: string;
|
|
8
|
+
fileSize?: number;
|
|
9
|
+
mimeType?: string;
|
|
10
|
+
contentUrl?: string;
|
|
11
|
+
thumbnailUrl?: string;
|
|
12
|
+
displayOrder?: number;
|
|
13
|
+
status: EntityStatus;
|
|
14
|
+
enabled: boolean;
|
|
15
|
+
payload?: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
export interface AttachFileRequest {
|
|
18
|
+
entityUniqueId: string;
|
|
19
|
+
entityType: string;
|
|
20
|
+
fileUniqueId: string;
|
|
21
|
+
displayOrder?: number;
|
|
22
|
+
payload?: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
export interface UpdateEntityFileRequest {
|
|
25
|
+
displayOrder?: number;
|
|
26
|
+
enabled?: boolean;
|
|
27
|
+
status?: EntityStatus;
|
|
28
|
+
payload?: Record<string, unknown>;
|
|
29
|
+
}
|
|
30
|
+
export interface ListEntityFilesParams {
|
|
31
|
+
page?: number;
|
|
32
|
+
perPage?: number;
|
|
33
|
+
entityUniqueId?: string;
|
|
34
|
+
entityType?: string;
|
|
35
|
+
fileType?: string;
|
|
36
|
+
status?: EntityStatus;
|
|
37
|
+
sortBy?: string;
|
|
38
|
+
sortOrder?: 'asc' | 'desc';
|
|
39
|
+
}
|
|
40
|
+
export interface ReorderFilesRequest {
|
|
41
|
+
fileOrders: Array<{
|
|
42
|
+
uniqueId: string;
|
|
43
|
+
displayOrder: number;
|
|
44
|
+
}>;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=entity-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-file.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/entity-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEtE,MAAM,WAAW,UAAW,SAAQ,YAAY;IAC9C,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,iBAAiB;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,uBAAuB;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,KAAK,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC,CAAC;CACJ"}
|