@sixtyninecommerce/admin 0.9.0 → 0.11.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.
Files changed (258) hide show
  1. package/README.md +4598 -128
  2. package/dist/catalog/assets.d.ts +120 -8
  3. package/dist/catalog/assets.js +98 -12
  4. package/dist/catalog/collections.d.ts +279 -14
  5. package/dist/catalog/collections.js +246 -15
  6. package/dist/catalog/index.d.ts +9 -2
  7. package/dist/catalog/index.js +4 -0
  8. package/dist/catalog/products.d.ts +318 -17
  9. package/dist/catalog/products.js +182 -14
  10. package/dist/catalog/properties.d.ts +102 -14
  11. package/dist/catalog/properties.js +13 -0
  12. package/dist/catalog/recommendations.d.ts +261 -0
  13. package/dist/catalog/recommendations.js +145 -0
  14. package/dist/catalog/reviews.d.ts +368 -0
  15. package/dist/catalog/reviews.js +318 -0
  16. package/dist/catalog/types.d.ts +17 -1
  17. package/dist/catalog/types.js +10 -0
  18. package/dist/catalog/variant-find.d.ts +136 -0
  19. package/dist/catalog/variant-find.js +239 -0
  20. package/dist/catalog/variants.d.ts +282 -25
  21. package/dist/catalog/variants.js +173 -25
  22. package/dist/catalog/visibility.d.ts +20 -5
  23. package/dist/catalog/visibility.js +19 -1
  24. package/dist/client.d.ts +116 -9
  25. package/dist/client.js +41 -7
  26. package/dist/content/assets.d.ts +286 -0
  27. package/dist/content/assets.js +181 -0
  28. package/dist/content/items.d.ts +269 -0
  29. package/dist/content/items.js +170 -0
  30. package/dist/content/types.d.ts +282 -0
  31. package/dist/content/types.js +100 -0
  32. package/dist/customers/age-verification.d.ts +66 -0
  33. package/dist/customers/age-verification.js +79 -0
  34. package/dist/customers/credit.d.ts +263 -0
  35. package/dist/customers/credit.js +244 -0
  36. package/dist/customers/delivery-preferences.d.ts +120 -0
  37. package/dist/customers/delivery-preferences.js +97 -0
  38. package/dist/customers/groups.d.ts +207 -0
  39. package/dist/customers/groups.js +438 -0
  40. package/dist/customers/index.d.ts +447 -37
  41. package/dist/customers/index.js +313 -40
  42. package/dist/customers/invitation-status.d.ts +57 -0
  43. package/dist/customers/invitation-status.js +21 -0
  44. package/dist/customers/notes.d.ts +67 -0
  45. package/dist/customers/notes.js +51 -0
  46. package/dist/customers/notification-recipients.d.ts +97 -0
  47. package/dist/customers/notification-recipients.js +84 -0
  48. package/dist/customers/saved-lists.d.ts +42 -0
  49. package/dist/customers/saved-lists.js +61 -0
  50. package/dist/customers/vat.d.ts +83 -0
  51. package/dist/customers/vat.js +46 -0
  52. package/dist/customers/wire.d.ts +20 -0
  53. package/dist/customers/wire.js +35 -0
  54. package/dist/documents/ar.d.ts +307 -0
  55. package/dist/documents/ar.js +254 -0
  56. package/dist/documents/index.d.ts +731 -21
  57. package/dist/documents/index.js +436 -24
  58. package/dist/documents/pdf.d.ts +2 -0
  59. package/dist/documents/pdf.js +11 -0
  60. package/dist/fulfillments/create.d.ts +167 -0
  61. package/dist/fulfillments/create.js +216 -0
  62. package/dist/fulfillments/index.d.ts +121 -10
  63. package/dist/fulfillments/index.js +120 -2
  64. package/dist/fulfillments/payment-policy.d.ts +64 -0
  65. package/dist/fulfillments/payment-policy.js +140 -0
  66. package/dist/fulfillments/warehouse.d.ts +724 -0
  67. package/dist/fulfillments/warehouse.js +914 -0
  68. package/dist/geo/index.d.ts +119 -0
  69. package/dist/geo/index.js +107 -0
  70. package/dist/index.d.ts +129 -30
  71. package/dist/index.js +47 -9
  72. package/dist/integrations/afas-actions.d.ts +234 -0
  73. package/dist/integrations/afas-actions.js +310 -0
  74. package/dist/integrations/afas-types.d.ts +483 -0
  75. package/dist/integrations/afas-types.js +5 -0
  76. package/dist/integrations/afas.d.ts +234 -0
  77. package/dist/integrations/afas.js +290 -0
  78. package/dist/integrations/connections.d.ts +103 -0
  79. package/dist/integrations/connections.js +55 -0
  80. package/dist/integrations/esp.d.ts +313 -0
  81. package/dist/integrations/esp.js +169 -0
  82. package/dist/integrations/exact-online-types.d.ts +423 -0
  83. package/dist/integrations/exact-online-types.js +6 -0
  84. package/dist/integrations/exact-online.d.ts +248 -0
  85. package/dist/integrations/exact-online.js +376 -0
  86. package/dist/integrations/index.d.ts +40 -0
  87. package/dist/integrations/index.js +24 -0
  88. package/dist/integrations/pipeline-keys.d.ts +13 -0
  89. package/dist/integrations/pipeline-keys.js +22 -0
  90. package/dist/integrations/pipelines.d.ts +114 -0
  91. package/dist/integrations/pipelines.js +46 -0
  92. package/dist/integrations/types.d.ts +322 -0
  93. package/dist/integrations/types.js +8 -0
  94. package/dist/jobs/bulk-action-run.d.ts +11 -2
  95. package/dist/jobs/bulk-action-run.js +4 -5
  96. package/dist/locations/index.d.ts +66 -0
  97. package/dist/locations/index.js +31 -0
  98. package/dist/meta/index.d.ts +162 -0
  99. package/dist/orders/bulk.d.ts +75 -0
  100. package/dist/orders/bulk.js +150 -0
  101. package/dist/orders/cancel-with-money.d.ts +227 -0
  102. package/dist/orders/cancel-with-money.js +153 -0
  103. package/dist/orders/commit-edit.d.ts +7 -1
  104. package/dist/orders/commit-edit.js +5 -1
  105. package/dist/orders/deposit-policy.d.ts +103 -0
  106. package/dist/orders/deposit-policy.js +202 -0
  107. package/dist/orders/drafts.d.ts +800 -0
  108. package/dist/orders/drafts.js +771 -0
  109. package/dist/orders/fields.d.ts +245 -0
  110. package/dist/orders/fields.js +188 -0
  111. package/dist/orders/get.d.ts +29 -19
  112. package/dist/orders/get.js +17 -8
  113. package/dist/orders/index.d.ts +125 -5
  114. package/dist/orders/index.js +35 -2
  115. package/dist/orders/lifecycle.d.ts +128 -0
  116. package/dist/orders/lifecycle.js +158 -0
  117. package/dist/orders/line-price-preview.d.ts +7 -2
  118. package/dist/orders/list.d.ts +222 -0
  119. package/dist/orders/list.js +377 -0
  120. package/dist/orders/manual-discounts.d.ts +11 -2
  121. package/dist/orders/manual-discounts.js +2 -0
  122. package/dist/orders/manual-pricing.d.ts +5 -0
  123. package/dist/orders/order-entry.d.ts +20 -7
  124. package/dist/orders/plan-edit.d.ts +1 -1
  125. package/dist/orders/plan-edit.js +4 -1
  126. package/dist/orders/settings.d.ts +201 -0
  127. package/dist/orders/settings.js +325 -0
  128. package/dist/orders/status.d.ts +159 -13
  129. package/dist/orders/status.js +21 -0
  130. package/dist/orders/surcharges.d.ts +8 -1
  131. package/dist/orders/surcharges.js +3 -2
  132. package/dist/payments/account-credit.d.ts +30 -0
  133. package/dist/payments/account-credit.js +19 -0
  134. package/dist/payments/ar.d.ts +292 -0
  135. package/dist/payments/ar.js +223 -0
  136. package/dist/payments/connected-account.d.ts +47 -0
  137. package/dist/payments/connected-account.js +61 -0
  138. package/dist/payments/credit-noted-fields.d.ts +12 -0
  139. package/dist/payments/credit-noted-fields.js +37 -0
  140. package/dist/payments/index.d.ts +263 -10
  141. package/dist/payments/index.js +133 -1
  142. package/dist/payments/methods.d.ts +332 -0
  143. package/dist/payments/methods.js +363 -0
  144. package/dist/payments/mollie-methods.d.ts +159 -0
  145. package/dist/payments/mollie-methods.js +141 -0
  146. package/dist/payments/payment-links.d.ts +180 -0
  147. package/dist/payments/payment-links.js +97 -0
  148. package/dist/payments/provider-keys.d.ts +150 -0
  149. package/dist/payments/provider-keys.js +118 -0
  150. package/dist/payments/providers.d.ts +86 -11
  151. package/dist/payments/providers.js +29 -0
  152. package/dist/payments/requests.d.ts +144 -0
  153. package/dist/payments/requests.js +92 -0
  154. package/dist/payments/store-credit-fields.d.ts +15 -0
  155. package/dist/payments/store-credit-fields.js +51 -0
  156. package/dist/pickups/index.d.ts +104 -0
  157. package/dist/pickups/index.js +105 -0
  158. package/dist/platform/channels.d.ts +132 -0
  159. package/dist/platform/channels.js +128 -0
  160. package/dist/platform/geo.d.ts +123 -0
  161. package/dist/platform/geo.js +144 -0
  162. package/dist/platform/tax.d.ts +154 -0
  163. package/dist/platform/tax.js +139 -0
  164. package/dist/pos/anomalies.d.ts +158 -0
  165. package/dist/pos/anomalies.js +64 -0
  166. package/dist/pos/assisted-selling.d.ts +79 -0
  167. package/dist/pos/assisted-selling.js +38 -0
  168. package/dist/pos/exchanges.d.ts +103 -0
  169. package/dist/pos/exchanges.js +22 -0
  170. package/dist/pos/gift-cards.d.ts +135 -0
  171. package/dist/pos/gift-cards.js +47 -0
  172. package/dist/pos/index.d.ts +2125 -32
  173. package/dist/pos/index.js +742 -4
  174. package/dist/pos/no-receipt.d.ts +94 -0
  175. package/dist/pos/no-receipt.js +25 -0
  176. package/dist/pos/offline-sales.d.ts +187 -0
  177. package/dist/pos/offline-sales.js +116 -0
  178. package/dist/pos/pay-by-link.d.ts +143 -0
  179. package/dist/pos/pay-by-link.js +57 -0
  180. package/dist/pos/quick-keys.d.ts +103 -0
  181. package/dist/pos/quick-keys.js +45 -0
  182. package/dist/pos/reports.d.ts +360 -0
  183. package/dist/pos/reports.js +62 -0
  184. package/dist/pos/returns.d.ts +217 -0
  185. package/dist/pos/returns.js +53 -0
  186. package/dist/pricing/bulk-coupons.d.ts +139 -0
  187. package/dist/pricing/bulk-coupons.js +112 -0
  188. package/dist/pricing/index.d.ts +177 -4
  189. package/dist/pricing/index.js +176 -1
  190. package/dist/pricing/price-lists.d.ts +604 -0
  191. package/dist/pricing/price-lists.js +600 -0
  192. package/dist/pricing/vouchers.d.ts +103 -0
  193. package/dist/pricing/vouchers.js +69 -0
  194. package/dist/purchasing/alerts.d.ts +89 -0
  195. package/dist/purchasing/alerts.js +62 -0
  196. package/dist/purchasing/cost.d.ts +110 -0
  197. package/dist/purchasing/cost.js +86 -0
  198. package/dist/purchasing/index.d.ts +36 -0
  199. package/dist/purchasing/index.js +16 -0
  200. package/dist/purchasing/purchase-orders.d.ts +548 -0
  201. package/dist/purchasing/purchase-orders.js +491 -0
  202. package/dist/purchasing/replenishment.d.ts +281 -0
  203. package/dist/purchasing/replenishment.js +240 -0
  204. package/dist/purchasing/settings.d.ts +152 -0
  205. package/dist/purchasing/settings.js +181 -0
  206. package/dist/purchasing/suppliers.d.ts +476 -0
  207. package/dist/purchasing/suppliers.js +438 -0
  208. package/dist/quotes/index.d.ts +501 -0
  209. package/dist/quotes/index.js +439 -0
  210. package/dist/reports/index.d.ts +71 -8
  211. package/dist/reports/index.js +74 -11
  212. package/dist/returns/index.d.ts +818 -0
  213. package/dist/returns/index.js +844 -0
  214. package/dist/search/index.d.ts +174 -0
  215. package/dist/search/index.js +125 -0
  216. package/dist/shipping/definitions.d.ts +29 -0
  217. package/dist/shipping/definitions.js +47 -0
  218. package/dist/shipping/fulfillment-profiles.d.ts +174 -0
  219. package/dist/shipping/fulfillment-profiles.js +104 -0
  220. package/dist/shipping/hendriks.d.ts +97 -0
  221. package/dist/shipping/hendriks.js +50 -0
  222. package/dist/shipping/index.d.ts +48 -0
  223. package/dist/shipping/index.js +25 -0
  224. package/dist/shipping/methods.d.ts +198 -0
  225. package/dist/shipping/methods.js +240 -0
  226. package/dist/shipping/myparcel.d.ts +254 -0
  227. package/dist/shipping/myparcel.js +178 -0
  228. package/dist/shipping/parcel-count-suggestion.d.ts +2 -0
  229. package/dist/shipping/parcel-rule.d.ts +6 -5
  230. package/dist/shipping/parcel-rule.js +21 -23
  231. package/dist/shipping/rate-tables.d.ts +179 -0
  232. package/dist/shipping/rate-tables.js +184 -0
  233. package/dist/stock/index.d.ts +10 -3
  234. package/dist/stock/index.js +3 -0
  235. package/dist/stock/locations.d.ts +144 -0
  236. package/dist/stock/locations.js +168 -0
  237. package/dist/stock/transfers.d.ts +216 -43
  238. package/dist/stock/transfers.js +140 -13
  239. package/dist/stored-value/index.d.ts +214 -4
  240. package/dist/stored-value/index.js +152 -0
  241. package/dist/subscriptions/index.d.ts +682 -0
  242. package/dist/subscriptions/index.js +815 -0
  243. package/dist/tax/index.d.ts +76 -1
  244. package/dist/tax/index.js +50 -0
  245. package/dist/tenant/email-style.d.ts +102 -0
  246. package/dist/tenant/email-style.js +72 -0
  247. package/dist/tenant/email-templates.d.ts +66 -0
  248. package/dist/tenant/email-templates.js +54 -0
  249. package/dist/tenant/notifications.d.ts +23 -17
  250. package/dist/tenant/settings-sources.d.ts +1 -1
  251. package/dist/tenant/time-zone.d.ts +17 -0
  252. package/dist/tenant/time-zone.js +11 -0
  253. package/dist/types.d.ts +51 -4
  254. package/dist/users/index.d.ts +3 -0
  255. package/dist/users/index.js +2 -0
  256. package/dist/users/warehouses.d.ts +50 -0
  257. package/dist/users/warehouses.js +51 -0
  258. package/package.json +2 -2
