@01.software/sdk 0.30.1 → 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/README.md +74 -20
- package/dist/client.cjs +81 -16
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +6 -6
- package/dist/client.d.ts +6 -6
- package/dist/client.js +81 -16
- package/dist/client.js.map +1 -1
- package/dist/{collection-client-B9d9kr1d.d.ts → collection-client-ByzY3hWK.d.ts} +3 -3
- package/dist/{collection-client-QPbwimkU.d.cts → collection-client-DFXXz0vk.d.cts} +3 -3
- package/dist/{const-VZuk2tWc.d.cts → const-AytzliEu.d.cts} +4 -4
- package/dist/{const-B75IFDRi.d.ts → const-BGCP-OJL.d.ts} +4 -4
- package/dist/{index-B2WbhEgT.d.cts → index-BGEhoDUs.d.cts} +1 -1
- package/dist/{index-B2WbhEgT.d.ts → index-BGEhoDUs.d.ts} +1 -1
- package/dist/index.cjs +156 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +156 -19
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-DPjO_IbQ.d.cts → payload-types-Wa4-eC6x.d.cts} +790 -534
- package/dist/{payload-types-DPjO_IbQ.d.ts → payload-types-Wa4-eC6x.d.ts} +790 -534
- package/dist/query.cjs +63 -13
- package/dist/query.cjs.map +1 -1
- package/dist/query.d.cts +6 -6
- package/dist/query.d.ts +6 -6
- package/dist/query.js +63 -13
- package/dist/query.js.map +1 -1
- package/dist/realtime.d.cts +2 -2
- package/dist/realtime.d.ts +2 -2
- package/dist/server.cjs +142 -17
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +32 -7
- package/dist/server.d.ts +32 -7
- package/dist/server.js +142 -17
- package/dist/server.js.map +1 -1
- package/dist/{types-Dlb2mwpX.d.cts → types-BX2mqDf6.d.ts} +46 -6
- package/dist/{types-1fBLrYU7.d.ts → types-CVA10VC-.d.ts} +6 -2
- package/dist/{types-BwT0eeaz.d.cts → types-CmLG-7RL.d.cts} +6 -2
- package/dist/{types-DuSKPiY5.d.ts → types-DChFjQGz.d.cts} +46 -6
- package/dist/ui/form.d.cts +1 -1
- package/dist/ui/form.d.ts +1 -1
- package/dist/ui/video.d.cts +1 -1
- package/dist/ui/video.d.ts +1 -1
- package/dist/webhook.d.cts +3 -3
- package/dist/webhook.d.ts +3 -3
- package/package.json +1 -1
package/dist/query.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
2
|
import { QueryClient, InfiniteData, UseQueryResult } from '@tanstack/react-query';
|
|
3
|
-
import { A as ApiQueryOptions, P as PayloadFindResponse, g as PayloadMutationResponse, I as CustomerAuth, M as CustomerProfile, K as CustomerAuthResponse, L as CustomerLoginData, Q as CustomerRegisterResponse, O as CustomerRegisterData, N as CustomerRefreshResponse,
|
|
4
|
-
import './payload-types-
|
|
5
|
-
import { C as CollectionClient } from './collection-client-
|
|
6
|
-
import { c as ServerCollection, P as PublicCollection } from './const-
|
|
7
|
-
import { C as CollectionType } from './types-
|
|
8
|
-
import { S as SDKError } from './index-
|
|
3
|
+
import { A as ApiQueryOptions, P as PayloadFindResponse, g as PayloadMutationResponse, I as CustomerAuth, M as CustomerProfile, K as CustomerAuthResponse, L as CustomerLoginData, Q as CustomerRegisterResponse, O as CustomerRegisterData, N as CustomerRefreshResponse, aW as UpdateProfileData, ab as ProductDetailParams, a2 as ProductDetail, an as ProductListingGroupsItem, h as RootClient } from './types-DChFjQGz.cjs';
|
|
4
|
+
import './payload-types-Wa4-eC6x.cjs';
|
|
5
|
+
import { C as CollectionClient } from './collection-client-DFXXz0vk.cjs';
|
|
6
|
+
import { c as ServerCollection, P as PublicCollection } from './const-AytzliEu.cjs';
|
|
7
|
+
import { C as CollectionType } from './types-CmLG-7RL.cjs';
|
|
8
|
+
import { S as SDKError } from './index-BGEhoDUs.cjs';
|
|
9
9
|
export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-D7HtUpqt.cjs';
|
|
10
10
|
import { ServerClient } from './server.cjs';
|
|
11
11
|
import './metadata.cjs';
|
package/dist/query.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
2
|
import { QueryClient, InfiniteData, UseQueryResult } from '@tanstack/react-query';
|
|
3
|
-
import { A as ApiQueryOptions, P as PayloadFindResponse, g as PayloadMutationResponse, I as CustomerAuth, M as CustomerProfile, K as CustomerAuthResponse, L as CustomerLoginData, Q as CustomerRegisterResponse, O as CustomerRegisterData, N as CustomerRefreshResponse,
|
|
4
|
-
import './payload-types-
|
|
5
|
-
import { C as CollectionClient } from './collection-client-
|
|
6
|
-
import { c as ServerCollection, P as PublicCollection } from './const-
|
|
7
|
-
import { C as CollectionType } from './types-
|
|
8
|
-
import { S as SDKError } from './index-
|
|
3
|
+
import { A as ApiQueryOptions, P as PayloadFindResponse, g as PayloadMutationResponse, I as CustomerAuth, M as CustomerProfile, K as CustomerAuthResponse, L as CustomerLoginData, Q as CustomerRegisterResponse, O as CustomerRegisterData, N as CustomerRefreshResponse, aW as UpdateProfileData, ab as ProductDetailParams, a2 as ProductDetail, an as ProductListingGroupsItem, h as RootClient } from './types-BX2mqDf6.js';
|
|
4
|
+
import './payload-types-Wa4-eC6x.js';
|
|
5
|
+
import { C as CollectionClient } from './collection-client-ByzY3hWK.js';
|
|
6
|
+
import { c as ServerCollection, P as PublicCollection } from './const-BGCP-OJL.js';
|
|
7
|
+
import { C as CollectionType } from './types-CVA10VC-.js';
|
|
8
|
+
import { S as SDKError } from './index-BGEhoDUs.js';
|
|
9
9
|
export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-D7HtUpqt.js';
|
|
10
10
|
import { ServerClient } from './server.js';
|
|
11
11
|
import './metadata.js';
|
package/dist/query.js
CHANGED
|
@@ -363,8 +363,16 @@ var ValidationError = class extends SDKError {
|
|
|
363
363
|
}
|
|
364
364
|
};
|
|
365
365
|
var ApiError = class extends SDKError {
|
|
366
|
-
constructor(message, status, details, userMessage, suggestion) {
|
|
367
|
-
super(
|
|
366
|
+
constructor(message, status, details, userMessage, suggestion, requestId) {
|
|
367
|
+
super(
|
|
368
|
+
"API_ERROR",
|
|
369
|
+
message,
|
|
370
|
+
status,
|
|
371
|
+
details,
|
|
372
|
+
userMessage,
|
|
373
|
+
suggestion,
|
|
374
|
+
requestId
|
|
375
|
+
);
|
|
368
376
|
this.name = "ApiError";
|
|
369
377
|
}
|
|
370
378
|
};
|
|
@@ -395,19 +403,43 @@ var UsageLimitError = class extends SDKError {
|
|
|
395
403
|
};
|
|
396
404
|
var AuthError = class extends SDKError {
|
|
397
405
|
constructor(message, details, userMessage, suggestion, requestId) {
|
|
398
|
-
super(
|
|
406
|
+
super(
|
|
407
|
+
"auth_error",
|
|
408
|
+
message,
|
|
409
|
+
401,
|
|
410
|
+
details,
|
|
411
|
+
userMessage,
|
|
412
|
+
suggestion,
|
|
413
|
+
requestId
|
|
414
|
+
);
|
|
399
415
|
this.name = "AuthError";
|
|
400
416
|
}
|
|
401
417
|
};
|
|
402
418
|
var PermissionError = class extends SDKError {
|
|
403
419
|
constructor(message, details, userMessage, suggestion, requestId) {
|
|
404
|
-
super(
|
|
420
|
+
super(
|
|
421
|
+
"permission_error",
|
|
422
|
+
message,
|
|
423
|
+
403,
|
|
424
|
+
details,
|
|
425
|
+
userMessage,
|
|
426
|
+
suggestion,
|
|
427
|
+
requestId
|
|
428
|
+
);
|
|
405
429
|
this.name = "PermissionError";
|
|
406
430
|
}
|
|
407
431
|
};
|
|
408
432
|
var NotFoundError = class extends SDKError {
|
|
409
433
|
constructor(message, details, userMessage, suggestion, requestId) {
|
|
410
|
-
super(
|
|
434
|
+
super(
|
|
435
|
+
"not_found",
|
|
436
|
+
message,
|
|
437
|
+
404,
|
|
438
|
+
details,
|
|
439
|
+
userMessage,
|
|
440
|
+
suggestion,
|
|
441
|
+
requestId
|
|
442
|
+
);
|
|
411
443
|
this.name = "NotFoundError";
|
|
412
444
|
}
|
|
413
445
|
};
|
|
@@ -419,7 +451,7 @@ var ConflictError = class extends SDKError {
|
|
|
419
451
|
};
|
|
420
452
|
var createNetworkError = (message, status, details, userMessage, suggestion) => new NetworkError(message, status, details, userMessage, suggestion);
|
|
421
453
|
var createValidationError = (message, details, userMessage, suggestion, status) => new ValidationError(message, details, userMessage, suggestion, status);
|
|
422
|
-
var createApiError = (message, status, details, userMessage, suggestion) => new ApiError(message, status, details, userMessage, suggestion);
|
|
454
|
+
var createApiError = (message, status, details, userMessage, suggestion, requestId) => new ApiError(message, status, details, userMessage, suggestion, requestId);
|
|
423
455
|
var createConfigError = (message, details, userMessage, suggestion) => new ConfigError(message, details, userMessage, suggestion);
|
|
424
456
|
var createTimeoutError = (message, details, userMessage, suggestion) => new TimeoutError(message, details, userMessage, suggestion);
|
|
425
457
|
var createUsageLimitError = (message, usage, details, userMessage, suggestion) => new UsageLimitError(message, usage, details, userMessage, suggestion);
|
|
@@ -1060,6 +1092,22 @@ function debugLog(debug, type, message, data) {
|
|
|
1060
1092
|
console.groupEnd();
|
|
1061
1093
|
}
|
|
1062
1094
|
}
|
|
1095
|
+
function redactSensitiveHeader(value) {
|
|
1096
|
+
const prefix = value.toLowerCase().startsWith("bearer ") ? "Bearer " : "";
|
|
1097
|
+
return value.length > 20 ? `${prefix}...****${value.slice(-8)}` : "****";
|
|
1098
|
+
}
|
|
1099
|
+
function redactSensitiveHeaders(headers) {
|
|
1100
|
+
const redacted = Object.fromEntries(headers.entries());
|
|
1101
|
+
if (redacted.authorization) {
|
|
1102
|
+
redacted.authorization = redactSensitiveHeader(redacted.authorization);
|
|
1103
|
+
}
|
|
1104
|
+
if (redacted["x-preview-token"]) {
|
|
1105
|
+
redacted["x-preview-token"] = redactSensitiveHeader(
|
|
1106
|
+
redacted["x-preview-token"]
|
|
1107
|
+
);
|
|
1108
|
+
}
|
|
1109
|
+
return redacted;
|
|
1110
|
+
}
|
|
1063
1111
|
function getErrorSuggestion(status) {
|
|
1064
1112
|
if (status === 400)
|
|
1065
1113
|
return "The request data failed validation. Check field values and types.";
|
|
@@ -1134,6 +1182,12 @@ async function parseErrorBody(response) {
|
|
|
1134
1182
|
return fallback;
|
|
1135
1183
|
}
|
|
1136
1184
|
}
|
|
1185
|
+
function getParsedErrorSuggestion(status, parsed) {
|
|
1186
|
+
if (status === 403 && parsed.reason === "origin_not_allowed") {
|
|
1187
|
+
return "Add the request origin to the tenant Browser API origins, then retry the browser request.";
|
|
1188
|
+
}
|
|
1189
|
+
return getErrorSuggestion(status);
|
|
1190
|
+
}
|
|
1137
1191
|
async function delay(ms) {
|
|
1138
1192
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
1139
1193
|
}
|
|
@@ -1147,7 +1201,7 @@ function createHttpStatusError(status, parsed, details, requestId) {
|
|
|
1147
1201
|
...parsed.errors && { errors: parsed.errors },
|
|
1148
1202
|
...parsed.body && { body: parsed.body }
|
|
1149
1203
|
};
|
|
1150
|
-
const suggestion =
|
|
1204
|
+
const suggestion = getParsedErrorSuggestion(status, parsed);
|
|
1151
1205
|
if (status === 400 || status === 422) {
|
|
1152
1206
|
return attachRequestId(
|
|
1153
1207
|
createValidationError(
|
|
@@ -1253,11 +1307,7 @@ async function httpFetch(url, options) {
|
|
|
1253
1307
|
if (!headers.has("Content-Type") && requestInit.body && !(requestInit.body instanceof FormData)) {
|
|
1254
1308
|
headers.set("Content-Type", "application/json");
|
|
1255
1309
|
}
|
|
1256
|
-
const redactedHeaders =
|
|
1257
|
-
if (redactedHeaders["authorization"]) {
|
|
1258
|
-
const token = redactedHeaders["authorization"];
|
|
1259
|
-
redactedHeaders["authorization"] = token.length > 20 ? `Bearer ...****${token.slice(-8)}` : "****";
|
|
1260
|
-
}
|
|
1310
|
+
const redactedHeaders = redactSensitiveHeaders(headers);
|
|
1261
1311
|
debugLog(debug, "request", url, {
|
|
1262
1312
|
method: requestInit.method || "GET",
|
|
1263
1313
|
headers: redactedHeaders,
|
|
@@ -1275,7 +1325,7 @@ async function httpFetch(url, options) {
|
|
|
1275
1325
|
debugLog(debug, "response", url, {
|
|
1276
1326
|
status: response.status,
|
|
1277
1327
|
statusText: response.statusText,
|
|
1278
|
-
headers:
|
|
1328
|
+
headers: redactSensitiveHeaders(response.headers)
|
|
1279
1329
|
});
|
|
1280
1330
|
if (!response.ok) {
|
|
1281
1331
|
if (isUsageLimitExceededResponse(response)) {
|