@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,38 @@
1
+ /**
2
+ * Every feeds key whose VALUE is data rather than DTO shape.
3
+ *
4
+ * Two families, both fatal if converted:
5
+ *
6
+ * 1. **The jsonb rule columns** (`*_json`) and the destination template's
7
+ * `default_source`. They hold a rule AST the platform stores and echoes
8
+ * byte-for-byte, and that AST is camelCase on purpose (`tableName`,
9
+ * `maxLen`, `caseInsensitive`, `excludeOutOfStock`). Converting a REQUEST
10
+ * would send `table_name` and save a lookup rule the compiler then resolves
11
+ * to nothing; converting a RESPONSE would hand the rule builder a node it
12
+ * cannot render. `stats_json` is here for the same reason — the generator
13
+ * writes `issueCounts`/`languageCode` into it — and, like `issue_counts`
14
+ * below, its counters are keyed by ISSUE CODE.
15
+ * 2. **The identifier-keyed maps.** `values` is keyed by feed target
16
+ * (`g:id`, `custom_label_0`), `applied_internal` by internal-field name
17
+ * (`^[a-z][a-z0-9_]*$`), `issue_counts` by issue code (`no_category`). Those
18
+ * keys are values in every sense that matters: `custom_label_0` camelises to
19
+ * `customLabel0` and never comes back, so a preview row would report totals
20
+ * under names no template, rule or issue filter knows.
21
+ *
22
+ * Both spellings of every name are listed because this set is used on both
23
+ * sides of the conversion — `case.ts` matches the key before OR after the
24
+ * rename, so a caller need not know which direction it is in.
25
+ */
26
+ export declare const FEEDS_PRESERVE_KEYS: ReadonlySet<string>;
27
+ /**
28
+ * Drop what the feeds query DTOs refuse.
29
+ *
30
+ * `undefined` the transport already skips; `''` it does not, and every feeds
31
+ * filter is `@Length(1, …)` or `@IsIn(...)` — so a cleared search box would
32
+ * turn a working list into a 400. `false` and `0` are KEPT: `?enabled=false` is
33
+ * a real filter, and dropping falsy-but-valid values is the classic way one
34
+ * silently stops working.
35
+ */
36
+ export declare function feedQuery(params: Record<string, string | number | boolean | undefined>): Record<string, string | number | boolean | undefined>;
37
+ /** Path-safe id segment. Ids are uuids, but a URL is never built by concatenation. */
38
+ export declare function segment(value: string): string;
@@ -0,0 +1,74 @@
1
+ import { PLATFORM_PASSTHROUGH_KEYS } from '@sixtyninecommerce/core';
2
+ /**
3
+ * Every feeds key whose VALUE is data rather than DTO shape.
4
+ *
5
+ * Two families, both fatal if converted:
6
+ *
7
+ * 1. **The jsonb rule columns** (`*_json`) and the destination template's
8
+ * `default_source`. They hold a rule AST the platform stores and echoes
9
+ * byte-for-byte, and that AST is camelCase on purpose (`tableName`,
10
+ * `maxLen`, `caseInsensitive`, `excludeOutOfStock`). Converting a REQUEST
11
+ * would send `table_name` and save a lookup rule the compiler then resolves
12
+ * to nothing; converting a RESPONSE would hand the rule builder a node it
13
+ * cannot render. `stats_json` is here for the same reason — the generator
14
+ * writes `issueCounts`/`languageCode` into it — and, like `issue_counts`
15
+ * below, its counters are keyed by ISSUE CODE.
16
+ * 2. **The identifier-keyed maps.** `values` is keyed by feed target
17
+ * (`g:id`, `custom_label_0`), `applied_internal` by internal-field name
18
+ * (`^[a-z][a-z0-9_]*$`), `issue_counts` by issue code (`no_category`). Those
19
+ * keys are values in every sense that matters: `custom_label_0` camelises to
20
+ * `customLabel0` and never comes back, so a preview row would report totals
21
+ * under names no template, rule or issue filter knows.
22
+ *
23
+ * Both spellings of every name are listed because this set is used on both
24
+ * sides of the conversion — `case.ts` matches the key before OR after the
25
+ * rename, so a caller need not know which direction it is in.
26
+ */
27
+ export const FEEDS_PRESERVE_KEYS = new Set([
28
+ ...PLATFORM_PASSTHROUGH_KEYS,
29
+ 'filters_json',
30
+ 'filtersJson',
31
+ 'mapping_json',
32
+ 'mappingJson',
33
+ 'settings_json',
34
+ 'settingsJson',
35
+ 'rules_json',
36
+ 'rulesJson',
37
+ 'entries_json',
38
+ 'entriesJson',
39
+ 'per_destination_json',
40
+ 'perDestinationJson',
41
+ 'payload_json',
42
+ 'payloadJson',
43
+ 'stats_json',
44
+ 'statsJson',
45
+ 'default_source',
46
+ 'defaultSource',
47
+ 'values',
48
+ 'applied_internal',
49
+ 'appliedInternal',
50
+ 'issue_counts',
51
+ 'issueCounts',
52
+ ]);
53
+ /**
54
+ * Drop what the feeds query DTOs refuse.
55
+ *
56
+ * `undefined` the transport already skips; `''` it does not, and every feeds
57
+ * filter is `@Length(1, …)` or `@IsIn(...)` — so a cleared search box would
58
+ * turn a working list into a 400. `false` and `0` are KEPT: `?enabled=false` is
59
+ * a real filter, and dropping falsy-but-valid values is the classic way one
60
+ * silently stops working.
61
+ */
62
+ export function feedQuery(params) {
63
+ const out = {};
64
+ for (const [key, value] of Object.entries(params)) {
65
+ if (value === undefined || value === '')
66
+ continue;
67
+ out[key] = value;
68
+ }
69
+ return out;
70
+ }
71
+ /** Path-safe id segment. Ids are uuids, but a URL is never built by concatenation. */
72
+ export function segment(value) {
73
+ return encodeURIComponent(value);
74
+ }
@@ -0,0 +1,42 @@
1
+ import { type Page, type Transport } from '@sixtyninecommerce/core';
2
+ import type { Call, ListOptions } from '../types.js';
3
+ import type { CreateFeedInternalFieldInput, CreateFeedLookupTableInput, FeedInternalField, FeedLookupTable, UpdateFeedInternalFieldInput, UpdateFeedLookupTableInput } from './types.js';
4
+ /**
5
+ * Channel-scoped computed values that mapping rules reference as
6
+ * `internal:<name>`.
7
+ *
8
+ * `position` is SERVER-assigned and always a dense `0..n-1` sequence: a create
9
+ * or update may ask for an index, and the service re-indexes the channel around
10
+ * it. A field may only read fields at a strictly lower position, so moving one
11
+ * can invalidate a rule that referenced it.
12
+ *
13
+ * Deleting a field still referenced by a rule is refused with a 409
14
+ * (`FIELD_IN_USE`); the refusal names the referencing rule.
15
+ */
16
+ export interface FeedInternalFieldsModule {
17
+ list(options?: ListOptions): Promise<Page<FeedInternalField>>;
18
+ get(id: string, options?: Call): Promise<FeedInternalField>;
19
+ create(input: CreateFeedInternalFieldInput, options?: Call): Promise<FeedInternalField>;
20
+ update(id: string, input: UpdateFeedInternalFieldInput, options?: Call): Promise<FeedInternalField>;
21
+ delete(id: string, options?: Call): Promise<void>;
22
+ }
23
+ /**
24
+ * Named, ordered substitution tables referenced by
25
+ * `{ kind: 'lookup', tableName }`. First match wins; a miss yields the empty
26
+ * string, never the input.
27
+ *
28
+ * `entriesJson` is replaced WHOLESALE on update — a table is one document, not
29
+ * a collection of addressable rows — so send the full list, never a delta. A
30
+ * rename or a delete is refused with a 409 (`TABLE_IN_USE`) while any rule in
31
+ * the channel still points at it: a lookup through a missing table blanks a
32
+ * field in a live feed.
33
+ */
34
+ export interface FeedLookupTablesModule {
35
+ list(options?: ListOptions): Promise<Page<FeedLookupTable>>;
36
+ get(id: string, options?: Call): Promise<FeedLookupTable>;
37
+ create(input: CreateFeedLookupTableInput, options?: Call): Promise<FeedLookupTable>;
38
+ update(id: string, input: UpdateFeedLookupTableInput, options?: Call): Promise<FeedLookupTable>;
39
+ delete(id: string, options?: Call): Promise<void>;
40
+ }
41
+ export declare function createFeedInternalFieldsModule(transport: Transport): FeedInternalFieldsModule;
42
+ export declare function createFeedLookupTablesModule(transport: Transport): FeedLookupTablesModule;
@@ -0,0 +1,56 @@
1
+ import { createPage, readRestPage } from '@sixtyninecommerce/core';
2
+ import { FEEDS_PRESERVE_KEYS, feedQuery, segment } from './preserve.js';
3
+ const INTERNAL_FIELDS = '/feeds/internal-fields';
4
+ const LOOKUP_TABLES = '/feeds/lookup-tables';
5
+ export function createFeedInternalFieldsModule(transport) {
6
+ async function list(options) {
7
+ const body = await transport.rest('plugins', {
8
+ method: 'GET',
9
+ path: INTERNAL_FIELDS,
10
+ query: feedQuery({ limit: options?.limit, after: options?.after }),
11
+ }, { ...options, preserveKeys: FEEDS_PRESERVE_KEYS });
12
+ const { items, meta } = readRestPage(body);
13
+ return createPage(items, meta, (cursor) => list({ ...options, after: cursor }));
14
+ }
15
+ return {
16
+ list,
17
+ get(id, options) {
18
+ return transport.rest('plugins', { method: 'GET', path: `${INTERNAL_FIELDS}/${segment(id)}` }, { ...options, preserveKeys: FEEDS_PRESERVE_KEYS });
19
+ },
20
+ create(input, options) {
21
+ return transport.rest('plugins', { method: 'POST', path: INTERNAL_FIELDS, body: input }, { ...options, preserveKeys: FEEDS_PRESERVE_KEYS });
22
+ },
23
+ update(id, input, options) {
24
+ return transport.rest('plugins', { method: 'PATCH', path: `${INTERNAL_FIELDS}/${segment(id)}`, body: input }, { ...options, preserveKeys: FEEDS_PRESERVE_KEYS });
25
+ },
26
+ async delete(id, options) {
27
+ await transport.rest('plugins', { method: 'DELETE', path: `${INTERNAL_FIELDS}/${segment(id)}`, expect: 'void' }, options);
28
+ },
29
+ };
30
+ }
31
+ export function createFeedLookupTablesModule(transport) {
32
+ async function list(options) {
33
+ const body = await transport.rest('plugins', {
34
+ method: 'GET',
35
+ path: LOOKUP_TABLES,
36
+ query: feedQuery({ limit: options?.limit, after: options?.after }),
37
+ }, { ...options, preserveKeys: FEEDS_PRESERVE_KEYS });
38
+ const { items, meta } = readRestPage(body);
39
+ return createPage(items, meta, (cursor) => list({ ...options, after: cursor }));
40
+ }
41
+ return {
42
+ list,
43
+ get(id, options) {
44
+ return transport.rest('plugins', { method: 'GET', path: `${LOOKUP_TABLES}/${segment(id)}` }, { ...options, preserveKeys: FEEDS_PRESERVE_KEYS });
45
+ },
46
+ create(input, options) {
47
+ return transport.rest('plugins', { method: 'POST', path: LOOKUP_TABLES, body: input }, { ...options, preserveKeys: FEEDS_PRESERVE_KEYS });
48
+ },
49
+ update(id, input, options) {
50
+ return transport.rest('plugins', { method: 'PATCH', path: `${LOOKUP_TABLES}/${segment(id)}`, body: input }, { ...options, preserveKeys: FEEDS_PRESERVE_KEYS });
51
+ },
52
+ async delete(id, options) {
53
+ await transport.rest('plugins', { method: 'DELETE', path: `${LOOKUP_TABLES}/${segment(id)}`, expect: 'void' }, options);
54
+ },
55
+ };
56
+ }