@01.software/sdk 0.4.1 → 0.4.2

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/index.d.cts CHANGED
@@ -1,13 +1,13 @@
1
- import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, E as Exchange, c as Cart, d as CartItem, P as Product } from './payload-types-BsjHfeAF.cjs';
2
- export { o as ApiUsage, as as ApiUsageSelect, A as Audience, ao as AudiencesSelect, bo as Auth, q as BillingHistory, au as BillingHistorySelect, y as Brand, B as BrandLogo, aD as BrandLogosSelect, aC as BrandsSelect, aT as CartItemsSelect, aS as CartsSelect, g as CodeBlock, bn as CollectionsWidget, C as Config, G as Customer, J as CustomerAddress, aQ as CustomerAddressesSelect, e as CustomerAuthOperations, H as CustomerGroup, aR as CustomerGroupsSelect, aP as CustomersSelect, W as Discount, aU as DiscountsSelect, $ as Document, a_ as DocumentCategoriesSelect, a1 as DocumentCategory, a0 as DocumentType, a$ as DocumentTypesSelect, aZ as DocumentsSelect, m as EmailLog, ap as EmailLogsSelect, N as ExchangeProduct, aN as ExchangeProductsSelect, aM as ExchangesSelect, j as FieldConfig, al as FieldConfigsSelect, aa as Flow, bb as FlowCategoriesSelect, ab as FlowCategory, ae as FlowEdgeType, ba as FlowEdgeTypesSelect, ad as FlowNodeType, b9 as FlowNodeTypesSelect, ac as FlowTag, bc as FlowTagsSelect, b8 as FlowsSelect, F as Form, af as FormSubmission, bi as FormSubmissionsSelect, bh as FormsSelect, K as FulfillmentItem, aJ as FulfillmentItemsSelect, aI as FulfillmentsSelect, b4 as GalleriesSelect, a6 as Gallery, b5 as GalleryCategoriesSelect, a7 as GalleryCategory, a9 as GalleryItem, b7 as GalleryItemsSelect, a8 as GalleryTag, b6 as GalleryTagsSelect, I as IframeBlock, k as Image, am as ImagesSelect, L as LiveStream, bg as LiveStreamsSelect, a5 as Music, b3 as MusicsSelect, aF as OrderProductsSelect, Q as OrderStatusLog, aH as OrderStatusLogsSelect, aE as OrdersSelect, ag as PayloadKv, bj as PayloadKvSelect, ah as PayloadLockedDocument, bk as PayloadLockedDocumentsSelect, aj as PayloadMigration, bm as PayloadMigrationsSelect, ai as PayloadPreference, bl as PayloadPreferencesSelect, f as PlayerBlock, a2 as Playlist, b1 as PlaylistCategoriesSelect, a3 as PlaylistCategory, a4 as PlaylistTag, b2 as PlaylistTagsSelect, b0 as PlaylistsSelect, X as Post, Y as PostAuthor, aW as PostAuthorsSelect, aX as PostCategoriesSelect, Z as PostCategory, _ as PostTag, aY as PostTagsSelect, aV as PostsSelect, az as ProductCategoriesSelect, w as ProductCategory, D as ProductCollection, aB as ProductCollectionsSelect, v as ProductOption, ay as ProductOptionsSelect, x as ProductTag, aA as ProductTagsSelect, u as ProductVariant, ax as ProductVariantsSelect, aw as ProductsSelect, M as ReturnProduct, aL as ReturnProductsSelect, aK as ReturnsSelect, aO as ShippingPoliciesSelect, z as ShippingPolicy, p as Subscription, at as SubscriptionsSelect, S as SupportedTimezones, l as SystemMedia, an as SystemMediaSelect, i as Tenant, r as TenantLogo, av as TenantLogosSelect, ar as TenantMetadataSelect, n as TenantMetadatum, aq as TenantsSelect, aG as TransactionsSelect, h as User, U as UserAuthOperations, ak as UsersSelect, V as Video, be as VideoCategoriesSelect, s as VideoCategory, t as VideoTag, bf as VideoTagsSelect, bd as VideosSelect } from './payload-types-BsjHfeAF.cjs';
1
+ import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, E as Exchange, c as Cart, d as CartItem, P as Product } from './payload-types-BbEEk9Ji.cjs';
2
+ export { o as ApiUsage, as as ApiUsageSelect, A as Audience, ao as AudiencesSelect, bo as Auth, q as BillingHistory, au as BillingHistorySelect, y as Brand, B as BrandLogo, aD as BrandLogosSelect, aC as BrandsSelect, aT as CartItemsSelect, aS as CartsSelect, g as CodeBlock, bn as CollectionsWidget, C as Config, G as Customer, J as CustomerAddress, aQ as CustomerAddressesSelect, e as CustomerAuthOperations, H as CustomerGroup, aR as CustomerGroupsSelect, aP as CustomersSelect, W as Discount, aU as DiscountsSelect, $ as Document, a_ as DocumentCategoriesSelect, a1 as DocumentCategory, a0 as DocumentType, a$ as DocumentTypesSelect, aZ as DocumentsSelect, m as EmailLog, ap as EmailLogsSelect, N as ExchangeProduct, aN as ExchangeProductsSelect, aM as ExchangesSelect, j as FieldConfig, al as FieldConfigsSelect, aa as Flow, bb as FlowCategoriesSelect, ab as FlowCategory, ae as FlowEdgeType, ba as FlowEdgeTypesSelect, ad as FlowNodeType, b9 as FlowNodeTypesSelect, ac as FlowTag, bc as FlowTagsSelect, b8 as FlowsSelect, F as Form, af as FormSubmission, bi as FormSubmissionsSelect, bh as FormsSelect, K as FulfillmentItem, aJ as FulfillmentItemsSelect, aI as FulfillmentsSelect, b4 as GalleriesSelect, a6 as Gallery, b5 as GalleryCategoriesSelect, a7 as GalleryCategory, a9 as GalleryItem, b7 as GalleryItemsSelect, a8 as GalleryTag, b6 as GalleryTagsSelect, I as IframeBlock, k as Image, am as ImagesSelect, L as LiveStream, bg as LiveStreamsSelect, a5 as Music, b3 as MusicsSelect, aF as OrderProductsSelect, Q as OrderStatusLog, aH as OrderStatusLogsSelect, aE as OrdersSelect, ag as PayloadKv, bj as PayloadKvSelect, ah as PayloadLockedDocument, bk as PayloadLockedDocumentsSelect, aj as PayloadMigration, bm as PayloadMigrationsSelect, ai as PayloadPreference, bl as PayloadPreferencesSelect, f as PlayerBlock, a2 as Playlist, b1 as PlaylistCategoriesSelect, a3 as PlaylistCategory, a4 as PlaylistTag, b2 as PlaylistTagsSelect, b0 as PlaylistsSelect, X as Post, Y as PostAuthor, aW as PostAuthorsSelect, aX as PostCategoriesSelect, Z as PostCategory, _ as PostTag, aY as PostTagsSelect, aV as PostsSelect, az as ProductCategoriesSelect, w as ProductCategory, D as ProductCollection, aB as ProductCollectionsSelect, v as ProductOption, ay as ProductOptionsSelect, x as ProductTag, aA as ProductTagsSelect, u as ProductVariant, ax as ProductVariantsSelect, aw as ProductsSelect, M as ReturnProduct, aL as ReturnProductsSelect, aK as ReturnsSelect, aO as ShippingPoliciesSelect, z as ShippingPolicy, p as Subscription, at as SubscriptionsSelect, S as SupportedTimezones, l as SystemMedia, an as SystemMediaSelect, i as Tenant, r as TenantLogo, av as TenantLogosSelect, ar as TenantMetadataSelect, n as TenantMetadatum, aq as TenantsSelect, aG as TransactionsSelect, h as User, U as UserAuthOperations, ak as UsersSelect, V as Video, be as VideoCategoriesSelect, s as VideoCategory, t as VideoTag, bf as VideoTagsSelect, bd as VideosSelect } from './payload-types-BbEEk9Ji.cjs';
3
3
  import { Sort, Where } from 'payload';
