@23blocks/block-files 1.0.4 → 2.1.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.esm.js CHANGED
@@ -134,40 +134,34 @@ function createStorageFilesService(transport, _config) {
134
134
  },
135
135
  async create (data) {
136
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
- }
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
152
149
  }
153
150
  });
154
151
  return decodeOne(response, storageFileMapper);
155
152
  },
156
153
  async update (uniqueId, data) {
157
154
  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
- }
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
171
165
  }
172
166
  });
173
167
  return decodeOne(response, storageFileMapper);
@@ -246,15 +240,12 @@ function createEntityFilesService(transport, _config) {
246
240
  },
247
241
  async attach (data) {
248
242
  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
- }
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
258
249
  }
259
250
  });
260
251
  return decodeOne(response, entityFileMapper);
@@ -264,27 +255,21 @@ function createEntityFilesService(transport, _config) {
264
255
  },
265
256
  async update (uniqueId, data) {
266
257
  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
- }
258
+ file: {
259
+ display_order: data.displayOrder,
260
+ enabled: data.enabled,
261
+ status: data.status,
262
+ payload: data.payload
275
263
  }
276
264
  });
277
265
  return decodeOne(response, entityFileMapper);
278
266
  },
279
267
  async reorder (entityUniqueId, entityType, data) {
280
268
  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
- }
269
+ file: {
270
+ entity_unique_id: entityUniqueId,
271
+ entity_type: entityType,
272
+ file_orders: data.fileOrders
288
273
  }
289
274
  });
290
275
  return decodeMany(response, entityFileMapper);
@@ -351,37 +336,31 @@ function createFileSchemasService(transport, _config) {
351
336
  },
352
337
  async create (data) {
353
338
  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
- }
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
366
348
  }
367
349
  });
368
350
  return decodeOne(response, fileSchemaMapper);
369
351
  },
370
352
  async update (uniqueId, data) {
371
353
  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
- }
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
385
364
  }
386
365
  });
387
366
  return decodeOne(response, fileSchemaMapper);
@@ -392,11 +371,327 @@ function createFileSchemasService(transport, _config) {
392
371
  };
393
372
  }
394
373
 
