@23blocks/block-files 1.0.3 → 2.0.0
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 +392 -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,392 @@
|
|
|
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
|
+
file: {
|
|
138
|
+
owner_unique_id: data.ownerUniqueId,
|
|
139
|
+
owner_type: data.ownerType,
|
|
140
|
+
file_name: data.fileName,
|
|
141
|
+
file_type: data.fileType,
|
|
142
|
+
file_size: data.fileSize,
|
|
143
|
+
mime_type: data.mimeType,
|
|
144
|
+
content_url: data.contentUrl,
|
|
145
|
+
storage_path: data.storagePath,
|
|
146
|
+
storage_provider: data.storageProvider,
|
|
147
|
+
payload: data.payload,
|
|
148
|
+
tags: data.tags
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
return decodeOne(response, storageFileMapper);
|
|
152
|
+
},
|
|
153
|
+
async update (uniqueId, data) {
|
|
154
|
+
const response = await transport.put(`/storage_files/${uniqueId}`, {
|
|
155
|
+
file: {
|
|
156
|
+
file_name: data.fileName,
|
|
157
|
+
file_type: data.fileType,
|
|
158
|
+
content_url: data.contentUrl,
|
|
159
|
+
thumbnail_url: data.thumbnailUrl,
|
|
160
|
+
preview_url: data.previewUrl,
|
|
161
|
+
enabled: data.enabled,
|
|
162
|
+
status: data.status,
|
|
163
|
+
payload: data.payload,
|
|
164
|
+
tags: data.tags
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
return decodeOne(response, storageFileMapper);
|
|
168
|
+
},
|
|
169
|
+
async delete (uniqueId) {
|
|
170
|
+
await transport.delete(`/storage_files/${uniqueId}`);
|
|
171
|
+
},
|
|
172
|
+
async download (uniqueId) {
|
|
173
|
+
const response = await transport.get(`/storage_files/${uniqueId}/download`, {
|
|
174
|
+
responseType: 'blob'
|
|
175
|
+
});
|
|
176
|
+
return response;
|
|
177
|
+
},
|
|
178
|
+
async listByOwner (ownerUniqueId, ownerType, params) {
|
|
179
|
+
const queryParams = {
|
|
180
|
+
owner_unique_id: ownerUniqueId,
|
|
181
|
+
owner_type: ownerType
|
|
182
|
+
};
|
|
183
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
184
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
185
|
+
if (params == null ? void 0 : params.fileType) queryParams['file_type'] = params.fileType;
|
|
186
|
+
if (params == null ? void 0 : params.mimeType) queryParams['mime_type'] = params.mimeType;
|
|
187
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
188
|
+
if (params == null ? void 0 : params.search) queryParams['search'] = params.search;
|
|
189
|
+
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
190
|
+
const response = await transport.get('/storage_files', {
|
|
191
|
+
params: queryParams
|
|
192
|
+
});
|
|
193
|
+
return decodePageResult(response, storageFileMapper);
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const entityFileMapper = {
|
|
199
|
+
type: 'EntityFile',
|
|
200
|
+
map: (resource)=>({
|
|
201
|
+
id: resource.id,
|
|
202
|
+
uniqueId: parseString(resource.attributes['unique_id']) || resource.id,
|
|
203
|
+
createdAt: parseDate(resource.attributes['created_at']) || new Date(),
|
|
204
|
+
updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
|
|
205
|
+
entityUniqueId: parseString(resource.attributes['entity_unique_id']) || '',
|
|
206
|
+
entityType: parseString(resource.attributes['entity_type']) || '',
|
|
207
|
+
fileUniqueId: parseString(resource.attributes['file_unique_id']) || '',
|
|
208
|
+
fileName: parseString(resource.attributes['file_name']) || '',
|
|
209
|
+
fileType: parseString(resource.attributes['file_type']),
|
|
210
|
+
fileSize: parseOptionalNumber(resource.attributes['file_size']),
|
|
211
|
+
mimeType: parseString(resource.attributes['mime_type']),
|
|
212
|
+
contentUrl: parseString(resource.attributes['content_url']),
|
|
213
|
+
thumbnailUrl: parseString(resource.attributes['thumbnail_url']),
|
|
214
|
+
displayOrder: parseOptionalNumber(resource.attributes['display_order']),
|
|
215
|
+
status: parseStatus(resource.attributes['status']),
|
|
216
|
+
enabled: parseBoolean(resource.attributes['enabled']),
|
|
217
|
+
payload: resource.attributes['payload']
|
|
218
|
+
})
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
function createEntityFilesService(transport, _config) {
|
|
222
|
+
return {
|
|
223
|
+
async list (params) {
|
|
224
|
+
const queryParams = {};
|
|
225
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
226
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
227
|
+
if (params == null ? void 0 : params.entityUniqueId) queryParams['entity_unique_id'] = params.entityUniqueId;
|
|
228
|
+
if (params == null ? void 0 : params.entityType) queryParams['entity_type'] = params.entityType;
|
|
229
|
+
if (params == null ? void 0 : params.fileType) queryParams['file_type'] = params.fileType;
|
|
230
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
231
|
+
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
232
|
+
const response = await transport.get('/entity_files', {
|
|
233
|
+
params: queryParams
|
|
234
|
+
});
|
|
235
|
+
return decodePageResult(response, entityFileMapper);
|
|
236
|
+
},
|
|
237
|
+
async get (uniqueId) {
|
|
238
|
+
const response = await transport.get(`/entity_files/${uniqueId}`);
|
|
239
|
+
return decodeOne(response, entityFileMapper);
|
|
240
|
+
},
|
|
241
|
+
async attach (data) {
|
|
242
|
+
const response = await transport.post('/entity_files', {
|
|
243
|
+
file: {
|
|
244
|
+
entity_unique_id: data.entityUniqueId,
|
|
245
|
+
entity_type: data.entityType,
|
|
246
|
+
file_unique_id: data.fileUniqueId,
|
|
247
|
+
display_order: data.displayOrder,
|
|
248
|
+
payload: data.payload
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
return decodeOne(response, entityFileMapper);
|
|
252
|
+
},
|
|
253
|
+
async detach (uniqueId) {
|
|
254
|
+
await transport.delete(`/entity_files/${uniqueId}`);
|
|
255
|
+
},
|
|
256
|
+
async update (uniqueId, data) {
|
|
257
|
+
const response = await transport.put(`/entity_files/${uniqueId}`, {
|
|
258
|
+
file: {
|
|
259
|
+
display_order: data.displayOrder,
|
|
260
|
+
enabled: data.enabled,
|
|
261
|
+
status: data.status,
|
|
262
|
+
payload: data.payload
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
return decodeOne(response, entityFileMapper);
|
|
266
|
+
},
|
|
267
|
+
async reorder (entityUniqueId, entityType, data) {
|
|
268
|
+
const response = await transport.put('/entity_files/reorder', {
|
|
269
|
+
file: {
|
|
270
|
+
entity_unique_id: entityUniqueId,
|
|
271
|
+
entity_type: entityType,
|
|
272
|
+
file_orders: data.fileOrders
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
return decodeMany(response, entityFileMapper);
|
|
276
|
+
},
|
|
277
|
+
async listByEntity (entityUniqueId, entityType, params) {
|
|
278
|
+
const queryParams = {
|
|
279
|
+
entity_unique_id: entityUniqueId,
|
|
280
|
+
entity_type: entityType
|
|
281
|
+
};
|
|
282
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
283
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
284
|
+
if (params == null ? void 0 : params.fileType) queryParams['file_type'] = params.fileType;
|
|
285
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
286
|
+
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
287
|
+
const response = await transport.get('/entity_files', {
|
|
288
|
+
params: queryParams
|
|
289
|
+
});
|
|
290
|
+
return decodePageResult(response, entityFileMapper);
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
const fileSchemaMapper = {
|
|
296
|
+
type: 'FileSchema',
|
|
297
|
+
map: (resource)=>({
|
|
298
|
+
id: resource.id,
|
|
299
|
+
uniqueId: parseString(resource.attributes['unique_id']) || resource.id,
|
|
300
|
+
createdAt: parseDate(resource.attributes['created_at']) || new Date(),
|
|
301
|
+
updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
|
|
302
|
+
code: parseString(resource.attributes['code']) || '',
|
|
303
|
+
name: parseString(resource.attributes['name']) || '',
|
|
304
|
+
description: parseString(resource.attributes['description']),
|
|
305
|
+
allowedMimeTypes: parseStringArray(resource.attributes['allowed_mime_types']),
|
|
306
|
+
maxFileSize: parseOptionalNumber(resource.attributes['max_file_size']),
|
|
307
|
+
required: parseBoolean(resource.attributes['required']),
|
|
308
|
+
multiple: parseBoolean(resource.attributes['multiple']),
|
|
309
|
+
status: parseStatus(resource.attributes['status']),
|
|
310
|
+
enabled: parseBoolean(resource.attributes['enabled']),
|
|
311
|
+
payload: resource.attributes['payload']
|
|
312
|
+
})
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
function createFileSchemasService(transport, _config) {
|
|
316
|
+
return {
|
|
317
|
+
async list (params) {
|
|
318
|
+
const queryParams = {};
|
|
319
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
320
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
321
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
322
|
+
if (params == null ? void 0 : params.search) queryParams['search'] = params.search;
|
|
323
|
+
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
324
|
+
const response = await transport.get('/file_schemas', {
|
|
325
|
+
params: queryParams
|
|
326
|
+
});
|
|
327
|
+
return decodePageResult(response, fileSchemaMapper);
|
|
328
|
+
},
|
|
329
|
+
async get (uniqueId) {
|
|
330
|
+
const response = await transport.get(`/file_schemas/${uniqueId}`);
|
|
331
|
+
return decodeOne(response, fileSchemaMapper);
|
|
332
|
+
},
|
|
333
|
+
async getByCode (code) {
|
|
334
|
+
const response = await transport.get(`/file_schemas/code/${code}`);
|
|
335
|
+
return decodeOne(response, fileSchemaMapper);
|
|
336
|
+
},
|
|
337
|
+
async create (data) {
|
|
338
|
+
const response = await transport.post('/file_schemas', {
|
|
339
|
+
file_schema: {
|
|
340
|
+
code: data.code,
|
|
341
|
+
name: data.name,
|
|
342
|
+
description: data.description,
|
|
343
|
+
allowed_mime_types: data.allowedMimeTypes,
|
|
344
|
+
max_file_size: data.maxFileSize,
|
|
345
|
+
required: data.required,
|
|
346
|
+
multiple: data.multiple,
|
|
347
|
+
payload: data.payload
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
return decodeOne(response, fileSchemaMapper);
|
|
351
|
+
},
|
|
352
|
+
async update (uniqueId, data) {
|
|
353
|
+
const response = await transport.put(`/file_schemas/${uniqueId}`, {
|
|
354
|
+
file_schema: {
|
|
355
|
+
name: data.name,
|
|
356
|
+
description: data.description,
|
|
357
|
+
allowed_mime_types: data.allowedMimeTypes,
|
|
358
|
+
max_file_size: data.maxFileSize,
|
|
359
|
+
required: data.required,
|
|
360
|
+
multiple: data.multiple,
|
|
361
|
+
enabled: data.enabled,
|
|
362
|
+
status: data.status,
|
|
363
|
+
payload: data.payload
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
return decodeOne(response, fileSchemaMapper);
|
|
367
|
+
},
|
|
368
|
+
async delete (uniqueId) {
|
|
369
|
+
await transport.delete(`/file_schemas/${uniqueId}`);
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
function createFilesBlock(transport, config) {
|
|
375
|
+
return {
|
|
376
|
+
storageFiles: createStorageFilesService(transport),
|
|
377
|
+
entityFiles: createEntityFilesService(transport),
|
|
378
|
+
fileSchemas: createFileSchemasService(transport)
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
const filesBlockMetadata = {
|
|
382
|
+
name: 'files',
|
|
383
|
+
version: '0.1.0',
|
|
384
|
+
description: 'File storage, upload, download, and file management',
|
|
385
|
+
resourceTypes: [
|
|
386
|
+
'StorageFile',
|
|
387
|
+
'EntityFile',
|
|
388
|
+
'FileSchema'
|
|
389
|
+
]
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
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,CA4E7G"}
|
|
@@ -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,CA6D7G"}
|
|
@@ -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,CA2G/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"}
|