4
4
  import * as _tanstack_react_query from '@tanstack/react-query';
5
5
  import { QueryClient } from '@tanstack/react-query';
6
- import { P as PublicCollection } from './const-BsO3aVX_.cjs';
7
- export { a as COLLECTIONS, C as Collection } from './const-BsO3aVX_.cjs';
6
+ import { P as PublicCollection } from './const-CWZ70tFe.cjs';
7
+ export { a as COLLECTIONS, C as Collection } from './const-CWZ70tFe.cjs';
8
8
  import { Metadata } from 'next';
9
- import { C as CollectionType } from './webhook-CkL56e65.cjs';
10
- export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, d as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-CkL56e65.cjs';
9
+ import { C as CollectionType } from './webhook-DRGm9rPn.cjs';
10
+ export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, d as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-DRGm9rPn.cjs';
11
11
  export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-DupPIYx-.cjs';
12
12
  export { b as IMAGE_SIZES, I as ImageData, a as ImagePalette, f as ImagePlaceholderOptions, d as getImageLqip, e as getImagePalette, h as getImagePlaceholderStyle, c as getImageSrcSet, g as getImageUrl } from './image-TT8lTsk5.cjs';
13
13
  export { e as VideoGifOptions, V as VideoThumbnailOptions, a as getVideoGif, c as getVideoMp4Url, d as getVideoStoryboard, b as getVideoStreamUrl, g as getVideoThumbnail } from './video-DbLL8yuc.cjs';
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, E as Exchange, c as Cart, d as CartItem, P as Product } from './payload-types-BsjHfeAF.js';
2
- export { o as ApiUsage, as as ApiUsageSelect, A as Audience, ao as AudiencesSelect, bo as Auth, q as BillingHistory, au as BillingHistorySelect, y as Brand, B as BrandLogo, aD as BrandLogosSelect, aC as BrandsSelect, aT as CartItemsSelect, aS as CartsSelect, g as CodeBlock, bn as CollectionsWidget, C as Config, G as Customer, J as CustomerAddress, aQ as CustomerAddressesSelect, e as CustomerAuthOperations, H as CustomerGroup, aR as CustomerGroupsSelect, aP as CustomersSelect, W as Discount, aU as DiscountsSelect, $ as Document, a_ as DocumentCategoriesSelect, a1 as DocumentCategory, a0 as DocumentType, a$ as DocumentTypesSelect, aZ as DocumentsSelect, m as EmailLog, ap as EmailLogsSelect, N as ExchangeProduct, aN as ExchangeProductsSelect, aM as ExchangesSelect, j as FieldConfig, al as FieldConfigsSelect, aa as Flow, bb as FlowCategoriesSelect, ab as FlowCategory, ae as FlowEdgeType, ba as FlowEdgeTypesSelect, ad as FlowNodeType, b9 as FlowNodeTypesSelect, ac as FlowTag, bc as FlowTagsSelect, b8 as FlowsSelect, F as Form, af as FormSubmission, bi as FormSubmissionsSelect, bh as FormsSelect, K as FulfillmentItem, aJ as FulfillmentItemsSelect, aI as FulfillmentsSelect, b4 as GalleriesSelect, a6 as Gallery, b5 as GalleryCategoriesSelect, a7 as GalleryCategory, a9 as GalleryItem, b7 as GalleryItemsSelect, a8 as GalleryTag, b6 as GalleryTagsSelect, I as IframeBlock, k as Image, am as ImagesSelect, L as LiveStream, bg as LiveStreamsSelect, a5 as Music, b3 as MusicsSelect, aF as OrderProductsSelect, Q as OrderStatusLog, aH as OrderStatusLogsSelect, aE as OrdersSelect, ag as PayloadKv, bj as PayloadKvSelect, ah as PayloadLockedDocument, bk as PayloadLockedDocumentsSelect, aj as PayloadMigration, bm as PayloadMigrationsSelect, ai as PayloadPreference, bl as PayloadPreferencesSelect, f as PlayerBlock, a2 as Playlist, b1 as PlaylistCategoriesSelect, a3 as PlaylistCategory, a4 as PlaylistTag, b2 as PlaylistTagsSelect, b0 as PlaylistsSelect, X as Post, Y as PostAuthor, aW as PostAuthorsSelect, aX as PostCategoriesSelect, Z as PostCategory, _ as PostTag, aY as PostTagsSelect, aV as PostsSelect, az as ProductCategoriesSelect, w as ProductCategory, D as ProductCollection, aB as ProductCollectionsSelect, v as ProductOption, ay as ProductOptionsSelect, x as ProductTag, aA as ProductTagsSelect, u as ProductVariant, ax as ProductVariantsSelect, aw as ProductsSelect, M as ReturnProduct, aL as ReturnProductsSelect, aK as ReturnsSelect, aO as ShippingPoliciesSelect, z as ShippingPolicy, p as Subscription, at as SubscriptionsSelect, S as SupportedTimezones, l as SystemMedia, an as SystemMediaSelect, i as Tenant, r as TenantLogo, av as TenantLogosSelect, ar as TenantMetadataSelect, n as TenantMetadatum, aq as TenantsSelect, aG as TransactionsSelect, h as User, U as UserAuthOperations, ak as UsersSelect, V as Video, be as VideoCategoriesSelect, s as VideoCategory, t as VideoTag, bf as VideoTagsSelect, bd as VideosSelect } from './payload-types-BsjHfeAF.js';
1
+ import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, E as Exchange, c as Cart, d as CartItem, P as Product } from './payload-types-BbEEk9Ji.js';
2
+ export { o as ApiUsage, as as ApiUsageSelect, A as Audience, ao as AudiencesSelect, bo as Auth, q as BillingHistory, au as BillingHistorySelect, y as Brand, B as BrandLogo, aD as BrandLogosSelect, aC as BrandsSelect, aT as CartItemsSelect, aS as CartsSelect, g as CodeBlock, bn as CollectionsWidget, C as Config, G as Customer, J as CustomerAddress, aQ as CustomerAddressesSelect, e as CustomerAuthOperations, H as CustomerGroup, aR as CustomerGroupsSelect, aP as CustomersSelect, W as Discount, aU as DiscountsSelect, $ as Document, a_ as DocumentCategoriesSelect, a1 as DocumentCategory, a0 as DocumentType, a$ as DocumentTypesSelect, aZ as DocumentsSelect, m as EmailLog, ap as EmailLogsSelect, N as ExchangeProduct, aN as ExchangeProductsSelect, aM as ExchangesSelect, j as FieldConfig, al as FieldConfigsSelect, aa as Flow, bb as FlowCategoriesSelect, ab as FlowCategory, ae as FlowEdgeType, ba as FlowEdgeTypesSelect, ad as FlowNodeType, b9 as FlowNodeTypesSelect, ac as FlowTag, bc as FlowTagsSelect, b8 as FlowsSelect, F as Form, af as FormSubmission, bi as FormSubmissionsSelect, bh as FormsSelect, K as FulfillmentItem, aJ as FulfillmentItemsSelect, aI as FulfillmentsSelect, b4 as GalleriesSelect, a6 as Gallery, b5 as GalleryCategoriesSelect, a7 as GalleryCategory, a9 as GalleryItem, b7 as GalleryItemsSelect, a8 as GalleryTag, b6 as GalleryTagsSelect, I as IframeBlock, k as Image, am as ImagesSelect, L as LiveStream, bg as LiveStreamsSelect, a5 as Music, b3 as MusicsSelect, aF as OrderProductsSelect, Q as OrderStatusLog, aH as OrderStatusLogsSelect, aE as OrdersSelect, ag as PayloadKv, bj as PayloadKvSelect, ah as PayloadLockedDocument, bk as PayloadLockedDocumentsSelect, aj as PayloadMigration, bm as PayloadMigrationsSelect, ai as PayloadPreference, bl as PayloadPreferencesSelect, f as PlayerBlock, a2 as Playlist, b1 as PlaylistCategoriesSelect, a3 as PlaylistCategory, a4 as PlaylistTag, b2 as PlaylistTagsSelect, b0 as PlaylistsSelect, X as Post, Y as PostAuthor, aW as PostAuthorsSelect, aX as PostCategoriesSelect, Z as PostCategory, _ as PostTag, aY as PostTagsSelect, aV as PostsSelect, az as ProductCategoriesSelect, w as ProductCategory, D as ProductCollection, aB as ProductCollectionsSelect, v as ProductOption, ay as ProductOptionsSelect, x as ProductTag, aA as ProductTagsSelect, u as ProductVariant, ax as ProductVariantsSelect, aw as ProductsSelect, M as ReturnProduct, aL as ReturnProductsSelect, aK as ReturnsSelect, aO as ShippingPoliciesSelect, z as ShippingPolicy, p as Subscription, at as SubscriptionsSelect, S as SupportedTimezones, l as SystemMedia, an as SystemMediaSelect, i as Tenant, r as TenantLogo, av as TenantLogosSelect, ar as TenantMetadataSelect, n as TenantMetadatum, aq as TenantsSelect, aG as TransactionsSelect, h as User, U as UserAuthOperations, ak as UsersSelect, V as Video, be as VideoCategoriesSelect, s as VideoCategory, t as VideoTag, bf as VideoTagsSelect, bd as VideosSelect } from './payload-types-BbEEk9Ji.js';
3
3
  import { Sort, Where } from 'payload';
