@sixtyninecommerce/admin 0.8.0 → 0.9.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 +2445 -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 +489 -0
- package/dist/catalog/products.js +365 -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 +274 -0
- package/dist/catalog/variants.js +258 -0
- package/dist/catalog/visibility.d.ts +57 -0
- package/dist/catalog/visibility.js +59 -0
- package/dist/client.d.ts +171 -3
- package/dist/client.js +81 -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 +360 -0
- package/dist/fulfillments/index.js +425 -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 +84 -9
- package/dist/index.js +16 -1
- package/dist/jobs/bulk-action-run.d.ts +65 -0
- package/dist/jobs/bulk-action-run.js +70 -0
- package/dist/locations/index.d.ts +6 -2
- package/dist/meta/index.d.ts +32 -0
- package/dist/orders/commit-edit.d.ts +123 -0
- package/dist/orders/commit-edit.js +142 -0
- package/dist/orders/get.d.ts +722 -0
- package/dist/orders/get.js +530 -0
- package/dist/orders/index.d.ts +105 -20
- package/dist/orders/index.js +44 -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 +132 -0
- package/dist/orders/manual-discounts.js +95 -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 +234 -9
- package/dist/payments/index.js +90 -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 +405 -0
- package/dist/pricing/index.js +351 -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/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,23 @@ 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';
|
|
13
22
|
import { type JobsModule } from './jobs/index.js';
|
|
14
23
|
import { type LocationsModule } from './locations/index.js';
|
|
15
24
|
import { type MetaModule } from './meta/index.js';
|
|
@@ -17,13 +26,33 @@ import { type MetafieldsModule } from './metafields/index.js';
|
|
|
17
26
|
import { type OrdersModule } from './orders/index.js';
|
|
18
27
|
import { type PaymentsModule } from './payments/index.js';
|
|
19
28
|
import { type PlatformAppsModule } from './platform/apps.js';
|
|
29
|
+
import { type PlatformCatalogModule } from './platform/catalog.js';
|
|
30
|
+
import { type PlatformEntitlementsModule } from './platform/entitlements.js';
|
|
31
|
+
import { type PlatformLegalEntitiesModule } from './platform/legal-entities.js';
|
|
32
|
+
import { type PlatformOrganizationsModule } from './platform/organizations.js';
|
|
20
33
|
import { type PlatformModule } from './platform/provision-store.js';
|
|
34
|
+
import { type PlatformReportsModule } from './platform/reports.js';
|
|
35
|
+
import { type PlatformServerMetricsModule } from './platform/server-metrics.js';
|
|
36
|
+
import { type PosModule } from './pos/index.js';
|
|
37
|
+
import { type PricingModule } from './pricing/index.js';
|
|
38
|
+
import { type ProvenanceModule } from './provenance/index.js';
|
|
39
|
+
import { type ReportsModule } from './reports/index.js';
|
|
21
40
|
import { type RedirectsModule } from './seo/redirects.js';
|
|
41
|
+
import { type ParcelCountSuggestionMethod } from './shipping/parcel-count-suggestion.js';
|
|
42
|
+
import { type ShippingModule } from './shipping/parcel-rule.js';
|
|
43
|
+
import { type StockModule } from './stock/index.js';
|
|
44
|
+
import { type StoredValueModule } from './stored-value/index.js';
|
|
22
45
|
import { type TaxModule } from './tax/index.js';
|
|
23
46
|
import { type CapabilitiesModule } from './tenant/capabilities.js';
|
|
24
47
|
import { type ChannelsModule } from './tenant/channels.js';
|
|
48
|
+
import { type TenantEntitlementsReader } from './tenant/entitlements.js';
|
|
49
|
+
import { type FieldGroupOwnersReader, type FieldGroupSyncSourcesReader } from './tenant/field-groups.js';
|
|
50
|
+
import { type LegalEntityModule } from './tenant/legal-entity.js';
|
|
51
|
+
import { type NotificationsModule } from './tenant/notifications.js';
|
|
25
52
|
import { type RetentionModule } from './tenant/retention.js';
|
|
53
|
+
import { type SettingsSourcesModule } from './tenant/settings-sources.js';
|
|
26
54
|
import { type UploadsModule } from './uploads/index.js';
|
|
55
|
+
import { type UsersModule } from './users/index.js';
|
|
27
56
|
export interface AdminClientConfig {
|
|
28
57
|
urls: {
|
|
29
58
|
vendureUrl: string;
|
|
@@ -71,21 +100,54 @@ export interface AdminClient {
|
|
|
71
100
|
apiTokens: ApiTokensModule;
|
|
72
101
|
/** Installing and managing apps on the ACTIVE store. Needs `InstallApps`. */
|
|
73
102
|
apps: AppsModule & {
|
|
74
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* One installation's own surfaces. `config` is its settings form (spec §8.13);
|
|
105
|
+
* `eventSubscription` is the calling installation's event subscription and
|
|
106
|
+
* its signing secret (spec §6.9), read with the installation's own credential.
|
|
107
|
+
*/
|
|
75
108
|
installation: {
|
|
76
109
|
config: AppInstallationConfigModule;
|
|
110
|
+
eventSubscription: AppEventSubscriptionModule;
|
|
111
|
+
/**
|
|
112
|
+
* The calling installation's hook signing secret, ONCE (spec §8.14): read it
|
|
113
|
+
* with the installation's own credential and hand it to `createHookHandler`.
|
|
114
|
+
*/
|
|
115
|
+
hookSecret: AppHookSecretModule;
|
|
77
116
|
};
|
|
78
117
|
};
|
|
79
118
|
audit: AuditModule;
|
|
119
|
+
/**
|
|
120
|
+
* Products, variants, options, facets, collections, assets, visibility and
|
|
121
|
+
* properties (spec §9.2 `catalog`). Needs the catalog permissions.
|
|
122
|
+
*/
|
|
123
|
+
catalog: CatalogModule;
|
|
80
124
|
channels: ChannelsModule;
|
|
81
125
|
content: {
|
|
82
126
|
forms: FormsModule;
|
|
83
127
|
};
|
|
128
|
+
/**
|
|
129
|
+
* Compliance requests to installed apps: data requests, customer and
|
|
130
|
+
* post-uninstall redactions, their acknowledgements and who is overdue (spec §6.9).
|
|
131
|
+
*/
|
|
132
|
+
compliance: ComplianceModule;
|
|
84
133
|
/**
|
|
85
134
|
* Invoices, credit notes and packing slips: issuing them, the numbered facts
|
|
86
135
|
* they were built from, and the store's own extension blocks (spec §8.5).
|
|
87
136
|
*/
|
|
88
137
|
documents: DocumentsModule;
|
|
138
|
+
/**
|
|
139
|
+
* App hooks (spec §8.14): calls the PLATFORM makes to an installed app, signed,
|
|
140
|
+
* budgeted, never redirected and audited. `assignments` makes an installed app
|
|
141
|
+
* the store's tax, payment or fulfillment provider; `ping` tests one hook.
|
|
142
|
+
*/
|
|
143
|
+
hooks: HooksModule;
|
|
144
|
+
/**
|
|
145
|
+
* Platform events (spec §6.9): `poll`/`pollAll`/`replay`/`head` over the event log (a
|
|
146
|
+
* machine credential with `ReadPlatformEvents`), `subscribe` to build a typed webhook
|
|
147
|
+
* endpoint, and `subscriptions.*` for where events are pushed (`ManageEventSubscriptions`,
|
|
148
|
+
* the `events` token template).
|
|
149
|
+
*/
|
|
150
|
+
events: EventsModule;
|
|
89
151
|
/**
|
|
90
152
|
* Customers — the commerce master record, plus their groups and addresses.
|
|
91
153
|
* `list`/`get` need `ReadCustomer`, the writes `UpdateCustomer`, and `erase`
|
|
@@ -93,9 +155,25 @@ export interface AdminClient {
|
|
|
93
155
|
* a customer across channels by email and is not reachable through this SDK.
|
|
94
156
|
*/
|
|
95
157
|
customers: CustomersModule;
|
|
158
|
+
/**
|
|
159
|
+
* A fulfillment's parcels, per-parcel barcodes, merged carrier label, and
|
|
160
|
+
* the request that labels every parcel still missing one.
|
|
161
|
+
*/
|
|
162
|
+
fulfillments: FulfillmentsModule;
|
|
163
|
+
/**
|
|
164
|
+
* Product feeds (spec §8.14): the configurations, their rule ASTs, the runs
|
|
165
|
+
* and item issues the generator produces, the Google-taxonomy mapping and the
|
|
166
|
+
* AI helpers. Channel-scoped throughout — no method takes a channel.
|
|
167
|
+
*/
|
|
168
|
+
feeds: FeedsModule;
|
|
96
169
|
/** The store's head registry: every client surface it serves (spec §6.7). */
|
|
97
170
|
heads: HeadsModule;
|
|
98
171
|
/** Every long-running operation the platform runs, under one resource (spec §6.11). */
|
|
172
|
+
/**
|
|
173
|
+
* JSONL bulk import and export (spec §6.11, §15.22): a million rows as one
|
|
174
|
+
* job, per-row outcomes, and none of your rate limit spent on the rows.
|
|
175
|
+
*/
|
|
176
|
+
bulk: BulkModule;
|
|
99
177
|
jobs: JobsModule;
|
|
100
178
|
/** Stock-location profiles (spec §8.7); `TenantContext.location` names one by id. */
|
|
101
179
|
locations: LocationsModule;
|
|
@@ -109,8 +187,9 @@ export interface AdminClient {
|
|
|
109
187
|
/** App and platform custom data on core entities (spec §8.13, §8.4). */
|
|
110
188
|
metafields: MetafieldsModule;
|
|
111
189
|
/**
|
|
112
|
-
* Surcharges on a placed order (spec §8.6 for `taxClass`),
|
|
113
|
-
* flow: park, read the payment position, settle (spec §8.2, §15.5)
|
|
190
|
+
* Surcharges on a placed order (spec §8.6 for `taxClass`), the deposit
|
|
191
|
+
* flow: park, read the payment position, settle (spec §8.2, §15.5), and the
|
|
192
|
+
* parcel count its shipping was charged for (`parcelCharge`).
|
|
114
193
|
*/
|
|
115
194
|
orders: OrdersModule;
|
|
116
195
|
/**
|
|
@@ -118,9 +197,47 @@ export interface AdminClient {
|
|
|
118
197
|
* recorded against an order with what it stands at (spec §8.2).
|
|
119
198
|
*/
|
|
120
199
|
payments: PaymentsModule;
|
|
200
|
+
/**
|
|
201
|
+
* Point of sale on a machine principal (spec §8.8): register sessions, cash,
|
|
202
|
+
* tenders, the sale, refunds, X and Z — with no paired tablet. Needs a `pos`
|
|
203
|
+
* token restricted to the location it sells from, and `tenant.location`.
|
|
204
|
+
*/
|
|
205
|
+
pos: PosModule;
|
|
206
|
+
/**
|
|
207
|
+
* Promotions at the register (spec §9.2 `pricing`): the promotions a register
|
|
208
|
+
* can offer now, coupons — plain and unique codes — on a Draft order, and what
|
|
209
|
+
* each discount did to each line.
|
|
210
|
+
*/
|
|
211
|
+
pricing: PricingModule;
|
|
212
|
+
/**
|
|
213
|
+
* Who last changed each field group (price, stock, product details, customer details) of a
|
|
214
|
+
* product, variant or customer, and whether an app or key manages it (spec §8.10). Last
|
|
215
|
+
* writer only; the history is the platform event log.
|
|
216
|
+
*/
|
|
217
|
+
provenance: ProvenanceModule;
|
|
218
|
+
/** Tenant reporting in minor units and ISO-8601 UTC (spec §9.2 `reports`, §9.3). */
|
|
219
|
+
reports: ReportsModule;
|
|
121
220
|
seo: {
|
|
122
221
|
redirects: RedirectsModule;
|
|
123
222
|
};
|
|
223
|
+
/**
|
|
224
|
+
* Shipping of the ACTIVE channel (spec §9.2 `shipping`): the channel's
|
|
225
|
+
* `parcelRule`, and `parcelCountSuggestion` for a set of variant items.
|
|
226
|
+
*/
|
|
227
|
+
shipping: ShippingModule & {
|
|
228
|
+
parcelCountSuggestion: ParcelCountSuggestionMethod;
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* Stock per location by state, the ledger with reasons, reason-carrying
|
|
232
|
+
* adjustments, transfers and allocation release (spec §9.2 `stock`, §8.7).
|
|
233
|
+
*/
|
|
234
|
+
stock: StockModule;
|
|
235
|
+
/**
|
|
236
|
+
* Stored value (incentives program): gift cards, store credit and points on one ledger —
|
|
237
|
+
* accounts, statements, liability, staff issue/adjust/block, and spending a balance as a
|
|
238
|
+
* payment on an order.
|
|
239
|
+
*/
|
|
240
|
+
storedValue: StoredValueModule;
|
|
124
241
|
/** The store's own tax classes and their per-country mappings (spec §8.6). */
|
|
125
242
|
tax: TaxModule;
|
|
126
243
|
/**
|
|
@@ -128,10 +245,40 @@ export interface AdminClient {
|
|
|
128
245
|
* bytes straight to the object store, then hand the id to a consuming call.
|
|
129
246
|
*/
|
|
130
247
|
uploads: UploadsModule;
|
|
248
|
+
/**
|
|
249
|
+
* The active store's staff (spec §7 `users.ensure`): `ensure` brings a person to exactly these
|
|
250
|
+
* roles in one repeatable call (created, attached, restored or unchanged), `update` changes their
|
|
251
|
+
* names or login email.
|
|
252
|
+
*/
|
|
253
|
+
users: UsersModule;
|
|
131
254
|
/** The calling tenant's own settings. Always the ACTIVE channel — no channel argument. */
|
|
132
255
|
tenant: {
|
|
133
256
|
capabilities: CapabilitiesModule;
|
|
257
|
+
/**
|
|
258
|
+
* The plugins the active store may use: its own grants and its organization's, as the
|
|
259
|
+
* engine's operation gate reads them, uncached. Needs `ReadCatalog` or `ReadSettings`.
|
|
260
|
+
*/
|
|
261
|
+
entitlements: TenantEntitlementsReader;
|
|
262
|
+
/**
|
|
263
|
+
* Who owns each field group on the active store (an app installation or an API token), as
|
|
264
|
+
* the grant rules read it. Release one with `apps.releaseFieldGroup`.
|
|
265
|
+
*/
|
|
266
|
+
fieldGroupOwners: FieldGroupOwnersReader;
|
|
267
|
+
/** The field groups Exact Online or the store's organization already writes here. */
|
|
268
|
+
fieldGroupSyncSources: FieldGroupSyncSourcesReader;
|
|
134
269
|
retention: RetentionModule;
|
|
270
|
+
/** Per notification event: on or off, who sends it (spec §8.15), and to whom. */
|
|
271
|
+
notifications: NotificationsModule;
|
|
272
|
+
/**
|
|
273
|
+
* Where each settings group comes from — the store or its organization — and the store's
|
|
274
|
+
* choice to keep its own values (multi-region spec §5.3).
|
|
275
|
+
*/
|
|
276
|
+
settingsSources: SettingsSourcesModule;
|
|
277
|
+
/**
|
|
278
|
+
* The active store's legal entity: the company its invoices name (multi-region spec §7.1).
|
|
279
|
+
* Changing it needs `UpdateSeller` on every store of the entity.
|
|
280
|
+
*/
|
|
281
|
+
legalEntity: LegalEntityModule;
|
|
135
282
|
};
|
|
136
283
|
/**
|
|
137
284
|
* Human SuperAdmin surface. Every method refuses an API token or an app
|
|
@@ -140,6 +287,27 @@ export interface AdminClient {
|
|
|
140
287
|
*/
|
|
141
288
|
platform: PlatformModule & {
|
|
142
289
|
apps: PlatformAppsModule;
|
|
290
|
+
/** Catalogue maintenance on a named store (the translation-language repair). */
|
|
291
|
+
catalog: PlatformCatalogModule;
|
|
292
|
+
/**
|
|
293
|
+
* Which external plugins each store may use: read one store's grants or every store's, and
|
|
294
|
+
* connect or disconnect a plugin for a store — see {@link PlatformEntitlementsModule}.
|
|
295
|
+
*/
|
|
296
|
+
entitlements: PlatformEntitlementsModule;
|
|
297
|
+
/**
|
|
298
|
+
* The platform's legal entities (multi-region spec §7.1): SuperAdmin list and create; read and
|
|
299
|
+
* update through every store of an entity — see {@link PlatformLegalEntitiesModule}.
|
|
300
|
+
*/
|
|
301
|
+
legalEntities: PlatformLegalEntitiesModule;
|
|
302
|
+
/**
|
|
303
|
+
* Organizations and their plugin entitlements (multi-region spec §5.1).
|
|
304
|
+
* An organization admin reads and edits its own with the organization's
|
|
305
|
+
* workspace channel as the tenant — see {@link PlatformOrganizationsModule}.
|
|
306
|
+
*/
|
|
307
|
+
organizations: PlatformOrganizationsModule;
|
|
308
|
+
reports: PlatformReportsModule;
|
|
309
|
+
/** Basic health of the platform's own servers (CPU, memory, disk, network). */
|
|
310
|
+
serverMetrics: PlatformServerMetricsModule;
|
|
143
311
|
};
|
|
144
312
|
/** A derived client on another tenant, sharing this one's principal. */
|
|
145
313
|
withTenant(tenant: Partial<TenantContext> & {
|
package/dist/client.js
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
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';
|
|
13
22
|
import { createJobsModule } from './jobs/index.js';
|
|
14
23
|
import { createLocationsModule } from './locations/index.js';
|
|
15
24
|
import { createMetaModule } from './meta/index.js';
|
|
@@ -17,13 +26,33 @@ import { createMetafieldsModule } from './metafields/index.js';
|
|
|
17
26
|
import { createOrdersModule } from './orders/index.js';
|
|
18
27
|
import { createPaymentsModule } from './payments/index.js';
|
|
19
28
|
import { createPlatformAppsModule } from './platform/apps.js';
|
|
29
|
+
import { createPlatformCatalogModule } from './platform/catalog.js';
|
|
30
|
+
import { createPlatformEntitlementsModule, } from './platform/entitlements.js';
|
|
31
|
+
import { createPlatformLegalEntitiesModule, } from './platform/legal-entities.js';
|
|
32
|
+
import { createPlatformOrganizationsModule, } from './platform/organizations.js';
|
|
20
33
|
import { createPlatformModule } from './platform/provision-store.js';
|
|
34
|
+
import { createPlatformReportsModule } from './platform/reports.js';
|
|
35
|
+
import { createPlatformServerMetricsModule, } from './platform/server-metrics.js';
|
|
36
|
+
import { createPosModule } from './pos/index.js';
|
|
37
|
+
import { createPricingModule } from './pricing/index.js';
|
|
38
|
+
import { createProvenanceModule } from './provenance/index.js';
|
|
39
|
+
import { createReportsModule } from './reports/index.js';
|
|
21
40
|
import { createRedirectsModule } from './seo/redirects.js';
|
|
41
|
+
import { createParcelCountSuggestion, } from './shipping/parcel-count-suggestion.js';
|
|
42
|
+
import { createShippingModule } from './shipping/parcel-rule.js';
|
|
43
|
+
import { createStockModule } from './stock/index.js';
|
|
44
|
+
import { createStoredValueModule } from './stored-value/index.js';
|
|
22
45
|
import { createTaxModule } from './tax/index.js';
|
|
23
46
|
import { createCapabilitiesModule } from './tenant/capabilities.js';
|
|
24
47
|
import { createChannelsModule } from './tenant/channels.js';
|
|
48
|
+
import { createTenantEntitlementsReader, } from './tenant/entitlements.js';
|
|
49
|
+
import { createFieldGroupOwnersReader, createFieldGroupSyncSourcesReader, } from './tenant/field-groups.js';
|
|
50
|
+
import { createLegalEntityModule } from './tenant/legal-entity.js';
|
|
51
|
+
import { createNotificationsModule } from './tenant/notifications.js';
|
|
25
52
|
import { createRetentionModule } from './tenant/retention.js';
|
|
53
|
+
import { createSettingsSourcesModule, } from './tenant/settings-sources.js';
|
|
26
54
|
import { createUploadsModule } from './uploads/index.js';
|
|
55
|
+
import { createUsersModule } from './users/index.js';
|
|
27
56
|
/**
|
|
28
57
|
* An admin credential in a browser is a credential the whole internet can read
|
|
29
58
|
* (spec §18 amendment 3, §15.21). A SESSION bearer is fine there — that is what
|
|
@@ -35,11 +64,9 @@ function assertNotInBrowser(auth) {
|
|
|
35
64
|
// long-lived token is, and for the same reason.
|
|
36
65
|
if (!('token' in auth) && !('app' in auth))
|
|
37
66
|
return;
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
|
|
41
|
-
const inBrowser = runtime.window !== undefined && runtime.document !== undefined;
|
|
42
|
-
if (!inBrowser)
|
|
67
|
+
// `core`'s one definition of "a browser", which the storefront SDK's
|
|
68
|
+
// private-token refusal uses too, so the two SDKs cannot disagree about it.
|
|
69
|
+
if (!isBrowserRuntime())
|
|
43
70
|
return;
|
|
44
71
|
const credential = 'app' in auth ? "An app's private key" : 'An API token';
|
|
45
72
|
throw new ValidationError({
|
|
@@ -157,7 +184,11 @@ function assertSessionIsWritable(session) {
|
|
|
157
184
|
*/
|
|
158
185
|
function buildAppsModule(transport) {
|
|
159
186
|
const apps = createAppsModule(transport);
|
|
160
|
-
const installation = Object.assign((id, options) => apps.installation(id, options), {
|
|
187
|
+
const installation = Object.assign((id, options) => apps.installation(id, options), {
|
|
188
|
+
config: createAppConfigModule(transport),
|
|
189
|
+
eventSubscription: createAppEventSubscriptionModule(transport),
|
|
190
|
+
hookSecret: createAppHookSecretModule(transport),
|
|
191
|
+
});
|
|
161
192
|
return { ...apps, installation };
|
|
162
193
|
}
|
|
163
194
|
export function createAdminClient(config) {
|
|
@@ -325,6 +356,17 @@ function buildClient(config, overrides, resolver, shared, credential) {
|
|
|
325
356
|
// No guard here: the transport refuses an unscoped call itself with
|
|
326
357
|
// TENANT_REQUIRED unless it opts in, and only `auth` does. One rule, in the
|
|
327
358
|
// one place that knows what left the process.
|
|
359
|
+
const jobsModule = createJobsModule(transport);
|
|
360
|
+
// The PUT goes to the object store, not to this platform, so it needs the
|
|
361
|
+
// caller's own fetch rather than the transport — which would attach the
|
|
362
|
+
// tenant headers and the bearer to a request that must carry neither.
|
|
363
|
+
const uploadsModule = createUploadsModule(transport, config.fetch ?? globalThis.fetch);
|
|
364
|
+
// Composed from the two modules it is built on rather than re-implementing
|
|
365
|
+
// either: `import` stages the file through `uploads` — the exact
|
|
366
|
+
// `Content-Length` + `Content-Type` + `client_token` protocol, in one place
|
|
367
|
+
// — and waits on the run through `jobs`, which owns the polling loop.
|
|
368
|
+
// `reports.export` rides the same export machinery, so it shares both.
|
|
369
|
+
const bulkModule = createBulkModule(transport, uploadsModule, jobsModule);
|
|
328
370
|
return {
|
|
329
371
|
auth: createAuthModule(transport, store && {
|
|
330
372
|
present: () => store.read() !== '',
|
|
@@ -346,32 +388,59 @@ function buildClient(config, overrides, resolver, shared, credential) {
|
|
|
346
388
|
}),
|
|
347
389
|
apiTokens: createApiTokensModule(transport),
|
|
348
390
|
apps: buildAppsModule(transport),
|
|
391
|
+
bulk: bulkModule,
|
|
349
392
|
audit: createAuditModule(transport),
|
|
393
|
+
catalog: createCatalogModule(transport),
|
|
350
394
|
channels: createChannelsModule(resolver),
|
|
351
395
|
content: { forms: createFormsModule(transport) },
|
|
396
|
+
fulfillments: createFulfillmentsModule(transport),
|
|
352
397
|
heads: createHeadsModule(transport),
|
|
353
|
-
jobs:
|
|
398
|
+
jobs: jobsModule,
|
|
354
399
|
locations: createLocationsModule(transport),
|
|
355
400
|
meta: createMetaModule(transport),
|
|
356
401
|
customObjects: createCustomObjectsModule(transport),
|
|
357
402
|
metafields: createMetafieldsModule(transport),
|
|
358
403
|
orders: createOrdersModule(transport),
|
|
359
404
|
payments: createPaymentsModule(transport),
|
|
405
|
+
pos: createPosModule(transport),
|
|
406
|
+
pricing: createPricingModule(transport),
|
|
407
|
+
provenance: createProvenanceModule(transport),
|
|
408
|
+
reports: createReportsModule(transport, bulkModule, jobsModule, () => tenant.location),
|
|
360
409
|
documents: createDocumentsModule(transport),
|
|
410
|
+
hooks: createHooksModule(transport),
|
|
411
|
+
events: createEventsModule(transport),
|
|
361
412
|
customers: createCustomersModule(transport),
|
|
413
|
+
compliance: createComplianceModule(transport),
|
|
414
|
+
feeds: createFeedsModule(transport),
|
|
362
415
|
seo: { redirects: createRedirectsModule(transport) },
|
|
416
|
+
shipping: {
|
|
417
|
+
...createShippingModule(transport),
|
|
418
|
+
parcelCountSuggestion: createParcelCountSuggestion(transport),
|
|
419
|
+
},
|
|
420
|
+
stock: createStockModule(transport),
|
|
421
|
+
storedValue: createStoredValueModule(transport),
|
|
363
422
|
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),
|
|
423
|
+
uploads: uploadsModule,
|
|
424
|
+
users: createUsersModule(transport),
|
|
368
425
|
tenant: {
|
|
369
426
|
capabilities: createCapabilitiesModule(transport),
|
|
427
|
+
entitlements: createTenantEntitlementsReader(transport),
|
|
428
|
+
fieldGroupOwners: createFieldGroupOwnersReader(transport),
|
|
429
|
+
fieldGroupSyncSources: createFieldGroupSyncSourcesReader(transport),
|
|
370
430
|
retention: createRetentionModule(transport),
|
|
431
|
+
notifications: createNotificationsModule(transport),
|
|
432
|
+
settingsSources: createSettingsSourcesModule(transport),
|
|
433
|
+
legalEntity: createLegalEntityModule(transport),
|
|
371
434
|
},
|
|
372
435
|
platform: {
|
|
373
436
|
...createPlatformModule(transport, config),
|
|
374
437
|
apps: createPlatformAppsModule(transport, config),
|
|
438
|
+
catalog: createPlatformCatalogModule(transport, config),
|
|
439
|
+
entitlements: createPlatformEntitlementsModule(transport, config),
|
|
440
|
+
legalEntities: createPlatformLegalEntitiesModule(transport, config),
|
|
441
|
+
organizations: createPlatformOrganizationsModule(transport, config),
|
|
442
|
+
reports: createPlatformReportsModule(transport, config),
|
|
443
|
+
serverMetrics: createPlatformServerMetricsModule(transport, config),
|
|
375
444
|
},
|
|
376
445
|
withTenant(next) {
|
|
377
446
|
// `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
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
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 function redactionWatcher() {
|
|
10
|
+
let withheld = false;
|
|
11
|
+
return {
|
|
12
|
+
onExtensions(extensions) {
|
|
13
|
+
const redaction = extensions.customerDataRedaction;
|
|
14
|
+
withheld = typeof redaction?.fields === 'number' && redaction.fields > 0;
|
|
15
|
+
},
|
|
16
|
+
mark(record) {
|
|
17
|
+
if (record && withheld)
|
|
18
|
+
record.redacted = true;
|
|
19
|
+
return record;
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|