arky-sdk 0.9.18 → 0.9.20

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/admin.d.cts CHANGED
@@ -1,3 +1,3 @@
1
- export { a3 as AdminSession, a0 as ApiConfig, A as AuthStateListener, a6 as CreateAdminConfig, a7 as createAdmin } from './admin-CBgRGUCX.cjs';
2
- export { am as AuthStorage, al as HttpClientConfig } from './api-CuqZQQGv.cjs';
3
- import './inventory-DrVRUkE2.cjs';
1
+ export { a3 as AdminSession, a0 as ApiConfig, A as AuthStateListener, a6 as CreateAdminConfig, a7 as createAdmin } from './admin-DB_GYW2b.cjs';
2
+ export { am as AuthStorage, al as HttpClientConfig } from './api-C_2AMzmc.cjs';
3
+ import './inventory-DgPpeRWU.cjs';
package/dist/admin.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { a3 as AdminSession, a0 as ApiConfig, A as AuthStateListener, a6 as CreateAdminConfig, a7 as createAdmin } from './admin-yoFJKZB8.js';
2
- export { am as AuthStorage, al as HttpClientConfig } from './api-CuqZQQGv.js';
3
- import './inventory-DNX8Vg-N.js';
1
+ export { a3 as AdminSession, a0 as ApiConfig, A as AuthStateListener, a6 as CreateAdminConfig, a7 as createAdmin } from './admin-CTtJoarO.js';
2
+ export { am as AuthStorage, al as HttpClientConfig } from './api-C_2AMzmc.js';
3
+ import './inventory-DdgZ5MI_.js';
package/dist/admin.js CHANGED
@@ -1,18 +1,3 @@
1
- // src/utils/errors.ts
2
- var convertServerErrorToRequestError = (serverError, renameRules) => {
3
- const validationErrors = serverError?.validationErrors ?? [];
4
- return {
5
- ...serverError,
6
- validationErrors: validationErrors.map((validationError) => {
7
- const field = validationError.field;
8
- return {
9
- field,
10
- error: validationError.error || "GENERAL.VALIDATION_ERROR"
11
- };
12
- })
13
- };
14
- };
15
-
16
1
  // src/utils/queryParams.ts
17
2
  function buildQueryString(params) {
18
3
  const queryParts = Object.entries(params).flatMap(
@@ -56,6 +41,12 @@ function toServerError(value, statusCode) {
56
41
  validationErrors
57
42
  };
58
43
  }
44
+ function normalizeValidationErrors(validationErrors) {
45
+ return validationErrors.map((validationError) => ({
46
+ field: validationError.field,
47
+ error: validationError.error || "GENERAL.VALIDATION_ERROR"
48
+ }));
49
+ }
59
50
  function createHttpClient(cfg) {
60
51
  const { authStorage } = cfg;
61
52
  let refreshPromise = null;
@@ -186,11 +177,10 @@ function createHttpClient(cfg) {
186
177
  }
187
178
  if (!res.ok) {
188
179
  const serverErr = toServerError(data, res.status);
189
- const reqErr = convertServerErrorToRequestError(serverErr);
190
180
  const requestId = res.headers.get("x-request-id") || res.headers.get("request-id");
191
181
  const err = requestError("ApiError", serverErr.message, {
192
182
  statusCode: serverErr.statusCode,
193
- validationErrors: reqErr.validationErrors,
183
+ validationErrors: normalizeValidationErrors(serverErr.validationErrors),
194
184
  method,
195
185
  url: fullUrl,
196
186
  requestId: requestId || void 0
@@ -1291,11 +1281,7 @@ var createActionAdminApi = (apiConfig) => ({
1291
1281
  async find(params, options) {
1292
1282
  const store_id = params.store_id || apiConfig.storeId;
1293
1283
  const queryParams = {};
1294
- if (params.query) queryParams.query = params.query;
1295
1284
  if (params.contact_id) queryParams.contact_id = params.contact_id;
1296
- if (params.types && params.types.length > 0) queryParams.types = params.types;
1297
- if (params.from !== void 0) queryParams.from = params.from;
1298
- if (params.to !== void 0) queryParams.to = params.to;
1299
1285
  if (params.limit !== void 0) queryParams.limit = params.limit;
1300
1286
  if (params.cursor) queryParams.cursor = params.cursor;
1301
1287
  return apiConfig.httpClient.get(
@@ -1341,16 +1327,6 @@ var createContactApi = (apiConfig) => {
1341
1327
  }
1342
1328
  );
1343
1329
  },
1344
- async findActions(params, options) {
1345
- const { store_id, ...queryParams } = params || {};
1346
- return apiConfig.httpClient.get(
1347
- `/v1/stores/${store_id || apiConfig.storeId}/actions`,
1348
- {
1349
- ...options,
1350
- params: Object.keys(queryParams).length > 0 ? queryParams : void 0
1351
- }
1352
- );
1353
- },
1354
1330
  async update(params, options) {
1355
1331
  const { id, store_id, ...body } = params;
1356
1332
  return apiConfig.httpClient.put(
@@ -2975,11 +2951,8 @@ function getBlockLabel(block) {
2975
2951
  function formatBlockValue(block) {
2976
2952
  if (block?.value === null || block?.value === void 0) return "";
2977
2953
  if (block.type === "boolean") return block.value ? "Yes" : "No";
2978
- if (block.type === "number") {
2979
- const properties = isRecord2(block.properties) ? block.properties : {};
2980
- if (properties.variant === "DATE" || properties.variant === "DATE_TIME") {
2981
- return new Date(Number(block.value)).toLocaleDateString();
2982
- }
2954
+ if (block.type === "date") {
2955
+ return new Date(Number(block.value) * 1e3).toLocaleDateString();
2983
2956
  }
2984
2957
  if (block.type === "media" && isRecord2(block.value)) {
2985
2958
  const label = block.value.name ?? block.value.title ?? block.value.id;