shopify-webhook-schemas 0.1.8 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/dist/src/index.d.ts +2 -0
  2. package/dist/src/index.js +3 -0
  3. package/dist/src/infer-schema.d.ts +18 -0
  4. package/dist/src/infer-schema.js +717 -0
  5. package/dist/src/scrape.js +11 -623
  6. package/metadatas/2025-04/app_purchases_one_time/update.json +1 -1
  7. package/metadatas/2025-04/app_subscriptions/approaching_capped_amount.json +1 -1
  8. package/metadatas/2025-04/app_subscriptions/update.json +5 -2
  9. package/metadatas/2025-04/bulk_operations/finish.json +1 -1
  10. package/metadatas/2025-04/checkouts/create.json +6 -6
  11. package/metadatas/2025-04/checkouts/update.json +6 -6
  12. package/metadatas/2025-04/discounts/create.json +2 -2
  13. package/metadatas/2025-04/discounts/delete.json +1 -1
  14. package/metadatas/2025-04/discounts/redeemcode_added.json +1 -1
  15. package/metadatas/2025-04/discounts/redeemcode_removed.json +1 -1
  16. package/metadatas/2025-04/discounts/update.json +2 -2
  17. package/metadatas/2025-04/draft_orders/create.json +24 -24
  18. package/metadatas/2025-04/draft_orders/update.json +26 -26
  19. package/metadatas/2025-04/fulfillments/create.json +71 -24
  20. package/metadatas/2025-04/fulfillments/update.json +71 -24
  21. package/metadatas/2025-04/inventory_items/create.json +2 -1
  22. package/metadatas/2025-04/inventory_items/delete.json +2 -1
  23. package/metadatas/2025-04/inventory_items/update.json +2 -1
  24. package/metadatas/2025-04/markets_backup_region/update.json +18 -0
  25. package/metadatas/2025-04/order_transactions/create.json +3 -3
  26. package/metadatas/2025-04/orders/cancelled.json +91 -41
  27. package/metadatas/2025-04/orders/create.json +91 -41
  28. package/metadatas/2025-04/orders/edited.json +1 -1
  29. package/metadatas/2025-04/orders/fulfilled.json +91 -41
  30. package/metadatas/2025-04/orders/paid.json +91 -41
  31. package/metadatas/2025-04/orders/partially_fulfilled.json +91 -41
  32. package/metadatas/2025-04/orders/updated.json +91 -41
  33. package/metadatas/2025-04/refunds/create.json +110 -34
  34. package/metadatas/2025-04/selling_plan_groups/create.json +2 -2
  35. package/metadatas/2025-04/selling_plan_groups/delete.json +2 -2
  36. package/metadatas/2025-04/selling_plan_groups/update.json +2 -2
  37. package/metadatas/2025-04/subscription_billing_attempts/challenged.json +2 -2
  38. package/metadatas/2025-04/subscription_billing_attempts/failure.json +2 -2
  39. package/metadatas/2025-04/subscription_billing_attempts/success.json +2 -2
  40. package/metadatas/2025-04/subscription_contracts/activate.json +4 -4
  41. package/metadatas/2025-04/subscription_contracts/cancel.json +4 -4
  42. package/metadatas/2025-04/subscription_contracts/create.json +4 -4
  43. package/metadatas/2025-04/subscription_contracts/expire.json +4 -4
  44. package/metadatas/2025-04/subscription_contracts/fail.json +4 -4
  45. package/metadatas/2025-04/subscription_contracts/pause.json +4 -4
  46. package/metadatas/2025-04/subscription_contracts/update.json +4 -4
  47. package/metadatas/2025-04/tender_transactions/create.json +1 -1
  48. package/package.json +6 -6
  49. package/schemas/2025-04/app_subscriptions/update.json +12 -0
  50. package/schemas/2025-04/carts/create.json +4 -1
  51. package/schemas/2025-04/carts/update.json +4 -1
  52. package/schemas/2025-04/checkouts/create.json +26 -16
  53. package/schemas/2025-04/checkouts/delete.json +3 -0
  54. package/schemas/2025-04/checkouts/update.json +26 -16
  55. package/schemas/2025-04/collections/create.json +20 -0
  56. package/schemas/2025-04/collections/update.json +20 -0
  57. package/schemas/2025-04/company_locations/create.json +37 -6
  58. package/schemas/2025-04/company_locations/delete.json +37 -6
  59. package/schemas/2025-04/company_locations/update.json +37 -6
  60. package/schemas/2025-04/customer_payment_methods/create.json +1 -1
  61. package/schemas/2025-04/customer_payment_methods/revoke.json +1 -1
  62. package/schemas/2025-04/customer_payment_methods/update.json +1 -1
  63. package/schemas/2025-04/customers/create.json +86 -4
  64. package/schemas/2025-04/customers/delete.json +78 -2
  65. package/schemas/2025-04/customers/disable.json +86 -4
  66. package/schemas/2025-04/customers/enable.json +86 -4
  67. package/schemas/2025-04/customers/update.json +86 -4
  68. package/schemas/2025-04/customers_email_marketing_consent/update.json +13 -3
  69. package/schemas/2025-04/customers_marketing_consent/update.json +13 -3
  70. package/schemas/2025-04/disputes/create.json +0 -1
  71. package/schemas/2025-04/disputes/update.json +0 -1
  72. package/schemas/2025-04/domains/create.json +4 -2
  73. package/schemas/2025-04/domains/destroy.json +4 -2
  74. package/schemas/2025-04/domains/update.json +4 -2
  75. package/schemas/2025-04/draft_orders/create.json +138 -4
  76. package/schemas/2025-04/draft_orders/update.json +138 -4
  77. package/schemas/2025-04/fulfillments/create.json +196 -66
  78. package/schemas/2025-04/fulfillments/update.json +196 -66
  79. package/schemas/2025-04/inventory_items/create.json +7 -3
  80. package/schemas/2025-04/inventory_items/update.json +7 -3
  81. package/schemas/2025-04/markets_backup_region/update.json +17 -0
  82. package/schemas/2025-04/order_transactions/create.json +15 -5
  83. package/schemas/2025-04/orders/cancelled.json +76 -4
  84. package/schemas/2025-04/orders/create.json +76 -4
  85. package/schemas/2025-04/orders/edited.json +8 -2
  86. package/schemas/2025-04/orders/fulfilled.json +76 -4
  87. package/schemas/2025-04/orders/paid.json +76 -4
  88. package/schemas/2025-04/orders/partially_fulfilled.json +76 -4
  89. package/schemas/2025-04/orders/risk_assessment_changed.json +9 -2
  90. package/schemas/2025-04/orders/shopify_protect_eligibility_changed.json +8 -1
  91. package/schemas/2025-04/orders/updated.json +76 -4
  92. package/schemas/2025-04/payment_terms/create.json +4 -1
  93. package/schemas/2025-04/payment_terms/update.json +4 -1
  94. package/schemas/2025-04/products/create.json +160 -64
  95. package/schemas/2025-04/products/update.json +160 -64
  96. package/schemas/2025-04/refunds/create.json +764 -17
  97. package/schemas/2025-04/selling_plan_groups/create.json +66 -10
  98. package/schemas/2025-04/selling_plan_groups/update.json +66 -10
  99. package/schemas/2025-04/shop/update.json +4 -3
  100. package/schemas/2025-04/subscription_billing_attempts/challenged.json +0 -1
  101. package/schemas/2025-04/subscription_billing_attempts/failure.json +0 -1
  102. package/schemas/2025-04/subscription_billing_attempts/success.json +0 -1
  103. package/schemas/2025-04/subscription_contracts/activate.json +8 -2
  104. package/schemas/2025-04/subscription_contracts/cancel.json +8 -2
  105. package/schemas/2025-04/subscription_contracts/create.json +8 -2
  106. package/schemas/2025-04/subscription_contracts/expire.json +8 -2
  107. package/schemas/2025-04/subscription_contracts/fail.json +8 -2
  108. package/schemas/2025-04/subscription_contracts/pause.json +8 -2
  109. package/schemas/2025-04/subscription_contracts/update.json +8 -2
  110. package/schemas/2025-04/tender_transactions/create.json +9 -16
  111. package/schemas/2025-04/themes/create.json +4 -1
  112. package/schemas/2025-04/themes/publish.json +4 -1
  113. package/schemas/2025-04/themes/update.json +4 -1
