@sixtyninecommerce/admin 0.8.0 → 0.10.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 (179) hide show
  1. package/README.md +2739 -17
  2. package/dist/api-tokens/index.d.ts +15 -5
  3. package/dist/api-tokens/index.js +1 -0
  4. package/dist/apps/event-subscription.d.ts +59 -0
  5. package/dist/apps/event-subscription.js +32 -0
  6. package/dist/apps/hook-secret.d.ts +22 -0
  7. package/dist/apps/hook-secret.js +36 -0
  8. package/dist/apps/index.d.ts +54 -3
  9. package/dist/apps/index.js +17 -0
  10. package/dist/audit/index.d.ts +7 -0
  11. package/dist/auth/queries.d.ts +5 -1
  12. package/dist/auth/queries.js +6 -0
  13. package/dist/bulk/index.d.ts +323 -0
  14. package/dist/bulk/index.js +162 -0
  15. package/dist/catalog/assets.d.ts +147 -0
  16. package/dist/catalog/assets.js +164 -0
  17. package/dist/catalog/collections.d.ts +109 -0
  18. package/dist/catalog/collections.js +91 -0
  19. package/dist/catalog/facets.d.ts +103 -0
  20. package/dist/catalog/facets.js +100 -0
  21. package/dist/catalog/index.d.ts +115 -0
  22. package/dist/catalog/index.js +21 -0
  23. package/dist/catalog/options.d.ts +89 -0
  24. package/dist/catalog/options.js +88 -0
  25. package/dist/catalog/products-bulk.d.ts +21 -0
  26. package/dist/catalog/products-bulk.js +58 -0
  27. package/dist/catalog/products.d.ts +650 -0
  28. package/dist/catalog/products.js +458 -0
  29. package/dist/catalog/properties.d.ts +234 -0
  30. package/dist/catalog/properties.js +158 -0
  31. package/dist/catalog/types.d.ts +174 -0
  32. package/dist/catalog/types.js +141 -0
  33. package/dist/catalog/variants.d.ts +324 -0
  34. package/dist/catalog/variants.js +288 -0
  35. package/dist/catalog/visibility.d.ts +57 -0
  36. package/dist/catalog/visibility.js +59 -0
  37. package/dist/client.d.ts +192 -3
  38. package/dist/client.js +87 -12
  39. package/dist/compliance/index.d.ts +88 -0
  40. package/dist/compliance/index.js +88 -0
  41. package/dist/customer-data-redaction.d.ts +14 -0
  42. package/dist/customer-data-redaction.js +22 -0
  43. package/dist/customers/index.d.ts +428 -17
  44. package/dist/customers/index.js +322 -15
  45. package/dist/documents/index.d.ts +513 -16
  46. package/dist/documents/index.js +229 -3
  47. package/dist/events/index.d.ts +259 -0
  48. package/dist/events/index.js +147 -0
  49. package/dist/feeds/ai.d.ts +46 -0
  50. package/dist/feeds/ai.js +43 -0
  51. package/dist/feeds/categories.d.ts +50 -0
  52. package/dist/feeds/categories.js +56 -0
  53. package/dist/feeds/configs.d.ts +54 -0
  54. package/dist/feeds/configs.js +85 -0
  55. package/dist/feeds/identifier-fields.d.ts +25 -0
  56. package/dist/feeds/identifier-fields.js +29 -0
  57. package/dist/feeds/index.d.ts +54 -0
  58. package/dist/feeds/index.js +46 -0
  59. package/dist/feeds/preserve.d.ts +38 -0
  60. package/dist/feeds/preserve.js +74 -0
  61. package/dist/feeds/rules.d.ts +42 -0
  62. package/dist/feeds/rules.js +56 -0
  63. package/dist/feeds/types.d.ts +654 -0
  64. package/dist/feeds/types.js +135 -0
  65. package/dist/fulfillments/index.d.ts +437 -0
  66. package/dist/fulfillments/index.js +534 -0
  67. package/dist/heads/index.d.ts +60 -0
  68. package/dist/heads/index.js +45 -0
  69. package/dist/hooks/assignments.d.ts +90 -0
  70. package/dist/hooks/assignments.js +53 -0
  71. package/dist/hooks/index.d.ts +97 -0
  72. package/dist/hooks/index.js +76 -0
  73. package/dist/index.d.ts +95 -9
  74. package/dist/index.js +21 -1
  75. package/dist/integrations/index.d.ts +14 -0
  76. package/dist/integrations/index.js +9 -0
  77. package/dist/integrations/pipelines.d.ts +113 -0
  78. package/dist/integrations/pipelines.js +62 -0
  79. package/dist/integrations/types.d.ts +176 -0
  80. package/dist/integrations/types.js +8 -0
  81. package/dist/jobs/bulk-action-run.d.ts +74 -0
  82. package/dist/jobs/bulk-action-run.js +69 -0
  83. package/dist/locations/index.d.ts +6 -2
  84. package/dist/meta/index.d.ts +32 -0
  85. package/dist/orders/bulk.d.ts +75 -0
  86. package/dist/orders/bulk.js +150 -0
  87. package/dist/orders/commit-edit.d.ts +123 -0
  88. package/dist/orders/commit-edit.js +142 -0
  89. package/dist/orders/deposit-policy.d.ts +103 -0
  90. package/dist/orders/deposit-policy.js +202 -0
  91. package/dist/orders/get.d.ts +722 -0
  92. package/dist/orders/get.js +530 -0
  93. package/dist/orders/index.d.ts +186 -21
  94. package/dist/orders/index.js +57 -0
  95. package/dist/orders/line-price-preview.d.ts +297 -0
  96. package/dist/orders/line-price-preview.js +50 -0
  97. package/dist/orders/manual-discounts.d.ts +141 -0
  98. package/dist/orders/manual-discounts.js +97 -0
  99. package/dist/orders/manual-pricing.d.ts +192 -0
  100. package/dist/orders/manual-pricing.js +72 -0
  101. package/dist/orders/order-entry.d.ts +566 -0
  102. package/dist/orders/order-entry.js +129 -0
  103. package/dist/orders/parcel-charge.d.ts +45 -0
  104. package/dist/orders/parcel-charge.js +55 -0
  105. package/dist/orders/plan-edit.d.ts +489 -0
  106. package/dist/orders/plan-edit.js +93 -0
  107. package/dist/orders/status.d.ts +235 -0
  108. package/dist/orders/status.js +96 -0
  109. package/dist/orders/surcharges.d.ts +75 -2
  110. package/dist/orders/surcharges.js +110 -4
  111. package/dist/payments/account-credit.d.ts +171 -0
  112. package/dist/payments/account-credit.js +107 -0
  113. package/dist/payments/index.d.ts +241 -9
  114. package/dist/payments/index.js +92 -0
  115. package/dist/payments/methods.d.ts +37 -0
  116. package/dist/payments/methods.js +33 -0
  117. package/dist/platform/catalog.d.ts +148 -0
  118. package/dist/platform/catalog.js +74 -0
  119. package/dist/platform/entitlements.d.ts +111 -0
  120. package/dist/platform/entitlements.js +86 -0
  121. package/dist/platform/legal-entities.d.ts +139 -0
  122. package/dist/platform/legal-entities.js +126 -0
  123. package/dist/platform/legal-entity-numbering.d.ts +103 -0
  124. package/dist/platform/legal-entity-numbering.js +101 -0
  125. package/dist/platform/organization-membership.d.ts +80 -0
  126. package/dist/platform/organization-membership.js +71 -0
  127. package/dist/platform/organization-settings.d.ts +33 -0
  128. package/dist/platform/organization-settings.js +42 -0
  129. package/dist/platform/organization-sharing.d.ts +172 -0
  130. package/dist/platform/organization-sharing.js +120 -0
  131. package/dist/platform/organizations.d.ts +205 -0
  132. package/dist/platform/organizations.js +180 -0
  133. package/dist/platform/provision-store.d.ts +88 -8
  134. package/dist/platform/provision-store.js +12 -0
  135. package/dist/platform/reports.d.ts +46 -0
  136. package/dist/platform/reports.js +31 -0
  137. package/dist/platform/server-metrics.d.ts +58 -0
  138. package/dist/platform/server-metrics.js +11 -0
  139. package/dist/pos/index.d.ts +567 -0
  140. package/dist/pos/index.js +205 -0
  141. package/dist/pricing/index.d.ts +408 -0
  142. package/dist/pricing/index.js +353 -0
  143. package/dist/pricing/vouchers.d.ts +103 -0
  144. package/dist/pricing/vouchers.js +69 -0
  145. package/dist/provenance/index.d.ts +93 -0
  146. package/dist/provenance/index.js +53 -0
  147. package/dist/reports/index.d.ts +199 -0
  148. package/dist/reports/index.js +154 -0
  149. package/dist/returns/index.d.ts +225 -0
  150. package/dist/returns/index.js +160 -0
  151. package/dist/search/index.d.ts +99 -0
  152. package/dist/search/index.js +62 -0
  153. package/dist/shipping/parcel-count-suggestion.d.ts +52 -0
  154. package/dist/shipping/parcel-count-suggestion.js +73 -0
  155. package/dist/shipping/parcel-rule.d.ts +48 -0
  156. package/dist/shipping/parcel-rule.js +91 -0
  157. package/dist/stock/index.d.ts +166 -0
  158. package/dist/stock/index.js +115 -0
  159. package/dist/stock/transfers.d.ts +520 -0
  160. package/dist/stock/transfers.js +437 -0
  161. package/dist/stored-value/index.d.ts +154 -0
  162. package/dist/stored-value/index.js +130 -0
  163. package/dist/tenant/capabilities.d.ts +10 -0
  164. package/dist/tenant/entitlements.d.ts +35 -0
  165. package/dist/tenant/entitlements.js +15 -0
  166. package/dist/tenant/field-groups.d.ts +64 -0
  167. package/dist/tenant/field-groups.js +34 -0
  168. package/dist/tenant/legal-entity.d.ts +32 -0
  169. package/dist/tenant/legal-entity.js +41 -0
  170. package/dist/tenant/notifications.d.ts +148 -0
  171. package/dist/tenant/notifications.js +79 -0
  172. package/dist/tenant/retention.d.ts +10 -4
  173. package/dist/tenant/settings-sources.d.ts +103 -0
  174. package/dist/tenant/settings-sources.js +92 -0
  175. package/dist/types.d.ts +86 -11
  176. package/dist/uploads/index.d.ts +11 -7
  177. package/dist/users/index.d.ts +104 -0
  178. package/dist/users/index.js +80 -0
  179. package/package.json +3 -2
