@hostwebhook/node-types 1.74.0 → 1.75.1
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/dist/calendar-operations.js +9 -2
- package/dist/esm/calendar-operations.js +9 -2
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/shopify-operations.d.ts +112 -11
- package/dist/esm/shopify-operations.js +413 -9
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -3
- package/dist/shopify-operations.d.ts +112 -11
- package/dist/shopify-operations.js +415 -10
- package/package.json +1 -1
|
@@ -58,8 +58,15 @@ const eventConfigParams = () => [
|
|
|
58
58
|
{ name: 'summaryTemplate', target: 'eventConfig', label: 'Summary', type: 'template', placeholder: '{{payload.title}}', execKey: 'summary' },
|
|
59
59
|
{ name: 'descriptionTemplate', target: 'eventConfig', label: 'Description', type: 'template', placeholder: 'Event description... (supports {{templates}})', execKey: 'description' },
|
|
60
60
|
{ name: 'locationTemplate', target: 'eventConfig', label: 'Location', type: 'template', placeholder: '{{payload.location}}', execKey: 'location' },
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
/* Los `description` de estos dos son la única pantalla donde el usuario se
|
|
62
|
+
entera de la regla de ambigüedad ANTES de mandar el payload. `05-06-2026`
|
|
63
|
+
se rechaza en ejecución (ver `normalizeDate`), y un rechazo que sólo
|
|
64
|
+
aparece en el log del run llega tarde: aquí se dice al lado del campo.
|
|
65
|
+
El de End Date dice además que es el ÚLTIMO DÍA INCLUIDO, porque el `+1`
|
|
66
|
+
de la exclusividad de Google lo pone HostWebhook y sin decirlo el usuario
|
|
67
|
+
lo escribiría dos veces. */
|
|
68
|
+
{ name: 'startTemplate', target: 'eventConfig', label: 'Start Date', type: 'template', placeholder: '{{payload.startTime}}', description: 'YYYY-MM-DD for an all-day event, or YYYY-MM-DDTHH:mm:ss for a timed one (interpreted in the Time Zone below). M-D-YYYY and D-M-YYYY work only when one part is above 12 — 05-06-2026 is rejected as ambiguous instead of guessed.', execKey: 'start' },
|
|
69
|
+
{ name: 'endTemplate', target: 'eventConfig', label: 'End Date', type: 'template', placeholder: '{{payload.endTime}}', description: 'YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss, same rules as Start Date. For all-day events this is the LAST DAY INCLUDED — HostWebhook adds the extra day Google needs, so a trip ending 2026-09-21 goes in as 2026-09-21.', execKey: 'end' },
|
|
63
70
|
{
|
|
64
71
|
name: 'attendeesTemplate',
|
|
65
72
|
target: 'eventConfig',
|
|
@@ -54,8 +54,15 @@ const eventConfigParams = () => [
|
|
|
54
54
|
{ name: 'summaryTemplate', target: 'eventConfig', label: 'Summary', type: 'template', placeholder: '{{payload.title}}', execKey: 'summary' },
|
|
55
55
|
{ name: 'descriptionTemplate', target: 'eventConfig', label: 'Description', type: 'template', placeholder: 'Event description... (supports {{templates}})', execKey: 'description' },
|
|
56
56
|
{ name: 'locationTemplate', target: 'eventConfig', label: 'Location', type: 'template', placeholder: '{{payload.location}}', execKey: 'location' },
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
/* Los `description` de estos dos son la única pantalla donde el usuario se
|
|
58
|
+
entera de la regla de ambigüedad ANTES de mandar el payload. `05-06-2026`
|
|
59
|
+
se rechaza en ejecución (ver `normalizeDate`), y un rechazo que sólo
|
|
60
|
+
aparece en el log del run llega tarde: aquí se dice al lado del campo.
|
|
61
|
+
El de End Date dice además que es el ÚLTIMO DÍA INCLUIDO, porque el `+1`
|
|
62
|
+
de la exclusividad de Google lo pone HostWebhook y sin decirlo el usuario
|
|
63
|
+
lo escribiría dos veces. */
|
|
64
|
+
{ name: 'startTemplate', target: 'eventConfig', label: 'Start Date', type: 'template', placeholder: '{{payload.startTime}}', description: 'YYYY-MM-DD for an all-day event, or YYYY-MM-DDTHH:mm:ss for a timed one (interpreted in the Time Zone below). M-D-YYYY and D-M-YYYY work only when one part is above 12 — 05-06-2026 is rejected as ambiguous instead of guessed.', execKey: 'start' },
|
|
65
|
+
{ name: 'endTemplate', target: 'eventConfig', label: 'End Date', type: 'template', placeholder: '{{payload.endTime}}', description: 'YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss, same rules as Start Date. For all-day events this is the LAST DAY INCLUDED — HostWebhook adds the extra day Google needs, so a trip ending 2026-09-21 goes in as 2026-09-21.', execKey: 'end' },
|
|
59
66
|
{
|
|
60
67
|
name: 'attendeesTemplate',
|
|
61
68
|
target: 'eventConfig',
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -30,8 +30,8 @@ export { DISCORD_TOOLKIT_SPECS, DISCORD_TOOLKIT_BY_TOOL_NAME, herramientasDeDisc
|
|
|
30
30
|
export type { DiscordToolkitSpec, DiscordToolkitParameter, } from './discord-toolkit.js';
|
|
31
31
|
export { MAILCHIMP_OPERATIONS, MAILCHIMP_OPERATION_SPECS, MAILCHIMP_CONTACT_STATUSES, isMailchimpOperation, } from './mailchimp-operations.js';
|
|
32
32
|
export type { MailchimpOperation, MailchimpContactStatus, MailchimpParamSpec, MailchimpOperationSpec, } from './mailchimp-operations.js';
|
|
33
|
-
export { SHOPIFY_OPERATIONS, SHOPIFY_OPERATION_SPECS, SHOPIFY_TAGGABLE_RESOURCES, SHOPIFY_SEARCHABLE_RESOURCES, isShopifyOperation, } from './shopify-operations.js';
|
|
34
|
-
export type { ShopifyOperation, ShopifyTaggableResource, ShopifySearchableResource, ShopifyParamSpec, ShopifyOperationSpec, } from './shopify-operations.js';
|
|
33
|
+
export { SHOPIFY_OPERATIONS, SHOPIFY_OPERATION_SPECS, SHOPIFY_OPERATION_SCOPES, SHOPIFY_TAGGABLE_RESOURCES, SHOPIFY_SEARCHABLE_RESOURCES, SHOPIFY_CANCEL_REASONS, SHOPIFY_PRODUCT_STATUSES, isShopifyOperation, scopesQueFaltanEnShopify, } from './shopify-operations.js';
|
|
34
|
+
export type { ShopifyOperation, ShopifyTaggableResource, ShopifySearchableResource, ShopifyCancelReason, ShopifyProductStatus, ShopifyParamSpec, ShopifyOperationSpec, } from './shopify-operations.js';
|
|
35
35
|
export { GITHUB_OPERATIONS, GITHUB_OPERATION_SPECS, GITHUB_DROPDOWN_OPERATIONS, GITHUB_ITERABLE_OPERATIONS, isGithubOperation, } from './github-operations.js';
|
|
36
36
|
export type { GithubOperation, GithubParamType, GithubParamSpec, GithubOperationSpec, } from './github-operations.js';
|
|
37
37
|
export { JIRA_OPERATIONS, JIRA_OPERATION_SPECS, JIRA_DROPDOWN_OPERATIONS, JIRA_ITERABLE_OPERATIONS, isJiraOperation, } from './jira-operations.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -29,7 +29,7 @@ export { DISCORD_OPERATIONS, DISCORD_OPERATION_SPECS, DISCORD_CAPACIDADES_POR_CR
|
|
|
29
29
|
ve el LLM. Es la misma pareja que ya tienen Telegram, Sheets y compañía. */
|
|
30
30
|
export { DISCORD_TOOLKIT_SPECS, DISCORD_TOOLKIT_BY_TOOL_NAME, herramientasDeDiscordPara, } from './discord-toolkit.js';
|
|
31
31
|
export { MAILCHIMP_OPERATIONS, MAILCHIMP_OPERATION_SPECS, MAILCHIMP_CONTACT_STATUSES, isMailchimpOperation, } from './mailchimp-operations.js';
|
|
32
|
-
export { SHOPIFY_OPERATIONS, SHOPIFY_OPERATION_SPECS, SHOPIFY_TAGGABLE_RESOURCES, SHOPIFY_SEARCHABLE_RESOURCES, isShopifyOperation, } from './shopify-operations.js';
|
|
32
|
+
export { SHOPIFY_OPERATIONS, SHOPIFY_OPERATION_SPECS, SHOPIFY_OPERATION_SCOPES, SHOPIFY_TAGGABLE_RESOURCES, SHOPIFY_SEARCHABLE_RESOURCES, SHOPIFY_CANCEL_REASONS, SHOPIFY_PRODUCT_STATUSES, isShopifyOperation, scopesQueFaltanEnShopify, } from './shopify-operations.js';
|
|
33
33
|
export { GITHUB_OPERATIONS, GITHUB_OPERATION_SPECS, GITHUB_DROPDOWN_OPERATIONS, GITHUB_ITERABLE_OPERATIONS, isGithubOperation, } from './github-operations.js';
|
|
34
34
|
export { JIRA_OPERATIONS, JIRA_OPERATION_SPECS, JIRA_DROPDOWN_OPERATIONS, JIRA_ITERABLE_OPERATIONS, isJiraOperation, } from './jira-operations.js';
|
|
35
35
|
export { BUCKET_OPERATIONS, BUCKET_OPERATION_SPECS, BUCKET_ITERABLE_OPERATIONS, isBucketOperation, } from './bucket-operations.js';
|
|
@@ -2,18 +2,24 @@
|
|
|
2
2
|
* Shopify Admin API operations — single source of truth across the api, the
|
|
3
3
|
* dashboard and downstream consumers (MCP server).
|
|
4
4
|
*
|
|
5
|
-
* ##
|
|
5
|
+
* ## Ten, out of several hundred
|
|
6
6
|
*
|
|
7
|
-
* The Admin API has hundreds of mutations. This node exposes
|
|
7
|
+
* The Admin API has hundreds of mutations. This node exposes ten, and the
|
|
8
8
|
* choice is argued in `api/docs/ADR-0007-shopify.md`: a menu of everything is
|
|
9
|
-
* how a node becomes unusable
|
|
10
|
-
* automate — put a customer in the store, tag something, sync stock, and read
|
|
11
|
-
* back what the store already knows.
|
|
9
|
+
* how a node becomes unusable.
|
|
12
10
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
11
|
+
* The first four cover what people automate on day one — put a customer in the
|
|
12
|
+
* store, tag something, sync stock, and read back what the store already
|
|
13
|
+
* knows. The six added on 2026-09-08 cover what they ask for on day two: the
|
|
14
|
+
* order lifecycle (draft → complete → fulfil → cancel), custom data
|
|
15
|
+
* (metafields) and putting a product in the catalogue.
|
|
16
|
+
*
|
|
17
|
+
* ⚠️ **Every entry below carries the OAuth scope it needs**, in
|
|
18
|
+
* `SHOPIFY_OPERATION_SCOPES`. That is not documentation: a scope missing from
|
|
19
|
+
* the credential answers HTTP 403 on a call that looks perfectly formed, and
|
|
20
|
+
* on Shopify a scope is granted at INSTALL time — adding one to the app means
|
|
21
|
+
* every existing credential has to be reconnected before it can use the new
|
|
22
|
+
* operation.
|
|
17
23
|
*
|
|
18
24
|
* ## GraphQL only, and the version is not ours to drift on
|
|
19
25
|
*
|
|
@@ -54,8 +60,35 @@
|
|
|
54
60
|
* `inventoryAdjustQuantities` must be sent with the `@idempotent` directive
|
|
55
61
|
* and an idempotency key. A stock adjustment is the one operation here where a
|
|
56
62
|
* silent retry is a real inventory error, so this is not boilerplate.
|
|
63
|
+
*
|
|
64
|
+
* ## What was verified for the six added on 2026-09-08
|
|
65
|
+
*
|
|
66
|
+
* Read off the Admin GraphQL reference for the current version, not recalled.
|
|
67
|
+
* The pages, and the one fact from each that a from-memory version gets wrong:
|
|
68
|
+
*
|
|
69
|
+
* - `draftOrderCreate(input: DraftOrderInput!)` — `lineItems` is the only
|
|
70
|
+
* required field of the input, and each item is `{ variantId, quantity }`
|
|
71
|
+
* OR `{ title, originalUnitPrice, quantity }` for a custom line.
|
|
72
|
+
* - `draftOrderComplete(id: ID!, …)` — the id is a **sibling argument**, not
|
|
73
|
+
* inside an input. `paymentPending` is deprecated and is not offered here.
|
|
74
|
+
* - `fulfillmentCreate(fulfillment: FulfillmentInput!)` — takes
|
|
75
|
+
* `lineItemsByFulfillmentOrder`, NOT an order id. There is no mutation that
|
|
76
|
+
* fulfils "an order": fulfilment hangs off FulfillmentOrder, so the
|
|
77
|
+
* executor has to look them up first. That indirection is the whole reason
|
|
78
|
+
* ADR-0007 left this out of v1.
|
|
79
|
+
* - `orderCancel(orderId:, reason:, restock:, …)` — `reason` and `restock` are
|
|
80
|
+
* **required arguments**, and the payload's errors arrive in
|
|
81
|
+
* `orderCancelUserErrors`; plain `userErrors` is deprecated there.
|
|
82
|
+
* - `metafieldsSet(metafields: [MetafieldsSetInput!]!)` — takes a LIST, and
|
|
83
|
+
* each entry needs all of `ownerId`, `namespace`, `key`, `type`, `value`.
|
|
84
|
+
* `type` is not guessable from the value: `single_line_text_field` and
|
|
85
|
+
* `number_integer` are different metafields.
|
|
86
|
+
* - `productCreate(product: ProductCreateInput!)` — the argument is `product`,
|
|
87
|
+
* not `input`; `input: ProductInput` is the deprecated spelling. It creates
|
|
88
|
+
* ONE default variant; more variants are `productVariantsBulkCreate`, which
|
|
89
|
+
* is a surface of its own and is not offered here.
|
|
57
90
|
*/
|
|
58
|
-
export declare const SHOPIFY_OPERATIONS: readonly ["upsertCustomer", "setTags", "adjustInventory", "findRecords"];
|
|
91
|
+
export declare const SHOPIFY_OPERATIONS: readonly ["upsertCustomer", "setTags", "adjustInventory", "findRecords", "createDraftOrder", "completeDraftOrder", "fulfillOrder", "cancelOrder", "setMetafield", "createProduct"];
|
|
59
92
|
export type ShopifyOperation = (typeof SHOPIFY_OPERATIONS)[number];
|
|
60
93
|
/** Type guard — for DTOs and AI tool calls, where the input is untrusted. */
|
|
61
94
|
export declare function isShopifyOperation(value: unknown): value is ShopifyOperation;
|
|
@@ -72,6 +105,22 @@ export type ShopifyTaggableResource = (typeof SHOPIFY_TAGGABLE_RESOURCES)[number
|
|
|
72
105
|
/** What `findRecords` can read back. */
|
|
73
106
|
export declare const SHOPIFY_SEARCHABLE_RESOURCES: readonly ["orders", "customers", "products"];
|
|
74
107
|
export type ShopifySearchableResource = (typeof SHOPIFY_SEARCHABLE_RESOURCES)[number];
|
|
108
|
+
/**
|
|
109
|
+
* `OrderCancelReason`, the whole enum, in Shopify's own spelling.
|
|
110
|
+
*
|
|
111
|
+
* A dropdown and not free text — and that is the opposite of the call made for
|
|
112
|
+
* `adjustInventory`'s `reason`, on purpose. The difference is not taste: the
|
|
113
|
+
* inventory vocabulary was NOT verifiable from the reference (see the note
|
|
114
|
+
* above), so a dropdown there would have been a list of invented values. This
|
|
115
|
+
* one IS the enumeration, read off `enums/OrderCancelReason`, and an argument
|
|
116
|
+
* of type `OrderCancelReason!` rejects anything outside it — so free text here
|
|
117
|
+
* would only mean the user finds out by failing.
|
|
118
|
+
*/
|
|
119
|
+
export declare const SHOPIFY_CANCEL_REASONS: readonly ["CUSTOMER", "DECLINED", "FRAUD", "INVENTORY", "OTHER", "STAFF"];
|
|
120
|
+
export type ShopifyCancelReason = (typeof SHOPIFY_CANCEL_REASONS)[number];
|
|
121
|
+
/** `ProductStatus`, the whole enum. Same reasoning as the cancel reasons. */
|
|
122
|
+
export declare const SHOPIFY_PRODUCT_STATUSES: readonly ["ACTIVE", "DRAFT", "ARCHIVED"];
|
|
123
|
+
export type ShopifyProductStatus = (typeof SHOPIFY_PRODUCT_STATUSES)[number];
|
|
75
124
|
export interface ShopifyParamSpec {
|
|
76
125
|
/** Field key — also the property name on operationConfig. */
|
|
77
126
|
name: string;
|
|
@@ -80,7 +129,7 @@ export interface ShopifyParamSpec {
|
|
|
80
129
|
* picker backed by a live lookup of the store's locations; `gid` is a
|
|
81
130
|
* Shopify global id, which is almost always templated from the payload
|
|
82
131
|
* rather than typed. */
|
|
83
|
-
type: 'gid' | 'location' | 'email' | 'string' | 'number' | 'tags' | 'taggableResource' | 'searchableResource' | 'json' | 'boolean';
|
|
132
|
+
type: 'gid' | 'location' | 'email' | 'string' | 'number' | 'tags' | 'taggableResource' | 'searchableResource' | 'cancelReason' | 'productStatus' | 'json' | 'boolean';
|
|
84
133
|
required?: boolean;
|
|
85
134
|
description: string;
|
|
86
135
|
placeholder?: string;
|
|
@@ -93,3 +142,55 @@ export interface ShopifyOperationSpec {
|
|
|
93
142
|
params: ShopifyParamSpec[];
|
|
94
143
|
}
|
|
95
144
|
export declare const SHOPIFY_OPERATION_SPECS: Record<ShopifyOperation, ShopifyOperationSpec>;
|
|
145
|
+
/**
|
|
146
|
+
* The OAuth scope each operation needs, so a missing one is named BEFORE the
|
|
147
|
+
* call instead of arriving as an HTTP 403 on a request that looks fine.
|
|
148
|
+
*
|
|
149
|
+
* ## The list is "any one of", not "all of"
|
|
150
|
+
*
|
|
151
|
+
* That is `fulfillOrder`'s doing and it is not a generalisation for its own
|
|
152
|
+
* sake: which fulfilment-order scope applies depends on where the order is
|
|
153
|
+
* fulfilled from — the merchant's own locations, a third-party service, or the
|
|
154
|
+
* app itself acting as one. Shopify accepts the mutation if the token carries
|
|
155
|
+
* ANY of the three. Requiring all three would refuse a store that is correctly
|
|
156
|
+
* set up.
|
|
157
|
+
*
|
|
158
|
+
* ## An empty list means "not checkable from the operation alone"
|
|
159
|
+
*
|
|
160
|
+
* `setTags` tags an order, a customer or a product through the same mutation,
|
|
161
|
+
* and `setMetafield` writes onto whichever resource the owner id points at —
|
|
162
|
+
* so the scope depends on a FIELD, not on the operation. Guessing would be
|
|
163
|
+
* worse than not checking: a wrong guess blocks a call Shopify would have
|
|
164
|
+
* accepted, and a pre-flight check that produces false refusals gets deleted.
|
|
165
|
+
* Those fall through to Shopify's own 403, which `describeShopifyError`
|
|
166
|
+
* already explains.
|
|
167
|
+
*
|
|
168
|
+
* ⚠️ Read against `shopify.dev/docs/api/usage/access-scopes` and each
|
|
169
|
+
* mutation's own "Access requirements". Two things follow from that page and
|
|
170
|
+
* are relied on by `scopesQueFaltanEnShopify`:
|
|
171
|
+
*
|
|
172
|
+
* - **A write scope includes read.** `write_orders` grants `read_orders`, so
|
|
173
|
+
* a required `read_x` is satisfied by a granted `write_x`.
|
|
174
|
+
* - **Scopes are granted at install.** Adding one to the app does not give
|
|
175
|
+
* it to credentials that already exist; those have to be reconnected.
|
|
176
|
+
*/
|
|
177
|
+
export declare const SHOPIFY_OPERATION_SCOPES: Record<ShopifyOperation, readonly string[]>;
|
|
178
|
+
/**
|
|
179
|
+
* Which of an operation's scopes the credential does NOT have.
|
|
180
|
+
*
|
|
181
|
+
* Empty means "nothing to say" — and it says that in three different
|
|
182
|
+
* situations, all of which have to fail OPEN:
|
|
183
|
+
*
|
|
184
|
+
* 1. The operation declares no scope (the resource-dependent ones).
|
|
185
|
+
* 2. The credential has a scope string and it covers one of the alternatives.
|
|
186
|
+
* 3. **The credential has no scope string at all.** Shopify returns the
|
|
187
|
+
* granted scopes on the token exchange, but a credential stored before
|
|
188
|
+
* that was read, or one whose metadata was pruned, has an empty string —
|
|
189
|
+
* and refusing to run a node because we cannot see its permissions would
|
|
190
|
+
* break working flows to prevent a maybe. Shopify is the authority here;
|
|
191
|
+
* this check only saves the round trip when it can prove the answer.
|
|
192
|
+
*
|
|
193
|
+
* @param concedidos what Shopify granted, as it sends it: a comma-separated
|
|
194
|
+
* string, or the already-split list.
|
|
195
|
+
*/
|
|
196
|
+
export declare function scopesQueFaltanEnShopify(concedidos: string | readonly string[] | null | undefined, requeridos: readonly string[]): string[];
|