skyflow-js 1.31.0 → 1.32.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.
- package/CHANGELOG.md +4 -0
- package/README.md +100 -0
- package/dist/sdkNodeBuild/index.js +1 -1
- package/dist/sdkNodeBuild/index.js.gz +0 -0
- package/dist/sdkNodeBuild/manifest.json +13 -13
- package/dist/sdkNodeBuild/manifest.json.gz +0 -0
- package/package.json +2 -2
- package/types/core/constants.d.ts +0 -1
- package/types/core/external/skyflow-container.d.ts +2 -2
- package/types/core-utils/reveal.d.ts +2 -2
- package/types/skyflow.d.ts +2 -2
- package/types/utils/common/index.d.ts +4 -1
- package/types/utils/constants.d.ts +12 -0
- package/types/utils/logs.d.ts +3 -0
- package/types/utils/validators/index.d.ts +2 -2
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -2362,6 +2362,106 @@ container.uploadFiles();
|
|
|
2362
2362
|
]
|
|
2363
2363
|
}
|
|
2364
2364
|
```
|
|
2365
|
+
### File upload with options:
|
|
2366
|
+
|
|
2367
|
+
Along with fileElementInput, you can define other options in the Options object as described below:
|
|
2368
|
+
```js
|
|
2369
|
+
const options = {
|
|
2370
|
+
allowedFileType: String[], // Optional, indicates the allowed file types for upload
|
|
2371
|
+
}
|
|
2372
|
+
```
|
|
2373
|
+
`allowedFileType`: An array of string value that indicates the allowedFileTypes to be uploaded.
|
|
2374
|
+
|
|
2375
|
+
#### File upload with options example
|
|
2376
|
+
|
|
2377
|
+
```javascript
|
|
2378
|
+
// Create collect Container.
|
|
2379
|
+
const collectContainer = skyflow.container(Skyflow.ContainerType.COLLECT);
|
|
2380
|
+
|
|
2381
|
+
// Create collect elements.
|
|
2382
|
+
const cardNumberElement = collectContainer.create({
|
|
2383
|
+
table: 'newTable',
|
|
2384
|
+
column: 'card_number',
|
|
2385
|
+
inputstyles: {
|
|
2386
|
+
base: {
|
|
2387
|
+
color: '#1d1d1d',
|
|
2388
|
+
},
|
|
2389
|
+
},
|
|
2390
|
+
labelStyles: {
|
|
2391
|
+
base: {
|
|
2392
|
+
fontSize: '12px',
|
|
2393
|
+
fontWeight: 'bold',
|
|
2394
|
+
},
|
|
2395
|
+
},
|
|
2396
|
+
errorTextStyles: {
|
|
2397
|
+
base: {
|
|
2398
|
+
color: '#f44336',
|
|
2399
|
+
},
|
|
2400
|
+
},
|
|
2401
|
+
placeholder: 'card number',
|
|
2402
|
+
label: 'Card Number',
|
|
2403
|
+
type: Skyflow.ElementType.CARD_NUMBER,
|
|
2404
|
+
});
|
|
2405
|
+
const options = {
|
|
2406
|
+
allowedFileType: [".pdf",".png"];
|
|
2407
|
+
};
|
|
2408
|
+
const fileElement = collectContainer.create({
|
|
2409
|
+
table: 'newTable',
|
|
2410
|
+
column: 'file',
|
|
2411
|
+
skyflowID: '431eaa6c-5c15-4513-aa15-29f50babe882',
|
|
2412
|
+
inputstyles: {
|
|
2413
|
+
base: {
|
|
2414
|
+
color: '#1d1d1d',
|
|
2415
|
+
},
|
|
2416
|
+
},
|
|
2417
|
+
labelStyles: {
|
|
2418
|
+
base: {
|
|
2419
|
+
fontSize: '12px',
|
|
2420
|
+
fontWeight: 'bold',
|
|
2421
|
+
},
|
|
2422
|
+
},
|
|
2423
|
+
errorTextStyles: {
|
|
2424
|
+
base: {
|
|
2425
|
+
color: '#f44336',
|
|
2426
|
+
},
|
|
2427
|
+
},
|
|
2428
|
+
type: Skyflow.ElementType.FILE_INPUT,
|
|
2429
|
+
},
|
|
2430
|
+
options
|
|
2431
|
+
);
|
|
2432
|
+
|
|
2433
|
+
// Mount the elements.
|
|
2434
|
+
cardNumberElement.mount('#collectCardNumber');
|
|
2435
|
+
fileElement.mount('#collectFile');
|
|
2436
|
+
|
|
2437
|
+
// Collect and upload methods.
|
|
2438
|
+
collectContainer.collect({});
|
|
2439
|
+
collectContainer.uploadFiles();
|
|
2440
|
+
|
|
2441
|
+
```
|
|
2442
|
+
**Sample Response for collect():**
|
|
2443
|
+
```javascript
|
|
2444
|
+
{
|
|
2445
|
+
"records": [
|
|
2446
|
+
{
|
|
2447
|
+
"table": "newTable",
|
|
2448
|
+
"fields": {
|
|
2449
|
+
"card_number": "f3907186-e7e2-466f-91e5-48e12c2bcbc1",
|
|
2450
|
+
}
|
|
2451
|
+
}
|
|
2452
|
+
]
|
|
2453
|
+
}
|
|
2454
|
+
```
|
|
2455
|
+
**Sample Response for file uploadFiles() :**
|
|
2456
|
+
```javascript
|
|
2457
|
+
{
|
|
2458
|
+
"fileUploadResponse": [
|
|
2459
|
+
{
|
|
2460
|
+
"skyflow_id": "431eaa6c-5c15-4513-aa15-29f50babe882"
|
|
2461
|
+
}
|
|
2462
|
+
]
|
|
2463
|
+
}
|
|
2464
|
+
```
|
|
2365
2465
|
#### File upload with additional elements
|
|
2366
2466
|
|
|
2367
2467
|
```javascript
|