4
4
  import * as _tanstack_react_query from '@tanstack/react-query';
5
5
  import { QueryClient } from '@tanstack/react-query';
6
- import { P as PublicCollection } from './const-DZyvV9wU.js';
7
- export { a as COLLECTIONS, C as Collection } from './const-DZyvV9wU.js';
6
+ import { P as PublicCollection } from './const-nftKBzYp.js';
7
+ export { a as COLLECTIONS, C as Collection } from './const-nftKBzYp.js';
8
8
  import { Metadata } from 'next';
9
- import { C as CollectionType } from './webhook-BBWl8O2f.js';
10
- export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, d as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-BBWl8O2f.js';
9
+ import { C as CollectionType } from './webhook-C4nmpBmQ.js';
10
+ export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, d as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-C4nmpBmQ.js';
11
11
  export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-DupPIYx-.js';
12
12
  export { b as IMAGE_SIZES, I as ImageData, a as ImagePalette, f as ImagePlaceholderOptions, d as getImageLqip, e as getImagePalette, h as getImagePlaceholderStyle, c as getImageSrcSet, g as getImageUrl } from './image-TT8lTsk5.js';
13
13
  export { e as VideoGifOptions, V as VideoThumbnailOptions, a as getVideoGif, c as getVideoMp4Url, d as getVideoStoryboard, b as getVideoStreamUrl, g as getVideoThumbnail } from './video-DbLL8yuc.js';
