@lssm/lib.files 0.0.0-canary-20251217080011 → 1.41.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 (138) hide show
  1. package/dist/contracts/index.js +1 -858
  2. package/dist/docs/files.docblock.js +2 -22
  3. package/dist/docs/index.js +1 -1
  4. package/dist/entities/index.js +1 -265
  5. package/dist/events.js +1 -343
  6. package/dist/files.feature.js +1 -124
  7. package/dist/index.js +1 -8
  8. package/dist/storage/index.js +1 -268
  9. package/package.json +13 -14
  10. package/dist/contracts/dist/capabilities/openbanking.js +0 -88
  11. package/dist/contracts/dist/client/index.js +0 -5
  12. package/dist/contracts/dist/client/react/feature-render.js +0 -2
  13. package/dist/contracts/dist/client/react/form-render.js +0 -4
  14. package/dist/contracts/dist/client/react/index.js +0 -4
  15. package/dist/contracts/dist/contract-registry/index.js +0 -1
  16. package/dist/contracts/dist/contract-registry/schemas.js +0 -60
  17. package/dist/contracts/dist/docs/PUBLISHING.docblock.js +0 -16
  18. package/dist/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +0 -16
  19. package/dist/contracts/dist/docs/index.js +0 -29
  20. package/dist/contracts/dist/docs/presentations.js +0 -71
  21. package/dist/contracts/dist/docs/registry.js +0 -44
  22. package/dist/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +0 -16
  23. package/dist/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +0 -16
  24. package/dist/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +0 -16
  25. package/dist/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +0 -16
  26. package/dist/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +0 -16
  27. package/dist/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +0 -80
  28. package/dist/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +0 -57
  29. package/dist/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +0 -16
  30. package/dist/contracts/dist/docs/tech/llm/llm-integration.docblock.js +0 -357
  31. package/dist/contracts/dist/docs/tech/mcp-endpoints.docblock.js +0 -37
  32. package/dist/contracts/dist/docs/tech/presentation-runtime.docblock.js +0 -16
  33. package/dist/contracts/dist/docs/tech/schema/README.docblock.js +0 -20
  34. package/dist/contracts/dist/docs/tech/studio/learning-events.docblock.js +0 -48
  35. package/dist/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +0 -79
  36. package/dist/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +0 -84
  37. package/dist/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +0 -45
  38. package/dist/contracts/dist/docs/tech/studio/project-routing.docblock.js +0 -67
  39. package/dist/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +0 -40
  40. package/dist/contracts/dist/docs/tech/studio/team-invitations.docblock.js +0 -69
  41. package/dist/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +0 -47
  42. package/dist/contracts/dist/docs/tech/studio/workspaces.docblock.js +0 -62
  43. package/dist/contracts/dist/docs/tech/telemetry-ingest.docblock.js +0 -155
  44. package/dist/contracts/dist/docs/tech/templates/runtime.docblock.js +0 -20
  45. package/dist/contracts/dist/docs/tech/vscode-extension.docblock.js +0 -101
  46. package/dist/contracts/dist/docs/tech/workflows/overview.docblock.js +0 -20
  47. package/dist/contracts/dist/events.js +0 -10
  48. package/dist/contracts/dist/experiments/evaluator.js +0 -1
  49. package/dist/contracts/dist/index.js +0 -71
  50. package/dist/contracts/dist/install.js +0 -2
  51. package/dist/contracts/dist/integrations/contracts.js +0 -377
  52. package/dist/contracts/dist/integrations/index.js +0 -18
  53. package/dist/contracts/dist/integrations/openbanking/contracts/accounts.js +0 -228
  54. package/dist/contracts/dist/integrations/openbanking/contracts/balances.js +0 -159
  55. package/dist/contracts/dist/integrations/openbanking/contracts/index.js +0 -3
  56. package/dist/contracts/dist/integrations/openbanking/contracts/transactions.js +0 -210
  57. package/dist/contracts/dist/integrations/openbanking/models.js +0 -242
  58. package/dist/contracts/dist/integrations/openbanking/telemetry.js +0 -13
  59. package/dist/contracts/dist/integrations/providers/elevenlabs.js +0 -52
  60. package/dist/contracts/dist/integrations/providers/gcs-storage.js +0 -75
  61. package/dist/contracts/dist/integrations/providers/gmail.js +0 -87
  62. package/dist/contracts/dist/integrations/providers/google-calendar.js +0 -66
  63. package/dist/contracts/dist/integrations/providers/index.js +0 -11
  64. package/dist/contracts/dist/integrations/providers/mistral.js +0 -68
  65. package/dist/contracts/dist/integrations/providers/postmark.js +0 -68
  66. package/dist/contracts/dist/integrations/providers/powens.js +0 -116
  67. package/dist/contracts/dist/integrations/providers/qdrant.js +0 -73
  68. package/dist/contracts/dist/integrations/providers/registry.js +0 -10
  69. package/dist/contracts/dist/integrations/providers/stripe.js +0 -83
  70. package/dist/contracts/dist/integrations/providers/twilio-sms.js +0 -61
  71. package/dist/contracts/dist/jsonschema.js +0 -1
  72. package/dist/contracts/dist/knowledge/contracts.js +0 -306
  73. package/dist/contracts/dist/knowledge/index.js +0 -7
  74. package/dist/contracts/dist/knowledge/spaces/email-threads.js +0 -34
  75. package/dist/contracts/dist/knowledge/spaces/financial-docs.js +0 -34
  76. package/dist/contracts/dist/knowledge/spaces/financial-overview.js +0 -38
  77. package/dist/contracts/dist/knowledge/spaces/index.js +0 -6
  78. package/dist/contracts/dist/knowledge/spaces/product-canon.js +0 -34
  79. package/dist/contracts/dist/knowledge/spaces/support-faq.js +0 -37
  80. package/dist/contracts/dist/knowledge/spaces/uploaded-docs.js +0 -34
  81. package/dist/contracts/dist/llm/exporters.js +0 -19
  82. package/dist/contracts/dist/llm/index.js +0 -2
  83. package/dist/contracts/dist/llm/prompts.js +0 -1
  84. package/dist/contracts/dist/onboarding-base.js +0 -196
  85. package/dist/contracts/dist/openapi.js +0 -1
  86. package/dist/contracts/dist/ownership.js +0 -21
  87. package/dist/contracts/dist/presentations.js +0 -1
  88. package/dist/contracts/dist/presentations.v2.js +0 -11
  89. package/dist/contracts/dist/prompt.js +0 -1
  90. package/dist/contracts/dist/promptRegistry.js +0 -1
  91. package/dist/contracts/dist/regenerator/index.js +0 -1
  92. package/dist/contracts/dist/regenerator/service.js +0 -6
  93. package/dist/contracts/dist/registry.js +0 -2
  94. package/dist/contracts/dist/resources.js +0 -1
  95. package/dist/contracts/dist/schema/dist/EnumType.js +0 -2
  96. package/dist/contracts/dist/schema/dist/FieldType.js +0 -49
  97. package/dist/contracts/dist/schema/dist/ScalarTypeEnum.js +0 -236
  98. package/dist/contracts/dist/schema/dist/SchemaModel.js +0 -34
  99. package/dist/contracts/dist/schema/dist/entity/defineEntity.js +0 -1
  100. package/dist/contracts/dist/schema/dist/entity/index.js +0 -2
  101. package/dist/contracts/dist/schema/dist/entity/types.js +0 -1
  102. package/dist/contracts/dist/schema/dist/index.js +0 -6
  103. package/dist/contracts/dist/server/graphql-pothos.js +0 -6
  104. package/dist/contracts/dist/server/index.js +0 -8
  105. package/dist/contracts/dist/server/mcp/createMcpServer.js +0 -4
  106. package/dist/contracts/dist/server/mcp/registerPresentations.js +0 -2
  107. package/dist/contracts/dist/server/mcp/registerPrompts.js +0 -1
  108. package/dist/contracts/dist/server/mcp/registerResources.js +0 -2
  109. package/dist/contracts/dist/server/mcp/registerTools.js +0 -1
  110. package/dist/contracts/dist/server/provider-mcp.js +0 -1
  111. package/dist/contracts/dist/server/rest-elysia.js +0 -1
  112. package/dist/contracts/dist/server/rest-express.js +0 -1
  113. package/dist/contracts/dist/server/rest-generic.js +0 -1
  114. package/dist/contracts/dist/server/rest-next-app.js +0 -1
  115. package/dist/contracts/dist/server/rest-next-pages.js +0 -1
  116. package/dist/contracts/dist/spec.js +0 -34
  117. package/dist/contracts/dist/telemetry/index.js +0 -1
  118. package/dist/contracts/dist/telemetry/tracker.js +0 -1
  119. package/dist/contracts/dist/tests/index.js +0 -1
  120. package/dist/contracts/dist/tests/runner.js +0 -2
  121. package/dist/contracts/dist/workflow/index.js +0 -1
  122. package/dist/contracts/dist/workflow/runner.js +0 -1
  123. package/dist/contracts/index.d.ts +0 -1139
  124. package/dist/docs/files.docblock.d.ts +0 -1
  125. package/dist/docs/index.d.ts +0 -1
  126. package/dist/entities/index.d.ts +0 -168
  127. package/dist/events.d.ts +0 -467
  128. package/dist/files.feature.d.ts +0 -11
  129. package/dist/index.d.ts +0 -6
  130. package/dist/schema/dist/EnumType.js +0 -2
  131. package/dist/schema/dist/FieldType.js +0 -49
  132. package/dist/schema/dist/ScalarTypeEnum.js +0 -236
  133. package/dist/schema/dist/SchemaModel.js +0 -39
  134. package/dist/schema/dist/entity/defineEntity.js +0 -236
  135. package/dist/schema/dist/entity/index.js +0 -2
  136. package/dist/schema/dist/entity/types.js +0 -1
  137. package/dist/schema/dist/index.js +0 -6
  138. package/dist/storage/index.d.ts +0 -200
