@truto/truto-jsonata 1.0.48 → 1.0.50
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 +62 -2
- package/dist/browser/index.js +25179 -16252
- package/dist/browser/index.js.map +207 -113
- package/dist/cjs/index.cjs +25179 -16252
- package/dist/cjs/index.cjs.map +207 -113
- package/dist/esm/index.js +17 -1
- package/dist/esm/index.js.map +8 -8
- package/dist/functions/digest.d.ts +1 -1
- package/dist/functions/removeEmptyItems.d.ts +1 -1
- package/package.json +11 -7
package/README.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://truto.one" target="_blank" rel="noopener noreferrer">
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://frontsite-logos.truto.one/truto.svg">
|
|
5
|
+
<source media="(prefers-color-scheme: light)" srcset="https://files-public.truto.one/824a1120-c112-45e6-8ca2-787ffeee3a1c">
|
|
6
|
+
<img alt="Truto Unified API" src="https://frontsite-logos.truto.one/truto.svg" width="240">
|
|
7
|
+
</picture>
|
|
8
|
+
</a>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<strong>Unified API for Everything</strong><br>
|
|
13
|
+
The integration platform that gives devs full control and sales the integrations they need to close deals now.
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
<a href="https://truto.one" target="_blank" rel="noopener noreferrer">Website</a> •
|
|
18
|
+
<a href="https://docs.truto.one "target="_blank" rel="noopener noreferrer">Docs</a>
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
1
23
|
|
|
2
24
|
# truto-jsonata
|
|
3
25
|
|
|
@@ -999,7 +1021,13 @@ Blob (13 bytes) {
|
|
|
999
1021
|
<details>
|
|
1000
1022
|
<summary>digest(text, algorithm = 'SHA-256', stringType = 'hex')</summary>
|
|
1001
1023
|
|
|
1002
|
-
Generates a cryptographic hash of the input text using a specified hashing algorithm and output format.
|
|
1024
|
+
Generates a cryptographic hash of the input text using a specified hashing algorithm and output format.
|
|
1025
|
+
|
|
1026
|
+
**Supported Algorithms:**
|
|
1027
|
+
- SHA algorithms (SHA-1, SHA-256, SHA-384, SHA-512) use the [Web Crypto API's `crypto.subtle.digest()`](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest). See [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest#supported_algorithms) for the complete list of supported algorithms.
|
|
1028
|
+
- MD5 uses the `md5.js` library (since MD5 is not supported by Web Crypto API).
|
|
1029
|
+
|
|
1030
|
+
**Output Formats:** 'hex', 'base64', and 'base64-urlSafe'.
|
|
1003
1031
|
|
|
1004
1032
|
**Example:**
|
|
1005
1033
|
|
|
@@ -1037,7 +1065,39 @@ const expression3 = trutoJsonata("$digest(text, algorithm, stringType)");
|
|
|
1037
1065
|
expression3.evaluate({ text: text3, algorithm: algorithm3, stringType: stringType3 }).then(result => {
|
|
1038
1066
|
console.log(result);
|
|
1039
1067
|
// Output: "Xh3mV+fAAG7ScGPjo4PElmR3obnFzGrxnbwGpEE4lI4="
|
|
1068
|
+
});
|
|
1069
|
+
|
|
1070
|
+
// Example 4: MD5 Algorithm, Hex Output
|
|
1071
|
+
const text4 = '42';
|
|
1072
|
+
const algorithm4 = 'MD5';
|
|
1073
|
+
const stringType4 = 'hex';
|
|
1040
1074
|
|
|
1075
|
+
const expression4 = trutoJsonata("$digest(text, algorithm, stringType)");
|
|
1076
|
+
expression4.evaluate({ text: text4, algorithm: algorithm4, stringType: stringType4 }).then(result => {
|
|
1077
|
+
console.log(result);
|
|
1078
|
+
// Output: "a1d0c6e83f027327d8461063f4ac58a6"
|
|
1079
|
+
});
|
|
1080
|
+
|
|
1081
|
+
// Example 5: MD5 Algorithm, Base64 Output
|
|
1082
|
+
const text5 = '42';
|
|
1083
|
+
const algorithm5 = 'MD5';
|
|
1084
|
+
const stringType5 = 'base64';
|
|
1085
|
+
|
|
1086
|
+
const expression5 = trutoJsonata("$digest(text, algorithm, stringType)");
|
|
1087
|
+
expression5.evaluate({ text: text5, algorithm: algorithm5, stringType: stringType5 }).then(result => {
|
|
1088
|
+
console.log(result);
|
|
1089
|
+
// Output: "odDG6D8CcyfYRgYj9KxYpg=="
|
|
1090
|
+
});
|
|
1091
|
+
|
|
1092
|
+
// Example 6: MD5 Algorithm, Base64 URL-Safe Output
|
|
1093
|
+
const text6 = '42';
|
|
1094
|
+
const algorithm6 = 'MD5';
|
|
1095
|
+
const stringType6 = 'base64-urlSafe';
|
|
1096
|
+
|
|
1097
|
+
const expression6 = trutoJsonata("$digest(text, algorithm, stringType)");
|
|
1098
|
+
expression6.evaluate({ text: text6, algorithm: algorithm6, stringType: stringType6 }).then(result => {
|
|
1099
|
+
console.log(result);
|
|
1100
|
+
// Output: "odDG6D8CcyfYRgYj9KxYpg"
|
|
1041
1101
|
});
|
|
1042
1102
|
|
|
1043
1103
|
```
|
|
@@ -2360,4 +2420,4 @@ expression.evaluate({}).then(result => { console.log(result); });
|
|
|
2360
2420
|
// Output: [[1,2],[3,4],[5]]
|
|
2361
2421
|
```
|
|
2362
2422
|
|
|
2363
|
-
</details>
|
|
2423
|
+
</details>
|