@@ -0,0 +1,234 @@
1
+ import { type Page, type Transport } from '@sixtyninecommerce/core';
2
+ import type { Call } from '../types.js';
3
+ import { type LanguageCode } from './types.js';
4
+ /**
5
+ * The field types a property may have, as the properties plugin stores them.
6
+ * `content_item` and `product` hold a list of ids; the rest hold one value.
7
+ */
8
+ export type PropertyFieldType = string;
9
+ export interface PropertyConfig {
10
+ /** For `enum` / `multi_enum`. */
11
+ options?: Array<{
12
+ value: string;
13
+ label: string;
14
+ }> | null;
15
+ min?: number | null;
16
+ max?: number | null;
17
+ maxLength?: number | null;
18
+ allowedCollectionIds?: string[] | null;
19
+ filterableFieldSlugs?: string[] | null;
20
+ /** Stored verbatim; its keys are the caller's own. */
21
+ productFilter?: unknown;
22
+ }
23
+ export interface Property {
24
+ id: string;
25
+ createdAt: string;
26
+ updatedAt: string;
27
+ /** Unique within the group; the storefront's key for the value. */
28
+ slug: string;
29
+ fieldType: PropertyFieldType;
30
+ /** A filterable property mirrors its values onto a facet (`facetId`). */
31
+ isFilterable: boolean;
32
+ isRequired: boolean;
33
+ position: number;
34
+ config: PropertyConfig | null;
35
+ facetId: string | null;
36
+ translations: Array<{
37
+ id: string;
38
+ languageCode: LanguageCode;
39
+ name: string;
40
+ helpText: string | null;
41
+ }>;
42
+ }
43
+ export interface PropertyGroup {
44
+ id: string;
45
+ createdAt: string;
46
+ updatedAt: string;
47
+ position: number;
48
+ translations: Array<{
49
+ id: string;
50
+ languageCode: LanguageCode;
51
+ name: string;
52
+ }>;
53
+ properties: Property[];
54
+ /**
55
+ * Whether the group, its properties and their values are written from the active channel. False
56
+ * for a workspace group a member store reads on a product it holds from its organization
57
+ * (`values.get`; decision 80): change the group, its properties and its values in the
58
+ * workspace. A `values.set` changing one of its values is refused whole
59
+ * (`MANAGED_BY_ORGANIZATION`); one echoing them unchanged is accepted. `groups.list` answers
60
+ * the store's own groups only, so their `editableHere` is true. Unlike
61
+ * `CatalogueOwnership.editableHere` it ignores the caller's permissions.
62
+ */
63
+ editableHere: boolean;
64
+ }
65
+ /** One stored value. `languageCode` null: a language-neutral value (every non-text type). */
66
+ export interface ProductPropertyValue {
67
+ id: string;
68
+ propertyId: string;
69
+ languageCode: LanguageCode | null;
70
+ /** Stored verbatim — never case-converted by this SDK. */
71
+ value: unknown;
72
+ }
73
+ export interface ProductPropertyGroupValues {
74
+ group: PropertyGroup;
75
+ values: ProductPropertyValue[];
76
+ }
77
+ export interface CreatePropertyGroupInput {
78
+ translations: Array<{
79
+ languageCode: LanguageCode;
80
+ name: string;
81
+ }>;
82
+ position?: number;
83
+ }
84
+ export interface UpdatePropertyGroupInput {
85
+ id: string;
86
+ translations?: Array<{
87
+ languageCode: LanguageCode;
88
+ name: string;
89
+ }>;
90
+ position?: number;
91
+ }
92
+ export interface CreatePropertyInput {
93
+ groupId: string;
94
+ fieldType: PropertyFieldType;
95
+ slug: string;
96
+ isFilterable?: boolean;
97
+ isRequired?: boolean;
98
+ config?: PropertyConfig;
99
+ position?: number;
100
+ translations: Array<{
101
+ languageCode: LanguageCode;
102
+ name: string;
103
+ helpText?: string;
104
+ }>;
105
+ }
106
+ export interface UpdatePropertyInput {
107
+ id: string;
108
+ slug?: string;
109
+ isFilterable?: boolean;
110
+ isRequired?: boolean;
111
+ config?: PropertyConfig;
112
+ position?: number;
113
+ translations?: Array<{
114
+ languageCode: LanguageCode;
115
+ name: string;
116
+ helpText?: string;
117
+ }>;
118
+ }
119
+ export interface SetPropertyValueInput {
120
+ propertyId: string;
121
+ /**
122
+ * The value's language, for a translatable (text) type. Ignored — stored
123
+ * language-neutral — for every other type, whatever is sent.
124
+ */
125
+ languageCode?: LanguageCode | null;
126
+ /** `null` clears it. A single id for a `content_item`/`product` property is stored as a one-item list. */
127
+ value: unknown;
128
+ /** The facet value's label, for a filterable `content_item`/`product` property. */
129
+ displayName?: string;
130
+ /** Per content item, the fields a field-level facet is built from. */
131
+ fieldValues?: Record<string, Record<string, unknown>>;
132
+ }
133
+ /** What {@link CatalogModule.syncContentFacets} did. */
134
+ export interface ContentFacetSyncResult {
135
+ propertyId: string;
136
+ /**
137
+ * How many content items (a `content_item` property) or products (a `product` property) the
138
+ * property's values name. Each was given its current label; 0 when the property names none, and
139
+ * then nothing was written.
140
+ */
141
+ items: number;
142
+ /**
143
+ * The named ids the label source did not answer: a content item that no longer exists, an id
144
+ * that is not one, a product this store does not hold. Their filter values keep the label they
145
+ * have, and a new one is labelled with the id itself.
146
+ */
147
+ unresolved: string[];
148
+ /**
149
+ * How many field-level facets were brought in line with the content items' field values (a
150
+ * `content_item` property whose saved configuration names fields to filter by), else 0.
151
+ */
152
+ fieldFacets: number;
153
+ }
154
+ /**
155
+ * Product properties: typed, grouped attributes a merchant defines once per
156
+ * store and fills per product (the properties plugin). Reading needs
157
+ * `ReadCatalog`; creating `CreateCatalog`, updating (values included)
158
+ * `UpdateCatalog`, deleting `DeleteCatalog`.
159
+ *
160
+ * Refusals of the group and property doors, GraphQL errors mapped by `core`:
161
+ * - `PROPERTY_GROUP_NOT_FOUND` → `NotFoundError` (404): `groups.update`,
162
+ * `create` (its `groupId`), `reorder` (its `groupId`) and `groups.reorder`
163
+ * (any of its ids, all checked before any group moves) name a group this
164
+ * store does not own. An older platform release skips such an id in
165
+ * `groups.reorder` and answers the store's groups as they are.
166
+ * - `PROPERTY_NOT_FOUND` → `NotFoundError` (404): `update` names a property of
167
+ * no group this store owns.
168
+ * - `PROPERTY_FILTERABLE_INVALID` → `ValidationError` (400): `isFilterable` on
169
+ * a field type that cannot carry a facet.
170
+ * - `MANAGED_BY_ORGANIZATION` → `BusinessRuleError` (422): in a store of an
171
+ * organization, any of those doors given a group or property of the
172
+ * workspace's groups it reads (`editableHere` false), `groups.reorder`
173
+ * included: edit it in the workspace.
174
+ *
175
+ * A platform release older than these codes sends them uncoded, as a
176
+ * non-retryable `UpstreamError` (status 500, `GRAPHQL_ERROR`) whose message is
177
+ * the engine's sentence. A delete of a group or property the store does not
178
+ * own is a `ConflictError` (`PROPERTY_GROUP_NOT_DELETED` /
179
+ * `PROPERTY_NOT_DELETED`), or `MANAGED_BY_ORGANIZATION` for the workspace's.
180
+ *
181
+ * `values.set` checks every value before it writes any. It answers
182
+ * `ENTITY_NOT_FOUND` for a product outside this store and for a `propertyId`
183
+ * this store neither owns nor reads. In a store of an organization it
184
+ * ignores an unchanged echo of a workspace property's value, but refuses a
185
+ * change to one with `MANAGED_BY_ORGANIZATION`, and the whole call with it.
186
+ */
187
+ export interface PropertiesModule {
188
+ groups: {
189
+ /** The complete list, as one terminal page — the query takes no paging. */
190
+ list(options?: Call): Promise<Page<PropertyGroup>>;
191
+ get(id: string, options?: Call): Promise<PropertyGroup | null>;
192
+ create(input: CreatePropertyGroupInput, options?: Call): Promise<PropertyGroup>;
193
+ update(input: UpdatePropertyGroupInput, options?: Call): Promise<PropertyGroup>;
194
+ /** Deletes the group AND every property in it, with their values. */
195
+ delete(id: string, options?: Call): Promise<void>;
196
+ /**
197
+ * Pass EVERY group id of the store, in the order wanted. Only the store's own groups:
198
+ * a workspace group (`editableHere` false) or another store's id refuses the whole call.
199
+ */
200
+ reorder(ids: string[], options?: Call): Promise<PropertyGroup[]>;
201
+ };
202
+ create(input: CreatePropertyInput, options?: Call): Promise<Property>;
203
+ update(input: UpdatePropertyInput, options?: Call): Promise<Property>;
204
+ delete(id: string, options?: Call): Promise<void>;
205
+ /** Pass every property id of the group, in the order wanted. */
206
+ reorder(groupId: string, propertyIds: string[], options?: Call): Promise<Property[]>;
207
+ values: {
208
+ /**
209
+ * Every group of the store, each with this product's stored values in every language. For a
210
+ * product the store holds from its organization, the workspace's groups and values come too,
211
+ * with `group.editableHere` false.
212
+ */
213
+ get(productId: string, options?: Call): Promise<ProductPropertyGroupValues[]>;
214
+ /** Upsert the given values; properties not named keep theirs. */
215
+ set(productId: string, values: SetPropertyValueInput[], options?: Call): Promise<void>;
216
+ };
217
+ }
218
+ export declare const PROPERTY_GROUP_FIELDS = "\n id\n createdAt\n updatedAt\n position\n translations {\n id\n languageCode\n name\n }\n properties { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n editableHere\n";
219
+ export declare const PROPERTY_GROUPS_QUERY = "\n query CatalogPropertyGroups {\n propertyGroups { \n id\n createdAt\n updatedAt\n position\n translations {\n id\n languageCode\n name\n }\n properties { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n editableHere\n }\n }\n";
220
+ export declare const PROPERTY_GROUP_QUERY = "\n query CatalogPropertyGroup($id: ID!) {\n propertyGroup(id: $id) { \n id\n createdAt\n updatedAt\n position\n translations {\n id\n languageCode\n name\n }\n properties { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n editableHere\n }\n }\n";
221
+ export declare const CREATE_PROPERTY_GROUP_MUTATION = "\n mutation CatalogCreatePropertyGroup($input: CreatePropertyGroupInput!) {\n createPropertyGroup(input: $input) { \n id\n createdAt\n updatedAt\n position\n translations {\n id\n languageCode\n name\n }\n properties { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n editableHere\n }\n }\n";
222
+ export declare const UPDATE_PROPERTY_GROUP_MUTATION = "\n mutation CatalogUpdatePropertyGroup($input: UpdatePropertyGroupInput!) {\n updatePropertyGroup(input: $input) { \n id\n createdAt\n updatedAt\n position\n translations {\n id\n languageCode\n name\n }\n properties { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n editableHere\n }\n }\n";
223
+ export declare const DELETE_PROPERTY_GROUP_MUTATION = "\n mutation CatalogDeletePropertyGroup($id: ID!) {\n deletePropertyGroup(id: $id) { \n result\n message\n }\n }\n";
224
+ export declare const REORDER_PROPERTY_GROUPS_MUTATION = "\n mutation CatalogReorderPropertyGroups($ids: [ID!]!) {\n reorderPropertyGroups(ids: $ids) { \n id\n createdAt\n updatedAt\n position\n translations {\n id\n languageCode\n name\n }\n properties { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n editableHere\n }\n }\n";
225
+ export declare const CREATE_PROPERTY_MUTATION = "\n mutation CatalogCreateProperty($input: CreatePropertyInput!) {\n createProperty(input: $input) { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n }\n";
226
+ export declare const UPDATE_PROPERTY_MUTATION = "\n mutation CatalogUpdateProperty($input: UpdatePropertyInput!) {\n updateProperty(input: $input) { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n }\n";
227
+ export declare const DELETE_PROPERTY_MUTATION = "\n mutation CatalogDeleteProperty($id: ID!) {\n deleteProperty(id: $id) { \n result\n message\n }\n }\n";
228
+ export declare const REORDER_PROPERTIES_MUTATION = "\n mutation CatalogReorderProperties($groupId: ID!, $propertyIds: [ID!]!) {\n reorderProperties(groupId: $groupId, propertyIds: $propertyIds) { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n }\n";
229
+ export declare const PRODUCT_PROPERTY_VALUES_QUERY = "\n query CatalogProductPropertyValues($productId: ID!) {\n productPropertyValues(productId: $productId) {\n group { \n id\n createdAt\n updatedAt\n position\n translations {\n id\n languageCode\n name\n }\n properties { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n editableHere\n }\n values {\n id\n propertyId\n languageCode\n value\n }\n }\n }\n";
230
+ export declare const SET_PRODUCT_PROPERTY_VALUES_MUTATION = "\n mutation CatalogSetProductPropertyValues($productId: ID!, $values: [SetProductPropertyValueInput!]!) {\n setProductPropertyValues(productId: $productId, values: $values)\n }\n";
231
+ export declare const SYNC_PROPERTY_FACETS_MUTATION = "\n mutation CatalogSyncPropertyFacets($propertyId: ID!) {\n syncPropertyFacets(propertyId: $propertyId) {\n propertyId\n items\n unresolved\n fieldFacets\n }\n }\n";
232
+ /** `catalog.syncContentFacets`; its contract is on {@link CatalogModule.syncContentFacets}. */
233
+ export declare function syncContentFacets(transport: Transport, propertyId: string, options?: Call): Promise<ContentFacetSyncResult>;
234
+ export declare function createPropertiesModule(transport: Transport): PropertiesModule;
@@ -0,0 +1,158 @@
1
+ import { createPage } from '@sixtyninecommerce/core';
2
+ import { assertDeleted, DELETION_FIELDS, fieldOf, } from './types.js';
3
+ const PROPERTY_FIELDS = /* GraphQL */ `
4
+ id
5
+ createdAt
6
+ updatedAt
7
+ slug
8
+ fieldType
9
+ isFilterable
10
+ isRequired
11
+ position
12
+ config {
13
+ options {
14
+ value
15
+ label
16
+ }
17
+ min
18
+ max
19
+ maxLength
20
+ allowedCollectionIds
21
+ filterableFieldSlugs
22
+ productFilter
23
+ }
24
+ facetId
25
+ translations {
26
+ id
27
+ languageCode
28
+ name
29
+ helpText
30
+ }
31
+ `;
32
+ export const PROPERTY_GROUP_FIELDS = /* GraphQL */ `
33
+ id
34
+ createdAt
35
+ updatedAt
36
+ position
37
+ translations {
38
+ id
39
+ languageCode
40
+ name
41
+ }
42
+ properties { ${PROPERTY_FIELDS} }
43
+ editableHere
44
+ `;
45
+ export const PROPERTY_GROUPS_QUERY = /* GraphQL */ `
46
+ query CatalogPropertyGroups {
47
+ propertyGroups { ${PROPERTY_GROUP_FIELDS} }
48
+ }
49
+ `;
50
+ export const PROPERTY_GROUP_QUERY = /* GraphQL */ `
51
+ query CatalogPropertyGroup($id: ID!) {
52
+ propertyGroup(id: $id) { ${PROPERTY_GROUP_FIELDS} }
53
+ }
54
+ `;
55
+ export const CREATE_PROPERTY_GROUP_MUTATION = /* GraphQL */ `
56
+ mutation CatalogCreatePropertyGroup($input: CreatePropertyGroupInput!) {
57
+ createPropertyGroup(input: $input) { ${PROPERTY_GROUP_FIELDS} }
58
+ }
59
+ `;
60
+ export const UPDATE_PROPERTY_GROUP_MUTATION = /* GraphQL */ `
61
+ mutation CatalogUpdatePropertyGroup($input: UpdatePropertyGroupInput!) {
62
+ updatePropertyGroup(input: $input) { ${PROPERTY_GROUP_FIELDS} }
63
+ }
64
+ `;
65
+ export const DELETE_PROPERTY_GROUP_MUTATION = /* GraphQL */ `
66
+ mutation CatalogDeletePropertyGroup($id: ID!) {
67
+ deletePropertyGroup(id: $id) { ${DELETION_FIELDS} }
68
+ }
69
+ `;
70
+ export const REORDER_PROPERTY_GROUPS_MUTATION = /* GraphQL */ `
71
+ mutation CatalogReorderPropertyGroups($ids: [ID!]!) {
72
+ reorderPropertyGroups(ids: $ids) { ${PROPERTY_GROUP_FIELDS} }
73
+ }
74
+ `;
75
+ export const CREATE_PROPERTY_MUTATION = /* GraphQL */ `
76
+ mutation CatalogCreateProperty($input: CreatePropertyInput!) {
77
+ createProperty(input: $input) { ${PROPERTY_FIELDS} }
78
+ }
79
+ `;
80
+ export const UPDATE_PROPERTY_MUTATION = /* GraphQL */ `
81
+ mutation CatalogUpdateProperty($input: UpdatePropertyInput!) {
82
+ updateProperty(input: $input) { ${PROPERTY_FIELDS} }
83
+ }
84
+ `;
85
+ export const DELETE_PROPERTY_MUTATION = /* GraphQL */ `
86
+ mutation CatalogDeleteProperty($id: ID!) {
87
+ deleteProperty(id: $id) { ${DELETION_FIELDS} }
88
+ }
89
+ `;
90
+ export const REORDER_PROPERTIES_MUTATION = /* GraphQL */ `
91
+ mutation CatalogReorderProperties($groupId: ID!, $propertyIds: [ID!]!) {
92
+ reorderProperties(groupId: $groupId, propertyIds: $propertyIds) { ${PROPERTY_FIELDS} }
93
+ }
94
+ `;
95
+ export const PRODUCT_PROPERTY_VALUES_QUERY = /* GraphQL */ `
96
+ query CatalogProductPropertyValues($productId: ID!) {
97
+ productPropertyValues(productId: $productId) {
98
+ group { ${PROPERTY_GROUP_FIELDS} }
99
+ values {
100
+ id
101
+ propertyId
102
+ languageCode
103
+ value
104
+ }
105
+ }
106
+ }
107
+ `;
108
+ export const SET_PRODUCT_PROPERTY_VALUES_MUTATION = /* GraphQL */ `
109
+ mutation CatalogSetProductPropertyValues($productId: ID!, $values: [SetProductPropertyValueInput!]!) {
110
+ setProductPropertyValues(productId: $productId, values: $values)
111
+ }
112
+ `;
113
+ export const SYNC_PROPERTY_FACETS_MUTATION = /* GraphQL */ `
114
+ mutation CatalogSyncPropertyFacets($propertyId: ID!) {
115
+ syncPropertyFacets(propertyId: $propertyId) {
116
+ propertyId
117
+ items
118
+ unresolved
119
+ fieldFacets
120
+ }
121
+ }
122
+ `;
123
+ /** `catalog.syncContentFacets`; its contract is on {@link CatalogModule.syncContentFacets}. */
124
+ export function syncContentFacets(transport, propertyId, options) {
125
+ return fieldOf(transport, SYNC_PROPERTY_FACETS_MUTATION, 'syncPropertyFacets', { propertyId }, options);
126
+ }
127
+ export function createPropertiesModule(transport) {
128
+ const call = (document, field, variables, options) => fieldOf(transport, document, field, variables, options);
129
+ const deleted = async (document, field, code, id, options) => {
130
+ assertDeleted(code, [await call(document, field, { id }, options)]);
131
+ };
132
+ return {
133
+ groups: {
134
+ async list(options) {
135
+ const items = await call(PROPERTY_GROUPS_QUERY, 'propertyGroups', {}, options);
136
+ return createPage(items, { nextCursor: null, hasNext: false, total: items.length }, () => {
137
+ // Unreachable while `hasNext` is false — `Page.next()` short-circuits.
138
+ throw new Error('propertyGroups returns a complete list; there is no next page');
139
+ });
140
+ },
141
+ get: (id, options) => call(PROPERTY_GROUP_QUERY, 'propertyGroup', { id }, options),
142
+ create: (input, options) => call(CREATE_PROPERTY_GROUP_MUTATION, 'createPropertyGroup', { input }, options),
143
+ update: (input, options) => call(UPDATE_PROPERTY_GROUP_MUTATION, 'updatePropertyGroup', { input }, options),
144
+ delete: (id, options) => deleted(DELETE_PROPERTY_GROUP_MUTATION, 'deletePropertyGroup', 'PROPERTY_GROUP_NOT_DELETED', id, options),
145
+ reorder: (ids, options) => call(REORDER_PROPERTY_GROUPS_MUTATION, 'reorderPropertyGroups', { ids }, options),
146
+ },
147
+ create: (input, options) => call(CREATE_PROPERTY_MUTATION, 'createProperty', { input }, options),
148
+ update: (input, options) => call(UPDATE_PROPERTY_MUTATION, 'updateProperty', { input }, options),
149
+ delete: (id, options) => deleted(DELETE_PROPERTY_MUTATION, 'deleteProperty', 'PROPERTY_NOT_DELETED', id, options),
150
+ reorder: (groupId, propertyIds, options) => call(REORDER_PROPERTIES_MUTATION, 'reorderProperties', { groupId, propertyIds }, options),
151
+ values: {
152
+ get: (productId, options) => call(PRODUCT_PROPERTY_VALUES_QUERY, 'productPropertyValues', { productId }, options),
153
+ async set(productId, values, options) {
154
+ await call(SET_PRODUCT_PROPERTY_VALUES_MUTATION, 'setProductPropertyValues', { productId, values }, options);
155
+ },
156
+ },
157
+ };
158
+ }
@@ -0,0 +1,174 @@
1
+ import { type Page, type Transport } from '@sixtyninecommerce/core';
2
+ import type { Call, ListOptions } from '../types.js';
3
+ /** A language code as Vendure spells it: `en`, `nl`, `pt_BR`. */
4
+ export type LanguageCode = string;
5
+ /** An asset as the catalog projects it — enough to render and to re-assign it. */
6
+ export interface AssetRef {
7
+ id: string;
8
+ name: string;
9
+ /** A preview URL the asset server scales; absolute or relative to the engine. */
10
+ preview: string;
11
+ source: string;
12
+ }
13
+ export interface FacetValueRef {
14
+ id: string;
15
+ code: string;
16
+ name: string;
17
+ facet: {
18
+ id: string;
19
+ code: string;
20
+ name: string;
21
+ };
22
+ }
23
+ /**
24
+ * A product's own availability (the pre-order engine, merged 2026-09-18).
25
+ *
26
+ * - `none` — ordinary stock rules.
27
+ * - `comingSoon` — shown, but nobody can order it, not even from stock.
28
+ * - `preorder` — customers allowed to backorder may order beyond stock; everyone
29
+ * else can still buy what is in stock.
30
+ */
31
+ export type ProductAvailabilityState = 'none' | 'comingSoon' | 'preorder';
32
+ /** A variant's: the product's states plus `inherit` (use the product's state, date and limit). */
33
+ export type VariantAvailabilityState = 'inherit' | ProductAvailabilityState;
34
+ /**
35
+ * Availability fields as they are READ. Every writer shares one shape: a state
36
+ * that is not `inherit` uses this row's own `availableFrom` and `preorderLimit`,
37
+ * empty ones included.
38
+ */
39
+ export interface Availability<State extends string> {
40
+ availabilityState: State;
41
+ /**
42
+ * ISO-8601 UTC instant at which the state ends on its own — from then on the
43
+ * ordinary stock and backorder rules apply again. Null: it ends by hand.
44
+ */
45
+ availableFrom: string | null;
46
+ /**
47
+ * Under `preorder`: the most units per variant that may be pre-ordered beyond
48
+ * stock across all open orders. Null: no limit. Ignored under every other
49
+ * state.
50
+ */
51
+ preorderLimit: number | null;
52
+ }
53
+ /**
54
+ * Availability fields as they are WRITTEN. Omit a field to leave it alone, pass
55
+ * null to clear it.
56
+ */
57
+ export interface AvailabilityInput<State extends string> {
58
+ availabilityState?: State;
59
+ /**
60
+ * An ISO-8601 instant WITH an explicit offset (`Z` or `±HH:mm`). One without
61
+ * is refused before the request leaves (`INVALID_DATETIME`), because the
62
+ * engine would read it in its own zone, not yours or the store's.
63
+ */
64
+ availableFrom?: string | null;
65
+ /** A whole number ≥ 0, or null for no limit. */
66
+ preorderLimit?: number | null;
67
+ }
68
+ /**
69
+ * A price the caller STATES. `basis` says which side of tax the amount is on,
70
+ * and must equal the store's own (`pricesIncludeTax`): the Admin API stores
71
+ * one amount in the store's basis and derives the other, so a net amount
72
+ * written into a gross store would silently lose a whole VAT rate. A mismatch
73
+ * is refused (`PRICE_BASIS_MISMATCH`) — the SDK never converts, because the
74
+ * rate that would convert it depends on the zone of each order.
75
+ */
76
+ export type PriceBasis = 'net' | 'gross';
77
+ /** Omit a key to leave it; unknown keys are not accepted by the Admin API. */
78
+ export interface TranslationInput {
79
+ languageCode: LanguageCode;
80
+ /** Present on update to edit that translation row rather than add one. */
81
+ id?: string;
82
+ }
83
+ /** Vendure's `ConfigurableOperationInput`: a collection filter, a promotion action. */
84
+ export interface ConfigurableOperationInput {
85
+ code: string;
86
+ /** Every argument is a STRING on the wire — lists and booleans JSON-encoded. */
87
+ arguments: Array<{
88
+ name: string;
89
+ value: string;
90
+ }>;
91
+ }
92
+ /** Vendure's `ConfigurableOperation`, as read back. */
93
+ export interface ConfigurableOperation {
94
+ code: string;
95
+ args: Array<{
96
+ name: string;
97
+ value: string;
98
+ }>;
99
+ }
100
+ /**
101
+ * Whose catalogue a row belongs to, as the ACTIVE channel sees it (multi-region spec §5.4):
102
+ * - `LOCAL` — the store's own row, or a row its organization keeps but has not shared yet.
103
+ * - `SHARED` — kept by the organization and shared: in a member store, a row of its
104
+ * organization's workspace; in the workspace, a row at least one member store holds.
105
+ *
106
+ * A string on the wire: a newer engine may answer a state this SDK does not name yet.
107
+ */
108
+ export type CatalogueOwnershipState = 'LOCAL' | 'SHARED';
109
+ export interface CatalogueOwnership {
110
+ state: CatalogueOwnershipState | (string & {});
111
+ /** The organization that keeps the row while it is `SHARED`; null while `LOCAL`. */
112
+ organizationName: string | null;
113
+ /**
114
+ * Whether the caller may change the row from the active channel: it holds the update permission
115
+ * here and on every other store holding the row, and, in a member store, a `SHARED` row is
116
+ * changed only in its organization's workspace, by everyone (a write from the store is refused
117
+ * `MANAGED_BY_ORGANIZATION`). A store's own values on a shared row (its prices, its exclusion)
118
+ * stay the store's to change. Disable an edit form on `false`; the engine refuses it anyway.
119
+ */
120
+ editableHere: boolean;
121
+ }
122
+ /** `catalogueOwnership` on the top-level row of each catalogue read (never on nested refs). */
123
+ export declare const CATALOGUE_OWNERSHIP_FIELDS = "\n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n";
124
+ export declare const ASSET_REF_FIELDS = "\n id\n name\n preview\n source\n";
125
+ export declare const FACET_VALUE_REF_FIELDS = "\n id\n code\n name\n facet {\n id\n code\n name\n }\n";
126
+ /**
127
+ * Refuse a datetime with no offset, or one that is not a date at all (spec
128
+ * §9.3). Returns the value unchanged — the engine stores the instant, and
129
+ * re-serialising it here would only risk changing its precision.
130
+ */
131
+ export declare function assertInstant(field: string, value: string | null | undefined): void;
132
+ /**
133
+ * Split an availability input into the custom fields the Admin API takes. Only
134
+ * PRESENT keys are copied — an omitted field must reach the server as omitted,
135
+ * never as null, or a partial update would clear it.
136
+ */
137
+ export declare function availabilityCustomFields<State extends string>(input: AvailabilityInput<State>): Record<string, unknown>;
138
+ /** Vendure's `DeletionResponse`. */
139
+ export interface DeletionResponse {
140
+ result: 'DELETED' | 'NOT_DELETED';
141
+ message?: string | null;
142
+ }
143
+ export declare const DELETION_FIELDS = "\n result\n message\n";
144
+ /**
145
+ * `NOT_DELETED` arrives at HTTP 200 with no error, so a caller awaiting a void
146
+ * promise would read a refusal as success. It becomes a `ConflictError`
147
+ * carrying the server's own sentence ("The FacetValue … is assigned to 3
148
+ * Products").
149
+ */
150
+ export declare function assertDeleted(code: string, responses: DeletionResponse[]): void;
151
+ /** Throw a Vendure ErrorResult (`MimeTypeError`, `ProductOptionInUseError`) as itself. */
152
+ export declare function unwrapResult<T>(value: T | {
153
+ errorCode: string;
154
+ message: string;
155
+ }): T;
156
+ export declare const DEFAULT_PAGE_SIZE = 25;
157
+ /** Vendure's `adminListQueryLimit` default; a larger `take` is refused by the engine. */
158
+ export declare const MAX_PAGE_SIZE = 1000;
159
+ /**
160
+ * Wrap one of Vendure's `skip/take` lists in a `Page<T>`. The offset hides
161
+ * inside the cursor (spec §9.3), and every following page re-sends the same
162
+ * filter, sort and per-call options — a page that forgot its tenant would walk
163
+ * another store's catalogue.
164
+ */
165
+ export declare function vendureListPage<W, T = W>(transport: Transport, document: string, field: string, variables: (skip: number, take: number) => Record<string, unknown>, options: ListOptions | undefined, map?: (wire: W) => T): Promise<Page<T>>;
166
+ /**
167
+ * Run one Admin API document and answer its single root field — the shape of
168
+ * almost every catalog call. The field is read by NAME from the response, so a
169
+ * document and its field name must be kept in step: an ABSENT field is refused
170
+ * rather than answered as `undefined` (a null one is a real answer), and
171
+ * `catalog-call-sites.spec.ts` drives every call site with a responder keyed
172
+ * on the document's own root field.
173
+ */
174
+ export declare function fieldOf<T>(transport: Transport, document: string, field: string, variables: Record<string, unknown>, options: Call | undefined): Promise<T>;