@zlink-systems/stream-connector 0.30.2 → 0.31.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/dist/browser/index.global.js +33 -15
- package/dist/browser/index.mjs +33 -15
- package/package.json +2 -2
|
@@ -794,20 +794,22 @@ var ZlinkStreamConnectorBundle = (() => {
|
|
|
794
794
|
if (value === void 0 || typeof value === "function" || typeof value === "symbol") {
|
|
795
795
|
throw new TypeError("framework-json-v1 payload is not a JSON value.");
|
|
796
796
|
}
|
|
797
|
-
const encoded = JSON.stringify(
|
|
798
|
-
value,
|
|
799
|
-
replacer === void 0 ? frameworkJsonV1Replacer : function(key, item) {
|
|
800
|
-
const transformed = replacer.call(this, key, item);
|
|
801
|
-
return frameworkJsonV1Replacer.call({ [key]: transformed }, key, transformed);
|
|
802
|
-
}
|
|
803
|
-
);
|
|
797
|
+
const encoded = replacer === void 0 ? JSON.stringify(value, frameworkJsonV1Replacer) : stringifyWithReplacer(value, replacer);
|
|
804
798
|
if (schema !== void 0) {
|
|
805
799
|
validateFrameworkJsonV1Value(JSON.parse(encoded), schema, "$", false);
|
|
806
800
|
}
|
|
807
801
|
return encoded;
|
|
808
802
|
}
|
|
803
|
+
function stringifyWithReplacer(value, replacer) {
|
|
804
|
+
return JSON.stringify(value, function(key, item) {
|
|
805
|
+
const transformed = replacer.call(this, key, item);
|
|
806
|
+
return frameworkJsonV1Value(transformed, transformed);
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
809
|
function frameworkJsonV1Replacer(key, item) {
|
|
810
|
-
|
|
810
|
+
return frameworkJsonV1Value(this[key], item);
|
|
811
|
+
}
|
|
812
|
+
function frameworkJsonV1Value(source, item) {
|
|
811
813
|
if (typeof source === "number" && !Number.isFinite(source)) {
|
|
812
814
|
throw new TypeError("framework-json-v1 only accepts finite JSON numbers.");
|
|
813
815
|
}
|
|
@@ -948,6 +950,9 @@ var ZlinkStreamConnectorBundle = (() => {
|
|
|
948
950
|
this.text = text;
|
|
949
951
|
this.options = options;
|
|
950
952
|
__publicField(this, "index", 0);
|
|
953
|
+
__publicField(this, "firstEscape");
|
|
954
|
+
const escape = text.indexOf("\\");
|
|
955
|
+
this.firstEscape = escape === -1 ? text.length : escape;
|
|
951
956
|
}
|
|
952
957
|
scan() {
|
|
953
958
|
this.skipWhitespace();
|
|
@@ -1015,19 +1020,32 @@ var ZlinkStreamConnectorBundle = (() => {
|
|
|
1015
1020
|
}
|
|
1016
1021
|
}
|
|
1017
1022
|
scanString() {
|
|
1018
|
-
const
|
|
1023
|
+
const text = this.text;
|
|
1024
|
+
const start = this.index;
|
|
1025
|
+
let index = start + 1;
|
|
1026
|
+
const end = text.indexOf('"', index);
|
|
1027
|
+
if (end !== -1 && end < this.firstEscape) {
|
|
1028
|
+
this.index = end + 1;
|
|
1029
|
+
return text.slice(index, end);
|
|
1030
|
+
}
|
|
1019
1031
|
let sawEscape = false;
|
|
1020
1032
|
for (; ; ) {
|
|
1021
|
-
if (
|
|
1022
|
-
|
|
1033
|
+
if (index >= text.length) {
|
|
1034
|
+
this.index = index;
|
|
1035
|
+
this.fail("unterminated string");
|
|
1036
|
+
}
|
|
1037
|
+
const character = text[index++];
|
|
1023
1038
|
if (character === '"') {
|
|
1024
|
-
|
|
1039
|
+
this.index = index;
|
|
1040
|
+
return sawEscape ? JSON.parse(text.slice(start, index)) : text.slice(start + 1, index - 1);
|
|
1025
1041
|
}
|
|
1026
1042
|
if (character === "\\") {
|
|
1027
1043
|
sawEscape = true;
|
|
1028
|
-
if (
|
|
1029
|
-
|
|
1030
|
-
|
|
1044
|
+
if (index >= text.length) {
|
|
1045
|
+
this.index = index;
|
|
1046
|
+
this.fail("unterminated escape");
|
|
1047
|
+
}
|
|
1048
|
+
if (text[index++] === "u") index += 4;
|
|
1031
1049
|
}
|
|
1032
1050
|
}
|
|
1033
1051
|
}
|
package/dist/browser/index.mjs
CHANGED
|
@@ -749,20 +749,22 @@ function stringifyFrameworkJsonV1(value, schema, replacer) {
|
|
|
749
749
|
if (value === void 0 || typeof value === "function" || typeof value === "symbol") {
|
|
750
750
|
throw new TypeError("framework-json-v1 payload is not a JSON value.");
|
|
751
751
|
}
|
|
752
|
-
const encoded = JSON.stringify(
|
|
753
|
-
value,
|
|
754
|
-
replacer === void 0 ? frameworkJsonV1Replacer : function(key, item) {
|
|
755
|
-
const transformed = replacer.call(this, key, item);
|
|
756
|
-
return frameworkJsonV1Replacer.call({ [key]: transformed }, key, transformed);
|
|
757
|
-
}
|
|
758
|
-
);
|
|
752
|
+
const encoded = replacer === void 0 ? JSON.stringify(value, frameworkJsonV1Replacer) : stringifyWithReplacer(value, replacer);
|
|
759
753
|
if (schema !== void 0) {
|
|
760
754
|
validateFrameworkJsonV1Value(JSON.parse(encoded), schema, "$", false);
|
|
761
755
|
}
|
|
762
756
|
return encoded;
|
|
763
757
|
}
|
|
758
|
+
function stringifyWithReplacer(value, replacer) {
|
|
759
|
+
return JSON.stringify(value, function(key, item) {
|
|
760
|
+
const transformed = replacer.call(this, key, item);
|
|
761
|
+
return frameworkJsonV1Value(transformed, transformed);
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
764
|
function frameworkJsonV1Replacer(key, item) {
|
|
765
|
-
|
|
765
|
+
return frameworkJsonV1Value(this[key], item);
|
|
766
|
+
}
|
|
767
|
+
function frameworkJsonV1Value(source, item) {
|
|
766
768
|
if (typeof source === "number" && !Number.isFinite(source)) {
|
|
767
769
|
throw new TypeError("framework-json-v1 only accepts finite JSON numbers.");
|
|
768
770
|
}
|
|
@@ -902,8 +904,11 @@ var JsonPropertyScanner = class {
|
|
|
902
904
|
constructor(text, options) {
|
|
903
905
|
this.text = text;
|
|
904
906
|
this.options = options;
|
|
907
|
+
const escape = text.indexOf("\\");
|
|
908
|
+
this.firstEscape = escape === -1 ? text.length : escape;
|
|
905
909
|
}
|
|
906
910
|
index = 0;
|
|
911
|
+
firstEscape;
|
|
907
912
|
scan() {
|
|
908
913
|
this.skipWhitespace();
|
|
909
914
|
this.scanValue();
|
|
@@ -969,19 +974,32 @@ var JsonPropertyScanner = class {
|
|
|
969
974
|
}
|
|
970
975
|
}
|
|
971
976
|
scanString() {
|
|
972
|
-
const
|
|
977
|
+
const text = this.text;
|
|
978
|
+
const start = this.index;
|
|
979
|
+
let index = start + 1;
|
|
980
|
+
const end = text.indexOf('"', index);
|
|
981
|
+
if (end !== -1 && end < this.firstEscape) {
|
|
982
|
+
this.index = end + 1;
|
|
983
|
+
return text.slice(index, end);
|
|
984
|
+
}
|
|
973
985
|
let sawEscape = false;
|
|
974
986
|
for (; ; ) {
|
|
975
|
-
if (
|
|
976
|
-
|
|
987
|
+
if (index >= text.length) {
|
|
988
|
+
this.index = index;
|
|
989
|
+
this.fail("unterminated string");
|
|
990
|
+
}
|
|
991
|
+
const character = text[index++];
|
|
977
992
|
if (character === '"') {
|
|
978
|
-
|
|
993
|
+
this.index = index;
|
|
994
|
+
return sawEscape ? JSON.parse(text.slice(start, index)) : text.slice(start + 1, index - 1);
|
|
979
995
|
}
|
|
980
996
|
if (character === "\\") {
|
|
981
997
|
sawEscape = true;
|
|
982
|
-
if (
|
|
983
|
-
|
|
984
|
-
|
|
998
|
+
if (index >= text.length) {
|
|
999
|
+
this.index = index;
|
|
1000
|
+
this.fail("unterminated escape");
|
|
1001
|
+
}
|
|
1002
|
+
if (text[index++] === "u") index += 4;
|
|
985
1003
|
}
|
|
986
1004
|
}
|
|
987
1005
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zlink-systems/stream-connector",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@zlink-systems/stream-wire": "0.
|
|
25
|
+
"@zlink-systems/stream-wire": "0.31.0"
|
|
26
26
|
}
|
|
27
27
|
}
|