374
+ const userFileMapper = {
375
+ type: 'file',
376
+ map: (data)=>{
377
+ var _data_id, _data_unique_id, _data_user_unique_id, _data_file_name, _data_file_type, _data_file_size, _data_status, _data_is_public;
378
+ return {
379
+ id: String((_data_id = data['id']) != null ? _data_id : ''),
380
+ uniqueId: String((_data_unique_id = data['unique_id']) != null ? _data_unique_id : ''),
381
+ userUniqueId: String((_data_user_unique_id = data['user_unique_id']) != null ? _data_user_unique_id : ''),
382
+ fileName: String((_data_file_name = data['file_name']) != null ? _data_file_name : ''),
383
+ fileType: String((_data_file_type = data['file_type']) != null ? _data_file_type : ''),
384
+ fileSize: Number((_data_file_size = data['file_size']) != null ? _data_file_size : 0),
385
+ mimeType: data['mime_type'],
386
+ url: data['url'],
387
+ thumbnailUrl: data['thumbnail_url'],
388
+ schemaUniqueId: data['schema_unique_id'],
389
+ status: (_data_status = data['status']) != null ? _data_status : 'active',
390
+ isPublic: Boolean((_data_is_public = data['is_public']) != null ? _data_is_public : false),
391
+ payload: data['payload'],
392
+ createdAt: data['created_at'] ? new Date(data['created_at']) : new Date(),
393
+ updatedAt: data['updated_at'] ? new Date(data['updated_at']) : new Date()
394
+ };
395
+ }
396
+ };
397
+
398
+ function createUserFilesService(transport, _config) {
399
+ return {
400
+ async list (userUniqueId, params) {
401
+ const queryParams = {};
402
+ if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
403
+ if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
404
+ if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
405
+ if (params == null ? void 0 : params.fileType) queryParams['file_type'] = params.fileType;
406
+ if (params == null ? void 0 : params.schemaUniqueId) queryParams['schema_unique_id'] = params.schemaUniqueId;
407
+ const response = await transport.get(`/users/${userUniqueId}/files`, {
408
+ params: queryParams
409
+ });
410
+ return decodePageResult(response, userFileMapper);
411
+ },
412
+ async get (userUniqueId, fileUniqueId) {
413
+ const response = await transport.get(`/users/${userUniqueId}/files/${fileUniqueId}`);
414
+ return decodeOne(response, userFileMapper);
415
+ },
416
+ async add (userUniqueId, data) {
417
+ const response = await transport.post(`/users/${userUniqueId}/files`, {
418
+ file: {
419
+ file_name: data.fileName,
420
+ file_type: data.fileType,
421
+ file_size: data.fileSize,
422
+ mime_type: data.mimeType,
423
+ url: data.url,
424
+ thumbnail_url: data.thumbnailUrl,
425
+ schema_unique_id: data.schemaUniqueId,
426
+ payload: data.payload
427
+ }
428
+ });
429
+ return decodeOne(response, userFileMapper);
430
+ },
431
+ async update (userUniqueId, fileUniqueId, data) {
432
+ const response = await transport.put(`/users/${userUniqueId}/files/${fileUniqueId}`, {
433
+ file: {
434
+ file_name: data.fileName,
435
+ file_type: data.fileType,
436
+ thumbnail_url: data.thumbnailUrl,
437
+ schema_unique_id: data.schemaUniqueId,
438
+ payload: data.payload
439
+ }
440
+ });
441
+ return decodeOne(response, userFileMapper);
442
+ },
443
+ async delete (userUniqueId, fileUniqueId) {
444
+ await transport.delete(`/users/${userUniqueId}/files/${fileUniqueId}`);
445
+ },
446
+ async presignUpload (userUniqueId, data) {
447
+ const response = await transport.put(`/users/${userUniqueId}/presign_upload`, {
448
+ file: {
449
+ file_name: data.fileName,
450
+ file_type: data.fileType,
451
+ mime_type: data.mimeType,
452
+ schema_unique_id: data.schemaUniqueId
453
+ }
454
+ });
455
+ return {
456
+ presignedUrl: response.presigned_url,
457
+ fileKey: response.file_key,
458
+ fields: response.fields,
459
+ expiresAt: new Date(response.expires_at)
460
+ };
461
+ },
462
+ async multipartPresign (userUniqueId, data) {
463
+ const response = await transport.post(`/users/${userUniqueId}/multipart_presign_upload`, {
464
+ file: {
465
+ file_name: data.fileName,
466
+ file_type: data.fileType,
467
+ file_size: data.fileSize,
468
+ mime_type: data.mimeType,
469
+ part_size: data.partSize
470
+ }
471
+ });
472
+ return {
473
+ uploadId: response.upload_id,
474
+ fileKey: response.file_key,
475
+ parts: response.parts.map((p)=>({
476
+ partNumber: p.part_number,
477
+ presignedUrl: p.presigned_url
478
+ }))
479
+ };
480
+ },
481
+ async multipartComplete (userUniqueId, data) {
482
+ const response = await transport.post(`/users/${userUniqueId}/multipart_complete_upload`, {
483
+ upload: {
484
+ upload_id: data.uploadId,
485
+ file_key: data.fileKey,
486
+ parts: data.parts.map((p)=>({
487
+ part_number: p.partNumber,
488
+ etag: p.etag
489
+ }))
490
+ }
491
+ });
492
+ return decodeOne(response, userFileMapper);
493
+ },
494
+ async approve (userUniqueId, fileUniqueId) {
495
+ const response = await transport.put(`/users/${userUniqueId}/files/${fileUniqueId}/approve`, {});
496
+ return decodeOne(response, userFileMapper);
497
+ },
498
+ async reject (userUniqueId, fileUniqueId) {
499
+ const response = await transport.put(`/users/${userUniqueId}/files/${fileUniqueId}/reject`, {});
500
+ return decodeOne(response, userFileMapper);
501
+ },
502
+ async publish (userUniqueId, fileUniqueId) {
503
+ const response = await transport.put(`/users/${userUniqueId}/files/${fileUniqueId}/publish`, {});
504
+ return decodeOne(response, userFileMapper);
505
+ },
506
+ async unpublish (userUniqueId, fileUniqueId) {
507
+ const response = await transport.put(`/users/${userUniqueId}/files/${fileUniqueId}/unpublish`, {});
508
+ return decodeOne(response, userFileMapper);
509
+ },
510
+ async addTag (userUniqueId, fileUniqueId, tagUniqueId) {
511
+ const response = await transport.post(`/users/${userUniqueId}/files/${fileUniqueId}/tags`, {
512
+ tag: {
513
+ unique_id: tagUniqueId
514
+ }
515
+ });
516
+ return decodeOne(response, userFileMapper);
517
+ },
518
+ async removeTag (userUniqueId, fileUniqueId, tagUniqueId) {
519
+ await transport.delete(`/users/${userUniqueId}/files/${fileUniqueId}/tags`, {
520
+ data: {
521
+ tag: {
522
+ unique_id: tagUniqueId
523
+ }
524
+ }
525
+ });
526
+ },
527
+ async bulkUpdateTags (userUniqueId, tagUniqueIds) {
528
+ await transport.post(`/users/${userUniqueId}/tags`, {
529
+ tags: {
530
+ unique_ids: tagUniqueIds
531
+ }
532
+ });
533
+ },
534
+ async requestAccess (userUniqueId, fileUniqueId) {
535
+ await transport.post(`/users/${userUniqueId}/files/${fileUniqueId}/requests/access`, {});
536
+ },
537
+ async getAccess (userUniqueId, fileUniqueId) {
538
+ const response = await transport.get(`/users/${userUniqueId}/files/${fileUniqueId}/access`);
539
+ return (response.data || []).map((item)=>{
540
+ var _item_unique_id, _item_file_unique_id, _item_grantee_unique_id, _item_access_type;
541
+ return {
542
+ uniqueId: String((_item_unique_id = item['unique_id']) != null ? _item_unique_id : ''),
543
+ fileUniqueId: String((_item_file_unique_id = item['file_unique_id']) != null ? _item_file_unique_id : ''),
544
+ granteeUniqueId: String((_item_grantee_unique_id = item['grantee_unique_id']) != null ? _item_grantee_unique_id : ''),
545
+ accessType: String((_item_access_type = item['access_type']) != null ? _item_access_type : ''),
546
+ grantedAt: new Date(item['granted_at']),
547
+ expiresAt: item['expires_at'] ? new Date(item['expires_at']) : undefined
548
+ };
549
+ });
550
+ },
551
+ async grantAccess (userUniqueId, fileUniqueId, data) {
552
+ const response = await transport.post(`/users/${userUniqueId}/files/${fileUniqueId}/access/grant`, {
553
+ access: {
554
+ grantee_unique_id: data.granteeUniqueId,
555
+ access_type: data.accessType,
556
+ expires_at: data.expiresAt
557
+ }
558
+ });
559
+ var _response_unique_id, _response_file_unique_id, _response_grantee_unique_id, _response_access_type;
560
+ return {
561
+ uniqueId: String((_response_unique_id = response['unique_id']) != null ? _response_unique_id : ''),
562
+ fileUniqueId: String((_response_file_unique_id = response['file_unique_id']) != null ? _response_file_unique_id : ''),
563
+ granteeUniqueId: String((_response_grantee_unique_id = response['grantee_unique_id']) != null ? _response_grantee_unique_id : ''),
564
+ accessType: String((_response_access_type = response['access_type']) != null ? _response_access_type : ''),
565
+ grantedAt: new Date(response['granted_at']),
566
+ expiresAt: response['expires_at'] ? new Date(response['expires_at']) : undefined
567
+ };
568
+ },
569
+ async revokeAccess (userUniqueId, fileUniqueId, accessUniqueId) {
570
+ await transport.delete(`/users/${userUniqueId}/files/${fileUniqueId}/access/${accessUniqueId}/revoke`);
571
+ },
572
+ async makePublic (userUniqueId, fileUniqueId) {
573
+ const response = await transport.post(`/users/${userUniqueId}/files/${fileUniqueId}/access/make_public`, {});
574
+ return decodeOne(response, userFileMapper);
575
+ },
576
+ async makePrivate (userUniqueId, fileUniqueId) {
577
+ const response = await transport.post(`/users/${userUniqueId}/files/${fileUniqueId}/access/make_private`, {});
578
+ return decodeOne(response, userFileMapper);
579
+ },
580
+ async bulkGrantAccess (userUniqueId, fileUniqueIds, granteeUniqueIds) {
581
+ await transport.post(`/users/${userUniqueId}/files/access/grant`, {
582
+ access: {
583
+ file_unique_ids: fileUniqueIds,
584
+ grantee_unique_ids: granteeUniqueIds
585
+ }
586
+ });
587
+ },
588
+ async bulkRevokeAccess (userUniqueId, fileUniqueIds, granteeUniqueIds) {
589
+ await transport.post(`/users/${userUniqueId}/files/access/revoke`, {
590
+ access: {
591
+ file_unique_ids: fileUniqueIds,
592
+ grantee_unique_ids: granteeUniqueIds
593
+ }
594
+ });
595
+ },
596
+ async listAccessRequests (userUniqueId, fileUniqueId) {
597
+ const response = await transport.get(`/users/${userUniqueId}/files/${fileUniqueId}/access/requests`);
598
+ return (response.data || []).map((item)=>{
599
+ var _item_unique_id, _item_file_unique_id, _item_grantee_unique_id, _item_access_type;
600
+ return {
601
+ uniqueId: String((_item_unique_id = item['unique_id']) != null ? _item_unique_id : ''),
602
+ fileUniqueId: String((_item_file_unique_id = item['file_unique_id']) != null ? _item_file_unique_id : ''),
603
+ granteeUniqueId: String((_item_grantee_unique_id = item['grantee_unique_id']) != null ? _item_grantee_unique_id : ''),
604
+ accessType: String((_item_access_type = item['access_type']) != null ? _item_access_type : ''),
605
+ grantedAt: new Date(item['granted_at']),
606
+ expiresAt: item['expires_at'] ? new Date(item['expires_at']) : undefined
607
+ };
608
+ });
609
+ },
610
+ async approveAccessRequest (userUniqueId, fileUniqueId, requestUniqueId) {
611
+ const response = await transport.put(`/users/${userUniqueId}/files/${fileUniqueId}/access/requests/${requestUniqueId}/approve`, {});
612
+ var _response_unique_id, _response_file_unique_id, _response_grantee_unique_id, _response_access_type;
613
+ return {
614
+ uniqueId: String((_response_unique_id = response['unique_id']) != null ? _response_unique_id : ''),
615
+ fileUniqueId: String((_response_file_unique_id = response['file_unique_id']) != null ? _response_file_unique_id : ''),
616
+ granteeUniqueId: String((_response_grantee_unique_id = response['grantee_unique_id']) != null ? _response_grantee_unique_id : ''),
617
+ accessType: String((_response_access_type = response['access_type']) != null ? _response_access_type : ''),
618
+ grantedAt: new Date(response['granted_at']),
619
+ expiresAt: response['expires_at'] ? new Date(response['expires_at']) : undefined
620
+ };
621
+ },
622
+ async denyAccessRequest (userUniqueId, fileUniqueId, requestUniqueId) {
623
+ await transport.delete(`/users/${userUniqueId}/files/${fileUniqueId}/access/requests/${requestUniqueId}/deny`);
624
+ },
625
+ async listGrantedDelegations (userUniqueId) {
626
+ const response = await transport.get(`/users/${userUniqueId}/delegations/granted`);
627
+ return (response.data || []).map((item)=>{
628
+ var _item_unique_id, _item_granter_unique_id, _item_grantee_unique_id, _item_access_level;
629
+ return {
630
+ uniqueId: String((_item_unique_id = item['unique_id']) != null ? _item_unique_id : ''),
631
+ granterUniqueId: String((_item_granter_unique_id = item['granter_unique_id']) != null ? _item_granter_unique_id : ''),
632
+ granteeUniqueId: String((_item_grantee_unique_id = item['grantee_unique_id']) != null ? _item_grantee_unique_id : ''),
633
+ accessLevel: String((_item_access_level = item['access_level']) != null ? _item_access_level : ''),
634
+ createdAt: new Date(item['created_at']),
635
+ expiresAt: item['expires_at'] ? new Date(item['expires_at']) : undefined
636
+ };
637
+ });
638
+ },
639
+ async listReceivedDelegations (userUniqueId) {
640
+ const response = await transport.get(`/users/${userUniqueId}/delegations/received`);
641
+ return (response.data || []).map((item)=>{
642
+ var _item_unique_id, _item_granter_unique_id, _item_grantee_unique_id, _item_access_level;
643
+ return {
644
+ uniqueId: String((_item_unique_id = item['unique_id']) != null ? _item_unique_id : ''),
645
+ granterUniqueId: String((_item_granter_unique_id = item['granter_unique_id']) != null ? _item_granter_unique_id : ''),
646
+ granteeUniqueId: String((_item_grantee_unique_id = item['grantee_unique_id']) != null ? _item_grantee_unique_id : ''),
647
+ accessLevel: String((_item_access_level = item['access_level']) != null ? _item_access_level : ''),
648
+ createdAt: new Date(item['created_at']),
649
+ expiresAt: item['expires_at'] ? new Date(item['expires_at']) : undefined
650
+ };
651
+ });
652
+ },
653
+ async getDelegation (userUniqueId, delegationUniqueId) {
654
+ const response = await transport.get(`/users/${userUniqueId}/delegations/${delegationUniqueId}`);
655
+ var _response_unique_id, _response_granter_unique_id, _response_grantee_unique_id, _response_access_level;
656
+ return {
657
+ uniqueId: String((_response_unique_id = response['unique_id']) != null ? _response_unique_id : ''),
658
+ granterUniqueId: String((_response_granter_unique_id = response['granter_unique_id']) != null ? _response_granter_unique_id : ''),
659
+ granteeUniqueId: String((_response_grantee_unique_id = response['grantee_unique_id']) != null ? _response_grantee_unique_id : ''),
660
+ accessLevel: String((_response_access_level = response['access_level']) != null ? _response_access_level : ''),
661
+ createdAt: new Date(response['created_at']),
662
+ expiresAt: response['expires_at'] ? new Date(response['expires_at']) : undefined
663
+ };
664
+ },
665
+ async createDelegation (userUniqueId, data) {
666
+ const response = await transport.post(`/users/${userUniqueId}/delegations`, {
667
+ delegation: {
668
+ grantee_unique_id: data.granteeUniqueId,
669
+ access_level: data.accessLevel,
670
+ expires_at: data.expiresAt
671
+ }
672
+ });
673
+ var _response_unique_id, _response_granter_unique_id, _response_grantee_unique_id, _response_access_level;
674
+ return {
675
+ uniqueId: String((_response_unique_id = response['unique_id']) != null ? _response_unique_id : ''),
676
+ granterUniqueId: String((_response_granter_unique_id = response['granter_unique_id']) != null ? _response_granter_unique_id : ''),
677
+ granteeUniqueId: String((_response_grantee_unique_id = response['grantee_unique_id']) != null ? _response_grantee_unique_id : ''),
678
+ accessLevel: String((_response_access_level = response['access_level']) != null ? _response_access_level : ''),
679
+ createdAt: new Date(response['created_at']),
680
+ expiresAt: response['expires_at'] ? new Date(response['expires_at']) : undefined
681
+ };
682
+ },
683
+ async revokeDelegation (userUniqueId, delegationUniqueId) {
684
+ await transport.delete(`/users/${userUniqueId}/delegations/${delegationUniqueId}`);
685
+ }
686
+ };
687
+ }
688
+
395
689
  function createFilesBlock(transport, config) {
396
690
  return {
397
691
  storageFiles: createStorageFilesService(transport),
398
692
  entityFiles: createEntityFilesService(transport),
399
- fileSchemas: createFileSchemasService(transport)
693
+ fileSchemas: createFileSchemasService(transport),
694
+ userFiles: createUserFilesService(transport)
400
695
  };
401
696
  }
