@contractspec/lib.files 1.57.0 → 1.58.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.
Files changed (44) hide show
  1. package/dist/contracts/index.d.ts +1080 -1086
  2. package/dist/contracts/index.d.ts.map +1 -1
  3. package/dist/contracts/index.js +575 -854
  4. package/dist/docs/files.docblock.d.ts +2 -1
  5. package/dist/docs/files.docblock.d.ts.map +1 -0
  6. package/dist/docs/files.docblock.js +17 -22
  7. package/dist/docs/index.d.ts +2 -1
  8. package/dist/docs/index.d.ts.map +1 -0
  9. package/dist/docs/index.js +66 -1
  10. package/dist/entities/index.d.ts +134 -139
  11. package/dist/entities/index.d.ts.map +1 -1
  12. package/dist/entities/index.js +228 -257
  13. package/dist/events.d.ts +357 -363
  14. package/dist/events.d.ts.map +1 -1
  15. package/dist/events.js +217 -400
  16. package/dist/files.capability.d.ts +2 -7
  17. package/dist/files.capability.d.ts.map +1 -1
  18. package/dist/files.capability.js +29 -25
  19. package/dist/files.feature.d.ts +1 -6
  20. package/dist/files.feature.d.ts.map +1 -1
  21. package/dist/files.feature.js +50 -131
  22. package/dist/index.d.ts +7 -6
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +1411 -8
  25. package/dist/node/contracts/index.js +576 -0
  26. package/dist/node/docs/files.docblock.js +65 -0
  27. package/dist/node/docs/index.js +65 -0
  28. package/dist/node/entities/index.js +235 -0
  29. package/dist/node/events.js +219 -0
  30. package/dist/node/files.capability.js +28 -0
  31. package/dist/node/files.feature.js +51 -0
  32. package/dist/node/index.js +1410 -0
  33. package/dist/node/storage/index.js +268 -0
  34. package/dist/storage/index.d.ts +163 -166
  35. package/dist/storage/index.d.ts.map +1 -1
  36. package/dist/storage/index.js +266 -266
  37. package/package.json +104 -30
  38. package/dist/contracts/index.js.map +0 -1
  39. package/dist/docs/files.docblock.js.map +0 -1
  40. package/dist/entities/index.js.map +0 -1
  41. package/dist/events.js.map +0 -1
  42. package/dist/files.capability.js.map +0 -1
  43. package/dist/files.feature.js.map +0 -1
  44. package/dist/storage/index.js.map +0 -1
@@ -1,856 +1,577 @@
1
+ // @bun
2
+ // src/contracts/index.ts
1
3
  import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
2
4
  import { defineCommand, defineQuery } from "@contractspec/lib.contracts";
