@lssm/lib.files 0.0.0-canary-20251217063201 → 0.0.0-canary-20251217073102

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 (133) hide show
  1. package/dist/contracts/dist/capabilities/openbanking.js +88 -1
  2. package/dist/contracts/dist/client/index.js +5 -1
  3. package/dist/contracts/dist/client/react/feature-render.js +2 -1
  4. package/dist/contracts/dist/client/react/form-render.js +4 -1
  5. package/dist/contracts/dist/client/react/index.js +4 -1
  6. package/dist/contracts/dist/contract-registry/index.js +1 -1
  7. package/dist/contracts/dist/contract-registry/schemas.js +60 -1
  8. package/dist/contracts/dist/docs/PUBLISHING.docblock.js +16 -76
  9. package/dist/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +16 -350
  10. package/dist/contracts/dist/docs/index.js +29 -1
  11. package/dist/contracts/dist/docs/presentations.js +71 -1
  12. package/dist/contracts/dist/docs/registry.js +44 -1
  13. package/dist/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +16 -383
  14. package/dist/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +16 -68
  15. package/dist/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +16 -140
  16. package/dist/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +16 -86
  17. package/dist/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +16 -1
  18. package/dist/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +24 -2
  19. package/dist/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +21 -2
  20. package/dist/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +16 -213
  21. package/dist/contracts/dist/docs/tech/llm/llm-integration.docblock.js +73 -5
  22. package/dist/contracts/dist/docs/tech/mcp-endpoints.docblock.js +37 -1
  23. package/dist/contracts/dist/docs/tech/presentation-runtime.docblock.js +16 -1
  24. package/dist/contracts/dist/docs/tech/schema/README.docblock.js +20 -262
  25. package/dist/contracts/dist/docs/tech/studio/learning-events.docblock.js +48 -1
  26. package/dist/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +24 -2
  27. package/dist/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +23 -2
  28. package/dist/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +25 -16
  29. package/dist/contracts/dist/docs/tech/studio/project-routing.docblock.js +67 -1
  30. package/dist/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +22 -2
  31. package/dist/contracts/dist/docs/tech/studio/team-invitations.docblock.js +40 -36
  32. package/dist/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +47 -1
  33. package/dist/contracts/dist/docs/tech/studio/workspaces.docblock.js +23 -2
  34. package/dist/contracts/dist/docs/tech/telemetry-ingest.docblock.js +36 -3
  35. package/dist/contracts/dist/docs/tech/templates/runtime.docblock.js +20 -1
  36. package/dist/contracts/dist/docs/tech/vscode-extension.docblock.js +36 -3
  37. package/dist/contracts/dist/docs/tech/workflows/overview.docblock.js +20 -1
  38. package/dist/contracts/dist/events.js +10 -1
  39. package/dist/contracts/dist/experiments/evaluator.js +1 -1
  40. package/dist/contracts/dist/index.js +71 -1
  41. package/dist/contracts/dist/install.js +2 -1
  42. package/dist/contracts/dist/integrations/contracts.js +377 -1
  43. package/dist/contracts/dist/integrations/index.js +18 -1
  44. package/dist/contracts/dist/integrations/openbanking/contracts/accounts.js +228 -1
  45. package/dist/contracts/dist/integrations/openbanking/contracts/balances.js +159 -1
  46. package/dist/contracts/dist/integrations/openbanking/contracts/index.js +3 -1
  47. package/dist/contracts/dist/integrations/openbanking/contracts/transactions.js +210 -1
  48. package/dist/contracts/dist/integrations/openbanking/models.js +242 -1
  49. package/dist/contracts/dist/integrations/openbanking/telemetry.js +13 -1
  50. package/dist/contracts/dist/integrations/providers/elevenlabs.js +52 -1
  51. package/dist/contracts/dist/integrations/providers/gcs-storage.js +75 -1
  52. package/dist/contracts/dist/integrations/providers/gmail.js +87 -1
  53. package/dist/contracts/dist/integrations/providers/google-calendar.js +66 -1
  54. package/dist/contracts/dist/integrations/providers/index.js +11 -1
  55. package/dist/contracts/dist/integrations/providers/mistral.js +68 -1
  56. package/dist/contracts/dist/integrations/providers/postmark.js +68 -1
  57. package/dist/contracts/dist/integrations/providers/powens.js +116 -1
  58. package/dist/contracts/dist/integrations/providers/qdrant.js +73 -1
  59. package/dist/contracts/dist/integrations/providers/registry.js +10 -1
  60. package/dist/contracts/dist/integrations/providers/stripe.js +83 -1
  61. package/dist/contracts/dist/integrations/providers/twilio-sms.js +61 -1
  62. package/dist/contracts/dist/jsonschema.js +1 -1
  63. package/dist/contracts/dist/knowledge/contracts.js +306 -1
  64. package/dist/contracts/dist/knowledge/index.js +7 -1
  65. package/dist/contracts/dist/knowledge/spaces/email-threads.js +34 -1
  66. package/dist/contracts/dist/knowledge/spaces/financial-docs.js +34 -1
  67. package/dist/contracts/dist/knowledge/spaces/financial-overview.js +38 -1
  68. package/dist/contracts/dist/knowledge/spaces/index.js +6 -1
  69. package/dist/contracts/dist/knowledge/spaces/product-canon.js +34 -1
  70. package/dist/contracts/dist/knowledge/spaces/support-faq.js +37 -1
  71. package/dist/contracts/dist/knowledge/spaces/uploaded-docs.js +34 -1
  72. package/dist/contracts/dist/llm/exporters.js +19 -1
  73. package/dist/contracts/dist/llm/index.js +2 -1
  74. package/dist/contracts/dist/llm/prompts.js +1 -1
  75. package/dist/contracts/dist/onboarding-base.js +196 -1
  76. package/dist/contracts/dist/openapi.js +1 -1
  77. package/dist/contracts/dist/ownership.js +21 -1
  78. package/dist/contracts/dist/presentations.js +1 -1
  79. package/dist/contracts/dist/presentations.v2.js +11 -1
  80. package/dist/contracts/dist/prompt.js +1 -1
  81. package/dist/contracts/dist/promptRegistry.js +1 -1
  82. package/dist/contracts/dist/regenerator/index.js +1 -1
  83. package/dist/contracts/dist/regenerator/service.js +6 -1
  84. package/dist/contracts/dist/registry.js +2 -1
  85. package/dist/contracts/dist/resources.js +1 -1
  86. package/dist/contracts/dist/schema/dist/EnumType.js +2 -1
  87. package/dist/contracts/dist/schema/dist/FieldType.js +49 -1
  88. package/dist/contracts/dist/schema/dist/ScalarTypeEnum.js +236 -1
  89. package/dist/contracts/dist/schema/dist/SchemaModel.js +34 -1
  90. package/dist/contracts/dist/schema/dist/entity/defineEntity.js +1 -1
  91. package/dist/contracts/dist/schema/dist/entity/index.js +2 -1
  92. package/dist/contracts/dist/schema/dist/entity/types.js +1 -1
  93. package/dist/contracts/dist/schema/dist/index.js +6 -1
  94. package/dist/contracts/dist/server/graphql-pothos.js +6 -1
  95. package/dist/contracts/dist/server/index.js +8 -1
  96. package/dist/contracts/dist/server/mcp/createMcpServer.js +4 -1
  97. package/dist/contracts/dist/server/mcp/registerPresentations.js +2 -1
  98. package/dist/contracts/dist/server/mcp/registerPrompts.js +1 -1
  99. package/dist/contracts/dist/server/mcp/registerResources.js +2 -1
  100. package/dist/contracts/dist/server/mcp/registerTools.js +1 -1
  101. package/dist/contracts/dist/server/provider-mcp.js +1 -1
  102. package/dist/contracts/dist/server/rest-elysia.js +1 -1
  103. package/dist/contracts/dist/server/rest-express.js +1 -1
  104. package/dist/contracts/dist/server/rest-generic.js +1 -1
  105. package/dist/contracts/dist/server/rest-next-app.js +1 -1
  106. package/dist/contracts/dist/server/rest-next-pages.js +1 -1
  107. package/dist/contracts/dist/spec.js +34 -1
  108. package/dist/contracts/dist/telemetry/index.js +1 -1
  109. package/dist/contracts/dist/telemetry/tracker.js +1 -1
  110. package/dist/contracts/dist/tests/index.js +1 -1
  111. package/dist/contracts/dist/tests/runner.js +2 -1
  112. package/dist/contracts/dist/workflow/index.js +1 -1
  113. package/dist/contracts/dist/workflow/runner.js +1 -1
  114. package/dist/contracts/index.d.ts +291 -291
  115. package/dist/contracts/index.js +858 -1
  116. package/dist/docs/files.docblock.js +22 -2
  117. package/dist/docs/index.js +1 -1
  118. package/dist/entities/index.d.ts +133 -133
  119. package/dist/entities/index.js +265 -1
  120. package/dist/events.d.ts +118 -118
  121. package/dist/events.js +343 -1
  122. package/dist/files.feature.js +124 -1
  123. package/dist/index.js +8 -1
  124. package/dist/schema/dist/EnumType.js +2 -1
  125. package/dist/schema/dist/FieldType.js +49 -1
  126. package/dist/schema/dist/ScalarTypeEnum.js +236 -1
  127. package/dist/schema/dist/SchemaModel.js +39 -1
  128. package/dist/schema/dist/entity/defineEntity.js +236 -1
  129. package/dist/schema/dist/entity/index.js +2 -1
  130. package/dist/schema/dist/entity/types.js +1 -1
  131. package/dist/schema/dist/index.js +6 -1
  132. package/dist/storage/index.js +268 -1
  133. package/package.json +5 -5