@@ -1,6 +1,49 @@
1
- import type { Page, Transport } from '@sixtyninecommerce/core';
2
- import type { Call, ListOptions } from '../types.js';
1
+ import { type Page, type Transport } from '@sixtyninecommerce/core';
2
+ import type { Call, ConfigurableOperationDefinition, ListOptions } from '../types.js';
3
3
  import { type AssetRef, type CatalogueOwnership, type ConfigurableOperation, type ConfigurableOperationInput, type LanguageCode } from './types.js';
4
+ import type { VariantStorePrice } from './variants.js';
5
+ /**
6
+ * A collection's search-engine settings for the whole store, which the storefront renders into
7
+ * the collection's page. Null for a setting the collection has no value for: the storefront then
8
+ * uses its default (`isRoutable` true, `isCanonical` false, `noindex` and `nofollow` false,
9
+ * `metaRobotsMaxImagePreview` `large`, `socialOgType` `website`, `twitterCardType`
10
+ * `summary_large_image`).
11
+ */
12
+ export interface CollectionSeo {
13
+ /**
14
+ * A top-level collection only: whether its subtree gets storefront URLs. Off, the subtree is
15
+ * for filtering only. Read nowhere for a collection below the top level.
16
+ */
17
+ isRoutable: boolean | null;
18
+ /**
19
+ * A top-level collection only: whether products listed under it take its path as their
20
+ * canonical URL (the lowest position wins when several do).
21
+ */
22
+ isCanonical: boolean | null;
23
+ noindex: boolean | null;
24
+ nofollow: boolean | null;
25
+ /** `none`, `standard` or `large`. */
26
+ metaRobotsMaxImagePreview: string | null;
27
+ /** The asset the social (OpenGraph) image shows; the featured asset when null. */
28
+ socialImageId: string | null;
29
+ /** `website` or `product`. */
30
+ socialOgType: string | null;
31
+ /** `summary` or `summary_large_image`. */
32
+ twitterCardType: string | null;
33
+ }
34
+ /**
35
+ * A collection's search-engine texts in ONE language; each null falls back as the storefront
36
+ * documents it (the SEO title to the name, the description to the collection's description, the
37
+ * social texts to the SEO ones).
38
+ */
39
+ export interface CollectionTranslationSeo {
40
+ seoTitle: string | null;
41
+ seoDescription: string | null;
42
+ canonicalUrl: string | null;
43
+ socialTitle: string | null;
44
+ socialDescription: string | null;
45
+ socialImageAlt: string | null;
46
+ }
4
47
  /**
5
48
  * A collection. Membership is DERIVED: the engine applies `filters` (and the
6
49
  * parent's, when `inheritFilters`) and recomputes the member variants in a
@@ -10,8 +53,8 @@ import { type AssetRef, type CatalogueOwnership, type ConfigurableOperation, typ
10
53
  * The filters this platform ships: `facet-value-filter`, `variant-name-filter`,
11
54
  * `product-id-filter` (arguments `productIds` — a JSON array of ids as a
12
55
  * string — and `combineWithAnd`), `variant-id-filter`, and the import
13
- * pipeline's `pipeline-manual-assignment`. The Admin API's
14
- * `collectionFilters` query lists them with their argument definitions.
56
+ * pipeline's `pipeline-manual-assignment`. `catalog.collections.filterDefinitions()`
57
+ * lists them with their argument definitions.
15
58
  */