402
697
  const filesBlockMetadata = {
@@ -406,7 +701,8 @@ const filesBlockMetadata = {
406
701
  resourceTypes: [
407
702
  'StorageFile',
408
703
  'EntityFile',
409
- 'FileSchema'
704
+ 'FileSchema',
705
+ 'UserFile'
410
706
  ]
411
707
  };
412
708
 
@@ -1,5 +1,5 @@
1
1
  import type { Transport, BlockConfig, BlockMetadata } from '@23blocks/contracts';
2
- import { type StorageFilesService, type EntityFilesService, type FileSchemasService } from './services';
2
+ import { type StorageFilesService, type EntityFilesService, type FileSchemasService, type UserFilesService } from './services';
3
3
  export interface FilesBlockConfig extends BlockConfig {
4
4
  appId: string;
5
5
  tenantId?: string;
@@ -8,6 +8,7 @@ export interface FilesBlock {
8
8
  storageFiles: StorageFilesService;
9
9
  entityFiles: EntityFilesService;
10
10
  fileSchemas: FileSchemasService;
11
+ userFiles: UserFilesService;
11
12
  }
12
13
  export declare function createFilesBlock(transport: Transport, config: FilesBlockConfig): FilesBlock;
13
14
  export declare const filesBlockMetadata: BlockMetadata;
@@ -1 +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"}
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,EAKL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACtB,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;IAChC,SAAS,EAAE,gBAAgB,CAAC;CAC7B;AAED,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,gBAAgB,GACvB,UAAU,CAOZ;AAED,eAAO,MAAM,kBAAkB,EAAE,aAUhC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export * from './storage-file.mapper';
2
2
  export * from './entity-file.mapper';
3
3
  export * from './file-schema.mapper';
4
+ export * from './user-file.mapper';
4
5
  export * from './utils';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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"}
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,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { JsonApiResourceMapper } from '@23blocks/jsonapi-codec';
2
+ import type { UserFile } from '../types/user-file';
3
+ export declare const userFileMapper: JsonApiResourceMapper<UserFile>;
4
+ //# sourceMappingURL=user-file.mapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-file.mapper.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/user-file.mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,eAAO,MAAM,cAAc,EAAE,qBAAqB,CAAC,QAAQ,CAmB1D,CAAC"}
@@ -1 +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,OAA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AAC,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"}
@@ -1 +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"}
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"}
@@ -1,4 +1,5 @@
1
1
  export * from './storage-files.service';
2
2
  export * from './entity-files.service';
3
3
  export * from './file-schemas.service';
4
+ export * from './user-files.service';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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"}
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;AACvC,cAAc,sBAAsB,CAAC"}
@@ -1 +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"}
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,39 @@
1
+ import type { Transport, PageResult } from '@23blocks/contracts';
2
+ import type { UserFile, ListUserFilesParams, AddUserFileRequest, UpdateUserFileRequest, PresignUploadRequest, PresignUploadResponse, MultipartPresignRequest, MultipartPresignResponse, MultipartCompleteRequest, FileAccess, FileAccessRequest, FileDelegation, CreateDelegationRequest } from '../types/user-file';
3
+ export interface UserFilesService {
4
+ list(userUniqueId: string, params?: ListUserFilesParams): Promise<PageResult<UserFile>>;
5
+ get(userUniqueId: string, fileUniqueId: string): Promise<UserFile>;
6
+ add(userUniqueId: string, data: AddUserFileRequest): Promise<UserFile>;
7
+ update(userUniqueId: string, fileUniqueId: string, data: UpdateUserFileRequest): Promise<UserFile>;
8
+ delete(userUniqueId: string, fileUniqueId: string): Promise<void>;
9
+ presignUpload(userUniqueId: string, data: PresignUploadRequest): Promise<PresignUploadResponse>;
10
+ multipartPresign(userUniqueId: string, data: MultipartPresignRequest): Promise<MultipartPresignResponse>;
11
+ multipartComplete(userUniqueId: string, data: MultipartCompleteRequest): Promise<UserFile>;
12
+ approve(userUniqueId: string, fileUniqueId: string): Promise<UserFile>;
13
+ reject(userUniqueId: string, fileUniqueId: string): Promise<UserFile>;
14
+ publish(userUniqueId: string, fileUniqueId: string): Promise<UserFile>;
15
+ unpublish(userUniqueId: string, fileUniqueId: string): Promise<UserFile>;
16
+ addTag(userUniqueId: string, fileUniqueId: string, tagUniqueId: string): Promise<UserFile>;
17
+ removeTag(userUniqueId: string, fileUniqueId: string, tagUniqueId: string): Promise<void>;
18
+ bulkUpdateTags(userUniqueId: string, tagUniqueIds: string[]): Promise<void>;
19
+ requestAccess(userUniqueId: string, fileUniqueId: string): Promise<void>;
20
+ getAccess(userUniqueId: string, fileUniqueId: string): Promise<FileAccess[]>;
21
+ grantAccess(userUniqueId: string, fileUniqueId: string, data: FileAccessRequest): Promise<FileAccess>;
22
+ revokeAccess(userUniqueId: string, fileUniqueId: string, accessUniqueId: string): Promise<void>;
23
+ makePublic(userUniqueId: string, fileUniqueId: string): Promise<UserFile>;
24
+ makePrivate(userUniqueId: string, fileUniqueId: string): Promise<UserFile>;
25
+ bulkGrantAccess(userUniqueId: string, fileUniqueIds: string[], granteeUniqueIds: string[]): Promise<void>;
26
+ bulkRevokeAccess(userUniqueId: string, fileUniqueIds: string[], granteeUniqueIds: string[]): Promise<void>;
27
+ listAccessRequests(userUniqueId: string, fileUniqueId: string): Promise<FileAccess[]>;
28
+ approveAccessRequest(userUniqueId: string, fileUniqueId: string, requestUniqueId: string): Promise<FileAccess>;
29
+ denyAccessRequest(userUniqueId: string, fileUniqueId: string, requestUniqueId: string): Promise<void>;
30
+ listGrantedDelegations(userUniqueId: string): Promise<FileDelegation[]>;
31
+ listReceivedDelegations(userUniqueId: string): Promise<FileDelegation[]>;
32
+ getDelegation(userUniqueId: string, delegationUniqueId: string): Promise<FileDelegation>;
33
+ createDelegation(userUniqueId: string, data: CreateDelegationRequest): Promise<FileDelegation>;
34
+ revokeDelegation(userUniqueId: string, delegationUniqueId: string): Promise<void>;
35
+ }
36
+ export declare function createUserFilesService(transport: Transport, _config: {
37
+ appId: string;
38
+ }): UserFilesService;
39
+ //# sourceMappingURL=user-files.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-files.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/user-files.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,KAAK,EACV,QAAQ,EACR,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,wBAAwB,EACxB,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,uBAAuB,EACxB,MAAM,oBAAoB,CAAC;AAG5B,MAAM,WAAW,gBAAgB;IAE/B,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;IACxF,GAAG,CAAC,YAAY,EAAE,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AoB,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/G,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAGtG,sBAAsB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IACxE,uBAAuB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IACzE,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACzF,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC/F,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnF;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,gBAAgB,CA+SzG"}
@@ -1,4 +1,5 @@
1
1
  export * from './storage-file';
2
2
  export * from './entity-file';
3
3
  export * from './file-schema';
4
+ export * from './user-file';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,100 @@
1
+ import type { IdentityCore, EntityStatus } from '@23blocks/contracts';
2
+ export interface UserFile extends IdentityCore {
3
+ userUniqueId: string;
4
+ fileName: string;
5
+ fileType: string;
6
+ fileSize: number;
7
+ mimeType?: string;
8
+ url?: string;
9
+ thumbnailUrl?: string;
10
+ schemaUniqueId?: string;
11
+ status: EntityStatus;
12
+ isPublic: boolean;
13
+ payload?: Record<string, unknown>;
14
+ }
15
+ export interface ListUserFilesParams {
16
+ page?: number;
17
+ perPage?: number;
18
+ status?: string;
19
+ fileType?: string;
20
+ schemaUniqueId?: string;
21
+ }
22
+ export interface AddUserFileRequest {
23
+ fileName: string;
24
+ fileType: string;
25
+ fileSize: number;
26
+ mimeType?: string;
27
+ url: string;
28
+ thumbnailUrl?: string;
29
+ schemaUniqueId?: string;
30
+ payload?: Record<string, unknown>;
31
+ }
32
+ export interface UpdateUserFileRequest {
33
+ fileName?: string;
34
+ fileType?: string;
35
+ thumbnailUrl?: string;
36
+ schemaUniqueId?: string;
37
+ payload?: Record<string, unknown>;
38
+ }
39
+ export interface PresignUploadRequest {
40
+ fileName: string;
41
+ fileType: string;
42
+ mimeType?: string;
43
+ schemaUniqueId?: string;
44
+ }
45
+ export interface PresignUploadResponse {
46
+ presignedUrl: string;
47
+ fileKey: string;
48
+ fields?: Record<string, string>;
49
+ expiresAt: Date;
50
+ }
51
+ export interface MultipartPresignRequest {
52
+ fileName: string;
53
+ fileType: string;
54
+ fileSize: number;
55
+ mimeType?: string;
56
+ partSize?: number;
57
+ }
58
+ export interface MultipartPresignResponse {
59
+ uploadId: string;
60
+ fileKey: string;
61
+ parts: Array<{
62
+ partNumber: number;
63
+ presignedUrl: string;
64
+ }>;
65
+ }
66
+ export interface MultipartCompleteRequest {
67
+ uploadId: string;
68
+ fileKey: string;
69
+ parts: Array<{
70
+ partNumber: number;
71
+ etag: string;
72
+ }>;
73
+ }
74
+ export interface FileAccessRequest {
75
+ granteeUniqueId: string;
76
+ accessType: 'read' | 'write' | 'admin';
77
+ expiresAt?: string;
78
+ }
79
+ export interface FileAccess {
80
+ uniqueId: string;
81
+ fileUniqueId: string;
82
+ granteeUniqueId: string;
83
+ accessType: string;
84
+ grantedAt: Date;
85
+ expiresAt?: Date;
86
+ }
87
+ export interface FileDelegation {
88
+ uniqueId: string;
89
+ granterUniqueId: string;
90
+ granteeUniqueId: string;
91
+ accessLevel: string;
92
+ createdAt: Date;
93
+ expiresAt?: Date;
94
+ }
95
+ export interface CreateDelegationRequest {
96
+ granteeUniqueId: string;
97
+ accessLevel: 'read' | 'write' | 'admin';
98
+ expiresAt?: string;
99
+ }
100
+ //# sourceMappingURL=user-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-file.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/user-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEtE,MAAM,WAAW,QAAS,SAAQ,YAAY;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QA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QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC;QACX,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC;QACX,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@23blocks/block-files",
3
- "version": "1.0.4",
3
+ "version": "2.1.0",
4
4
  "description": "Files block for 23blocks SDK - storage, upload, download, file management",
5
5
  "license": "MIT",
6
6
  "author": "23blocks <hello@23blocks.com>",