@use-tusk/drift-node-sdk 0.1.16 → 0.1.17
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 +7 -0
- package/dist/index.cjs +15 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7853,7 +7853,10 @@ function getDecodedType(contentType) {
|
|
|
7853
7853
|
logger.debug(`Invalid Content-Type header: ${contentType}`);
|
|
7854
7854
|
return;
|
|
7855
7855
|
}
|
|
7856
|
-
|
|
7856
|
+
const mainType = contentTypeString.toLowerCase().split(";")[0].trim();
|
|
7857
|
+
const decodedType = CONTENT_TYPE_MAPPING[mainType];
|
|
7858
|
+
if (decodedType !== void 0) return decodedType;
|
|
7859
|
+
if (mainType.includes("json")) return DecodedType.JSON;
|
|
7857
7860
|
}
|
|
7858
7861
|
const ACCEPTABLE_CONTENT_TYPES = new Set([DecodedType.JSON, DecodedType.PLAIN_TEXT]);
|
|
7859
7862
|
|
|
@@ -8198,10 +8201,17 @@ var JsonSchemaHelper = class JsonSchemaHelper {
|
|
|
8198
8201
|
static decodeDataWithMerges(data, schemaMerges) {
|
|
8199
8202
|
if (!schemaMerges) return data;
|
|
8200
8203
|
const decodedData = { ...data };
|
|
8201
|
-
for (const [key, schema] of Object.entries(schemaMerges)) if (schema.encoding &&
|
|
8204
|
+
for (const [key, schema] of Object.entries(schemaMerges)) if (schema.encoding && data[key] !== void 0) try {
|
|
8202
8205
|
let decodedValue = data[key];
|
|
8203
|
-
if (
|
|
8204
|
-
|
|
8206
|
+
if (typeof decodedValue === "string") {
|
|
8207
|
+
if (schema.encoding === EncodingType.BASE64) decodedValue = Buffer.from(decodedValue, "base64").toString("utf8");
|
|
8208
|
+
if (schema.decodedType === DecodedType.JSON) decodedValue = JSON.parse(decodedValue);
|
|
8209
|
+
else if (!schema.decodedType) try {
|
|
8210
|
+
decodedValue = JSON.parse(decodedValue);
|
|
8211
|
+
} catch {
|
|
8212
|
+
logger.debug(`[JsonSchemaHelper] Failed to parse JSON for key: ${key}, no decodedType specified`);
|
|
8213
|
+
}
|
|
8214
|
+
}
|
|
8205
8215
|
decodedData[key] = decodedValue;
|
|
8206
8216
|
} catch (error) {
|
|
8207
8217
|
logger.debug(`[JsonSchemaHelper] Failed to decode ${key}:`, error);
|
|
@@ -32046,7 +32056,7 @@ var require_src = /* @__PURE__ */ __commonJS({ "node_modules/@opentelemetry/sdk-
|
|
|
32046
32056
|
//#endregion
|
|
32047
32057
|
//#region package.json
|
|
32048
32058
|
var import_src$1 = /* @__PURE__ */ __toESM(require_src(), 1);
|
|
32049
|
-
var version = "0.1.
|
|
32059
|
+
var version = "0.1.17";
|
|
32050
32060
|
|
|
32051
32061
|
//#endregion
|
|
32052
32062
|
//#region src/version.ts
|