@geekmidas/storage 0.0.5 → 0.1.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 (35) hide show
  1. package/dist/{AmazonStorageClient-tyGekctm.cjs → AmazonStorageClient-BKzXhCX0.cjs} +28 -5
  2. package/dist/AmazonStorageClient-BKzXhCX0.cjs.map +1 -0
  3. package/dist/{AmazonStorageClient-Bkw-x2o2.mjs → AmazonStorageClient-CwUey48q.mjs} +3 -2
  4. package/dist/AmazonStorageClient-CwUey48q.mjs.map +1 -0
  5. package/dist/{AmazonStorageClient-DaktozmE.d.mts → AmazonStorageClient-Gz0Fh1sy.d.mts} +3 -2
  6. package/dist/AmazonStorageClient-aduVU3_p.d.cts +2 -1
  7. package/dist/AmazonStorageClient.cjs +1 -1
  8. package/dist/AmazonStorageClient.d.mts +2 -2
  9. package/dist/AmazonStorageClient.mjs +2 -2
  10. package/dist/{StorageClient-CZGIC_fz.mjs → StorageClient-4ADnTPnJ.mjs} +2 -1
  11. package/dist/StorageClient-4ADnTPnJ.mjs.map +1 -0
  12. package/dist/StorageClient-BDRVrMJj.cjs +2 -1
  13. package/dist/StorageClient-BDRVrMJj.cjs.map +1 -0
  14. package/dist/StorageClient-CcOAW3YV.d.cts +2 -1
  15. package/dist/{StorageClient-CveQoxJa.d.mts → StorageClient-XgMsiUrd.d.mts} +2 -1
  16. package/dist/StorageClient.d.mts +1 -1
  17. package/dist/StorageClient.mjs +1 -1
  18. package/dist/aws.cjs +1 -1
  19. package/dist/aws.d.mts +2 -2
  20. package/dist/aws.mjs +2 -2
  21. package/dist/index.d.mts +1 -1
  22. package/package.json +29 -6
  23. package/dist/__tests__/AmazonStorageClient.spec.cjs +0 -348
  24. package/dist/__tests__/AmazonStorageClient.spec.d.cts +0 -1
  25. package/dist/__tests__/AmazonStorageClient.spec.d.mts +0 -1
  26. package/dist/__tests__/AmazonStorageClient.spec.mjs +0 -347
  27. package/dist/__tests__/StorageClient.spec.cjs +0 -81
  28. package/dist/__tests__/StorageClient.spec.d.cts +0 -1
  29. package/dist/__tests__/StorageClient.spec.d.mts +0 -1
  30. package/dist/__tests__/StorageClient.spec.mjs +0 -81
  31. package/dist/chunk-DWy1uDak.cjs +0 -39
  32. package/dist/magic-string.es-BvJNBYzY.mjs +0 -1014
  33. package/dist/magic-string.es-CKiDiYoS.cjs +0 -1015
  34. package/dist/vi.bdSIJ99Y-CucmVasy.mjs +0 -14928
  35. package/dist/vi.bdSIJ99Y-D0m6qImj.cjs +0 -14926