@@ -1,21 +1,4 @@
1
- import { registerDocBlocks } from "../contracts/dist/docs/registry.js";
2
- import "../contracts/dist/docs/index.js";
3
-
4
- //#region src/docs/files.docblock.ts
5
- registerDocBlocks([{
6
- id: "docs.files.attachments",
7
- title: "Files, Versions & Attachments",
8
- summary: "Spec-first file management with storage adapters, versioning, presigned URLs, and polymorphic attachments for any entity.",
9
- kind: "reference",
10
- visibility: "public",
11
- route: "/docs/files/attachments",
12
- tags: [
13
- "files",
14
- "attachments",
15
- "storage",
16
- "versions"
17
- ],
18
- body: `## Capabilities
1
+ import{registerDocBlocks as e}from"@lssm/lib.contracts/docs";e([{id:`docs.files.attachments`,title:`Files, Versions & Attachments`,summary:`Spec-first file management with storage adapters, versioning, presigned URLs, and polymorphic attachments for any entity.`,kind:`reference`,visibility:`public`,route:`/docs/files/attachments`,tags:[`files`,`attachments`,`storage`,`versions`],body:`## Capabilities
19
2
 
20
3
  - **Entities**: File, FileVersion, Attachment, UploadSession with retention, checksum, ACLs.
21
4
  - **Contracts**: upload/update/delete/list/get files; presigned upload/download; version create/list; attach/detach/list attachments.
@@ -65,7 +48,4 @@ await AttachFileContract; // register in spec to enable attach flows
65
48
  - Enforce size/MIME limits in your handlers; avoid storing PII in paths.
66
49
  - Keep \`orgId\` scoped for multi-tenant isolation; prefer presigned URLs for public delivery.
67
50
  - Persist checksums for integrity; emit audit + events for access/retention changes.
68
- `
69
- }]);
70
-
71
- //#endregion
51
+ `}]);
@@ -1 +1 @@
1
- import "./files.docblock.js";
1
+ import"./files.docblock.js";
@@ -1,265 +1 @@
1
- import { defineEntity, defineEntityEnum, field, index } from "../schema/dist/entity/defineEntity.js";
2
- import "../schema/dist/index.js";
3
-
4
- //#region src/entities/index.ts
5
- /**
6
- * Storage provider enum.
7
- */
8
- const StorageProviderEnum = defineEntityEnum({
9
- name: "StorageProvider",
10
- values: [
11
- "LOCAL",
12
- "S3",
13
- "GCS",
14
- "AZURE",
15
- "CLOUDFLARE"
16
- ],
17
- schema: "lssm_files",
18
- description: "Storage backend provider."
19
- });
20
- /**
21
- * File status enum.
22
- */
23
- const FileStatusEnum = defineEntityEnum({
24
- name: "FileStatus",
25
- values: [
26
- "PENDING",
27
- "UPLOADED",
28
- "PROCESSING",
29
- "READY",
30
- "ERROR",
31
- "DELETED"
32
- ],
33
- schema: "lssm_files",
34
- description: "File processing status."
35
- });
36
- /**
37
- * File entity - represents an uploaded file.
38
- */
39
- const FileEntity = defineEntity({
40
- name: "File",
41
- description: "An uploaded file.",
42
- schema: "lssm_files",
43
- map: "file",
44
- fields: {
45
- id: field.id({ description: "Unique file identifier" }),
46
- name: field.string({ description: "Original file name" }),
47
- mimeType: field.string({ description: "MIME type" }),
48
- size: field.int({ description: "File size in bytes" }),
49
- storageProvider: field.enum("StorageProvider", {
50
- default: "LOCAL",
51
- description: "Storage backend"
52
- }),
53
- storagePath: field.string({ description: "Path in storage backend" }),
54
- storageKey: field.string({
55
- isOptional: true,
56
- description: "Storage key/bucket"
57
- }),
58
- checksum: field.string({
59
- isOptional: true,
60
- description: "SHA-256 checksum"
61
- }),
62
- etag: field.string({
63
- isOptional: true,
64
- description: "Storage ETag"
65
- }),
66
- status: field.enum("FileStatus", {
67
- default: "PENDING",
68
- description: "File status"
69
- }),
70
- isPublic: field.boolean({
71
- default: false,
72
- description: "Whether file is publicly accessible"
73
- }),
74
- expiresAt: field.dateTime({
75
- isOptional: true,
76
- description: "Auto-delete timestamp"
77
- }),
78
- ownerId: field.string({ description: "User who uploaded" }),
79
- orgId: field.string({
80
- isOptional: true,
81
- description: "Organization scope"
82
- }),
83
- metadata: field.json({
84
- isOptional: true,
85
- description: "Additional metadata"
86
- }),
87
- tags: field.json({
88
- isOptional: true,
89
- description: "Tags for categorization"
90
- }),
91
- width: field.int({
92
- isOptional: true,
93
- description: "Image width in pixels"
94
- }),
95
- height: field.int({
96
- isOptional: true,
97
- description: "Image height in pixels"
98
- }),
99
- createdAt: field.createdAt(),
100
- updatedAt: field.updatedAt(),
101
- versions: field.hasMany("FileVersion"),
102
- attachments: field.hasMany("Attachment")
103
- },
104
- indexes: [
105
- index.on(["ownerId"]),
106
- index.on(["orgId"]),
107
- index.on(["status"]),
108
- index.on(["mimeType"]),
109
- index.on(["storageProvider", "storagePath"])
110
- ],
111
- enums: [StorageProviderEnum, FileStatusEnum]
112
- });
113
- /**
114
- * FileVersion entity - version history for files.
115
- */
116
- const FileVersionEntity = defineEntity({
117
- name: "FileVersion",
118
- description: "A version of a file.",
119
- schema: "lssm_files",
120
- map: "file_version",
121
- fields: {
122
- id: field.id({ description: "Unique version identifier" }),
123
- fileId: field.foreignKey({ description: "Parent file" }),
124
- version: field.int({ description: "Version number" }),
125
- size: field.int({ description: "Version size in bytes" }),
126
- storagePath: field.string({ description: "Path in storage backend" }),
127
- checksum: field.string({
128
- isOptional: true,
129
- description: "SHA-256 checksum"
130
- }),
131
- comment: field.string({
132
- isOptional: true,
133
- description: "Version comment"
134
- }),
135
- changes: field.json({
136
- isOptional: true,
137
- description: "Change description"
138
- }),
139
- createdBy: field.string({ description: "User who created version" }),
140
- createdAt: field.createdAt(),
141
- file: field.belongsTo("File", ["fileId"], ["id"], { onDelete: "Cascade" })
142
- },
143
- indexes: [index.on(["fileId", "version"]), index.unique(["fileId", "version"], { name: "file_version_unique" })]
144
- });
145
- /**
146
- * Attachment entity - polymorphic link between files and entities.
147
- */
148
- const AttachmentEntity = defineEntity({
149
- name: "Attachment",
150
- description: "Links a file to an entity.",
151
- schema: "lssm_files",
152
- map: "attachment",
153
- fields: {
154
- id: field.id({ description: "Unique attachment identifier" }),
155
- fileId: field.foreignKey({ description: "Attached file" }),
156
- entityType: field.string({ description: "Target entity type (deal, listing, etc.)" }),
157
- entityId: field.string({ description: "Target entity ID" }),
158
- attachmentType: field.string({
159
- isOptional: true,
160
- description: "Type of attachment (document, image, avatar, etc.)"
161
- }),
162
- name: field.string({
163
- isOptional: true,
164
- description: "Display name (overrides file name)"
165
- }),
166
- description: field.string({
167
- isOptional: true,
168
- description: "Attachment description"
169
- }),
170
- order: field.int({
171
- default: 0,
172
- description: "Display order"
173
- }),
174
- metadata: field.json({
175
- isOptional: true,
176
- description: "Attachment-specific metadata"
177
- }),
178
- createdBy: field.string({ description: "User who created attachment" }),
179
- createdAt: field.createdAt(),
180
- updatedAt: field.updatedAt(),
181
- file: field.belongsTo("File", ["fileId"], ["id"], { onDelete: "Cascade" })
182
- },
183
- indexes: [
184
- index.on(["entityType", "entityId"]),
185
- index.on(["fileId"]),
186
- index.on([
187
- "entityType",
188
- "entityId",
189
- "attachmentType"
190
- ]),
191
- index.unique([
192
- "fileId",
193
- "entityType",
194
- "entityId"
195
- ], { name: "attachment_unique" })
196
- ]
197
- });
198
- /**
199
- * UploadSession entity - tracks multipart uploads.
200
- */
201
- const UploadSessionEntity = defineEntity({
202
- name: "UploadSession",
203
- description: "Tracks a multipart upload session.",
204
- schema: "lssm_files",
205
- map: "upload_session",
206
- fields: {
207
- id: field.id({ description: "Unique session identifier" }),
208
- fileName: field.string({ description: "Target file name" }),
209
- mimeType: field.string({ description: "Expected MIME type" }),
210
- totalSize: field.int({ description: "Total file size" }),
211
- uploadId: field.string({
212
- isOptional: true,
213
- description: "Storage upload ID"
214
- }),
215
- uploadedBytes: field.int({
216
- default: 0,
217
- description: "Bytes uploaded so far"
218
- }),
219
- uploadedParts: field.json({
220
- isOptional: true,
221
- description: "Completed part info"
222
- }),
223
- status: field.string({
224
- default: "\"pending\"",
225
- description: "Session status"
226
- }),
227
- error: field.string({
228
- isOptional: true,
229
- description: "Error message if failed"
230
- }),
231
- fileId: field.string({
232
- isOptional: true,
233
- description: "Resulting file ID"
234
- }),
235
- ownerId: field.string({ description: "User who initiated upload" }),
236
- orgId: field.string({
237
- isOptional: true,
238
- description: "Organization scope"
239
- }),
240
- expiresAt: field.dateTime({ description: "Session expiry time" }),
241
- createdAt: field.createdAt(),
242
- updatedAt: field.updatedAt()
243
- },
244
- indexes: [index.on(["status", "expiresAt"]), index.on(["ownerId"])]
245
- });
246
- /**
247
- * All file entities for schema composition.
248
- */
249
- const fileEntities = [
250
- FileEntity,
251
- FileVersionEntity,
252
- AttachmentEntity,
253
- UploadSessionEntity
254
- ];
255
- /**
256
- * Module schema contribution for files.
257
- */
258
- const filesSchemaContribution = {
259
- moduleId: "@lssm/lib.files",
260
- entities: fileEntities,
261
- enums: [StorageProviderEnum, FileStatusEnum]
262
- };
263
-
264
- //#endregion
265
- export { AttachmentEntity, FileEntity, FileStatusEnum, FileVersionEntity, StorageProviderEnum, UploadSessionEntity, fileEntities, filesSchemaContribution };
1
+ import{defineEntity as e,defineEntityEnum as t,field as n,index as r}from"@lssm/lib.schema";const i=t({name:`StorageProvider`,values:[`LOCAL`,`S3`,`GCS`,`AZURE`,`CLOUDFLARE`],schema:`lssm_files`,description:`Storage backend provider.`}),a=t({name:`FileStatus`,values:[`PENDING`,`UPLOADED`,`PROCESSING`,`READY`,`ERROR`,`DELETED`],schema:`lssm_files`,description:`File processing status.`}),o=e({name:`File`,description:`An uploaded file.`,schema:`lssm_files`,map:`file`,fields:{id:n.id({description:`Unique file identifier`}),name:n.string({description:`Original file name`}),mimeType:n.string({description:`MIME type`}),size:n.int({description:`File size in bytes`}),storageProvider:n.enum(`StorageProvider`,{default:`LOCAL`,description:`Storage backend`}),storagePath:n.string({description:`Path in storage backend`}),storageKey:n.string({isOptional:!0,description:`Storage key/bucket`}),checksum:n.string({isOptional:!0,description:`SHA-256 checksum`}),etag:n.string({isOptional:!0,description:`Storage ETag`}),status:n.enum(`FileStatus`,{default:`PENDING`,description:`File status`}),isPublic:n.boolean({default:!1,description:`Whether file is publicly accessible`}),expiresAt:n.dateTime({isOptional:!0,description:`Auto-delete timestamp`}),ownerId:n.string({description:`User who uploaded`}),orgId:n.string({isOptional:!0,description:`Organization scope`}),metadata:n.json({isOptional:!0,description:`Additional metadata`}),tags:n.json({isOptional:!0,description:`Tags for categorization`}),width:n.int({isOptional:!0,description:`Image width in pixels`}),height:n.int({isOptional:!0,description:`Image height in pixels`}),createdAt:n.createdAt(),updatedAt:n.updatedAt(),versions:n.hasMany(`FileVersion`),attachments:n.hasMany(`Attachment`)},indexes:[r.on([`ownerId`]),r.on([`orgId`]),r.on([`status`]),r.on([`mimeType`]),r.on([`storageProvider`,`storagePath`])],enums:[i,a]}),s=e({name:`FileVersion`,description:`A version of a file.`,schema:`lssm_files`,map:`file_version`,fields:{id:n.id({description:`Unique version identifier`}),fileId:n.foreignKey({description:`Parent file`}),version:n.int({description:`Version number`}),size:n.int({description:`Version size in bytes`}),storagePath:n.string({description:`Path in storage backend`}),checksum:n.string({isOptional:!0,description:`SHA-256 checksum`}),comment:n.string({isOptional:!0,description:`Version comment`}),changes:n.json({isOptional:!0,description:`Change description`}),createdBy:n.string({description:`User who created version`}),createdAt:n.createdAt(),file:n.belongsTo(`File`,[`fileId`],[`id`],{onDelete:`Cascade`})},indexes:[r.on([`fileId`,`version`]),r.unique([`fileId`,`version`],{name:`file_version_unique`})]}),c=e({name:`Attachment`,description:`Links a file to an entity.`,schema:`lssm_files`,map:`attachment`,fields:{id:n.id({description:`Unique attachment identifier`}),fileId:n.foreignKey({description:`Attached file`}),entityType:n.string({description:`Target entity type (deal, listing, etc.)`}),entityId:n.string({description:`Target entity ID`}),attachmentType:n.string({isOptional:!0,description:`Type of attachment (document, image, avatar, etc.)`}),name:n.string({isOptional:!0,description:`Display name (overrides file name)`}),description:n.string({isOptional:!0,description:`Attachment description`}),order:n.int({default:0,description:`Display order`}),metadata:n.json({isOptional:!0,description:`Attachment-specific metadata`}),createdBy:n.string({description:`User who created attachment`}),createdAt:n.createdAt(),updatedAt:n.updatedAt(),file:n.belongsTo(`File`,[`fileId`],[`id`],{onDelete:`Cascade`})},indexes:[r.on([`entityType`,`entityId`]),r.on([`fileId`]),r.on([`entityType`,`entityId`,`attachmentType`]),r.unique([`fileId`,`entityType`,`entityId`],{name:`attachment_unique`})]}),l=e({name:`UploadSession`,description:`Tracks a multipart upload session.`,schema:`lssm_files`,map:`upload_session`,fields:{id:n.id({description:`Unique session identifier`}),fileName:n.string({description:`Target file name`}),mimeType:n.string({description:`Expected MIME type`}),totalSize:n.int({description:`Total file size`}),uploadId:n.string({isOptional:!0,description:`Storage upload ID`}),uploadedBytes:n.int({default:0,description:`Bytes uploaded so far`}),uploadedParts:n.json({isOptional:!0,description:`Completed part info`}),status:n.string({default:`"pending"`,description:`Session status`}),error:n.string({isOptional:!0,description:`Error message if failed`}),fileId:n.string({isOptional:!0,description:`Resulting file ID`}),ownerId:n.string({description:`User who initiated upload`}),orgId:n.string({isOptional:!0,description:`Organization scope`}),expiresAt:n.dateTime({description:`Session expiry time`}),createdAt:n.createdAt(),updatedAt:n.updatedAt()},indexes:[r.on([`status`,`expiresAt`]),r.on([`ownerId`])]}),u=[o,s,c,l],d={moduleId:`@lssm/lib.files`,entities:u,enums:[i,a]};export{c as AttachmentEntity,o as FileEntity,a as FileStatusEnum,s as FileVersionEntity,i as StorageProviderEnum,l as UploadSessionEntity,u as fileEntities,d as filesSchemaContribution};
package/dist/events.js CHANGED
@@ -1,343 +1 @@
1
- import { ScalarTypeEnum } from "./schema/dist/ScalarTypeEnum.js";
2
- import { defineSchemaModel } from "./schema/dist/SchemaModel.js";
3
- import "./schema/dist/index.js";
4
- import { defineEvent } from "./contracts/dist/events.js";
5
- import "./contracts/dist/index.js";
6
-
7
- //#region src/events.ts
8
- const FileUploadedPayload = defineSchemaModel({
9
- name: "FileUploadedEventPayload",
10
- description: "Payload when a file is uploaded",
11
- fields: {
12
- fileId: {
13
- type: ScalarTypeEnum.String_unsecure(),
14
- isOptional: false
15
- },
16
- name: {
17
- type: ScalarTypeEnum.String_unsecure(),
18
- isOptional: false
19
- },
20
- mimeType: {
21
- type: ScalarTypeEnum.String_unsecure(),
22
- isOptional: false
23
- },
24
- size: {
25
- type: ScalarTypeEnum.Int_unsecure(),
26
- isOptional: false
27
- },
28
- storageProvider: {
29
- type: ScalarTypeEnum.String_unsecure(),
30
- isOptional: false
31
- },
32
- ownerId: {
33
- type: ScalarTypeEnum.String_unsecure(),
34
- isOptional: false
35
- },
36
- orgId: {
37
- type: ScalarTypeEnum.String_unsecure(),
38
- isOptional: true
39
- },
40
- uploadedAt: {
41
- type: ScalarTypeEnum.DateTime(),
42
- isOptional: false
43
- }
44
- }
45
- });
46
- const FileUpdatedPayload = defineSchemaModel({
47
- name: "FileUpdatedEventPayload",
48
- description: "Payload when a file is updated",
49
- fields: {
50
- fileId: {
51
- type: ScalarTypeEnum.String_unsecure(),
52
- isOptional: false
53
- },
54
- name: {
55
- type: ScalarTypeEnum.String_unsecure(),
56
- isOptional: false
57
- },
58
- changes: {
59
- type: ScalarTypeEnum.JSON(),
60
- isOptional: false
61
- },
62
- updatedBy: {
63
- type: ScalarTypeEnum.String_unsecure(),
64
- isOptional: true
65
- },
66
- updatedAt: {
67
- type: ScalarTypeEnum.DateTime(),
68
- isOptional: false
69
- }
70
- }
71
- });
72
- const FileDeletedPayload = defineSchemaModel({
73
- name: "FileDeletedEventPayload",
74
- description: "Payload when a file is deleted",
75
- fields: {
76
- fileId: {
77
- type: ScalarTypeEnum.String_unsecure(),
78
- isOptional: false
79
- },
80
- name: {
81
- type: ScalarTypeEnum.String_unsecure(),
82
- isOptional: false
83
- },
84
- storageProvider: {
85
- type: ScalarTypeEnum.String_unsecure(),
86
- isOptional: false
87
- },
88
- storagePath: {
89
- type: ScalarTypeEnum.String_unsecure(),
90
- isOptional: false
91
- },
92
- deletedBy: {
93
- type: ScalarTypeEnum.String_unsecure(),
94
- isOptional: true
95
- },
96
- deletedAt: {
97
- type: ScalarTypeEnum.DateTime(),
98
- isOptional: false
99
- }
100
- }
101
- });
102
- const FileVersionCreatedPayload = defineSchemaModel({
103
- name: "FileVersionCreatedEventPayload",
104
- description: "Payload when a file version is created",
105
- fields: {
106
- fileId: {
107
- type: ScalarTypeEnum.String_unsecure(),
108
- isOptional: false
109
- },
110
- versionId: {
111
- type: ScalarTypeEnum.String_unsecure(),
112
- isOptional: false
113
- },
114
- version: {
115
- type: ScalarTypeEnum.Int_unsecure(),
116
- isOptional: false
117
- },
118
- size: {
119
- type: ScalarTypeEnum.Int_unsecure(),
120
- isOptional: false
121
- },
122
- createdBy: {
123
- type: ScalarTypeEnum.String_unsecure(),
124
- isOptional: false
125
- },
126
- comment: {
127
- type: ScalarTypeEnum.String_unsecure(),
128
- isOptional: true
129
- },
130
- createdAt: {
131
- type: ScalarTypeEnum.DateTime(),
132
- isOptional: false
133
- }
134
- }
135
- });
136
- const AttachmentAttachedPayload = defineSchemaModel({
137
- name: "AttachmentAttachedEventPayload",
138
- description: "Payload when a file is attached to an entity",
139
- fields: {
140
- attachmentId: {
141
- type: ScalarTypeEnum.String_unsecure(),
142
- isOptional: false
143
- },
144
- fileId: {
145
- type: ScalarTypeEnum.String_unsecure(),
146
- isOptional: false
147
- },
148
- entityType: {
149
- type: ScalarTypeEnum.String_unsecure(),
150
- isOptional: false
151
- },
152
- entityId: {
153
- type: ScalarTypeEnum.String_unsecure(),
154
- isOptional: false
155
- },
156
- attachmentType: {
157
- type: ScalarTypeEnum.String_unsecure(),
158
- isOptional: true
159
- },
160
- attachedBy: {
161
- type: ScalarTypeEnum.String_unsecure(),
162
- isOptional: false
163
- },
164
- attachedAt: {
165
- type: ScalarTypeEnum.DateTime(),
166
- isOptional: false
167
- }
168
- }
169
- });
170
- const AttachmentDetachedPayload = defineSchemaModel({
171
- name: "AttachmentDetachedEventPayload",
172
- description: "Payload when a file is detached from an entity",
173
- fields: {
174
- attachmentId: {
175
- type: ScalarTypeEnum.String_unsecure(),
176
- isOptional: false
177
- },
178
- fileId: {
179
- type: ScalarTypeEnum.String_unsecure(),
180
- isOptional: false
181
- },
182
- entityType: {
183
- type: ScalarTypeEnum.String_unsecure(),
184
- isOptional: false
185
- },
186
- entityId: {
187
- type: ScalarTypeEnum.String_unsecure(),
188
- isOptional: false
189
- },
190
- detachedBy: {
191
- type: ScalarTypeEnum.String_unsecure(),
192
- isOptional: true
193
- },
194
- detachedAt: {
195
- type: ScalarTypeEnum.DateTime(),
196
- isOptional: false
197
- }
198
- }
199
- });
200
- const UploadSessionStartedPayload = defineSchemaModel({
201
- name: "UploadSessionStartedEventPayload",
202
- description: "Payload when an upload session starts",
203
- fields: {
204
- sessionId: {
205
- type: ScalarTypeEnum.String_unsecure(),
206
- isOptional: false
207
- },
208
- fileName: {
209
- type: ScalarTypeEnum.String_unsecure(),
210
- isOptional: false
211
- },
212
- mimeType: {
213
- type: ScalarTypeEnum.String_unsecure(),
214
- isOptional: false
215
- },
216
- totalSize: {
217
- type: ScalarTypeEnum.Int_unsecure(),
218
- isOptional: false
219
- },
220
- ownerId: {
221
- type: ScalarTypeEnum.String_unsecure(),
222
- isOptional: false
223
- },
224
- startedAt: {
225
- type: ScalarTypeEnum.DateTime(),
226
- isOptional: false
227
- }
228
- }
229
- });
230
- const UploadSessionCompletedPayload = defineSchemaModel({
231
- name: "UploadSessionCompletedEventPayload",
232
- description: "Payload when an upload session completes",
233
- fields: {
234
- sessionId: {
235
- type: ScalarTypeEnum.String_unsecure(),
236
- isOptional: false
237
- },
238
- fileId: {
239
- type: ScalarTypeEnum.String_unsecure(),
240
- isOptional: false
241
- },
242
- fileName: {
243
- type: ScalarTypeEnum.String_unsecure(),
244
- isOptional: false
245
- },
246
- size: {
247
- type: ScalarTypeEnum.Int_unsecure(),
248
- isOptional: false
249
- },
250
- completedAt: {
251
- type: ScalarTypeEnum.DateTime(),
252
- isOptional: false
253
- }
254
- }
255
- });
256
- /**
257
- * Emitted when a file is uploaded.
258
- */
259
- const FileUploadedEvent = defineEvent({
260
- name: "file.uploaded",
261
- version: 1,
262
- description: "A file has been uploaded.",
263
- payload: FileUploadedPayload
264
- });
265
- /**
266
- * Emitted when a file is updated.
267
- */
268
- const FileUpdatedEvent = defineEvent({
269
- name: "file.updated",
270
- version: 1,
271
- description: "A file has been updated.",
272
- payload: FileUpdatedPayload
273
- });
274
- /**
275
- * Emitted when a file is deleted.
276
- */
277
- const FileDeletedEvent = defineEvent({
278
- name: "file.deleted",
279
- version: 1,
280
- description: "A file has been deleted.",
281
- payload: FileDeletedPayload
282
- });
283
- /**
284
- * Emitted when a file version is created.
285
- */
286
- const FileVersionCreatedEvent = defineEvent({
287
- name: "file.version_created",
288
- version: 1,
289
- description: "A new file version has been created.",
290
- payload: FileVersionCreatedPayload
291
- });
292
- /**
293
- * Emitted when a file is attached to an entity.
294
- */
295
- const AttachmentAttachedEvent = defineEvent({
296
- name: "attachment.attached",
297
- version: 1,
298
- description: "A file has been attached to an entity.",
299
- payload: AttachmentAttachedPayload
300
- });
301
- /**
302
- * Emitted when a file is detached from an entity.
303
- */
304
- const AttachmentDetachedEvent = defineEvent({
305
- name: "attachment.detached",
306
- version: 1,
307
- description: "A file has been detached from an entity.",
308
- payload: AttachmentDetachedPayload
309
- });
310
- /**
311
- * Emitted when an upload session starts.
312
- */
313
- const UploadSessionStartedEvent = defineEvent({
314
- name: "upload.session_started",
315
- version: 1,
316
- description: "An upload session has started.",
317
- payload: UploadSessionStartedPayload
318
- });
319
- /**
320
- * Emitted when an upload session completes.
321
- */
322
- const UploadSessionCompletedEvent = defineEvent({
323
- name: "upload.session_completed",
324
- version: 1,
325
- description: "An upload session has completed.",
326
- payload: UploadSessionCompletedPayload
327
- });
328
- /**
329
- * All file events.
330
- */
331
- const FileEvents = {
332
- FileUploadedEvent,
333
- FileUpdatedEvent,
334
- FileDeletedEvent,
335
- FileVersionCreatedEvent,
336
- AttachmentAttachedEvent,
337
- AttachmentDetachedEvent,
338
- UploadSessionStartedEvent,
339
- UploadSessionCompletedEvent
340
- };
341
-
342
- //#endregion
343
- export { AttachmentAttachedEvent, AttachmentDetachedEvent, FileDeletedEvent, FileEvents, FileUpdatedEvent, FileUploadedEvent, FileVersionCreatedEvent, UploadSessionCompletedEvent, UploadSessionStartedEvent };
1
+ import{ScalarTypeEnum as e,defineSchemaModel as t}from"@lssm/lib.schema";import{defineEvent as n}from"@lssm/lib.contracts";const r=t({name:`FileUploadedEventPayload`,description:`Payload when a file is uploaded`,fields:{fileId:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!1},mimeType:{type:e.String_unsecure(),isOptional:!1},size:{type:e.Int_unsecure(),isOptional:!1},storageProvider:{type:e.String_unsecure(),isOptional:!1},ownerId:{type:e.String_unsecure(),isOptional:!1},orgId:{type:e.String_unsecure(),isOptional:!0},uploadedAt:{type:e.DateTime(),isOptional:!1}}}),i=t({name:`FileUpdatedEventPayload`,description:`Payload when a file is updated`,fields:{fileId:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!1},changes:{type:e.JSON(),isOptional:!1},updatedBy:{type:e.String_unsecure(),isOptional:!0},updatedAt:{type:e.DateTime(),isOptional:!1}}}),a=t({name:`FileDeletedEventPayload`,description:`Payload when a file is deleted`,fields:{fileId:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!1},storageProvider:{type:e.String_unsecure(),isOptional:!1},storagePath:{type:e.String_unsecure(),isOptional:!1},deletedBy:{type:e.String_unsecure(),isOptional:!0},deletedAt:{type:e.DateTime(),isOptional:!1}}}),o=t({name:`FileVersionCreatedEventPayload`,description:`Payload when a file version is created`,fields:{fileId:{type:e.String_unsecure(),isOptional:!1},versionId:{type:e.String_unsecure(),isOptional:!1},version:{type:e.Int_unsecure(),isOptional:!1},size:{type:e.Int_unsecure(),isOptional:!1},createdBy:{type:e.String_unsecure(),isOptional:!1},comment:{type:e.String_unsecure(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1}}}),s=t({name:`AttachmentAttachedEventPayload`,description:`Payload when a file is attached to an entity`,fields:{attachmentId:{type:e.String_unsecure(),isOptional:!1},fileId:{type:e.String_unsecure(),isOptional:!1},entityType:{type:e.String_unsecure(),isOptional:!1},entityId:{type:e.String_unsecure(),isOptional:!1},attachmentType:{type:e.String_unsecure(),isOptional:!0},attachedBy:{type:e.String_unsecure(),isOptional:!1},attachedAt:{type:e.DateTime(),isOptional:!1}}}),c=t({name:`AttachmentDetachedEventPayload`,description:`Payload when a file is detached from an entity`,fields:{attachmentId:{type:e.String_unsecure(),isOptional:!1},fileId:{type:e.String_unsecure(),isOptional:!1},entityType:{type:e.String_unsecure(),isOptional:!1},entityId:{type:e.String_unsecure(),isOptional:!1},detachedBy:{type:e.String_unsecure(),isOptional:!0},detachedAt:{type:e.DateTime(),isOptional:!1}}}),l=t({name:`UploadSessionStartedEventPayload`,description:`Payload when an upload session starts`,fields:{sessionId:{type:e.String_unsecure(),isOptional:!1},fileName:{type:e.String_unsecure(),isOptional:!1},mimeType:{type:e.String_unsecure(),isOptional:!1},totalSize:{type:e.Int_unsecure(),isOptional:!1},ownerId:{type:e.String_unsecure(),isOptional:!1},startedAt:{type:e.DateTime(),isOptional:!1}}}),u=t({name:`UploadSessionCompletedEventPayload`,description:`Payload when an upload session completes`,fields:{sessionId:{type:e.String_unsecure(),isOptional:!1},fileId:{type:e.String_unsecure(),isOptional:!1},fileName:{type:e.String_unsecure(),isOptional:!1},size:{type:e.Int_unsecure(),isOptional:!1},completedAt:{type:e.DateTime(),isOptional:!1}}}),d=n({name:`file.uploaded`,version:1,description:`A file has been uploaded.`,payload:r}),f=n({name:`file.updated`,version:1,description:`A file has been updated.`,payload:i}),p=n({name:`file.deleted`,version:1,description:`A file has been deleted.`,payload:a}),m=n({name:`file.version_created`,version:1,description:`A new file version has been created.`,payload:o}),h=n({name:`attachment.attached`,version:1,description:`A file has been attached to an entity.`,payload:s}),g=n({name:`attachment.detached`,version:1,description:`A file has been detached from an entity.`,payload:c}),_=n({name:`upload.session_started`,version:1,description:`An upload session has started.`,payload:l}),v=n({name:`upload.session_completed`,version:1,description:`An upload session has completed.`,payload:u}),y={FileUploadedEvent:d,FileUpdatedEvent:f,FileDeletedEvent:p,FileVersionCreatedEvent:m,AttachmentAttachedEvent:h,AttachmentDetachedEvent:g,UploadSessionStartedEvent:_,UploadSessionCompletedEvent:v};export{h as AttachmentAttachedEvent,g as AttachmentDetachedEvent,p as FileDeletedEvent,y as FileEvents,f as FileUpdatedEvent,d as FileUploadedEvent,m as FileVersionCreatedEvent,v as UploadSessionCompletedEvent,_ as UploadSessionStartedEvent};