skyflow-js 1.27.4 → 1.29.0-beta.1
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 +473 -57
- package/dist/sdkNodeBuild/index.js +1 -1
- package/dist/sdkNodeBuild/index.js.gz +0 -0
- package/package.json +1 -1
- package/types/core/constants.d.ts +1 -0
- package/types/core/external/skyflow-container.d.ts +2 -1
- package/types/core-utils/collect.d.ts +17 -2
- package/types/core-utils/delete.d.ts +4 -0
- package/types/skyflow.d.ts +2 -1
- package/types/utils/common/index.d.ts +23 -0
- package/types/utils/constants.d.ts +52 -0
- package/types/utils/logs.d.ts +18 -0
- package/types/utils/validators/index.d.ts +2 -1
package/README.md
CHANGED
|
@@ -128,9 +128,10 @@ For `env` parameter, there are 2 accepted values in Skyflow.Env
|
|
|
128
128
|
# Securely collecting data client-side
|
|
129
129
|
- [**Insert data into the vault**](#insert-data-into-the-vault)
|
|
130
130
|
- [**Using Skyflow Elements to collect data**](#using-skyflow-elements-to-collect-data)
|
|
131
|
+
- [**Using Skyflow Elements to update data**](#using-skyflow-elements-to-update-data)
|
|
131
132
|
- [**Using validations on Collect Elements**](#validations)
|
|
132
133
|
- [**Event Listener on Collect Elements**](#event-listener-on-collect-elements)
|
|
133
|
-
- [**UI Error for Collect
|
|
134
|
+
- [**UI Error for Collect Elements**](#ui-error-for-collect-elements)
|
|
134
135
|
- [**Set and Clear value for Collect Elements (DEV ENV ONLY)**](#set-and-clear-value-for-collect-elements-dev-env-only)
|
|
135
136
|
- [**Using Skyflow File Element to upload a file**](#using-skyflow-file-element-to-upload-a-file)
|
|
136
137
|
## Insert data into the vault
|
|
@@ -248,6 +249,9 @@ inputStyles: {
|
|
|
248
249
|
padding: '10px 16px',
|
|
249
250
|
borderRadius: '4px',
|
|
250
251
|
color: '#1d1d1d',
|
|
252
|
+
'&:hover': { // Hover styles.
|
|
253
|
+
borderColor: 'green'
|
|
254
|
+
},
|
|
251
255
|
},
|
|
252
256
|
complete: {
|
|
253
257
|
color: '#4caf50',
|
|
@@ -599,6 +603,211 @@ cvvElement.mount('#cvv'); //Assumes there is a div with id='#cvv' in the webpage
|
|
|
599
603
|
]
|
|
600
604
|
}
|
|
601
605
|
```
|
|
606
|
+
## Using Skyflow Elements to update data
|
|
607
|
+
|
|
608
|
+
You can update the data in a vault with Skyflow Elements. Use the following steps to securely update data.
|
|
609
|
+
|
|
610
|
+
### Step 1: Create a container
|
|
611
|
+
Create a container for the form elements using the `container(Skyflow.ContainerType)` method of the Skyflow client:
|
|
612
|
+
|
|
613
|
+
```javascript
|
|
614
|
+
const container = skyflowClient.container(Skyflow.ContainerType.COLLECT)
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
### Step 2: Create a collect Element
|
|
618
|
+
Create a collect element. Collect Elements are defined as follows:
|
|
619
|
+
|
|
620
|
+
```javascript
|
|
621
|
+
const collectElement = {
|
|
622
|
+
table: "string", // Required, the table this data belongs to.
|
|
623
|
+
column: "string", // Required, the column into which this data should be updated.
|
|
624
|
+
type: Skyflow.ElementType, // Skyflow.ElementType enum.
|
|
625
|
+
inputStyles: {}, // Optional, styles that should be applied to the form element.
|
|
626
|
+
labelStyles: {}, // Optional, styles that will be applied to the label of the collect element.
|
|
627
|
+
errorTextStyles: {}, // Optional, styles that will be applied to the errorText of the collect element.
|
|
628
|
+
label: "string", // Optional, label for the form element.
|
|
629
|
+
placeholder: "string", // Optional, placeholder for the form element.
|
|
630
|
+
altText: "string", // (DEPRECATED) string that acts as an initial value for the collect element.
|
|
631
|
+
validations: [], // Optional, array of validation rules.
|
|
632
|
+
skyflowID: "string", // The skyflow_id of the record to be updated.
|
|
633
|
+
};
|
|
634
|
+
const options = {
|
|
635
|
+
required: false, // Optional, indicates whether the field is marked as required. Defaults to 'false'.
|
|
636
|
+
enableCardIcon: true, // Optional, indicates whether the element needs a card icon (only applicable for CARD_NUMBER ElementType).
|
|
637
|
+
format: String, // Optional, format for the element (only applicable currently for EXPIRATION_DATE ElementType).
|
|
638
|
+
enableCopy: false, // Optional, enables the copy icon in collect and reveal elements to copy text to clipboard. Defaults to 'false').
|
|
639
|
+
};
|
|
640
|
+
const element = container.create(collectElement, options);
|
|
641
|
+
```
|
|
642
|
+
The `table` and `column` fields indicate which table and column the Element corresponds to.
|
|
643
|
+
|
|
644
|
+
`skyflowID` indicates the record that you want to update.
|
|
645
|
+
|
|
646
|
+
**Notes:**
|
|
647
|
+
- Use dot-delimited strings to specify columns nested inside JSON fields (for example, `address.street.line1`)
|
|
648
|
+
|
|
649
|
+
### Step 3: Mount Elements to the DOM
|
|
650
|
+
To specify where the Elements are rendered on your page, create placeholder `<div>` elements with unique `id` tags. For instance, the form below has three empty elements with unique IDs as placeholders for three Skyflow Elements.
|
|
651
|
+
```html
|
|
652
|
+
<form>
|
|
653
|
+
<div id="cardNumber" />
|
|
654
|
+
<br/>
|
|
655
|
+
<div id="expireDate" />
|
|
656
|
+
<br/>
|
|
657
|
+
<div id="cvv" />
|
|
658
|
+
<br/>
|
|
659
|
+
<button type="submit">Submit</button>
|
|
660
|
+
</form>
|
|
661
|
+
```
|
|
662
|
+
Now, when you call the `mount(domElement)` method, the Elements is inserted in the specified divs. For instance, the call below inserts the Element into the div with the id "#cardNumber".
|
|
663
|
+
```javascript
|
|
664
|
+
element.mount('#cardNumber');
|
|
665
|
+
```
|
|
666
|
+
Use the `unmount` method to reset a Collect Element to its initial state.
|
|
667
|
+
```javascript
|
|
668
|
+
element.unmount();
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
|
|
672
|
+
### Step 4: Update data from Elements
|
|
673
|
+
When the form is ready to submit, call the `collect(options?)` method on the container object. The `options` parameter takes a object of optional parameters as shown below:
|
|
674
|
+
- `tokens`: indicates whether tokens for the collected data should be returned or not. Defaults to 'true'
|
|
675
|
+
- `additionalFields`: Non-PCI elements data to update or insert into the vault which should be in the records object format.
|
|
676
|
+
- `upsert`: To support upsert operations while collecting data from Skyflow elements, pass the table and column marked as unique in the table.
|
|
677
|
+
|
|
678
|
+
```javascript
|
|
679
|
+
const options = {
|
|
680
|
+
tokens: true, // Optional, indicates whether tokens for the collected data should be returned. Defaults to 'true'.
|
|
681
|
+
additionalFields: {
|
|
682
|
+
records: [
|
|
683
|
+
{
|
|
684
|
+
table: "string", // Table into which record should be updated.
|
|
685
|
+
fields: {
|
|
686
|
+
column1: "value", // Column names should match vault column names.
|
|
687
|
+
skyflowID: "value", // The skyflow_id of the record to be updated.
|
|
688
|
+
// ...additional fields here.
|
|
689
|
+
},
|
|
690
|
+
},
|
|
691
|
+
// ...additional records here.
|
|
692
|
+
],
|
|
693
|
+
},// Optional
|
|
694
|
+
upsert: [ // Upsert operations support in the vault
|
|
695
|
+
{
|
|
696
|
+
table: "string", // Table name
|
|
697
|
+
column: "value", // Unique column in the table
|
|
698
|
+
},
|
|
699
|
+
], // Optional
|
|
700
|
+
};
|
|
701
|
+
container.collect(options);
|
|
702
|
+
```
|
|
703
|
+
**Note:** `skyflowID` is required if you want to update the data. If `skyflowID` isn't specified, the `collect(options?)` method creates a new record in the vault.
|
|
704
|
+
|
|
705
|
+
### End to end example of updating data with Skyflow Elements
|
|
706
|
+
|
|
707
|
+
**Sample Code:**
|
|
708
|
+
|
|
709
|
+
```javascript
|
|
710
|
+
//Step 1
|
|
711
|
+
const container = skyflowClient.container(Skyflow.ContainerType.COLLECT);
|
|
712
|
+
|
|
713
|
+
//Step 2
|
|
714
|
+
const cardNumberElement = container.create({
|
|
715
|
+
table: 'cards',
|
|
716
|
+
column: 'cardNumber',
|
|
717
|
+
inputStyles: {
|
|
718
|
+
base: {
|
|
719
|
+
color: '#1d1d1d',
|
|
720
|
+
},
|
|
721
|
+
cardIcon: {
|
|
722
|
+
position: 'absolute',
|
|
723
|
+
left: '8px',
|
|
724
|
+
bottom: 'calc(50% - 12px)',
|
|
725
|
+
},
|
|
726
|
+
},
|
|
727
|
+
labelStyles: {
|
|
728
|
+
base: {
|
|
729
|
+
fontSize: '12px',
|
|
730
|
+
fontWeight: 'bold',
|
|
731
|
+
},
|
|
732
|
+
},
|
|
733
|
+
errorTextStyles: {
|
|
734
|
+
base: {
|
|
735
|
+
color: '#f44336',
|
|
736
|
+
},
|
|
737
|
+
},
|
|
738
|
+
placeholder: 'Card Number',
|
|
739
|
+
label: 'Card Number',
|
|
740
|
+
type: Skyflow.ElementType.CARD_NUMBER,
|
|
741
|
+
skyflowID: '431eaa6c-5c15-4513-aa15-29f50babe882',
|
|
742
|
+
});
|
|
743
|
+
const cardHolderNameElement = container.create({
|
|
744
|
+
table: 'cards',
|
|
745
|
+
column: 'first_name',
|
|
746
|
+
inputStyles: {
|
|
747
|
+
base: {
|
|
748
|
+
color: '#1d1d1d',
|
|
749
|
+
},
|
|
750
|
+
cardIcon: {
|
|
751
|
+
position: 'absolute',
|
|
752
|
+
left: '8px',
|
|
753
|
+
bottom: 'calc(50% - 12px)',
|
|
754
|
+
},
|
|
755
|
+
},
|
|
756
|
+
labelStyles: {
|
|
757
|
+
base: {
|
|
758
|
+
fontSize: '12px',
|
|
759
|
+
fontWeight: 'bold',
|
|
760
|
+
},
|
|
761
|
+
},
|
|
762
|
+
errorTextStyles: {
|
|
763
|
+
base: {
|
|
764
|
+
color: '#f44336',
|
|
765
|
+
},
|
|
766
|
+
},
|
|
767
|
+
placeholder: 'Card Holder Name',
|
|
768
|
+
label: 'Card Holder Name',
|
|
769
|
+
type: Skyflow.ElementType.CARDHOLDER_NAME,
|
|
770
|
+
skyflowID: '431eaa6c-5c15-4513-aa15-29f50babe882',
|
|
771
|
+
});
|
|
772
|
+
|
|
773
|
+
// Step 3
|
|
774
|
+
cardNumberElement.mount('#cardNumber'); // Assumes there is a div with id='#cardNumber' in the webpage.
|
|
775
|
+
cardHolderNameElement.mount('#cardHolderName'); // Assumes there is a div with id='#cardHolderName' in the webpage.
|
|
776
|
+
|
|
777
|
+
// Step 4
|
|
778
|
+
const nonPCIRecords = {
|
|
779
|
+
records: [
|
|
780
|
+
{
|
|
781
|
+
table: 'cards',
|
|
782
|
+
fields: {
|
|
783
|
+
gender: 'MALE',
|
|
784
|
+
skyflowID: '431eaa6c-5c15-4513-aa15-29f50babe882',
|
|
785
|
+
},
|
|
786
|
+
},
|
|
787
|
+
],
|
|
788
|
+
};
|
|
789
|
+
|
|
790
|
+
container.collect({
|
|
791
|
+
tokens: true,
|
|
792
|
+
additionalFields: nonPCIRecords,
|
|
793
|
+
});
|
|
794
|
+
```
|
|
795
|
+
**Sample Response :**
|
|
796
|
+
```javascript
|
|
797
|
+
{
|
|
798
|
+
"records": [
|
|
799
|
+
{
|
|
800
|
+
"table": "cards",
|
|
801
|
+
"fields": {
|
|
802
|
+
"skyflow_id": "431eaa6c-5c15-4513-aa15-29f50babe882",
|
|
803
|
+
"cardNumber": "f3907186-e7e2-466f-91e5-48e12c2bcbc1",
|
|
804
|
+
"first_name": "131e70dc-6f76-4319-bdd3-96281e051051",
|
|
805
|
+
"gender": "12f670af-6c7d-4837-83fb-30365fbc0b1e"
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
]
|
|
809
|
+
}
|
|
810
|
+
```
|
|
602
811
|
|
|
603
812
|
### Validations
|
|
604
813
|
|
|
@@ -1333,17 +1542,161 @@ Sample Element state object when env is `PROD`
|
|
|
1333
1542
|
value: ''
|
|
1334
1543
|
}
|
|
1335
1544
|
```
|
|
1545
|
+
|
|
1546
|
+
### Update composable elements
|
|
1547
|
+
You can update composable element properties with the `update` interface.
|
|
1548
|
+
|
|
1549
|
+
|
|
1550
|
+
The `update` interface takes the below object:
|
|
1551
|
+
```javascript
|
|
1552
|
+
const updateElement = {
|
|
1553
|
+
table: 'string', // Optional. The table this data belongs to.
|
|
1554
|
+
column: 'string', // Optional. The column this data belongs to.
|
|
1555
|
+
inputStyles: {}, // Optional. Styles applied to the form element.
|
|
1556
|
+
labelStyles: {}, // Optional. Styles for the label of the element.
|
|
1557
|
+
errorTextStyles: {}, // Optional. Styles for the errorText of element.
|
|
1558
|
+
label: 'string', // Optional. Label for the form element.
|
|
1559
|
+
placeholder: 'string', // Optional. Placeholder for the form element.
|
|
1560
|
+
validations: [], // Optional. Array of validation rules.
|
|
1561
|
+
};
|
|
1562
|
+
```
|
|
1563
|
+
|
|
1564
|
+
Only include the properties that you want to update for the specified composable element.
|
|
1565
|
+
|
|
1566
|
+
Properties your provided when you created the element remain the same until you explicitly update them.
|
|
1567
|
+
|
|
1568
|
+
`Note`: You can't update the `type` property of an element.
|
|
1569
|
+
|
|
1570
|
+
### End to end example
|
|
1571
|
+
```javascript
|
|
1572
|
+
const containerOptions = { layout: [2, 1] };
|
|
1573
|
+
|
|
1574
|
+
// Create a composable container.
|
|
1575
|
+
const composableContainer = skyflow.container(
|
|
1576
|
+
Skyflow.ContainerType.COMPOSABLE,
|
|
1577
|
+
containerOptions
|
|
1578
|
+
);
|
|
1579
|
+
|
|
1580
|
+
const stylesOptions = {
|
|
1581
|
+
inputStyles: {
|
|
1582
|
+
base: {
|
|
1583
|
+
fontFamily: 'Inter',
|
|
1584
|
+
fontStyle: 'normal',
|
|
1585
|
+
fontWeight: 400,
|
|
1586
|
+
fontSize: '14px',
|
|
1587
|
+
lineHeight: '21px',
|
|
1588
|
+
width: '294px',
|
|
1589
|
+
},
|
|
1590
|
+
},
|
|
1591
|
+
labelStyles: {},
|
|
1592
|
+
errorTextStyles: {
|
|
1593
|
+
base: {},
|
|
1594
|
+
},
|
|
1595
|
+
};
|
|
1596
|
+
|
|
1597
|
+
// Create composable elements.
|
|
1598
|
+
const cardHolderNameElement = composableContainer.create({
|
|
1599
|
+
table: 'pii_fields',
|
|
1600
|
+
column: 'first_name',
|
|
1601
|
+
...stylesOptions,
|
|
1602
|
+
placeholder: 'Cardholder Name',
|
|
1603
|
+
type: Skyflow.ElementType.CARDHOLDER_NAME,
|
|
1604
|
+
});
|
|
1605
|
+
|
|
1606
|
+
|
|
1607
|
+
const cardNumberElement = composableContainer.create({
|
|
1608
|
+
table: 'pii_fields',
|
|
1609
|
+
column: 'card_number',
|
|
1610
|
+
...stylesOptions,
|
|
1611
|
+
placeholder: 'Card Number',
|
|
1612
|
+
type: Skyflow.ElementType.CARD_NUMBER,
|
|
1613
|
+
});
|
|
1614
|
+
|
|
1615
|
+
const cvvElement = composableContainer.create({
|
|
1616
|
+
table: 'pii_fields',
|
|
1617
|
+
column: 'cvv',
|
|
1618
|
+
...stylesOptions,
|
|
1619
|
+
placeholder: 'CVV',
|
|
1620
|
+
type: Skyflow.ElementType.CVV,
|
|
1621
|
+
});
|
|
1622
|
+
|
|
1623
|
+
// Mount the composable container.
|
|
1624
|
+
composableContainer.mount('#compostableContainer'); // Assumes there is a div with id='#composableContainer' in the webpage.
|
|
1625
|
+
|
|
1626
|
+
// ...
|
|
1627
|
+
|
|
1628
|
+
// Update validations property on cvvElement.
|
|
1629
|
+
cvvElement.update({
|
|
1630
|
+
validations: [{
|
|
1631
|
+
type: Skyflow.ValidationRuleType.LENGTH_MATCH_RULE,
|
|
1632
|
+
params: {
|
|
1633
|
+
max: 3,
|
|
1634
|
+
error: 'cvv must be 3 digits',
|
|
1635
|
+
},
|
|
1636
|
+
}]
|
|
1637
|
+
})
|
|
1638
|
+
|
|
1639
|
+
// Update label, placeholder properties on cardHolderNameElement.
|
|
1640
|
+
cardHolderNameElement.update({
|
|
1641
|
+
label: 'CARDHOLDER NAME',
|
|
1642
|
+
placeholder: 'Eg: John'
|
|
1643
|
+
});
|
|
1644
|
+
|
|
1645
|
+
// Update table, column, inputStyles properties on cardNumberElement.
|
|
1646
|
+
cardNumberElement.update({
|
|
1647
|
+
table:'cards',
|
|
1648
|
+
column:'card_number',
|
|
1649
|
+
inputStyles:{
|
|
1650
|
+
base:{
|
|
1651
|
+
color:'blue'
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
});
|
|
1655
|
+
|
|
1656
|
+
|
|
1657
|
+
```
|
|
1658
|
+
### Set an event listener on a composable container
|
|
1659
|
+
Currently, the SDK supports one event:
|
|
1660
|
+
- `SUBMIT`: Triggered when the `Enter` key is pressed in any container element.
|
|
1661
|
+
|
|
1662
|
+
The handler `function(void) => void` is a callback function you provide that's called when the `SUBMIT' event fires.
|
|
1663
|
+
|
|
1664
|
+
### Example
|
|
1665
|
+
```javascript
|
|
1666
|
+
const containerOptions = { layout: [1] }
|
|
1667
|
+
|
|
1668
|
+
// Creating a composable container.
|
|
1669
|
+
const composableContainer = skyflow.container(Skyflow.ContainerType.COMPOSABLE, containerOptions);
|
|
1670
|
+
|
|
1671
|
+
// Creating the element.
|
|
1672
|
+
const cvv = composableContainer.create({
|
|
1673
|
+
table: 'pii_fields',
|
|
1674
|
+
column: 'primary_card.cvv',
|
|
1675
|
+
type: Skyflow.ElementType.CVV,
|
|
1676
|
+
});
|
|
1677
|
+
|
|
1678
|
+
// Mounting the container.
|
|
1679
|
+
composableContainer.mount('#cvvContainer');
|
|
1680
|
+
|
|
1681
|
+
// Subscribing to the `SUBMIT` event, which gets triggered when the user hits `enter` key in any container element input.
|
|
1682
|
+
composableContainer.on(Skyflow.EventName.SUBMIT, ()=> {
|
|
1683
|
+
// Your implementation when the SUBMIT(enter) event occurs.
|
|
1684
|
+
console.log('Submit Event Listener is being Triggered.');
|
|
1685
|
+
});
|
|
1686
|
+
```
|
|
1687
|
+
|
|
1688
|
+
|
|
1336
1689
|
---
|
|
1337
1690
|
# Securely revealing data client-side
|
|
1338
1691
|
- [**Retrieving data from the vault**](#retrieving-data-from-the-vault)
|
|
1339
1692
|
- [**Using Skyflow Elements to reveal data**](#using-skyflow-elements-to-reveal-data)
|
|
1340
1693
|
- [**UI Error for Reveal Elements**](#ui-error-for-reveal-elements)
|
|
1341
1694
|
- [**Set token for Reveal Elements**](#set-token-for-reveal-elements)
|
|
1342
|
-
-
|
|
1695
|
+
- [**Set and clear altText for Reveal Elements**](#set-and-clear-alttext-for-reveal-elements)
|
|
1343
1696
|
|
|
1344
1697
|
## Retrieving data from the vault
|
|
1345
1698
|
|
|
1346
|
-
For non-PCI use-cases, retrieving data from the vault and revealing it in the browser can be done either using the SkyflowID's or tokens as described below
|
|
1699
|
+
For non-PCI use-cases, retrieving data from the vault and revealing it in the browser can be done either using the SkyflowID's, unique column values or tokens as described below
|
|
1347
1700
|
|
|
1348
1701
|
- ### Using Skyflow tokens
|
|
1349
1702
|
In order to retrieve data from your vault using tokens that you have previously generated for that data, you can use the `detokenize(records)` method. The records parameter takes a JSON object that contains `records` to be fetched as shown below.
|
|
@@ -1394,71 +1747,134 @@ The sample response:
|
|
|
1394
1747
|
}
|
|
1395
1748
|
```
|
|
1396
1749
|
|
|
1397
|
-
- ### Using Skyflow ID's
|
|
1398
|
-
|
|
1750
|
+
- ### Using Skyflow ID's or Unique Column Values
|
|
1751
|
+
You can retrieve data from the vault with the get(records) method using either Skyflow IDs or unique column values.
|
|
1752
|
+
|
|
1753
|
+
The records parameter accepts a JSON object that contains an array of either Skyflow IDs or unique column names and values.
|
|
1754
|
+
|
|
1755
|
+
Note: You can use either Skyflow IDs or unique values to retrieve records. You can't use both at the same time.
|
|
1756
|
+
|
|
1757
|
+
Skyflow.RedactionTypes accepts four values:
|
|
1758
|
+
- `PLAIN_TEXT`
|
|
1759
|
+
- `MASKED`
|
|
1760
|
+
- `REDACTED`
|
|
1761
|
+
- `DEFAULT`
|
|
1762
|
+
|
|
1763
|
+
You must apply a redaction type to retrieve data.
|
|
1764
|
+
|
|
1765
|
+
#### Schema (Skyflow IDs)
|
|
1399
1766
|
|
|
1400
1767
|
```javascript
|
|
1401
|
-
{
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
}
|
|
1768
|
+
data = {
|
|
1769
|
+
records: [
|
|
1770
|
+
{
|
|
1771
|
+
ids: ["SKYFLOW_ID_1", "SKYFLOW_ID_2"], // List of skyflow_ids for the records to fetch.
|
|
1772
|
+
table: "NAME_OF_SKYFLOW_TABLE", // Name of table holding the records in the vault.
|
|
1773
|
+
redaction: Skyflow.RedactionType, // Redaction type to apply to retrieved data.
|
|
1774
|
+
},
|
|
1775
|
+
],
|
|
1776
|
+
};
|
|
1410
1777
|
```
|
|
1778
|
+
#### Schema (Unique column values)
|
|
1411
1779
|
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1780
|
+
```javascript
|
|
1781
|
+
data = {
|
|
1782
|
+
records: [
|
|
1783
|
+
{
|
|
1784
|
+
table: "NAME_OF_SKYFLOW_TABLE", // Name of table holding the records in the vault.
|
|
1785
|
+
columnName: "UNIQUE_COLUMN_NAME", // Unique column name in the vault.
|
|
1786
|
+
columnValues: [ // List of given unique column values.
|
|
1787
|
+
"<COLUMN_VALUE_2>",
|
|
1788
|
+
"<COLUMN_VALUE_3>",
|
|
1789
|
+
], // Required when specifying a unique column
|
|
1790
|
+
redaction: Skyflow.RedactionType, // Redaction type applies to retrieved data.
|
|
1417
1791
|
|
|
1418
|
-
|
|
1792
|
+
},
|
|
1793
|
+
],
|
|
1794
|
+
};
|
|
1795
|
+
```
|
|
1796
|
+
[Example usage (Skyflow IDs)](https://github.com/skyflowapi/skyflow-js/blob/master/samples/using-script-tag/get-pure-js.html)
|
|
1419
1797
|
|
|
1420
1798
|
```javascript
|
|
1421
|
-
skyflow.
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1799
|
+
skyflow.get({
|
|
1800
|
+
records: [
|
|
1801
|
+
{
|
|
1802
|
+
ids: ["f8d8a622-b557-4c6b-a12c-c5ebe0b0bfd9"],
|
|
1803
|
+
table: "cards",
|
|
1804
|
+
redaction: Skyflow.RedactionType.PLAIN_TEXT,
|
|
1805
|
+
},
|
|
1806
|
+
{
|
|
1807
|
+
ids: ["da26de53-95d5-4bdb-99db-8d8c66a35ff9"],
|
|
1808
|
+
table: "contacts",
|
|
1809
|
+
redaction: Skyflow.RedactionType.PLAIN_TEXT,
|
|
1810
|
+
},
|
|
1811
|
+
],
|
|
1434
1812
|
});
|
|
1435
1813
|
```
|
|
1814
|
+
Example response
|
|
1436
1815
|
|
|
1437
|
-
|
|
1816
|
+
```javascript
|
|
1817
|
+
{
|
|
1818
|
+
"records": [
|
|
1819
|
+
{
|
|
1820
|
+
"fields": {
|
|
1821
|
+
"card_number": "4111111111111111",
|
|
1822
|
+
"cvv": "127",
|
|
1823
|
+
"expiry_date": "11/2035",
|
|
1824
|
+
"fullname": "myname",
|
|
1825
|
+
"id": "f8d8a622-b557-4c6b-a12c-c5ebe0b0bfd9"
|
|
1826
|
+
},
|
|
1827
|
+
"table": "cards"
|
|
1828
|
+
}
|
|
1829
|
+
],
|
|
1830
|
+
"errors": [
|
|
1831
|
+
{
|
|
1832
|
+
"error": {
|
|
1833
|
+
"code": "404",
|
|
1834
|
+
"description": "No Records Found"
|
|
1835
|
+
},
|
|
1836
|
+
"ids": ["da26de53-95d5-4bdb-99db-8d8c66a35ff9"]
|
|
1837
|
+
}
|
|
1838
|
+
]
|
|
1839
|
+
}
|
|
1840
|
+
```
|
|
1841
|
+
[Example usage (Unique column values)](https://github.com/skyflowapi/skyflow-js/blob/master/samples/using-script-tag/get-pure-js.html)
|
|
1438
1842
|
|
|
1843
|
+
```javascript
|
|
1844
|
+
skyflow.get({
|
|
1845
|
+
records: [
|
|
1846
|
+
{
|
|
1847
|
+
table: "cards",
|
|
1848
|
+
redaction: RedactionType.PLAIN_TEXT,
|
|
1849
|
+
columnName: "card_id",
|
|
1850
|
+
columnValues: ["123", "456"],
|
|
1851
|
+
}
|
|
1852
|
+
],
|
|
1853
|
+
});
|
|
1854
|
+
```
|
|
1855
|
+
Sample response:
|
|
1439
1856
|
```javascript
|
|
1440
1857
|
{
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
]
|
|
1858
|
+
"records": [
|
|
1859
|
+
{
|
|
1860
|
+
"fields": {
|
|
1861
|
+
"card_id": "123",
|
|
1862
|
+
"expiry_date": "11/35",
|
|
1863
|
+
"fullname": "myname",
|
|
1864
|
+
"id": "f8d2-b557-4c6b-a12c-c5ebfd9"
|
|
1865
|
+
},
|
|
1866
|
+
"table": "cards"
|
|
1867
|
+
},
|
|
1868
|
+
{
|
|
1869
|
+
"fields": {
|
|
1870
|
+
"card_id": "456",
|
|
1871
|
+
"expiry_date": "10/23",
|
|
1872
|
+
"fullname": "sam",
|
|
1873
|
+
"id": "da53-95d5-4bdb-99db-8d8c5ff9"
|
|
1874
|
+
},
|
|
1875
|
+
"table": "cards"
|
|
1876
|
+
}
|
|
1877
|
+
]
|
|
1462
1878
|
}
|
|
1463
1879
|
```
|
|
1464
1880
|
|
|
@@ -1885,8 +2301,8 @@ cardNumberElement.mount('#collectCardNumber');
|
|
|
1885
2301
|
fileElement.mount('#collectFile');
|
|
1886
2302
|
|
|
1887
2303
|
// Collect and upload methods.
|
|
1888
|
-
|
|
1889
|
-
|
|
2304
|
+
collectContainer.collect({});
|
|
2305
|
+
collectContainer.uploadFiles();
|
|
1890
2306
|
|
|
1891
2307
|
```
|
|
1892
2308
|
**Sample Response for collect():**
|