@m8tes/sdk 0.1.0-alpha.1 → 0.1.0-alpha.3
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/CHANGELOG.md +202 -1
- package/README.md +57 -3
- package/dist/{chunk-UFQQNUFE.js → chunk-CURNMC4F.js} +26 -3
- package/dist/chunk-CURNMC4F.js.map +1 -0
- package/dist/index.cjs +748 -117
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +866 -80
- package/dist/index.d.ts +866 -80
- package/dist/index.js +716 -117
- package/dist/index.js.map +1 -1
- package/dist/protocol/index.cjs +24 -0
- package/dist/protocol/index.cjs.map +1 -1
- package/dist/protocol/index.d.cts +40 -1
- package/dist/protocol/index.d.ts +40 -1
- package/dist/protocol/index.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-UFQQNUFE.js.map +0 -1
package/dist/protocol/index.cjs
CHANGED
|
@@ -1080,6 +1080,29 @@ async function errorFromResponse(res, opts = {}) {
|
|
|
1080
1080
|
return new Cls(message, fields);
|
|
1081
1081
|
}
|
|
1082
1082
|
|
|
1083
|
+
// src/protocol/seg.ts
|
|
1084
|
+
var UNADDRESSABLE = /* @__PURE__ */ new Set(["", ".", ".."]);
|
|
1085
|
+
var SEPARATOR = "/";
|
|
1086
|
+
function reject(value, reason) {
|
|
1087
|
+
throw new ValidationError(
|
|
1088
|
+
`${JSON.stringify(value)} cannot be used as a URL path segment: ${reason}. Percent-encoding does not help \u2014 the server decodes the path before routing it.`,
|
|
1089
|
+
{ type: "invalid_request_error", code: 0, status: 0 }
|
|
1090
|
+
);
|
|
1091
|
+
}
|
|
1092
|
+
function seg(value) {
|
|
1093
|
+
if (value === null || value === void 0) {
|
|
1094
|
+
reject(String(value), "an id of null or undefined is a caller bug, not a resource name");
|
|
1095
|
+
}
|
|
1096
|
+
const text = String(value);
|
|
1097
|
+
if (UNADDRESSABLE.has(text)) {
|
|
1098
|
+
reject(text, "it addresses the parent or the collection, not a resource");
|
|
1099
|
+
}
|
|
1100
|
+
if (text.includes(SEPARATOR)) {
|
|
1101
|
+
reject(text, "a '/' becomes a real path separator once the server decodes it");
|
|
1102
|
+
}
|
|
1103
|
+
return encodeURIComponent(text);
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1083
1106
|
exports.APIError = APIError;
|
|
1084
1107
|
exports.AuthenticationError = AuthenticationError;
|
|
1085
1108
|
exports.BillingError = BillingError;
|
|
@@ -1104,6 +1127,7 @@ exports.isTerminalEvent = isTerminalEvent;
|
|
|
1104
1127
|
exports.parseErrorEnvelope = parseErrorEnvelope;
|
|
1105
1128
|
exports.parseRetryAfter = parseRetryAfter;
|
|
1106
1129
|
exports.parseSse = parseSse;
|
|
1130
|
+
exports.seg = seg;
|
|
1107
1131
|
exports.splitConcatenatedJson = splitConcatenatedJson;
|
|
1108
1132
|
//# sourceMappingURL=index.cjs.map
|
|
1109
1133
|
//# sourceMappingURL=index.cjs.map
|