3
-
4
- //#region src/contracts/index.ts
5
- const OWNERS = ["platform.files"];
6
- const FileModel = defineSchemaModel({
7
- name: "File",
8
- description: "Represents an uploaded file",
9
- fields: {
10
- id: {
11
- type: ScalarTypeEnum.String_unsecure(),
12
- isOptional: false
13
- },
14
- name: {
15
- type: ScalarTypeEnum.String_unsecure(),
16
- isOptional: false
17
- },
18
- mimeType: {
19
- type: ScalarTypeEnum.String_unsecure(),
20
- isOptional: false
21
- },
22
- size: {
23
- type: ScalarTypeEnum.Int_unsecure(),
24
- isOptional: false
25
- },
26
- storageProvider: {
27
- type: ScalarTypeEnum.String_unsecure(),
28
- isOptional: false
29
- },
30
- storagePath: {
31
- type: ScalarTypeEnum.String_unsecure(),
32
- isOptional: false
33
- },
34
- checksum: {
35
- type: ScalarTypeEnum.String_unsecure(),
36
- isOptional: true
37
- },
38
- status: {
39
- type: ScalarTypeEnum.String_unsecure(),
40
- isOptional: false
41
- },
42
- isPublic: {
43
- type: ScalarTypeEnum.Boolean(),
44
- isOptional: false
45
- },
46
- ownerId: {
47
- type: ScalarTypeEnum.String_unsecure(),
48
- isOptional: false
49
- },
50
- orgId: {
51
- type: ScalarTypeEnum.String_unsecure(),
52
- isOptional: true
53
- },
54
- metadata: {
55
- type: ScalarTypeEnum.JSON(),
56
- isOptional: true
57
- },
58
- width: {
59
- type: ScalarTypeEnum.Int_unsecure(),
60
- isOptional: true
61
- },
62
- height: {
63
- type: ScalarTypeEnum.Int_unsecure(),
64
- isOptional: true
65
- },
66
- createdAt: {
67
- type: ScalarTypeEnum.DateTime(),
68
- isOptional: false
69
- },
70
- updatedAt: {
71
- type: ScalarTypeEnum.DateTime(),
72
- isOptional: false
73
- }
74
- }
75
- });
76
- const FileVersionModel = defineSchemaModel({
77
- name: "FileVersion",
78
- description: "Represents a file version",
79
- fields: {
80
- id: {
81
- type: ScalarTypeEnum.String_unsecure(),
82
- isOptional: false
83
- },
84
- fileId: {
85
- type: ScalarTypeEnum.String_unsecure(),
86
- isOptional: false
87
- },
88
- version: {
89
- type: ScalarTypeEnum.String_unsecure(),
90
- isOptional: false
91
- },
92
- size: {
93
- type: ScalarTypeEnum.Int_unsecure(),
94
- isOptional: false
95
- },
96
- storagePath: {
97
- type: ScalarTypeEnum.String_unsecure(),
98
- isOptional: false
99
- },
100
- checksum: {
101
- type: ScalarTypeEnum.String_unsecure(),
102
- isOptional: true
103
- },
104
- comment: {
105
- type: ScalarTypeEnum.String_unsecure(),
106
- isOptional: true
107
- },
108
- createdBy: {
109
- type: ScalarTypeEnum.String_unsecure(),
110
- isOptional: false
111
- },
112
- createdAt: {
113
- type: ScalarTypeEnum.DateTime(),
114
- isOptional: false
115
- }
116
- }
117
- });
118
- const AttachmentModel = defineSchemaModel({
119
- name: "Attachment",
120
- description: "Represents an attachment",
121
- fields: {
122
- id: {
123
- type: ScalarTypeEnum.String_unsecure(),
124
- isOptional: false
125
- },
126
- fileId: {
127
- type: ScalarTypeEnum.String_unsecure(),
128
- isOptional: false
129
- },
130
- entityType: {
131
- type: ScalarTypeEnum.String_unsecure(),
132
- isOptional: false
133
- },
134
- entityId: {
135
- type: ScalarTypeEnum.String_unsecure(),
136
- isOptional: false
137
- },
138
- attachmentType: {
139
- type: ScalarTypeEnum.String_unsecure(),
140
- isOptional: true
141
- },
142
- name: {
143
- type: ScalarTypeEnum.String_unsecure(),
144
- isOptional: true
145
- },
146
- description: {
147
- type: ScalarTypeEnum.String_unsecure(),
148
- isOptional: true
149
- },
150
- order: {
151
- type: ScalarTypeEnum.Int_unsecure(),
152
- isOptional: false
153
- },
154
- metadata: {
155
- type: ScalarTypeEnum.JSON(),
156
- isOptional: true
157
- },
158
- createdBy: {
159
- type: ScalarTypeEnum.String_unsecure(),
160
- isOptional: false
161
- },
162
- createdAt: {
163
- type: ScalarTypeEnum.DateTime(),
164
- isOptional: false
165
- },
166
- file: {
167
- type: FileModel,
168
- isOptional: true
169
- }
170
- }
171
- });
172
- const PresignedUrlModel = defineSchemaModel({
173
- name: "PresignedUrl",
174
- description: "A presigned URL for file operations",
175
- fields: {
176
- url: {
177
- type: ScalarTypeEnum.String_unsecure(),
178
- isOptional: false
179
- },
180
- fields: {
181
- type: ScalarTypeEnum.JSON(),
182
- isOptional: true
183
- },
184
- expiresAt: {
185
- type: ScalarTypeEnum.DateTime(),
186
- isOptional: false
187
- },
188
- fileId: {
189
- type: ScalarTypeEnum.String_unsecure(),
190
- isOptional: true
191
- },
192
- sessionId: {
193
- type: ScalarTypeEnum.String_unsecure(),
194
- isOptional: true
195
- }
196
- }
197
- });
198
- const UploadFileInput = defineSchemaModel({
199
- name: "UploadFileInput",
200
- description: "Input for uploading a file",
201
- fields: {
202
- name: {
203
- type: ScalarTypeEnum.String_unsecure(),
204
- isOptional: false
205
- },
206
- mimeType: {
207
- type: ScalarTypeEnum.String_unsecure(),
208
- isOptional: false
209
- },
210
- size: {
211
- type: ScalarTypeEnum.Int_unsecure(),
212
- isOptional: false
213
- },
214
- content: {
215
- type: ScalarTypeEnum.String_unsecure(),
216
- isOptional: false
217
- },
218
- orgId: {
219
- type: ScalarTypeEnum.String_unsecure(),
220
- isOptional: true
221
- },
222
- isPublic: {
223
- type: ScalarTypeEnum.Boolean(),
224
- isOptional: true
225
- },
226
- metadata: {
227
- type: ScalarTypeEnum.JSON(),
228
- isOptional: true
229
- },
230
- tags: {
231
- type: ScalarTypeEnum.JSON(),
232
- isOptional: true
233
- }
234
- }
235
- });
236
- const UpdateFileInput = defineSchemaModel({
237
- name: "UpdateFileInput",
238
- description: "Input for updating a file",
239
- fields: {
240
- fileId: {
241
- type: ScalarTypeEnum.String_unsecure(),
242
- isOptional: false
243
- },
244
- name: {
245
- type: ScalarTypeEnum.String_unsecure(),
246
- isOptional: true
247
- },
248
- isPublic: {
249
- type: ScalarTypeEnum.Boolean(),
250
- isOptional: true
251
- },
252
- metadata: {
253
- type: ScalarTypeEnum.JSON(),
254
- isOptional: true
255
- },
256
- tags: {
257
- type: ScalarTypeEnum.JSON(),
258
- isOptional: true
259
- }
260
- }
261
- });
262
- const DeleteFileInput = defineSchemaModel({
263
- name: "DeleteFileInput",
264
- description: "Input for deleting a file",
265
- fields: { fileId: {
266
- type: ScalarTypeEnum.String_unsecure(),
267
- isOptional: false
268
- } }
269
- });
270
- const GetFileInput = defineSchemaModel({
271
- name: "GetFileInput",
272
- description: "Input for getting a file",
273
- fields: { fileId: {
274
- type: ScalarTypeEnum.String_unsecure(),
275
- isOptional: false
276
- } }
277
- });
278
- const ListFilesInput = defineSchemaModel({
279
- name: "ListFilesInput",
280
- description: "Input for listing files",
281
- fields: {
282
- orgId: {
283
- type: ScalarTypeEnum.String_unsecure(),
284
- isOptional: true
285
- },
286
- ownerId: {
287
- type: ScalarTypeEnum.String_unsecure(),
288
- isOptional: true
289
- },
290
- mimeType: {
291
- type: ScalarTypeEnum.String_unsecure(),
292
- isOptional: true
293
- },
294
- status: {
295
- type: ScalarTypeEnum.String_unsecure(),
296
- isOptional: true
297
- },
298
- tags: {
299
- type: ScalarTypeEnum.JSON(),
300
- isOptional: true
301
- },
302
- limit: {
303
- type: ScalarTypeEnum.Int_unsecure(),
304
- isOptional: true
305
- },
306
- offset: {
307
- type: ScalarTypeEnum.Int_unsecure(),
308
- isOptional: true
309
- }
310
- }
311
- });
312
- const ListFilesOutput = defineSchemaModel({
313
- name: "ListFilesOutput",
314
- description: "Output for listing files",
315
- fields: {
316
- files: {
317
- type: FileModel,
318
- isArray: true,
319
- isOptional: false
320
- },
321
- total: {
322
- type: ScalarTypeEnum.Int_unsecure(),
323
- isOptional: false
324
- }
325
- }
326
- });
327
- const GetDownloadUrlInput = defineSchemaModel({
328
- name: "GetDownloadUrlInput",
329
- description: "Input for getting a download URL",
330
- fields: {
331
- fileId: {
332
- type: ScalarTypeEnum.String_unsecure(),
333
- isOptional: false
334
- },
335
- expiresInSeconds: {
336
- type: ScalarTypeEnum.Int_unsecure(),
337
- isOptional: true
338
- }
339
- }
340
- });
341
- const CreateVersionInput = defineSchemaModel({
342
- name: "CreateVersionInput",
343
- description: "Input for creating a file version",
344
- fields: {
345
- fileId: {
346
- type: ScalarTypeEnum.String_unsecure(),
347
- isOptional: false
348
- },
349
- content: {
350
- type: ScalarTypeEnum.String_unsecure(),
351
- isOptional: false
352
- },
353
- comment: {
354
- type: ScalarTypeEnum.String_unsecure(),
355
- isOptional: true
356
- }
357
- }
358
- });
359
- const GetVersionsInput = defineSchemaModel({
360
- name: "GetVersionsInput",
361
- description: "Input for getting file versions",
362
- fields: {
363
- fileId: {
364
- type: ScalarTypeEnum.String_unsecure(),
365
- isOptional: false
366
- },
367
- limit: {
368
- type: ScalarTypeEnum.Int_unsecure(),
369
- isOptional: true
370
- },
371
- offset: {
372
- type: ScalarTypeEnum.Int_unsecure(),
373
- isOptional: true
374
- }
375
- }
376
- });
377
- const GetVersionsOutput = defineSchemaModel({
378
- name: "GetVersionsOutput",
379
- description: "Output for getting file versions",
380
- fields: {
381
- versions: {
382
- type: FileVersionModel,
383
- isArray: true,
384
- isOptional: false
385
- },
386
- total: {
387
- type: ScalarTypeEnum.Int_unsecure(),
388
- isOptional: false
389
- }
390
- }
391
- });
392
- const AttachFileInput = defineSchemaModel({
393
- name: "AttachFileInput",
394
- description: "Input for attaching a file to an entity",
395
- fields: {
396
- fileId: {
397
- type: ScalarTypeEnum.String_unsecure(),
398
- isOptional: false
399
- },
400
- entityType: {
401
- type: ScalarTypeEnum.String_unsecure(),
402
- isOptional: false
403
- },
404
- entityId: {
405
- type: ScalarTypeEnum.String_unsecure(),
406
- isOptional: false
407
- },
408
- attachmentType: {
409
- type: ScalarTypeEnum.String_unsecure(),
410
- isOptional: true
411
- },
412
- name: {
413
- type: ScalarTypeEnum.String_unsecure(),
414
- isOptional: true
415
- },
416
- description: {
417
- type: ScalarTypeEnum.String_unsecure(),
418
- isOptional: true
419
- },
420
- order: {
421
- type: ScalarTypeEnum.Int_unsecure(),
422
- isOptional: true
423
- },
424
- metadata: {
425
- type: ScalarTypeEnum.JSON(),
426
- isOptional: true
427
- }
428
- }
429
- });
430
- const DetachFileInput = defineSchemaModel({
431
- name: "DetachFileInput",
432
- description: "Input for detaching a file",
433
- fields: { attachmentId: {
434
- type: ScalarTypeEnum.String_unsecure(),
435
- isOptional: false
436
- } }
437
- });
438
- const ListAttachmentsInput = defineSchemaModel({
439
- name: "ListAttachmentsInput",
440
- description: "Input for listing attachments",
441
- fields: {
442
- entityType: {
443
- type: ScalarTypeEnum.String_unsecure(),
444
- isOptional: false
445
- },
446
- entityId: {
447
- type: ScalarTypeEnum.String_unsecure(),
448
- isOptional: false
449
- },
450
- attachmentType: {
451
- type: ScalarTypeEnum.String_unsecure(),
452
- isOptional: true
453
- }
454
- }
455
- });
456
- const ListAttachmentsOutput = defineSchemaModel({
457
- name: "ListAttachmentsOutput",
458
- description: "Output for listing attachments",
459
- fields: {
460
- attachments: {
461
- type: AttachmentModel,
462
- isArray: true,
463
- isOptional: false
464
- },
465
- total: {
466
- type: ScalarTypeEnum.Int_unsecure(),
467
- isOptional: false
468
- }
469
- }
470
- });
471
- const CreatePresignedUrlInput = defineSchemaModel({
472
- name: "CreatePresignedUrlInput",
473
- description: "Input for creating a presigned upload URL",
474
- fields: {
475
- fileName: {
476
- type: ScalarTypeEnum.String_unsecure(),
477
- isOptional: false
478
- },
479
- mimeType: {
480
- type: ScalarTypeEnum.String_unsecure(),
481
- isOptional: false
482
- },
483
- size: {
484
- type: ScalarTypeEnum.Int_unsecure(),
485
- isOptional: false
486
- },
487
- orgId: {
488
- type: ScalarTypeEnum.String_unsecure(),
489
- isOptional: true
490
- },
491
- expiresInSeconds: {
492
- type: ScalarTypeEnum.Int_unsecure(),
493
- isOptional: true
494
- }
495
- }
496
- });
497
- const SuccessOutput = defineSchemaModel({
498
- name: "SuccessOutput",
499
- description: "Generic success output",
500
- fields: { success: {
501
- type: ScalarTypeEnum.Boolean(),
502
- isOptional: false
503
- } }
504
- });
505
- /**
506
- * Upload a file.
507
- */
508
- const UploadFileContract = defineCommand({
509
- meta: {
510
- key: "file.upload",
511
- version: "1.0.0",
512
- stability: "stable",
513
- owners: [...OWNERS],
514
- tags: ["files", "upload"],
515
- description: "Upload a new file.",
516
- goal: "Store a file and create a file record.",
517
- context: "Called when uploading files directly."
518
- },
519
- io: {
520
- input: UploadFileInput,
521
- output: FileModel,
522
- errors: {
523
- FILE_TOO_LARGE: {
524
- description: "File exceeds size limit",
525
- http: 413,
526
- gqlCode: "FILE_TOO_LARGE",
527
- when: "File size exceeds configured limit"
528
- },
529
- INVALID_MIME_TYPE: {
530
- description: "MIME type not allowed",
531
- http: 415,
532
- gqlCode: "INVALID_MIME_TYPE",
533
- when: "File type is not in allowed list"
534
- }
535
- }
536
- },
537
- policy: { auth: "user" }
538
- });
539
- /**
540
- * Update a file.
541
- */
542
- const UpdateFileContract = defineCommand({
543
- meta: {
544
- key: "file.update",
545
- version: "1.0.0",
546
- stability: "stable",
547
- owners: [...OWNERS],
548
- tags: ["files", "update"],
549
- description: "Update file metadata.",
550
- goal: "Modify file properties without replacing content.",
551
- context: "Called when renaming or updating file metadata."
552
- },
553
- io: {
554
- input: UpdateFileInput,
555
- output: FileModel,
556
- errors: { FILE_NOT_FOUND: {
557
- description: "File does not exist",
558
- http: 404,
559
- gqlCode: "FILE_NOT_FOUND",
560
- when: "File ID is invalid"
561
- } }
562
- },
563
- policy: { auth: "user" }
564
- });
565
- /**
566
- * Delete a file.
567
- */
568
- const DeleteFileContract = defineCommand({
569
- meta: {
570
- key: "file.delete",
571
- version: "1.0.0",
572
- stability: "stable",
573
- owners: [...OWNERS],
574
- tags: ["files", "delete"],
575
- description: "Delete a file.",
576
- goal: "Remove a file and all its versions and attachments.",
577
- context: "Called when removing a file permanently."
578
- },
579
- io: {
580
- input: DeleteFileInput,
581
- output: SuccessOutput,
582
- errors: { FILE_NOT_FOUND: {
583
- description: "File does not exist",
584
- http: 404,
585
- gqlCode: "FILE_NOT_FOUND",
586
- when: "File ID is invalid"
587
- } }
588
- },
589
- policy: { auth: "user" }
590
- });
591
- /**
592
- * Get a file by ID.
593
- */
594
- const GetFileContract = defineQuery({
595
- meta: {
596
- key: "file.get",
597
- version: "1.0.0",
598
- stability: "stable",
599
- owners: [...OWNERS],
600
- tags: ["files", "get"],
601
- description: "Get a file by ID.",
602
- goal: "Retrieve file metadata.",
603
- context: "Called to inspect file details."
604
- },
605
- io: {
606
- input: GetFileInput,
607
- output: FileModel,
608
- errors: { FILE_NOT_FOUND: {
609
- description: "File does not exist",
610
- http: 404,
611
- gqlCode: "FILE_NOT_FOUND",
612
- when: "File ID is invalid"
613
- } }
614
- },
615
- policy: { auth: "user" }
616
- });
617
- /**
618
- * List files.
619
- */
620
- const ListFilesContract = defineQuery({
621
- meta: {
622
- key: "file.list",
623
- version: "1.0.0",
624
- stability: "stable",
625
- owners: [...OWNERS],
626
- tags: ["files", "list"],
627
- description: "List files with filtering.",
628
- goal: "Browse uploaded files.",
629
- context: "Called to browse file library."
630
- },
631
- io: {
632
- input: ListFilesInput,
633
- output: ListFilesOutput
634
- },
635
- policy: { auth: "user" }
636
- });
637
- /**
638
- * Get download URL.
639
- */
640
- const GetDownloadUrlContract = defineQuery({
641
- meta: {
642
- key: "file.downloadUrl",
643
- version: "1.0.0",
644
- stability: "stable",
645
- owners: [...OWNERS],
646
- tags: ["files", "download"],
647
- description: "Get a presigned download URL.",
648
- goal: "Generate a temporary URL for downloading.",
649
- context: "Called when user wants to download a file."
650
- },
651
- io: {
652
- input: GetDownloadUrlInput,
653
- output: PresignedUrlModel,
654
- errors: { FILE_NOT_FOUND: {
655
- description: "File does not exist",
656
- http: 404,
657
- gqlCode: "FILE_NOT_FOUND",
658
- when: "File ID is invalid"
659
- } }
660
- },
661
- policy: { auth: "user" }
662
- });
663
- /**
664
- * Create a file version.
665
- */
666
- const CreateVersionContract = defineCommand({
667
- meta: {
668
- key: "file.version.create",
669
- version: "1.0.0",
670
- stability: "stable",
671
- owners: [...OWNERS],
672
- tags: [
673
- "files",
674
- "version",
675
- "create"
676
- ],
677
- description: "Create a new version of a file.",
678
- goal: "Upload a new version while preserving history.",
679
- context: "Called when updating a document."
680
- },
681
- io: {
682
- input: CreateVersionInput,
683
- output: FileVersionModel,
684
- errors: { FILE_NOT_FOUND: {
685
- description: "File does not exist",
686
- http: 404,
687
- gqlCode: "FILE_NOT_FOUND",
688
- when: "File ID is invalid"
689
- } }
690
- },
691
- policy: { auth: "user" }
692
- });
693
- /**
694
- * Get file versions.
695
- */
696
- const GetVersionsContract = defineQuery({
697
- meta: {
698
- key: "file.version.list",
699
- version: "1.0.0",
700
- stability: "stable",
701
- owners: [...OWNERS],
702
- tags: [
703
- "files",
704
- "version",
705
- "list"
706
- ],
707
- description: "Get file version history.",
708
- goal: "View all versions of a file.",
709
- context: "Called to browse file history."
710
- },
711
- io: {
712
- input: GetVersionsInput,
713
- output: GetVersionsOutput,
714
- errors: { FILE_NOT_FOUND: {
715
- description: "File does not exist",
716
- http: 404,
717
- gqlCode: "FILE_NOT_FOUND",
718
- when: "File ID is invalid"
719
- } }
720
- },
721
- policy: { auth: "user" }
722
- });
723
- /**
724
- * Attach a file to an entity.
725
- */
726
- const AttachFileContract = defineCommand({
727
- meta: {
728
- key: "attachment.attach",
729
- version: "1.0.0",
730
- stability: "stable",
731
- owners: [...OWNERS],
732
- tags: [
733
- "files",
734
- "attachment",
735
- "attach"
736
- ],
737
- description: "Attach a file to an entity.",
738
- goal: "Link a file to a business entity.",
739
- context: "Called when associating files with entities."
740
- },
741
- io: {
742
- input: AttachFileInput,
743
- output: AttachmentModel,
744
- errors: {
745
- FILE_NOT_FOUND: {
746
- description: "File does not exist",
747
- http: 404,
748
- gqlCode: "FILE_NOT_FOUND",
749
- when: "File ID is invalid"
750
- },
751
- ATTACHMENT_EXISTS: {
752
- description: "Attachment already exists",
753
- http: 409,
754
- gqlCode: "ATTACHMENT_EXISTS",
755
- when: "File is already attached to this entity"
756
- }
757
- }
758
- },
759
- policy: { auth: "user" }
760
- });
761
- /**
762
- * Detach a file from an entity.
763
- */
764
- const DetachFileContract = defineCommand({
765
- meta: {
766
- key: "attachment.detach",
767
- version: "1.0.0",
768
- stability: "stable",
769
- owners: [...OWNERS],
770
- tags: [
771
- "files",
772
- "attachment",
773
- "detach"
774
- ],
775
- description: "Detach a file from an entity.",
776
- goal: "Remove a file association.",
777
- context: "Called when removing file from entity."
778
- },
779
- io: {
780
- input: DetachFileInput,
781
- output: SuccessOutput,
782
- errors: { ATTACHMENT_NOT_FOUND: {
783
- description: "Attachment does not exist",
784
- http: 404,
785
- gqlCode: "ATTACHMENT_NOT_FOUND",
786
- when: "Attachment ID is invalid"
787
- } }
788
- },
789
- policy: { auth: "user" }
790
- });
791
- /**
792
- * List attachments for an entity.
793
- */
794
- const ListAttachmentsContract = defineQuery({
795
- meta: {
796
- key: "attachment.list",
797
- version: "1.0.0",
798
- stability: "stable",
799
- owners: [...OWNERS],
800
- tags: [
801
- "files",
802
- "attachment",
803
- "list"
804
- ],
805
- description: "List attachments for an entity.",
806
- goal: "Get all files attached to an entity.",
807
- context: "Called to display attached files."
808
- },
809
- io: {
810
- input: ListAttachmentsInput,
811
- output: ListAttachmentsOutput
812
- },
813
- policy: { auth: "user" }
814
- });
815
- /**
816
- * Create a presigned upload URL.
817
- */
818
- const CreatePresignedUrlContract = defineCommand({
819
- meta: {
820
- key: "file.presignedUrl.create",
821
- version: "1.0.0",
822
- stability: "stable",
823
- owners: [...OWNERS],
824
- tags: [
825
- "files",
826
- "presigned",
827
- "upload"
828
- ],
829
- description: "Create a presigned URL for direct upload.",
830
- goal: "Enable direct-to-storage uploads.",
831
- context: "Called for large file uploads."
832
- },
833
- io: {
834
- input: CreatePresignedUrlInput,
835
- output: PresignedUrlModel,
836
- errors: {
837
- FILE_TOO_LARGE: {
838
- description: "File exceeds size limit",
839
- http: 413,
840
- gqlCode: "FILE_TOO_LARGE",
841
- when: "Requested file size exceeds limit"
842
- },
843
- INVALID_MIME_TYPE: {
844
- description: "MIME type not allowed",
845
- http: 415,
846
- gqlCode: "INVALID_MIME_TYPE",
847
- when: "File type is not in allowed list"
848
- }
849
- }
850
- },
851
- policy: { auth: "user" }
852
- });
853
-
854
- //#endregion
855
- export { AttachFileContract, AttachmentModel, CreatePresignedUrlContract, CreateVersionContract, DeleteFileContract, DetachFileContract, FileModel, FileVersionModel, GetDownloadUrlContract, GetFileContract, GetVersionsContract, ListAttachmentsContract, ListFilesContract, PresignedUrlModel, UpdateFileContract, UploadFileContract };
856
- //# sourceMappingURL=index.js.map
5
+ var OWNERS = ["platform.files"];
6
+ var FileModel = defineSchemaModel({
7
+ name: "File",
8
+ description: "Represents an uploaded file",
9
+ fields: {
10
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
11
+ name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
12
+ mimeType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
13
+ size: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
14
+ storageProvider: {
15
+ type: ScalarTypeEnum.String_unsecure(),
16
+ isOptional: false
17
+ },
18
+ storagePath: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
19
+ checksum: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
20
+ status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
21
+ isPublic: { type: ScalarTypeEnum.Boolean(), isOptional: false },
22
+ ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
23
+ orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
24
+ metadata: { type: ScalarTypeEnum.JSON(), isOptional: true },
25
+ width: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
26
+ height: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
27
+ createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
28
+ updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
29
+ }
30
+ });
31
+ var FileVersionModel = defineSchemaModel({
32
+ name: "FileVersion",
33
+ description: "Represents a file version",
34
+ fields: {
35
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
36
+ fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
37
+ version: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
38
+ size: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
39
+ storagePath: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
40
+ checksum: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
41
+ comment: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
42
+ createdBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
43
+ createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
44
+ }
45
+ });
46
+ var AttachmentModel = defineSchemaModel({
47
+ name: "Attachment",
48
+ description: "Represents an attachment",
49
+ fields: {
50
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
51
+ fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
52
+ entityType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
53
+ entityId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
54
+ attachmentType: {
55
+ type: ScalarTypeEnum.String_unsecure(),
56
+ isOptional: true
57
+ },
58
+ name: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
59
+ description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
60
+ order: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
61
+ metadata: { type: ScalarTypeEnum.JSON(), isOptional: true },
62
+ createdBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
63
+ createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
64
+ file: { type: FileModel, isOptional: true }
65
+ }
66
+ });
67
+ var PresignedUrlModel = defineSchemaModel({
68
+ name: "PresignedUrl",
69
+ description: "A presigned URL for file operations",
70
+ fields: {
71
+ url: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
72
+ fields: { type: ScalarTypeEnum.JSON(), isOptional: true },
73
+ expiresAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
74
+ fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
75
+ sessionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
76
+ }
77
+ });
78
+ var UploadFileInput = defineSchemaModel({
79
+ name: "UploadFileInput",
80
+ description: "Input for uploading a file",
81
+ fields: {
82
+ name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
83
+ mimeType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
84
+ size: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
85
+ content: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
86
+ orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
87
+ isPublic: { type: ScalarTypeEnum.Boolean(), isOptional: true },
88
+ metadata: { type: ScalarTypeEnum.JSON(), isOptional: true },
89
+ tags: { type: ScalarTypeEnum.JSON(), isOptional: true }
90
+ }
91
+ });
92
+ var UpdateFileInput = defineSchemaModel({
93
+ name: "UpdateFileInput",
94
+ description: "Input for updating a file",
95
+ fields: {
96
+ fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
97
+ name: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
98
+ isPublic: { type: ScalarTypeEnum.Boolean(), isOptional: true },
99
+ metadata: { type: ScalarTypeEnum.JSON(), isOptional: true },
100
+ tags: { type: ScalarTypeEnum.JSON(), isOptional: true }
101
+ }
102
+ });
103
+ var DeleteFileInput = defineSchemaModel({
104
+ name: "DeleteFileInput",
105
+ description: "Input for deleting a file",
106
+ fields: {
107
+ fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
108
+ }
109
+ });
110
+ var GetFileInput = defineSchemaModel({
111
+ name: "GetFileInput",
112
+ description: "Input for getting a file",
113
+ fields: {
114
+ fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
115
+ }
116
+ });
117
+ var ListFilesInput = defineSchemaModel({
118
+ name: "ListFilesInput",
119
+ description: "Input for listing files",
120
+ fields: {
121
+ orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
122
+ ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
123
+ mimeType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
124
+ status: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
125
+ tags: { type: ScalarTypeEnum.JSON(), isOptional: true },
126
+ limit: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
127
+ offset: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true }
128
+ }
129
+ });
130
+ var ListFilesOutput = defineSchemaModel({
131
+ name: "ListFilesOutput",
132
+ description: "Output for listing files",
133
+ fields: {
134
+ files: { type: FileModel, isArray: true, isOptional: false },
135
+ total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false }
136
+ }
137
+ });
138
+ var GetDownloadUrlInput = defineSchemaModel({
139
+ name: "GetDownloadUrlInput",
140
+ description: "Input for getting a download URL",
141
+ fields: {
142
+ fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
143
+ expiresInSeconds: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true }
144
+ }
145
+ });
146
+ var CreateVersionInput = defineSchemaModel({
147
+ name: "CreateVersionInput",
148
+ description: "Input for creating a file version",
149
+ fields: {
150
+ fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
151
+ content: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
152
+ comment: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
153
+ }
154
+ });
155
+ var GetVersionsInput = defineSchemaModel({
156
+ name: "GetVersionsInput",
157
+ description: "Input for getting file versions",
158
+ fields: {
159
+ fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
160
+ limit: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
161
+ offset: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true }
162
+ }
163
+ });
164
+ var GetVersionsOutput = defineSchemaModel({
165
+ name: "GetVersionsOutput",
166
+ description: "Output for getting file versions",
167
+ fields: {
168
+ versions: { type: FileVersionModel, isArray: true, isOptional: false },
169
+ total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false }
170
+ }
171
+ });
172
+ var AttachFileInput = defineSchemaModel({
173
+ name: "AttachFileInput",
174
+ description: "Input for attaching a file to an entity",
175
+ fields: {
176
+ fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
177
+ entityType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
178
+ entityId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
179
+ attachmentType: {
180
+ type: ScalarTypeEnum.String_unsecure(),
181
+ isOptional: true
182
+ },
183
+ name: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
184
+ description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
185
+ order: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
186
+ metadata: { type: ScalarTypeEnum.JSON(), isOptional: true }
187
+ }
188
+ });
189
+ var DetachFileInput = defineSchemaModel({
190
+ name: "DetachFileInput",
191
+ description: "Input for detaching a file",
192
+ fields: {
193
+ attachmentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
194
+ }
195
+ });
196
+ var ListAttachmentsInput = defineSchemaModel({
197
+ name: "ListAttachmentsInput",
198
+ description: "Input for listing attachments",
199
+ fields: {
200
+ entityType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
201
+ entityId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
202
+ attachmentType: {
203
+ type: ScalarTypeEnum.String_unsecure(),
204
+ isOptional: true
205
+ }
206
+ }
207
+ });
208
+ var ListAttachmentsOutput = defineSchemaModel({
209
+ name: "ListAttachmentsOutput",
210
+ description: "Output for listing attachments",
211
+ fields: {
212
+ attachments: { type: AttachmentModel, isArray: true, isOptional: false },
213
+ total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false }
214
+ }
215
+ });
216
+ var CreatePresignedUrlInput = defineSchemaModel({
217
+ name: "CreatePresignedUrlInput",
218
+ description: "Input for creating a presigned upload URL",
219
+ fields: {
220
+ fileName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
221
+ mimeType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
222
+ size: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
223
+ orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
224
+ expiresInSeconds: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true }
225
+ }
226
+ });
227
+ var SuccessOutput = defineSchemaModel({
228
+ name: "SuccessOutput",
229
+ description: "Generic success output",
230
+ fields: {
231
+ success: { type: ScalarTypeEnum.Boolean(), isOptional: false }
232
+ }
233
+ });
234
+ var UploadFileContract = defineCommand({
235
+ meta: {
236
+ key: "file.upload",
237
+ version: "1.0.0",
238
+ stability: "stable",
239
+ owners: [...OWNERS],
240
+ tags: ["files", "upload"],
241
+ description: "Upload a new file.",
242
+ goal: "Store a file and create a file record.",
243
+ context: "Called when uploading files directly."
244
+ },
245
+ io: {
246
+ input: UploadFileInput,
247
+ output: FileModel,
248
+ errors: {
249
+ FILE_TOO_LARGE: {
250
+ description: "File exceeds size limit",
251
+ http: 413,
252
+ gqlCode: "FILE_TOO_LARGE",
253
+ when: "File size exceeds configured limit"
254
+ },
255
+ INVALID_MIME_TYPE: {
256
+ description: "MIME type not allowed",
257
+ http: 415,
258
+ gqlCode: "INVALID_MIME_TYPE",
259
+ when: "File type is not in allowed list"
260
+ }
261
+ }
262
+ },
263
+ policy: {
264
+ auth: "user"
265
+ }
266
+ });
267
+ var UpdateFileContract = defineCommand({
268
+ meta: {
269
+ key: "file.update",
270
+ version: "1.0.0",
271
+ stability: "stable",
272
+ owners: [...OWNERS],
273
+ tags: ["files", "update"],
274
+ description: "Update file metadata.",
275
+ goal: "Modify file properties without replacing content.",
276
+ context: "Called when renaming or updating file metadata."
277
+ },
278
+ io: {
279
+ input: UpdateFileInput,
280
+ output: FileModel,
281
+ errors: {
282
+ FILE_NOT_FOUND: {
283
+ description: "File does not exist",
284
+ http: 404,
285
+ gqlCode: "FILE_NOT_FOUND",
286
+ when: "File ID is invalid"
287
+ }
288
+ }
289
+ },
290
+ policy: {
291
+ auth: "user"
292
+ }
293
+ });
294
+ var DeleteFileContract = defineCommand({
295
+ meta: {
296
+ key: "file.delete",
297
+ version: "1.0.0",
298
+ stability: "stable",
299
+ owners: [...OWNERS],
300
+ tags: ["files", "delete"],
301
+ description: "Delete a file.",
302
+ goal: "Remove a file and all its versions and attachments.",
303
+ context: "Called when removing a file permanently."
304
+ },
305
+ io: {
306
+ input: DeleteFileInput,
307
+ output: SuccessOutput,
308
+ errors: {
309
+ FILE_NOT_FOUND: {
310
+ description: "File does not exist",
311
+ http: 404,
312
+ gqlCode: "FILE_NOT_FOUND",
313
+ when: "File ID is invalid"
314
+ }
315
+ }
316
+ },
317
+ policy: {
318
+ auth: "user"
319
+ }
320
+ });
321
+ var GetFileContract = defineQuery({
322
+ meta: {
323
+ key: "file.get",
324
+ version: "1.0.0",
325
+ stability: "stable",
326
+ owners: [...OWNERS],
327
+ tags: ["files", "get"],
328
+ description: "Get a file by ID.",
329
+ goal: "Retrieve file metadata.",
330
+ context: "Called to inspect file details."
331
+ },
332
+ io: {
333
+ input: GetFileInput,
334
+ output: FileModel,
335
+ errors: {
336
+ FILE_NOT_FOUND: {
337
+ description: "File does not exist",
338
+ http: 404,
339
+ gqlCode: "FILE_NOT_FOUND",
340
+ when: "File ID is invalid"
341
+ }
342
+ }
343
+ },
344
+ policy: {
345
+ auth: "user"
346
+ }
347
+ });
348
+ var ListFilesContract = defineQuery({
349
+ meta: {
350
+ key: "file.list",
351
+ version: "1.0.0",
352
+ stability: "stable",
353
+ owners: [...OWNERS],
354
+ tags: ["files", "list"],
355
+ description: "List files with filtering.",
356
+ goal: "Browse uploaded files.",
357
+ context: "Called to browse file library."
358
+ },
359
+ io: {
360
+ input: ListFilesInput,
361
+ output: ListFilesOutput
362
+ },
363
+ policy: {
364
+ auth: "user"
365
+ }
366
+ });
367
+ var GetDownloadUrlContract = defineQuery({
368
+ meta: {
369
+ key: "file.downloadUrl",
370
+ version: "1.0.0",
371
+ stability: "stable",
372
+ owners: [...OWNERS],
373
+ tags: ["files", "download"],
374
+ description: "Get a presigned download URL.",
375
+ goal: "Generate a temporary URL for downloading.",
376
+ context: "Called when user wants to download a file."
377
+ },
378
+ io: {
379
+ input: GetDownloadUrlInput,
380
+ output: PresignedUrlModel,
381
+ errors: {
382
+ FILE_NOT_FOUND: {
383
+ description: "File does not exist",
384
+ http: 404,
385
+ gqlCode: "FILE_NOT_FOUND",
386
+ when: "File ID is invalid"
387
+ }
388
+ }
389
+ },
390
+ policy: {
391
+ auth: "user"
392
+ }
393
+ });
394
+ var CreateVersionContract = defineCommand({
395
+ meta: {
396
+ key: "file.version.create",
397
+ version: "1.0.0",
398
+ stability: "stable",
399
+ owners: [...OWNERS],
400
+ tags: ["files", "version", "create"],
401
+ description: "Create a new version of a file.",
402
+ goal: "Upload a new version while preserving history.",
403
+ context: "Called when updating a document."
404
+ },
405
+ io: {
406
+ input: CreateVersionInput,
407
+ output: FileVersionModel,
408
+ errors: {
409
+ FILE_NOT_FOUND: {
410
+ description: "File does not exist",
411
+ http: 404,
412
+ gqlCode: "FILE_NOT_FOUND",
413
+ when: "File ID is invalid"
414
+ }
415
+ }
416
+ },
417
+ policy: {
418
+ auth: "user"
419
+ }
420
+ });
421
+ var GetVersionsContract = defineQuery({
422
+ meta: {
423
+ key: "file.version.list",
424
+ version: "1.0.0",
425
+ stability: "stable",
426
+ owners: [...OWNERS],
427
+ tags: ["files", "version", "list"],
428
+ description: "Get file version history.",
429
+ goal: "View all versions of a file.",
430
+ context: "Called to browse file history."
431
+ },
432
+ io: {
433
+ input: GetVersionsInput,
434
+ output: GetVersionsOutput,
435
+ errors: {
436
+ FILE_NOT_FOUND: {
437
+ description: "File does not exist",
438
+ http: 404,
439
+ gqlCode: "FILE_NOT_FOUND",
440
+ when: "File ID is invalid"
441
+ }
442
+ }
443
+ },
444
+ policy: {
445
+ auth: "user"
446
+ }
447
+ });
448
+ var AttachFileContract = defineCommand({
449
+ meta: {
450
+ key: "attachment.attach",
451
+ version: "1.0.0",
452
+ stability: "stable",
453
+ owners: [...OWNERS],
454
+ tags: ["files", "attachment", "attach"],
455
+ description: "Attach a file to an entity.",
456
+ goal: "Link a file to a business entity.",
457
+ context: "Called when associating files with entities."
458
+ },
459
+ io: {
460
+ input: AttachFileInput,
461
+ output: AttachmentModel,
462
+ errors: {
463
+ FILE_NOT_FOUND: {
464
+ description: "File does not exist",
465
+ http: 404,
466
+ gqlCode: "FILE_NOT_FOUND",
467
+ when: "File ID is invalid"
468
+ },
469
+ ATTACHMENT_EXISTS: {
470
+ description: "Attachment already exists",
471
+ http: 409,
472
+ gqlCode: "ATTACHMENT_EXISTS",
473
+ when: "File is already attached to this entity"
474
+ }
475
+ }
476
+ },
477
+ policy: {
478
+ auth: "user"
479
+ }
480
+ });
481
+ var DetachFileContract = defineCommand({
482
+ meta: {
483
+ key: "attachment.detach",
484
+ version: "1.0.0",
485
+ stability: "stable",
486
+ owners: [...OWNERS],
487
+ tags: ["files", "attachment", "detach"],
488
+ description: "Detach a file from an entity.",
489
+ goal: "Remove a file association.",
490
+ context: "Called when removing file from entity."
491
+ },
492
+ io: {
493
+ input: DetachFileInput,
494
+ output: SuccessOutput,
495
+ errors: {
496
+ ATTACHMENT_NOT_FOUND: {
497
+ description: "Attachment does not exist",
498
+ http: 404,
499
+ gqlCode: "ATTACHMENT_NOT_FOUND",
500
+ when: "Attachment ID is invalid"
501
+ }
502
+ }
503
+ },
504
+ policy: {
505
+ auth: "user"
506
+ }
507
+ });
508
+ var ListAttachmentsContract = defineQuery({
509
+ meta: {
510
+ key: "attachment.list",
511
+ version: "1.0.0",
512
+ stability: "stable",
513
+ owners: [...OWNERS],
514
+ tags: ["files", "attachment", "list"],
515
+ description: "List attachments for an entity.",
516
+ goal: "Get all files attached to an entity.",
517
+ context: "Called to display attached files."
518
+ },
519
+ io: {
520
+ input: ListAttachmentsInput,
521
+ output: ListAttachmentsOutput
522
+ },
523
+ policy: {
524
+ auth: "user"
525
+ }
526
+ });
527
+ var CreatePresignedUrlContract = defineCommand({
528
+ meta: {
529
+ key: "file.presignedUrl.create",
530
+ version: "1.0.0",
531
+ stability: "stable",
532
+ owners: [...OWNERS],
533
+ tags: ["files", "presigned", "upload"],
534
+ description: "Create a presigned URL for direct upload.",
535
+ goal: "Enable direct-to-storage uploads.",
536
+ context: "Called for large file uploads."
537
+ },
538
+ io: {
539
+ input: CreatePresignedUrlInput,
540
+ output: PresignedUrlModel,
541
+ errors: {
542
+ FILE_TOO_LARGE: {
543
+ description: "File exceeds size limit",
544
+ http: 413,
545
+ gqlCode: "FILE_TOO_LARGE",
546
+ when: "Requested file size exceeds limit"
547
+ },
548
+ INVALID_MIME_TYPE: {
549
+ description: "MIME type not allowed",
550
+ http: 415,
551
+ gqlCode: "INVALID_MIME_TYPE",
552
+ when: "File type is not in allowed list"
553
+ }
554
+ }
555
+ },
556
+ policy: {
557
+ auth: "user"
558
+ }
559
+ });
560
+ export {
561
+ UploadFileContract,
562
+ UpdateFileContract,
563
+ PresignedUrlModel,
564
+ ListFilesContract,
565
+ ListAttachmentsContract,
566
+ GetVersionsContract,
567
+ GetFileContract,
568
+ GetDownloadUrlContract,
569
+ FileVersionModel,
570
+ FileModel,
571
+ DetachFileContract,
572
+ DeleteFileContract,
573
+ CreateVersionContract,
574
+ CreatePresignedUrlContract,
575
+ AttachmentModel,
576
+ AttachFileContract
577
+ };