@geekmidas/storage 0.1.0 → 1.0.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.
@@ -2,88 +2,88 @@ import { describe, expect, it } from 'vitest';
2
2
  import { StorageProvider } from '../StorageClient';
3
3
 
4
4
  describe('StorageClient', () => {
5
- describe('StorageProvider enum', () => {
6
- it('should have correct provider values', () => {
7
- expect(StorageProvider.AWSS3).toBe('geekimdas.toolbox.storage.aws.s3');
8
- expect(StorageProvider.GCP).toBe('geekimdas.toolbox.storage.gcp');
9
- expect(StorageProvider.AZURE).toBe('geekimdas.toolbox.storage.azure');
10
- });
5
+ describe('StorageProvider enum', () => {
6
+ it('should have correct provider values', () => {
7
+ expect(StorageProvider.AWSS3).toBe('geekimdas.toolbox.storage.aws.s3');
8
+ expect(StorageProvider.GCP).toBe('geekimdas.toolbox.storage.gcp');
9
+ expect(StorageProvider.AZURE).toBe('geekimdas.toolbox.storage.azure');
10
+ });
11
11
 
12
- it('should have unique provider values', () => {
13
- const values = Object.values(StorageProvider);
14
- const uniqueValues = new Set(values);
15
- expect(uniqueValues.size).toBe(values.length);
16
- });
17
- });
12
+ it('should have unique provider values', () => {
13
+ const values = Object.values(StorageProvider);
14
+ const uniqueValues = new Set(values);
15
+ expect(uniqueValues.size).toBe(values.length);
16
+ });
17
+ });
18
18
 
19
- describe('interfaces', () => {
20
- it('should define DocumentVersion interface correctly', () => {
21
- // This is a compile-time test to ensure the interface exists
22
- // and has the correct shape
23
- const version: import('../StorageClient').DocumentVersion = {
24
- id: 'test-id',
25
- createdAt: new Date(),
26
- };
19
+ describe('interfaces', () => {
20
+ it('should define DocumentVersion interface correctly', () => {
21
+ // This is a compile-time test to ensure the interface exists
22
+ // and has the correct shape
23
+ const version: import('../StorageClient').DocumentVersion = {
24
+ id: 'test-id',
25
+ createdAt: new Date(),
26
+ };
27
27
 
28
- expect(version.id).toBe('test-id');
29
- expect(version.createdAt).toBeInstanceOf(Date);
30
- });
28
+ expect(version.id).toBe('test-id');
29
+ expect(version.createdAt).toBeInstanceOf(Date);
30
+ });
31
31
 
32
- it('should define File interface correctly', () => {
33
- const file: import('../StorageClient').File = {
34
- path: 'test/path.txt',
35
- };
32
+ it('should define File interface correctly', () => {
33
+ const file: import('../StorageClient').File = {
34
+ path: 'test/path.txt',
35
+ };
36
36
 
37
- expect(file.path).toBe('test/path.txt');
38
- expect(file.name).toBeUndefined();
37
+ expect(file.path).toBe('test/path.txt');
38
+ expect(file.name).toBeUndefined();
39
39
 
40
- const fileWithName: import('../StorageClient').File = {
41
- path: 'test/path.txt',
42
- name: 'display-name.txt',
43
- };
40
+ const fileWithName: import('../StorageClient').File = {
41
+ path: 'test/path.txt',
42
+ name: 'display-name.txt',
43
+ };
44
44
 
45
- expect(fileWithName.path).toBe('test/path.txt');
46
- expect(fileWithName.name).toBe('display-name.txt');
47
- });
45
+ expect(fileWithName.path).toBe('test/path.txt');
46
+ expect(fileWithName.name).toBe('display-name.txt');
47
+ });
48
48
 
49
- it('should define GetUploadParams interface correctly', () => {
50
- const params: import('../StorageClient').GetUploadParams = {
51
- path: 'test/upload.txt',
52
- contentType: 'text/plain',
53
- contentLength: 100,
54
- };
49
+ it('should define GetUploadParams interface correctly', () => {
50
+ const params: import('../StorageClient').GetUploadParams = {
51
+ path: 'test/upload.txt',
52
+ contentType: 'text/plain',
53
+ contentLength: 100,
54
+ };
55
55
 
56
- expect(params.path).toBe('test/upload.txt');
57
- expect(params.contentType).toBe('text/plain');
58
- expect(params.contentLength).toBe(100);
59
- });
56
+ expect(params.path).toBe('test/upload.txt');
57
+ expect(params.contentType).toBe('text/plain');
58
+ expect(params.contentLength).toBe(100);
59
+ });
60
60
 
61
- it('should define GetUploadResponse interface correctly', () => {
62
- const response: import('../StorageClient').GetUploadResponse = {
63
- url: 'https://example.com/upload',
64
- fields: [
65
- { key: 'key', value: 'test/path.txt' },
66
- { key: 'acl', value: 'public-read' },
67
- ],
68
- };
61
+ it('should define GetUploadResponse interface correctly', () => {
62
+ const response: import('../StorageClient').GetUploadResponse = {
63
+ url: 'https://example.com/upload',
64
+ fields: [
65
+ { key: 'key', value: 'test/path.txt' },
66
+ { key: 'acl', value: 'public-read' },
67
+ ],
68
+ };
69
69
 
70
- expect(response.url).toBe('https://example.com/upload');
71
- expect(response.fields).toHaveLength(2);
72
- expect(response.fields[0]).toEqual({
73
- key: 'key',
74
- value: 'test/path.txt',
75
- });
76
- expect(response.fields[1]).toEqual({ key: 'acl', value: 'public-read' });
77
- });
70
+ expect(response.url).toBe('https://example.com/upload');
71
+ expect(response.fields).toHaveLength(2);
72
+ expect(response.fields[0]).toEqual({
73
+ key: 'key',
74
+ value: 'test/path.txt',
75
+ });
76
+ expect(response.fields[1]).toEqual({ key: 'acl', value: 'public-read' });
77
+ });
78
78
 
79
- it('should define UploadField type correctly', () => {
80
- const field: import('../StorageClient').UploadField = {
81
- key: 'test-key',
82
- value: 'test-value',
83
- };
79
+ it('should define UploadField type correctly', () => {
80
+ const field: import('../StorageClient').UploadField = {
81
+ key: 'test-key',
82
+ value: 'test-value',
83
+ };
84
84
 
85
- expect(field.key).toBe('test-key');
86
- expect(field.value).toBe('test-value');
87
- });
88
- });
85
+ expect(field.key).toBe('test-key');
86
+ expect(field.value).toBe('test-value');
87
+ });
88
+ });
89
89
  });
package/src/aws.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  export {
2
- AmazonStorageClient,
3
- AmazonCannedAccessControlList,
2
+ AmazonCannedAccessControlList,
3
+ AmazonStorageClient,
4
4
  } from './AmazonStorageClient';
5
5
  export type {
6
- StorageClient,
7
- DocumentVersion,
8
- File,
9
- GetUploadParams,
10
- GetUploadResponse,
6
+ DocumentVersion,
7
+ File,
8
+ GetUploadParams,
9
+ GetUploadResponse,
10
+ StorageClient,
11
11
  } from './StorageClient';
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist",
5
+ "rootDir": "./src",
6
+ "composite": true
7
+ },
8
+ "include": ["src/**/*"]
9
+ }
package/tsdown.config.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { defineConfig } from 'tsdown';
2
2
 
3
3
  export default defineConfig({
4
- external: [
5
- '@aws-sdk/client-s3',
6
- '@aws-sdk/s3-presigned-post',
7
- '@aws-sdk/s3-request-presigner',
8
- ],
4
+ external: [
5
+ '@aws-sdk/client-s3',
6
+ '@aws-sdk/s3-presigned-post',
7
+ '@aws-sdk/s3-request-presigner',
8
+ ],
9
9
  });