@keystrokehq/shopify 0.0.15 → 0.0.16-integration-id-canonicalization.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 +14 -153
- package/dist/{schemas.d.mts → common-C2s35du9.d.mts} +3 -2
- package/dist/{schemas.mjs → common-JZyHdK6p.mjs} +3 -3
- package/dist/credential-sets/index.d.mts +2 -0
- package/dist/credential-sets/index.mjs +4 -0
- package/dist/index.d.mts +4 -1
- package/dist/index.mjs +6 -1
- package/dist/operations/index.d.mts +2 -0
- package/dist/operations/index.mjs +3 -0
- package/dist/schemas/index.d.mts +2 -0
- package/dist/schemas/index.mjs +3 -0
- package/dist/shopify-app.credential-set-DuAYUhzY.d.mts +65 -0
- package/dist/shopify-app.credential-set-M3vKwTji.mjs +17 -0
- package/dist/shopify.credential-set-CaxST3GP.mjs +205 -0
- package/dist/update-shopify-product.operation-ByYhZggW.mjs +1972 -0
- package/dist/update-shopify-product.operation-Db_kLuJa.d.mts +2817 -0
- package/package.json +14 -69
- package/dist/_official/index.d.mts +0 -33
- package/dist/_official/index.mjs +0 -3
- package/dist/_runtime/index.d.mts +0 -56
- package/dist/_runtime/index.mjs +0 -150
- package/dist/articles.d.mts +0 -158
- package/dist/articles.mjs +0 -252
- package/dist/blogs.d.mts +0 -97
- package/dist/blogs.mjs +0 -174
- package/dist/client.d.mts +0 -22
- package/dist/client.mjs +0 -90
- package/dist/collections.d.mts +0 -121
- package/dist/collections.mjs +0 -209
- package/dist/connection.d.mts +0 -2
- package/dist/connection.mjs +0 -3
- package/dist/customers.d.mts +0 -142
- package/dist/customers.mjs +0 -225
- package/dist/events.d.mts +0 -181
- package/dist/events.mjs +0 -67
- package/dist/factory-DwZJl9JC.mjs +0 -8
- package/dist/fulfillments.d.mts +0 -89
- package/dist/fulfillments.mjs +0 -167
- package/dist/integration-B5LK_0eR.mjs +0 -63
- package/dist/integration-DrHCkXco.d.mts +0 -27
- package/dist/inventory.d.mts +0 -90
- package/dist/inventory.mjs +0 -182
- package/dist/locations.d.mts +0 -40
- package/dist/locations.mjs +0 -81
- package/dist/messaging.d.mts +0 -1
- package/dist/messaging.mjs +0 -1
- package/dist/operation-helpers-CKEDIx0o.mjs +0 -21
- package/dist/orders.d.mts +0 -213
- package/dist/orders.mjs +0 -271
- package/dist/products.d.mts +0 -139
- package/dist/products.mjs +0 -171
- package/dist/shop.d.mts +0 -16
- package/dist/shop.mjs +0 -31
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keystrokehq/shopify",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16-integration-id-canonicalization.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
@@ -9,73 +9,17 @@
|
|
|
9
9
|
"types": "./dist/index.d.mts",
|
|
10
10
|
"default": "./dist/index.mjs"
|
|
11
11
|
},
|
|
12
|
-
"./
|
|
13
|
-
"types": "./dist/
|
|
14
|
-
"default": "./dist/
|
|
12
|
+
"./credential-sets": {
|
|
13
|
+
"types": "./dist/credential-sets/index.d.mts",
|
|
14
|
+
"default": "./dist/credential-sets/index.mjs"
|
|
15
15
|
},
|
|
16
|
-
"./
|
|
17
|
-
"types": "./dist/
|
|
18
|
-
"default": "./dist/
|
|
19
|
-
},
|
|
20
|
-
"./client": {
|
|
21
|
-
"types": "./dist/client.d.mts",
|
|
22
|
-
"default": "./dist/client.mjs"
|
|
16
|
+
"./operations": {
|
|
17
|
+
"types": "./dist/operations/index.d.mts",
|
|
18
|
+
"default": "./dist/operations/index.mjs"
|
|
23
19
|
},
|
|
24
20
|
"./schemas": {
|
|
25
|
-
"types": "./dist/schemas.d.mts",
|
|
26
|
-
"default": "./dist/schemas.mjs"
|
|
27
|
-
},
|
|
28
|
-
"./events": {
|
|
29
|
-
"types": "./dist/events.d.mts",
|
|
30
|
-
"default": "./dist/events.mjs"
|
|
31
|
-
},
|
|
32
|
-
"./shop": {
|
|
33
|
-
"types": "./dist/shop.d.mts",
|
|
34
|
-
"default": "./dist/shop.mjs"
|
|
35
|
-
},
|
|
36
|
-
"./products": {
|
|
37
|
-
"types": "./dist/products.d.mts",
|
|
38
|
-
"default": "./dist/products.mjs"
|
|
39
|
-
},
|
|
40
|
-
"./collections": {
|
|
41
|
-
"types": "./dist/collections.d.mts",
|
|
42
|
-
"default": "./dist/collections.mjs"
|
|
43
|
-
},
|
|
44
|
-
"./orders": {
|
|
45
|
-
"types": "./dist/orders.d.mts",
|
|
46
|
-
"default": "./dist/orders.mjs"
|
|
47
|
-
},
|
|
48
|
-
"./customers": {
|
|
49
|
-
"types": "./dist/customers.d.mts",
|
|
50
|
-
"default": "./dist/customers.mjs"
|
|
51
|
-
},
|
|
52
|
-
"./blogs": {
|
|
53
|
-
"types": "./dist/blogs.d.mts",
|
|
54
|
-
"default": "./dist/blogs.mjs"
|
|
55
|
-
},
|
|
56
|
-
"./articles": {
|
|
57
|
-
"types": "./dist/articles.d.mts",
|
|
58
|
-
"default": "./dist/articles.mjs"
|
|
59
|
-
},
|
|
60
|
-
"./inventory": {
|
|
61
|
-
"types": "./dist/inventory.d.mts",
|
|
62
|
-
"default": "./dist/inventory.mjs"
|
|
63
|
-
},
|
|
64
|
-
"./locations": {
|
|
65
|
-
"types": "./dist/locations.d.mts",
|
|
66
|
-
"default": "./dist/locations.mjs"
|
|
67
|
-
},
|
|
68
|
-
"./fulfillments": {
|
|
69
|
-
"types": "./dist/fulfillments.d.mts",
|
|
70
|
-
"default": "./dist/fulfillments.mjs"
|
|
71
|
-
},
|
|
72
|
-
"./_official": {
|
|
73
|
-
"types": "./dist/_official/index.d.mts",
|
|
74
|
-
"default": "./dist/_official/index.mjs"
|
|
75
|
-
},
|
|
76
|
-
"./_runtime": {
|
|
77
|
-
"types": "./dist/_runtime/index.d.mts",
|
|
78
|
-
"default": "./dist/_runtime/index.mjs"
|
|
21
|
+
"types": "./dist/schemas/index.d.mts",
|
|
22
|
+
"default": "./dist/schemas/index.mjs"
|
|
79
23
|
}
|
|
80
24
|
},
|
|
81
25
|
"files": [
|
|
@@ -84,21 +28,22 @@
|
|
|
84
28
|
"LICENSE"
|
|
85
29
|
],
|
|
86
30
|
"dependencies": {
|
|
87
|
-
"@keystrokehq/integration-authoring": "^0.0.9",
|
|
88
31
|
"@shopify/admin-api-client": "^1.1.2",
|
|
89
32
|
"zod": "^4.3.6"
|
|
90
33
|
},
|
|
91
34
|
"peerDependencies": {
|
|
92
|
-
"@keystrokehq/core": ">=0.0.
|
|
35
|
+
"@keystrokehq/core": ">=0.0.8 <0.1.0"
|
|
93
36
|
},
|
|
94
37
|
"devDependencies": {
|
|
95
38
|
"@types/node": "^22.19.11",
|
|
96
39
|
"tsdown": "^0.20.3",
|
|
97
40
|
"typescript": "^5.9.3",
|
|
98
41
|
"vitest": "^4.0.18",
|
|
99
|
-
"@keystrokehq/core": "^0.0.
|
|
42
|
+
"@keystrokehq/core": "^0.0.12",
|
|
100
43
|
"@keystrokehq/test-utils": "0.0.0",
|
|
101
|
-
"@keystrokehq/
|
|
44
|
+
"@keystrokehq/credential-connection": "1.0.0",
|
|
45
|
+
"@keystrokehq/typescript-config": "0.0.0",
|
|
46
|
+
"@keystrokehq/integration-authoring": "0.0.9"
|
|
102
47
|
},
|
|
103
48
|
"keywords": [
|
|
104
49
|
"shopify",
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { i as shopifyOfficialIntegration, n as shopify, r as shopifyBundle, t as ShopifyCredentials } from "../integration-DrHCkXco.mjs";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { CredentialSet } from "@keystrokehq/core";
|
|
4
|
-
import { InferCredentialSetAuth } from "@keystrokehq/core/credential-set";
|
|
5
|
-
|
|
6
|
-
//#region src/_official/provider-app.d.ts
|
|
7
|
-
declare const shopifyAppCredentialSet: CredentialSet<"keystroke:shopify-app", z.ZodObject<{
|
|
8
|
-
clientId: z.ZodString;
|
|
9
|
-
clientSecret: z.ZodString;
|
|
10
|
-
webhookSecret: z.ZodString;
|
|
11
|
-
}, z.core.$strip>>;
|
|
12
|
-
declare const shopifyOfficialProviderSeed: {
|
|
13
|
-
readonly provider: "shopify";
|
|
14
|
-
readonly appRef: "shopify-platform";
|
|
15
|
-
readonly displayName: "Shopify Platform";
|
|
16
|
-
readonly credentialSetName: "Keystroke Shopify Platform App";
|
|
17
|
-
readonly envShape: {
|
|
18
|
-
readonly KEYSTROKE_OFFICIAL_SHOPIFY_APP_ID: z.ZodOptional<z.ZodString>;
|
|
19
|
-
readonly KEYSTROKE_OFFICIAL_SHOPIFY_CLIENT_ID: z.ZodOptional<z.ZodString>;
|
|
20
|
-
readonly KEYSTROKE_OFFICIAL_SHOPIFY_CLIENT_SECRET: z.ZodOptional<z.ZodString>;
|
|
21
|
-
readonly KEYSTROKE_OFFICIAL_SHOPIFY_WEBHOOK_SECRET: z.ZodOptional<z.ZodString>;
|
|
22
|
-
};
|
|
23
|
-
readonly requiredEnvKeys: readonly ["KEYSTROKE_OFFICIAL_SHOPIFY_APP_ID", "KEYSTROKE_OFFICIAL_SHOPIFY_CLIENT_ID", "KEYSTROKE_OFFICIAL_SHOPIFY_CLIENT_SECRET", "KEYSTROKE_OFFICIAL_SHOPIFY_WEBHOOK_SECRET"];
|
|
24
|
-
readonly externalAppIdEnvKey: "KEYSTROKE_OFFICIAL_SHOPIFY_APP_ID";
|
|
25
|
-
readonly buildCredentials: (env: Record<string, string | undefined>) => {
|
|
26
|
-
clientId: string | undefined;
|
|
27
|
-
clientSecret: string | undefined;
|
|
28
|
-
webhookSecret: string | undefined;
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
type ShopifyAppCredentials = InferCredentialSetAuth<typeof shopifyAppCredentialSet>;
|
|
32
|
-
//#endregion
|
|
33
|
-
export { type ShopifyAppCredentials, type ShopifyCredentials, shopify, shopifyAppCredentialSet, shopifyBundle, shopifyOfficialIntegration, shopifyOfficialProviderSeed };
|
package/dist/_official/index.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { a as shopifyAppCredentialSet, n as shopifyBundle, o as shopifyOfficialProviderSeed, r as shopifyOfficialIntegration, t as shopify } from "../integration-B5LK_0eR.mjs";
|
|
2
|
-
|
|
3
|
-
export { shopify, shopifyAppCredentialSet, shopifyBundle, shopifyOfficialIntegration, shopifyOfficialProviderSeed };
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { t as ShopifyCredentials } from "../integration-DrHCkXco.mjs";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
|
|
4
|
-
//#region src/webhook-management.d.ts
|
|
5
|
-
declare const SHOPIFY_WEBHOOK_RUNTIME_DEFINITIONS: readonly [{
|
|
6
|
-
readonly eventTopic: "products/create";
|
|
7
|
-
readonly subscriptionTopic: "PRODUCTS_CREATE";
|
|
8
|
-
readonly path: "/shopify/products/create";
|
|
9
|
-
}, {
|
|
10
|
-
readonly eventTopic: "products/update";
|
|
11
|
-
readonly subscriptionTopic: "PRODUCTS_UPDATE";
|
|
12
|
-
readonly path: "/shopify/products/update";
|
|
13
|
-
}, {
|
|
14
|
-
readonly eventTopic: "products/delete";
|
|
15
|
-
readonly subscriptionTopic: "PRODUCTS_DELETE";
|
|
16
|
-
readonly path: "/shopify/products/delete";
|
|
17
|
-
}, {
|
|
18
|
-
readonly eventTopic: "orders/create";
|
|
19
|
-
readonly subscriptionTopic: "ORDERS_CREATE";
|
|
20
|
-
readonly path: "/shopify/orders/create";
|
|
21
|
-
}, {
|
|
22
|
-
readonly eventTopic: "orders/updated";
|
|
23
|
-
readonly subscriptionTopic: "ORDERS_UPDATED";
|
|
24
|
-
readonly path: "/shopify/orders/updated";
|
|
25
|
-
}, {
|
|
26
|
-
readonly eventTopic: "orders/cancelled";
|
|
27
|
-
readonly subscriptionTopic: "ORDERS_CANCELLED";
|
|
28
|
-
readonly path: "/shopify/orders/cancelled";
|
|
29
|
-
}, {
|
|
30
|
-
readonly eventTopic: "orders/fulfilled";
|
|
31
|
-
readonly subscriptionTopic: "ORDERS_FULFILLED";
|
|
32
|
-
readonly path: "/shopify/orders/fulfilled";
|
|
33
|
-
}];
|
|
34
|
-
declare const webhookSubscriptionSchema: z.ZodObject<{
|
|
35
|
-
id: z.ZodString;
|
|
36
|
-
topic: z.ZodEnum<{
|
|
37
|
-
PRODUCTS_CREATE: "PRODUCTS_CREATE";
|
|
38
|
-
PRODUCTS_UPDATE: "PRODUCTS_UPDATE";
|
|
39
|
-
PRODUCTS_DELETE: "PRODUCTS_DELETE";
|
|
40
|
-
ORDERS_CREATE: "ORDERS_CREATE";
|
|
41
|
-
ORDERS_UPDATED: "ORDERS_UPDATED";
|
|
42
|
-
ORDERS_CANCELLED: "ORDERS_CANCELLED";
|
|
43
|
-
ORDERS_FULFILLED: "ORDERS_FULFILLED";
|
|
44
|
-
}>;
|
|
45
|
-
uri: z.ZodString;
|
|
46
|
-
}, z.core.$strip>;
|
|
47
|
-
interface EnsureShopifyWebhookSubscriptionsResult {
|
|
48
|
-
readonly kept: readonly string[];
|
|
49
|
-
readonly created: readonly string[];
|
|
50
|
-
readonly deleted: readonly string[];
|
|
51
|
-
}
|
|
52
|
-
declare function buildShopifyWebhookCallbackUri(baseUrl: string, path: string): string;
|
|
53
|
-
declare function listShopifyWebhookSubscriptions(credentials: ShopifyCredentials): Promise<readonly z.infer<typeof webhookSubscriptionSchema>[]>;
|
|
54
|
-
declare function ensureShopifyWebhookSubscriptions(credentials: ShopifyCredentials, callbackBaseUrl: string): Promise<EnsureShopifyWebhookSubscriptionsResult>;
|
|
55
|
-
//#endregion
|
|
56
|
-
export { SHOPIFY_WEBHOOK_RUNTIME_DEFINITIONS, buildShopifyWebhookCallbackUri, ensureShopifyWebhookSubscriptions, listShopifyWebhookSubscriptions };
|
package/dist/_runtime/index.mjs
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { shopifyGlobalIdSchema, shopifyUserErrorSchema } from "../schemas.mjs";
|
|
2
|
-
import { createShopifyClient } from "../client.mjs";
|
|
3
|
-
import { shopifyWebhookSubscriptionTopicSchema, shopifyWebhookTopicSchema } from "../events.mjs";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
|
|
6
|
-
//#region src/webhook-management.ts
|
|
7
|
-
const shopifyWebhookRuntimeDefinitionSchema = z.object({
|
|
8
|
-
eventTopic: shopifyWebhookTopicSchema,
|
|
9
|
-
subscriptionTopic: shopifyWebhookSubscriptionTopicSchema,
|
|
10
|
-
path: z.string().min(1)
|
|
11
|
-
});
|
|
12
|
-
const SHOPIFY_WEBHOOK_RUNTIME_DEFINITIONS = [
|
|
13
|
-
{
|
|
14
|
-
eventTopic: "products/create",
|
|
15
|
-
subscriptionTopic: "PRODUCTS_CREATE",
|
|
16
|
-
path: "/shopify/products/create"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
eventTopic: "products/update",
|
|
20
|
-
subscriptionTopic: "PRODUCTS_UPDATE",
|
|
21
|
-
path: "/shopify/products/update"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
eventTopic: "products/delete",
|
|
25
|
-
subscriptionTopic: "PRODUCTS_DELETE",
|
|
26
|
-
path: "/shopify/products/delete"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
eventTopic: "orders/create",
|
|
30
|
-
subscriptionTopic: "ORDERS_CREATE",
|
|
31
|
-
path: "/shopify/orders/create"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
eventTopic: "orders/updated",
|
|
35
|
-
subscriptionTopic: "ORDERS_UPDATED",
|
|
36
|
-
path: "/shopify/orders/updated"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
eventTopic: "orders/cancelled",
|
|
40
|
-
subscriptionTopic: "ORDERS_CANCELLED",
|
|
41
|
-
path: "/shopify/orders/cancelled"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
eventTopic: "orders/fulfilled",
|
|
45
|
-
subscriptionTopic: "ORDERS_FULFILLED",
|
|
46
|
-
path: "/shopify/orders/fulfilled"
|
|
47
|
-
}
|
|
48
|
-
];
|
|
49
|
-
const webhookSubscriptionSchema = z.object({
|
|
50
|
-
id: shopifyGlobalIdSchema,
|
|
51
|
-
topic: shopifyWebhookSubscriptionTopicSchema,
|
|
52
|
-
uri: z.string().url()
|
|
53
|
-
});
|
|
54
|
-
const listWebhookSubscriptionsResponseSchema = z.object({ webhookSubscriptions: z.object({ nodes: z.array(webhookSubscriptionSchema) }) });
|
|
55
|
-
const createWebhookSubscriptionResponseSchema = z.object({ webhookSubscriptionCreate: z.object({
|
|
56
|
-
webhookSubscription: webhookSubscriptionSchema.nullable(),
|
|
57
|
-
userErrors: z.array(shopifyUserErrorSchema)
|
|
58
|
-
}) });
|
|
59
|
-
const deleteWebhookSubscriptionResponseSchema = z.object({ webhookSubscriptionDelete: z.object({
|
|
60
|
-
deletedWebhookSubscriptionId: shopifyGlobalIdSchema.nullable(),
|
|
61
|
-
userErrors: z.array(shopifyUserErrorSchema)
|
|
62
|
-
}) });
|
|
63
|
-
function assertNoUserErrors(userErrors) {
|
|
64
|
-
if (userErrors.length === 0) return;
|
|
65
|
-
const message = userErrors.map((error) => error.field && error.field.length > 0 ? `${error.field.join(".")}: ${error.message}` : error.message).join("; ");
|
|
66
|
-
throw new Error(`Shopify webhook subscription error: ${message}`);
|
|
67
|
-
}
|
|
68
|
-
function buildShopifyWebhookCallbackUri(baseUrl, path) {
|
|
69
|
-
return new URL(path, baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`).toString();
|
|
70
|
-
}
|
|
71
|
-
async function listShopifyWebhookSubscriptions(credentials) {
|
|
72
|
-
return (await createShopifyClient(credentials).graphql(`
|
|
73
|
-
query ListWebhookSubscriptions($topics: [WebhookSubscriptionTopic!]) {
|
|
74
|
-
webhookSubscriptions(first: 50, topics: $topics) {
|
|
75
|
-
nodes {
|
|
76
|
-
id
|
|
77
|
-
topic
|
|
78
|
-
uri
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
`, listWebhookSubscriptionsResponseSchema, { variables: { topics: SHOPIFY_WEBHOOK_RUNTIME_DEFINITIONS.map((definition) => definition.subscriptionTopic) } })).webhookSubscriptions.nodes;
|
|
83
|
-
}
|
|
84
|
-
async function createShopifyWebhookSubscription(credentials, topic, uri) {
|
|
85
|
-
const response = await createShopifyClient(credentials).graphql(`
|
|
86
|
-
mutation CreateWebhookSubscription(
|
|
87
|
-
$topic: WebhookSubscriptionTopic!
|
|
88
|
-
$webhookSubscription: WebhookSubscriptionInput!
|
|
89
|
-
) {
|
|
90
|
-
webhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) {
|
|
91
|
-
webhookSubscription {
|
|
92
|
-
id
|
|
93
|
-
topic
|
|
94
|
-
uri
|
|
95
|
-
}
|
|
96
|
-
userErrors {
|
|
97
|
-
field
|
|
98
|
-
message
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
`, createWebhookSubscriptionResponseSchema, { variables: {
|
|
103
|
-
topic,
|
|
104
|
-
webhookSubscription: { uri }
|
|
105
|
-
} });
|
|
106
|
-
assertNoUserErrors(response.webhookSubscriptionCreate.userErrors);
|
|
107
|
-
if (!response.webhookSubscriptionCreate.webhookSubscription) throw new Error(`Shopify did not return the created webhook subscription for ${topic}.`);
|
|
108
|
-
return response.webhookSubscriptionCreate.webhookSubscription;
|
|
109
|
-
}
|
|
110
|
-
async function deleteShopifyWebhookSubscription(credentials, id) {
|
|
111
|
-
const response = await createShopifyClient(credentials).graphql(`
|
|
112
|
-
mutation DeleteWebhookSubscription($id: ID!) {
|
|
113
|
-
webhookSubscriptionDelete(id: $id) {
|
|
114
|
-
deletedWebhookSubscriptionId
|
|
115
|
-
userErrors {
|
|
116
|
-
field
|
|
117
|
-
message
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
`, deleteWebhookSubscriptionResponseSchema, { variables: { id } });
|
|
122
|
-
assertNoUserErrors(response.webhookSubscriptionDelete.userErrors);
|
|
123
|
-
if (!response.webhookSubscriptionDelete.deletedWebhookSubscriptionId) throw new Error(`Shopify did not confirm deletion for webhook subscription ${id}.`);
|
|
124
|
-
return response.webhookSubscriptionDelete.deletedWebhookSubscriptionId;
|
|
125
|
-
}
|
|
126
|
-
async function ensureShopifyWebhookSubscriptions(credentials, callbackBaseUrl) {
|
|
127
|
-
const existing = await listShopifyWebhookSubscriptions(credentials);
|
|
128
|
-
const kept = [];
|
|
129
|
-
const created = [];
|
|
130
|
-
const deleted = [];
|
|
131
|
-
for (const definition of SHOPIFY_WEBHOOK_RUNTIME_DEFINITIONS) {
|
|
132
|
-
const expectedUri = buildShopifyWebhookCallbackUri(callbackBaseUrl, definition.path);
|
|
133
|
-
const matches = existing.filter((subscription) => subscription.topic === definition.subscriptionTopic);
|
|
134
|
-
const canonical = matches.find((subscription) => subscription.uri === expectedUri);
|
|
135
|
-
if (canonical) kept.push(canonical.id);
|
|
136
|
-
for (const subscription of matches) if (!canonical || subscription.id !== canonical.id) deleted.push(await deleteShopifyWebhookSubscription(credentials, subscription.id));
|
|
137
|
-
if (!canonical) {
|
|
138
|
-
const createdSubscription = await createShopifyWebhookSubscription(credentials, definition.subscriptionTopic, expectedUri);
|
|
139
|
-
created.push(createdSubscription.id);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
return {
|
|
143
|
-
kept,
|
|
144
|
-
created,
|
|
145
|
-
deleted
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
//#endregion
|
|
150
|
-
export { SHOPIFY_WEBHOOK_RUNTIME_DEFINITIONS, buildShopifyWebhookCallbackUri, ensureShopifyWebhookSubscriptions, listShopifyWebhookSubscriptions };
|
package/dist/articles.d.mts
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
3
|
-
|
|
4
|
-
//#region src/articles.d.ts
|
|
5
|
-
declare const listArticles: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
6
|
-
first: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
7
|
-
after: z.ZodOptional<z.ZodString>;
|
|
8
|
-
query: z.ZodOptional<z.ZodString>;
|
|
9
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
10
|
-
nodes: z.ZodArray<z.ZodObject<{
|
|
11
|
-
id: z.ZodString;
|
|
12
|
-
title: z.ZodString;
|
|
13
|
-
handle: z.ZodString;
|
|
14
|
-
blog: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
15
|
-
id: z.ZodString;
|
|
16
|
-
title: z.ZodString;
|
|
17
|
-
handle: z.ZodString;
|
|
18
|
-
createdAt: z.ZodOptional<z.ZodISODateTime>;
|
|
19
|
-
updatedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
20
|
-
commentPolicy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
21
|
-
templateSuffix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
22
|
-
}, z.core.$strip>>>;
|
|
23
|
-
author: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
24
|
-
body: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
25
|
-
summary: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
26
|
-
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
27
|
-
image: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
28
|
-
url: z.ZodURL;
|
|
29
|
-
altText: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
30
|
-
}, z.core.$strip>>>;
|
|
31
|
-
publishedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
32
|
-
updatedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
33
|
-
}, z.core.$strip>>;
|
|
34
|
-
pageInfo: z.ZodObject<{
|
|
35
|
-
hasNextPage: z.ZodBoolean;
|
|
36
|
-
hasPreviousPage: z.ZodOptional<z.ZodBoolean>;
|
|
37
|
-
startCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
38
|
-
endCursor: z.ZodNullable<z.ZodString>;
|
|
39
|
-
}, z.core.$strip>;
|
|
40
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:shopify", z.ZodObject<{
|
|
41
|
-
SHOPIFY_STORE_DOMAIN: z.ZodString;
|
|
42
|
-
SHOPIFY_ACCESS_TOKEN: z.ZodString;
|
|
43
|
-
}, z.core.$strip>>], undefined>;
|
|
44
|
-
declare const getArticle: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
45
|
-
id: z.ZodString;
|
|
46
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
47
|
-
id: z.ZodString;
|
|
48
|
-
title: z.ZodString;
|
|
49
|
-
handle: z.ZodString;
|
|
50
|
-
blog: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
51
|
-
id: z.ZodString;
|
|
52
|
-
title: z.ZodString;
|
|
53
|
-
handle: z.ZodString;
|
|
54
|
-
createdAt: z.ZodOptional<z.ZodISODateTime>;
|
|
55
|
-
updatedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
56
|
-
commentPolicy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
57
|
-
templateSuffix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
58
|
-
}, z.core.$strip>>>;
|
|
59
|
-
author: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
60
|
-
body: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
61
|
-
summary: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
62
|
-
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
63
|
-
image: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
64
|
-
url: z.ZodURL;
|
|
65
|
-
altText: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
66
|
-
}, z.core.$strip>>>;
|
|
67
|
-
publishedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
68
|
-
updatedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
69
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:shopify", z.ZodObject<{
|
|
70
|
-
SHOPIFY_STORE_DOMAIN: z.ZodString;
|
|
71
|
-
SHOPIFY_ACCESS_TOKEN: z.ZodString;
|
|
72
|
-
}, z.core.$strip>>], undefined>;
|
|
73
|
-
declare const createArticle: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
74
|
-
handle: z.ZodOptional<z.ZodString>;
|
|
75
|
-
body: z.ZodOptional<z.ZodString>;
|
|
76
|
-
summary: z.ZodOptional<z.ZodString>;
|
|
77
|
-
authorName: z.ZodOptional<z.ZodString>;
|
|
78
|
-
isPublished: z.ZodOptional<z.ZodBoolean>;
|
|
79
|
-
publishDate: z.ZodOptional<z.ZodISODateTime>;
|
|
80
|
-
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
81
|
-
blogId: z.ZodString;
|
|
82
|
-
title: z.ZodString;
|
|
83
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
84
|
-
id: z.ZodString;
|
|
85
|
-
title: z.ZodString;
|
|
86
|
-
handle: z.ZodString;
|
|
87
|
-
blog: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
88
|
-
id: z.ZodString;
|
|
89
|
-
title: z.ZodString;
|
|
90
|
-
handle: z.ZodString;
|
|
91
|
-
createdAt: z.ZodOptional<z.ZodISODateTime>;
|
|
92
|
-
updatedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
93
|
-
commentPolicy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
94
|
-
templateSuffix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
95
|
-
}, z.core.$strip>>>;
|
|
96
|
-
author: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
97
|
-
body: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
98
|
-
summary: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
99
|
-
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
100
|
-
image: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
101
|
-
url: z.ZodURL;
|
|
102
|
-
altText: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
103
|
-
}, z.core.$strip>>>;
|
|
104
|
-
publishedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
105
|
-
updatedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
106
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:shopify", z.ZodObject<{
|
|
107
|
-
SHOPIFY_STORE_DOMAIN: z.ZodString;
|
|
108
|
-
SHOPIFY_ACCESS_TOKEN: z.ZodString;
|
|
109
|
-
}, z.core.$strip>>], undefined>;
|
|
110
|
-
declare const updateArticle: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
111
|
-
blogId: z.ZodOptional<z.ZodString>;
|
|
112
|
-
title: z.ZodOptional<z.ZodString>;
|
|
113
|
-
handle: z.ZodOptional<z.ZodString>;
|
|
114
|
-
body: z.ZodOptional<z.ZodString>;
|
|
115
|
-
summary: z.ZodOptional<z.ZodString>;
|
|
116
|
-
authorName: z.ZodOptional<z.ZodString>;
|
|
117
|
-
isPublished: z.ZodOptional<z.ZodBoolean>;
|
|
118
|
-
publishDate: z.ZodOptional<z.ZodISODateTime>;
|
|
119
|
-
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
120
|
-
id: z.ZodString;
|
|
121
|
-
redirectNewHandle: z.ZodOptional<z.ZodBoolean>;
|
|
122
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
123
|
-
id: z.ZodString;
|
|
124
|
-
title: z.ZodString;
|
|
125
|
-
handle: z.ZodString;
|
|
126
|
-
blog: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
127
|
-
id: z.ZodString;
|
|
128
|
-
title: z.ZodString;
|
|
129
|
-
handle: z.ZodString;
|
|
130
|
-
createdAt: z.ZodOptional<z.ZodISODateTime>;
|
|
131
|
-
updatedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
132
|
-
commentPolicy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
133
|
-
templateSuffix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
134
|
-
}, z.core.$strip>>>;
|
|
135
|
-
author: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
136
|
-
body: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
137
|
-
summary: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
138
|
-
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
139
|
-
image: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
140
|
-
url: z.ZodURL;
|
|
141
|
-
altText: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
142
|
-
}, z.core.$strip>>>;
|
|
143
|
-
publishedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
144
|
-
updatedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
145
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:shopify", z.ZodObject<{
|
|
146
|
-
SHOPIFY_STORE_DOMAIN: z.ZodString;
|
|
147
|
-
SHOPIFY_ACCESS_TOKEN: z.ZodString;
|
|
148
|
-
}, z.core.$strip>>], undefined>;
|
|
149
|
-
declare const deleteArticle: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
150
|
-
id: z.ZodString;
|
|
151
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
152
|
-
deletedArticleId: z.ZodString;
|
|
153
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:shopify", z.ZodObject<{
|
|
154
|
-
SHOPIFY_STORE_DOMAIN: z.ZodString;
|
|
155
|
-
SHOPIFY_ACCESS_TOKEN: z.ZodString;
|
|
156
|
-
}, z.core.$strip>>], undefined>;
|
|
157
|
-
//#endregion
|
|
158
|
-
export { createArticle, deleteArticle, getArticle, listArticles, updateArticle };
|