@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.
- package/README.md +2739 -17
- package/dist/api-tokens/index.d.ts +15 -5
- package/dist/api-tokens/index.js +1 -0
- package/dist/apps/event-subscription.d.ts +59 -0
- package/dist/apps/event-subscription.js +32 -0
- package/dist/apps/hook-secret.d.ts +22 -0
- package/dist/apps/hook-secret.js +36 -0
- package/dist/apps/index.d.ts +54 -3
- package/dist/apps/index.js +17 -0
- package/dist/audit/index.d.ts +7 -0
- package/dist/auth/queries.d.ts +5 -1
- package/dist/auth/queries.js +6 -0
- package/dist/bulk/index.d.ts +323 -0
- package/dist/bulk/index.js +162 -0
- package/dist/catalog/assets.d.ts +147 -0
- package/dist/catalog/assets.js +164 -0
- package/dist/catalog/collections.d.ts +109 -0
- package/dist/catalog/collections.js +91 -0
- package/dist/catalog/facets.d.ts +103 -0
- package/dist/catalog/facets.js +100 -0
- package/dist/catalog/index.d.ts +115 -0
- package/dist/catalog/index.js +21 -0
- package/dist/catalog/options.d.ts +89 -0
- package/dist/catalog/options.js +88 -0
- package/dist/catalog/products-bulk.d.ts +21 -0
- package/dist/catalog/products-bulk.js +58 -0
- package/dist/catalog/products.d.ts +650 -0
- package/dist/catalog/products.js +458 -0
- package/dist/catalog/properties.d.ts +234 -0
- package/dist/catalog/properties.js +158 -0
- package/dist/catalog/types.d.ts +174 -0
- package/dist/catalog/types.js +141 -0
- package/dist/catalog/variants.d.ts +324 -0
- package/dist/catalog/variants.js +288 -0
- package/dist/catalog/visibility.d.ts +57 -0
- package/dist/catalog/visibility.js +59 -0
- package/dist/client.d.ts +192 -3
- package/dist/client.js +87 -12
- package/dist/compliance/index.d.ts +88 -0
- package/dist/compliance/index.js +88 -0
- package/dist/customer-data-redaction.d.ts +14 -0
- package/dist/customer-data-redaction.js +22 -0
- package/dist/customers/index.d.ts +428 -17
- package/dist/customers/index.js +322 -15
- package/dist/documents/index.d.ts +513 -16
- package/dist/documents/index.js +229 -3
- package/dist/events/index.d.ts +259 -0
- package/dist/events/index.js +147 -0
- package/dist/feeds/ai.d.ts +46 -0
- package/dist/feeds/ai.js +43 -0
- package/dist/feeds/categories.d.ts +50 -0
- package/dist/feeds/categories.js +56 -0
- package/dist/feeds/configs.d.ts +54 -0
- package/dist/feeds/configs.js +85 -0
- package/dist/feeds/identifier-fields.d.ts +25 -0
- package/dist/feeds/identifier-fields.js +29 -0
- package/dist/feeds/index.d.ts +54 -0
- package/dist/feeds/index.js +46 -0
- package/dist/feeds/preserve.d.ts +38 -0
- package/dist/feeds/preserve.js +74 -0
- package/dist/feeds/rules.d.ts +42 -0
- package/dist/feeds/rules.js +56 -0
- package/dist/feeds/types.d.ts +654 -0
- package/dist/feeds/types.js +135 -0
- package/dist/fulfillments/index.d.ts +437 -0
- package/dist/fulfillments/index.js +534 -0
- package/dist/heads/index.d.ts +60 -0
- package/dist/heads/index.js +45 -0
- package/dist/hooks/assignments.d.ts +90 -0
- package/dist/hooks/assignments.js +53 -0
- package/dist/hooks/index.d.ts +97 -0
- package/dist/hooks/index.js +76 -0
- package/dist/index.d.ts +95 -9
- package/dist/index.js +21 -1
- package/dist/integrations/index.d.ts +14 -0
- package/dist/integrations/index.js +9 -0
- package/dist/integrations/pipelines.d.ts +113 -0
- package/dist/integrations/pipelines.js +62 -0
- package/dist/integrations/types.d.ts +176 -0
- package/dist/integrations/types.js +8 -0
- package/dist/jobs/bulk-action-run.d.ts +74 -0
- package/dist/jobs/bulk-action-run.js +69 -0
- package/dist/locations/index.d.ts +6 -2
- package/dist/meta/index.d.ts +32 -0
- package/dist/orders/bulk.d.ts +75 -0
- package/dist/orders/bulk.js +150 -0
- package/dist/orders/commit-edit.d.ts +123 -0
- package/dist/orders/commit-edit.js +142 -0
- package/dist/orders/deposit-policy.d.ts +103 -0
- package/dist/orders/deposit-policy.js +202 -0
- package/dist/orders/get.d.ts +722 -0
- package/dist/orders/get.js +530 -0
- package/dist/orders/index.d.ts +186 -21
- package/dist/orders/index.js +57 -0
- package/dist/orders/line-price-preview.d.ts +297 -0
- package/dist/orders/line-price-preview.js +50 -0
- package/dist/orders/manual-discounts.d.ts +141 -0
- package/dist/orders/manual-discounts.js +97 -0
- package/dist/orders/manual-pricing.d.ts +192 -0
- package/dist/orders/manual-pricing.js +72 -0
- package/dist/orders/order-entry.d.ts +566 -0
- package/dist/orders/order-entry.js +129 -0
- package/dist/orders/parcel-charge.d.ts +45 -0
- package/dist/orders/parcel-charge.js +55 -0
- package/dist/orders/plan-edit.d.ts +489 -0
- package/dist/orders/plan-edit.js +93 -0
- package/dist/orders/status.d.ts +235 -0
- package/dist/orders/status.js +96 -0
- package/dist/orders/surcharges.d.ts +75 -2
- package/dist/orders/surcharges.js +110 -4
- package/dist/payments/account-credit.d.ts +171 -0
- package/dist/payments/account-credit.js +107 -0
- package/dist/payments/index.d.ts +241 -9
- package/dist/payments/index.js +92 -0
- package/dist/payments/methods.d.ts +37 -0
- package/dist/payments/methods.js +33 -0
- package/dist/platform/catalog.d.ts +148 -0
- package/dist/platform/catalog.js +74 -0
- package/dist/platform/entitlements.d.ts +111 -0
- package/dist/platform/entitlements.js +86 -0
- package/dist/platform/legal-entities.d.ts +139 -0
- package/dist/platform/legal-entities.js +126 -0
- package/dist/platform/legal-entity-numbering.d.ts +103 -0
- package/dist/platform/legal-entity-numbering.js +101 -0
- package/dist/platform/organization-membership.d.ts +80 -0
- package/dist/platform/organization-membership.js +71 -0
- package/dist/platform/organization-settings.d.ts +33 -0
- package/dist/platform/organization-settings.js +42 -0
- package/dist/platform/organization-sharing.d.ts +172 -0
- package/dist/platform/organization-sharing.js +120 -0
- package/dist/platform/organizations.d.ts +205 -0
- package/dist/platform/organizations.js +180 -0
- package/dist/platform/provision-store.d.ts +88 -8
- package/dist/platform/provision-store.js +12 -0
- package/dist/platform/reports.d.ts +46 -0
- package/dist/platform/reports.js +31 -0
- package/dist/platform/server-metrics.d.ts +58 -0
- package/dist/platform/server-metrics.js +11 -0
- package/dist/pos/index.d.ts +567 -0
- package/dist/pos/index.js +205 -0
- package/dist/pricing/index.d.ts +408 -0
- package/dist/pricing/index.js +353 -0
- package/dist/pricing/vouchers.d.ts +103 -0
- package/dist/pricing/vouchers.js +69 -0
- package/dist/provenance/index.d.ts +93 -0
- package/dist/provenance/index.js +53 -0
- package/dist/reports/index.d.ts +199 -0
- package/dist/reports/index.js +154 -0
- package/dist/returns/index.d.ts +225 -0
- package/dist/returns/index.js +160 -0
- package/dist/search/index.d.ts +99 -0
- package/dist/search/index.js +62 -0
- package/dist/shipping/parcel-count-suggestion.d.ts +52 -0
- package/dist/shipping/parcel-count-suggestion.js +73 -0
- package/dist/shipping/parcel-rule.d.ts +48 -0
- package/dist/shipping/parcel-rule.js +91 -0
- package/dist/stock/index.d.ts +166 -0
- package/dist/stock/index.js +115 -0
- package/dist/stock/transfers.d.ts +520 -0
- package/dist/stock/transfers.js +437 -0
- package/dist/stored-value/index.d.ts +154 -0
- package/dist/stored-value/index.js +130 -0
- package/dist/tenant/capabilities.d.ts +10 -0
- package/dist/tenant/entitlements.d.ts +35 -0
- package/dist/tenant/entitlements.js +15 -0
- package/dist/tenant/field-groups.d.ts +64 -0
- package/dist/tenant/field-groups.js +34 -0
- package/dist/tenant/legal-entity.d.ts +32 -0
- package/dist/tenant/legal-entity.js +41 -0
- package/dist/tenant/notifications.d.ts +148 -0
- package/dist/tenant/notifications.js +79 -0
- package/dist/tenant/retention.d.ts +10 -4
- package/dist/tenant/settings-sources.d.ts +103 -0
- package/dist/tenant/settings-sources.js +92 -0
- package/dist/types.d.ts +86 -11
- package/dist/uploads/index.d.ts +11 -7
- package/dist/users/index.d.ts +104 -0
- package/dist/users/index.js +80 -0
- package/package.json +3 -2
package/dist/client.d.ts
CHANGED
|
@@ -2,14 +2,24 @@ import { type DeprecationNotice, type RateLimitInfo, type RetryPolicy, type Tena
|
|
|
2
2
|
import { type ApiTokensModule } from './api-tokens/index.js';
|
|
3
3
|
import { type AppInstallationConfigModule } from './apps/config.js';
|
|
4
4
|
import { type AppCredentialConfig } from './apps/credential.js';
|
|
5
|
+
import { type AppEventSubscriptionModule } from './apps/event-subscription.js';
|
|
6
|
+
import { type AppHookSecretModule } from './apps/hook-secret.js';
|
|
5
7
|
import { type AppsModule } from './apps/index.js';
|
|
6
8
|
import { type AuditModule } from './audit/index.js';
|
|
7
9
|
import { type AuthModule } from './auth/index.js';
|
|
10
|
+
import { type BulkModule } from './bulk/index.js';
|
|
11
|
+
import { type CatalogModule } from './catalog/index.js';
|
|
12
|
+
import { type ComplianceModule } from './compliance/index.js';
|
|
8
13
|
import { type FormsModule } from './content/forms.js';
|
|
9
14
|
import { type CustomObjectsModule } from './custom-objects/index.js';
|
|
10
15
|
import { type CustomersModule } from './customers/index.js';
|
|
11
16
|
import { type DocumentsModule } from './documents/index.js';
|
|
17
|
+
import { type EventsModule } from './events/index.js';
|
|
18
|
+
import { type FeedsModule } from './feeds/index.js';
|
|
19
|
+
import { type FulfillmentsModule } from './fulfillments/index.js';
|
|
12
20
|
import { type HeadsModule } from './heads/index.js';
|
|
21
|
+
import { type HooksModule } from './hooks/index.js';
|
|
22
|
+
import { type IntegrationsModule } from './integrations/index.js';
|
|
13
23
|
import { type JobsModule } from './jobs/index.js';
|
|
14
24
|
import { type LocationsModule } from './locations/index.js';
|
|
15
25
|
import { type MetaModule } from './meta/index.js';
|
|
@@ -17,13 +27,35 @@ import { type MetafieldsModule } from './metafields/index.js';
|
|
|
17
27
|
import { type OrdersModule } from './orders/index.js';
|
|
18
28
|
import { type PaymentsModule } from './payments/index.js';
|
|
19
29
|
import { type PlatformAppsModule } from './platform/apps.js';
|
|
30
|
+
import { type PlatformCatalogModule } from './platform/catalog.js';
|
|
31
|
+
import { type PlatformEntitlementsModule } from './platform/entitlements.js';
|
|
32
|
+
import { type PlatformLegalEntitiesModule } from './platform/legal-entities.js';
|
|
33
|
+
import { type PlatformOrganizationsModule } from './platform/organizations.js';
|
|
20
34
|
import { type PlatformModule } from './platform/provision-store.js';
|
|
35
|
+
import { type PlatformReportsModule } from './platform/reports.js';
|
|
36
|
+
import { type PlatformServerMetricsModule } from './platform/server-metrics.js';
|
|
37
|
+
import { type PosModule } from './pos/index.js';
|
|
38
|
+
import { type PricingModule } from './pricing/index.js';
|
|
39
|
+
import { type ProvenanceModule } from './provenance/index.js';
|
|
40
|
+
import { type ReportsModule } from './reports/index.js';
|
|
41
|
+
import { type ReturnsModule } from './returns/index.js';
|
|
42
|
+
import { type SearchModule } from './search/index.js';
|
|
21
43
|
import { type RedirectsModule } from './seo/redirects.js';
|
|
44
|
+
import { type ParcelCountSuggestionMethod } from './shipping/parcel-count-suggestion.js';
|
|
45
|
+
import { type ShippingModule } from './shipping/parcel-rule.js';
|
|
46
|
+
import { type StockModule } from './stock/index.js';
|
|
47
|
+
import { type StoredValueModule } from './stored-value/index.js';
|
|
22
48
|
import { type TaxModule } from './tax/index.js';
|
|
23
49
|
import { type CapabilitiesModule } from './tenant/capabilities.js';
|
|
24
50
|
import { type ChannelsModule } from './tenant/channels.js';
|
|
51
|
+
import { type TenantEntitlementsReader } from './tenant/entitlements.js';
|
|
52
|
+
import { type FieldGroupOwnersReader, type FieldGroupSyncSourcesReader } from './tenant/field-groups.js';
|
|
53
|
+
import { type LegalEntityModule } from './tenant/legal-entity.js';
|
|
54
|
+
import { type NotificationsModule } from './tenant/notifications.js';
|
|
25
55
|
import { type RetentionModule } from './tenant/retention.js';
|
|
56
|
+
import { type SettingsSourcesModule } from './tenant/settings-sources.js';
|
|
26
57
|
import { type UploadsModule } from './uploads/index.js';
|
|
58
|
+
import { type UsersModule } from './users/index.js';
|
|
27
59
|
export interface AdminClientConfig {
|
|
28
60
|
urls: {
|
|
29
61
|
vendureUrl: string;
|
|
@@ -71,21 +103,60 @@ export interface AdminClient {
|
|
|
71
103
|
apiTokens: ApiTokensModule;
|
|
72
104
|
/** Installing and managing apps on the ACTIVE store. Needs `InstallApps`. */
|
|
73
105
|
apps: AppsModule & {
|
|
74
|
-
/**
|
|
106
|
+
/**
|
|
107
|
+
* One installation's own surfaces. `config` is its settings form (spec §8.13);
|
|
108
|
+
* `eventSubscription` is the calling installation's event subscription and
|
|
109
|
+
* its signing secret (spec §6.9), read with the installation's own credential.
|
|
110
|
+
*/
|
|
75
111
|
installation: {
|
|
76
112
|
config: AppInstallationConfigModule;
|
|
113
|
+
eventSubscription: AppEventSubscriptionModule;
|
|
114
|
+
/**
|
|
115
|
+
* The calling installation's hook signing secret, ONCE (spec §8.14): read it
|
|
116
|
+
* with the installation's own credential and hand it to `createHookHandler`.
|
|
117
|
+
*/
|
|
118
|
+
hookSecret: AppHookSecretModule;
|
|
77
119
|
};
|
|
78
120
|
};
|
|
79
121
|
audit: AuditModule;
|
|
122
|
+
/**
|
|
123
|
+
* Products, variants, options, facets, collections, assets, visibility and
|
|
124
|
+
* properties (spec §9.2 `catalog`). Needs the catalog permissions.
|
|
125
|
+
*/
|
|
126
|
+
catalog: CatalogModule;
|
|
80
127
|
channels: ChannelsModule;
|
|
81
128
|
content: {
|
|
82
129
|
forms: FormsModule;
|
|
83
130
|
};
|
|
131
|
+
/**
|
|
132
|
+
* Compliance requests to installed apps: data requests, customer and
|
|
133
|
+
* post-uninstall redactions, their acknowledgements and who is overdue (spec §6.9).
|
|
134
|
+
*/
|
|
135
|
+
compliance: ComplianceModule;
|
|
84
136
|
/**
|
|
85
137
|
* Invoices, credit notes and packing slips: issuing them, the numbered facts
|
|
86
138
|
* they were built from, and the store's own extension blocks (spec §8.5).
|
|
87
139
|
*/
|
|
88
140
|
documents: DocumentsModule;
|
|
141
|
+
/**
|
|
142
|
+
* App hooks (spec §8.14): calls the PLATFORM makes to an installed app, signed,
|
|
143
|
+
* budgeted, never redirected and audited. `assignments` makes an installed app
|
|
144
|
+
* the store's tax, payment or fulfillment provider; `ping` tests one hook.
|
|
145
|
+
*/
|
|
146
|
+
hooks: HooksModule;
|
|
147
|
+
/**
|
|
148
|
+
* The store's connections to other systems (spec §9.2). `pipelines.drafts` keeps a
|
|
149
|
+
* half-finished import or export set-up on the server for 7 days after its last change, for any
|
|
150
|
+
* admin of the store with pipeline rights, and never holds a credential.
|
|
151
|
+
*/
|
|
152
|
+
integrations: IntegrationsModule;
|
|
153
|
+
/**
|
|
154
|
+
* Platform events (spec §6.9): `poll`/`pollAll`/`replay`/`head` over the event log (a
|
|
155
|
+
* machine credential with `ReadPlatformEvents`), `subscribe` to build a typed webhook
|
|
156
|
+
* endpoint, and `subscriptions.*` for where events are pushed (`ManageEventSubscriptions`,
|
|
157
|
+
* the `events` token template).
|
|
158
|
+
*/
|
|
159
|
+
events: EventsModule;
|
|
89
160
|
/**
|
|
90
161
|
* Customers — the commerce master record, plus their groups and addresses.
|
|
91
162
|
* `list`/`get` need `ReadCustomer`, the writes `UpdateCustomer`, and `erase`
|
|
@@ -93,9 +164,25 @@ export interface AdminClient {
|
|
|
93
164
|
* a customer across channels by email and is not reachable through this SDK.
|
|
94
165
|
*/
|
|
95
166
|
customers: CustomersModule;
|
|
167
|
+
/**
|
|
168
|
+
* A fulfillment's parcels, per-parcel barcodes, merged carrier label, and
|
|
169
|
+
* the request that labels every parcel still missing one.
|
|
170
|
+
*/
|
|
171
|
+
fulfillments: FulfillmentsModule;
|
|
172
|
+
/**
|
|
173
|
+
* Product feeds (spec §8.14): the configurations, their rule ASTs, the runs
|
|
174
|
+
* and item issues the generator produces, the Google-taxonomy mapping and the
|
|
175
|
+
* AI helpers. Channel-scoped throughout — no method takes a channel.
|
|
176
|
+
*/
|
|
177
|
+
feeds: FeedsModule;
|
|
96
178
|
/** The store's head registry: every client surface it serves (spec §6.7). */
|
|
97
179
|
heads: HeadsModule;
|
|
98
180
|
/** Every long-running operation the platform runs, under one resource (spec §6.11). */
|
|
181
|
+
/**
|
|
182
|
+
* JSONL bulk import and export (spec §6.11, §15.22): a million rows as one
|
|
183
|
+
* job, per-row outcomes, and none of your rate limit spent on the rows.
|
|
184
|
+
*/
|
|
185
|
+
bulk: BulkModule;
|
|
99
186
|
jobs: JobsModule;
|
|
100
187
|
/** Stock-location profiles (spec §8.7); `TenantContext.location` names one by id. */
|
|
101
188
|
locations: LocationsModule;
|
|
@@ -109,8 +196,9 @@ export interface AdminClient {
|
|
|
109
196
|
/** App and platform custom data on core entities (spec §8.13, §8.4). */
|
|
110
197
|
metafields: MetafieldsModule;
|
|
111
198
|
/**
|
|
112
|
-
* Surcharges on a placed order (spec §8.6 for `taxClass`),
|
|
113
|
-
* flow: park, read the payment position, settle (spec §8.2, §15.5)
|
|
199
|
+
* Surcharges on a placed order (spec §8.6 for `taxClass`), the deposit
|
|
200
|
+
* flow: park, read the payment position, settle (spec §8.2, §15.5), and the
|
|
201
|
+
* parcel count its shipping was charged for (`parcelCharge`).
|
|
114
202
|
*/
|
|
115
203
|
orders: OrdersModule;
|
|
116
204
|
/**
|
|
@@ -118,9 +206,59 @@ export interface AdminClient {
|
|
|
118
206
|
* recorded against an order with what it stands at (spec §8.2).
|
|
119
207
|
*/
|
|
120
208
|
payments: PaymentsModule;
|
|
209
|
+
/**
|
|
210
|
+
* Point of sale on a machine principal (spec §8.8): register sessions, cash,
|
|
211
|
+
* tenders, the sale, refunds, X and Z — with no paired tablet. Needs a `pos`
|
|
212
|
+
* token restricted to the location it sells from, and `tenant.location`.
|
|
213
|
+
*/
|
|
214
|
+
pos: PosModule;
|
|
215
|
+
/**
|
|
216
|
+
* Promotions at the register (spec §9.2 `pricing`): the promotions a register
|
|
217
|
+
* can offer now, coupons — plain and unique codes — on a Draft order, and what
|
|
218
|
+
* each discount did to each line.
|
|
219
|
+
*/
|
|
220
|
+
pricing: PricingModule;
|
|
221
|
+
/**
|
|
222
|
+
* Who last changed each field group (price, stock, product details, customer details) of a
|
|
223
|
+
* product, variant or customer, and whether an app or key manages it (spec §8.10). Last
|
|
224
|
+
* writer only; the history is the platform event log.
|
|
225
|
+
*/
|
|
226
|
+
provenance: ProvenanceModule;
|
|
227
|
+
/** Tenant reporting in minor units and ISO-8601 UTC (spec §9.2 `reports`, §9.3). */
|
|
228
|
+
reports: ReportsModule;
|
|
229
|
+
/**
|
|
230
|
+
* Order returns (RMA): one return, an order's returns, what of an order can
|
|
231
|
+
* still be returned, and the plan for settling a return (headless W9-47). The
|
|
232
|
+
* list and the writes are phase 7.
|
|
233
|
+
*/
|
|
234
|
+
returns: ReturnsModule;
|
|
235
|
+
/**
|
|
236
|
+
* One search across the store (spec §7 `search.entities`): products, orders, customers and
|
|
237
|
+
* content in one call, each type's best matches already loaded, in relevance order. A type
|
|
238
|
+
* the credential may not read is skipped and named, never refused.
|
|
239
|
+
*/
|
|
240
|
+
search: SearchModule;
|
|
121
241
|
seo: {
|
|
122
242
|
redirects: RedirectsModule;
|
|
123
243
|
};
|
|
244
|
+
/**
|
|
245
|
+
* Shipping of the ACTIVE channel (spec §9.2 `shipping`): the channel's
|
|
246
|
+
* `parcelRule`, and `parcelCountSuggestion` for a set of variant items.
|
|
247
|
+
*/
|
|
248
|
+
shipping: ShippingModule & {
|
|
249
|
+
parcelCountSuggestion: ParcelCountSuggestionMethod;
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* Stock per location by state, the ledger with reasons, reason-carrying
|
|
253
|
+
* adjustments, transfers and allocation release (spec §9.2 `stock`, §8.7).
|
|
254
|
+
*/
|
|
255
|
+
stock: StockModule;
|
|
256
|
+
/**
|
|
257
|
+
* Stored value (incentives program): gift cards, store credit and points on one ledger —
|
|
258
|
+
* accounts, statements, liability, staff issue/adjust/block, and spending a balance as a
|
|
259
|
+
* payment on an order.
|
|
260
|
+
*/
|
|
261
|
+
storedValue: StoredValueModule;
|
|
124
262
|
/** The store's own tax classes and their per-country mappings (spec §8.6). */
|
|
125
263
|
tax: TaxModule;
|
|
126
264
|
/**
|
|
@@ -128,10 +266,40 @@ export interface AdminClient {
|
|
|
128
266
|
* bytes straight to the object store, then hand the id to a consuming call.
|
|
129
267
|
*/
|
|
130
268
|
uploads: UploadsModule;
|
|
269
|
+
/**
|
|
270
|
+
* The active store's staff (spec §7 `users.ensure`): `ensure` brings a person to exactly these
|
|
271
|
+
* roles in one repeatable call (created, attached, restored or unchanged), `update` changes their
|
|
272
|
+
* names or login email.
|
|
273
|
+
*/
|
|
274
|
+
users: UsersModule;
|
|
131
275
|
/** The calling tenant's own settings. Always the ACTIVE channel — no channel argument. */
|
|
132
276
|
tenant: {
|
|
133
277
|
capabilities: CapabilitiesModule;
|
|
278
|
+
/**
|
|
279
|
+
* The plugins the active store may use: its own grants and its organization's, as the
|
|
280
|
+
* engine's operation gate reads them, uncached. Needs `ReadCatalog` or `ReadSettings`.
|
|
281
|
+
*/
|
|
282
|
+
entitlements: TenantEntitlementsReader;
|
|
283
|
+
/**
|
|
284
|
+
* Who owns each field group on the active store (an app installation or an API token), as
|
|
285
|
+
* the grant rules read it. Release one with `apps.releaseFieldGroup`.
|
|
286
|
+
*/
|
|
287
|
+
fieldGroupOwners: FieldGroupOwnersReader;
|
|
288
|
+
/** The field groups Exact Online or the store's organization already writes here. */
|
|
289
|
+
fieldGroupSyncSources: FieldGroupSyncSourcesReader;
|
|
134
290
|
retention: RetentionModule;
|
|
291
|
+
/** Per notification event: on or off, who sends it (spec §8.15), and to whom. */
|
|
292
|
+
notifications: NotificationsModule;
|
|
293
|
+
/**
|
|
294
|
+
* Where each settings group comes from — the store or its organization — and the store's
|
|
295
|
+
* choice to keep its own values (multi-region spec §5.3).
|
|
296
|
+
*/
|
|
297
|
+
settingsSources: SettingsSourcesModule;
|
|
298
|
+
/**
|
|
299
|
+
* The active store's legal entity: the company its invoices name (multi-region spec §7.1).
|
|
300
|
+
* Changing it needs `UpdateSeller` on every store of the entity.
|
|
301
|
+
*/
|
|
302
|
+
legalEntity: LegalEntityModule;
|
|
135
303
|
};
|
|
136
304
|
/**
|
|
137
305
|
* Human SuperAdmin surface. Every method refuses an API token or an app
|
|
@@ -140,6 +308,27 @@ export interface AdminClient {
|
|
|
140
308
|
*/
|
|
141
309
|
platform: PlatformModule & {
|
|
142
310
|
apps: PlatformAppsModule;
|
|
311
|
+
/** Catalogue maintenance on a named store (the translation-language repair). */
|
|
312
|
+
catalog: PlatformCatalogModule;
|
|
313
|
+
/**
|
|
314
|
+
* Which external plugins each store may use: read one store's grants or every store's, and
|
|
315
|
+
* connect or disconnect a plugin for a store — see {@link PlatformEntitlementsModule}.
|
|
316
|
+
*/
|
|
317
|
+
entitlements: PlatformEntitlementsModule;
|
|
318
|
+
/**
|
|
319
|
+
* The platform's legal entities (multi-region spec §7.1): SuperAdmin list and create; read and
|
|
320
|
+
* update through every store of an entity — see {@link PlatformLegalEntitiesModule}.
|
|
321
|
+
*/
|
|
322
|
+
legalEntities: PlatformLegalEntitiesModule;
|
|
323
|
+
/**
|
|
324
|
+
* Organizations and their plugin entitlements (multi-region spec §5.1).
|
|
325
|
+
* An organization admin reads and edits its own with the organization's
|
|
326
|
+
* workspace channel as the tenant — see {@link PlatformOrganizationsModule}.
|
|
327
|
+
*/
|
|
328
|
+
organizations: PlatformOrganizationsModule;
|
|
329
|
+
reports: PlatformReportsModule;
|
|
330
|
+
/** Basic health of the platform's own servers (CPU, memory, disk, network). */
|
|
331
|
+
serverMetrics: PlatformServerMetricsModule;
|
|
143
332
|
};
|
|
144
333
|
/** A derived client on another tenant, sharing this one's principal. */
|
|
145
334
|
withTenant(tenant: Partial<TenantContext> & {
|
package/dist/client.js
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
import { createChannelResolver, createTransport, mergeTenant, UNSCOPED_TENANT, ValidationError, } from '@sixtyninecommerce/core';
|
|
1
|
+
import { createChannelResolver, createTransport, isBrowserRuntime, mergeTenant, UNSCOPED_TENANT, ValidationError, } from '@sixtyninecommerce/core';
|
|
2
2
|
import { createApiTokensModule } from './api-tokens/index.js';
|
|
3
3
|
import { createAppConfigModule } from './apps/config.js';
|
|
4
4
|
import { createAppCredential, } from './apps/credential.js';
|
|
5
|
+
import { createAppEventSubscriptionModule, } from './apps/event-subscription.js';
|
|
6
|
+
import { createAppHookSecretModule } from './apps/hook-secret.js';
|
|
5
7
|
import { createAppsModule } from './apps/index.js';
|
|
6
8
|
import { createAuditModule } from './audit/index.js';
|
|
7
9
|
import { createAuthModule } from './auth/index.js';
|
|
10
|
+
import { createBulkModule } from './bulk/index.js';
|
|
11
|
+
import { createCatalogModule } from './catalog/index.js';
|
|
12
|
+
import { createComplianceModule } from './compliance/index.js';
|
|
8
13
|
import { createFormsModule } from './content/forms.js';
|
|
9
14
|
import { createCustomObjectsModule } from './custom-objects/index.js';
|
|
10
15
|
import { createCustomersModule } from './customers/index.js';
|
|
11
16
|
import { createDocumentsModule } from './documents/index.js';
|
|
17
|
+
import { createEventsModule } from './events/index.js';
|
|
18
|
+
import { createFeedsModule } from './feeds/index.js';
|
|
19
|
+
import { createFulfillmentsModule } from './fulfillments/index.js';
|
|
12
20
|
import { createHeadsModule } from './heads/index.js';
|
|
21
|
+
import { createHooksModule } from './hooks/index.js';
|
|
22
|
+
import { createIntegrationsModule } from './integrations/index.js';
|
|
13
23
|
import { createJobsModule } from './jobs/index.js';
|
|
14
24
|
import { createLocationsModule } from './locations/index.js';
|
|
15
25
|
import { createMetaModule } from './meta/index.js';
|
|
@@ -17,13 +27,35 @@ import { createMetafieldsModule } from './metafields/index.js';
|
|
|
17
27
|
import { createOrdersModule } from './orders/index.js';
|
|
18
28
|
import { createPaymentsModule } from './payments/index.js';
|
|
19
29
|
import { createPlatformAppsModule } from './platform/apps.js';
|
|
30
|
+
import { createPlatformCatalogModule } from './platform/catalog.js';
|
|
31
|
+
import { createPlatformEntitlementsModule, } from './platform/entitlements.js';
|
|
32
|
+
import { createPlatformLegalEntitiesModule, } from './platform/legal-entities.js';
|
|
33
|
+
import { createPlatformOrganizationsModule, } from './platform/organizations.js';
|
|
20
34
|
import { createPlatformModule } from './platform/provision-store.js';
|
|
35
|
+
import { createPlatformReportsModule } from './platform/reports.js';
|
|
36
|
+
import { createPlatformServerMetricsModule, } from './platform/server-metrics.js';
|
|
37
|
+
import { createPosModule } from './pos/index.js';
|
|
38
|
+
import { createPricingModule } from './pricing/index.js';
|
|
39
|
+
import { createProvenanceModule } from './provenance/index.js';
|
|
40
|
+
import { createReportsModule } from './reports/index.js';
|
|
41
|
+
import { createReturnsModule } from './returns/index.js';
|
|
42
|
+
import { createSearchModule } from './search/index.js';
|
|
21
43
|
import { createRedirectsModule } from './seo/redirects.js';
|
|
44
|
+
import { createParcelCountSuggestion, } from './shipping/parcel-count-suggestion.js';
|
|
45
|
+
import { createShippingModule } from './shipping/parcel-rule.js';
|
|
46
|
+
import { createStockModule } from './stock/index.js';
|
|
47
|
+
import { createStoredValueModule } from './stored-value/index.js';
|
|
22
48
|
import { createTaxModule } from './tax/index.js';
|
|
23
49
|
import { createCapabilitiesModule } from './tenant/capabilities.js';
|
|
24
50
|
import { createChannelsModule } from './tenant/channels.js';
|
|
51
|
+
import { createTenantEntitlementsReader, } from './tenant/entitlements.js';
|
|
52
|
+
import { createFieldGroupOwnersReader, createFieldGroupSyncSourcesReader, } from './tenant/field-groups.js';
|
|
53
|
+
import { createLegalEntityModule } from './tenant/legal-entity.js';
|
|
54
|
+
import { createNotificationsModule } from './tenant/notifications.js';
|
|
25
55
|
import { createRetentionModule } from './tenant/retention.js';
|
|
56
|
+
import { createSettingsSourcesModule, } from './tenant/settings-sources.js';
|
|
26
57
|
import { createUploadsModule } from './uploads/index.js';
|
|
58
|
+
import { createUsersModule } from './users/index.js';
|
|
27
59
|
/**
|
|
28
60
|
* An admin credential in a browser is a credential the whole internet can read
|
|
29
61
|
* (spec §18 amendment 3, §15.21). A SESSION bearer is fine there — that is what
|
|
@@ -35,11 +67,9 @@ function assertNotInBrowser(auth) {
|
|
|
35
67
|
// long-lived token is, and for the same reason.
|
|
36
68
|
if (!('token' in auth) && !('app' in auth))
|
|
37
69
|
return;
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
|
|
41
|
-
const inBrowser = runtime.window !== undefined && runtime.document !== undefined;
|
|
42
|
-
if (!inBrowser)
|
|
70
|
+
// `core`'s one definition of "a browser", which the storefront SDK's
|
|
71
|
+
// private-token refusal uses too, so the two SDKs cannot disagree about it.
|
|
72
|
+
if (!isBrowserRuntime())
|
|
43
73
|
return;
|
|
44
74
|
const credential = 'app' in auth ? "An app's private key" : 'An API token';
|
|
45
75
|
throw new ValidationError({
|
|
@@ -157,7 +187,11 @@ function assertSessionIsWritable(session) {
|
|
|
157
187
|
*/
|
|
158
188
|
function buildAppsModule(transport) {
|
|
159
189
|
const apps = createAppsModule(transport);
|
|
160
|
-
const installation = Object.assign((id, options) => apps.installation(id, options), {
|
|
190
|
+
const installation = Object.assign((id, options) => apps.installation(id, options), {
|
|
191
|
+
config: createAppConfigModule(transport),
|
|
192
|
+
eventSubscription: createAppEventSubscriptionModule(transport),
|
|
193
|
+
hookSecret: createAppHookSecretModule(transport),
|
|
194
|
+
});
|
|
161
195
|
return { ...apps, installation };
|
|
162
196
|
}
|
|
163
197
|
export function createAdminClient(config) {
|
|
@@ -325,6 +359,17 @@ function buildClient(config, overrides, resolver, shared, credential) {
|
|
|
325
359
|
// No guard here: the transport refuses an unscoped call itself with
|
|
326
360
|
// TENANT_REQUIRED unless it opts in, and only `auth` does. One rule, in the
|
|
327
361
|
// one place that knows what left the process.
|
|
362
|
+
const jobsModule = createJobsModule(transport);
|
|
363
|
+
// The PUT goes to the object store, not to this platform, so it needs the
|
|
364
|
+
// caller's own fetch rather than the transport — which would attach the
|
|
365
|
+
// tenant headers and the bearer to a request that must carry neither.
|
|
366
|
+
const uploadsModule = createUploadsModule(transport, config.fetch ?? globalThis.fetch);
|
|
367
|
+
// Composed from the two modules it is built on rather than re-implementing
|
|
368
|
+
// either: `import` stages the file through `uploads` — the exact
|
|
369
|
+
// `Content-Length` + `Content-Type` + `client_token` protocol, in one place
|
|
370
|
+
// — and waits on the run through `jobs`, which owns the polling loop.
|
|
371
|
+
// `reports.export` rides the same export machinery, so it shares both.
|
|
372
|
+
const bulkModule = createBulkModule(transport, uploadsModule, jobsModule);
|
|
328
373
|
return {
|
|
329
374
|
auth: createAuthModule(transport, store && {
|
|
330
375
|
present: () => store.read() !== '',
|
|
@@ -346,32 +391,62 @@ function buildClient(config, overrides, resolver, shared, credential) {
|
|
|
346
391
|
}),
|
|
347
392
|
apiTokens: createApiTokensModule(transport),
|
|
348
393
|
apps: buildAppsModule(transport),
|
|
394
|
+
bulk: bulkModule,
|
|
349
395
|
audit: createAuditModule(transport),
|
|
396
|
+
catalog: createCatalogModule(transport),
|
|
350
397
|
channels: createChannelsModule(resolver),
|
|
351
398
|
content: { forms: createFormsModule(transport) },
|
|
399
|
+
fulfillments: createFulfillmentsModule(transport),
|
|
352
400
|
heads: createHeadsModule(transport),
|
|
353
|
-
jobs:
|
|
401
|
+
jobs: jobsModule,
|
|
354
402
|
locations: createLocationsModule(transport),
|
|
355
403
|
meta: createMetaModule(transport),
|
|
356
404
|
customObjects: createCustomObjectsModule(transport),
|
|
357
405
|
metafields: createMetafieldsModule(transport),
|
|
358
406
|
orders: createOrdersModule(transport),
|
|
359
407
|
payments: createPaymentsModule(transport),
|
|
408
|
+
pos: createPosModule(transport),
|
|
409
|
+
pricing: createPricingModule(transport),
|
|
410
|
+
provenance: createProvenanceModule(transport),
|
|
411
|
+
reports: createReportsModule(transport, bulkModule, jobsModule, () => tenant.location),
|
|
412
|
+
returns: createReturnsModule(transport),
|
|
360
413
|
documents: createDocumentsModule(transport),
|
|
414
|
+
hooks: createHooksModule(transport),
|
|
415
|
+
integrations: createIntegrationsModule(transport),
|
|
416
|
+
events: createEventsModule(transport),
|
|
361
417
|
customers: createCustomersModule(transport),
|
|
418
|
+
compliance: createComplianceModule(transport),
|
|
419
|
+
feeds: createFeedsModule(transport),
|
|
420
|
+
search: createSearchModule(transport),
|
|
362
421
|
seo: { redirects: createRedirectsModule(transport) },
|
|
422
|
+
shipping: {
|
|
423
|
+
...createShippingModule(transport),
|
|
424
|
+
parcelCountSuggestion: createParcelCountSuggestion(transport),
|
|
425
|
+
},
|
|
426
|
+
stock: createStockModule(transport),
|
|
427
|
+
storedValue: createStoredValueModule(transport),
|
|
363
428
|
tax: createTaxModule(transport),
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
// tenant headers and the bearer to a request that must carry neither.
|
|
367
|
-
uploads: createUploadsModule(transport, config.fetch ?? globalThis.fetch),
|
|
429
|
+
uploads: uploadsModule,
|
|
430
|
+
users: createUsersModule(transport),
|
|
368
431
|
tenant: {
|
|
369
432
|
capabilities: createCapabilitiesModule(transport),
|
|
433
|
+
entitlements: createTenantEntitlementsReader(transport),
|
|
434
|
+
fieldGroupOwners: createFieldGroupOwnersReader(transport),
|
|
435
|
+
fieldGroupSyncSources: createFieldGroupSyncSourcesReader(transport),
|
|
370
436
|
retention: createRetentionModule(transport),
|
|
437
|
+
notifications: createNotificationsModule(transport),
|
|
438
|
+
settingsSources: createSettingsSourcesModule(transport),
|
|
439
|
+
legalEntity: createLegalEntityModule(transport),
|
|
371
440
|
},
|
|
372
441
|
platform: {
|
|
373
442
|
...createPlatformModule(transport, config),
|
|
374
443
|
apps: createPlatformAppsModule(transport, config),
|
|
444
|
+
catalog: createPlatformCatalogModule(transport, config),
|
|
445
|
+
entitlements: createPlatformEntitlementsModule(transport, config),
|
|
446
|
+
legalEntities: createPlatformLegalEntitiesModule(transport, config),
|
|
447
|
+
organizations: createPlatformOrganizationsModule(transport, config),
|
|
448
|
+
reports: createPlatformReportsModule(transport, config),
|
|
449
|
+
serverMetrics: createPlatformServerMetricsModule(transport, config),
|
|
375
450
|
},
|
|
376
451
|
withTenant(next) {
|
|
377
452
|
// `mergeTenant`, not a spread: it merges `actor` FIELD BY FIELD, so a
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { type Page, type Transport } from '@sixtyninecommerce/core';
|
|
2
|
+
import type { Call, ListOptions } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Compliance requests — what the platform asks of the apps installed on a
|
|
5
|
+
* store (headless spec §6.9 "Compliance events").
|
|
6
|
+
*
|
|
7
|
+
* Three kinds, each delivered to every app installation as an event whatever
|
|
8
|
+
* its event filters say:
|
|
9
|
+
*
|
|
10
|
+
* - `data` — `customer.data_requested`, raised with
|
|
11
|
+
* `admin.customers.requestData`: tell the merchant what you hold about this
|
|
12
|
+
* person;
|
|
13
|
+
* - `customer_redact` — `customer.redact_requested`, raised by
|
|
14
|
+
* `admin.customers.erase`: erase your copy of this person;
|
|
15
|
+
* - `installation_redact` — `installation.redact_requested`, 48 hours after
|
|
16
|
+
* your app was uninstalled: erase what you hold about this store. It cannot
|
|
17
|
+
* be acknowledged (the installation has no credential any more).
|
|
18
|
+
*
|
|
19
|
+
* An app acknowledges a request within 30 days (`dueAt`) with
|
|
20
|
+
* {@link ComplianceModule.acknowledge}, using its own installation token. The
|
|
21
|
+
* merchant reads the state with {@link ComplianceModule.list}: an addressed
|
|
22
|
+
* installation that has not acknowledged by `dueAt` is listed in
|
|
23
|
+
* `overdueInstallationIds`. Overdue is reported, never enforced: nothing is
|
|
24
|
+
* suspended.
|
|
25
|
+
*/
|
|
26
|
+
export declare const COMPLIANCE_REQUEST_FIELDS = "\n id\n kind\n subjectId\n requestedBy\n reason\n requestedAt\n dueAt\n addressedInstallationIds\n acknowledgements { id requestId installationId acknowledgedAt note }\n overdueInstallationIds\n overdue\n";
|
|
27
|
+
export declare const LIST_QUERY = "\n query ComplianceRequests($options: ComplianceRequestListOptions) {\n complianceRequests(options: $options) {\n items { \n id\n kind\n subjectId\n requestedBy\n reason\n requestedAt\n dueAt\n addressedInstallationIds\n acknowledgements { id requestId installationId acknowledgedAt note }\n overdueInstallationIds\n overdue\n }\n totalItems\n }\n }\n";
|
|
28
|
+
export declare const ACKNOWLEDGE_MUTATION = "\n mutation AcknowledgeComplianceRequest($requestId: ID!, $note: String, $idempotencyKey: String) {\n acknowledgeComplianceRequest(requestId: $requestId, note: $note, idempotencyKey: $idempotencyKey) {\n id\n requestId\n installationId\n acknowledgedAt\n note\n }\n }\n";
|
|
29
|
+
export type ComplianceRequestKind = 'data' | 'customer_redact' | 'installation_redact';
|
|
30
|
+
export interface ComplianceAcknowledgement {
|
|
31
|
+
id: string;
|
|
32
|
+
requestId: string;
|
|
33
|
+
installationId: string;
|
|
34
|
+
/** ISO-8601. */
|
|
35
|
+
acknowledgedAt: string;
|
|
36
|
+
/** The app's note. Blanked when the customer the request is about is erased. */
|
|
37
|
+
note: string | null;
|
|
38
|
+
}
|
|
39
|
+
export interface ComplianceRequest {
|
|
40
|
+
id: string;
|
|
41
|
+
kind: ComplianceRequestKind;
|
|
42
|
+
/** The customer id, or the installation id for `installation_redact`. */
|
|
43
|
+
subjectId: string;
|
|
44
|
+
/** `<kind>:<id>` of who asked (`user:`, `api_token:`, `app_installation:`, `system:`). */
|
|
45
|
+
requestedBy: string | null;
|
|
46
|
+
/** The merchant's reason on a data request. Never sent to apps. */
|
|
47
|
+
reason: string | null;
|
|
48
|
+
/** ISO-8601. */
|
|
49
|
+
requestedAt: string;
|
|
50
|
+
/** ISO-8601; `requestedAt` + 30 days. */
|
|
51
|
+
dueAt: string;
|
|
52
|
+
/** The installations it was delivered to, as they stood when it was raised. */
|
|
53
|
+
addressedInstallationIds: string[];
|
|
54
|
+
acknowledgements: ComplianceAcknowledgement[];
|
|
55
|
+
/** Addressed installations with no acknowledgement once `dueAt` has passed. */
|
|
56
|
+
overdueInstallationIds: string[];
|
|
57
|
+
overdue: boolean;
|
|
58
|
+
[extra: string]: unknown;
|
|
59
|
+
}
|
|
60
|
+
export interface ComplianceListOptions extends ListOptions {
|
|
61
|
+
kind?: ComplianceRequestKind;
|
|
62
|
+
/** A customer id, or an installation id for `installation_redact`. */
|
|
63
|
+
subjectId?: string;
|
|
64
|
+
/** Only requests addressed to this installation. */
|
|
65
|
+
installationId?: string;
|
|
66
|
+
/** Only requests past `dueAt` with an unacknowledged addressed installation. */
|
|
67
|
+
overdueOnly?: boolean;
|
|
68
|
+
}
|
|
69
|
+
export interface AcknowledgeComplianceOptions extends Call {
|
|
70
|
+
/**
|
|
71
|
+
* Up to 1000 characters. Refused (`COMPLIANCE_NOTE_NOT_ALLOWED`) on a request
|
|
72
|
+
* about a customer who has been erased: nothing about them may outlive it.
|
|
73
|
+
*/
|
|
74
|
+
note?: string;
|
|
75
|
+
}
|
|
76
|
+
export interface ComplianceModule {
|
|
77
|
+
/** This store's compliance requests, newest first. Needs ReadCustomer, ReadSettings or InstallApps. */
|
|
78
|
+
list(options?: ComplianceListOptions): Promise<Page<ComplianceRequest>>;
|
|
79
|
+
/**
|
|
80
|
+
* Acknowledge a request delivered to your app. Call it with the app's OWN
|
|
81
|
+
* installation token (`PermissionDeniedError` `COMPLIANCE_ACKNOWLEDGE_NOT_ALLOWED`
|
|
82
|
+
* otherwise); a request that was not delivered to your installation is
|
|
83
|
+
* `NotFoundError` `COMPLIANCE_REQUEST_NOT_FOUND`. Acknowledging twice answers
|
|
84
|
+
* the first acknowledgement.
|
|
85
|
+
*/
|
|
86
|
+
acknowledge(requestId: string, options?: AcknowledgeComplianceOptions): Promise<ComplianceAcknowledgement>;
|
|
87
|
+
}
|
|
88
|
+
export declare function createComplianceModule(transport: Transport): ComplianceModule;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { pageFromVendureList, readOffsetCursor, } from '@sixtyninecommerce/core';
|
|
2
|
+
/**
|
|
3
|
+
* Compliance requests — what the platform asks of the apps installed on a
|
|
4
|
+
* store (headless spec §6.9 "Compliance events").
|
|
5
|
+
*
|
|
6
|
+
* Three kinds, each delivered to every app installation as an event whatever
|
|
7
|
+
* its event filters say:
|
|
8
|
+
*
|
|
9
|
+
* - `data` — `customer.data_requested`, raised with
|
|
10
|
+
* `admin.customers.requestData`: tell the merchant what you hold about this
|
|
11
|
+
* person;
|
|
12
|
+
* - `customer_redact` — `customer.redact_requested`, raised by
|
|
13
|
+
* `admin.customers.erase`: erase your copy of this person;
|
|
14
|
+
* - `installation_redact` — `installation.redact_requested`, 48 hours after
|
|
15
|
+
* your app was uninstalled: erase what you hold about this store. It cannot
|
|
16
|
+
* be acknowledged (the installation has no credential any more).
|
|
17
|
+
*
|
|
18
|
+
* An app acknowledges a request within 30 days (`dueAt`) with
|
|
19
|
+
* {@link ComplianceModule.acknowledge}, using its own installation token. The
|
|
20
|
+
* merchant reads the state with {@link ComplianceModule.list}: an addressed
|
|
21
|
+
* installation that has not acknowledged by `dueAt` is listed in
|
|
22
|
+
* `overdueInstallationIds`. Overdue is reported, never enforced: nothing is
|
|
23
|
+
* suspended.
|
|
24
|
+
*/
|
|
25
|
+
export const COMPLIANCE_REQUEST_FIELDS = /* GraphQL */ `
|
|
26
|
+
id
|
|
27
|
+
kind
|
|
28
|
+
subjectId
|
|
29
|
+
requestedBy
|
|
30
|
+
reason
|
|
31
|
+
requestedAt
|
|
32
|
+
dueAt
|
|
33
|
+
addressedInstallationIds
|
|
34
|
+
acknowledgements { id requestId installationId acknowledgedAt note }
|
|
35
|
+
overdueInstallationIds
|
|
36
|
+
overdue
|
|
37
|
+
`;
|
|
38
|
+
export const LIST_QUERY = /* GraphQL */ `
|
|
39
|
+
query ComplianceRequests($options: ComplianceRequestListOptions) {
|
|
40
|
+
complianceRequests(options: $options) {
|
|
41
|
+
items { ${COMPLIANCE_REQUEST_FIELDS} }
|
|
42
|
+
totalItems
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
export const ACKNOWLEDGE_MUTATION = /* GraphQL */ `
|
|
47
|
+
mutation AcknowledgeComplianceRequest($requestId: ID!, $note: String, $idempotencyKey: String) {
|
|
48
|
+
acknowledgeComplianceRequest(requestId: $requestId, note: $note, idempotencyKey: $idempotencyKey) {
|
|
49
|
+
id
|
|
50
|
+
requestId
|
|
51
|
+
installationId
|
|
52
|
+
acknowledgedAt
|
|
53
|
+
note
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
const DEFAULT_PAGE_SIZE = 25;
|
|
58
|
+
export function createComplianceModule(transport) {
|
|
59
|
+
const listPage = async (skip, take, options) => {
|
|
60
|
+
const filter = {
|
|
61
|
+
kind: options?.kind ?? null,
|
|
62
|
+
subjectId: options?.subjectId ?? null,
|
|
63
|
+
installationId: options?.installationId ?? null,
|
|
64
|
+
overdueOnly: options?.overdueOnly ?? null,
|
|
65
|
+
};
|
|
66
|
+
const data = await transport.graphql({ api: 'admin', query: LIST_QUERY, variables: { options: { skip, take, filter } } }, options);
|
|
67
|
+
return pageFromVendureList(data.complianceRequests, skip, take, (cursor) => listPage(readOffsetCursor(cursor), take, options));
|
|
68
|
+
};
|
|
69
|
+
return {
|
|
70
|
+
list(options) {
|
|
71
|
+
const take = options?.limit ?? DEFAULT_PAGE_SIZE;
|
|
72
|
+
const skip = options?.after === undefined ? 0 : readOffsetCursor(options.after);
|
|
73
|
+
return listPage(skip, take, options);
|
|
74
|
+
},
|
|
75
|
+
async acknowledge(requestId, options) {
|
|
76
|
+
const data = await transport.graphql({
|
|
77
|
+
api: 'admin',
|
|
78
|
+
query: ACKNOWLEDGE_MUTATION,
|
|
79
|
+
variables: {
|
|
80
|
+
requestId,
|
|
81
|
+
note: options?.note ?? null,
|
|
82
|
+
idempotencyKey: options?.idempotencyKey ?? null,
|
|
83
|
+
},
|
|
84
|
+
}, options);
|
|
85
|
+
return data.acknowledgeComplianceRequest;
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads the Admin API's `customerDataRedaction` response extension (W7-12): it
|
|
3
|
+
* says how many field positions the caller's customer-data level blanked.
|
|
4
|
+
*
|
|
5
|
+
* One watcher per call: `onExtensions` goes on the transport call, and `mark`
|
|
6
|
+
* stamps `redacted: true` on each record of the answer when anything was
|
|
7
|
+
* withheld. Without the stamp a blanked field reads as "none on record".
|
|
8
|
+
*/
|
|
9
|
+
export declare function redactionWatcher(): {
|
|
10
|
+
onExtensions: (extensions: Readonly<Record<string, unknown>>) => void;
|
|
11
|
+
mark: <T extends {
|
|
12
|
+
redacted?: true;
|
|
13
|
+
} | null>(record: T) => T;
|
|
14
|
+
};
|