@@ -3,20 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const json_schema_walker_1 = require("@cloudflare/json-schema-walker");
7
- const schema_infer_1 = require("@jsonhero/schema-infer");
8
- const chalk_1 = __importDefault(require("chalk"));
9
6
  const cheerio_1 = __importDefault(require("cheerio"));
10
7
  const fs_extra_1 = __importDefault(require("fs-extra"));
11
8
  const globby_1 = require("globby");
12
9
  const got_1 = __importDefault(require("got"));
13
10
  const lodash_1 = require("lodash");
11
+ const chalk_1 = __importDefault(require("chalk"));
14
12
  const path_1 = __importDefault(require("path"));
15
- const safe_stable_stringify_1 = require("safe-stable-stringify");
16
13
  const src_1 = require("src");
17
14
  const shopify_js_1 = require("./shopify.js");
18
- const stringify = (0, safe_stable_stringify_1.configure)({ deterministic: true });
19
- const startVersion = "2024-04";
15
+ const infer_schema_1 = require("./infer-schema");
20
16
  function assert(value, message) {
21
17
  if (!value) {
22
18
  throw new Error(message ?? "value is not truthy");
@@ -67,55 +63,6 @@ const loadRailsData = async (url) => {
67
63
  const docsWebhooksPageForVersion = (version) => `https://shopify.dev/docs/api/admin-rest/${version}/resources/webhook#event-topics`;
68
64
  let warnings = 0;
69
65
  let errors = 0;
70
- const sortStringArrays = (obj) => {
71
- return (0, lodash_1.cloneDeepWith)(obj, (value) => {
72
- if (Array.isArray(value) && value.every((item) => typeof item === "string")) {
73
- return value.sort();
74
- }
75
- });
76
- };
77
- const getDeterministicObject = (obj) => {
78
- const stableString = stringify(sortStringArrays(obj));
79
- return JSON.parse(stableString);
80
- };
81
- const inferSchemaFromExamplePayload = (examplePayload, metadata, version) => {
82
- const inference = (0, schema_infer_1.inferSchema)(examplePayload);
83
- // build a copy of the payload and apply overrides based on the webhook name
84
- for (const [matcher, override] of manualExamples) {
85
- if (matcher.test(metadata.name)) {
86
- const overridesPayload = (0, lodash_1.cloneDeep)(examplePayload);
87
- const maskedOverride = (0, lodash_1.pick)(override, Object.keys(examplePayload));
88
- (0, lodash_1.merge)(overridesPayload, maskedOverride);
89
- inference.infer(overridesPayload);
90
- }
91
- }
92
- const schema = {
93
- $schema: "https://json-schema.org/draft/2020-12/schema",
94
- ...inference.toJSONSchema(),
95
- };
96
- for (const override of overrides) {
97
- if (override.topics.includes(metadata.name) && (!override.versions || override.versions.includes(startVersion))) {
98
- for (const [key, schemaOverride] of Object.entries(override.schema)) {
99
- schema.properties[key] = schemaOverride;
100
- }
101
- }
102
- }
103
- const sortedSchema = getDeterministicObject(schema);
104
- (0, json_schema_walker_1.schemaWalk)(sortedSchema, (subschema, path, _parent, parentPath) => {
105
- if ((0, lodash_1.isEqual)(subschema, { type: "null" })) {
106
- warnings += 1;
107
- const fullPath = [...parentPath, ...path].join(".");
108
- if (unknownPaths.some(([pattern, paths]) => pattern.test(metadata.name) && paths.includes(fullPath))) {
109
- // we know this path is always null, so don't error
110
- }
111
- else {
112
- errors += 1;
113
- console.error(`${chalk_1.default.red("schema error")}: null type found in final schema for version ${chalk_1.default.blue(version)} for ${chalk_1.default.blue(metadata.name)} at path ${chalk_1.default.green(fullPath)}`);
114
- }
115
- }
116
- }, () => { }, (0, json_schema_walker_1.getVocabulary)(sortedSchema));
117
- return sortedSchema;
118
- };
119
66
  const loadExemplars = async () => {
120
67
  const files = await (0, globby_1.globby)(path_1.default.join(__dirname, "../exemplars/**/*.json"));
121
68
  for (const file of files) {
@@ -124,13 +71,13 @@ const loadExemplars = async () => {
124
71
  const topicPattern = new RegExp(`${segments.pop()}.+`);
125
72
  const _version = segments.pop();
126
73
  const exemplar = await fs_extra_1.default.readJSON(file);
127
- manualExamples.push([topicPattern, exemplar]);
74
+ infer_schema_1.manualExamples.push([topicPattern, exemplar]);
128
75
  }
129
76
  console.log(`loaded ${files.length} exemplars`);
130
77
  };
131
78
  const getAllVersions = async () => {
132
- const rootPage = await loadRailsData(docsWebhooksPageForVersion(startVersion));
133
- return (0, lodash_1.uniq)([startVersion, ...rootPage.api.selectable_versions]).filter((version) => version != "unstable");
79
+ const rootPage = await loadRailsData(docsWebhooksPageForVersion(infer_schema_1.startVersion));
80
+ return (0, lodash_1.uniq)([infer_schema_1.startVersion, ...rootPage.api.selectable_versions]).filter((version) => version != "unstable");
134
81
  };
135
82
  const main = async () => {
136
83
  await loadExemplars();
@@ -152,7 +99,12 @@ const main = async () => {
152
99
  const metadataFile = path_1.default.join(rootDir, "metadatas", version, webhook.name + ".json");
153
100
  await fs_extra_1.default.mkdir(path_1.default.dirname(metadataFile), { recursive: true });
154
101
  await fs_extra_1.default.writeFile(metadataFile, JSON.stringify(webhook, null, 2), "utf-8");
155
- const schema = inferSchemaFromExamplePayload(webhook.response, webhook, version);
102
+ const { schema, warnings: warningCount, errors: errorMessages } = (0, infer_schema_1.inferSchemaFromExamplePayload)(webhook.response, webhook);
103
+ warnings += warningCount;
104
+ for (const error of errorMessages) {
105
+ console.error(`${chalk_1.default.red("schema error")}: ${error.message} for version ${chalk_1.default.blue(version)} for ${chalk_1.default.blue(webhook.name)} at path ${chalk_1.default.green(error.path)}`);
106
+ errors += 1;
107
+ }
156
108
  const schemaFile = path_1.default.join(rootDir, "schemas", version, webhook.name + ".json");
157
109
  await fs_extra_1.default.mkdir(path_1.default.dirname(schemaFile), { recursive: true });
158
110
  await fs_extra_1.default.writeFile(schemaFile, JSON.stringify(schema, null, 2), "utf-8");
@@ -167,567 +119,3 @@ const main = async () => {
167
119
  }
168
120
  };
169
121
  void main();
170
- // paths that we can't find any source data for at all, so we don't know what type they should be
171
- const unknownPaths = [
172
- [
173
- /checkouts\/.+/,
174
- [
175
- "properties.line_items.items.properties.unit_price_measurement.properties.measured_type",
176
- "properties.line_items.items.properties.unit_price_measurement.properties.quantity_value",
177
- "properties.line_items.items.properties.unit_price_measurement.properties.quantity_unit",
178
- "properties.line_items.items.properties.unit_price_measurement.properties.reference_value",
179
- "properties.line_items.items.properties.unit_price_measurement.properties.reference_unit",
180
- "properties.line_items.items.properties.tax_lines.items.properties.reporting_jurisdiction_name",
181
- "properties.line_items.items.properties.tax_lines.items.properties.reporting_jurisdiction_type",
182
- "properties.line_items.items.properties.tax_lines.items.properties.reporting_jurisdiction_code",
183
- "properties.line_items.items.properties.user_id",
184
- "properties.line_items.items.properties.compare_at_price",
185
- "properties.gateway",
186
- "properties.shipping_lines.items.properties.delivery_category",
187
- "properties.shipping_lines.items.properties.validation_context",
188
- "properties.shipping_lines.items.properties.requested_fulfillment_service_id",
189
- "properties.shipping_lines.items.properties.tax_lines.items.properties.identifier",
190
- "properties.shipping_lines.items.properties.tax_lines.items.properties.reporting_jurisdiction_name",
191
- "properties.shipping_lines.items.properties.tax_lines.items.properties.tax_api_client_id",
192
- "properties.shipping_lines.items.properties.tax_lines.items.properties.reporting_exempt_amount",
193
- "properties.shipping_lines.items.properties.tax_lines.items.properties.jurisdiction_source",
194
- "properties.shipping_lines.items.properties.tax_lines.items.properties.reporting_jurisdiction_code",
195
- "properties.shipping_lines.items.properties.tax_lines.items.properties.reporting_jurisdiction_type",
196
- "properties.shipping_lines.items.properties.tax_lines.items.properties.reporting_taxable_amount",
197
- "properties.shipping_lines.items.properties.tax_lines.items.properties.jurisdiction_type",
198
- "properties.shipping_lines.items.properties.tax_lines.items.properties.tax_type",
199
- "properties.shipping_lines.items.properties.tax_lines.items.properties.jurisdiction_id",
200
- "properties.shipping_lines.items.properties.tax_lines.items.properties.reporting_non_taxable_amount",
201
- "properties.shipping_lines.items.properties.custom_tax_lines",
202
- "properties.shipping_lines.items.properties.estimated_delivery_time_range",
203
- "properties.line_items.items.properties.tax_lines.items.properties.tax_type",
204
- "properties.line_items.items.properties.tax_lines.items.properties.identifier",
205
- "properties.line_items.items.properties.discount_allocations.items.properties.id",
206
- "properties.line_items.items.properties.discount_allocations.items.properties.created_at",
207
- ],
208
- ],
209
- [
210
- /collection_listings\/.+/,
211
- ["properties.collection_listing.properties.default_product_image", "properties.collection_listing.properties.image"],
212
- ],
213
- [/domains\/.+/, ["properties.localization.properties.country"]],
214
- [/orders\/.+/, ["properties.client_details.properties.session_hash"]],
215
- ];
216
- // example data we feed the schema infer-er for each topic to allow it to discover real types
217
- const manualExamples = [
218
- [
219
- /.+/,
220
- {
221
- admin_graphql_api_id: "gid://shopify/Something/1234567890",
222
- admin_graphql_api_job_id: "gid://shopify/Job/1234567890",
223
- created_at: "2021-12-30T19:00:00-05:00",
224
- updated_at: "2021-12-30T19:00:00-05:00",
225
- address2: "Apt 123",
226
- latitude: 10.1,
227
- longitude: 10.1,
228
- location_id: 111111,
229
- },
230
- ],
231
- [
232
- /(app|shop)\/.+/,
233
- {
234
- domain: "example.com",
235
- source: "example source",
236
- myshopify_domain: "example.myshopify.com",
237
- google_apps_domain: "example.com",
238
- google_apps_login_enabled: true,
239
- password_enabled: true,
240
- taxes_included: true,
241
- tax_shipping: true,
242
- iana_timezone: "America/New_York",
243
- auto_configure_tax_inclusivity: true,
244
- county_taxes: true,
245
- },
246
- ],
247
- [
248
- /bulk_operations\/.+/,
249
- {
250
- error_code: "SOME_ERROR_ENUM",
251
- },
252
- ],
253
- [
254
- /carts\/.+/,
255
- {
256
- note: "some cart note string",
257
- },
258
- ],
259
- [
260
- /(checkouts|orders)\/.+/,
261
- {
262
- gateway: "shopify_payments",
263
- landing_site: "https://example.com",
264
- note: "some order note",
265
- referring_site: "https://example.com",
266
- completed_at: "2021-12-30T19:00:00-05:00",
267
- closed_at: "2021-12-30T19:00:00-05:00",
268
- user_id: 11111111,
269
- location_id: 22222222,
270
- source_identifier: "some_source_identifier",
271
- source_url: "https://example.com",
272
- device_id: "some_device_id",
273
- phone: "+1 (123) 456 7890",
274
- sms_marketing_phone: "+1 (123) 456 7890",
275
- customer_locale: "en",
276
- source: "some_source",
277
- total_duties: 10.11,
278
- app_id: 12345,
279
- browser_ip: "10.0.0.1",
280
- cart_token: "some_cart_token",
281
- checkout_id: 12345,
282
- client_details: {
283
- accept_language: "en-US,en;q=0.9",
284
- browser_height: 800,
285
- },
286
- confirmation_number: "some_confirmation_number",
287
- current_total_additional_fees_set: {
288
- shop_money: {
289
- amount: "0.00",
290
- currency_code: "USD",
291
- },
292
- presentment_money: {
293
- amount: "0.00",
294
- currency_code: "USD",
295
- },
296
- },
297
- current_total_duties_set: {
298
- shop_money: {
299
- amount: "0.00",
300
- currency_code: "USD",
301
- },
302
- presentment_money: {
303
- amount: "0.00",
304
- currency_code: "USD",
305
- },
306
- },
307
- original_total_additional_fees_set: {
308
- shop_money: {
309
- amount: "0.00",
310
- currency_code: "USD",
311
- },
312
- presentment_money: {
313
- amount: "0.00",
314
- currency_code: "USD",
315
- },
316
- },
317
- original_total_duties_set: {
318
- shop_money: {
319
- amount: "0.00",
320
- currency_code: "USD",
321
- },
322
- presentment_money: {
323
- amount: "0.00",
324
- currency_code: "USD",
325
- },
326
- },
327
- checkout_token: "some_checkout_token",
328
- landing_site_ref: "https://example.com",
329
- merchant_of_record_app_id: 12345,
330
- po_number: "some_po_number",
331
- processed_at: "2021-12-30T19:00:00-05:00",
332
- reference: "some_reference",
333
- payment_terms: "some_payment_terms",
334
- reservation_token: "some_reservation_token",
335
- billing_address: {
336
- address2: "suite 101",
337
- latitude: 34.1,
338
- longitude: 34.1,
339
- },
340
- shipping_address: {
341
- address2: "suite 101",
342
- latitude: 34.1,
343
- longitude: 34.1,
344
- },
345
- customer: {
346
- created_at: "2024-05-05T02:42:32+08:00",
347
- marketing_opt_in_level: "single_opt_in",
348
- note: "some string",
349
- multipass_identifier: "hello",
350
- },
351
- },
352
- ],
353
- [
354
- /checkouts\/.+/,
355
- {
356
- line_items: [
357
- {
358
- presentment_variant_title: "51 x 76 / Blanc / 1",
359
- taxable: true,
360
- variant_price: "69.00",
361
- presentment_title: "Taie d'oreiller Pure Soie de Mûrier",
362
- requires_shipping: true,
363
- unit_price_measurement: {
364
- measured_type: null,
365
- quantity_unit: null,
366
- quantity_value: null,
367
- reference_unit: null,
368
- reference_value: null,
369
- },
370
- variant_title: "51 x 76 / Blanc / 1",
371
- title: "Taie d'oreiller Pure Soie de Mûrier",
372
- gift_card: false,
373
- destination_location_id: 4042942054746,
374
- compare_at_price: null,
375
- key: "e0105d4efb1970501cf831566fa79752",
376
- line_price: "69.00",
377
- vendor: "Emily's pillow",
378
- quantity: 1,
379
- applied_discounts: [],
380
- grams: 110,
381
- properties: [
382
- {
383
- name: "_isJust",
384
- value: "true",
385
- },
386
- ],
387
- tax_lines: [
388
- {
389
- reporting_jurisdiction_type: null,
390
- reporting_non_taxable_amount: "0.00",
391
- zone: null,
392
- compare_at: 0.2,
393
- reporting_taxable_amount: "57.50",
394
- tax_api_client_id: null,
395
- jurisdiction_source: "ActiveTax",
396
- title: "FR TVA",
397
- identifier: null,
398
- jurisdiction_type: "COUNTRY",
399
- reporting_jurisdiction_code: null,
400
- source: "MerchantActiveTax",
401
- reporting_exempt_amount: "0.00",
402
- reporting_jurisdiction_name: null,
403
- jurisdiction_id: "FR",
404
- tax_type: null,
405
- channel_liable: false,
406
- price: "11.50",
407
- rate: 0.2,
408
- position: 1,
409
- tax_calculation_price: "11.50",
410
- },
411
- ],
412
- sku: "EMIL-TO5176-22WH",
413
- rank: 0,
414
- user_id: null,
415
- product_id: 4610455470216,
416
- discount_allocations: [],
417
- origin_location_id: 1743669821576,
418
- fulfillment_service: "manual",
419
- variant_id: 32516187029640,
420
- price: "69.00",
421
- },
422
- ],
423
- },
424
- ],
425
- [
426
- /collections\/.+/,
427
- {
428
- sort_order: "manual",
429
- template_suffix: "some_template_suffix",
430
- },
431
- ],
432
- [
433
- /collection_listings\/.+/,
434
- {
435
- collection_listing: {
436
- updated_at: "2021-12-30T19:00:00-05:00",
437
- sort_order: 1,
438
- },
439
- },
440
- ],
441
- [
442
- /company_locations\/.+/,
443
- {
444
- buyer_experience_configuration: { pay_now_only: true },
445
- billing_address: {
446
- address2: "suite 101",
447
- },
448
- shipping_address: {
449
- address2: "suite 101",
450
- },
451
- },
452
- ],
453
- [
454
- /customers\/.+/,
455
- {
456
- last_order_id: 12345,
457
- multipass_identifier: "some_multipass_identifier",
458
- last_order_name: "Foobar",
459
- phone: "+1 (123) 456 7890",
460
- sms_marketing_consent: false,
461
- email_marketing_consent: false,
462
- accepts_marketing_updated_at: "2021-12-30T19:00:00-05:00",
463
- marketing_opt_in_level: "single_opt_in",
464
- },
465
- ],
466
- [
467
- /customer_account_settings\/.+/,
468
- {
469
- url: "https://example.com",
470
- },
471
- ],
472
- [
473
- /customer.+consent\/.+/,
474
- {
475
- phone: "+1 (123) 456 7890",
476
- email_address: "test@test.com",
477
- },
478
- ],
479
- [
480
- /disputes\/.+/,
481
- {
482
- evidence_sent_on: "2021-12-30T19:00:00-05:00",
483
- finalized_on: "2021-12-30T19:00:00-05:00",
484
- },
485
- ],
486
- [
487
- /draft_orders\/.+/,
488
- {
489
- invoice_sent_at: "2021-12-30T19:00:00-05:00",
490
- order_id: 12345,
491
- },
492
- ],
493
- [
494
- /fulfillment_events\/.+/,
495
- {
496
- city: "Ottawa",
497
- province: "ON",
498
- zip: "K1P1J1",
499
- address1: "150 Elgin St",
500
- estimated_delivery_at: "2021-12-30T19:00:00-05:00",
501
- },
502
- ],
503
- [
504
- /fulfillment_orders\/.+/,
505
- {
506
- remaining_fulfillment_order: {
507
- id: 5859333242902,
508
- shop_id: 20978040854,
509
- order_id: 4804938989590,
510
- assigned_location_id: 67794436118,
511
- request_status: "unsubmitted",
512
- status: "open",
513
- supported_actions: ["request_fulfillment", "hold", "move"],
514
- destination: {
515
- id: 5479404371990,
516
- address1: "23 Hassall Street",
517
- address2: "",
518
- city: "Parramatta",
519
- company: null,
520
- country: "Australia",
521
- email: "",
522
- first_name: "Tyler",
523
- last_name: "Kelleher",
524
- phone: null,
525
- province: "New South Wales",
526
- zip: "2150",
527
- },
528
- line_items: [
529
- {
530
- id: 12675478814742,
531
- shop_id: 20978040854,
532
- fulfillment_order_id: 5859333242902,
533
- quantity: 1,
534
- line_item_id: 12553770336278,
535
- inventory_item_id: 44276125368342,
536
- fulfillable_quantity: 1,
537
- variant_id: 42182036422678,
538
- },
539
- ],
540
- fulfill_at: "2022-10-13T13:00:00-04:00",
541
- fulfill_by: null,
542
- international_duties: {
543
- incoterm: "DAP",
544
- },
545
- fulfillment_holds: [],
546
- delivery_method: {
547
- id: 140816351254,
548
- method_type: "shipping",
549
- min_delivery_date_time: null,
550
- max_delivery_date_time: null,
551
- },
552
- assigned_location: {
553
- address1: null,
554
- address2: null,
555
- city: null,
556
- country_code: "CA",
557
- location_id: 67794436118,
558
- name: "test-created-via-api-2",
559
- phone: null,
560
- province: null,
561
- zip: null,
562
- },
563
- },
564
- },
565
- ],
566
- [
567
- /fulfillments\/.+/,
568
- {
569
- service: "manual",
570
- shipment_status: "confirmed",
571
- origin_address: {
572
- first_name: "Steve",
573
- address1: "123 Shipping Street",
574
- phone: "555-555-SHIP",
575
- city: "Shippington",
576
- zip: "40003",
577
- province: "Kentucky",
578
- country: "United States",
579
- last_name: "Shipper",
580
- address2: null,
581
- company: "Shipping Company",
582
- latitude: null,
583
- longitude: null,
584
- name: "Steve Shipper",
585
- country_code: "US",
586
- province_code: "KY",
587
- },
588
- },
589
- ],
590
- [
591
- /inventory_items\/.+/,
592
- {
593
- cost: 10.11,
594
- country_code_of_origin: "CA",
595
- province_code_of_origin: "CA",
596
- harmonized_system_code: "1234567890",
597
- },
598
- ],
599
- [
600
- /inventory_levels\/.+/,
601
- {
602
- available: 10,
603
- },
604
- ],
605
- [
606
- /order_transactions\/.+/,
607
- {
608
- message: "some message from the gateway",
609
- user_id: 12345,
610
- parent_id: 12345,
611
- processed_at: "2021-12-30T19:00:00-05:00",
612
- device_id: "some_device_id",
613
- error_code: "SOME_ERROR_ENUM",
614
- },
615
- ],
616
- [
617
- /orders\/risk_assessment.+/,
618
- {
619
- provider_id: 12345,
620
- provider_title: "whatever",
621
- },
622
- ],
623
- [
624
- /products\/.+/,
625
- {
626
- template_suffix: "something",
627
- image: "gid://shopify/ProductImage/1234567890",
628
- },
629
- ],
630
- [
631
- /refunds\/.+/,
632
- {
633
- return: "unknown",
634
- },
635
- ],
636
- [
637
- /selling_plan_groups\/.+/,
638
- {
639
- app_id: 12345,
640
- description: "some description",
641
- position: 1,
642
- },
643
- ],
644
- [
645
- /subscription_billing_attempts\/.+/,
646
- {
647
- id: 12345,
648
- error_message: "some error message",
649
- error_code: "some error copde",
650
- },
651
- ],
652
- [
653
- /subscription_billing_cycle.+/,
654
- {
655
- contract_edit: "some contract edit",
656
- },
657
- ],
658
- [
659
- /tender_transactions\/.+/,
660
- {
661
- user_id: 12345,
662
- processed_at: "2021-12-30T19:00:00-05:00",
663
- payment_details: { something: "true" },
664
- },
665
- ],
666
- ];
667
- const shippingAddress = {
668
- type: "object",
669
- properties: {
670
- first_name: {
671
- type: "string",
672
- },
673
- address1: {
674
- type: "string",
675
- },
676
- phone: {
677
- type: "string",
678
- },
679
- city: {
680
- type: "string",
681
- },
682
- zip: {
683
- type: "string",
684
- },
685
- province: {
686
- type: "string",
687
- },
688
- country: {
689
- type: "string",
690
- },
691
- last_name: {
692
- type: "string",
693
- },
694
- address2: {
695
- type: ["string", "null"],
696
- },
697
- company: {
698
- type: ["string", "null"],
699
- },
700
- latitude: {
701
- type: ["number", "null"],
702
- },
703
- longitude: {
704
- type: ["number", "null"],
705
- },
706
- name: {
707
- type: "string",
708
- },
709
- country_code: {
710
- type: "string",
711
- },
712
- province_code: {
713
- type: "string",
714
- },
715
- },
716
- };
717
- const overrides = [
718
- {
719
- topics: ["checkouts/create", "checkouts/update"],
720
- schema: {
721
- shipping_address: shippingAddress,
722
- },
723
- },
724
- {
725
- topics: ["order_transactions/create", "order_transactions/update"],
726
- schema: {
727
- receipt: {
728
- type: "object",
729
- additionalProperties: true,
730
- },
731
- },
732
- },
733
- ];
@@ -9,7 +9,7 @@
9
9
  "related_resource": "ApplicationCharge",
10
10
  "response": {
11
11
  "app_purchase_one_time": {
12
- "admin_graphql_api_id": "gid://shopify/AppPurchaseOneTime/1017262350",
12
+ "admin_graphql_api_id": "gid://shopify/AppPurchaseOneTime/1017262366",
13
13
  "name": "Webhook Test",
14
14
  "status": "PENDING",
15
15
  "admin_graphql_api_shop_id": "gid://shopify/Shop/548380009",
@@ -9,7 +9,7 @@
9
9
  "related_resource": "RecurringApplicationCharge",
10
10
  "response": {
11
11
  "app_subscription": {
12
- "admin_graphql_api_id": "gid://shopify/AppSubscription/1029266950",
12
+ "admin_graphql_api_id": "gid://shopify/AppSubscription/1029266975",
13
13
  "name": "Webhook Test",
14
14
  "balance_used": 0,
15
15
  "capped_amount": "20.0",