@contractspec/lib.files 1.44.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/events.js ADDED
@@ -0,0 +1,403 @@
1
+ import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
2
+ import { defineEvent } from "@contractspec/lib.contracts";
3
+
4
+ //#region src/events.ts
5
+ const FileUploadedPayload = defineSchemaModel({
6
+ name: "FileUploadedEventPayload",
7
+ description: "Payload when a file is uploaded",
8
+ fields: {
9
+ fileId: {
10
+ type: ScalarTypeEnum.String_unsecure(),
11
+ isOptional: false
12
+ },
13
+ name: {
14
+ type: ScalarTypeEnum.String_unsecure(),
15
+ isOptional: false
16
+ },
17
+ mimeType: {
18
+ type: ScalarTypeEnum.String_unsecure(),
19
+ isOptional: false
20
+ },
21
+ size: {
22
+ type: ScalarTypeEnum.Int_unsecure(),
23
+ isOptional: false
24
+ },
25
+ storageProvider: {
26
+ type: ScalarTypeEnum.String_unsecure(),
27
+ isOptional: false
28
+ },
29
+ ownerId: {
30
+ type: ScalarTypeEnum.String_unsecure(),
31
+ isOptional: false
32
+ },
33
+ orgId: {
34
+ type: ScalarTypeEnum.String_unsecure(),
35
+ isOptional: true
36
+ },
37
+ uploadedAt: {
38
+ type: ScalarTypeEnum.DateTime(),
39
+ isOptional: false
40
+ }
41
+ }
42
+ });
43
+ const FileUpdatedPayload = defineSchemaModel({
44
+ name: "FileUpdatedEventPayload",
45
+ description: "Payload when a file is updated",
46
+ fields: {
47
+ fileId: {
48
+ type: ScalarTypeEnum.String_unsecure(),
49
+ isOptional: false
50
+ },
51
+ name: {
52
+ type: ScalarTypeEnum.String_unsecure(),
53
+ isOptional: false
54
+ },
55
+ changes: {
56
+ type: ScalarTypeEnum.JSON(),
57
+ isOptional: false
58
+ },
59
+ updatedBy: {
60
+ type: ScalarTypeEnum.String_unsecure(),
61
+ isOptional: true
62
+ },
63
+ updatedAt: {
64
+ type: ScalarTypeEnum.DateTime(),
65
+ isOptional: false
66
+ }
67
+ }
68
+ });
69
+ const FileDeletedPayload = defineSchemaModel({
70
+ name: "FileDeletedEventPayload",
71
+ description: "Payload when a file is deleted",
72
+ fields: {
73
+ fileId: {
74
+ type: ScalarTypeEnum.String_unsecure(),
75
+ isOptional: false
76
+ },
77
+ name: {
78
+ type: ScalarTypeEnum.String_unsecure(),
79
+ isOptional: false
80
+ },
81
+ storageProvider: {
82
+ type: ScalarTypeEnum.String_unsecure(),
83
+ isOptional: false
84
+ },
85
+ storagePath: {
86
+ type: ScalarTypeEnum.String_unsecure(),
87
+ isOptional: false
88
+ },
89
+ deletedBy: {
90
+ type: ScalarTypeEnum.String_unsecure(),
91
+ isOptional: true
92
+ },
93
+ deletedAt: {
94
+ type: ScalarTypeEnum.DateTime(),
95
+ isOptional: false
96
+ }
97
+ }
98
+ });
99
+ const FileVersionCreatedPayload = defineSchemaModel({
100
+ name: "FileVersionCreatedEventPayload",
101
+ description: "Payload when a file version is created",
102
+ fields: {
103
+ fileId: {
104
+ type: ScalarTypeEnum.String_unsecure(),
105
+ isOptional: false
106
+ },
107
+ versionId: {
108
+ type: ScalarTypeEnum.String_unsecure(),
109
+ isOptional: false
110
+ },
111
+ version: {
112
+ type: ScalarTypeEnum.Int_unsecure(),
113
+ isOptional: false
114
+ },
115
+ size: {
116
+ type: ScalarTypeEnum.Int_unsecure(),
117
+ isOptional: false
118
+ },
119
+ createdBy: {
120
+ type: ScalarTypeEnum.String_unsecure(),
121
+ isOptional: false
122
+ },
123
+ comment: {
124
+ type: ScalarTypeEnum.String_unsecure(),
125
+ isOptional: true
126
+ },
127
+ createdAt: {
128
+ type: ScalarTypeEnum.DateTime(),
129
+ isOptional: false
130
+ }
131
+ }
132
+ });
133
+ const AttachmentAttachedPayload = defineSchemaModel({
134
+ name: "AttachmentAttachedEventPayload",
135
+ description: "Payload when a file is attached to an entity",
136
+ fields: {
137
+ attachmentId: {
138
+ type: ScalarTypeEnum.String_unsecure(),
139
+ isOptional: false
140
+ },
141
+ fileId: {
142
+ type: ScalarTypeEnum.String_unsecure(),
143
+ isOptional: false
144
+ },
145
+ entityType: {
146
+ type: ScalarTypeEnum.String_unsecure(),
147
+ isOptional: false
148
+ },
149
+ entityId: {
150
+ type: ScalarTypeEnum.String_unsecure(),
151
+ isOptional: false
152
+ },
153
+ attachmentType: {
154
+ type: ScalarTypeEnum.String_unsecure(),
155
+ isOptional: true
156
+ },
157
+ attachedBy: {
158
+ type: ScalarTypeEnum.String_unsecure(),
159
+ isOptional: false
160
+ },
161
+ attachedAt: {
162
+ type: ScalarTypeEnum.DateTime(),
163
+ isOptional: false
164
+ }
165
+ }
166
+ });
167
+ const AttachmentDetachedPayload = defineSchemaModel({
168
+ name: "AttachmentDetachedEventPayload",
169
+ description: "Payload when a file is detached from an entity",
170
+ fields: {
171
+ attachmentId: {
172
+ type: ScalarTypeEnum.String_unsecure(),
173
+ isOptional: false
174
+ },
175
+ fileId: {
176
+ type: ScalarTypeEnum.String_unsecure(),
177
+ isOptional: false
178
+ },
179
+ entityType: {
180
+ type: ScalarTypeEnum.String_unsecure(),
181
+ isOptional: false
182
+ },
183
+ entityId: {
184
+ type: ScalarTypeEnum.String_unsecure(),
185
+ isOptional: false
186
+ },
187
+ detachedBy: {
188
+ type: ScalarTypeEnum.String_unsecure(),
189
+ isOptional: true
190
+ },
191
+ detachedAt: {
192
+ type: ScalarTypeEnum.DateTime(),
193
+ isOptional: false
194
+ }
195
+ }
196
+ });
197
+ const UploadSessionStartedPayload = defineSchemaModel({
198
+ name: "UploadSessionStartedEventPayload",
199
+ description: "Payload when an upload session starts",
200
+ fields: {
201
+ sessionId: {
202
+ type: ScalarTypeEnum.String_unsecure(),
203
+ isOptional: false
204
+ },
205
+ fileName: {
206
+ type: ScalarTypeEnum.String_unsecure(),
207
+ isOptional: false
208
+ },
209
+ mimeType: {
210
+ type: ScalarTypeEnum.String_unsecure(),
211
+ isOptional: false
212
+ },
213
+ totalSize: {
214
+ type: ScalarTypeEnum.Int_unsecure(),
215
+ isOptional: false
216
+ },
217
+ ownerId: {
218
+ type: ScalarTypeEnum.String_unsecure(),
219
+ isOptional: false
220
+ },
221
+ startedAt: {
222
+ type: ScalarTypeEnum.DateTime(),
223
+ isOptional: false
224
+ }
225
+ }
226
+ });
227
+ const UploadSessionCompletedPayload = defineSchemaModel({
228
+ name: "UploadSessionCompletedEventPayload",
229
+ description: "Payload when an upload session completes",
230
+ fields: {
231
+ sessionId: {
232
+ type: ScalarTypeEnum.String_unsecure(),
233
+ isOptional: false
234
+ },
235
+ fileId: {
236
+ type: ScalarTypeEnum.String_unsecure(),
237
+ isOptional: false
238
+ },
239
+ fileName: {
240
+ type: ScalarTypeEnum.String_unsecure(),
241
+ isOptional: false
242
+ },
243
+ size: {
244
+ type: ScalarTypeEnum.Int_unsecure(),
245
+ isOptional: false
246
+ },
247
+ completedAt: {
248
+ type: ScalarTypeEnum.DateTime(),
249
+ isOptional: false
250
+ }
251
+ }
252
+ });
253
+ /**
254
+ * Emitted when a file is uploaded.
255
+ */
256
+ const FileUploadedEvent = defineEvent({
257
+ meta: {
258
+ key: "file.uploaded",
259
+ version: 1,
260
+ description: "A file has been uploaded.",
261
+ stability: "stable",
262
+ owners: ["@platform.files"],
263
+ tags: ["files", "upload"]
264
+ },
265
+ payload: FileUploadedPayload
266
+ });
267
+ /**
268
+ * Emitted when a file is updated.
269
+ */
270
+ const FileUpdatedEvent = defineEvent({
271
+ meta: {
272
+ key: "file.updated",
273
+ version: 1,
274
+ description: "A file has been updated.",
275
+ stability: "stable",
276
+ owners: ["@platform.files"],
277
+ tags: ["files", "update"]
278
+ },
279
+ payload: FileUpdatedPayload
280
+ });
281
+ /**
282
+ * Emitted when a file is deleted.
283
+ */
284
+ const FileDeletedEvent = defineEvent({
285
+ meta: {
286
+ key: "file.deleted",
287
+ version: 1,
288
+ description: "A file has been deleted.",
289
+ stability: "stable",
290
+ owners: ["@platform.files"],
291
+ tags: ["files", "delete"]
292
+ },
293
+ payload: FileDeletedPayload
294
+ });
295
+ /**
296
+ * Emitted when a file version is created.
297
+ */
298
+ const FileVersionCreatedEvent = defineEvent({
299
+ meta: {
300
+ key: "file.version_created",
301
+ version: 1,
302
+ description: "A new file version has been created.",
303
+ stability: "stable",
304
+ owners: ["@platform.files"],
305
+ tags: [
306
+ "files",
307
+ "version",
308
+ "create"
309
+ ]
310
+ },
311
+ payload: FileVersionCreatedPayload
312
+ });
313
+ /**
314
+ * Emitted when a file is attached to an entity.
315
+ */
316
+ const AttachmentAttachedEvent = defineEvent({
317
+ meta: {
318
+ key: "attachment.attached",
319
+ version: 1,
320
+ description: "A file has been attached to an entity.",
321
+ stability: "stable",
322
+ owners: ["@platform.files"],
323
+ tags: [
324
+ "files",
325
+ "attachment",
326
+ "attach"
327
+ ]
328
+ },
329
+ payload: AttachmentAttachedPayload
330
+ });
331
+ /**
332
+ * Emitted when a file is detached from an entity.
333
+ */
334
+ const AttachmentDetachedEvent = defineEvent({
335
+ meta: {
336
+ key: "attachment.detached",
337
+ version: 1,
338
+ description: "A file has been detached from an entity.",
339
+ stability: "stable",
340
+ owners: ["@platform.files"],
341
+ tags: [
342
+ "files",
343
+ "attachment",
344
+ "detach"
345
+ ]
346
+ },
347
+ payload: AttachmentDetachedPayload
348
+ });
349
+ /**
350
+ * Emitted when an upload session starts.
351
+ */
352
+ const UploadSessionStartedEvent = defineEvent({
353
+ meta: {
354
+ key: "upload.session_started",
355
+ version: 1,
356
+ description: "An upload session has started.",
357
+ stability: "stable",
358
+ owners: ["@platform.files"],
359
+ tags: [
360
+ "files",
361
+ "upload",
362
+ "session",
363
+ "start"
364
+ ]
365
+ },
366
+ payload: UploadSessionStartedPayload
367
+ });
368
+ /**
369
+ * Emitted when an upload session completes.
370
+ */
371
+ const UploadSessionCompletedEvent = defineEvent({
372
+ meta: {
373
+ key: "upload.session_completed",
374
+ version: 1,
375
+ description: "An upload session has completed.",
376
+ stability: "stable",
377
+ owners: ["@platform.files"],
378
+ tags: [
379
+ "files",
380
+ "upload",
381
+ "session",
382
+ "complete"
383
+ ]
384
+ },
385
+ payload: UploadSessionCompletedPayload
386
+ });
387
+ /**
388
+ * All file events.
389
+ */
390
+ const FileEvents = {
391
+ FileUploadedEvent,
392
+ FileUpdatedEvent,
393
+ FileDeletedEvent,
394
+ FileVersionCreatedEvent,
395
+ AttachmentAttachedEvent,
396
+ AttachmentDetachedEvent,
397
+ UploadSessionStartedEvent,
398
+ UploadSessionCompletedEvent
399
+ };
400
+
401
+ //#endregion
402
+ export { AttachmentAttachedEvent, AttachmentDetachedEvent, FileDeletedEvent, FileEvents, FileUpdatedEvent, FileUploadedEvent, FileVersionCreatedEvent, UploadSessionCompletedEvent, UploadSessionStartedEvent };
403
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","names":[],"sources":["../src/events.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\nimport { defineEvent } from '@contractspec/lib.contracts';\n\n// ============ Event Payloads ============\n\nconst FileUploadedPayload = defineSchemaModel({\n name: 'FileUploadedEventPayload',\n description: 'Payload when a file is uploaded',\n fields: {\n fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n mimeType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n size: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n storageProvider: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n uploadedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst FileUpdatedPayload = defineSchemaModel({\n name: 'FileUpdatedEventPayload',\n description: 'Payload when a file is updated',\n fields: {\n fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n changes: { type: ScalarTypeEnum.JSON(), isOptional: false },\n updatedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst FileDeletedPayload = defineSchemaModel({\n name: 'FileDeletedEventPayload',\n description: 'Payload when a file is deleted',\n fields: {\n fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n storageProvider: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n storagePath: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n deletedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n deletedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst FileVersionCreatedPayload = defineSchemaModel({\n name: 'FileVersionCreatedEventPayload',\n description: 'Payload when a file version is created',\n fields: {\n fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n versionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n version: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n size: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n createdBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n comment: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst AttachmentAttachedPayload = defineSchemaModel({\n name: 'AttachmentAttachedEventPayload',\n description: 'Payload when a file is attached to an entity',\n fields: {\n attachmentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n entityType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n entityId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n attachmentType: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n attachedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n attachedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst AttachmentDetachedPayload = defineSchemaModel({\n name: 'AttachmentDetachedEventPayload',\n description: 'Payload when a file is detached from an entity',\n fields: {\n attachmentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n entityType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n entityId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n detachedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n detachedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst UploadSessionStartedPayload = defineSchemaModel({\n name: 'UploadSessionStartedEventPayload',\n description: 'Payload when an upload session starts',\n fields: {\n sessionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n fileName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n mimeType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n totalSize: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst UploadSessionCompletedPayload = defineSchemaModel({\n name: 'UploadSessionCompletedEventPayload',\n description: 'Payload when an upload session completes',\n fields: {\n sessionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n fileName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n size: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n// ============ Events ============\n\n/**\n * Emitted when a file is uploaded.\n */\nexport const FileUploadedEvent = defineEvent({\n meta: {\n key: 'file.uploaded',\n version: 1,\n description: 'A file has been uploaded.',\n stability: 'stable',\n owners: ['@platform.files'],\n tags: ['files', 'upload'],\n },\n payload: FileUploadedPayload,\n});\n\n/**\n * Emitted when a file is updated.\n */\nexport const FileUpdatedEvent = defineEvent({\n meta: {\n key: 'file.updated',\n version: 1,\n description: 'A file has been updated.',\n stability: 'stable',\n owners: ['@platform.files'],\n tags: ['files', 'update'],\n },\n payload: FileUpdatedPayload,\n});\n\n/**\n * Emitted when a file is deleted.\n */\nexport const FileDeletedEvent = defineEvent({\n meta: {\n key: 'file.deleted',\n version: 1,\n description: 'A file has been deleted.',\n stability: 'stable',\n owners: ['@platform.files'],\n tags: ['files', 'delete'],\n },\n payload: FileDeletedPayload,\n});\n\n/**\n * Emitted when a file version is created.\n */\nexport const FileVersionCreatedEvent = defineEvent({\n meta: {\n key: 'file.version_created',\n version: 1,\n description: 'A new file version has been created.',\n stability: 'stable',\n owners: ['@platform.files'],\n tags: ['files', 'version', 'create'],\n },\n payload: FileVersionCreatedPayload,\n});\n\n/**\n * Emitted when a file is attached to an entity.\n */\nexport const AttachmentAttachedEvent = defineEvent({\n meta: {\n key: 'attachment.attached',\n version: 1,\n description: 'A file has been attached to an entity.',\n stability: 'stable',\n owners: ['@platform.files'],\n tags: ['files', 'attachment', 'attach'],\n },\n payload: AttachmentAttachedPayload,\n});\n\n/**\n * Emitted when a file is detached from an entity.\n */\nexport const AttachmentDetachedEvent = defineEvent({\n meta: {\n key: 'attachment.detached',\n version: 1,\n description: 'A file has been detached from an entity.',\n stability: 'stable',\n owners: ['@platform.files'],\n tags: ['files', 'attachment', 'detach'],\n },\n payload: AttachmentDetachedPayload,\n});\n\n/**\n * Emitted when an upload session starts.\n */\nexport const UploadSessionStartedEvent = defineEvent({\n meta: {\n key: 'upload.session_started',\n version: 1,\n description: 'An upload session has started.',\n stability: 'stable',\n owners: ['@platform.files'],\n tags: ['files', 'upload', 'session', 'start'],\n },\n payload: UploadSessionStartedPayload,\n});\n\n/**\n * Emitted when an upload session completes.\n */\nexport const UploadSessionCompletedEvent = defineEvent({\n meta: {\n key: 'upload.session_completed',\n version: 1,\n description: 'An upload session has completed.',\n stability: 'stable',\n owners: ['@platform.files'],\n tags: ['files', 'upload', 'session', 'complete'],\n },\n payload: UploadSessionCompletedPayload,\n});\n\n/**\n * All file events.\n */\nexport const FileEvents = {\n FileUploadedEvent,\n FileUpdatedEvent,\n FileDeletedEvent,\n FileVersionCreatedEvent,\n AttachmentAttachedEvent,\n AttachmentDetachedEvent,\n UploadSessionStartedEvent,\n UploadSessionCompletedEvent,\n};\n"],"mappings":";;;;AAKA,MAAM,sBAAsB,kBAAkB;CAC5C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,MAAM;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EAChE,iBAAiB;GACf,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,OAAO;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACnE,YAAY;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EACnE;CACF,CAAC;AAEF,MAAM,qBAAqB,kBAAkB;CAC3C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,SAAS;GAAE,MAAM,eAAe,MAAM;GAAE,YAAY;GAAO;EAC3D,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACvE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;AAEF,MAAM,qBAAqB,kBAAkB;CAC3C,MAAM;CACN,aA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AS;GAAU;GAAW;GAAQ;EAC9C;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,8BAA8B,YAAY;CACrD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,kBAAkB;EAC3B,MAAM;GAAC;GAAS;GAAU;GAAW;GAAW;EACjD;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,aAAa;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
@@ -0,0 +1,12 @@
1
+ import { FeatureModuleSpec } from "@contractspec/lib.contracts";
2
+
3
+ //#region src/files.feature.d.ts
4
+
5
+ /**
6
+ * Files feature module that bundles file upload, versioning,
7
+ * and attachment management capabilities.
8
+ */
9
+ declare const FilesFeature: FeatureModuleSpec;
10
+ //#endregion
11
+ export { FilesFeature };
12
+ //# sourceMappingURL=files.feature.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.feature.d.ts","names":[],"sources":["../src/files.feature.ts"],"sourcesContent":[],"mappings":";;;;;;;;cAWa,cAAc"}
@@ -0,0 +1,126 @@
1
+ //#region src/files.feature.ts
2
+ /**
3
+ * Files feature module that bundles file upload, versioning,
4
+ * and attachment management capabilities.
5
+ */
6
+ const FilesFeature = {
7
+ meta: {
8
+ key: "files",
9
+ version: 1,
10
+ title: "File Management",
11
+ description: "File upload, versioning, and attachment management with presigned URLs",
12
+ domain: "platform",
13
+ owners: ["@platform.files"],
14
+ tags: [
15
+ "files",
16
+ "upload",
17
+ "attachments",
18
+ "storage"
19
+ ],
20
+ stability: "stable"
21
+ },
22
+ operations: [
23
+ {
24
+ key: "file.upload",
25
+ version: 1
26
+ },
27
+ {
28
+ key: "file.update",
29
+ version: 1
30
+ },
31
+ {
32
+ key: "file.delete",
33
+ version: 1
34
+ },
35
+ {
36
+ key: "file.get",
37
+ version: 1
38
+ },
39
+ {
40
+ key: "file.list",
41
+ version: 1
42
+ },
43
+ {
44
+ key: "file.downloadUrl",
45
+ version: 1
46
+ },
47
+ {
48
+ key: "file.presignedUrl.create",
49
+ version: 1
50
+ },
51
+ {
52
+ key: "file.version.create",
53
+ version: 1
54
+ },
55
+ {
56
+ key: "file.version.list",
57
+ version: 1
58
+ },
59
+ {
60
+ key: "attachment.attach",
61
+ version: 1
62
+ },
63
+ {
64
+ key: "attachment.detach",
65
+ version: 1
66
+ },
67
+ {
68
+ key: "attachment.list",
69
+ version: 1
70
+ }
71
+ ],
72
+ events: [
73
+ {
74
+ key: "file.uploaded",
75
+ version: 1
76
+ },
77
+ {
78
+ key: "file.updated",
79
+ version: 1
80
+ },
81
+ {
82
+ key: "file.deleted",
83
+ version: 1
84
+ },
85
+ {
86
+ key: "file.version_created",
87
+ version: 1
88
+ },
89
+ {
90
+ key: "attachment.attached",
91
+ version: 1
92
+ },
93
+ {
94
+ key: "attachment.detached",
95
+ version: 1
96
+ },
97
+ {
98
+ key: "upload.session_started",
99
+ version: 1
100
+ },
101
+ {
102
+ key: "upload.session_completed",
103
+ version: 1
104
+ }
105
+ ],
106
+ presentations: [],
107
+ opToPresentation: [],
108
+ presentationsTargets: [],
109
+ capabilities: {
110
+ provides: [{
111
+ key: "files",
112
+ version: 1
113
+ }, {
114
+ key: "attachments",
115
+ version: 1
116
+ }],
117
+ requires: [{
118
+ key: "identity",
119
+ version: 1
120
+ }]
121
+ }
122
+ };
123
+
124
+ //#endregion
125
+ export { FilesFeature };
126
+ //# sourceMappingURL=files.feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.feature.js","names":["FilesFeature: FeatureModuleSpec"],"sources":["../src/files.feature.ts"],"sourcesContent":["/**\n * Files Feature Module Specification\n *\n * Defines the feature module for file management capabilities.\n */\nimport type { FeatureModuleSpec } from '@contractspec/lib.contracts';\n\n/**\n * Files feature module that bundles file upload, versioning,\n * and attachment management capabilities.\n */\nexport const FilesFeature: FeatureModuleSpec = {\n meta: {\n key: 'files',\n version: 1,\n title: 'File Management',\n description:\n 'File upload, versioning, and attachment management with presigned URLs',\n domain: 'platform',\n owners: ['@platform.files'],\n tags: ['files', 'upload', 'attachments', 'storage'],\n stability: 'stable',\n },\n\n // All contract operations included in this feature\n operations: [\n // File CRUD operations\n { key: 'file.upload', version: 1 },\n { key: 'file.update', version: 1 },\n { key: 'file.delete', version: 1 },\n { key: 'file.get', version: 1 },\n { key: 'file.list', version: 1 },\n { key: 'file.downloadUrl', version: 1 },\n { key: 'file.presignedUrl.create', version: 1 },\n\n // Version operations\n { key: 'file.version.create', version: 1 },\n { key: 'file.version.list', version: 1 },\n\n // Attachment operations\n { key: 'attachment.attach', version: 1 },\n { key: 'attachment.detach', version: 1 },\n { key: 'attachment.list', version: 1 },\n ],\n\n // Events emitted by this feature\n events: [\n // File events\n { key: 'file.uploaded', version: 1 },\n { key: 'file.updated', version: 1 },\n { key: 'file.deleted', version: 1 },\n { key: 'file.version_created', version: 1 },\n\n // Attachment events\n { key: 'attachment.attached', version: 1 },\n { key: 'attachment.detached', version: 1 },\n\n // Upload session events\n { key: 'upload.session_started', version: 1 },\n { key: 'upload.session_completed', version: 1 },\n ],\n\n // No presentations for this library feature\n presentations: [],\n opToPresentation: [],\n presentationsTargets: [],\n\n // Capability definitions\n capabilities: {\n provides: [\n { key: 'files', version: 1 },\n { key: 'attachments', version: 1 },\n ],\n requires: [{ key: 'identity', version: 1 }],\n },\n};\n"],"mappings":";;;;;AAWA,MAAaA,eAAkC;CAC7C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,QAAQ;EACR,QAAQ,CAAC,kBAAkB;EAC3B,MAAM;GAAC;GAAS;GAAU;GAAe;GAAU;EACnD,WAAW;EACZ;CAGD,YAAY;EAEV;GAAE,KAAK;GAAe,SAAS;GAAG;EAClC;GAAE,KAAK;GAAe,SAAS;GAAG;EAClC;GAAE,KAAK;GAAe,SAAS;GAAG;EAClC;GAAE,KAAK;GAAY,SAAS;GAAG;EAC/B;GAAE,KAAK;GAAa,SAAS;GAAG;EAChC;GAAE,KAAK;GAAoB,SAAS;GAAG;EACvC;GAAE,KAAK;GAA4B,SAAS;GAAG;EAG/C;GAAE,KAAK;GAAuB,SAAS;GAAG;EAC1C;GAAE,KAAK;GAAqB,SAAS;GAAG;EAGxC;GAAE,KAAK;GAAqB,SAAS;GAAG;EACxC;GAAE,KAAK;GAAqB,SAAS;GAAG;EACxC;GAAE,KAAK;GAAmB,SAAS;GAAG;EACvC;CAGD,QAAQ;EAEN;GAAE,KAAK;GAAiB,SAAS;GAAG;EACpC;GAAE,KAAK;GAAgB,SAAS;GAAG;EACnC;GAAE,KAAK;GAAgB,SAAS;GAAG;EACnC;GAAE,KAAK;GAAwB,SAAS;GAAG;EAG3C;GAAE,KAAK;GAAuB,SAAS;GAAG;EAC1C;GAAE,KAAK;GAAuB,SAAS;GAAG;EAG1C;GAAE,KAAK;GAA0B,SAAS;GAAG;EAC7C;GAAE,KAAK;GAA4B,SAAS;GAAG;EAChD;CAGD,eAAe,EAAE;CACjB,kBAAkB,EAAE;CACpB,sBAAsB,EAAE;CAGxB,cAAc;EACZ,UAAU,CACR;GAAE,KAAK;GAAS,SAAS;GAAG,EAC5B;GAAE,KAAK;GAAe,SAAS;GAAG,CACnC;EACD,UAAU,CAAC;GAAE,KAAK;GAAY,SAAS;GAAG,CAAC;EAC5C;CACF"}
@@ -0,0 +1,6 @@
1
+ import { AttachFileContract, AttachmentModel, CreatePresignedUrlContract, CreateVersionContract, DeleteFileContract, DetachFileContract, FileModel, FileVersionModel, GetDownloadUrlContract, GetFileContract, GetVersionsContract, ListAttachmentsContract, ListFilesContract, PresignedUrlModel, UpdateFileContract, UploadFileContract } from "./contracts/index.js";
2
+ import { AttachmentEntity, FileEntity, FileStatusEnum, FileVersionEntity, StorageProviderEnum, UploadSessionEntity, fileEntities, filesSchemaContribution } from "./entities/index.js";
3
+ import { AttachmentAttachedEvent, AttachmentDetachedEvent, FileDeletedEvent, FileEvents, FileUpdatedEvent, FileUploadedEvent, FileVersionCreatedEvent, UploadSessionCompletedEvent, UploadSessionStartedEvent } from "./events.js";
4
+ import { FilesFeature } from "./files.feature.js";
5
+ import { InMemoryStorageAdapter, ListOptions, ListResult, LocalStorageAdapter, LocalStorageOptions, PresignedDownloadOptions, PresignedUploadOptions, PresignedUrl, S3StorageAdapter, S3StorageOptions, StorageAdapter, StorageConfig, StorageFile, StorageProvider, UploadOptions, createStorageAdapter } from "./storage/index.js";
6
+ export { AttachFileContract, AttachmentAttachedEvent, AttachmentDetachedEvent, AttachmentEntity, AttachmentModel, CreatePresignedUrlContract, CreateVersionContract, DeleteFileContract, DetachFileContract, FileDeletedEvent, FileEntity, FileEvents, FileModel, FileStatusEnum, FileUpdatedEvent, FileUploadedEvent, FileVersionCreatedEvent, FileVersionEntity, FileVersionModel, FilesFeature, GetDownloadUrlContract, GetFileContract, GetVersionsContract, InMemoryStorageAdapter, ListAttachmentsContract, ListFilesContract, ListOptions, ListResult, LocalStorageAdapter, LocalStorageOptions, PresignedDownloadOptions, PresignedUploadOptions, PresignedUrl, PresignedUrlModel, S3StorageAdapter, S3StorageOptions, StorageAdapter, StorageConfig, StorageFile, StorageProvider, StorageProviderEnum, UpdateFileContract, UploadFileContract, UploadOptions, UploadSessionCompletedEvent, UploadSessionEntity, UploadSessionStartedEvent, createStorageAdapter, fileEntities, filesSchemaContribution };
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ import { AttachmentAttachedEvent, AttachmentDetachedEvent, FileDeletedEvent, FileEvents, FileUpdatedEvent, FileUploadedEvent, FileVersionCreatedEvent, UploadSessionCompletedEvent, UploadSessionStartedEvent } from "./events.js";
2
+ import { FilesFeature } from "./files.feature.js";
3
+ import { AttachmentEntity, FileEntity, FileStatusEnum, FileVersionEntity, StorageProviderEnum, UploadSessionEntity, fileEntities, filesSchemaContribution } from "./entities/index.js";
4
+ import { AttachFileContract, AttachmentModel, CreatePresignedUrlContract, CreateVersionContract, DeleteFileContract, DetachFileContract, FileModel, FileVersionModel, GetDownloadUrlContract, GetFileContract, GetVersionsContract, ListAttachmentsContract, ListFilesContract, PresignedUrlModel, UpdateFileContract, UploadFileContract } from "./contracts/index.js";
5
+ import { InMemoryStorageAdapter, LocalStorageAdapter, S3StorageAdapter, createStorageAdapter } from "./storage/index.js";
6
+ import "./docs/index.js";
7
+
8
+ export { AttachFileContract, AttachmentAttachedEvent, AttachmentDetachedEvent, AttachmentEntity, AttachmentModel, CreatePresignedUrlContract, CreateVersionContract, DeleteFileContract, DetachFileContract, FileDeletedEvent, FileEntity, FileEvents, FileModel, FileStatusEnum, FileUpdatedEvent, FileUploadedEvent, FileVersionCreatedEvent, FileVersionEntity, FileVersionModel, FilesFeature, GetDownloadUrlContract, GetFileContract, GetVersionsContract, InMemoryStorageAdapter, ListAttachmentsContract, ListFilesContract, LocalStorageAdapter, PresignedUrlModel, S3StorageAdapter, StorageProviderEnum, UpdateFileContract, UploadFileContract, UploadSessionCompletedEvent, UploadSessionEntity, UploadSessionStartedEvent, createStorageAdapter, fileEntities, filesSchemaContribution };