@contractspec/lib.files 1.56.1 → 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.
- package/dist/contracts/index.d.ts +1080 -1086
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +575 -854
- package/dist/docs/files.docblock.d.ts +2 -1
- package/dist/docs/files.docblock.d.ts.map +1 -0
- package/dist/docs/files.docblock.js +17 -22
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +66 -1
- package/dist/entities/index.d.ts +134 -139
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/index.js +228 -257
- package/dist/events.d.ts +357 -363
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +217 -400
- package/dist/files.capability.d.ts +2 -7
- package/dist/files.capability.d.ts.map +1 -1
- package/dist/files.capability.js +29 -25
- package/dist/files.feature.d.ts +1 -7
- package/dist/files.feature.d.ts.map +1 -1
- package/dist/files.feature.js +50 -131
- package/dist/index.d.ts +7 -6
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1411 -8
- package/dist/node/contracts/index.js +576 -0
- package/dist/node/docs/files.docblock.js +65 -0
- package/dist/node/docs/index.js +65 -0
- package/dist/node/entities/index.js +235 -0
- package/dist/node/events.js +219 -0
- package/dist/node/files.capability.js +28 -0
- package/dist/node/files.feature.js +51 -0
- package/dist/node/index.js +1410 -0
- package/dist/node/storage/index.js +268 -0
- package/dist/storage/index.d.ts +163 -166
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +266 -266
- package/package.json +104 -30
- package/dist/contracts/index.js.map +0 -1
- package/dist/docs/files.docblock.js.map +0 -1
- package/dist/entities/index.js.map +0 -1
- package/dist/events.js.map +0 -1
- package/dist/files.capability.js.map +0 -1
- package/dist/files.feature.js.map +0 -1
- package/dist/storage/index.js.map +0 -1
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
// src/entities/index.ts
|
|
2
|
+
import {
|
|
3
|
+
defineEntity,
|
|
4
|
+
defineEntityEnum,
|
|
5
|
+
field,
|
|
6
|
+
index
|
|
7
|
+
} from "@contractspec/lib.schema";
|
|
8
|
+
var StorageProviderEnum = defineEntityEnum({
|
|
9
|
+
name: "StorageProvider",
|
|
10
|
+
values: ["LOCAL", "S3", "GCS", "AZURE", "CLOUDFLARE"],
|
|
11
|
+
schema: "lssm_files",
|
|
12
|
+
description: "Storage backend provider."
|
|
13
|
+
});
|
|
14
|
+
var FileStatusEnum = defineEntityEnum({
|
|
15
|
+
name: "FileStatus",
|
|
16
|
+
values: [
|
|
17
|
+
"PENDING",
|
|
18
|
+
"UPLOADED",
|
|
19
|
+
"PROCESSING",
|
|
20
|
+
"READY",
|
|
21
|
+
"ERROR",
|
|
22
|
+
"DELETED"
|
|
23
|
+
],
|
|
24
|
+
schema: "lssm_files",
|
|
25
|
+
description: "File processing status."
|
|
26
|
+
});
|
|
27
|
+
var FileEntity = defineEntity({
|
|
28
|
+
name: "File",
|
|
29
|
+
description: "An uploaded file.",
|
|
30
|
+
schema: "lssm_files",
|
|
31
|
+
map: "file",
|
|
32
|
+
fields: {
|
|
33
|
+
id: field.id({ description: "Unique file identifier" }),
|
|
34
|
+
name: field.string({ description: "Original file name" }),
|
|
35
|
+
mimeType: field.string({ description: "MIME type" }),
|
|
36
|
+
size: field.int({ description: "File size in bytes" }),
|
|
37
|
+
storageProvider: field.enum("StorageProvider", {
|
|
38
|
+
default: "LOCAL",
|
|
39
|
+
description: "Storage backend"
|
|
40
|
+
}),
|
|
41
|
+
storagePath: field.string({ description: "Path in storage backend" }),
|
|
42
|
+
storageKey: field.string({
|
|
43
|
+
isOptional: true,
|
|
44
|
+
description: "Storage key/bucket"
|
|
45
|
+
}),
|
|
46
|
+
checksum: field.string({
|
|
47
|
+
isOptional: true,
|
|
48
|
+
description: "SHA-256 checksum"
|
|
49
|
+
}),
|
|
50
|
+
etag: field.string({ isOptional: true, description: "Storage ETag" }),
|
|
51
|
+
status: field.enum("FileStatus", {
|
|
52
|
+
default: "PENDING",
|
|
53
|
+
description: "File status"
|
|
54
|
+
}),
|
|
55
|
+
isPublic: field.boolean({
|
|
56
|
+
default: false,
|
|
57
|
+
description: "Whether file is publicly accessible"
|
|
58
|
+
}),
|
|
59
|
+
expiresAt: field.dateTime({
|
|
60
|
+
isOptional: true,
|
|
61
|
+
description: "Auto-delete timestamp"
|
|
62
|
+
}),
|
|
63
|
+
ownerId: field.string({ description: "User who uploaded" }),
|
|
64
|
+
orgId: field.string({
|
|
65
|
+
isOptional: true,
|
|
66
|
+
description: "Organization scope"
|
|
67
|
+
}),
|
|
68
|
+
metadata: field.json({
|
|
69
|
+
isOptional: true,
|
|
70
|
+
description: "Additional metadata"
|
|
71
|
+
}),
|
|
72
|
+
tags: field.json({
|
|
73
|
+
isOptional: true,
|
|
74
|
+
description: "Tags for categorization"
|
|
75
|
+
}),
|
|
76
|
+
width: field.int({
|
|
77
|
+
isOptional: true,
|
|
78
|
+
description: "Image width in pixels"
|
|
79
|
+
}),
|
|
80
|
+
height: field.int({
|
|
81
|
+
isOptional: true,
|
|
82
|
+
description: "Image height in pixels"
|
|
83
|
+
}),
|
|
84
|
+
createdAt: field.createdAt(),
|
|
85
|
+
updatedAt: field.updatedAt(),
|
|
86
|
+
versions: field.hasMany("FileVersion"),
|
|
87
|
+
attachments: field.hasMany("Attachment")
|
|
88
|
+
},
|
|
89
|
+
indexes: [
|
|
90
|
+
index.on(["ownerId"]),
|
|
91
|
+
index.on(["orgId"]),
|
|
92
|
+
index.on(["status"]),
|
|
93
|
+
index.on(["mimeType"]),
|
|
94
|
+
index.on(["storageProvider", "storagePath"])
|
|
95
|
+
],
|
|
96
|
+
enums: [StorageProviderEnum, FileStatusEnum]
|
|
97
|
+
});
|
|
98
|
+
var FileVersionEntity = defineEntity({
|
|
99
|
+
name: "FileVersion",
|
|
100
|
+
description: "A version of a file.",
|
|
101
|
+
schema: "lssm_files",
|
|
102
|
+
map: "file_version",
|
|
103
|
+
fields: {
|
|
104
|
+
id: field.id({ description: "Unique version identifier" }),
|
|
105
|
+
fileId: field.foreignKey({ description: "Parent file" }),
|
|
106
|
+
version: field.int({ description: "Version number" }),
|
|
107
|
+
size: field.int({ description: "Version size in bytes" }),
|
|
108
|
+
storagePath: field.string({ description: "Path in storage backend" }),
|
|
109
|
+
checksum: field.string({
|
|
110
|
+
isOptional: true,
|
|
111
|
+
description: "SHA-256 checksum"
|
|
112
|
+
}),
|
|
113
|
+
comment: field.string({ isOptional: true, description: "Version comment" }),
|
|
114
|
+
changes: field.json({
|
|
115
|
+
isOptional: true,
|
|
116
|
+
description: "Change description"
|
|
117
|
+
}),
|
|
118
|
+
createdBy: field.string({ description: "User who created version" }),
|
|
119
|
+
createdAt: field.createdAt(),
|
|
120
|
+
file: field.belongsTo("File", ["fileId"], ["id"], { onDelete: "Cascade" })
|
|
121
|
+
},
|
|
122
|
+
indexes: [
|
|
123
|
+
index.on(["fileId", "version"]),
|
|
124
|
+
index.unique(["fileId", "version"], { name: "file_version_unique" })
|
|
125
|
+
]
|
|
126
|
+
});
|
|
127
|
+
var AttachmentEntity = defineEntity({
|
|
128
|
+
name: "Attachment",
|
|
129
|
+
description: "Links a file to an entity.",
|
|
130
|
+
schema: "lssm_files",
|
|
131
|
+
map: "attachment",
|
|
132
|
+
fields: {
|
|
133
|
+
id: field.id({ description: "Unique attachment identifier" }),
|
|
134
|
+
fileId: field.foreignKey({ description: "Attached file" }),
|
|
135
|
+
entityType: field.string({
|
|
136
|
+
description: "Target entity type (deal, listing, etc.)"
|
|
137
|
+
}),
|
|
138
|
+
entityId: field.string({ description: "Target entity ID" }),
|
|
139
|
+
attachmentType: field.string({
|
|
140
|
+
isOptional: true,
|
|
141
|
+
description: "Type of attachment (document, image, avatar, etc.)"
|
|
142
|
+
}),
|
|
143
|
+
name: field.string({
|
|
144
|
+
isOptional: true,
|
|
145
|
+
description: "Display name (overrides file name)"
|
|
146
|
+
}),
|
|
147
|
+
description: field.string({
|
|
148
|
+
isOptional: true,
|
|
149
|
+
description: "Attachment description"
|
|
150
|
+
}),
|
|
151
|
+
order: field.int({ default: 0, description: "Display order" }),
|
|
152
|
+
metadata: field.json({
|
|
153
|
+
isOptional: true,
|
|
154
|
+
description: "Attachment-specific metadata"
|
|
155
|
+
}),
|
|
156
|
+
createdBy: field.string({ description: "User who created attachment" }),
|
|
157
|
+
createdAt: field.createdAt(),
|
|
158
|
+
updatedAt: field.updatedAt(),
|
|
159
|
+
file: field.belongsTo("File", ["fileId"], ["id"], { onDelete: "Cascade" })
|
|
160
|
+
},
|
|
161
|
+
indexes: [
|
|
162
|
+
index.on(["entityType", "entityId"]),
|
|
163
|
+
index.on(["fileId"]),
|
|
164
|
+
index.on(["entityType", "entityId", "attachmentType"]),
|
|
165
|
+
index.unique(["fileId", "entityType", "entityId"], {
|
|
166
|
+
name: "attachment_unique"
|
|
167
|
+
})
|
|
168
|
+
]
|
|
169
|
+
});
|
|
170
|
+
var UploadSessionEntity = defineEntity({
|
|
171
|
+
name: "UploadSession",
|
|
172
|
+
description: "Tracks a multipart upload session.",
|
|
173
|
+
schema: "lssm_files",
|
|
174
|
+
map: "upload_session",
|
|
175
|
+
fields: {
|
|
176
|
+
id: field.id({ description: "Unique session identifier" }),
|
|
177
|
+
fileName: field.string({ description: "Target file name" }),
|
|
178
|
+
mimeType: field.string({ description: "Expected MIME type" }),
|
|
179
|
+
totalSize: field.int({ description: "Total file size" }),
|
|
180
|
+
uploadId: field.string({
|
|
181
|
+
isOptional: true,
|
|
182
|
+
description: "Storage upload ID"
|
|
183
|
+
}),
|
|
184
|
+
uploadedBytes: field.int({
|
|
185
|
+
default: 0,
|
|
186
|
+
description: "Bytes uploaded so far"
|
|
187
|
+
}),
|
|
188
|
+
uploadedParts: field.json({
|
|
189
|
+
isOptional: true,
|
|
190
|
+
description: "Completed part info"
|
|
191
|
+
}),
|
|
192
|
+
status: field.string({
|
|
193
|
+
default: '"pending"',
|
|
194
|
+
description: "Session status"
|
|
195
|
+
}),
|
|
196
|
+
error: field.string({
|
|
197
|
+
isOptional: true,
|
|
198
|
+
description: "Error message if failed"
|
|
199
|
+
}),
|
|
200
|
+
fileId: field.string({
|
|
201
|
+
isOptional: true,
|
|
202
|
+
description: "Resulting file ID"
|
|
203
|
+
}),
|
|
204
|
+
ownerId: field.string({ description: "User who initiated upload" }),
|
|
205
|
+
orgId: field.string({
|
|
206
|
+
isOptional: true,
|
|
207
|
+
description: "Organization scope"
|
|
208
|
+
}),
|
|
209
|
+
expiresAt: field.dateTime({ description: "Session expiry time" }),
|
|
210
|
+
createdAt: field.createdAt(),
|
|
211
|
+
updatedAt: field.updatedAt()
|
|
212
|
+
},
|
|
213
|
+
indexes: [index.on(["status", "expiresAt"]), index.on(["ownerId"])]
|
|
214
|
+
});
|
|
215
|
+
var fileEntities = [
|
|
216
|
+
FileEntity,
|
|
217
|
+
FileVersionEntity,
|
|
218
|
+
AttachmentEntity,
|
|
219
|
+
UploadSessionEntity
|
|
220
|
+
];
|
|
221
|
+
var filesSchemaContribution = {
|
|
222
|
+
moduleId: "@contractspec/lib.files",
|
|
223
|
+
entities: fileEntities,
|
|
224
|
+
enums: [StorageProviderEnum, FileStatusEnum]
|
|
225
|
+
};
|
|
226
|
+
export {
|
|
227
|
+
filesSchemaContribution,
|
|
228
|
+
fileEntities,
|
|
229
|
+
UploadSessionEntity,
|
|
230
|
+
StorageProviderEnum,
|
|
231
|
+
FileVersionEntity,
|
|
232
|
+
FileStatusEnum,
|
|
233
|
+
FileEntity,
|
|
234
|
+
AttachmentEntity
|
|
235
|
+
};
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
// src/events.ts
|
|
2
|
+
import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
|
|
3
|
+
import { defineEvent } from "@contractspec/lib.contracts";
|
|
4
|
+
var FileUploadedPayload = defineSchemaModel({
|
|
5
|
+
name: "FileUploadedEventPayload",
|
|
6
|
+
description: "Payload when a file is uploaded",
|
|
7
|
+
fields: {
|
|
8
|
+
fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
9
|
+
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
10
|
+
mimeType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
11
|
+
size: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
12
|
+
storageProvider: {
|
|
13
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
14
|
+
isOptional: false
|
|
15
|
+
},
|
|
16
|
+
ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
17
|
+
orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
18
|
+
uploadedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
var FileUpdatedPayload = defineSchemaModel({
|
|
22
|
+
name: "FileUpdatedEventPayload",
|
|
23
|
+
description: "Payload when a file is updated",
|
|
24
|
+
fields: {
|
|
25
|
+
fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
26
|
+
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
27
|
+
changes: { type: ScalarTypeEnum.JSON(), isOptional: false },
|
|
28
|
+
updatedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
29
|
+
updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
var FileDeletedPayload = defineSchemaModel({
|
|
33
|
+
name: "FileDeletedEventPayload",
|
|
34
|
+
description: "Payload when a file is deleted",
|
|
35
|
+
fields: {
|
|
36
|
+
fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
37
|
+
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
38
|
+
storageProvider: {
|
|
39
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
40
|
+
isOptional: false
|
|
41
|
+
},
|
|
42
|
+
storagePath: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
43
|
+
deletedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
44
|
+
deletedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
var FileVersionCreatedPayload = defineSchemaModel({
|
|
48
|
+
name: "FileVersionCreatedEventPayload",
|
|
49
|
+
description: "Payload when a file version is created",
|
|
50
|
+
fields: {
|
|
51
|
+
fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
52
|
+
versionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
53
|
+
version: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
54
|
+
size: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
55
|
+
createdBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
56
|
+
comment: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
57
|
+
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
var AttachmentAttachedPayload = defineSchemaModel({
|
|
61
|
+
name: "AttachmentAttachedEventPayload",
|
|
62
|
+
description: "Payload when a file is attached to an entity",
|
|
63
|
+
fields: {
|
|
64
|
+
attachmentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
65
|
+
fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
66
|
+
entityType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
67
|
+
entityId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
68
|
+
attachmentType: {
|
|
69
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
70
|
+
isOptional: true
|
|
71
|
+
},
|
|
72
|
+
attachedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
73
|
+
attachedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
var AttachmentDetachedPayload = defineSchemaModel({
|
|
77
|
+
name: "AttachmentDetachedEventPayload",
|
|
78
|
+
description: "Payload when a file is detached from an entity",
|
|
79
|
+
fields: {
|
|
80
|
+
attachmentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
81
|
+
fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
82
|
+
entityType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
83
|
+
entityId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
84
|
+
detachedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
85
|
+
detachedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
var UploadSessionStartedPayload = defineSchemaModel({
|
|
89
|
+
name: "UploadSessionStartedEventPayload",
|
|
90
|
+
description: "Payload when an upload session starts",
|
|
91
|
+
fields: {
|
|
92
|
+
sessionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
93
|
+
fileName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
94
|
+
mimeType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
95
|
+
totalSize: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
96
|
+
ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
97
|
+
startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
var UploadSessionCompletedPayload = defineSchemaModel({
|
|
101
|
+
name: "UploadSessionCompletedEventPayload",
|
|
102
|
+
description: "Payload when an upload session completes",
|
|
103
|
+
fields: {
|
|
104
|
+
sessionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
105
|
+
fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
106
|
+
fileName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
107
|
+
size: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
108
|
+
completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
var FileUploadedEvent = defineEvent({
|
|
112
|
+
meta: {
|
|
113
|
+
key: "file.uploaded",
|
|
114
|
+
version: "1.0.0",
|
|
115
|
+
description: "A file has been uploaded.",
|
|
116
|
+
stability: "stable",
|
|
117
|
+
owners: ["@platform.files"],
|
|
118
|
+
tags: ["files", "upload"]
|
|
119
|
+
},
|
|
120
|
+
payload: FileUploadedPayload
|
|
121
|
+
});
|
|
122
|
+
var FileUpdatedEvent = defineEvent({
|
|
123
|
+
meta: {
|
|
124
|
+
key: "file.updated",
|
|
125
|
+
version: "1.0.0",
|
|
126
|
+
description: "A file has been updated.",
|
|
127
|
+
stability: "stable",
|
|
128
|
+
owners: ["@platform.files"],
|
|
129
|
+
tags: ["files", "update"]
|
|
130
|
+
},
|
|
131
|
+
payload: FileUpdatedPayload
|
|
132
|
+
});
|
|
133
|
+
var FileDeletedEvent = defineEvent({
|
|
134
|
+
meta: {
|
|
135
|
+
key: "file.deleted",
|
|
136
|
+
version: "1.0.0",
|
|
137
|
+
description: "A file has been deleted.",
|
|
138
|
+
stability: "stable",
|
|
139
|
+
owners: ["@platform.files"],
|
|
140
|
+
tags: ["files", "delete"]
|
|
141
|
+
},
|
|
142
|
+
payload: FileDeletedPayload
|
|
143
|
+
});
|
|
144
|
+
var FileVersionCreatedEvent = defineEvent({
|
|
145
|
+
meta: {
|
|
146
|
+
key: "file.version_created",
|
|
147
|
+
version: "1.0.0",
|
|
148
|
+
description: "A new file version has been created.",
|
|
149
|
+
stability: "stable",
|
|
150
|
+
owners: ["@platform.files"],
|
|
151
|
+
tags: ["files", "version", "create"]
|
|
152
|
+
},
|
|
153
|
+
payload: FileVersionCreatedPayload
|
|
154
|
+
});
|
|
155
|
+
var AttachmentAttachedEvent = defineEvent({
|
|
156
|
+
meta: {
|
|
157
|
+
key: "attachment.attached",
|
|
158
|
+
version: "1.0.0",
|
|
159
|
+
description: "A file has been attached to an entity.",
|
|
160
|
+
stability: "stable",
|
|
161
|
+
owners: ["@platform.files"],
|
|
162
|
+
tags: ["files", "attachment", "attach"]
|
|
163
|
+
},
|
|
164
|
+
payload: AttachmentAttachedPayload
|
|
165
|
+
});
|
|
166
|
+
var AttachmentDetachedEvent = defineEvent({
|
|
167
|
+
meta: {
|
|
168
|
+
key: "attachment.detached",
|
|
169
|
+
version: "1.0.0",
|
|
170
|
+
description: "A file has been detached from an entity.",
|
|
171
|
+
stability: "stable",
|
|
172
|
+
owners: ["@platform.files"],
|
|
173
|
+
tags: ["files", "attachment", "detach"]
|
|
174
|
+
},
|
|
175
|
+
payload: AttachmentDetachedPayload
|
|
176
|
+
});
|
|
177
|
+
var UploadSessionStartedEvent = defineEvent({
|
|
178
|
+
meta: {
|
|
179
|
+
key: "upload.session_started",
|
|
180
|
+
version: "1.0.0",
|
|
181
|
+
description: "An upload session has started.",
|
|
182
|
+
stability: "stable",
|
|
183
|
+
owners: ["@platform.files"],
|
|
184
|
+
tags: ["files", "upload", "session", "start"]
|
|
185
|
+
},
|
|
186
|
+
payload: UploadSessionStartedPayload
|
|
187
|
+
});
|
|
188
|
+
var UploadSessionCompletedEvent = defineEvent({
|
|
189
|
+
meta: {
|
|
190
|
+
key: "upload.session_completed",
|
|
191
|
+
version: "1.0.0",
|
|
192
|
+
description: "An upload session has completed.",
|
|
193
|
+
stability: "stable",
|
|
194
|
+
owners: ["@platform.files"],
|
|
195
|
+
tags: ["files", "upload", "session", "complete"]
|
|
196
|
+
},
|
|
197
|
+
payload: UploadSessionCompletedPayload
|
|
198
|
+
});
|
|
199
|
+
var FileEvents = {
|
|
200
|
+
FileUploadedEvent,
|
|
201
|
+
FileUpdatedEvent,
|
|
202
|
+
FileDeletedEvent,
|
|
203
|
+
FileVersionCreatedEvent,
|
|
204
|
+
AttachmentAttachedEvent,
|
|
205
|
+
AttachmentDetachedEvent,
|
|
206
|
+
UploadSessionStartedEvent,
|
|
207
|
+
UploadSessionCompletedEvent
|
|
208
|
+
};
|
|
209
|
+
export {
|
|
210
|
+
UploadSessionStartedEvent,
|
|
211
|
+
UploadSessionCompletedEvent,
|
|
212
|
+
FileVersionCreatedEvent,
|
|
213
|
+
FileUploadedEvent,
|
|
214
|
+
FileUpdatedEvent,
|
|
215
|
+
FileEvents,
|
|
216
|
+
FileDeletedEvent,
|
|
217
|
+
AttachmentDetachedEvent,
|
|
218
|
+
AttachmentAttachedEvent
|
|
219
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// src/files.capability.ts
|
|
2
|
+
import { defineCapability, StabilityEnum } from "@contractspec/lib.contracts";
|
|
3
|
+
var FilesCapability = defineCapability({
|
|
4
|
+
meta: {
|
|
5
|
+
key: "files",
|
|
6
|
+
version: "1.0.0",
|
|
7
|
+
kind: "data",
|
|
8
|
+
stability: StabilityEnum.Experimental,
|
|
9
|
+
description: "File storage and management",
|
|
10
|
+
owners: ["@platform.core"],
|
|
11
|
+
tags: ["files", "storage"]
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
var AttachmentsCapability = defineCapability({
|
|
15
|
+
meta: {
|
|
16
|
+
key: "attachments",
|
|
17
|
+
version: "1.0.0",
|
|
18
|
+
kind: "data",
|
|
19
|
+
stability: StabilityEnum.Experimental,
|
|
20
|
+
description: "File attachments for entities",
|
|
21
|
+
owners: ["@platform.core"],
|
|
22
|
+
tags: ["attachments", "files"]
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
export {
|
|
26
|
+
FilesCapability,
|
|
27
|
+
AttachmentsCapability
|
|
28
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// src/files.feature.ts
|
|
2
|
+
import { defineFeature } from "@contractspec/lib.contracts";
|
|
3
|
+
var FilesFeature = defineFeature({
|
|
4
|
+
meta: {
|
|
5
|
+
key: "files",
|
|
6
|
+
version: "1.0.0",
|
|
7
|
+
title: "File Management",
|
|
8
|
+
description: "File storage, attachments, and media processing with presigned URLs",
|
|
9
|
+
domain: "platform",
|
|
10
|
+
owners: ["@platform.files"],
|
|
11
|
+
tags: ["files", "upload", "attachments", "storage"],
|
|
12
|
+
stability: "stable"
|
|
13
|
+
},
|
|
14
|
+
operations: [
|
|
15
|
+
{ key: "file.upload", version: "1.0.0" },
|
|
16
|
+
{ key: "file.update", version: "1.0.0" },
|
|
17
|
+
{ key: "file.delete", version: "1.0.0" },
|
|
18
|
+
{ key: "file.get", version: "1.0.0" },
|
|
19
|
+
{ key: "file.list", version: "1.0.0" },
|
|
20
|
+
{ key: "file.downloadUrl", version: "1.0.0" },
|
|
21
|
+
{ key: "file.presignedUrl.create", version: "1.0.0" },
|
|
22
|
+
{ key: "file.version.create", version: "1.0.0" },
|
|
23
|
+
{ key: "file.version.list", version: "1.0.0" },
|
|
24
|
+
{ key: "attachment.attach", version: "1.0.0" },
|
|
25
|
+
{ key: "attachment.detach", version: "1.0.0" },
|
|
26
|
+
{ key: "attachment.list", version: "1.0.0" }
|
|
27
|
+
],
|
|
28
|
+
events: [
|
|
29
|
+
{ key: "file.uploaded", version: "1.0.0" },
|
|
30
|
+
{ key: "file.updated", version: "1.0.0" },
|
|
31
|
+
{ key: "file.deleted", version: "1.0.0" },
|
|
32
|
+
{ key: "file.version_created", version: "1.0.0" },
|
|
33
|
+
{ key: "attachment.attached", version: "1.0.0" },
|
|
34
|
+
{ key: "attachment.detached", version: "1.0.0" },
|
|
35
|
+
{ key: "upload.session_started", version: "1.0.0" },
|
|
36
|
+
{ key: "upload.session_completed", version: "1.0.0" }
|
|
37
|
+
],
|
|
38
|
+
presentations: [],
|
|
39
|
+
opToPresentation: [],
|
|
40
|
+
presentationsTargets: [],
|
|
41
|
+
capabilities: {
|
|
42
|
+
provides: [
|
|
43
|
+
{ key: "files", version: "1.0.0" },
|
|
44
|
+
{ key: "attachments", version: "1.0.0" }
|
|
45
|
+
],
|
|
46
|
+
requires: [{ key: "identity", version: "1.0.0" }]
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
export {
|
|
50
|
+
FilesFeature
|
|
51
|
+
};
|