package/dist/index.js CHANGED
@@ -273,7 +273,7 @@ function resolveApiUrl() {
273
273
  // src/core/internal/utils/http.ts
274
274
  var DEFAULT_TIMEOUT = 3e4;
275
275
  var DEFAULT_RETRYABLE_STATUSES = [408, 429, 500, 502, 503, 504];
276
- var NON_RETRYABLE_STATUSES = [401, 403, 404, 422];
276
+ var NON_RETRYABLE_STATUSES = [400, 401, 403, 404, 422];
277
277
  var SAFE_METHODS = ["GET", "HEAD", "OPTIONS"];
278
278
  function debugLog(debug, type, message, data) {
279
279
  if (!debug) return;
@@ -285,6 +285,7 @@ function debugLog(debug, type, message, data) {
285
285
  }
286
286
  }
287
287
  function getErrorSuggestion(status) {
288
+ if (status === 400) return "The request data failed validation. Check field values and types.";
288
289
  if (status === 401) return "Please check your authentication credentials.";
289
290
  if (status === 403) return "Access denied. Check your credentials or permissions.";
290
291
  if (status === 404) return "The requested resource was not found.";
@@ -294,6 +295,7 @@ function getErrorSuggestion(status) {
294
295
  }
295
296
  function parseErrorBody(response) {
296
297
  return __async(this, null, function* () {
298
+ var _a;
297
299
  const fallback = {
298
300
  errorMessage: `HTTP ${response.status}: ${response.statusText}`,
299
301
  userMessage: `Request failed (status: ${response.status})`
@@ -301,14 +303,27 @@ function parseErrorBody(response) {
301
303
  try {
302
304
  const body = yield response.json();
303
305
  if (body.errors && Array.isArray(body.errors)) {
304
- const details = body.errors.map(
306
+ const fieldErrors = [];
307
+ for (const e of body.errors) {
308
+ if (((_a = e.data) == null ? void 0 : _a.errors) && Array.isArray(e.data.errors) && e.data.errors.length > 0) {
309
+ for (const fe of e.data.errors) {
310
+ fieldErrors.push({
311
+ field: fe.path || fe.field,
312
+ message: fe.message
313
+ });
314
+ }
315
+ } else if (e.field || e.message) {
316
+ fieldErrors.push({ field: e.field, message: e.message });
317
+ }
318
+ }
319
+ const details = (fieldErrors.length > 0 ? fieldErrors : body.errors).map(
305
320
  (e) => e.field ? `${e.field}: ${e.message}` : e.message
306
321
  ).filter(Boolean).join("; ");
307
322
  if (details) {
308
323
  return {
309
324
  errorMessage: `HTTP ${response.status}: ${details}`,
310
325
  userMessage: details,
311
- errors: body.errors
326
+ errors: fieldErrors.length > 0 ? fieldErrors : body.errors
312
327
  };
313
328
  }
314
329
  }