@jr2804/livesync-cli 1.0.32-cli.1 → 1.0.51-cli.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/LICENSE +0 -0
- package/README.md +4 -1
- package/dist/{AwsRestJsonProtocol-BPmCQzXa.cjs → AwsRestJsonProtocol-8bfuD33v.cjs} +26 -24
- package/dist/{common-B3KclSP_.cjs → HttpInterceptingShapeSerializer-CdZ0h50h.cjs} +294 -23
- package/dist/XmlShapeDeserializer-B7URh4O0.cjs +435 -0
- package/dist/{dist-es-DhxfSNMj.cjs → dist-es-BM2h2Gys.cjs} +3 -4
- package/dist/dist-es-Cc6BAzq1.cjs +68 -0
- package/dist/{dist-es-BU2b9jKG.cjs → dist-es-CyUUay9V.cjs} +3 -3
- package/dist/{dist-es-FcX9AtZC.cjs → dist-es-DvWHLSEe.cjs} +6 -6
- package/dist/{dist-es-CaaxKLO9.cjs → dist-es-bSvKL25L.cjs} +1 -1
- package/dist/{event-streams-DmrxQXpO.cjs → event-streams-_ny8BA_d.cjs} +4 -4
- package/dist/{extensions-DkDzTVCO.cjs → extensions-BY32lT5G.cjs} +302 -35
- package/dist/index.cjs +49547 -34723
- package/dist/{loadSso-Dn78jIWR.cjs → loadSso-BTCpyZdX.cjs} +36 -14
- package/dist/{sdk-stream-mixin-YBLWtp6l.cjs → sdk-stream-mixin-DkgFkSQp.cjs} +4 -4
- package/dist/{signin-DHnd2WFx.cjs → signin-C5HI1JED.cjs} +39 -17
- package/dist/{sso-oidc-B4fkm2gn.cjs → sso-oidc-CgmbzBa9.cjs} +36 -14
- package/dist/{stream-collector-jwXXBEUn.cjs → stream-collector-DMWbWhbd.cjs} +291 -7
- package/dist/{sts-C9aqjeec.cjs → sts-BN3zvW2j.cjs} +56 -23
- package/dist/toUtf8-Dj4WWtpp.cjs +56 -0
- package/package.json +7 -7
- package/dist/XmlShapeDeserializer-B1_gcW92.cjs +0 -2097
- package/dist/date-utils-Dr5LXq4_.cjs +0 -338
- package/dist/serde-DtADB-gG.cjs +0 -597
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
@@ -23,7 +23,10 @@ livesync-cli <database-path> daemon --vault /path/to/vault
|
|
|
23
23
|
|---------|-------------|
|
|
24
24
|
| `daemon` | (default) Run mirror scan then continuously sync CouchDB ↔ local filesystem |
|
|
25
25
|
| `sync` | Run one replication cycle and exit |
|
|
26
|
-
| `mirror` |
|
|
26
|
+
| `mirror` | Bidirectional sync between the local database and the vault directory |
|
|
27
|
+
| `journal-skip <journal-key>` | Retry replication, skip only the matching stopped Journal, and resume |
|
|
28
|
+
| `rebuild` | Rebuild the local and remote databases from the vault (requires `--force`) |
|
|
29
|
+
| `fetch` | Replace the local database with remote state and reflect it to the vault (requires `--force`) |
|
|
27
30
|
|
|
28
31
|
### File operations
|
|
29
32
|
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
const require_stream_collector = require("./stream-collector-
|
|
2
|
-
const require_extensions = require("./extensions-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const require_common = require("./common-B3KclSP_.cjs");
|
|
1
|
+
const require_stream_collector = require("./stream-collector-DMWbWhbd.cjs");
|
|
2
|
+
const require_extensions = require("./extensions-BY32lT5G.cjs");
|
|
3
|
+
const require_toUtf8 = require("./toUtf8-Dj4WWtpp.cjs");
|
|
4
|
+
const require_HttpInterceptingShapeSerializer = require("./HttpInterceptingShapeSerializer-CdZ0h50h.cjs");
|
|
6
5
|
//#region ../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/jsonReviver.js
|
|
7
6
|
function jsonReviver(key, value, context) {
|
|
8
7
|
if (context?.source) {
|
|
9
8
|
const numericString = context.source;
|
|
10
9
|
if (typeof value === "number") {
|
|
11
|
-
if (value > Number.MAX_SAFE_INTEGER || value < Number.MIN_SAFE_INTEGER || numericString !== String(value)) if (numericString.includes(".")) return new
|
|
10
|
+
if (value > Number.MAX_SAFE_INTEGER || value < Number.MIN_SAFE_INTEGER || numericString !== String(value)) if (numericString.includes(".")) return new require_extensions.NumericValue(numericString, "bigDecimal");
|
|
12
11
|
else return BigInt(numericString);
|
|
13
12
|
}
|
|
14
13
|
}
|
|
15
14
|
return value;
|
|
16
15
|
}
|
|
17
16
|
//#endregion
|
|
17
|
+
//#region ../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/common.js
|
|
18
|
+
var collectBodyString = (streamBody, context) => require_extensions.collectBody(streamBody, context).then((body) => (context?.utf8Encoder ?? require_toUtf8.toUtf8)(body));
|
|
19
|
+
//#endregion
|
|
18
20
|
//#region ../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/parseJsonBody.js
|
|
19
|
-
var parseJsonBody = (streamBody, context) =>
|
|
21
|
+
var parseJsonBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
|
|
20
22
|
if (encoded.length) try {
|
|
21
23
|
return JSON.parse(encoded);
|
|
22
24
|
} catch (e) {
|
|
@@ -102,23 +104,23 @@ var JsonShapeDeserializer = class extends require_extensions.SerdeContextConfig
|
|
|
102
104
|
if (ns.isBlobSchema() && typeof value === "string") return require_stream_collector.fromBase64(value);
|
|
103
105
|
const mediaType = ns.getMergedTraits().mediaType;
|
|
104
106
|
if (ns.isStringSchema() && typeof value === "string" && mediaType) {
|
|
105
|
-
if (mediaType === "application/json" || mediaType.endsWith("+json")) return
|
|
107
|
+
if (mediaType === "application/json" || mediaType.endsWith("+json")) return require_extensions.LazyJsonString.from(value);
|
|
106
108
|
return value;
|
|
107
109
|
}
|
|
108
110
|
if (ns.isTimestampSchema() && value != null) switch (require_extensions.determineTimestampFormat(ns, this.settings)) {
|
|
109
|
-
case 5: return
|
|
110
|
-
case 6: return
|
|
111
|
-
case 7: return
|
|
111
|
+
case 5: return require_stream_collector.parseRfc3339DateTimeWithOffset(value);
|
|
112
|
+
case 6: return require_stream_collector.parseRfc7231DateTime(value);
|
|
113
|
+
case 7: return require_stream_collector.parseEpochTimestamp(value);
|
|
112
114
|
default:
|
|
113
115
|
console.warn("Missing timestamp format, parsing value with Date constructor:", value);
|
|
114
116
|
return new Date(value);
|
|
115
117
|
}
|
|
116
118
|
if (ns.isBigIntegerSchema() && (typeof value === "number" || typeof value === "string")) return BigInt(value);
|
|
117
119
|
if (ns.isBigDecimalSchema() && value != void 0) {
|
|
118
|
-
if (value instanceof
|
|
120
|
+
if (value instanceof require_extensions.NumericValue) return value;
|
|
119
121
|
const untyped = value;
|
|
120
|
-
if (untyped.type === "bigDecimal" && "string" in untyped) return new
|
|
121
|
-
return new
|
|
122
|
+
if (untyped.type === "bigDecimal" && "string" in untyped) return new require_extensions.NumericValue(untyped.string, untyped.type);
|
|
123
|
+
return new require_extensions.NumericValue(String(value), "bigDecimal");
|
|
122
124
|
}
|
|
123
125
|
if (ns.isNumericSchema() && typeof value === "string") {
|
|
124
126
|
switch (value) {
|
|
@@ -130,7 +132,7 @@ var JsonShapeDeserializer = class extends require_extensions.SerdeContextConfig
|
|
|
130
132
|
}
|
|
131
133
|
if (ns.isDocumentSchema()) if (isObject) {
|
|
132
134
|
const out = Array.isArray(value) ? [] : {};
|
|
133
|
-
for (const [k, v] of Object.entries(value)) if (v instanceof
|
|
135
|
+
for (const [k, v] of Object.entries(value)) if (v instanceof require_extensions.NumericValue) out[k] = v;
|
|
134
136
|
else out[k] = this._read(ns, v);
|
|
135
137
|
return out;
|
|
136
138
|
} else return structuredClone(value);
|
|
@@ -148,7 +150,7 @@ var JsonReplacer = class {
|
|
|
148
150
|
if (this.stage === 2) throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");
|
|
149
151
|
this.stage = 1;
|
|
150
152
|
return (key, value) => {
|
|
151
|
-
if (value instanceof
|
|
153
|
+
if (value instanceof require_extensions.NumericValue) {
|
|
152
154
|
const v = `${"Νnv" + this.counter++}_` + value.string;
|
|
153
155
|
this.values.set(`"${v}"`, value.string);
|
|
154
156
|
return v;
|
|
@@ -254,20 +256,20 @@ var JsonShapeSerializer = class extends require_extensions.SerdeContextConfig {
|
|
|
254
256
|
}
|
|
255
257
|
if (value instanceof Date && (ns.isTimestampSchema() || ns.isDocumentSchema())) switch (require_extensions.determineTimestampFormat(ns, this.settings)) {
|
|
256
258
|
case 5: return value.toISOString().replace(".000Z", "Z");
|
|
257
|
-
case 6: return
|
|
259
|
+
case 6: return require_stream_collector.dateToUtcString(value);
|
|
258
260
|
case 7: return value.getTime() / 1e3;
|
|
259
261
|
default:
|
|
260
262
|
console.warn("Missing timestamp format, using epoch seconds", value);
|
|
261
263
|
return value.getTime() / 1e3;
|
|
262
264
|
}
|
|
263
|
-
if (value instanceof
|
|
265
|
+
if (value instanceof require_extensions.NumericValue) this.useReplacer = true;
|
|
264
266
|
}
|
|
265
267
|
if (value === null && container?.isStructSchema()) return;
|
|
266
268
|
if (ns.isStringSchema()) {
|
|
267
|
-
if (typeof value === "undefined" && ns.isIdempotencyToken()) return
|
|
269
|
+
if (typeof value === "undefined" && ns.isIdempotencyToken()) return require_extensions.generateIdempotencyToken();
|
|
268
270
|
const mediaType = ns.getMergedTraits().mediaType;
|
|
269
271
|
if (value != null && mediaType) {
|
|
270
|
-
if (mediaType === "application/json" || mediaType.endsWith("+json")) return
|
|
272
|
+
if (mediaType === "application/json" || mediaType.endsWith("+json")) return require_extensions.LazyJsonString.from(value);
|
|
271
273
|
}
|
|
272
274
|
return value;
|
|
273
275
|
}
|
|
@@ -282,7 +284,7 @@ var JsonShapeSerializer = class extends require_extensions.SerdeContextConfig {
|
|
|
282
284
|
if (typeof value === "bigint") this.useReplacer = true;
|
|
283
285
|
if (ns.isDocumentSchema()) if (isObject) {
|
|
284
286
|
const out = Array.isArray(value) ? [] : {};
|
|
285
|
-
for (const [k, v] of Object.entries(value)) if (v instanceof
|
|
287
|
+
for (const [k, v] of Object.entries(value)) if (v instanceof require_extensions.NumericValue) {
|
|
286
288
|
this.useReplacer = true;
|
|
287
289
|
out[k] = v;
|
|
288
290
|
} else out[k] = this._write(ns, v);
|
|
@@ -312,7 +314,7 @@ var JsonCodec = class extends require_extensions.SerdeContextConfig {
|
|
|
312
314
|
};
|
|
313
315
|
//#endregion
|
|
314
316
|
//#region ../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsRestJsonProtocol.js
|
|
315
|
-
var AwsRestJsonProtocol = class extends
|
|
317
|
+
var AwsRestJsonProtocol = class extends require_HttpInterceptingShapeSerializer.HttpBindingProtocol {
|
|
316
318
|
serializer;
|
|
317
319
|
deserializer;
|
|
318
320
|
codec;
|
|
@@ -331,8 +333,8 @@ var AwsRestJsonProtocol = class extends require_common.HttpBindingProtocol {
|
|
|
331
333
|
jsonName: true
|
|
332
334
|
};
|
|
333
335
|
this.codec = new JsonCodec(settings);
|
|
334
|
-
this.serializer = new
|
|
335
|
-
this.deserializer = new
|
|
336
|
+
this.serializer = new require_HttpInterceptingShapeSerializer.HttpInterceptingShapeSerializer(this.codec.createSerializer(), settings);
|
|
337
|
+
this.deserializer = new require_HttpInterceptingShapeSerializer.HttpInterceptingShapeDeserializer(this.codec.createDeserializer(), settings);
|
|
336
338
|
}
|
|
337
339
|
getShapeId() {
|
|
338
340
|
return "aws.protocols#restJson1";
|
|
@@ -1,6 +1,286 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
1
|
+
const require_stream_collector = require("./stream-collector-DMWbWhbd.cjs");
|
|
2
|
+
const require_extensions = require("./extensions-BY32lT5G.cjs");
|
|
3
|
+
const require_toUtf8 = require("./toUtf8-Dj4WWtpp.cjs");
|
|
4
|
+
let node_stream = require("node:stream");
|
|
5
|
+
//#region ../../../node_modules/@smithy/core/dist-es/submodules/serde/quote-header.js
|
|
6
|
+
function quoteHeader(part) {
|
|
7
|
+
if (part.includes(",") || part.includes("\"")) part = `"${part.replace(/"/g, "\\\"")}"`;
|
|
8
|
+
return part;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region ../../../node_modules/@smithy/core/dist-es/submodules/serde/split-every.js
|
|
12
|
+
function splitEvery(value, delimiter, numDelimiters) {
|
|
13
|
+
if (numDelimiters <= 0 || !Number.isInteger(numDelimiters)) throw new Error("Invalid number of delimiters (" + numDelimiters + ") for splitEvery.");
|
|
14
|
+
const segments = value.split(delimiter);
|
|
15
|
+
if (numDelimiters === 1) return segments;
|
|
16
|
+
const compoundSegments = [];
|
|
17
|
+
let currentSegment = "";
|
|
18
|
+
for (let i = 0; i < segments.length; i++) {
|
|
19
|
+
if (currentSegment === "") currentSegment = segments[i];
|
|
20
|
+
else currentSegment += delimiter + segments[i];
|
|
21
|
+
if ((i + 1) % numDelimiters === 0) {
|
|
22
|
+
compoundSegments.push(currentSegment);
|
|
23
|
+
currentSegment = "";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (currentSegment !== "") compoundSegments.push(currentSegment);
|
|
27
|
+
return compoundSegments;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region ../../../node_modules/@smithy/core/dist-es/submodules/serde/util-hex-encoding/hex-encoding.js
|
|
31
|
+
var SHORT_TO_HEX = {};
|
|
32
|
+
var HEX_TO_SHORT = {};
|
|
33
|
+
for (let i = 0; i < 256; i++) {
|
|
34
|
+
let encodedByte = i.toString(16).toLowerCase();
|
|
35
|
+
if (encodedByte.length === 1) encodedByte = `0${encodedByte}`;
|
|
36
|
+
SHORT_TO_HEX[i] = encodedByte;
|
|
37
|
+
HEX_TO_SHORT[encodedByte] = i;
|
|
38
|
+
}
|
|
39
|
+
function toHex(bytes) {
|
|
40
|
+
let out = "";
|
|
41
|
+
for (let i = 0; i < bytes.byteLength; i++) out += SHORT_TO_HEX[bytes[i]];
|
|
42
|
+
return out;
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region ../../../node_modules/@smithy/core/dist-es/submodules/serde/util-stream/stream-type-check.js
|
|
46
|
+
var isReadableStream = (stream) => typeof ReadableStream === "function" && (stream?.constructor?.name === ReadableStream.name || stream instanceof ReadableStream);
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region ../../../node_modules/@smithy/core/dist-es/submodules/serde/util-utf8/fromUtf8.browser.js
|
|
49
|
+
var fromUtf8 = (input) => new TextEncoder().encode(input);
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region ../../../node_modules/@smithy/core/dist-es/submodules/serde/util-base64/constants-for-browser.js
|
|
52
|
+
var chars = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`;
|
|
53
|
+
var alphabetByEncoding = Object.entries(chars).reduce((acc, [i, c]) => {
|
|
54
|
+
acc[c] = Number(i);
|
|
55
|
+
return acc;
|
|
56
|
+
}, {});
|
|
57
|
+
var alphabetByValue = chars.split("");
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region ../../../node_modules/@smithy/core/dist-es/submodules/serde/util-base64/toBase64.browser.js
|
|
60
|
+
function toBase64(_input) {
|
|
61
|
+
let input;
|
|
62
|
+
if (typeof _input === "string") input = fromUtf8(_input);
|
|
63
|
+
else input = _input;
|
|
64
|
+
const isArrayLike = typeof input === "object" && typeof input.length === "number";
|
|
65
|
+
const isUint8Array = typeof input === "object" && typeof input.byteOffset === "number" && typeof input.byteLength === "number";
|
|
66
|
+
if (!isArrayLike && !isUint8Array) throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");
|
|
67
|
+
let str = "";
|
|
68
|
+
for (let i = 0; i < input.length; i += 3) {
|
|
69
|
+
let bits = 0;
|
|
70
|
+
let bitLength = 0;
|
|
71
|
+
for (let j = i, limit = Math.min(i + 3, input.length); j < limit; j++) {
|
|
72
|
+
bits |= input[j] << (limit - j - 1) * 8;
|
|
73
|
+
bitLength += 8;
|
|
74
|
+
}
|
|
75
|
+
const bitClusterCount = Math.ceil(bitLength / 6);
|
|
76
|
+
bits <<= bitClusterCount * 6 - bitLength;
|
|
77
|
+
for (let k = 1; k <= bitClusterCount; k++) {
|
|
78
|
+
const offset = (bitClusterCount - k) * 6;
|
|
79
|
+
str += alphabetByValue[(bits & 63 << offset) >> offset];
|
|
80
|
+
}
|
|
81
|
+
str += "==".slice(0, 4 - bitClusterCount);
|
|
82
|
+
}
|
|
83
|
+
return str;
|
|
84
|
+
}
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region ../../../node_modules/@smithy/core/dist-es/submodules/serde/util-utf8/toUtf8.browser.js
|
|
87
|
+
var toUtf8 = (input) => {
|
|
88
|
+
if (typeof input === "string") return input;
|
|
89
|
+
if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");
|
|
90
|
+
return new TextDecoder("utf-8").decode(input);
|
|
91
|
+
};
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region ../../../node_modules/@smithy/core/dist-es/submodules/serde/util-base64/fromBase64.browser.js
|
|
94
|
+
var fromBase64 = (input) => {
|
|
95
|
+
let totalByteLength = input.length / 4 * 3;
|
|
96
|
+
if (input.slice(-2) === "==") totalByteLength -= 2;
|
|
97
|
+
else if (input.slice(-1) === "=") totalByteLength--;
|
|
98
|
+
const out = new ArrayBuffer(totalByteLength);
|
|
99
|
+
const dataView = new DataView(out);
|
|
100
|
+
for (let i = 0; i < input.length; i += 4) {
|
|
101
|
+
let bits = 0;
|
|
102
|
+
let bitLength = 0;
|
|
103
|
+
for (let j = i, limit = i + 3; j <= limit; j++) if (input[j] !== "=") {
|
|
104
|
+
if (!(input[j] in alphabetByEncoding)) throw new TypeError(`Invalid character ${input[j]} in base64 string.`);
|
|
105
|
+
bits |= alphabetByEncoding[input[j]] << (limit - j) * 6;
|
|
106
|
+
bitLength += 6;
|
|
107
|
+
} else bits >>= 6;
|
|
108
|
+
const chunkOffset = i / 4 * 3;
|
|
109
|
+
bits >>= bitLength % 8;
|
|
110
|
+
const byteLength = Math.floor(bitLength / 8);
|
|
111
|
+
for (let k = 0; k < byteLength; k++) {
|
|
112
|
+
const offset = (byteLength - k - 1) * 8;
|
|
113
|
+
dataView.setUint8(chunkOffset + k, (bits & 255 << offset) >> offset);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return new Uint8Array(out);
|
|
117
|
+
};
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region ../../../node_modules/@smithy/core/dist-es/submodules/serde/util-stream/stream-collector.browser.js
|
|
120
|
+
var streamCollector$1 = async (stream) => {
|
|
121
|
+
if (typeof Blob === "function" && stream instanceof Blob || stream.constructor?.name === "Blob") {
|
|
122
|
+
if (Blob.prototype.arrayBuffer !== void 0) return new Uint8Array(await stream.arrayBuffer());
|
|
123
|
+
return collectBlob(stream);
|
|
124
|
+
}
|
|
125
|
+
return collectStream(stream);
|
|
126
|
+
};
|
|
127
|
+
async function collectBlob(blob) {
|
|
128
|
+
const arrayBuffer = fromBase64(await readToBase64(blob));
|
|
129
|
+
return new Uint8Array(arrayBuffer);
|
|
130
|
+
}
|
|
131
|
+
async function collectStream(stream) {
|
|
132
|
+
const chunks = [];
|
|
133
|
+
const reader = stream.getReader();
|
|
134
|
+
let isDone = false;
|
|
135
|
+
let length = 0;
|
|
136
|
+
while (!isDone) {
|
|
137
|
+
const { done, value } = await reader.read();
|
|
138
|
+
if (value) {
|
|
139
|
+
chunks.push(value);
|
|
140
|
+
length += value.length;
|
|
141
|
+
}
|
|
142
|
+
isDone = done;
|
|
143
|
+
}
|
|
144
|
+
const collected = new Uint8Array(length);
|
|
145
|
+
let offset = 0;
|
|
146
|
+
for (const chunk of chunks) {
|
|
147
|
+
collected.set(chunk, offset);
|
|
148
|
+
offset += chunk.length;
|
|
149
|
+
}
|
|
150
|
+
return collected;
|
|
151
|
+
}
|
|
152
|
+
function readToBase64(blob) {
|
|
153
|
+
return new Promise((resolve, reject) => {
|
|
154
|
+
const reader = new FileReader();
|
|
155
|
+
reader.onloadend = () => {
|
|
156
|
+
if (reader.readyState !== 2) return reject(/* @__PURE__ */ new Error("Reader aborted too early"));
|
|
157
|
+
const result = reader.result ?? "";
|
|
158
|
+
const commaIndex = result.indexOf(",");
|
|
159
|
+
const dataOffset = commaIndex > -1 ? commaIndex + 1 : result.length;
|
|
160
|
+
resolve(result.substring(dataOffset));
|
|
161
|
+
};
|
|
162
|
+
reader.onabort = () => reject(/* @__PURE__ */ new Error("Read aborted"));
|
|
163
|
+
reader.onerror = () => reject(reader.error);
|
|
164
|
+
reader.readAsDataURL(blob);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region ../../../node_modules/@smithy/core/dist-es/submodules/serde/util-stream/sdk-stream-mixin.browser.js
|
|
169
|
+
var ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED$1 = "The stream has already been transformed.";
|
|
170
|
+
var sdkStreamMixin$1 = (stream) => {
|
|
171
|
+
if (!isBlobInstance(stream) && !isReadableStream(stream)) {
|
|
172
|
+
const name = stream?.__proto__?.constructor?.name || stream;
|
|
173
|
+
throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${name}`);
|
|
174
|
+
}
|
|
175
|
+
let transformed = false;
|
|
176
|
+
const transformToByteArray = async () => {
|
|
177
|
+
if (transformed) throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED$1);
|
|
178
|
+
transformed = true;
|
|
179
|
+
return await streamCollector$1(stream);
|
|
180
|
+
};
|
|
181
|
+
const blobToWebStream = (blob) => {
|
|
182
|
+
if (typeof blob.stream !== "function") throw new Error("Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.\nIf you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body");
|
|
183
|
+
return blob.stream();
|
|
184
|
+
};
|
|
185
|
+
return Object.assign(stream, {
|
|
186
|
+
transformToByteArray,
|
|
187
|
+
transformToString: async (encoding) => {
|
|
188
|
+
const buf = await transformToByteArray();
|
|
189
|
+
if (encoding === "base64") return toBase64(buf);
|
|
190
|
+
else if (encoding === "hex") return toHex(buf);
|
|
191
|
+
else if (encoding === void 0 || encoding === "utf8" || encoding === "utf-8") return toUtf8(buf);
|
|
192
|
+
else if (typeof TextDecoder === "function") return new TextDecoder(encoding).decode(buf);
|
|
193
|
+
else throw new Error("TextDecoder is not available, please make sure polyfill is provided.");
|
|
194
|
+
},
|
|
195
|
+
transformToWebStream: () => {
|
|
196
|
+
if (transformed) throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED$1);
|
|
197
|
+
transformed = true;
|
|
198
|
+
if (isBlobInstance(stream)) return blobToWebStream(stream);
|
|
199
|
+
else if (isReadableStream(stream)) return stream;
|
|
200
|
+
else throw new Error(`Cannot transform payload to web stream, got ${stream}`);
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
var isBlobInstance = (stream) => typeof Blob === "function" && stream instanceof Blob;
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region ../../../node_modules/@smithy/core/dist-es/submodules/serde/util-stream/stream-collector.js
|
|
207
|
+
var Collector = class extends node_stream.Writable {
|
|
208
|
+
bufferedBytes = [];
|
|
209
|
+
_write(chunk, encoding, callback) {
|
|
210
|
+
this.bufferedBytes.push(chunk);
|
|
211
|
+
callback();
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
var isReadableStreamInstance = (stream) => typeof ReadableStream === "function" && stream instanceof ReadableStream;
|
|
215
|
+
async function collectReadableStream(stream) {
|
|
216
|
+
const chunks = [];
|
|
217
|
+
const reader = stream.getReader();
|
|
218
|
+
let isDone = false;
|
|
219
|
+
let length = 0;
|
|
220
|
+
while (!isDone) {
|
|
221
|
+
const { done, value } = await reader.read();
|
|
222
|
+
if (value) {
|
|
223
|
+
chunks.push(value);
|
|
224
|
+
length += value.length;
|
|
225
|
+
}
|
|
226
|
+
isDone = done;
|
|
227
|
+
}
|
|
228
|
+
const collected = new Uint8Array(length);
|
|
229
|
+
let offset = 0;
|
|
230
|
+
for (const chunk of chunks) {
|
|
231
|
+
collected.set(chunk, offset);
|
|
232
|
+
offset += chunk.length;
|
|
233
|
+
}
|
|
234
|
+
return collected;
|
|
235
|
+
}
|
|
236
|
+
var streamCollector = (stream) => {
|
|
237
|
+
if (isReadableStreamInstance(stream)) return collectReadableStream(stream);
|
|
238
|
+
return new Promise((resolve, reject) => {
|
|
239
|
+
const collector = new Collector();
|
|
240
|
+
stream.pipe(collector);
|
|
241
|
+
stream.on("error", (err) => {
|
|
242
|
+
collector.end();
|
|
243
|
+
reject(err);
|
|
244
|
+
});
|
|
245
|
+
collector.on("error", reject);
|
|
246
|
+
collector.on("finish", function() {
|
|
247
|
+
resolve(new Uint8Array(Buffer.concat(this.bufferedBytes)));
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
};
|
|
251
|
+
//#endregion
|
|
252
|
+
//#region ../../../node_modules/@smithy/core/dist-es/submodules/serde/util-stream/sdk-stream-mixin.js
|
|
253
|
+
var ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED = "The stream has already been transformed.";
|
|
254
|
+
var sdkStreamMixin = (stream) => {
|
|
255
|
+
if (!(stream instanceof node_stream.Readable)) try {
|
|
256
|
+
return sdkStreamMixin$1(stream);
|
|
257
|
+
} catch (e) {
|
|
258
|
+
const name = stream?.__proto__?.constructor?.name || stream;
|
|
259
|
+
throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${name}`);
|
|
260
|
+
}
|
|
261
|
+
let transformed = false;
|
|
262
|
+
const transformToByteArray = async () => {
|
|
263
|
+
if (transformed) throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED);
|
|
264
|
+
transformed = true;
|
|
265
|
+
return await streamCollector(stream);
|
|
266
|
+
};
|
|
267
|
+
return Object.assign(stream, {
|
|
268
|
+
transformToByteArray,
|
|
269
|
+
transformToString: async (encoding) => {
|
|
270
|
+
const buf = await transformToByteArray();
|
|
271
|
+
if (encoding === void 0 || Buffer.isEncoding(encoding)) return require_toUtf8.fromArrayBuffer(buf.buffer, buf.byteOffset, buf.byteLength).toString(encoding);
|
|
272
|
+
else return new TextDecoder(encoding).decode(buf);
|
|
273
|
+
},
|
|
274
|
+
transformToWebStream: () => {
|
|
275
|
+
if (transformed) throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED);
|
|
276
|
+
if (stream.readableFlowing !== null) throw new Error("The stream has been consumed by other callbacks.");
|
|
277
|
+
if (typeof node_stream.Readable.toWeb !== "function") throw new Error("Readable.toWeb() is not supported. Please ensure a polyfill is available.");
|
|
278
|
+
transformed = true;
|
|
279
|
+
return node_stream.Readable.toWeb(stream);
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
};
|
|
283
|
+
//#endregion
|
|
4
284
|
//#region ../../../node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js
|
|
5
285
|
var HttpBindingProtocol = class extends require_extensions.HttpProtocol {
|
|
6
286
|
async serializeRequest(operationSchema, _input, context) {
|
|
@@ -171,7 +451,7 @@ var HttpBindingProtocol = class extends require_extensions.HttpProtocol {
|
|
|
171
451
|
response,
|
|
172
452
|
responseSchema: ns
|
|
173
453
|
});
|
|
174
|
-
else dataObject[memberName] =
|
|
454
|
+
else dataObject[memberName] = sdkStreamMixin(response.body);
|
|
175
455
|
else if (response.body) {
|
|
176
456
|
const bytes = await require_extensions.collectBody(response.body, context);
|
|
177
457
|
if (bytes.byteLength > 0) dataObject[memberName] = await deserializer.read(memberSchema, bytes);
|
|
@@ -183,8 +463,8 @@ var HttpBindingProtocol = class extends require_extensions.HttpProtocol {
|
|
|
183
463
|
const headerListValueSchema = memberSchema.getValueSchema();
|
|
184
464
|
headerListValueSchema.getMergedTraits().httpHeader = key;
|
|
185
465
|
let sections;
|
|
186
|
-
if (headerListValueSchema.isTimestampSchema() && headerListValueSchema.getSchema() === 4) sections =
|
|
187
|
-
else sections =
|
|
466
|
+
if (headerListValueSchema.isTimestampSchema() && headerListValueSchema.getSchema() === 4) sections = splitEvery(value, ",", 2);
|
|
467
|
+
else sections = require_extensions.splitHeader(value);
|
|
188
468
|
const list = [];
|
|
189
469
|
for (const section of sections) list.push(await deserializer.read(headerListValueSchema, section.trim()));
|
|
190
470
|
dataObject[memberName] = list;
|
|
@@ -222,11 +502,11 @@ var HttpInterceptingShapeDeserializer = class extends require_extensions.SerdeCo
|
|
|
222
502
|
read(schema, data) {
|
|
223
503
|
const ns = require_extensions.NormalizedSchema.of(schema);
|
|
224
504
|
const traits = ns.getMergedTraits();
|
|
225
|
-
const toString = this.serdeContext?.utf8Encoder ??
|
|
505
|
+
const toString = this.serdeContext?.utf8Encoder ?? require_toUtf8.toUtf8;
|
|
226
506
|
if (traits.httpHeader || traits.httpResponseCode) return this.stringDeserializer.read(ns, toString(data));
|
|
227
507
|
if (traits.httpPayload) {
|
|
228
508
|
if (ns.isBlobSchema()) {
|
|
229
|
-
const toBytes = this.serdeContext?.utf8Decoder ??
|
|
509
|
+
const toBytes = this.serdeContext?.utf8Decoder ?? require_toUtf8.fromUtf8;
|
|
230
510
|
if (typeof data === "string") return toBytes(data);
|
|
231
511
|
return data;
|
|
232
512
|
} else if (ns.isStringSchema()) {
|
|
@@ -261,7 +541,7 @@ var ToStringShapeSerializer = class extends require_extensions.SerdeContext {
|
|
|
261
541
|
this.stringBuffer = value.toISOString().replace(".000Z", "Z");
|
|
262
542
|
break;
|
|
263
543
|
case 6:
|
|
264
|
-
this.stringBuffer =
|
|
544
|
+
this.stringBuffer = require_stream_collector.dateToUtcString(value);
|
|
265
545
|
break;
|
|
266
546
|
case 7:
|
|
267
547
|
this.stringBuffer = String(value.getTime() / 1e3);
|
|
@@ -273,7 +553,7 @@ var ToStringShapeSerializer = class extends require_extensions.SerdeContext {
|
|
|
273
553
|
return;
|
|
274
554
|
}
|
|
275
555
|
if (ns.isBlobSchema() && "byteLength" in value) {
|
|
276
|
-
this.stringBuffer = (this.serdeContext?.base64Encoder ??
|
|
556
|
+
this.stringBuffer = (this.serdeContext?.base64Encoder ?? require_extensions.toBase64)(value);
|
|
277
557
|
return;
|
|
278
558
|
}
|
|
279
559
|
if (ns.isListSchema() && Array.isArray(value)) {
|
|
@@ -281,7 +561,7 @@ var ToStringShapeSerializer = class extends require_extensions.SerdeContext {
|
|
|
281
561
|
for (const item of value) {
|
|
282
562
|
this.write([ns.getValueSchema(), ns.getMergedTraits()], item);
|
|
283
563
|
const headerItem = this.flush();
|
|
284
|
-
const serialized = ns.getValueSchema().isTimestampSchema() ? headerItem :
|
|
564
|
+
const serialized = ns.getValueSchema().isTimestampSchema() ? headerItem : quoteHeader(headerItem);
|
|
285
565
|
if (buffer !== "") buffer += ", ";
|
|
286
566
|
buffer += serialized;
|
|
287
567
|
}
|
|
@@ -294,15 +574,15 @@ var ToStringShapeSerializer = class extends require_extensions.SerdeContext {
|
|
|
294
574
|
const mediaType = ns.getMergedTraits().mediaType;
|
|
295
575
|
let intermediateValue = value;
|
|
296
576
|
if (mediaType) {
|
|
297
|
-
if (mediaType === "application/json" || mediaType.endsWith("+json")) intermediateValue =
|
|
577
|
+
if (mediaType === "application/json" || mediaType.endsWith("+json")) intermediateValue = require_extensions.LazyJsonString.from(intermediateValue);
|
|
298
578
|
if (ns.getMergedTraits().httpHeader) {
|
|
299
|
-
this.stringBuffer = (this.serdeContext?.base64Encoder ??
|
|
579
|
+
this.stringBuffer = (this.serdeContext?.base64Encoder ?? require_extensions.toBase64)(intermediateValue.toString());
|
|
300
580
|
return;
|
|
301
581
|
}
|
|
302
582
|
}
|
|
303
583
|
this.stringBuffer = value;
|
|
304
584
|
break;
|
|
305
|
-
default: if (ns.isIdempotencyToken()) this.stringBuffer =
|
|
585
|
+
default: if (ns.isIdempotencyToken()) this.stringBuffer = require_extensions.generateIdempotencyToken();
|
|
306
586
|
else this.stringBuffer = String(value);
|
|
307
587
|
}
|
|
308
588
|
}
|
|
@@ -346,9 +626,6 @@ var HttpInterceptingShapeSerializer = class {
|
|
|
346
626
|
}
|
|
347
627
|
};
|
|
348
628
|
//#endregion
|
|
349
|
-
//#region ../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/common.js
|
|
350
|
-
var collectBodyString = (streamBody, context) => require_extensions.collectBody(streamBody, context).then((body) => (context?.utf8Encoder ?? require_date_utils.toUtf8)(body));
|
|
351
|
-
//#endregion
|
|
352
629
|
Object.defineProperty(exports, "HttpBindingProtocol", {
|
|
353
630
|
enumerable: true,
|
|
354
631
|
get: function() {
|
|
@@ -367,9 +644,3 @@ Object.defineProperty(exports, "HttpInterceptingShapeSerializer", {
|
|
|
367
644
|
return HttpInterceptingShapeSerializer;
|
|
368
645
|
}
|
|
369
646
|
});
|
|
370
|
-
Object.defineProperty(exports, "collectBodyString", {
|
|
371
|
-
enumerable: true,
|
|
372
|
-
get: function() {
|
|
373
|
-
return collectBodyString;
|
|
374
|
-
}
|
|
375
|
-
});
|