@contractspec/lib.files 1.57.0 → 1.59.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 -6
- 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
package/dist/entities/index.js
CHANGED
|
@@ -1,265 +1,236 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"CLOUDFLARE"
|
|
15
|
-
],
|
|
16
|
-
schema: "lssm_files",
|
|
17
|
-
description: "Storage backend provider."
|
|
1
|
+
// @bun
|
|
2
|
+
// src/entities/index.ts
|
|
3
|
+
import {
|
|
4
|
+
defineEntity,
|
|
5
|
+
defineEntityEnum,
|
|
6
|
+
field,
|
|
7
|
+
index
|
|
8
|
+
} from "@contractspec/lib.schema";
|
|
9
|
+
var StorageProviderEnum = defineEntityEnum({
|
|
10
|
+
name: "StorageProvider",
|
|
11
|
+
values: ["LOCAL", "S3", "GCS", "AZURE", "CLOUDFLARE"],
|
|
12
|
+
schema: "lssm_files",
|
|
13
|
+
description: "Storage backend provider."
|
|
18
14
|
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
],
|
|
32
|
-
schema: "lssm_files",
|
|
33
|
-
description: "File processing status."
|
|
15
|
+
var FileStatusEnum = defineEntityEnum({
|
|
16
|
+
name: "FileStatus",
|
|
17
|
+
values: [
|
|
18
|
+
"PENDING",
|
|
19
|
+
"UPLOADED",
|
|
20
|
+
"PROCESSING",
|
|
21
|
+
"READY",
|
|
22
|
+
"ERROR",
|
|
23
|
+
"DELETED"
|
|
24
|
+
],
|
|
25
|
+
schema: "lssm_files",
|
|
26
|
+
description: "File processing status."
|
|
34
27
|
});
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
index.on(["orgId"]),
|
|
106
|
-
index.on(["status"]),
|
|
107
|
-
index.on(["mimeType"]),
|
|
108
|
-
index.on(["storageProvider", "storagePath"])
|
|
109
|
-
],
|
|
110
|
-
enums: [StorageProviderEnum, FileStatusEnum]
|
|
28
|
+
var FileEntity = defineEntity({
|
|
29
|
+
name: "File",
|
|
30
|
+
description: "An uploaded file.",
|
|
31
|
+
schema: "lssm_files",
|
|
32
|
+
map: "file",
|
|
33
|
+
fields: {
|
|
34
|
+
id: field.id({ description: "Unique file identifier" }),
|
|
35
|
+
name: field.string({ description: "Original file name" }),
|
|
36
|
+
mimeType: field.string({ description: "MIME type" }),
|
|
37
|
+
size: field.int({ description: "File size in bytes" }),
|
|
38
|
+
storageProvider: field.enum("StorageProvider", {
|
|
39
|
+
default: "LOCAL",
|
|
40
|
+
description: "Storage backend"
|
|
41
|
+
}),
|
|
42
|
+
storagePath: field.string({ description: "Path in storage backend" }),
|
|
43
|
+
storageKey: field.string({
|
|
44
|
+
isOptional: true,
|
|
45
|
+
description: "Storage key/bucket"
|
|
46
|
+
}),
|
|
47
|
+
checksum: field.string({
|
|
48
|
+
isOptional: true,
|
|
49
|
+
description: "SHA-256 checksum"
|
|
50
|
+
}),
|
|
51
|
+
etag: field.string({ isOptional: true, description: "Storage ETag" }),
|
|
52
|
+
status: field.enum("FileStatus", {
|
|
53
|
+
default: "PENDING",
|
|
54
|
+
description: "File status"
|
|
55
|
+
}),
|
|
56
|
+
isPublic: field.boolean({
|
|
57
|
+
default: false,
|
|
58
|
+
description: "Whether file is publicly accessible"
|
|
59
|
+
}),
|
|
60
|
+
expiresAt: field.dateTime({
|
|
61
|
+
isOptional: true,
|
|
62
|
+
description: "Auto-delete timestamp"
|
|
63
|
+
}),
|
|
64
|
+
ownerId: field.string({ description: "User who uploaded" }),
|
|
65
|
+
orgId: field.string({
|
|
66
|
+
isOptional: true,
|
|
67
|
+
description: "Organization scope"
|
|
68
|
+
}),
|
|
69
|
+
metadata: field.json({
|
|
70
|
+
isOptional: true,
|
|
71
|
+
description: "Additional metadata"
|
|
72
|
+
}),
|
|
73
|
+
tags: field.json({
|
|
74
|
+
isOptional: true,
|
|
75
|
+
description: "Tags for categorization"
|
|
76
|
+
}),
|
|
77
|
+
width: field.int({
|
|
78
|
+
isOptional: true,
|
|
79
|
+
description: "Image width in pixels"
|
|
80
|
+
}),
|
|
81
|
+
height: field.int({
|
|
82
|
+
isOptional: true,
|
|
83
|
+
description: "Image height in pixels"
|
|
84
|
+
}),
|
|
85
|
+
createdAt: field.createdAt(),
|
|
86
|
+
updatedAt: field.updatedAt(),
|
|
87
|
+
versions: field.hasMany("FileVersion"),
|
|
88
|
+
attachments: field.hasMany("Attachment")
|
|
89
|
+
},
|
|
90
|
+
indexes: [
|
|
91
|
+
index.on(["ownerId"]),
|
|
92
|
+
index.on(["orgId"]),
|
|
93
|
+
index.on(["status"]),
|
|
94
|
+
index.on(["mimeType"]),
|
|
95
|
+
index.on(["storageProvider", "storagePath"])
|
|
96
|
+
],
|
|
97
|
+
enums: [StorageProviderEnum, FileStatusEnum]
|
|
111
98
|
});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
file: field.belongsTo("File", ["fileId"], ["id"], { onDelete: "Cascade" })
|
|
141
|
-
},
|
|
142
|
-
indexes: [index.on(["fileId", "version"]), index.unique(["fileId", "version"], { name: "file_version_unique" })]
|
|
99
|
+
var FileVersionEntity = defineEntity({
|
|
100
|
+
name: "FileVersion",
|
|
101
|
+
description: "A version of a file.",
|
|
102
|
+
schema: "lssm_files",
|
|
103
|
+
map: "file_version",
|
|
104
|
+
fields: {
|
|
105
|
+
id: field.id({ description: "Unique version identifier" }),
|
|
106
|
+
fileId: field.foreignKey({ description: "Parent file" }),
|
|
107
|
+
version: field.int({ description: "Version number" }),
|
|
108
|
+
size: field.int({ description: "Version size in bytes" }),
|
|
109
|
+
storagePath: field.string({ description: "Path in storage backend" }),
|
|
110
|
+
checksum: field.string({
|
|
111
|
+
isOptional: true,
|
|
112
|
+
description: "SHA-256 checksum"
|
|
113
|
+
}),
|
|
114
|
+
comment: field.string({ isOptional: true, description: "Version comment" }),
|
|
115
|
+
changes: field.json({
|
|
116
|
+
isOptional: true,
|
|
117
|
+
description: "Change description"
|
|
118
|
+
}),
|
|
119
|
+
createdBy: field.string({ description: "User who created version" }),
|
|
120
|
+
createdAt: field.createdAt(),
|
|
121
|
+
file: field.belongsTo("File", ["fileId"], ["id"], { onDelete: "Cascade" })
|
|
122
|
+
},
|
|
123
|
+
indexes: [
|
|
124
|
+
index.on(["fileId", "version"]),
|
|
125
|
+
index.unique(["fileId", "version"], { name: "file_version_unique" })
|
|
126
|
+
]
|
|
143
127
|
});
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
"entityType",
|
|
187
|
-
"entityId",
|
|
188
|
-
"attachmentType"
|
|
189
|
-
]),
|
|
190
|
-
index.unique([
|
|
191
|
-
"fileId",
|
|
192
|
-
"entityType",
|
|
193
|
-
"entityId"
|
|
194
|
-
], { name: "attachment_unique" })
|
|
195
|
-
]
|
|
128
|
+
var AttachmentEntity = defineEntity({
|
|
129
|
+
name: "Attachment",
|
|
130
|
+
description: "Links a file to an entity.",
|
|
131
|
+
schema: "lssm_files",
|
|
132
|
+
map: "attachment",
|
|
133
|
+
fields: {
|
|
134
|
+
id: field.id({ description: "Unique attachment identifier" }),
|
|
135
|
+
fileId: field.foreignKey({ description: "Attached file" }),
|
|
136
|
+
entityType: field.string({
|
|
137
|
+
description: "Target entity type (deal, listing, etc.)"
|
|
138
|
+
}),
|
|
139
|
+
entityId: field.string({ description: "Target entity ID" }),
|
|
140
|
+
attachmentType: field.string({
|
|
141
|
+
isOptional: true,
|
|
142
|
+
description: "Type of attachment (document, image, avatar, etc.)"
|
|
143
|
+
}),
|
|
144
|
+
name: field.string({
|
|
145
|
+
isOptional: true,
|
|
146
|
+
description: "Display name (overrides file name)"
|
|
147
|
+
}),
|
|
148
|
+
description: field.string({
|
|
149
|
+
isOptional: true,
|
|
150
|
+
description: "Attachment description"
|
|
151
|
+
}),
|
|
152
|
+
order: field.int({ default: 0, description: "Display order" }),
|
|
153
|
+
metadata: field.json({
|
|
154
|
+
isOptional: true,
|
|
155
|
+
description: "Attachment-specific metadata"
|
|
156
|
+
}),
|
|
157
|
+
createdBy: field.string({ description: "User who created attachment" }),
|
|
158
|
+
createdAt: field.createdAt(),
|
|
159
|
+
updatedAt: field.updatedAt(),
|
|
160
|
+
file: field.belongsTo("File", ["fileId"], ["id"], { onDelete: "Cascade" })
|
|
161
|
+
},
|
|
162
|
+
indexes: [
|
|
163
|
+
index.on(["entityType", "entityId"]),
|
|
164
|
+
index.on(["fileId"]),
|
|
165
|
+
index.on(["entityType", "entityId", "attachmentType"]),
|
|
166
|
+
index.unique(["fileId", "entityType", "entityId"], {
|
|
167
|
+
name: "attachment_unique"
|
|
168
|
+
})
|
|
169
|
+
]
|
|
196
170
|
});
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
updatedAt: field.updatedAt()
|
|
242
|
-
},
|
|
243
|
-
indexes: [index.on(["status", "expiresAt"]), index.on(["ownerId"])]
|
|
171
|
+
var UploadSessionEntity = defineEntity({
|
|
172
|
+
name: "UploadSession",
|
|
173
|
+
description: "Tracks a multipart upload session.",
|
|
174
|
+
schema: "lssm_files",
|
|
175
|
+
map: "upload_session",
|
|
176
|
+
fields: {
|
|
177
|
+
id: field.id({ description: "Unique session identifier" }),
|
|
178
|
+
fileName: field.string({ description: "Target file name" }),
|
|
179
|
+
mimeType: field.string({ description: "Expected MIME type" }),
|
|
180
|
+
totalSize: field.int({ description: "Total file size" }),
|
|
181
|
+
uploadId: field.string({
|
|
182
|
+
isOptional: true,
|
|
183
|
+
description: "Storage upload ID"
|
|
184
|
+
}),
|
|
185
|
+
uploadedBytes: field.int({
|
|
186
|
+
default: 0,
|
|
187
|
+
description: "Bytes uploaded so far"
|
|
188
|
+
}),
|
|
189
|
+
uploadedParts: field.json({
|
|
190
|
+
isOptional: true,
|
|
191
|
+
description: "Completed part info"
|
|
192
|
+
}),
|
|
193
|
+
status: field.string({
|
|
194
|
+
default: '"pending"',
|
|
195
|
+
description: "Session status"
|
|
196
|
+
}),
|
|
197
|
+
error: field.string({
|
|
198
|
+
isOptional: true,
|
|
199
|
+
description: "Error message if failed"
|
|
200
|
+
}),
|
|
201
|
+
fileId: field.string({
|
|
202
|
+
isOptional: true,
|
|
203
|
+
description: "Resulting file ID"
|
|
204
|
+
}),
|
|
205
|
+
ownerId: field.string({ description: "User who initiated upload" }),
|
|
206
|
+
orgId: field.string({
|
|
207
|
+
isOptional: true,
|
|
208
|
+
description: "Organization scope"
|
|
209
|
+
}),
|
|
210
|
+
expiresAt: field.dateTime({ description: "Session expiry time" }),
|
|
211
|
+
createdAt: field.createdAt(),
|
|
212
|
+
updatedAt: field.updatedAt()
|
|
213
|
+
},
|
|
214
|
+
indexes: [index.on(["status", "expiresAt"]), index.on(["ownerId"])]
|
|
244
215
|
});
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
FileVersionEntity,
|
|
251
|
-
AttachmentEntity,
|
|
252
|
-
UploadSessionEntity
|
|
216
|
+
var fileEntities = [
|
|
217
|
+
FileEntity,
|
|
218
|
+
FileVersionEntity,
|
|
219
|
+
AttachmentEntity,
|
|
220
|
+
UploadSessionEntity
|
|
253
221
|
];
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
222
|
+
var filesSchemaContribution = {
|
|
223
|
+
moduleId: "@contractspec/lib.files",
|
|
224
|
+
entities: fileEntities,
|
|
225
|
+
enums: [StorageProviderEnum, FileStatusEnum]
|
|
226
|
+
};
|
|
227
|
+
export {
|
|
228
|
+
filesSchemaContribution,
|
|
229
|
+
fileEntities,
|
|
230
|
+
UploadSessionEntity,
|
|
231
|
+
StorageProviderEnum,
|
|
232
|
+
FileVersionEntity,
|
|
233
|
+
FileStatusEnum,
|
|
234
|
+
FileEntity,
|
|
235
|
+
AttachmentEntity
|
|
261
236
|
};
|
|
262
|
-
|
|
263
|
-
//#endregion
|
|
264
|
-
export { AttachmentEntity, FileEntity, FileStatusEnum, FileVersionEntity, StorageProviderEnum, UploadSessionEntity, fileEntities, filesSchemaContribution };
|
|
265
|
-
//# sourceMappingURL=index.js.map
|