@@ -1,347 +0,0 @@
1
- import { beforeAll, describe, globalExpect, it } from "../vi.bdSIJ99Y-CucmVasy.mjs";
2
- import { StorageProvider } from "../StorageClient-CZGIC_fz.mjs";
3
- import { AmazonCannedAccessControlList, AmazonStorageClient } from "../AmazonStorageClient-Bkw-x2o2.mjs";
4
- import { S3Client } from "@aws-sdk/client-s3";
5
- import { InMemoryCache } from "@geekmidas/cache/memory";
6
-
7
- //#region src/__tests__/AmazonStorageClient.spec.ts
8
- describe("AmazonStorageClient Integration Tests", () => {
9
- let client;
10
- const testBucket = "geekmidas";
11
- const testKey = "test-files/test.txt";
12
- const testContent = "Hello, World!";
13
- const testContentType = "text/plain";
14
- beforeAll(async () => {
15
- client = AmazonStorageClient.create({
16
- bucket: testBucket,
17
- region: "us-east-1",
18
- accessKeyId: "geekmidas",
19
- secretAccessKey: "geekmidas",
20
- endpoint: "http://localhost:9000",
21
- acl: AmazonCannedAccessControlList.PublicRead,
22
- forcePathStyle: true
23
- });
24
- await new Promise((resolve) => setTimeout(resolve, 2e3));
25
- });
26
- describe("provider property", () => {
27
- it("should return AWS S3 provider", () => {
28
- globalExpect(client.provider).toBe(StorageProvider.AWSS3);
29
- });
30
- });
31
- describe("upload and download workflow", () => {
32
- it.skip("should upload a file directly and generate download URL", async () => {
33
- await client.upload(testKey, testContent, testContentType);
34
- const downloadUrl = await client.getDownloadURL({ path: testKey });
35
- globalExpect(downloadUrl).toMatch(/^http:\/\/localhost:9000\/geekmidas\/test-files\/test\.txt/);
36
- globalExpect(downloadUrl).toContain("X-Amz-Algorithm=AWS4-HMAC-SHA256");
37
- globalExpect(downloadUrl).toContain("X-Amz-Credential=");
38
- globalExpect(downloadUrl).toContain("X-Amz-Date=");
39
- globalExpect(downloadUrl).toContain("X-Amz-SignedHeaders=");
40
- globalExpect(downloadUrl).toContain("X-Amz-Signature=");
41
- const response = await fetch(downloadUrl);
42
- globalExpect(response.ok).toBe(true);
43
- const downloadedContent = await response.text();
44
- globalExpect(downloadedContent).toBe(testContent);
45
- });
46
- it("should upload a file with filename and generate download URL with content disposition", async () => {
47
- const keyWithName = "test-files/named-file.txt";
48
- const fileName = "my-document.txt";
49
- await client.upload(keyWithName, testContent, testContentType);
50
- const downloadUrl = await client.getDownloadURL({
51
- path: keyWithName,
52
- name: fileName
53
- });
54
- globalExpect(downloadUrl).toContain("response-content-disposition=attachment%3B%20filename%3Dmy-document.txt");
55
- });
56
- it("should handle binary data upload", async () => {
57
- const binaryKey = "test-files/binary.bin";
58
- const binaryData = Buffer.from([
59
- 72,
60
- 101,
61
- 108,
62
- 108,
63
- 111
64
- ]);
65
- await client.upload(binaryKey, binaryData, "application/octet-stream");
66
- const downloadUrl = await client.getDownloadURL({ path: binaryKey });
67
- const response = await fetch(downloadUrl);
68
- const downloadedBuffer = await response.arrayBuffer();
69
- globalExpect(new Uint8Array(downloadedBuffer)).toEqual(new Uint8Array(binaryData));
70
- });
71
- });
72
- describe("presigned upload URLs", () => {
73
- it("should generate presigned PUT upload URL", async () => {
74
- const uploadKey = "test-files/presigned-upload.txt";
75
- const uploadUrl = await client.getUploadURL({
76
- path: uploadKey,
77
- contentType: testContentType,
78
- contentLength: testContent.length
79
- });
80
- globalExpect(uploadUrl).toMatch(/^http:\/\/localhost:9000\/geekmidas\/test-files\/presigned-upload\.txt/);
81
- globalExpect(uploadUrl).toContain("X-Amz-Algorithm=AWS4-HMAC-SHA256");
82
- const uploadResponse = await fetch(uploadUrl, {
83
- method: "PUT",
84
- headers: {
85
- "Content-Type": testContentType,
86
- "Content-Length": testContent.length.toString()
87
- },
88
- body: testContent
89
- });
90
- globalExpect(uploadResponse.ok).toBe(true);
91
- const downloadUrl = await client.getDownloadURL({ path: uploadKey });
92
- const downloadResponse = await fetch(downloadUrl);
93
- const downloadedContent = await downloadResponse.text();
94
- globalExpect(downloadedContent).toBe(testContent);
95
- });
96
- it("should generate presigned POST upload with form fields", async () => {
97
- const uploadKey = "test-files/presigned-post.txt";
98
- const uploadData = await client.getUpload({
99
- path: uploadKey,
100
- contentType: testContentType,
101
- contentLength: testContent.length
102
- });
103
- globalExpect(uploadData.url).toBe("http://localhost:9000/geekmidas");
104
- globalExpect(uploadData.fields).toContainEqual({
105
- key: "key",
106
- value: uploadKey
107
- });
108
- globalExpect(uploadData.fields).toContainEqual({
109
- key: "acl",
110
- value: "public-read"
111
- });
112
- const formData = new FormData();
113
- uploadData.fields.forEach(({ key, value }) => {
114
- formData.append(key, value);
115
- });
116
- formData.append("file", new Blob([testContent], { type: testContentType }));
117
- const uploadResponse = await fetch(uploadData.url, {
118
- method: "POST",
119
- body: formData
120
- });
121
- globalExpect(uploadResponse.ok).toBe(true);
122
- const downloadUrl = await client.getDownloadURL({ path: uploadKey });
123
- const downloadResponse = await fetch(downloadUrl);
124
- const downloadedContent = await downloadResponse.blob();
125
- globalExpect(downloadedContent).toEqual(new Blob([testContent], { type: testContentType }));
126
- });
127
- });
128
- describe("versioning", () => {
129
- it("should handle file versions", async () => {
130
- const versionKey = "test-files/versioned.txt";
131
- const content1 = "Version 1";
132
- const content2 = "Version 2";
133
- await client.upload(versionKey, content1, testContentType);
134
- await client.upload(versionKey, content2, testContentType);
135
- const versions = await client.getVersions(versionKey);
136
- globalExpect(Array.isArray(versions)).toBe(true);
137
- if (versions.length > 0) {
138
- globalExpect(versions[0]).toHaveProperty("id");
139
- globalExpect(versions[0]).toHaveProperty("createdAt");
140
- globalExpect(versions[0].createdAt).toBeInstanceOf(Date);
141
- }
142
- });
143
- });
144
- describe("error handling", () => {
145
- it("should handle download URL generation for non-existent files", async () => {
146
- const downloadUrl = await client.getDownloadURL({ path: "non-existent/file.txt" });
147
- globalExpect(downloadUrl).toMatch(/^http:\/\/localhost:9000\/geekmidas\/non-existent\/file\.txt/);
148
- const response = await fetch(downloadUrl);
149
- globalExpect(response.status).toBe(404);
150
- });
151
- });
152
- describe("custom expiration times", () => {
153
- it("should respect custom expiration for download URLs", async () => {
154
- const key = "test-files/expiration-test.txt";
155
- await client.upload(key, testContent, testContentType);
156
- const shortExpirationUrl = await client.getDownloadURL({ path: key }, 1);
157
- const longExpirationUrl = await client.getDownloadURL({ path: key }, 3600);
158
- globalExpect(shortExpirationUrl).toContain("X-Amz-Expires=1");
159
- globalExpect(longExpirationUrl).toContain("X-Amz-Expires=3600");
160
- });
161
- it("should respect custom expiration for upload URLs", async () => {
162
- const key = "test-files/upload-expiration-test.txt";
163
- const shortExpirationUrl = await client.getUploadURL({
164
- path: key,
165
- contentType: testContentType,
166
- contentLength: testContent.length
167
- }, 1);
168
- const longExpirationUrl = await client.getUploadURL({
169
- path: key,
170
- contentType: testContentType,
171
- contentLength: testContent.length
172
- }, 3600);
173
- globalExpect(shortExpirationUrl).toContain("X-Amz-Expires=1");
174
- globalExpect(longExpirationUrl).toContain("X-Amz-Expires=3600");
175
- });
176
- });
177
- describe("factory method", () => {
178
- it("should create client with minimal configuration", () => {
179
- const minimalClient = AmazonStorageClient.create({ bucket: "geekmidas" });
180
- globalExpect(minimalClient).toBeInstanceOf(AmazonStorageClient);
181
- globalExpect(minimalClient.provider).toBe(StorageProvider.AWSS3);
182
- });
183
- it("should create client with full configuration", () => {
184
- const fullClient = AmazonStorageClient.create({
185
- bucket: "geekmidas",
186
- region: "us-west-2",
187
- accessKeyId: "test-key",
188
- secretAccessKey: "test-secret",
189
- endpoint: "https://custom-s3.example.com",
190
- acl: AmazonCannedAccessControlList.Private
191
- });
192
- globalExpect(fullClient).toBeInstanceOf(AmazonStorageClient);
193
- globalExpect(fullClient.provider).toBe(StorageProvider.AWSS3);
194
- });
195
- });
196
- describe("different ACL configurations", () => {
197
- it("should work with different ACL settings", async () => {
198
- const privateClient = AmazonStorageClient.create({
199
- bucket: testBucket,
200
- region: "us-east-1",
201
- accessKeyId: "minioadmin",
202
- secretAccessKey: "minioadmin",
203
- endpoint: "http://localhost:9000",
204
- acl: AmazonCannedAccessControlList.Private
205
- });
206
- const uploadData = await privateClient.getUpload({
207
- path: "test-files/private.txt",
208
- contentType: testContentType,
209
- contentLength: testContent.length
210
- });
211
- globalExpect(uploadData.fields).toContainEqual({
212
- key: "acl",
213
- value: "private"
214
- });
215
- });
216
- });
217
- describe("S3Client integration", () => {
218
- it("should work with externally created S3Client", () => {
219
- const s3Client = new S3Client({
220
- region: "us-east-1",
221
- credentials: {
222
- accessKeyId: "minioadmin",
223
- secretAccessKey: "minioadmin"
224
- },
225
- endpoint: "http://localhost:9000"
226
- });
227
- const storageClient = new AmazonStorageClient(s3Client, testBucket, AmazonCannedAccessControlList.PublicRead);
228
- globalExpect(storageClient).toBeInstanceOf(AmazonStorageClient);
229
- globalExpect(storageClient.provider).toBe(StorageProvider.AWSS3);
230
- });
231
- });
232
- describe("cache functionality", () => {
233
- it("should cache download URLs", async () => {
234
- const cache = new InMemoryCache();
235
- const clientWithCache = AmazonStorageClient.create({
236
- bucket: testBucket,
237
- region: "us-east-1",
238
- accessKeyId: "geekmidas",
239
- secretAccessKey: "geekmidas",
240
- endpoint: "http://localhost:9000",
241
- forcePathStyle: true,
242
- cache
243
- });
244
- const key = "test-files/cache-test.txt";
245
- await clientWithCache.upload(key, testContent, testContentType);
246
- const url1 = await clientWithCache.getDownloadURL({ path: key });
247
- const url2 = await clientWithCache.getDownloadURL({ path: key });
248
- globalExpect(url1).toBe(url2);
249
- const cacheKey = `download-url:${key}`;
250
- const cachedUrl = await cache.get(cacheKey);
251
- globalExpect(cachedUrl).toBe(url1);
252
- });
253
- it("should respect cache expiration based on URL expiry", async () => {
254
- const cache = new InMemoryCache();
255
- const clientWithCache = AmazonStorageClient.create({
256
- bucket: testBucket,
257
- region: "us-east-1",
258
- accessKeyId: "geekmidas",
259
- secretAccessKey: "geekmidas",
260
- endpoint: "http://localhost:9000",
261
- forcePathStyle: true,
262
- cache
263
- });
264
- const key = "test-files/cache-expiry.txt";
265
- await clientWithCache.upload(key, testContent, testContentType);
266
- await clientWithCache.getDownloadURL({ path: key }, 30);
267
- const cacheKey = `download-url:${key}`;
268
- const cachedShortUrl = await cache.get(cacheKey);
269
- globalExpect(cachedShortUrl).toBeUndefined();
270
- const longExpiryUrl = await clientWithCache.getDownloadURL({ path: key }, 3600);
271
- const cachedLongUrl = await cache.get(cacheKey);
272
- globalExpect(cachedLongUrl).toBe(longExpiryUrl);
273
- });
274
- it("should use cached URL when available", async () => {
275
- const cache = new InMemoryCache();
276
- const clientWithCache = AmazonStorageClient.create({
277
- bucket: testBucket,
278
- region: "us-east-1",
279
- accessKeyId: "geekmidas",
280
- secretAccessKey: "geekmidas",
281
- endpoint: "http://localhost:9000",
282
- forcePathStyle: true,
283
- cache
284
- });
285
- const key = "test-files/pre-cached.txt";
286
- const cachedUrl = "https://pre-cached-url.example.com";
287
- const cacheKey = `download-url:${key}`;
288
- await cache.set(cacheKey, cachedUrl);
289
- const url = await clientWithCache.getDownloadURL({ path: key });
290
- globalExpect(url).toBe(cachedUrl);
291
- });
292
- it("should work without cache", async () => {
293
- const clientNoCache = AmazonStorageClient.create({
294
- bucket: testBucket,
295
- region: "us-east-1",
296
- accessKeyId: "geekmidas",
297
- secretAccessKey: "geekmidas",
298
- endpoint: "http://localhost:9000",
299
- forcePathStyle: true
300
- });
301
- const key = "test-files/no-cache.txt";
302
- await clientNoCache.upload(key, testContent, testContentType);
303
- const url1 = await clientNoCache.getDownloadURL({ path: key });
304
- const url2 = await clientNoCache.getDownloadURL({ path: key });
305
- globalExpect(url1).toMatch(/^http:\/\/localhost:9000\/geekmidas\/test-files\/no-cache\.txt/);
306
- globalExpect(url2).toMatch(/^http:\/\/localhost:9000\/geekmidas\/test-files\/no-cache\.txt/);
307
- });
308
- it("should pass cache to constructor", () => {
309
- const cache = new InMemoryCache();
310
- const s3Client = new S3Client({
311
- region: "us-east-1",
312
- credentials: {
313
- accessKeyId: "geekmidas",
314
- secretAccessKey: "geekmidas"
315
- },
316
- endpoint: "http://localhost:9000",
317
- forcePathStyle: true
318
- });
319
- const clientWithCache = new AmazonStorageClient(s3Client, testBucket, AmazonCannedAccessControlList.PublicRead, cache);
320
- globalExpect(clientWithCache.cache).toBe(cache);
321
- });
322
- });
323
- describe("getVersionDownloadURL", () => {
324
- it("should generate version-specific download URL", async () => {
325
- const versionKey = "test-files/version-download.txt";
326
- const versionId = "test-version-id";
327
- await client.upload(versionKey, testContent, testContentType);
328
- const downloadUrl = await client.getVersionDownloadURL({
329
- path: versionKey,
330
- name: "versioned-file.txt"
331
- }, versionId);
332
- globalExpect(downloadUrl).toMatch(/^http:\/\/localhost:9000\/geekmidas\/test-files\/version-download\.txt/);
333
- globalExpect(downloadUrl).toContain("X-Amz-Algorithm=AWS4-HMAC-SHA256");
334
- globalExpect(downloadUrl).toContain("response-content-disposition=attachment%3B%20filename%3Dversioned-file.txt");
335
- });
336
- it("should generate version URL without filename", async () => {
337
- const versionKey = "test-files/version-no-name.txt";
338
- const versionId = "test-version-id";
339
- await client.upload(versionKey, testContent, testContentType);
340
- const downloadUrl = await client.getVersionDownloadURL({ path: versionKey }, versionId);
341
- globalExpect(downloadUrl).toMatch(/^http:\/\/localhost:9000\/geekmidas\/test-files\/version-no-name\.txt/);
342
- globalExpect(downloadUrl).not.toContain("response-content-disposition");
343
- });
344
- });
345
- });
346
-
347
- //#endregion
@@ -1,81 +0,0 @@
1
- const require_StorageClient = require('../StorageClient-BDRVrMJj.cjs');
2
- const require_vi_bdSIJ99Y = require('../vi.bdSIJ99Y-D0m6qImj.cjs');
3
-
4
- //#region src/__tests__/StorageClient.spec.ts
5
- require_vi_bdSIJ99Y.describe("StorageClient", () => {
6
- require_vi_bdSIJ99Y.describe("StorageProvider enum", () => {
7
- require_vi_bdSIJ99Y.it("should have correct provider values", () => {
8
- require_vi_bdSIJ99Y.globalExpect(require_StorageClient.StorageProvider.AWSS3).toBe("geekimdas.toolbox.storage.aws.s3");
9
- require_vi_bdSIJ99Y.globalExpect(require_StorageClient.StorageProvider.GCP).toBe("geekimdas.toolbox.storage.gcp");
10
- require_vi_bdSIJ99Y.globalExpect(require_StorageClient.StorageProvider.AZURE).toBe("geekimdas.toolbox.storage.azure");
11
- });
12
- require_vi_bdSIJ99Y.it("should have unique provider values", () => {
13
- const values = Object.values(require_StorageClient.StorageProvider);
14
- const uniqueValues = new Set(values);
15
- require_vi_bdSIJ99Y.globalExpect(uniqueValues.size).toBe(values.length);
16
- });
17
- });
18
- require_vi_bdSIJ99Y.describe("interfaces", () => {
19
- require_vi_bdSIJ99Y.it("should define DocumentVersion interface correctly", () => {
20
- const version = {
21
- id: "test-id",
22
- createdAt: /* @__PURE__ */ new Date()
23
- };
24
- require_vi_bdSIJ99Y.globalExpect(version.id).toBe("test-id");
25
- require_vi_bdSIJ99Y.globalExpect(version.createdAt).toBeInstanceOf(Date);
26
- });
27
- require_vi_bdSIJ99Y.it("should define File interface correctly", () => {
28
- const file = { path: "test/path.txt" };
29
- require_vi_bdSIJ99Y.globalExpect(file.path).toBe("test/path.txt");
30
- require_vi_bdSIJ99Y.globalExpect(file.name).toBeUndefined();
31
- const fileWithName = {
32
- path: "test/path.txt",
33
- name: "display-name.txt"
34
- };
35
- require_vi_bdSIJ99Y.globalExpect(fileWithName.path).toBe("test/path.txt");
36
- require_vi_bdSIJ99Y.globalExpect(fileWithName.name).toBe("display-name.txt");
37
- });
38
- require_vi_bdSIJ99Y.it("should define GetUploadParams interface correctly", () => {
39
- const params = {
40
- path: "test/upload.txt",
41
- contentType: "text/plain",
42
- contentLength: 100
43
- };
44
- require_vi_bdSIJ99Y.globalExpect(params.path).toBe("test/upload.txt");
45
- require_vi_bdSIJ99Y.globalExpect(params.contentType).toBe("text/plain");
46
- require_vi_bdSIJ99Y.globalExpect(params.contentLength).toBe(100);
47
- });
48
- require_vi_bdSIJ99Y.it("should define GetUploadResponse interface correctly", () => {
49
- const response = {
50
- url: "https://example.com/upload",
51
- fields: [{
52
- key: "key",
53
- value: "test/path.txt"
54
- }, {
55
- key: "acl",
56
- value: "public-read"
57
- }]
58
- };
59
- require_vi_bdSIJ99Y.globalExpect(response.url).toBe("https://example.com/upload");
60
- require_vi_bdSIJ99Y.globalExpect(response.fields).toHaveLength(2);
61
- require_vi_bdSIJ99Y.globalExpect(response.fields[0]).toEqual({
62
- key: "key",
63
- value: "test/path.txt"
64
- });
65
- require_vi_bdSIJ99Y.globalExpect(response.fields[1]).toEqual({
66
- key: "acl",
67
- value: "public-read"
68
- });
69
- });
70
- require_vi_bdSIJ99Y.it("should define UploadField type correctly", () => {
71
- const field = {
72
- key: "test-key",
73
- value: "test-value"
74
- };
75
- require_vi_bdSIJ99Y.globalExpect(field.key).toBe("test-key");
76
- require_vi_bdSIJ99Y.globalExpect(field.value).toBe("test-value");
77
- });
78
- });
79
- });
80
-
81
- //#endregion
@@ -1 +0,0 @@
1
- export { };
@@ -1 +0,0 @@
1
- export { };
@@ -1,81 +0,0 @@
1
- import { describe, globalExpect, it } from "../vi.bdSIJ99Y-CucmVasy.mjs";
2
- import { StorageProvider } from "../StorageClient-CZGIC_fz.mjs";
3
-
4
- //#region src/__tests__/StorageClient.spec.ts
5
- describe("StorageClient", () => {
6
- describe("StorageProvider enum", () => {
7
- it("should have correct provider values", () => {
8
- globalExpect(StorageProvider.AWSS3).toBe("geekimdas.toolbox.storage.aws.s3");
9
- globalExpect(StorageProvider.GCP).toBe("geekimdas.toolbox.storage.gcp");
10
- globalExpect(StorageProvider.AZURE).toBe("geekimdas.toolbox.storage.azure");
11
- });
12
- it("should have unique provider values", () => {
13
- const values = Object.values(StorageProvider);
14
- const uniqueValues = new Set(values);
15
- globalExpect(uniqueValues.size).toBe(values.length);
16
- });
17
- });
18
- describe("interfaces", () => {
19
- it("should define DocumentVersion interface correctly", () => {
20
- const version = {
21
- id: "test-id",
22
- createdAt: /* @__PURE__ */ new Date()
23
- };
24
- globalExpect(version.id).toBe("test-id");
25
- globalExpect(version.createdAt).toBeInstanceOf(Date);
26
- });
27
- it("should define File interface correctly", () => {
28
- const file = { path: "test/path.txt" };
29
- globalExpect(file.path).toBe("test/path.txt");
30
- globalExpect(file.name).toBeUndefined();
31
- const fileWithName = {
32
- path: "test/path.txt",
33
- name: "display-name.txt"
34
- };
35
- globalExpect(fileWithName.path).toBe("test/path.txt");
36
- globalExpect(fileWithName.name).toBe("display-name.txt");
37
- });
38
- it("should define GetUploadParams interface correctly", () => {
39
- const params = {
40
- path: "test/upload.txt",
41
- contentType: "text/plain",
42
- contentLength: 100
43
- };
44
- globalExpect(params.path).toBe("test/upload.txt");
45
- globalExpect(params.contentType).toBe("text/plain");
46
- globalExpect(params.contentLength).toBe(100);
47
- });
48
- it("should define GetUploadResponse interface correctly", () => {
49
- const response = {
50
- url: "https://example.com/upload",
51
- fields: [{
52
- key: "key",
53
- value: "test/path.txt"
54
- }, {
55
- key: "acl",
56
- value: "public-read"
57
- }]
58
- };
59
- globalExpect(response.url).toBe("https://example.com/upload");
60
- globalExpect(response.fields).toHaveLength(2);
61
- globalExpect(response.fields[0]).toEqual({
62
- key: "key",
63
- value: "test/path.txt"
64
- });
65
- globalExpect(response.fields[1]).toEqual({
66
- key: "acl",
67
- value: "public-read"
68
- });
69
- });
70
- it("should define UploadField type correctly", () => {
71
- const field = {
72
- key: "test-key",
73
- value: "test-value"
74
- };
75
- globalExpect(field.key).toBe("test-key");
76
- globalExpect(field.value).toBe("test-value");
77
- });
78
- });
79
- });
80
-
81
- //#endregion
@@ -1,39 +0,0 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJS = (cb, mod) => function() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
13
- key = keys[i];
14
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
- get: ((k) => from[k]).bind(null, key),
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
22
- value: mod,
23
- enumerable: true
24
- }) : target, mod));
25
-
26
- //#endregion
27
-
28
- Object.defineProperty(exports, '__commonJS', {
29
- enumerable: true,
30
- get: function () {
31
- return __commonJS;
32
- }
33
- });
34
- Object.defineProperty(exports, '__toESM', {
35
- enumerable: true,
36
- get: function () {
37
- return __toESM;
38
- }
39
- });