16
59
  export interface Collection {
17
60
  id: string;
@@ -23,11 +66,16 @@ export interface Collection {
23
66
  isPrivate: boolean;
24
67
  /** The root collection's id for a top-level collection. */
25
68
  parentId: string;
69
+ /** The place among its siblings; sort by it to show them in the merchant's order. */
26
70
  position: number;
27
71
  inheritFilters: boolean;
28
72
  filters: ConfigurableOperation[];
29
73
  featuredAsset: AssetRef | null;
30
74
  assets: AssetRef[];
75
+ /**
76
+ * The path from the store's root (first, named `__root_collection__`) down to the collection
77
+ * itself (last).
78
+ */
31
79
  breadcrumbs: Array<{
32
80
  id: string;
33
81
  name: string;
@@ -35,21 +83,45 @@ export interface Collection {
35
83
  }>;
36
84
  /** How many variants the last membership run matched. */
37
85
  productVariantCount: number;
86
+ /** The store-wide search-engine settings. */
87
+ seo: CollectionSeo;
38
88
  translations: Array<{
39
89
  id: string;
40
90
  languageCode: LanguageCode;
41
91
  name: string;
42
92
  slug: string;
43
93
  description: string;
94
+ /** The search-engine texts in this language. */
95
+ seo: CollectionTranslationSeo;
44
96
  }>;
45
97
  /** The store's own collection, or its organization's; see {@link CatalogueOwnership}. */
46
98
  catalogueOwnership: CatalogueOwnership;
47
99
  }
100
+ /** A collection as {@link CollectionsModule.get} reads it: the {@link Collection}, its parent and children. */
101
+ export interface CollectionDetail extends Collection {
102
+ /**
103
+ * The collection above it: for a top-level collection, the store's root, named
104
+ * `__root_collection__`. Null only for a root itself.
105
+ */
106
+ parent: {
107
+ id: string;
108
+ name: string;
109
+ } | null;
110
+ /** The collections right under it, every one, in no set order: sort them by `position`. */
111
+ children: Array<{
112
+ id: string;
113
+ name: string;
114
+ slug: string;
115
+ position: number;
116
+ }>;
117
+ }
48
118
  export interface CollectionTranslationInput {
49
119
  languageCode: LanguageCode;
50
120
  name: string;
51
121
  slug: string;
52
122
  description: string;
123
+ /** The search-engine texts in this language; what is left out keeps its value. */
124
+ seo?: Partial<CollectionTranslationSeo>;
53
125
  }
54
126
  export interface CreateCollectionInput {
55
127
  translations: CollectionTranslationInput[];
@@ -60,6 +132,8 @@ export interface CreateCollectionInput {
60
132
  inheritFilters?: boolean;
61
133
  featuredAssetId?: string | null;
62
134
  assetIds?: string[];
135
+ /** The store-wide search-engine settings; what is left out keeps its value (or default). */
136
+ seo?: Partial<CollectionSeo>;
63
137
  }
64
138
  export interface UpdateCollectionInput extends Partial<Omit<CreateCollectionInput, 'translations'>> {
65
139
  id: string;
@@ -68,42 +142,233 @@ export interface UpdateCollectionInput extends Partial<Omit<CreateCollectionInpu
68
142
  id?: string;
69
143
  }>;
70
144
  }
145
+ /** What a collection list can be sorted by. */
146
+ export type CollectionSortField = 'position' | 'name' | 'createdAt' | 'updatedAt' | 'id';
71
147
  export interface CollectionListOptions extends ListOptions {
72
148
  /** Only the direct children of this collection. */
73
149
  parentId?: string;
74
150
  /** Case-insensitive substring of the name. */
75
151
  name?: string;
152
+ /** Only the collections right under the store's root: the top level of its tree. */
153
+ topLevelOnly?: boolean;
154
+ /**
155
+ * Only these collections. An id the store does not hold is left out, never an error; an empty
156
+ * list answers an empty page without asking the engine.
157
+ */
158
+ ids?: readonly string[];
159
+ /**
160
+ * ONE sort key; the engine's own order (unsorted) when omitted. Use `position` to show
161
+ * siblings in the merchant's order. The engine adds no tie-breaker, and every sibling group
162
+ * numbers its positions from 0: to walk EVERY collection page by page, sort by `id`, or rows
163
+ * tied across a page boundary can repeat or go missing.
164
+ */
165
+ sort?: {
166
+ field: CollectionSortField;
167
+ direction: 'ASC' | 'DESC';
168
+ };
169
+ }
170
+ /** The most collections one {@link CollectionsModule.search} answers. */
171
+ export declare const MAX_COLLECTION_SEARCH_TAKE = 100;
172
+ export interface CollectionSearchOptions extends Call {
173
+ /** Collections to answer, 1 to {@link MAX_COLLECTION_SEARCH_TAKE}; 25 when omitted. */
174
+ take?: number;
175
+ /** Best matches to skip, 0 when omitted. */
176
+ skip?: number;
177
+ }
178
+ export interface CollectionSearchResult {
179
+ /** The matching collections, best match first. */
180
+ items: Collection[];
181
+ /** Every match the search index counts, not only this page's. */
182
+ total: number;
183
+ }
184
+ /** What {@link CollectionsModule.previewVariants} computes the members of. */
185
+ export interface CollectionPreviewInput {
186
+ /** The filters to apply, as a save would send them; unsaved ones included. */
187
+ filters: ConfigurableOperationInput[];
188
+ /** Also apply the parent's filters (and its parent's, as far as they inherit). */
189
+ inheritFilters: boolean;
190
+ /** The parent whose filters `inheritFilters` adds; none for a top-level collection. */
191
+ parentId?: string;
192
+ }
193
+ export interface CollectionPreviewOptions extends ListOptions {
194
+ /** Only variants whose name or SKU contains this, capitals ignored. */
195
+ term?: string;
196
+ }
197
+ /** A variant a collection's filters would take in, as the preview lists it. */
198
+ export interface CollectionPreviewVariant {
199
+ id: string;
200
+ name: string;
201
+ sku: string;
202
+ /**
203
+ * The variant's price in the store, or null when the store has no price for it: a preview
204
+ * lists an unpriced variant like any other. Never 0 for a missing price.
205
+ */
206
+ storePrice: VariantStorePrice | null;
207
+ product: {
208
+ id: string;
209
+ name: string;
210
+ featuredAsset: AssetRef | null;
211
+ };
76
212
  }
77
213
  /**
78
214
  * Collections. Reading needs `ReadCatalog` (or `ReadCollection`), writing the
79
215
  * matching Create/Update/Delete permission.
80
216
  *
81
- * Refusals in the engine's words: "Cannot move a Collection into itself" on
82
- * `move` (`ValidationError`), an unknown id as `NotFoundError`
217
+ * Refusals in the engine's words: an unknown id as `NotFoundError`
83
218
  * (`ENTITY_NOT_FOUND`), and a refused delete as `ConflictError`
84
219
  * (`COLLECTION_NOT_DELETED`) with the engine's message. Deleting a collection
85
220
  * deletes its descendants too.
86
221
  *
222
+ * **An organization's collections** (multi-region decision 62): a member store may put a
223
+ * collection of its own under its organization's collection (`create` or `update` with that
224
+ * `parentId`), and it stays the store's to change. It may not reorder or re-parent the
225
+ * organization's collections: those writes, and a `move` under an organization's collection
226
+ * (which renumbers its siblings), are refused `MANAGED_BY_ORGANIZATION` (422 `BusinessRuleError`).
227
+ *
87
228
  * There is no `addProducts`: a manual collection's list lives INSIDE its
88
229
  * `product-id-filter` arguments, so adding one product is a read-modify-write
89
230
  * of the whole filter list, and doing that from a client (`update`) races
90
231
  * every other writer. To put a product in collections, or take it out, use
91
232
  * `catalog.products.setCollections`, which the engine runs under a row lock.
233
+ *
234
+ * No write deduplicates on `idempotencyKey`: a repeated `create` makes a second collection.
92
235
  */
93
236
  export interface CollectionsModule {
237
+ /**
238
+ * One page of the store's collections (`limit` 1 to 1,000, default 25). Walk them all with
239
+ * `for await`: every following page re-sends the same filters, sort and store.
240
+ *
241
+ * Refused before sending: `INVALID_PAGE_SIZE` (`ValidationError`, 400) for a `limit` outside
242
+ * 1 to 1,000; `INVALID_COLLECTION_SORT` (`ValidationError`, 400) for a sort field or direction
243
+ * not named in {@link CollectionListOptions.sort}.
244
+ *
245
+ * @effect read
246
+ */
94
247
  list(options?: CollectionListOptions): Promise<Page<Collection>>;
95
- get(id: string, options?: Call): Promise<Collection | null>;
248
+ /**
249
+ * One collection with its parent and children; null for an id this store does not have, the
250
+ * same answer another store's collection gets.
251
+ *
252
+ * @effect read
253
+ */
254
+ get(id: string, options?: Call): Promise<CollectionDetail | null>;
255
+ /**
256
+ * The store's collections that best match `term` (by name, by the names of the collections
257
+ * above it, by slug; a typo is forgiven), best first: the search index finds them, and each is
258
+ * read from the engine, so what it answers is current. A collection the index still lists
259
+ * but the store no longer holds is left out, so a page can be shorter than `take`. A blank
260
+ * term matches every collection.
261
+ *
262
+ * A collection created or renamed a moment ago may be missing for a few seconds: the index is
263
+ * written by a job after the change.
264
+ *
265
+ * Refusals: `SEARCH_INPUT_INVALID` (`ValidationError`, 400) for a `take` outside 1 to
266
+ * {@link MAX_COLLECTION_SEARCH_TAKE} or a `skip` that is not a whole number, before sending;
267
+ * `SERVICE_UNAVAILABLE` (503, retryable) when the search service does not answer;
268
+ * `PermissionDeniedError` without `ReadCatalog` or `ReadCollection`.
269
+ *
270
+ * @effect read
271
+ */
272
+ search(term: string, options?: CollectionSearchOptions): Promise<CollectionSearchResult>;
273
+ /**
274
+ * Create a collection. Needs `CreateCatalog` or `CreateCollection`.
275
+ *
276
+ * A new translation needs a name; its slug, when left out, is made from the name in that
277
+ * language (multi-region decision 106).
278
+ *
279
+ * Refusals (nothing is written):
280
+ * - `TRANSLATION_INPUT_INVALID` → `ValidationError` (400): a translation without a name, or
281
+ * with a name no slug can be made from (`!!!`) and no slug. One `details` entry per refused
282
+ * field, each message naming the language and the field; the entries carry no `field`
283
+ * pointer (the engine refuses below the call's arguments).
284
+ * - `TRANSLATION_LANGUAGE_NOT_OFFERED` → `BusinessRuleError` (422): a translation in a
285
+ * language the store does not offer.
286
+ * - `ENTITY_NOT_FOUND` → `NotFoundError` (404): a `parentId` this store does not hold.
287
+ * - `SHARED_COLLECTION_NOT_ALLOWED` → `PermissionDeniedError` (403): the parent is also
288
+ * another store's, and you may not change that store's catalogue.
289
+ *
290
+ * @effect write
291
+ */
96
292
  create(input: CreateCollectionInput, options?: Call): Promise<Collection>;
293
+ /**
294
+ * A PATCH of the collection: what the input leaves out keeps its value, but `filters`, when
295
+ * sent, replace the whole list. A translation for a language the collection has no row in is
296
+ * a NEW row, judged as on {@link create}. A `parentId` re-parents it (the store's root puts it
297
+ * at the top level); a parent inside its own subtree is refused `ILLEGAL_OPERATION`
298
+ * (`BusinessRuleError`, 422, "Cannot move a Collection into itself"). The other refusals are
299
+ * {@link create}'s, plus `MANAGED_BY_ORGANIZATION` for an organization's collection.
300
+ *
301
+ * @effect write
302
+ */
97
303
  update(input: UpdateCollectionInput, options?: Call): Promise<Collection>;
304
+ /**
305
+ * Delete a collection AND every collection below it. Products are not deleted; they leave the
306
+ * deleted collections. Nothing in this SDK restores a collection. Needs `DeleteCatalog` or
307
+ * `DeleteCollection`.
308
+ *
309
+ * Refusals (nothing is deleted):
310
+ * - `COLLECTION_NOT_DELETED` → `ConflictError` (409): the engine declined, in its own words.
311
+ * - `ENTITY_NOT_FOUND` → `NotFoundError` (404): a collection this store does not hold.
312
+ * - `SHARED_COLLECTION_NOT_ALLOWED` → `PermissionDeniedError` (403): another store also holds
313
+ * it, and you may not delete there.
314
+ * - `MANAGED_BY_ORGANIZATION` → `BusinessRuleError` (422): a collection of the store's
315
+ * organization.
316
+ *
317
+ * @effect destructive
318
+ */
98
319
  delete(id: string, options?: Call): Promise<void>;
99
- /** Re-parent and/or reorder: `index` is the position among the new parent's children. */
320
+ /**
321
+ * Re-parent and/or reorder: `index` is the position among the new parent's children, counted
322
+ * over ALL of them (not one page's). The store's root as `parentId` keeps it at the top level.
323
+ * Needs `UpdateCatalog` or `UpdateCollection`.
324
+ *
325
+ * Refusals (nothing moves):
326
+ * - `ILLEGAL_OPERATION` → `BusinessRuleError` (422): the new parent is the collection itself
327
+ * or one of its descendants ("Cannot move a Collection into itself").
328
+ * - `ENTITY_NOT_FOUND` → `NotFoundError` (404): a collection or parent this store does not
329
+ * hold, another store's root included.
330
+ * - `MANAGED_BY_ORGANIZATION` → `BusinessRuleError` (422): the collection is the store's
331
+ * organization's, or the new parent is (a move renumbers the parent's other children; put a
332
+ * collection of your own under it with `update({ id, parentId })` instead).
333
+ * - `SHARED_COLLECTION_NOT_ALLOWED` → `PermissionDeniedError` (403): the collection or the
334
+ * parent is also another store's, and you may not change that store's catalogue.
335
+ *
336
+ * @effect write
337
+ */
100
338
  move(collectionId: string, parentId: string, index: number, options?: Call): Promise<Collection>;
339
+ /**
340
+ * The filters a collection may use, with the arguments each takes (labels and descriptions in
341
+ * the language of the request): the same for every store. `args[].required` is NOT the
342
+ * enforced rule (see `ConfigArgDefinition.required`).
343
+ *
344
+ * @effect read
345
+ */
346
+ filterDefinitions(options?: Call): Promise<ConfigurableOperationDefinition[]>;
347
+ /**
348
+ * The variants a collection WOULD hold with these filters, computed now and saved nowhere: a
349
+ * page of them (`limit` 1 to 1,000, default 25), in no set order. It works before a collection
350
+ * exists and for unsaved changes. No filters at all (and none inherited) answers every variant
351
+ * of the store, not none; so does a lone filter sent with `combineWithAnd` `false` (send `true`).
352
+ *
353
+ * Refusals: `INVALID_PAGE_SIZE` (`ValidationError`, 400) before sending; a filter code the
354
+ * engine does not know, or an argument it cannot read, in the engine's words.
355
+ *
356
+ * @effect read
357
+ */
358
+ previewVariants(input: CollectionPreviewInput, options?: CollectionPreviewOptions): Promise<Page<CollectionPreviewVariant>>;
101
359
  }
102
- export declare const COLLECTION_FIELDS = "\n id\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n createdAt\n updatedAt\n name\n slug\n description\n isPrivate\n parentId\n position\n inheritFilters\n filters {\n code\n args {\n name\n value\n }\n }\n featuredAsset { \n id\n name\n preview\n source\n }\n assets { \n id\n name\n preview\n source\n }\n breadcrumbs {\n id\n name\n slug\n }\n productVariantCount\n translations {\n id\n languageCode\n name\n slug\n description\n }\n";
103
- export declare const COLLECTIONS_QUERY = "\n query CatalogCollections($options: CollectionListOptions) {\n collections(options: $options) {\n items { \n id\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n createdAt\n updatedAt\n name\n slug\n description\n isPrivate\n parentId\n position\n inheritFilters\n filters {\n code\n args {\n name\n value\n }\n }\n featuredAsset { \n id\n name\n preview\n source\n }\n assets { \n id\n name\n preview\n source\n }\n breadcrumbs {\n id\n name\n slug\n }\n productVariantCount\n translations {\n id\n languageCode\n name\n slug\n description\n }\n }\n totalItems\n }\n }\n";
104
- export declare const COLLECTION_QUERY = "\n query CatalogCollection($id: ID!) {\n collection(id: $id) { \n id\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n createdAt\n updatedAt\n name\n slug\n description\n isPrivate\n parentId\n position\n inheritFilters\n filters {\n code\n args {\n name\n value\n }\n }\n featuredAsset { \n id\n name\n preview\n source\n }\n assets { \n id\n name\n preview\n source\n }\n breadcrumbs {\n id\n name\n slug\n }\n productVariantCount\n translations {\n id\n languageCode\n name\n slug\n description\n }\n }\n }\n";
105
- export declare const CREATE_COLLECTION_MUTATION = "\n mutation CatalogCreateCollection($input: CreateCollectionInput!) {\n createCollection(input: $input) { \n id\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n createdAt\n updatedAt\n name\n slug\n description\n isPrivate\n parentId\n position\n inheritFilters\n filters {\n code\n args {\n name\n value\n }\n }\n featuredAsset { \n id\n name\n preview\n source\n }\n assets { \n id\n name\n preview\n source\n }\n breadcrumbs {\n id\n name\n slug\n }\n productVariantCount\n translations {\n id\n languageCode\n name\n slug\n description\n }\n }\n }\n";
106
- export declare const UPDATE_COLLECTION_MUTATION = "\n mutation CatalogUpdateCollection($input: UpdateCollectionInput!) {\n updateCollection(input: $input) { \n id\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n createdAt\n updatedAt\n name\n slug\n description\n isPrivate\n parentId\n position\n inheritFilters\n filters {\n code\n args {\n name\n value\n }\n }\n featuredAsset { \n id\n name\n preview\n source\n }\n assets { \n id\n name\n preview\n source\n }\n breadcrumbs {\n id\n name\n slug\n }\n productVariantCount\n translations {\n id\n languageCode\n name\n slug\n description\n }\n }\n }\n";
360
+ export declare const COLLECTION_FIELDS = "\n id\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n createdAt\n updatedAt\n name\n slug\n description\n isPrivate\n parentId\n position\n inheritFilters\n filters {\n code\n args {\n name\n value\n }\n }\n featuredAsset { \n id\n name\n preview\n source\n type\n mimeType\n customFields {\n altText\n }\n }\n assets { \n id\n name\n preview\n source\n type\n mimeType\n customFields {\n altText\n }\n }\n breadcrumbs {\n id\n name\n slug\n }\n productVariantCount\n \n customFields {\n isRoutable\n isCanonical\n noindex\n nofollow\n metaRobotsMaxImagePreview\n socialImageId\n socialOgType\n twitterCardType\n }\n\n translations {\n id\n languageCode\n name\n slug\n description\n \n customFields {\n seoTitle\n seoDescription\n canonicalUrl\n socialTitle\n socialDescription\n socialImageAlt\n }\n\n }\n";
361
+ export declare const COLLECTIONS_QUERY = "\n query CatalogCollections($options: CollectionListOptions) {\n collections(options: $options) {\n items { \n id\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n createdAt\n updatedAt\n name\n slug\n description\n isPrivate\n parentId\n position\n inheritFilters\n filters {\n code\n args {\n name\n value\n }\n }\n featuredAsset { \n id\n name\n preview\n source\n type\n mimeType\n customFields {\n altText\n }\n }\n assets { \n id\n name\n preview\n source\n type\n mimeType\n customFields {\n altText\n }\n }\n breadcrumbs {\n id\n name\n slug\n }\n productVariantCount\n \n customFields {\n isRoutable\n isCanonical\n noindex\n nofollow\n metaRobotsMaxImagePreview\n socialImageId\n socialOgType\n twitterCardType\n }\n\n translations {\n id\n languageCode\n name\n slug\n description\n \n customFields {\n seoTitle\n seoDescription\n canonicalUrl\n socialTitle\n socialDescription\n socialImageAlt\n }\n\n }\n }\n totalItems\n }\n }\n";
362
+ export declare const COLLECTION_QUERY = "\n query CatalogCollection($id: ID!) {\n collection(id: $id) {\n \n id\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n createdAt\n updatedAt\n name\n slug\n description\n isPrivate\n parentId\n position\n inheritFilters\n filters {\n code\n args {\n name\n value\n }\n }\n featuredAsset { \n id\n name\n preview\n source\n type\n mimeType\n customFields {\n altText\n }\n }\n assets { \n id\n name\n preview\n source\n type\n mimeType\n customFields {\n altText\n }\n }\n breadcrumbs {\n id\n name\n slug\n }\n productVariantCount\n \n customFields {\n isRoutable\n isCanonical\n noindex\n nofollow\n metaRobotsMaxImagePreview\n socialImageId\n socialOgType\n twitterCardType\n }\n\n translations {\n id\n languageCode\n name\n slug\n description\n \n customFields {\n seoTitle\n seoDescription\n canonicalUrl\n socialTitle\n socialDescription\n socialImageAlt\n }\n\n }\n\n parent {\n id\n name\n }\n children {\n id\n name\n slug\n position\n }\n }\n }\n";
363
+ export declare const CREATE_COLLECTION_MUTATION = "\n mutation CatalogCreateCollection($input: CreateCollectionInput!) {\n createCollection(input: $input) { \n id\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n createdAt\n updatedAt\n name\n slug\n description\n isPrivate\n parentId\n position\n inheritFilters\n filters {\n code\n args {\n name\n value\n }\n }\n featuredAsset { \n id\n name\n preview\n source\n type\n mimeType\n customFields {\n altText\n }\n }\n assets { \n id\n name\n preview\n source\n type\n mimeType\n customFields {\n altText\n }\n }\n breadcrumbs {\n id\n name\n slug\n }\n productVariantCount\n \n customFields {\n isRoutable\n isCanonical\n noindex\n nofollow\n metaRobotsMaxImagePreview\n socialImageId\n socialOgType\n twitterCardType\n }\n\n translations {\n id\n languageCode\n name\n slug\n description\n \n customFields {\n seoTitle\n seoDescription\n canonicalUrl\n socialTitle\n socialDescription\n socialImageAlt\n }\n\n }\n }\n }\n";
364
+ export declare const UPDATE_COLLECTION_MUTATION = "\n mutation CatalogUpdateCollection($input: UpdateCollectionInput!) {\n updateCollection(input: $input) { \n id\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n createdAt\n updatedAt\n name\n slug\n description\n isPrivate\n parentId\n position\n inheritFilters\n filters {\n code\n args {\n name\n value\n }\n }\n featuredAsset { \n id\n name\n preview\n source\n type\n mimeType\n customFields {\n altText\n }\n }\n assets { \n id\n name\n preview\n source\n type\n mimeType\n customFields {\n altText\n }\n }\n breadcrumbs {\n id\n name\n slug\n }\n productVariantCount\n \n customFields {\n isRoutable\n isCanonical\n noindex\n nofollow\n metaRobotsMaxImagePreview\n socialImageId\n socialOgType\n twitterCardType\n }\n\n translations {\n id\n languageCode\n name\n slug\n description\n \n customFields {\n seoTitle\n seoDescription\n canonicalUrl\n socialTitle\n socialDescription\n socialImageAlt\n }\n\n }\n }\n }\n";
107
365
  export declare const DELETE_COLLECTION_MUTATION = "\n mutation CatalogDeleteCollection($id: ID!) {\n deleteCollection(id: $id) { \n result\n message\n }\n }\n";
108
- export declare const MOVE_COLLECTION_MUTATION = "\n mutation CatalogMoveCollection($input: MoveCollectionInput!) {\n moveCollection(input: $input) { \n id\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n createdAt\n updatedAt\n name\n slug\n description\n isPrivate\n parentId\n position\n inheritFilters\n filters {\n code\n args {\n name\n value\n }\n }\n featuredAsset { \n id\n name\n preview\n source\n }\n assets { \n id\n name\n preview\n source\n }\n breadcrumbs {\n id\n name\n slug\n }\n productVariantCount\n translations {\n id\n languageCode\n name\n slug\n description\n }\n }\n }\n";
366
+ export declare const MOVE_COLLECTION_MUTATION = "\n mutation CatalogMoveCollection($input: MoveCollectionInput!) {\n moveCollection(input: $input) { \n id\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n createdAt\n updatedAt\n name\n slug\n description\n isPrivate\n parentId\n position\n inheritFilters\n filters {\n code\n args {\n name\n value\n }\n }\n featuredAsset { \n id\n name\n preview\n source\n type\n mimeType\n customFields {\n altText\n }\n }\n assets { \n id\n name\n preview\n source\n type\n mimeType\n customFields {\n altText\n }\n }\n breadcrumbs {\n id\n name\n slug\n }\n productVariantCount\n \n customFields {\n isRoutable\n isCanonical\n noindex\n nofollow\n metaRobotsMaxImagePreview\n socialImageId\n socialOgType\n twitterCardType\n }\n\n translations {\n id\n languageCode\n name\n slug\n description\n \n customFields {\n seoTitle\n seoDescription\n canonicalUrl\n socialTitle\n socialDescription\n socialImageAlt\n }\n\n }\n }\n }\n";
367
+ export declare const COLLECTION_FILTER_DEFINITIONS_QUERY = "\n query CatalogCollectionFilterDefinitions {\n collectionFilters {\n code\n description\n args {\n name\n type\n list\n required\n defaultValue\n label\n description\n ui\n }\n }\n }\n";
368
+ /**
369
+ * The preview's price is `storePrice` (null for a variant the store has no price for), never
370
+ * core's `price` / `priceWithTax` / `currencyCode`, which raise "No price information was
371
+ * found…" for such a variant and, being non-null, empty the whole preview (#1504).
372
+ */
373
+ export declare const PREVIEW_COLLECTION_VARIANTS_QUERY = "\n query CatalogPreviewCollectionVariants(\n $input: PreviewCollectionVariantsInput!\n $options: ProductVariantListOptions\n ) {\n previewCollectionVariants(input: $input, options: $options) {\n items {\n id\n name\n sku\n storePrice {\n price\n priceWithTax\n currencyCode\n }\n product {\n id\n name\n featuredAsset { \n id\n name\n preview\n source\n type\n mimeType\n customFields {\n altText\n }\n }\n }\n }\n totalItems\n }\n }\n";
109
374
  export declare function createCollectionsModule(transport: Transport): CollectionsModule;