@gofynd/fdk-client-javascript 1.4.15-beta.2 → 1.4.15-beta.4
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/README.md +2 -2
- package/application.d.ts +1 -2
- package/application.js +2 -3
- package/index.d.ts +1 -2
- package/index.js +7 -1
- package/package.json +2 -3
- package/sdk/application/ApplicationClient.js +0 -18
- package/sdk/application/Cart/CartApplicationClient.d.ts +55 -90
- package/sdk/application/Cart/CartApplicationClient.js +27 -1203
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +80 -142
- package/sdk/application/Catalog/CatalogApplicationClient.js +40 -1344
- package/sdk/application/Common/CommonApplicationClient.d.ts +4 -8
- package/sdk/application/Common/CommonApplicationClient.js +2 -92
- package/sdk/application/Communication/CommunicationApplicationClient.d.ts +6 -19
- package/sdk/application/Communication/CommunicationApplicationClient.js +3 -148
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +32 -73
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +16 -727
- package/sdk/application/Content/ContentApplicationClient.d.ts +46 -78
- package/sdk/application/Content/ContentApplicationClient.js +23 -941
- package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +6 -11
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +4 -134
- package/sdk/application/Lead/LeadApplicationClient.d.ts +10 -18
- package/sdk/application/Lead/LeadApplicationClient.js +5 -217
- package/sdk/application/Logistic/LogisticApplicationClient.d.ts +22 -39
- package/sdk/application/Logistic/LogisticApplicationClient.js +11 -496
- package/sdk/application/Order/OrderApplicationClient.d.ts +22 -42
- package/sdk/application/Order/OrderApplicationClient.js +11 -505
- package/sdk/application/Payment/PaymentApplicationClient.d.ts +92 -212
- package/sdk/application/Payment/PaymentApplicationClient.js +46 -2106
- package/sdk/application/Rewards/RewardsApplicationClient.d.ts +14 -28
- package/sdk/application/Rewards/RewardsApplicationClient.js +7 -311
- package/sdk/application/Share/ShareApplicationClient.d.ts +14 -24
- package/sdk/application/Share/ShareApplicationClient.js +7 -309
- package/sdk/application/Theme/ThemeApplicationClient.d.ts +8 -14
- package/sdk/application/Theme/ThemeApplicationClient.js +4 -174
- package/sdk/application/User/UserApplicationClient.d.ts +85 -136
- package/sdk/application/User/UserApplicationClient.js +42 -1818
- package/sdk/application/Webhook/WebhookApplicationClient.d.ts +2 -5
- package/sdk/application/Webhook/WebhookApplicationClient.js +1 -50
- package/sdk/application/index.d.ts +0 -18
- package/sdk/application/index.js +0 -33
- package/sdk/partner/OAuthClient.js +1 -0
- package/sdk/platform/Cart/CartPlatformModel.d.ts +7 -0
- package/sdk/platform/Cart/CartPlatformModel.js +3 -0
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +0 -7
- package/sdk/platform/Catalog/CatalogPlatformModel.js +0 -3
- package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +7 -0
- package/sdk/platform/Configuration/ConfigurationPlatformModel.js +3 -0
- package/sdk/public/Configuration/ConfigurationPublicClient.js +4 -2
- package/sdk/public/Content/ContentPublicClient.js +4 -2
- package/sdk/public/Partner/PartnerPublicClient.js +4 -2
- package/sdk/public/Webhook/WebhookPublicClient.js +4 -2
- package/sdk/application/Cart/CartApplicationModel.d.ts +0 -3994
- package/sdk/application/Cart/CartApplicationModel.js +0 -2497
- package/sdk/application/Cart/CartApplicationValidator.d.ts +0 -769
- package/sdk/application/Cart/CartApplicationValidator.js +0 -530
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +0 -3857
- package/sdk/application/Catalog/CatalogApplicationModel.js +0 -2629
- package/sdk/application/Catalog/CatalogApplicationValidator.d.ts +0 -791
- package/sdk/application/Catalog/CatalogApplicationValidator.js +0 -551
- package/sdk/application/Common/CommonApplicationModel.d.ts +0 -449
- package/sdk/application/Common/CommonApplicationModel.js +0 -308
- package/sdk/application/Common/CommonApplicationValidator.d.ts +0 -46
- package/sdk/application/Common/CommonApplicationValidator.js +0 -38
- package/sdk/application/Communication/CommunicationApplicationModel.d.ts +0 -293
- package/sdk/application/Communication/CommunicationApplicationModel.js +0 -201
- package/sdk/application/Communication/CommunicationApplicationValidator.d.ts +0 -29
- package/sdk/application/Communication/CommunicationApplicationValidator.js +0 -38
- package/sdk/application/Configuration/ConfigurationApplicationModel.d.ts +0 -2556
- package/sdk/application/Configuration/ConfigurationApplicationModel.js +0 -1887
- package/sdk/application/Configuration/ConfigurationApplicationValidator.d.ts +0 -179
- package/sdk/application/Configuration/ConfigurationApplicationValidator.js +0 -176
- package/sdk/application/Content/ContentApplicationModel.d.ts +0 -2133
- package/sdk/application/Content/ContentApplicationModel.js +0 -1589
- package/sdk/application/Content/ContentApplicationValidator.d.ts +0 -284
- package/sdk/application/Content/ContentApplicationValidator.js +0 -264
- package/sdk/application/FileStorage/FileStorageApplicationModel.d.ts +0 -272
- package/sdk/application/FileStorage/FileStorageApplicationModel.js +0 -190
- package/sdk/application/FileStorage/FileStorageApplicationValidator.d.ts +0 -56
- package/sdk/application/FileStorage/FileStorageApplicationValidator.js +0 -53
- package/sdk/application/Lead/LeadApplicationModel.d.ts +0 -590
- package/sdk/application/Lead/LeadApplicationModel.js +0 -480
- package/sdk/application/Lead/LeadApplicationValidator.d.ts +0 -68
- package/sdk/application/Lead/LeadApplicationValidator.js +0 -71
- package/sdk/application/Logistic/LogisticApplicationModel.d.ts +0 -1675
- package/sdk/application/Logistic/LogisticApplicationModel.js +0 -1121
- package/sdk/application/Logistic/LogisticApplicationValidator.d.ts +0 -254
- package/sdk/application/Logistic/LogisticApplicationValidator.js +0 -190
- package/sdk/application/Order/OrderApplicationModel.d.ts +0 -2296
- package/sdk/application/Order/OrderApplicationModel.js +0 -1471
- package/sdk/application/Order/OrderApplicationValidator.d.ts +0 -265
- package/sdk/application/Order/OrderApplicationValidator.js +0 -197
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +0 -4058
- package/sdk/application/Payment/PaymentApplicationModel.js +0 -2630
- package/sdk/application/Payment/PaymentApplicationValidator.d.ts +0 -576
- package/sdk/application/Payment/PaymentApplicationValidator.js +0 -594
- package/sdk/application/Rewards/RewardsApplicationModel.d.ts +0 -365
- package/sdk/application/Rewards/RewardsApplicationModel.js +0 -396
- package/sdk/application/Rewards/RewardsApplicationValidator.d.ts +0 -73
- package/sdk/application/Rewards/RewardsApplicationValidator.js +0 -84
- package/sdk/application/Share/ShareApplicationModel.d.ts +0 -339
- package/sdk/application/Share/ShareApplicationModel.js +0 -234
- package/sdk/application/Share/ShareApplicationValidator.d.ts +0 -90
- package/sdk/application/Share/ShareApplicationValidator.js +0 -91
- package/sdk/application/Theme/ThemeApplicationModel.d.ts +0 -1713
- package/sdk/application/Theme/ThemeApplicationModel.js +0 -1426
- package/sdk/application/Theme/ThemeApplicationValidator.d.ts +0 -66
- package/sdk/application/Theme/ThemeApplicationValidator.js +0 -58
- package/sdk/application/User/UserApplicationModel.d.ts +0 -1943
- package/sdk/application/User/UserApplicationModel.js +0 -1382
- package/sdk/application/User/UserApplicationValidator.d.ts +0 -560
- package/sdk/application/User/UserApplicationValidator.js +0 -573
- package/sdk/application/Webhook/WebhookApplicationModel.d.ts +0 -52
- package/sdk/application/Webhook/WebhookApplicationModel.js +0 -46
- package/sdk/application/Webhook/WebhookApplicationValidator.d.ts +0 -16
- package/sdk/application/Webhook/WebhookApplicationValidator.js +0 -19
- package/sdk/common/Clickstream.d.ts +0 -1
- package/sdk/common/Clickstream.js +0 -464
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
export = FileStorageApplicationModel;
|
|
2
|
-
/**
|
|
3
|
-
* @typedef CDN
|
|
4
|
-
* @property {string} url - The CDN URL for accessing the file.
|
|
5
|
-
* @property {string} absolute_url - The absolute URL of the file.
|
|
6
|
-
* @property {string} relative_url - The relative URL of the file.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* @typedef Upload
|
|
10
|
-
* @property {number} expiry - The expiration time for the signed URL.
|
|
11
|
-
* @property {string} url - The signed URL for uploading the file.
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* @typedef StartResponse
|
|
15
|
-
* @property {string} file_name - The name of the file that was uploaded.
|
|
16
|
-
* @property {string} file_path - The path to the file in the storage location.
|
|
17
|
-
* @property {string} content_type - The content type of the file.
|
|
18
|
-
* @property {string} [method] - The HTTP method to be used for uploading the file.
|
|
19
|
-
* @property {string} namespace - The namespace associated with the file.
|
|
20
|
-
* @property {string} operation - The operation to be performed on the storage service.
|
|
21
|
-
* @property {number} size - The size of the file in bytes.
|
|
22
|
-
* @property {Upload} upload
|
|
23
|
-
* @property {CDN} cdn
|
|
24
|
-
* @property {string[]} [tags] - Tags associated with the file.
|
|
25
|
-
*/
|
|
26
|
-
/**
|
|
27
|
-
* @typedef Params
|
|
28
|
-
* @property {string} [subpath] - Specifies a particular directory or location
|
|
29
|
-
* within the storage structure where the file should be placed or is located.
|
|
30
|
-
*/
|
|
31
|
-
/**
|
|
32
|
-
* @typedef StartRequest
|
|
33
|
-
* @property {string} file_name - The name of the file to be uploaded.
|
|
34
|
-
* @property {string} content_type - The name of the file to be uploaded.
|
|
35
|
-
* @property {number} size - The size of the file in bytes.
|
|
36
|
-
* @property {string[]} [tags] - Tags associated with the file.
|
|
37
|
-
* @property {Params} [params]
|
|
38
|
-
*/
|
|
39
|
-
/**
|
|
40
|
-
* @typedef CreatedBy
|
|
41
|
-
* @property {string} [username] - The username of the user who created the file.
|
|
42
|
-
*/
|
|
43
|
-
/**
|
|
44
|
-
* @typedef CompleteResponse
|
|
45
|
-
* @property {string} _id - The unique identifier of the uploaded file.
|
|
46
|
-
* @property {string} file_name - The name of the file that was uploaded.
|
|
47
|
-
* @property {string} file_path - The path to the file in the storage location.
|
|
48
|
-
* @property {string} content_type - The content type of the file.
|
|
49
|
-
* @property {string} namespace - The namespace associated with the file.
|
|
50
|
-
* @property {string} operation - The operation performed on the storage service.
|
|
51
|
-
* @property {number} size - The size of the file in bytes.
|
|
52
|
-
* @property {Upload} upload
|
|
53
|
-
* @property {CDN} cdn
|
|
54
|
-
* @property {boolean} success - The success status of the upload operation.
|
|
55
|
-
* @property {string[]} [tags] - Tags associated with the file.
|
|
56
|
-
* @property {string} created_on - The timestamp when the file was created.
|
|
57
|
-
* @property {string} modified_on - The timestamp when the file was last modified.
|
|
58
|
-
* @property {CreatedBy} [created_by]
|
|
59
|
-
*/
|
|
60
|
-
/**
|
|
61
|
-
* @typedef Urls
|
|
62
|
-
* @property {string} url - This is the original asset URL provided in the
|
|
63
|
-
* request. This is the URL for which a signed URL has been generated.
|
|
64
|
-
* @property {string} signed_url - Generated signed URL.
|
|
65
|
-
* @property {number} expiry - The expiration time for the signed URL.
|
|
66
|
-
*/
|
|
67
|
-
/**
|
|
68
|
-
* @typedef SignUrlResponse
|
|
69
|
-
* @property {Urls[]} urls - Signed URL object.
|
|
70
|
-
*/
|
|
71
|
-
/**
|
|
72
|
-
* @typedef SignUrlRequest
|
|
73
|
-
* @property {number} expiry - The expiration time for the signed URL.
|
|
74
|
-
* @property {string[]} urls - List of asset URLs to be signed. .
|
|
75
|
-
*/
|
|
76
|
-
declare class FileStorageApplicationModel {
|
|
77
|
-
}
|
|
78
|
-
declare namespace FileStorageApplicationModel {
|
|
79
|
-
export { CDN, Upload, StartResponse, Params, StartRequest, CreatedBy, CompleteResponse, Urls, SignUrlResponse, SignUrlRequest };
|
|
80
|
-
}
|
|
81
|
-
/** @returns {CDN} */
|
|
82
|
-
declare function CDN(): CDN;
|
|
83
|
-
type CDN = {
|
|
84
|
-
/**
|
|
85
|
-
* - The CDN URL for accessing the file.
|
|
86
|
-
*/
|
|
87
|
-
url: string;
|
|
88
|
-
/**
|
|
89
|
-
* - The absolute URL of the file.
|
|
90
|
-
*/
|
|
91
|
-
absolute_url: string;
|
|
92
|
-
/**
|
|
93
|
-
* - The relative URL of the file.
|
|
94
|
-
*/
|
|
95
|
-
relative_url: string;
|
|
96
|
-
};
|
|
97
|
-
/** @returns {Upload} */
|
|
98
|
-
declare function Upload(): Upload;
|
|
99
|
-
type Upload = {
|
|
100
|
-
/**
|
|
101
|
-
* - The expiration time for the signed URL.
|
|
102
|
-
*/
|
|
103
|
-
expiry: number;
|
|
104
|
-
/**
|
|
105
|
-
* - The signed URL for uploading the file.
|
|
106
|
-
*/
|
|
107
|
-
url: string;
|
|
108
|
-
};
|
|
109
|
-
/** @returns {StartResponse} */
|
|
110
|
-
declare function StartResponse(): StartResponse;
|
|
111
|
-
type StartResponse = {
|
|
112
|
-
/**
|
|
113
|
-
* - The name of the file that was uploaded.
|
|
114
|
-
*/
|
|
115
|
-
file_name: string;
|
|
116
|
-
/**
|
|
117
|
-
* - The path to the file in the storage location.
|
|
118
|
-
*/
|
|
119
|
-
file_path: string;
|
|
120
|
-
/**
|
|
121
|
-
* - The content type of the file.
|
|
122
|
-
*/
|
|
123
|
-
content_type: string;
|
|
124
|
-
/**
|
|
125
|
-
* - The HTTP method to be used for uploading the file.
|
|
126
|
-
*/
|
|
127
|
-
method?: string;
|
|
128
|
-
/**
|
|
129
|
-
* - The namespace associated with the file.
|
|
130
|
-
*/
|
|
131
|
-
namespace: string;
|
|
132
|
-
/**
|
|
133
|
-
* - The operation to be performed on the storage service.
|
|
134
|
-
*/
|
|
135
|
-
operation: string;
|
|
136
|
-
/**
|
|
137
|
-
* - The size of the file in bytes.
|
|
138
|
-
*/
|
|
139
|
-
size: number;
|
|
140
|
-
upload: Upload;
|
|
141
|
-
cdn: CDN;
|
|
142
|
-
/**
|
|
143
|
-
* - Tags associated with the file.
|
|
144
|
-
*/
|
|
145
|
-
tags?: string[];
|
|
146
|
-
};
|
|
147
|
-
/** @returns {Params} */
|
|
148
|
-
declare function Params(): Params;
|
|
149
|
-
type Params = {
|
|
150
|
-
/**
|
|
151
|
-
* - Specifies a particular directory or location
|
|
152
|
-
* within the storage structure where the file should be placed or is located.
|
|
153
|
-
*/
|
|
154
|
-
subpath?: string;
|
|
155
|
-
};
|
|
156
|
-
/** @returns {StartRequest} */
|
|
157
|
-
declare function StartRequest(): StartRequest;
|
|
158
|
-
type StartRequest = {
|
|
159
|
-
/**
|
|
160
|
-
* - The name of the file to be uploaded.
|
|
161
|
-
*/
|
|
162
|
-
file_name: string;
|
|
163
|
-
/**
|
|
164
|
-
* - The name of the file to be uploaded.
|
|
165
|
-
*/
|
|
166
|
-
content_type: string;
|
|
167
|
-
/**
|
|
168
|
-
* - The size of the file in bytes.
|
|
169
|
-
*/
|
|
170
|
-
size: number;
|
|
171
|
-
/**
|
|
172
|
-
* - Tags associated with the file.
|
|
173
|
-
*/
|
|
174
|
-
tags?: string[];
|
|
175
|
-
params?: Params;
|
|
176
|
-
};
|
|
177
|
-
/** @returns {CreatedBy} */
|
|
178
|
-
declare function CreatedBy(): CreatedBy;
|
|
179
|
-
type CreatedBy = {
|
|
180
|
-
/**
|
|
181
|
-
* - The username of the user who created the file.
|
|
182
|
-
*/
|
|
183
|
-
username?: string;
|
|
184
|
-
};
|
|
185
|
-
/** @returns {CompleteResponse} */
|
|
186
|
-
declare function CompleteResponse(): CompleteResponse;
|
|
187
|
-
type CompleteResponse = {
|
|
188
|
-
/**
|
|
189
|
-
* - The unique identifier of the uploaded file.
|
|
190
|
-
*/
|
|
191
|
-
_id: string;
|
|
192
|
-
/**
|
|
193
|
-
* - The name of the file that was uploaded.
|
|
194
|
-
*/
|
|
195
|
-
file_name: string;
|
|
196
|
-
/**
|
|
197
|
-
* - The path to the file in the storage location.
|
|
198
|
-
*/
|
|
199
|
-
file_path: string;
|
|
200
|
-
/**
|
|
201
|
-
* - The content type of the file.
|
|
202
|
-
*/
|
|
203
|
-
content_type: string;
|
|
204
|
-
/**
|
|
205
|
-
* - The namespace associated with the file.
|
|
206
|
-
*/
|
|
207
|
-
namespace: string;
|
|
208
|
-
/**
|
|
209
|
-
* - The operation performed on the storage service.
|
|
210
|
-
*/
|
|
211
|
-
operation: string;
|
|
212
|
-
/**
|
|
213
|
-
* - The size of the file in bytes.
|
|
214
|
-
*/
|
|
215
|
-
size: number;
|
|
216
|
-
upload: Upload;
|
|
217
|
-
cdn: CDN;
|
|
218
|
-
/**
|
|
219
|
-
* - The success status of the upload operation.
|
|
220
|
-
*/
|
|
221
|
-
success: boolean;
|
|
222
|
-
/**
|
|
223
|
-
* - Tags associated with the file.
|
|
224
|
-
*/
|
|
225
|
-
tags?: string[];
|
|
226
|
-
/**
|
|
227
|
-
* - The timestamp when the file was created.
|
|
228
|
-
*/
|
|
229
|
-
created_on: string;
|
|
230
|
-
/**
|
|
231
|
-
* - The timestamp when the file was last modified.
|
|
232
|
-
*/
|
|
233
|
-
modified_on: string;
|
|
234
|
-
created_by?: CreatedBy;
|
|
235
|
-
};
|
|
236
|
-
/** @returns {Urls} */
|
|
237
|
-
declare function Urls(): Urls;
|
|
238
|
-
type Urls = {
|
|
239
|
-
/**
|
|
240
|
-
* - This is the original asset URL provided in the
|
|
241
|
-
* request. This is the URL for which a signed URL has been generated.
|
|
242
|
-
*/
|
|
243
|
-
url: string;
|
|
244
|
-
/**
|
|
245
|
-
* - Generated signed URL.
|
|
246
|
-
*/
|
|
247
|
-
signed_url: string;
|
|
248
|
-
/**
|
|
249
|
-
* - The expiration time for the signed URL.
|
|
250
|
-
*/
|
|
251
|
-
expiry: number;
|
|
252
|
-
};
|
|
253
|
-
/** @returns {SignUrlResponse} */
|
|
254
|
-
declare function SignUrlResponse(): SignUrlResponse;
|
|
255
|
-
type SignUrlResponse = {
|
|
256
|
-
/**
|
|
257
|
-
* - Signed URL object.
|
|
258
|
-
*/
|
|
259
|
-
urls: Urls[];
|
|
260
|
-
};
|
|
261
|
-
/** @returns {SignUrlRequest} */
|
|
262
|
-
declare function SignUrlRequest(): SignUrlRequest;
|
|
263
|
-
type SignUrlRequest = {
|
|
264
|
-
/**
|
|
265
|
-
* - The expiration time for the signed URL.
|
|
266
|
-
*/
|
|
267
|
-
expiry: number;
|
|
268
|
-
/**
|
|
269
|
-
* - List of asset URLs to be signed. .
|
|
270
|
-
*/
|
|
271
|
-
urls: string[];
|
|
272
|
-
};
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
const Joi = require("joi");
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @typedef CDN
|
|
5
|
-
* @property {string} url - The CDN URL for accessing the file.
|
|
6
|
-
* @property {string} absolute_url - The absolute URL of the file.
|
|
7
|
-
* @property {string} relative_url - The relative URL of the file.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @typedef Upload
|
|
12
|
-
* @property {number} expiry - The expiration time for the signed URL.
|
|
13
|
-
* @property {string} url - The signed URL for uploading the file.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @typedef StartResponse
|
|
18
|
-
* @property {string} file_name - The name of the file that was uploaded.
|
|
19
|
-
* @property {string} file_path - The path to the file in the storage location.
|
|
20
|
-
* @property {string} content_type - The content type of the file.
|
|
21
|
-
* @property {string} [method] - The HTTP method to be used for uploading the file.
|
|
22
|
-
* @property {string} namespace - The namespace associated with the file.
|
|
23
|
-
* @property {string} operation - The operation to be performed on the storage service.
|
|
24
|
-
* @property {number} size - The size of the file in bytes.
|
|
25
|
-
* @property {Upload} upload
|
|
26
|
-
* @property {CDN} cdn
|
|
27
|
-
* @property {string[]} [tags] - Tags associated with the file.
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @typedef Params
|
|
32
|
-
* @property {string} [subpath] - Specifies a particular directory or location
|
|
33
|
-
* within the storage structure where the file should be placed or is located.
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @typedef StartRequest
|
|
38
|
-
* @property {string} file_name - The name of the file to be uploaded.
|
|
39
|
-
* @property {string} content_type - The name of the file to be uploaded.
|
|
40
|
-
* @property {number} size - The size of the file in bytes.
|
|
41
|
-
* @property {string[]} [tags] - Tags associated with the file.
|
|
42
|
-
* @property {Params} [params]
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* @typedef CreatedBy
|
|
47
|
-
* @property {string} [username] - The username of the user who created the file.
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* @typedef CompleteResponse
|
|
52
|
-
* @property {string} _id - The unique identifier of the uploaded file.
|
|
53
|
-
* @property {string} file_name - The name of the file that was uploaded.
|
|
54
|
-
* @property {string} file_path - The path to the file in the storage location.
|
|
55
|
-
* @property {string} content_type - The content type of the file.
|
|
56
|
-
* @property {string} namespace - The namespace associated with the file.
|
|
57
|
-
* @property {string} operation - The operation performed on the storage service.
|
|
58
|
-
* @property {number} size - The size of the file in bytes.
|
|
59
|
-
* @property {Upload} upload
|
|
60
|
-
* @property {CDN} cdn
|
|
61
|
-
* @property {boolean} success - The success status of the upload operation.
|
|
62
|
-
* @property {string[]} [tags] - Tags associated with the file.
|
|
63
|
-
* @property {string} created_on - The timestamp when the file was created.
|
|
64
|
-
* @property {string} modified_on - The timestamp when the file was last modified.
|
|
65
|
-
* @property {CreatedBy} [created_by]
|
|
66
|
-
*/
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* @typedef Urls
|
|
70
|
-
* @property {string} url - This is the original asset URL provided in the
|
|
71
|
-
* request. This is the URL for which a signed URL has been generated.
|
|
72
|
-
* @property {string} signed_url - Generated signed URL.
|
|
73
|
-
* @property {number} expiry - The expiration time for the signed URL.
|
|
74
|
-
*/
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* @typedef SignUrlResponse
|
|
78
|
-
* @property {Urls[]} urls - Signed URL object.
|
|
79
|
-
*/
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* @typedef SignUrlRequest
|
|
83
|
-
* @property {number} expiry - The expiration time for the signed URL.
|
|
84
|
-
* @property {string[]} urls - List of asset URLs to be signed. .
|
|
85
|
-
*/
|
|
86
|
-
|
|
87
|
-
class FileStorageApplicationModel {
|
|
88
|
-
/** @returns {CDN} */
|
|
89
|
-
static CDN() {
|
|
90
|
-
return Joi.object({
|
|
91
|
-
url: Joi.string().allow("").required(),
|
|
92
|
-
absolute_url: Joi.string().allow("").required(),
|
|
93
|
-
relative_url: Joi.string().allow("").required(),
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/** @returns {Upload} */
|
|
98
|
-
static Upload() {
|
|
99
|
-
return Joi.object({
|
|
100
|
-
expiry: Joi.number().required(),
|
|
101
|
-
url: Joi.string().allow("").required(),
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/** @returns {StartResponse} */
|
|
106
|
-
static StartResponse() {
|
|
107
|
-
return Joi.object({
|
|
108
|
-
file_name: Joi.string().allow("").required(),
|
|
109
|
-
file_path: Joi.string().allow("").required(),
|
|
110
|
-
content_type: Joi.string().allow("").required(),
|
|
111
|
-
method: Joi.string().allow(""),
|
|
112
|
-
namespace: Joi.string().allow("").required(),
|
|
113
|
-
operation: Joi.string().allow("").required(),
|
|
114
|
-
size: Joi.number().required(),
|
|
115
|
-
upload: FileStorageApplicationModel.Upload().required(),
|
|
116
|
-
cdn: FileStorageApplicationModel.CDN().required(),
|
|
117
|
-
tags: Joi.array().items(Joi.string().allow("")),
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/** @returns {Params} */
|
|
122
|
-
static Params() {
|
|
123
|
-
return Joi.object({
|
|
124
|
-
subpath: Joi.string().allow(""),
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/** @returns {StartRequest} */
|
|
129
|
-
static StartRequest() {
|
|
130
|
-
return Joi.object({
|
|
131
|
-
file_name: Joi.string().allow("").required(),
|
|
132
|
-
content_type: Joi.string().allow("").required(),
|
|
133
|
-
size: Joi.number().required(),
|
|
134
|
-
tags: Joi.array().items(Joi.string().allow("")),
|
|
135
|
-
params: FileStorageApplicationModel.Params(),
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/** @returns {CreatedBy} */
|
|
140
|
-
static CreatedBy() {
|
|
141
|
-
return Joi.object({
|
|
142
|
-
username: Joi.string().allow(""),
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/** @returns {CompleteResponse} */
|
|
147
|
-
static CompleteResponse() {
|
|
148
|
-
return Joi.object({
|
|
149
|
-
_id: Joi.string().allow("").required(),
|
|
150
|
-
file_name: Joi.string().allow("").required(),
|
|
151
|
-
file_path: Joi.string().allow("").required(),
|
|
152
|
-
content_type: Joi.string().allow("").required(),
|
|
153
|
-
namespace: Joi.string().allow("").required(),
|
|
154
|
-
operation: Joi.string().allow("").required(),
|
|
155
|
-
size: Joi.number().required(),
|
|
156
|
-
upload: FileStorageApplicationModel.Upload().required(),
|
|
157
|
-
cdn: FileStorageApplicationModel.CDN().required(),
|
|
158
|
-
success: Joi.boolean().required(),
|
|
159
|
-
tags: Joi.array().items(Joi.string().allow("")),
|
|
160
|
-
created_on: Joi.string().allow("").required(),
|
|
161
|
-
modified_on: Joi.string().allow("").required(),
|
|
162
|
-
created_by: FileStorageApplicationModel.CreatedBy(),
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/** @returns {Urls} */
|
|
167
|
-
static Urls() {
|
|
168
|
-
return Joi.object({
|
|
169
|
-
url: Joi.string().allow("").required(),
|
|
170
|
-
signed_url: Joi.string().allow("").required(),
|
|
171
|
-
expiry: Joi.number().required(),
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/** @returns {SignUrlResponse} */
|
|
176
|
-
static SignUrlResponse() {
|
|
177
|
-
return Joi.object({
|
|
178
|
-
urls: Joi.array().items(FileStorageApplicationModel.Urls()).required(),
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/** @returns {SignUrlRequest} */
|
|
183
|
-
static SignUrlRequest() {
|
|
184
|
-
return Joi.object({
|
|
185
|
-
expiry: Joi.number().required(),
|
|
186
|
-
urls: Joi.array().items(Joi.string().allow("")).required(),
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
module.exports = FileStorageApplicationModel;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
export = FileStorageApplicationValidator;
|
|
2
|
-
/**
|
|
3
|
-
* @typedef CompleteUploadParam
|
|
4
|
-
* @property {string} namespace - Segregation of different types of
|
|
5
|
-
* files(products, orders, logistics etc), Required for validating the data of
|
|
6
|
-
* the file being uploaded, decides where exactly the file will be stored
|
|
7
|
-
* inside the storage bucket.
|
|
8
|
-
* @property {FileStorageApplicationModel.StartResponse} body
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* @typedef SignUrlsParam
|
|
12
|
-
* @property {FileStorageApplicationModel.SignUrlRequest} body
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* @typedef StartUploadParam
|
|
16
|
-
* @property {string} namespace - Segregation of different types of
|
|
17
|
-
* files(products, orders, logistics etc), Required for validating the data of
|
|
18
|
-
* the file being uploaded, decides where exactly the file will be stored
|
|
19
|
-
* inside the storage bucket.
|
|
20
|
-
* @property {FileStorageApplicationModel.StartRequest} body
|
|
21
|
-
*/
|
|
22
|
-
declare class FileStorageApplicationValidator {
|
|
23
|
-
/** @returns {CompleteUploadParam} */
|
|
24
|
-
static completeUpload(): CompleteUploadParam;
|
|
25
|
-
/** @returns {SignUrlsParam} */
|
|
26
|
-
static signUrls(): SignUrlsParam;
|
|
27
|
-
/** @returns {StartUploadParam} */
|
|
28
|
-
static startUpload(): StartUploadParam;
|
|
29
|
-
}
|
|
30
|
-
declare namespace FileStorageApplicationValidator {
|
|
31
|
-
export { CompleteUploadParam, SignUrlsParam, StartUploadParam };
|
|
32
|
-
}
|
|
33
|
-
type CompleteUploadParam = {
|
|
34
|
-
/**
|
|
35
|
-
* - Segregation of different types of
|
|
36
|
-
* files(products, orders, logistics etc), Required for validating the data of
|
|
37
|
-
* the file being uploaded, decides where exactly the file will be stored
|
|
38
|
-
* inside the storage bucket.
|
|
39
|
-
*/
|
|
40
|
-
namespace: string;
|
|
41
|
-
body: FileStorageApplicationModel.StartResponse;
|
|
42
|
-
};
|
|
43
|
-
type SignUrlsParam = {
|
|
44
|
-
body: FileStorageApplicationModel.SignUrlRequest;
|
|
45
|
-
};
|
|
46
|
-
type StartUploadParam = {
|
|
47
|
-
/**
|
|
48
|
-
* - Segregation of different types of
|
|
49
|
-
* files(products, orders, logistics etc), Required for validating the data of
|
|
50
|
-
* the file being uploaded, decides where exactly the file will be stored
|
|
51
|
-
* inside the storage bucket.
|
|
52
|
-
*/
|
|
53
|
-
namespace: string;
|
|
54
|
-
body: FileStorageApplicationModel.StartRequest;
|
|
55
|
-
};
|
|
56
|
-
import FileStorageApplicationModel = require("./FileStorageApplicationModel");
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
const Joi = require("joi");
|
|
2
|
-
|
|
3
|
-
const FileStorageApplicationModel = require("./FileStorageApplicationModel");
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @typedef CompleteUploadParam
|
|
7
|
-
* @property {string} namespace - Segregation of different types of
|
|
8
|
-
* files(products, orders, logistics etc), Required for validating the data of
|
|
9
|
-
* the file being uploaded, decides where exactly the file will be stored
|
|
10
|
-
* inside the storage bucket.
|
|
11
|
-
* @property {FileStorageApplicationModel.StartResponse} body
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @typedef SignUrlsParam
|
|
16
|
-
* @property {FileStorageApplicationModel.SignUrlRequest} body
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @typedef StartUploadParam
|
|
21
|
-
* @property {string} namespace - Segregation of different types of
|
|
22
|
-
* files(products, orders, logistics etc), Required for validating the data of
|
|
23
|
-
* the file being uploaded, decides where exactly the file will be stored
|
|
24
|
-
* inside the storage bucket.
|
|
25
|
-
* @property {FileStorageApplicationModel.StartRequest} body
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
class FileStorageApplicationValidator {
|
|
29
|
-
/** @returns {CompleteUploadParam} */
|
|
30
|
-
static completeUpload() {
|
|
31
|
-
return Joi.object({
|
|
32
|
-
namespace: Joi.string().allow("").required(),
|
|
33
|
-
body: FileStorageApplicationModel.StartResponse().required(),
|
|
34
|
-
}).required();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/** @returns {SignUrlsParam} */
|
|
38
|
-
static signUrls() {
|
|
39
|
-
return Joi.object({
|
|
40
|
-
body: FileStorageApplicationModel.SignUrlRequest().required(),
|
|
41
|
-
}).required();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** @returns {StartUploadParam} */
|
|
45
|
-
static startUpload() {
|
|
46
|
-
return Joi.object({
|
|
47
|
-
namespace: Joi.string().allow("").required(),
|
|
48
|
-
body: FileStorageApplicationModel.StartRequest().required(),
|
|
49
|
-
}).required();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
module.exports = FileStorageApplicationValidator;
|