@sparkstudio/storage-ui 1.0.11 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +33 -21
- package/dist/index.d.cts +27 -18
- package/dist/index.d.ts +27 -18
- package/dist/index.js +32 -21
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -26,6 +26,7 @@ __export(index_exports, {
|
|
|
26
26
|
ContainerType: () => ContainerType,
|
|
27
27
|
Home: () => Home,
|
|
28
28
|
HomeView: () => HomeView,
|
|
29
|
+
S3: () => S3,
|
|
29
30
|
SparkStudioStorageSDK: () => SparkStudioStorageSDK,
|
|
30
31
|
UploadContainer: () => UploadContainer
|
|
31
32
|
});
|
|
@@ -109,23 +110,22 @@ var Container = class {
|
|
|
109
110
|
if (!response.ok) throw new Error(await response.text());
|
|
110
111
|
return await response.json();
|
|
111
112
|
}
|
|
112
|
-
async
|
|
113
|
-
const url = `${this.baseUrl}/api/Container/
|
|
113
|
+
async DeleteContainer(id) {
|
|
114
|
+
const url = `${this.baseUrl}/api/Container/DeleteContainer/` + id;
|
|
114
115
|
const token = localStorage.getItem("auth_token");
|
|
115
116
|
const requestOptions = {
|
|
116
|
-
method: "
|
|
117
|
+
method: "GET",
|
|
117
118
|
headers: {
|
|
118
119
|
"Content-Type": "application/json",
|
|
119
120
|
...token && { Authorization: `Bearer ${token}` }
|
|
120
|
-
}
|
|
121
|
-
body: JSON.stringify(containerDTO)
|
|
121
|
+
}
|
|
122
122
|
};
|
|
123
123
|
const response = await fetch(url, requestOptions);
|
|
124
124
|
if (!response.ok) throw new Error(await response.text());
|
|
125
125
|
return await response.json();
|
|
126
126
|
}
|
|
127
|
-
async
|
|
128
|
-
const url = `${this.baseUrl}/api/Container/
|
|
127
|
+
async CreateFileContainer(fileName, size, contentType) {
|
|
128
|
+
const url = `${this.baseUrl}/api/Container/CreateFileContainer/` + fileName + `/` + size + `/` + contentType;
|
|
129
129
|
const token = localStorage.getItem("auth_token");
|
|
130
130
|
const requestOptions = {
|
|
131
131
|
method: "GET",
|
|
@@ -138,22 +138,39 @@ var Container = class {
|
|
|
138
138
|
if (!response.ok) throw new Error(await response.text());
|
|
139
139
|
return await response.json();
|
|
140
140
|
}
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
// src/api/Controllers/Home.ts
|
|
144
|
+
var Home = class {
|
|
145
|
+
baseUrl;
|
|
146
|
+
constructor(baseUrl) {
|
|
147
|
+
this.baseUrl = baseUrl;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// src/api/Controllers/S3.ts
|
|
152
|
+
var S3 = class {
|
|
153
|
+
baseUrl;
|
|
154
|
+
constructor(baseUrl) {
|
|
155
|
+
this.baseUrl = baseUrl;
|
|
156
|
+
}
|
|
157
|
+
async DeleteS3(containerDTO) {
|
|
158
|
+
const url = `${this.baseUrl}/api/S3/DeleteS3`;
|
|
143
159
|
const token = localStorage.getItem("auth_token");
|
|
144
160
|
const requestOptions = {
|
|
145
|
-
method: "
|
|
161
|
+
method: "POST",
|
|
146
162
|
headers: {
|
|
147
163
|
"Content-Type": "application/json",
|
|
148
164
|
...token && { Authorization: `Bearer ${token}` }
|
|
149
|
-
}
|
|
165
|
+
},
|
|
166
|
+
body: JSON.stringify(containerDTO)
|
|
150
167
|
};
|
|
151
168
|
const response = await fetch(url, requestOptions);
|
|
152
169
|
if (!response.ok) throw new Error(await response.text());
|
|
153
170
|
return await response.json();
|
|
154
171
|
}
|
|
155
172
|
async GetPreSignedUrl(containerDTO) {
|
|
156
|
-
const url = `${this.baseUrl}/api/
|
|
173
|
+
const url = `${this.baseUrl}/api/S3/GetPreSignedUrl`;
|
|
157
174
|
const token = localStorage.getItem("auth_token");
|
|
158
175
|
const requestOptions = {
|
|
159
176
|
method: "POST",
|
|
@@ -169,21 +186,15 @@ var Container = class {
|
|
|
169
186
|
}
|
|
170
187
|
};
|
|
171
188
|
|
|
172
|
-
// src/api/Controllers/Home.ts
|
|
173
|
-
var Home = class {
|
|
174
|
-
baseUrl;
|
|
175
|
-
constructor(baseUrl) {
|
|
176
|
-
this.baseUrl = baseUrl;
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
|
|
180
189
|
// src/api/SparkStudioStorageSDK.ts
|
|
181
190
|
var SparkStudioStorageSDK = class {
|
|
182
191
|
container;
|
|
183
192
|
home;
|
|
193
|
+
s3;
|
|
184
194
|
constructor(baseUrl) {
|
|
185
195
|
this.container = new Container(baseUrl);
|
|
186
196
|
this.home = new Home(baseUrl);
|
|
197
|
+
this.s3 = new S3(baseUrl);
|
|
187
198
|
}
|
|
188
199
|
};
|
|
189
200
|
|
|
@@ -425,7 +436,7 @@ function HomeView() {
|
|
|
425
436
|
const sdkDb = new SparkStudioStorageSDK("https://lf9zyufpuk.execute-api.us-east-2.amazonaws.com/Prod");
|
|
426
437
|
const sdkS3 = new SparkStudioStorageSDK("https://iq0gmcn0pd.execute-api.us-east-2.amazonaws.com/Prod");
|
|
427
438
|
const containerDTO = await sdkDb.container.CreateFileContainer(file.name, file.size, encodeURIComponent(file.type));
|
|
428
|
-
const resultS3 = await sdkS3.
|
|
439
|
+
const resultS3 = await sdkS3.s3.GetPreSignedUrl(containerDTO);
|
|
429
440
|
return resultS3;
|
|
430
441
|
};
|
|
431
442
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
@@ -466,6 +477,7 @@ function HomeView() {
|
|
|
466
477
|
ContainerType,
|
|
467
478
|
Home,
|
|
468
479
|
HomeView,
|
|
480
|
+
S3,
|
|
469
481
|
SparkStudioStorageSDK,
|
|
470
482
|
UploadContainer
|
|
471
483
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -33,6 +33,29 @@ declare class ContainerDTO implements IContainerDTO {
|
|
|
33
33
|
constructor(init: ContainerDTOInit);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Auto-generated client for the Container controller.
|
|
38
|
+
*/
|
|
39
|
+
declare class Container {
|
|
40
|
+
private baseUrl;
|
|
41
|
+
constructor(baseUrl: string);
|
|
42
|
+
ReadChildrenByContainerId(parentId: string): Promise<ContainerDTO[]>;
|
|
43
|
+
ReadRootContainers(): Promise<ContainerDTO[]>;
|
|
44
|
+
Read(id: string): Promise<ContainerDTO>;
|
|
45
|
+
Create(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
46
|
+
Update(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
47
|
+
DeleteContainer(id: string): Promise<ContainerDTO>;
|
|
48
|
+
CreateFileContainer(fileName: string, size: number, contentType: string): Promise<ContainerDTO>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Auto-generated client for the Home controller.
|
|
53
|
+
*/
|
|
54
|
+
declare class Home {
|
|
55
|
+
private baseUrl;
|
|
56
|
+
constructor(baseUrl: string);
|
|
57
|
+
}
|
|
58
|
+
|
|
36
59
|
/**
|
|
37
60
|
* Represents an Auto-generated model for AWSPresignedUrlDTO.
|
|
38
61
|
*/
|
|
@@ -50,36 +73,22 @@ declare class AWSPresignedUrlDTO implements IAWSPresignedUrlDTO {
|
|
|
50
73
|
}
|
|
51
74
|
|
|
52
75
|
/**
|
|
53
|
-
* Auto-generated client for the
|
|
76
|
+
* Auto-generated client for the S3 controller.
|
|
54
77
|
*/
|
|
55
|
-
declare class
|
|
78
|
+
declare class S3 {
|
|
56
79
|
private baseUrl;
|
|
57
80
|
constructor(baseUrl: string);
|
|
58
|
-
ReadChildrenByContainerId(parentId: string): Promise<ContainerDTO[]>;
|
|
59
|
-
ReadRootContainers(): Promise<ContainerDTO[]>;
|
|
60
|
-
Read(id: string): Promise<ContainerDTO>;
|
|
61
|
-
Create(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
62
|
-
Update(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
63
81
|
DeleteS3(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
64
|
-
DeleteContainer(id: string): Promise<ContainerDTO>;
|
|
65
|
-
CreateFileContainer(fileName: string, size: number, contentType: string): Promise<ContainerDTO>;
|
|
66
82
|
GetPreSignedUrl(containerDTO: ContainerDTO): Promise<AWSPresignedUrlDTO>;
|
|
67
83
|
}
|
|
68
84
|
|
|
69
|
-
/**
|
|
70
|
-
* Auto-generated client for the Home controller.
|
|
71
|
-
*/
|
|
72
|
-
declare class Home {
|
|
73
|
-
private baseUrl;
|
|
74
|
-
constructor(baseUrl: string);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
85
|
/**
|
|
78
86
|
* Auto-generated API client.
|
|
79
87
|
*/
|
|
80
88
|
declare class SparkStudioStorageSDK {
|
|
81
89
|
container: Container;
|
|
82
90
|
home: Home;
|
|
91
|
+
s3: S3;
|
|
83
92
|
constructor(baseUrl: string);
|
|
84
93
|
}
|
|
85
94
|
|
|
@@ -113,4 +122,4 @@ declare const UploadContainer: React.FC<UploadContainerProps>;
|
|
|
113
122
|
|
|
114
123
|
declare function HomeView(): react_jsx_runtime.JSX.Element;
|
|
115
124
|
|
|
116
|
-
export { AWSPresignedUrlDTO, Container, ContainerDTO, ContainerType, Home, HomeView, type IAWSPresignedUrlDTO, type IContainerDTO, SparkStudioStorageSDK, UploadContainer, type UploadContainerProps };
|
|
125
|
+
export { AWSPresignedUrlDTO, Container, ContainerDTO, ContainerType, Home, HomeView, type IAWSPresignedUrlDTO, type IContainerDTO, S3, SparkStudioStorageSDK, UploadContainer, type UploadContainerProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -33,6 +33,29 @@ declare class ContainerDTO implements IContainerDTO {
|
|
|
33
33
|
constructor(init: ContainerDTOInit);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Auto-generated client for the Container controller.
|
|
38
|
+
*/
|
|
39
|
+
declare class Container {
|
|
40
|
+
private baseUrl;
|
|
41
|
+
constructor(baseUrl: string);
|
|
42
|
+
ReadChildrenByContainerId(parentId: string): Promise<ContainerDTO[]>;
|
|
43
|
+
ReadRootContainers(): Promise<ContainerDTO[]>;
|
|
44
|
+
Read(id: string): Promise<ContainerDTO>;
|
|
45
|
+
Create(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
46
|
+
Update(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
47
|
+
DeleteContainer(id: string): Promise<ContainerDTO>;
|
|
48
|
+
CreateFileContainer(fileName: string, size: number, contentType: string): Promise<ContainerDTO>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Auto-generated client for the Home controller.
|
|
53
|
+
*/
|
|
54
|
+
declare class Home {
|
|
55
|
+
private baseUrl;
|
|
56
|
+
constructor(baseUrl: string);
|
|
57
|
+
}
|
|
58
|
+
|
|
36
59
|
/**
|
|
37
60
|
* Represents an Auto-generated model for AWSPresignedUrlDTO.
|
|
38
61
|
*/
|
|
@@ -50,36 +73,22 @@ declare class AWSPresignedUrlDTO implements IAWSPresignedUrlDTO {
|
|
|
50
73
|
}
|
|
51
74
|
|
|
52
75
|
/**
|
|
53
|
-
* Auto-generated client for the
|
|
76
|
+
* Auto-generated client for the S3 controller.
|
|
54
77
|
*/
|
|
55
|
-
declare class
|
|
78
|
+
declare class S3 {
|
|
56
79
|
private baseUrl;
|
|
57
80
|
constructor(baseUrl: string);
|
|
58
|
-
ReadChildrenByContainerId(parentId: string): Promise<ContainerDTO[]>;
|
|
59
|
-
ReadRootContainers(): Promise<ContainerDTO[]>;
|
|
60
|
-
Read(id: string): Promise<ContainerDTO>;
|
|
61
|
-
Create(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
62
|
-
Update(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
63
81
|
DeleteS3(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
64
|
-
DeleteContainer(id: string): Promise<ContainerDTO>;
|
|
65
|
-
CreateFileContainer(fileName: string, size: number, contentType: string): Promise<ContainerDTO>;
|
|
66
82
|
GetPreSignedUrl(containerDTO: ContainerDTO): Promise<AWSPresignedUrlDTO>;
|
|
67
83
|
}
|
|
68
84
|
|
|
69
|
-
/**
|
|
70
|
-
* Auto-generated client for the Home controller.
|
|
71
|
-
*/
|
|
72
|
-
declare class Home {
|
|
73
|
-
private baseUrl;
|
|
74
|
-
constructor(baseUrl: string);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
85
|
/**
|
|
78
86
|
* Auto-generated API client.
|
|
79
87
|
*/
|
|
80
88
|
declare class SparkStudioStorageSDK {
|
|
81
89
|
container: Container;
|
|
82
90
|
home: Home;
|
|
91
|
+
s3: S3;
|
|
83
92
|
constructor(baseUrl: string);
|
|
84
93
|
}
|
|
85
94
|
|
|
@@ -113,4 +122,4 @@ declare const UploadContainer: React.FC<UploadContainerProps>;
|
|
|
113
122
|
|
|
114
123
|
declare function HomeView(): react_jsx_runtime.JSX.Element;
|
|
115
124
|
|
|
116
|
-
export { AWSPresignedUrlDTO, Container, ContainerDTO, ContainerType, Home, HomeView, type IAWSPresignedUrlDTO, type IContainerDTO, SparkStudioStorageSDK, UploadContainer, type UploadContainerProps };
|
|
125
|
+
export { AWSPresignedUrlDTO, Container, ContainerDTO, ContainerType, Home, HomeView, type IAWSPresignedUrlDTO, type IContainerDTO, S3, SparkStudioStorageSDK, UploadContainer, type UploadContainerProps };
|
package/dist/index.js
CHANGED
|
@@ -76,23 +76,22 @@ var Container = class {
|
|
|
76
76
|
if (!response.ok) throw new Error(await response.text());
|
|
77
77
|
return await response.json();
|
|
78
78
|
}
|
|
79
|
-
async
|
|
80
|
-
const url = `${this.baseUrl}/api/Container/
|
|
79
|
+
async DeleteContainer(id) {
|
|
80
|
+
const url = `${this.baseUrl}/api/Container/DeleteContainer/` + id;
|
|
81
81
|
const token = localStorage.getItem("auth_token");
|
|
82
82
|
const requestOptions = {
|
|
83
|
-
method: "
|
|
83
|
+
method: "GET",
|
|
84
84
|
headers: {
|
|
85
85
|
"Content-Type": "application/json",
|
|
86
86
|
...token && { Authorization: `Bearer ${token}` }
|
|
87
|
-
}
|
|
88
|
-
body: JSON.stringify(containerDTO)
|
|
87
|
+
}
|
|
89
88
|
};
|
|
90
89
|
const response = await fetch(url, requestOptions);
|
|
91
90
|
if (!response.ok) throw new Error(await response.text());
|
|
92
91
|
return await response.json();
|
|
93
92
|
}
|
|
94
|
-
async
|
|
95
|
-
const url = `${this.baseUrl}/api/Container/
|
|
93
|
+
async CreateFileContainer(fileName, size, contentType) {
|
|
94
|
+
const url = `${this.baseUrl}/api/Container/CreateFileContainer/` + fileName + `/` + size + `/` + contentType;
|
|
96
95
|
const token = localStorage.getItem("auth_token");
|
|
97
96
|
const requestOptions = {
|
|
98
97
|
method: "GET",
|
|
@@ -105,22 +104,39 @@ var Container = class {
|
|
|
105
104
|
if (!response.ok) throw new Error(await response.text());
|
|
106
105
|
return await response.json();
|
|
107
106
|
}
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// src/api/Controllers/Home.ts
|
|
110
|
+
var Home = class {
|
|
111
|
+
baseUrl;
|
|
112
|
+
constructor(baseUrl) {
|
|
113
|
+
this.baseUrl = baseUrl;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// src/api/Controllers/S3.ts
|
|
118
|
+
var S3 = class {
|
|
119
|
+
baseUrl;
|
|
120
|
+
constructor(baseUrl) {
|
|
121
|
+
this.baseUrl = baseUrl;
|
|
122
|
+
}
|
|
123
|
+
async DeleteS3(containerDTO) {
|
|
124
|
+
const url = `${this.baseUrl}/api/S3/DeleteS3`;
|
|
110
125
|
const token = localStorage.getItem("auth_token");
|
|
111
126
|
const requestOptions = {
|
|
112
|
-
method: "
|
|
127
|
+
method: "POST",
|
|
113
128
|
headers: {
|
|
114
129
|
"Content-Type": "application/json",
|
|
115
130
|
...token && { Authorization: `Bearer ${token}` }
|
|
116
|
-
}
|
|
131
|
+
},
|
|
132
|
+
body: JSON.stringify(containerDTO)
|
|
117
133
|
};
|
|
118
134
|
const response = await fetch(url, requestOptions);
|
|
119
135
|
if (!response.ok) throw new Error(await response.text());
|
|
120
136
|
return await response.json();
|
|
121
137
|
}
|
|
122
138
|
async GetPreSignedUrl(containerDTO) {
|
|
123
|
-
const url = `${this.baseUrl}/api/
|
|
139
|
+
const url = `${this.baseUrl}/api/S3/GetPreSignedUrl`;
|
|
124
140
|
const token = localStorage.getItem("auth_token");
|
|
125
141
|
const requestOptions = {
|
|
126
142
|
method: "POST",
|
|
@@ -136,21 +152,15 @@ var Container = class {
|
|
|
136
152
|
}
|
|
137
153
|
};
|
|
138
154
|
|
|
139
|
-
// src/api/Controllers/Home.ts
|
|
140
|
-
var Home = class {
|
|
141
|
-
baseUrl;
|
|
142
|
-
constructor(baseUrl) {
|
|
143
|
-
this.baseUrl = baseUrl;
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
|
|
147
155
|
// src/api/SparkStudioStorageSDK.ts
|
|
148
156
|
var SparkStudioStorageSDK = class {
|
|
149
157
|
container;
|
|
150
158
|
home;
|
|
159
|
+
s3;
|
|
151
160
|
constructor(baseUrl) {
|
|
152
161
|
this.container = new Container(baseUrl);
|
|
153
162
|
this.home = new Home(baseUrl);
|
|
163
|
+
this.s3 = new S3(baseUrl);
|
|
154
164
|
}
|
|
155
165
|
};
|
|
156
166
|
|
|
@@ -392,7 +402,7 @@ function HomeView() {
|
|
|
392
402
|
const sdkDb = new SparkStudioStorageSDK("https://lf9zyufpuk.execute-api.us-east-2.amazonaws.com/Prod");
|
|
393
403
|
const sdkS3 = new SparkStudioStorageSDK("https://iq0gmcn0pd.execute-api.us-east-2.amazonaws.com/Prod");
|
|
394
404
|
const containerDTO = await sdkDb.container.CreateFileContainer(file.name, file.size, encodeURIComponent(file.type));
|
|
395
|
-
const resultS3 = await sdkS3.
|
|
405
|
+
const resultS3 = await sdkS3.s3.GetPreSignedUrl(containerDTO);
|
|
396
406
|
return resultS3;
|
|
397
407
|
};
|
|
398
408
|
return /* @__PURE__ */ jsxs2(
|
|
@@ -432,6 +442,7 @@ export {
|
|
|
432
442
|
ContainerType,
|
|
433
443
|
Home,
|
|
434
444
|
HomeView,
|
|
445
|
+
S3,
|
|
435
446
|
SparkStudioStorageSDK,
|
|
436
447
|
UploadContainer
|
|
437
448
|
};
|