@@ -1 +1,268 @@
1
- import*as e from"node:crypto";import*as t from"node:fs/promises";import*as n from"node:path";var r=class{provider=`LOCAL`;basePath;baseUrl;constructor(e){this.basePath=e.basePath,this.baseUrl=e.baseUrl}async upload(r){let i=n.join(this.basePath,r.path),a=n.dirname(i);await t.mkdir(a,{recursive:!0});let o=typeof r.content==`string`?Buffer.from(r.content,`base64`):r.content;await t.writeFile(i,o);let s=e.createHash(`sha256`).update(o).digest(`hex`);return{path:r.path,size:o.length,mimeType:r.mimeType,checksum:s,metadata:r.metadata}}async download(e){let r=n.join(this.basePath,e);return t.readFile(r)}async delete(e){let r=n.join(this.basePath,e);await t.unlink(r)}async exists(e){let r=n.join(this.basePath,e);try{return await t.access(r),!0}catch{return!1}}async getMetadata(e){let r=n.join(this.basePath,e);try{return{path:e,size:(await t.stat(r)).size,mimeType:`application/octet-stream`}}catch{return null}}async list(e){let r=e?.prefix?n.join(this.basePath,e.prefix):this.basePath;try{let i=await t.readdir(r,{withFileTypes:!0}),a=[];for(let o of i)if(o.isFile()){let i=e?.prefix?n.join(e.prefix,o.name):o.name,s=await t.stat(n.join(r,o.name));a.push({path:i,size:s.size,mimeType:`application/octet-stream`})}let o=e?.limit||a.length;return{files:a.slice(0,o),hasMore:a.length>o}}catch{return{files:[],hasMore:!1}}}async createPresignedUpload(e){let t=e.expiresIn||3600,n=new Date(Date.now()+t*1e3);return{url:this.baseUrl?`${this.baseUrl}/upload?path=${encodeURIComponent(e.path)}`:`/upload?path=${encodeURIComponent(e.path)}`,fields:{path:e.path,mimeType:e.mimeType},expiresAt:n}}async createPresignedDownload(e){let t=e.expiresIn||3600,n=new Date(Date.now()+t*1e3);return{url:this.baseUrl?`${this.baseUrl}/download/${e.path}`:`/download/${e.path}`,expiresAt:n}}getPublicUrl(e){return this.baseUrl?`${this.baseUrl}/${e}`:null}async copy(e,r){let i=n.join(this.basePath,e),a=n.join(this.basePath,r),o=n.dirname(a);return await t.mkdir(o,{recursive:!0}),await t.copyFile(i,a),{path:r,size:(await t.stat(a)).size,mimeType:`application/octet-stream`}}},i=class{provider=`S3`;config;constructor(e){this.config=e}async upload(e){throw Error(`S3 adapter requires @aws-sdk/client-s3. Install it and implement the upload method.`)}async download(e){throw Error(`S3 adapter requires @aws-sdk/client-s3. Install it and implement the download method.`)}async delete(e){throw Error(`S3 adapter requires @aws-sdk/client-s3. Install it and implement the delete method.`)}async exists(e){throw Error(`S3 adapter requires @aws-sdk/client-s3. Install it and implement the exists method.`)}async getMetadata(e){throw Error(`S3 adapter requires @aws-sdk/client-s3. Install it and implement the getMetadata method.`)}async list(e){throw Error(`S3 adapter requires @aws-sdk/client-s3. Install it and implement the list method.`)}async createPresignedUpload(e){throw Error(`S3 adapter requires @aws-sdk/client-s3. Install it and implement the createPresignedUpload method.`)}async createPresignedDownload(e){throw Error(`S3 adapter requires @aws-sdk/client-s3. Install it and implement the createPresignedDownload method.`)}getPublicUrl(e){let{bucket:t,region:n,endpoint:r}=this.config;return r?`${r}/${t}/${e}`:`https://${t}.s3.${n}.amazonaws.com/${e}`}async copy(e,t){throw Error(`S3 adapter requires @aws-sdk/client-s3. Install it and implement the copy method.`)}},a=class{provider=`LOCAL`;files=new Map;async upload(t){let n=typeof t.content==`string`?Buffer.from(t.content,`base64`):t.content,r=e.createHash(`sha256`).update(n).digest(`hex`),i={path:t.path,size:n.length,mimeType:t.mimeType,checksum:r,metadata:t.metadata};return this.files.set(t.path,{content:n,metadata:i}),i}async download(e){let t=this.files.get(e);if(!t)throw Error(`File not found: ${e}`);return t.content}async delete(e){this.files.delete(e)}async exists(e){return this.files.has(e)}async getMetadata(e){return this.files.get(e)?.metadata||null}async list(e){let t=e?.prefix||``,n=[];for(let[e,r]of this.files)e.startsWith(t)&&n.push(r.metadata);let r=e?.limit||n.length;return{files:n.slice(0,r),hasMore:n.length>r}}async createPresignedUpload(e){let t=new Date(Date.now()+(e.expiresIn||3600)*1e3);return{url:`/upload?path=${encodeURIComponent(e.path)}`,fields:{path:e.path},expiresAt:t}}async createPresignedDownload(e){let t=new Date(Date.now()+(e.expiresIn||3600)*1e3);return{url:`/download/${e.path}`,expiresAt:t}}getPublicUrl(e){return`/files/${e}`}async copy(e,t){let n=this.files.get(e);if(!n)throw Error(`Source file not found: ${e}`);let r={...n.metadata,path:t};return this.files.set(t,{content:n.content,metadata:r}),r}clear(){this.files.clear()}};function o(e){switch(e.provider){case`LOCAL`:if(!e.local)throw Error(`Local storage configuration required`);return new r(e.local);case`S3`:if(!e.s3)throw Error(`S3 storage configuration required`);return new i(e.s3);default:throw Error(`Unsupported storage provider: ${e.provider}`)}}export{a as InMemoryStorageAdapter,r as LocalStorageAdapter,i as S3StorageAdapter,o as createStorageAdapter};
1
+ import * as crypto from "node:crypto";
2
+ import * as fs from "node:fs/promises";
3
+ import * as path from "node:path";
4
+
5
+ //#region src/storage/index.ts
6
+ /**
7
+ * Local filesystem storage adapter.
8
+ * For development and testing purposes.
9
+ */
10
+ var LocalStorageAdapter = class {
11
+ provider = "LOCAL";
12
+ basePath;
13
+ baseUrl;
14
+ constructor(options) {
15
+ this.basePath = options.basePath;
16
+ this.baseUrl = options.baseUrl;
17
+ }
18
+ async upload(options) {
19
+ const fullPath = path.join(this.basePath, options.path);
20
+ const dir = path.dirname(fullPath);
21
+ await fs.mkdir(dir, { recursive: true });
22
+ const content = typeof options.content === "string" ? Buffer.from(options.content, "base64") : options.content;
23
+ await fs.writeFile(fullPath, content);
24
+ const checksum = crypto.createHash("sha256").update(content).digest("hex");
25
+ return {
26
+ path: options.path,
27
+ size: content.length,
28
+ mimeType: options.mimeType,
29
+ checksum,
30
+ metadata: options.metadata
31
+ };
32
+ }
33
+ async download(filePath) {
34
+ const fullPath = path.join(this.basePath, filePath);
35
+ return fs.readFile(fullPath);
36
+ }
37
+ async delete(filePath) {
38
+ const fullPath = path.join(this.basePath, filePath);
39
+ await fs.unlink(fullPath);
40
+ }
41
+ async exists(filePath) {
42
+ const fullPath = path.join(this.basePath, filePath);
43
+ try {
44
+ await fs.access(fullPath);
45
+ return true;
46
+ } catch {
47
+ return false;
48
+ }
49
+ }
50
+ async getMetadata(filePath) {
51
+ const fullPath = path.join(this.basePath, filePath);
52
+ try {
53
+ return {
54
+ path: filePath,
55
+ size: (await fs.stat(fullPath)).size,
56
+ mimeType: "application/octet-stream"
57
+ };
58
+ } catch {
59
+ return null;
60
+ }
61
+ }
62
+ async list(options) {
63
+ const dir = options?.prefix ? path.join(this.basePath, options.prefix) : this.basePath;
64
+ try {
65
+ const entries = await fs.readdir(dir, { withFileTypes: true });
66
+ const files = [];
67
+ for (const entry of entries) if (entry.isFile()) {
68
+ const filePath = options?.prefix ? path.join(options.prefix, entry.name) : entry.name;
69
+ const stat = await fs.stat(path.join(dir, entry.name));
70
+ files.push({
71
+ path: filePath,
72
+ size: stat.size,
73
+ mimeType: "application/octet-stream"
74
+ });
75
+ }
76
+ const limit = options?.limit || files.length;
77
+ return {
78
+ files: files.slice(0, limit),
79
+ hasMore: files.length > limit
80
+ };
81
+ } catch {
82
+ return {
83
+ files: [],
84
+ hasMore: false
85
+ };
86
+ }
87
+ }
88
+ async createPresignedUpload(options) {
89
+ const expiresIn = options.expiresIn || 3600;
90
+ const expiresAt = new Date(Date.now() + expiresIn * 1e3);
91
+ return {
92
+ url: this.baseUrl ? `${this.baseUrl}/upload?path=${encodeURIComponent(options.path)}` : `/upload?path=${encodeURIComponent(options.path)}`,
93
+ fields: {
94
+ path: options.path,
95
+ mimeType: options.mimeType
96
+ },
97
+ expiresAt
98
+ };
99
+ }
100
+ async createPresignedDownload(options) {
101
+ const expiresIn = options.expiresIn || 3600;
102
+ const expiresAt = new Date(Date.now() + expiresIn * 1e3);
103
+ return {
104
+ url: this.baseUrl ? `${this.baseUrl}/download/${options.path}` : `/download/${options.path}`,
105
+ expiresAt
106
+ };
107
+ }
108
+ getPublicUrl(filePath) {
109
+ if (!this.baseUrl) return null;
110
+ return `${this.baseUrl}/${filePath}`;
111
+ }
112
+ async copy(sourcePath, destinationPath) {
113
+ const sourceFullPath = path.join(this.basePath, sourcePath);
114
+ const destFullPath = path.join(this.basePath, destinationPath);
115
+ const destDir = path.dirname(destFullPath);
116
+ await fs.mkdir(destDir, { recursive: true });
117
+ await fs.copyFile(sourceFullPath, destFullPath);
118
+ return {
119
+ path: destinationPath,
120
+ size: (await fs.stat(destFullPath)).size,
121
+ mimeType: "application/octet-stream"
122
+ };
123
+ }
124
+ };
125
+ /**
126
+ * S3 storage adapter interface.
127
+ * Implementation would use AWS SDK or compatible client.
128
+ *
129
+ * This is a placeholder that defines the interface.
130
+ * Actual implementation would require @aws-sdk/client-s3 dependency.
131
+ */
132
+ var S3StorageAdapter = class {
133
+ provider = "S3";
134
+ config;
135
+ constructor(options) {
136
+ this.config = options;
137
+ }
138
+ async upload(options) {
139
+ throw new Error("S3 adapter requires @aws-sdk/client-s3. Install it and implement the upload method.");
140
+ }
141
+ async download(filePath) {
142
+ throw new Error("S3 adapter requires @aws-sdk/client-s3. Install it and implement the download method.");
143
+ }
144
+ async delete(filePath) {
145
+ throw new Error("S3 adapter requires @aws-sdk/client-s3. Install it and implement the delete method.");
146
+ }
147
+ async exists(filePath) {
148
+ throw new Error("S3 adapter requires @aws-sdk/client-s3. Install it and implement the exists method.");
149
+ }
150
+ async getMetadata(filePath) {
151
+ throw new Error("S3 adapter requires @aws-sdk/client-s3. Install it and implement the getMetadata method.");
152
+ }
153
+ async list(options) {
154
+ throw new Error("S3 adapter requires @aws-sdk/client-s3. Install it and implement the list method.");
155
+ }
156
+ async createPresignedUpload(options) {
157
+ throw new Error("S3 adapter requires @aws-sdk/client-s3. Install it and implement the createPresignedUpload method.");
158
+ }
159
+ async createPresignedDownload(options) {
160
+ throw new Error("S3 adapter requires @aws-sdk/client-s3. Install it and implement the createPresignedDownload method.");
161
+ }
162
+ getPublicUrl(filePath) {
163
+ const { bucket, region, endpoint } = this.config;
164
+ if (endpoint) return `${endpoint}/${bucket}/${filePath}`;
165
+ return `https://${bucket}.s3.${region}.amazonaws.com/${filePath}`;
166
+ }
167
+ async copy(sourcePath, destinationPath) {
168
+ throw new Error("S3 adapter requires @aws-sdk/client-s3. Install it and implement the copy method.");
169
+ }
170
+ };
171
+ /**
172
+ * In-memory storage adapter for testing.
173
+ */
174
+ var InMemoryStorageAdapter = class {
175
+ provider = "LOCAL";
176
+ files = /* @__PURE__ */ new Map();
177
+ async upload(options) {
178
+ const content = typeof options.content === "string" ? Buffer.from(options.content, "base64") : options.content;
179
+ const checksum = crypto.createHash("sha256").update(content).digest("hex");
180
+ const metadata = {
181
+ path: options.path,
182
+ size: content.length,
183
+ mimeType: options.mimeType,
184
+ checksum,
185
+ metadata: options.metadata
186
+ };
187
+ this.files.set(options.path, {
188
+ content,
189
+ metadata
190
+ });
191
+ return metadata;
192
+ }
193
+ async download(filePath) {
194
+ const file = this.files.get(filePath);
195
+ if (!file) throw new Error(`File not found: ${filePath}`);
196
+ return file.content;
197
+ }
198
+ async delete(filePath) {
199
+ this.files.delete(filePath);
200
+ }
201
+ async exists(filePath) {
202
+ return this.files.has(filePath);
203
+ }
204
+ async getMetadata(filePath) {
205
+ return this.files.get(filePath)?.metadata || null;
206
+ }
207
+ async list(options) {
208
+ const prefix = options?.prefix || "";
209
+ const files = [];
210
+ for (const [path$1, file] of this.files) if (path$1.startsWith(prefix)) files.push(file.metadata);
211
+ const limit = options?.limit || files.length;
212
+ return {
213
+ files: files.slice(0, limit),
214
+ hasMore: files.length > limit
215
+ };
216
+ }
217
+ async createPresignedUpload(options) {
218
+ const expiresAt = new Date(Date.now() + (options.expiresIn || 3600) * 1e3);
219
+ return {
220
+ url: `/upload?path=${encodeURIComponent(options.path)}`,
221
+ fields: { path: options.path },
222
+ expiresAt
223
+ };
224
+ }
225
+ async createPresignedDownload(options) {
226
+ const expiresAt = new Date(Date.now() + (options.expiresIn || 3600) * 1e3);
227
+ return {
228
+ url: `/download/${options.path}`,
229
+ expiresAt
230
+ };
231
+ }
232
+ getPublicUrl(filePath) {
233
+ return `/files/${filePath}`;
234
+ }
235
+ async copy(sourcePath, destinationPath) {
236
+ const source = this.files.get(sourcePath);
237
+ if (!source) throw new Error(`Source file not found: ${sourcePath}`);
238
+ const metadata = {
239
+ ...source.metadata,
240
+ path: destinationPath
241
+ };
242
+ this.files.set(destinationPath, {
243
+ content: source.content,
244
+ metadata
245
+ });
246
+ return metadata;
247
+ }
248
+ clear() {
249
+ this.files.clear();
250
+ }
251
+ };
252
+ /**
253
+ * Create a storage adapter based on configuration.
254
+ */
255
+ function createStorageAdapter(config) {
256
+ switch (config.provider) {
257
+ case "LOCAL":
258
+ if (!config.local) throw new Error("Local storage configuration required");
259
+ return new LocalStorageAdapter(config.local);
260
+ case "S3":
261
+ if (!config.s3) throw new Error("S3 storage configuration required");
262
+ return new S3StorageAdapter(config.s3);
263
+ default: throw new Error(`Unsupported storage provider: ${config.provider}`);
264
+ }
265
+ }
266
+
267
+ //#endregion
268
+ export { InMemoryStorageAdapter, LocalStorageAdapter, S3StorageAdapter, createStorageAdapter };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lssm/lib.files",
3
- "version": "0.0.0-canary-20251217063201",
3
+ "version": "0.0.0-canary-20251217073102",
4
4
  "description": "Files, documents and attachments module for ContractSpec applications",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -18,13 +18,13 @@
18
18
  "lint:check": "eslint src"
19
19
  },
20
20
  "dependencies": {
21
- "@lssm/lib.schema": "0.0.0-canary-20251217063201",
22
- "@lssm/lib.contracts": "0.0.0-canary-20251217063201",
21
+ "@lssm/lib.schema": "0.0.0-canary-20251217073102",
22
+ "@lssm/lib.contracts": "0.0.0-canary-20251217073102",
23
23
  "zod": "^4.1.13"
24
24
  },
25
25
  "devDependencies": {
26
- "@lssm/tool.typescript": "0.0.0-canary-20251217063201",
27
- "@lssm/tool.tsdown": "0.0.0-canary-20251217063201",
26
+ "@lssm/tool.typescript": "0.0.0-canary-20251217073102",
27
+ "@lssm/tool.tsdown": "0.0.0-canary-20251217073102",
28
28
  "typescript": "^5.9.3"
29
29
  },
30
30
  "exports": {