@ratio-mcp/shared 1.0.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.
@@ -0,0 +1,1082 @@
1
+ /**
2
+ * Static scopes data — sourced from GET /api/v1/scopes
3
+ * Enriched with LLM-friendly descriptions, use_cases, and pairing hints
4
+ * so the LLM can intelligently suggest scopes based on app descriptions.
5
+ *
6
+ * To refresh base data: fetch from ${RATIO_API_BASE_URL}/api/v1/scopes
7
+ *
8
+ * Last updated: 2026-03-18
9
+ */
10
+ // ─── Primary Resources ─────────────────────────────────────────
11
+ export const PRIMARY_RESOURCES = [
12
+ 'orders',
13
+ 'products',
14
+ 'customers',
15
+ 'inventory',
16
+ 'discounts',
17
+ 'payments',
18
+ 'shipping',
19
+ 'fulfillments',
20
+ 'draft_orders',
21
+ 'returns',
22
+ 'gift_cards',
23
+ 'analytics',
24
+ 'channels',
25
+ 'content',
26
+ 'files',
27
+ 'locations',
28
+ 'themes',
29
+ 'markets',
30
+ 'reports',
31
+ 'locales',
32
+ 'publications',
33
+ 'settings',
34
+ 'webhooks',
35
+ 'apps',
36
+ ];
37
+ // ─── Resource Metadata ──────────────────────────────────────────
38
+ // Tells the LLM what each resource is about, whether codegen works,
39
+ // and which resources are commonly needed together.
40
+ export const RESOURCE_METADATA = {
41
+ orders: {
42
+ description: 'Merchant orders — includes line items, pricing, customer info, payment status, ' +
43
+ 'fulfillment status, shipping/billing addresses, and order lifecycle events. ' +
44
+ 'This is the core transactional data for any e-commerce store.',
45
+ codegen_ready: true,
46
+ commonly_needed_with: ['products', 'customers', 'inventory'],
47
+ example_app_types: [
48
+ 'Order analytics & reporting',
49
+ 'Order management & fulfillment',
50
+ 'Fraud detection',
51
+ 'Shipping & logistics',
52
+ 'Accounting & invoicing',
53
+ 'Customer support tools',
54
+ ],
55
+ },
56
+ products: {
57
+ description: 'Product catalog — includes titles, descriptions, pricing (in paise), variants, ' +
58
+ 'images, inventory tracking, SEO metadata, categories, collections, and tags. ' +
59
+ 'This is the merchandise data that powers the storefront.',
60
+ codegen_ready: true,
61
+ commonly_needed_with: ['inventory', 'orders', 'categories'],
62
+ example_app_types: [
63
+ 'Product catalog sync',
64
+ 'Price comparison & optimization',
65
+ 'SEO & content optimization',
66
+ 'Marketplace integrations',
67
+ 'Product recommendations',
68
+ 'Bulk product management',
69
+ ],
70
+ },
71
+ customers: {
72
+ description: 'Customer profiles — includes contact info (email, phone), addresses, ' +
73
+ 'order history associations, and customer segmentation data. ' +
74
+ 'Essential for any app that personalizes experiences or targets specific audiences.',
75
+ codegen_ready: false,
76
+ commonly_needed_with: ['orders', 'analytics'],
77
+ example_app_types: [
78
+ 'CRM & customer management',
79
+ 'Email/SMS marketing',
80
+ 'Loyalty & rewards programs',
81
+ 'Customer analytics & segmentation',
82
+ 'Personalization engines',
83
+ ],
84
+ },
85
+ inventory: {
86
+ description: 'Stock levels and inventory management — track quantities across locations, ' +
87
+ 'set reorder points, manage warehouse stock. Critical for apps that need to ' +
88
+ 'know product availability or manage supply chain.',
89
+ codegen_ready: false,
90
+ commonly_needed_with: ['products', 'orders', 'locations'],
91
+ example_app_types: [
92
+ 'Inventory management & sync',
93
+ 'Low-stock alerts',
94
+ 'Warehouse management',
95
+ 'Demand forecasting',
96
+ 'Multi-location inventory',
97
+ ],
98
+ },
99
+ discounts: {
100
+ description: 'Discount rules and promotional campaigns — create percentage or fixed-amount ' +
101
+ 'discounts, set eligibility conditions (minimum purchase, specific products/collections), ' +
102
+ 'manage coupon codes, and track discount usage.',
103
+ codegen_ready: false,
104
+ commonly_needed_with: ['orders', 'products', 'customers'],
105
+ example_app_types: [
106
+ 'Discount & coupon management',
107
+ 'Promotional campaigns',
108
+ 'Bundle & volume pricing',
109
+ 'Loyalty discounts',
110
+ 'Cart abandonment recovery',
111
+ ],
112
+ },
113
+ payments: {
114
+ description: 'Payment transactions — view payment status, process refunds, and track ' +
115
+ 'payment gateway interactions. Covers the financial side of order processing.',
116
+ codegen_ready: false,
117
+ commonly_needed_with: ['orders', 'returns'],
118
+ example_app_types: [
119
+ 'Payment gateway integrations',
120
+ 'Refund management',
121
+ 'Financial reconciliation',
122
+ 'Accounting tools',
123
+ ],
124
+ },
125
+ shipping: {
126
+ description: 'Shipping rates, methods, and carrier configurations — manage shipping zones, ' +
127
+ 'calculate rates, and configure delivery options for the storefront.',
128
+ codegen_ready: false,
129
+ commonly_needed_with: ['orders', 'fulfillments', 'locations'],
130
+ example_app_types: [
131
+ 'Shipping rate calculators',
132
+ 'Carrier integrations',
133
+ 'Delivery estimation',
134
+ 'Shipping label generators',
135
+ ],
136
+ },
137
+ fulfillments: {
138
+ description: 'Order fulfillment tracking — manage the process of picking, packing, and ' +
139
+ 'shipping orders. Includes tracking numbers, fulfillment status, and shipment details.',
140
+ codegen_ready: false,
141
+ commonly_needed_with: ['orders', 'shipping', 'inventory'],
142
+ example_app_types: [
143
+ 'Fulfillment automation',
144
+ 'Warehouse management',
145
+ 'Dropshipping tools',
146
+ 'Shipment tracking',
147
+ ],
148
+ },
149
+ draft_orders: {
150
+ description: 'Draft/preliminary orders that haven\'t been finalized — useful for B2B workflows, ' +
151
+ 'custom quotes, or orders created on behalf of customers by staff.',
152
+ codegen_ready: false,
153
+ commonly_needed_with: ['orders', 'products', 'customers'],
154
+ example_app_types: [
155
+ 'B2B ordering tools',
156
+ 'Custom quote generators',
157
+ 'POS integrations',
158
+ 'Wholesale platforms',
159
+ ],
160
+ },
161
+ returns: {
162
+ description: 'Return and exchange management — process return requests, track return shipments, ' +
163
+ 'manage refunds, and handle exchange workflows.',
164
+ codegen_ready: false,
165
+ commonly_needed_with: ['orders', 'payments', 'inventory'],
166
+ example_app_types: [
167
+ 'Returns management portals',
168
+ 'Exchange automation',
169
+ 'Refund processing',
170
+ 'RMA tracking',
171
+ ],
172
+ },
173
+ gift_cards: {
174
+ description: 'Gift card creation and management — issue digital gift cards, track balances, ' +
175
+ 'and handle redemptions.',
176
+ codegen_ready: false,
177
+ commonly_needed_with: ['orders', 'customers'],
178
+ example_app_types: [
179
+ 'Gift card platforms',
180
+ 'Loyalty programs',
181
+ 'Corporate gifting',
182
+ ],
183
+ },
184
+ analytics: {
185
+ description: 'Store analytics and metrics — access aggregated data on sales, traffic, ' +
186
+ 'conversion rates, and business performance.',
187
+ codegen_ready: false,
188
+ commonly_needed_with: ['orders', 'products', 'customers'],
189
+ example_app_types: [
190
+ 'Dashboard & reporting tools',
191
+ 'Business intelligence',
192
+ 'Performance monitoring',
193
+ ],
194
+ },
195
+ channels: {
196
+ description: 'Sales channels — manage where products are sold (online store, social media, ' +
197
+ 'marketplaces, POS).',
198
+ codegen_ready: false,
199
+ commonly_needed_with: ['products', 'publications'],
200
+ example_app_types: [
201
+ 'Multi-channel selling',
202
+ 'Marketplace integrations',
203
+ 'Social commerce',
204
+ ],
205
+ },
206
+ content: {
207
+ description: 'Store content like pages, blog posts, and media — manage the non-product ' +
208
+ 'content on the storefront.',
209
+ codegen_ready: false,
210
+ commonly_needed_with: ['themes', 'files'],
211
+ example_app_types: [
212
+ 'CMS integrations',
213
+ 'Blog management',
214
+ 'Content marketing',
215
+ ],
216
+ },
217
+ files: {
218
+ description: 'File management — upload, organize, and serve images, documents, and other ' +
219
+ 'media assets used across the store.',
220
+ codegen_ready: false,
221
+ commonly_needed_with: ['products', 'content'],
222
+ example_app_types: [
223
+ 'Asset management',
224
+ 'Image optimization',
225
+ 'Bulk media upload',
226
+ ],
227
+ },
228
+ locations: {
229
+ description: 'Physical store locations and warehouses — manage addresses, operating hours, ' +
230
+ 'and inventory assignment per location.',
231
+ codegen_ready: false,
232
+ commonly_needed_with: ['inventory', 'shipping', 'fulfillments'],
233
+ example_app_types: [
234
+ 'Store locator',
235
+ 'Multi-location management',
236
+ 'Local delivery',
237
+ ],
238
+ },
239
+ themes: {
240
+ description: 'Storefront themes and templates — customize the look and feel of the ' +
241
+ 'merchant\'s online store.',
242
+ codegen_ready: false,
243
+ commonly_needed_with: ['content', 'files'],
244
+ example_app_types: [
245
+ 'Theme customization',
246
+ 'A/B testing',
247
+ 'Page builders',
248
+ ],
249
+ },
250
+ markets: {
251
+ description: 'International markets — manage multi-currency, multi-language, and ' +
252
+ 'region-specific selling configurations.',
253
+ codegen_ready: false,
254
+ commonly_needed_with: ['locales', 'products', 'shipping'],
255
+ example_app_types: [
256
+ 'International expansion',
257
+ 'Currency conversion',
258
+ 'Localization tools',
259
+ ],
260
+ },
261
+ reports: {
262
+ description: 'Custom reports — generate and access detailed reports on sales, inventory, ' +
263
+ 'customers, and other business metrics.',
264
+ codegen_ready: false,
265
+ commonly_needed_with: ['analytics', 'orders', 'products'],
266
+ example_app_types: [
267
+ 'Custom reporting',
268
+ 'Data export tools',
269
+ 'Financial reports',
270
+ ],
271
+ },
272
+ locales: {
273
+ description: 'Language and locale settings — manage translations and language-specific ' +
274
+ 'content for multi-language stores.',
275
+ codegen_ready: false,
276
+ commonly_needed_with: ['markets', 'content'],
277
+ example_app_types: [
278
+ 'Translation management',
279
+ 'Multi-language stores',
280
+ ],
281
+ },
282
+ publications: {
283
+ description: 'Product publishing — control which products are visible on which sales ' +
284
+ 'channels and markets.',
285
+ codegen_ready: false,
286
+ commonly_needed_with: ['products', 'channels'],
287
+ example_app_types: [
288
+ 'Channel management',
289
+ 'Product syndication',
290
+ ],
291
+ },
292
+ settings: {
293
+ description: 'Store-wide settings — access and modify global store configuration ' +
294
+ 'like checkout settings, tax rules, and notification preferences.',
295
+ codegen_ready: false,
296
+ commonly_needed_with: [],
297
+ example_app_types: [
298
+ 'Store configuration tools',
299
+ 'Tax management',
300
+ 'Checkout customization',
301
+ ],
302
+ },
303
+ webhooks: {
304
+ description: 'Webhook subscriptions — register URLs to receive real-time notifications ' +
305
+ 'when events occur (order created, product updated, app uninstalled, etc.).',
306
+ codegen_ready: false,
307
+ commonly_needed_with: ['orders', 'products'],
308
+ example_app_types: [
309
+ 'Any app that needs real-time event processing',
310
+ 'Integration middleware',
311
+ 'Automation platforms',
312
+ ],
313
+ },
314
+ apps: {
315
+ description: 'App metadata — access information about installed apps on the merchant\'s store.',
316
+ codegen_ready: false,
317
+ commonly_needed_with: [],
318
+ example_app_types: [
319
+ 'App management dashboards',
320
+ 'Integration platforms',
321
+ ],
322
+ },
323
+ };
324
+ // ─── Enriched Scope Data ────────────────────────────────────────
325
+ export const SCOPES_BY_RESOURCE = {
326
+ orders: [
327
+ {
328
+ id: '35f7087f-3412-49f2-8b39-4617100e2587',
329
+ code: 'read_orders',
330
+ label: 'Read Orders',
331
+ resource: 'orders',
332
+ createdAt: '2026-02-12T08:46:36.791Z',
333
+ description: 'View all order data — list orders with filtering/pagination, get individual order details ' +
334
+ 'including line items, pricing, customer info, addresses, payment status, and fulfillment status. ' +
335
+ 'This is the most commonly needed scope for any app that works with orders.',
336
+ use_cases: [
337
+ 'Display order lists and dashboards',
338
+ 'Analyze order trends and revenue',
339
+ 'Check order status for fulfillment workflows',
340
+ 'Validate discount eligibility based on past orders',
341
+ 'Customer support tools that look up orders',
342
+ ],
343
+ commonly_paired_with: ['read_products', 'read_customers'],
344
+ },
345
+ {
346
+ id: '0f8ee481-5e5f-41e3-996b-857b51e81e9c',
347
+ code: 'write_orders',
348
+ label: 'Write Orders',
349
+ resource: 'orders',
350
+ createdAt: '2026-02-12T08:46:36.415Z',
351
+ description: 'Create new orders, update existing orders (email, phone, note, tags, status, addresses, line items), ' +
352
+ 'cancel orders with optional restock, and update external IDs for third-party sync. ' +
353
+ 'Includes all read_orders permissions automatically.',
354
+ use_cases: [
355
+ 'Create orders from external channels (marketplace, POS)',
356
+ 'Update order notes or tags for internal workflows',
357
+ 'Cancel orders and trigger restocking',
358
+ 'Sync order IDs with external ERP/WMS systems',
359
+ 'Automated order management and processing',
360
+ ],
361
+ commonly_paired_with: ['read_products', 'write_inventory'],
362
+ },
363
+ {
364
+ id: '6615dcee-afc2-4131-adbc-d0051b0e5fb8',
365
+ code: 'order-cancel',
366
+ label: 'Order cancel',
367
+ resource: 'orders',
368
+ createdAt: '2026-02-12T12:54:16.601Z',
369
+ description: 'Specific permission to cancel orders — allows cancelling with reason, staff notes, ' +
370
+ 'restock options, and customer notification control.',
371
+ use_cases: [
372
+ 'Fraud detection apps that auto-cancel suspicious orders',
373
+ 'Customer self-service cancellation portals',
374
+ 'Automated cancellation workflows',
375
+ ],
376
+ commonly_paired_with: ['read_orders', 'write_inventory'],
377
+ },
378
+ {
379
+ id: 'e62a3d30-d9f4-455e-afa8-0d753e9697e3',
380
+ code: 'order-create',
381
+ label: 'Order create',
382
+ resource: 'orders',
383
+ createdAt: '2026-02-12T12:54:00.455Z',
384
+ description: 'Specific permission to create new orders — submit orders with full details ' +
385
+ 'including line items, customer, addresses, and payment info.',
386
+ use_cases: [
387
+ 'POS systems creating in-store orders',
388
+ 'Marketplace sync apps importing orders',
389
+ 'B2B platforms creating wholesale orders',
390
+ 'Subscription apps generating recurring orders',
391
+ ],
392
+ commonly_paired_with: ['read_orders', 'read_products', 'read_customers'],
393
+ },
394
+ {
395
+ id: 'fa1143a9-619d-4975-a031-6701e4b00ce7',
396
+ code: 'order-update',
397
+ label: 'Order update',
398
+ resource: 'orders',
399
+ createdAt: '2026-02-12T12:54:31.203Z',
400
+ description: 'Specific permission to update existing orders — modify order fields like ' +
401
+ 'email, phone, notes, tags, status, addresses, and line items.',
402
+ use_cases: [
403
+ 'Order editing tools for customer support',
404
+ 'Automated tagging and categorization',
405
+ 'Address correction workflows',
406
+ 'Order status update integrations',
407
+ ],
408
+ commonly_paired_with: ['read_orders'],
409
+ },
410
+ ],
411
+ products: [
412
+ {
413
+ id: '6ed56a65-fad1-44b0-8faa-f26f7b420f93',
414
+ code: 'read_products',
415
+ label: 'Read Products',
416
+ resource: 'products',
417
+ createdAt: '2026-02-01T12:21:12.348Z',
418
+ description: 'View product catalog — list products with filtering (status, vendor, tags, category, collection), ' +
419
+ 'get product details including variants, images, pricing, inventory tracking, and SEO metadata. ' +
420
+ 'Essential for any app that needs to reference what the merchant sells.',
421
+ use_cases: [
422
+ 'Display product catalogs and listings',
423
+ 'Sync products to external marketplaces',
424
+ 'Analyze product performance alongside orders',
425
+ 'Build product recommendation engines',
426
+ 'SEO audit tools that review product metadata',
427
+ ],
428
+ commonly_paired_with: ['read_orders', 'read_inventory'],
429
+ },
430
+ {
431
+ id: '0a7be257-d312-429e-9e94-9b8be04f0a25',
432
+ code: 'write_products',
433
+ label: 'Write Products',
434
+ resource: 'products',
435
+ createdAt: '2026-02-12T08:46:41.885Z',
436
+ description: 'Create and update products — add new products with full details (title, description, pricing, ' +
437
+ 'variants, SEO, categories, collections, tags), and update any product field. ' +
438
+ 'Includes all read_products permissions automatically.',
439
+ use_cases: [
440
+ 'Bulk product import from suppliers or spreadsheets',
441
+ 'Marketplace sync (two-way product updates)',
442
+ 'Automated price optimization',
443
+ 'Product content generation and SEO improvement',
444
+ 'Catalog management tools',
445
+ ],
446
+ commonly_paired_with: ['read_orders', 'write_inventory'],
447
+ },
448
+ {
449
+ id: 'a7f8f95e-1884-4f5e-bc21-be52586b1564',
450
+ code: 'delete_products',
451
+ label: 'Delete Products',
452
+ resource: 'products',
453
+ createdAt: '2026-02-01T12:21:12.749Z',
454
+ description: 'Permanently delete products from the store. This is a destructive action. ' +
455
+ 'Includes all write_products and read_products permissions automatically.',
456
+ use_cases: [
457
+ 'Catalog cleanup tools that remove discontinued items',
458
+ 'Sync tools that need to mirror deletions from external systems',
459
+ 'Bulk product management with full lifecycle control',
460
+ ],
461
+ commonly_paired_with: ['write_products'],
462
+ },
463
+ ],
464
+ customers: [
465
+ {
466
+ id: '1f6e9370-96f7-4af6-ad4d-bb65ec26677f',
467
+ code: 'read_customers',
468
+ label: 'Read Customers',
469
+ resource: 'customers',
470
+ createdAt: '2026-02-01T12:21:13.548Z',
471
+ description: 'View customer profiles — access contact info (email, phone), addresses, ' +
472
+ 'and associated order history. Needed for personalization, marketing, and support apps.',
473
+ use_cases: [
474
+ 'Customer analytics and segmentation',
475
+ 'Email/SMS marketing targeting',
476
+ 'CRM integrations',
477
+ 'Loyalty program member lookups',
478
+ 'Customer support tools',
479
+ ],
480
+ commonly_paired_with: ['read_orders', 'read_analytics'],
481
+ },
482
+ {
483
+ id: '8389df02-33a8-4037-b9e0-2577f6187d3f',
484
+ code: 'write_customers',
485
+ label: 'Write Customers',
486
+ resource: 'customers',
487
+ createdAt: '2026-02-01T12:21:13.749Z',
488
+ description: 'Create and update customer profiles — add new customers, update contact info and addresses. ' +
489
+ 'Includes all read_customers permissions automatically.',
490
+ use_cases: [
491
+ 'CRM sync (import customers from external systems)',
492
+ 'Customer data enrichment',
493
+ 'Loyalty program enrollment',
494
+ 'POS customer creation',
495
+ ],
496
+ commonly_paired_with: ['read_orders', 'write_orders'],
497
+ },
498
+ {
499
+ id: 'f635340b-3d1e-4377-b591-b8487021b314',
500
+ code: 'delete_customers',
501
+ label: 'Delete Customers',
502
+ resource: 'customers',
503
+ createdAt: '2026-02-01T12:21:13.948Z',
504
+ description: 'Delete customer records. Destructive action — use with caution. ' +
505
+ 'Includes all write_customers and read_customers permissions.',
506
+ use_cases: [
507
+ 'GDPR/data privacy compliance tools',
508
+ 'Customer data cleanup',
509
+ ],
510
+ commonly_paired_with: ['write_customers'],
511
+ },
512
+ ],
513
+ inventory: [
514
+ {
515
+ id: '9a1b34af-2974-4e09-a855-4d444a914169',
516
+ code: 'read_inventory',
517
+ label: 'Read Inventory',
518
+ resource: 'inventory',
519
+ createdAt: '2026-02-01T12:21:14.198Z',
520
+ description: 'View inventory levels — check stock quantities across locations, see reorder points, ' +
521
+ 'and monitor availability. Essential for any app that needs to know if products are in stock.',
522
+ use_cases: [
523
+ 'Low-stock alert systems',
524
+ 'Inventory dashboards and reporting',
525
+ 'Product availability checks for external channels',
526
+ 'Demand forecasting based on stock levels',
527
+ 'Warehouse management visibility',
528
+ ],
529
+ commonly_paired_with: ['read_products', 'read_orders'],
530
+ },
531
+ {
532
+ id: '30575c53-aa12-498e-8c76-4e8b5ae9f633',
533
+ code: 'write_inventory',
534
+ label: 'Write Inventory',
535
+ resource: 'inventory',
536
+ createdAt: '2026-02-12T08:46:29.910Z',
537
+ description: 'Update stock levels — adjust quantities, set inventory at locations, manage restocking. ' +
538
+ 'Includes all read_inventory permissions automatically.',
539
+ use_cases: [
540
+ 'Inventory sync with warehouses or ERP systems',
541
+ 'Automatic restocking when orders are cancelled',
542
+ 'Multi-location stock transfers',
543
+ 'Supplier integration for stock updates',
544
+ ],
545
+ commonly_paired_with: ['read_products', 'write_orders'],
546
+ },
547
+ {
548
+ id: 'aac7fb27-4df1-4331-a8b9-5f51ffab0623',
549
+ code: 'delete_inventory',
550
+ label: 'Delete Inventory',
551
+ resource: 'inventory',
552
+ createdAt: '2026-02-01T12:21:14.598Z',
553
+ description: 'Delete inventory records. Includes all write_inventory and read_inventory permissions.',
554
+ use_cases: [
555
+ 'Inventory cleanup tools',
556
+ 'Location decommissioning workflows',
557
+ ],
558
+ commonly_paired_with: ['write_inventory'],
559
+ },
560
+ ],
561
+ discounts: [
562
+ {
563
+ id: '2c14f243-75b1-4a16-85ce-ba4608ff78bc',
564
+ code: 'read_discounts',
565
+ label: 'Read Discounts',
566
+ resource: 'discounts',
567
+ createdAt: '2026-02-12T08:46:25.745Z',
568
+ description: 'View discount rules and campaigns — see active promotions, coupon codes, ' +
569
+ 'eligibility conditions, usage stats, and discount values (percentage or fixed amount).',
570
+ use_cases: [
571
+ 'Discount analytics and performance tracking',
572
+ 'Display active promotions on external channels',
573
+ 'Validate coupon codes before applying',
574
+ 'Marketing campaign reporting',
575
+ ],
576
+ commonly_paired_with: ['read_orders', 'read_products'],
577
+ },
578
+ {
579
+ id: '6207720c-3954-447d-a4ed-69b90b43cc8a',
580
+ code: 'write_discounts',
581
+ label: 'Write Discounts',
582
+ resource: 'discounts',
583
+ createdAt: '2026-02-12T08:46:25.470Z',
584
+ description: 'Create and update discounts — build promotional campaigns, generate coupon codes, ' +
585
+ 'set eligibility rules (min purchase, specific products/collections, customer segments). ' +
586
+ 'Includes all read_discounts permissions automatically.',
587
+ use_cases: [
588
+ 'Promotional campaign management tools',
589
+ 'Automated discount creation (flash sales, seasonal)',
590
+ 'Loyalty reward generation',
591
+ 'Bundle pricing and volume discount engines',
592
+ 'Cart abandonment recovery with auto-generated coupons',
593
+ ],
594
+ commonly_paired_with: ['read_orders', 'read_products', 'read_customers'],
595
+ },
596
+ {
597
+ id: 'cd09bd6e-b186-4637-ba21-99e376230cba',
598
+ code: 'delete_discounts',
599
+ label: 'Delete Discounts',
600
+ resource: 'discounts',
601
+ createdAt: '2026-02-01T12:21:16.528Z',
602
+ description: 'Delete discount rules and campaigns. Includes all write_discounts and read_discounts permissions.',
603
+ use_cases: [
604
+ 'Cleanup expired promotions automatically',
605
+ 'Campaign lifecycle management',
606
+ ],
607
+ commonly_paired_with: ['write_discounts'],
608
+ },
609
+ ],
610
+ payments: [
611
+ {
612
+ id: 'a7bc79b5-8003-465a-ab3b-1ff49ddc7748',
613
+ code: 'read_payments',
614
+ label: 'Read Payments',
615
+ resource: 'payments',
616
+ createdAt: '2026-02-01T12:21:14.988Z',
617
+ description: 'View payment transactions — see payment status, gateway details, and transaction history for orders.',
618
+ use_cases: [
619
+ 'Financial reporting and reconciliation',
620
+ 'Payment status dashboards',
621
+ 'Accounting tool integrations',
622
+ ],
623
+ commonly_paired_with: ['read_orders'],
624
+ },
625
+ {
626
+ id: 'b48d4b6a-3998-4cfa-babd-96226c14c24b',
627
+ code: 'write_payments',
628
+ label: 'Write Payments',
629
+ resource: 'payments',
630
+ createdAt: '2026-02-01T12:21:15.188Z',
631
+ description: 'Process payments and refunds. Includes read_payments permissions.',
632
+ use_cases: [
633
+ 'Payment gateway integrations',
634
+ 'Refund processing tools',
635
+ 'Automated payment capture',
636
+ ],
637
+ commonly_paired_with: ['write_orders', 'read_orders'],
638
+ },
639
+ {
640
+ id: '47a7d9df-18a0-40e4-a596-8aec7f4c93c8',
641
+ code: 'delete_payments',
642
+ label: 'Delete Payments',
643
+ resource: 'payments',
644
+ createdAt: '2026-02-01T12:21:15.388Z',
645
+ description: 'Delete payment records. Includes all payment permissions.',
646
+ use_cases: ['Payment record cleanup'],
647
+ commonly_paired_with: ['write_payments'],
648
+ },
649
+ ],
650
+ shipping: [
651
+ {
652
+ id: '5647544a-8cc1-41e0-9717-a8bebade010a',
653
+ code: 'read_shipping',
654
+ label: 'Read Shipping',
655
+ resource: 'shipping',
656
+ createdAt: '2026-02-01T12:21:15.588Z',
657
+ description: 'View shipping rates, zones, and carrier configurations.',
658
+ use_cases: ['Shipping rate display', 'Carrier comparison tools', 'Delivery estimation'],
659
+ commonly_paired_with: ['read_orders', 'read_fulfillments'],
660
+ },
661
+ {
662
+ id: 'b0aa2cca-8377-42b2-ae40-f3ae45fe995b',
663
+ code: 'write_shipping',
664
+ label: 'Write Shipping',
665
+ resource: 'shipping',
666
+ createdAt: '2026-02-01T12:21:15.769Z',
667
+ description: 'Create and update shipping rates and configurations. Includes read_shipping.',
668
+ use_cases: ['Carrier integration setup', 'Dynamic shipping rate engines'],
669
+ commonly_paired_with: ['write_orders', 'write_fulfillments'],
670
+ },
671
+ {
672
+ id: '5b3ad1c9-a610-4c85-9ad4-8723132f855f',
673
+ code: 'delete_shipping',
674
+ label: 'Delete Shipping',
675
+ resource: 'shipping',
676
+ createdAt: '2026-02-01T12:21:15.925Z',
677
+ description: 'Delete shipping configurations. Includes all shipping permissions.',
678
+ use_cases: ['Shipping config cleanup'],
679
+ commonly_paired_with: ['write_shipping'],
680
+ },
681
+ ],
682
+ fulfillments: [
683
+ {
684
+ id: '6032bfc2-63ea-46b8-939f-713127f2887c',
685
+ code: 'read_fulfillments',
686
+ label: 'Read Fulfillments',
687
+ resource: 'fulfillments',
688
+ createdAt: '2026-02-12T08:46:28.272Z',
689
+ description: 'View fulfillment details — tracking numbers, shipment status, and fulfillment history.',
690
+ use_cases: ['Shipment tracking dashboards', 'Fulfillment analytics', 'Customer delivery notifications'],
691
+ commonly_paired_with: ['read_orders', 'read_shipping'],
692
+ },
693
+ {
694
+ id: 'c778ad47-744b-4486-91fb-305c81e55069',
695
+ code: 'write_fulfillments',
696
+ label: 'Write Fulfillments',
697
+ resource: 'fulfillments',
698
+ createdAt: '2026-02-12T08:46:28.030Z',
699
+ description: 'Create and update fulfillments — mark orders as fulfilled, add tracking info. Includes read_fulfillments.',
700
+ use_cases: ['Fulfillment automation', 'Warehouse management systems', 'Dropshipping integrations'],
701
+ commonly_paired_with: ['write_orders', 'read_inventory'],
702
+ },
703
+ ],
704
+ draft_orders: [
705
+ {
706
+ id: '7fc8e283-ff75-45d8-9c0e-dd216820c659',
707
+ code: 'read_draft_orders',
708
+ label: 'Read Draft Orders',
709
+ resource: 'draft_orders',
710
+ createdAt: '2026-02-12T08:46:27.120Z',
711
+ description: 'View draft/preliminary orders — orders not yet finalized, useful for B2B and quoting workflows.',
712
+ use_cases: ['Draft order dashboards', 'Quote management', 'B2B order review'],
713
+ commonly_paired_with: ['read_orders', 'read_products'],
714
+ },
715
+ {
716
+ id: '61bb98e5-543b-43c1-b29f-bb42aa612569',
717
+ code: 'write_draft_orders',
718
+ label: 'Write Draft Orders',
719
+ resource: 'draft_orders',
720
+ createdAt: '2026-02-12T08:46:26.760Z',
721
+ description: 'Create and update draft orders. Includes read_draft_orders.',
722
+ use_cases: ['B2B quoting tools', 'Custom order creation workflows', 'POS draft creation'],
723
+ commonly_paired_with: ['write_orders', 'read_products', 'read_customers'],
724
+ },
725
+ ],
726
+ returns: [
727
+ {
728
+ id: 'b241cad0-c7fb-42c3-8817-be5a855c66f8',
729
+ code: 'read_returns',
730
+ label: 'Read Returns',
731
+ resource: 'returns',
732
+ createdAt: '2026-02-12T08:46:45.510Z',
733
+ description: 'View return requests and their status — track what customers want to return and why.',
734
+ use_cases: ['Returns dashboard', 'Return rate analytics', 'Customer support lookups'],
735
+ commonly_paired_with: ['read_orders', 'read_payments'],
736
+ },
737
+ {
738
+ id: 'ca27e565-7727-4c08-a4e1-967f579c268d',
739
+ code: 'write_returns',
740
+ label: 'Write Returns',
741
+ resource: 'returns',
742
+ createdAt: '2026-02-12T08:46:45.127Z',
743
+ description: 'Process return requests — approve, reject, and manage return workflows. Includes read_returns.',
744
+ use_cases: ['Returns management portals', 'Automated return approval', 'Exchange workflows'],
745
+ commonly_paired_with: ['write_orders', 'write_payments', 'write_inventory'],
746
+ },
747
+ ],
748
+ gift_cards: [
749
+ {
750
+ id: 'd48db2ee-e1e3-4c4a-aedc-890ef324d89a',
751
+ code: 'read_gift_cards',
752
+ label: 'Read Gift Cards',
753
+ resource: 'gift_cards',
754
+ createdAt: '2026-02-12T08:46:29.595Z',
755
+ description: 'View gift cards — check balances, see issued cards, and track redemptions.',
756
+ use_cases: ['Gift card balance lookups', 'Gift card analytics'],
757
+ commonly_paired_with: ['read_orders', 'read_customers'],
758
+ },
759
+ {
760
+ id: 'dbd0bd71-f7e3-41f6-9084-f78bf7867724',
761
+ code: 'write_gift_cards',
762
+ label: 'Write Gift Cards',
763
+ resource: 'gift_cards',
764
+ createdAt: '2026-02-12T08:46:29.295Z',
765
+ description: 'Issue and manage gift cards — create new cards, adjust balances. Includes read_gift_cards.',
766
+ use_cases: ['Gift card issuance platforms', 'Loyalty reward distribution', 'Corporate gifting tools'],
767
+ commonly_paired_with: ['read_customers', 'read_orders'],
768
+ },
769
+ ],
770
+ analytics: [
771
+ {
772
+ id: '79ef776f-d3da-4ef2-9f0b-88b034476bbd',
773
+ code: 'read_analytics',
774
+ label: 'Read Analytics',
775
+ resource: 'analytics',
776
+ createdAt: '2026-02-01T12:21:14.798Z',
777
+ description: 'Access store analytics — aggregated sales data, traffic metrics, conversion rates, ' +
778
+ 'and business performance insights.',
779
+ use_cases: [
780
+ 'Business intelligence dashboards',
781
+ 'Performance reporting tools',
782
+ 'Revenue tracking and forecasting',
783
+ 'Marketing attribution analysis',
784
+ ],
785
+ commonly_paired_with: ['read_orders', 'read_products', 'read_customers'],
786
+ },
787
+ ],
788
+ channels: [
789
+ {
790
+ id: '1444cdcc-8179-4324-a04f-bc037baf2adb',
791
+ code: 'read_channels',
792
+ label: 'Read Channels',
793
+ resource: 'channels',
794
+ createdAt: '2026-02-12T08:46:46.140Z',
795
+ description: 'View sales channels configured for the store.',
796
+ use_cases: ['Multi-channel dashboards', 'Channel performance comparison'],
797
+ commonly_paired_with: ['read_products', 'read_publications'],
798
+ },
799
+ {
800
+ id: 'a2557094-db43-42bf-b6df-4c04c86e3f72',
801
+ code: 'write_channels',
802
+ label: 'Write Channels',
803
+ resource: 'channels',
804
+ createdAt: '2026-02-12T08:46:45.800Z',
805
+ description: 'Create and configure sales channels. Includes read_channels.',
806
+ use_cases: ['Marketplace integration setup', 'Social commerce channel creation'],
807
+ commonly_paired_with: ['write_products', 'write_publications'],
808
+ },
809
+ ],
810
+ content: [
811
+ {
812
+ id: 'f86e34f0-d00c-46b5-b6bf-ebe5b60f5266',
813
+ code: 'read_content',
814
+ label: 'Read Content',
815
+ resource: 'content',
816
+ createdAt: '2026-02-12T08:46:51.255Z',
817
+ description: 'View store content — pages, blog posts, and media content.',
818
+ use_cases: ['Content audit tools', 'SEO analysis', 'Content migration'],
819
+ commonly_paired_with: ['read_themes', 'read_files'],
820
+ },
821
+ {
822
+ id: '7a27a369-408e-410a-8b17-f374eac4cdf8',
823
+ code: 'write_content',
824
+ label: 'Write Content',
825
+ resource: 'content',
826
+ createdAt: '2026-02-12T08:46:50.905Z',
827
+ description: 'Create and update store content. Includes read_content.',
828
+ use_cases: ['CMS integrations', 'AI content generation', 'Blog management tools'],
829
+ commonly_paired_with: ['write_files', 'write_themes'],
830
+ },
831
+ ],
832
+ files: [
833
+ {
834
+ id: '4f231a25-92fa-4ad6-b718-9061b922087a',
835
+ code: 'read_files',
836
+ label: 'Read Files',
837
+ resource: 'files',
838
+ createdAt: '2026-02-12T08:46:27.780Z',
839
+ description: 'View and download files — images, documents, and media assets.',
840
+ use_cases: ['Asset management dashboards', 'Image optimization analysis'],
841
+ commonly_paired_with: ['read_products', 'read_content'],
842
+ },
843
+ {
844
+ id: '823abdce-dd71-474e-9cd2-637ff4e978dd',
845
+ code: 'write_files',
846
+ label: 'Write Files',
847
+ resource: 'files',
848
+ createdAt: '2026-02-12T08:46:27.440Z',
849
+ description: 'Upload and manage files. Includes read_files.',
850
+ use_cases: ['Bulk image upload tools', 'Asset management with editing'],
851
+ commonly_paired_with: ['write_products', 'write_content'],
852
+ },
853
+ ],
854
+ locations: [
855
+ {
856
+ id: 'c6e7e99c-b92d-4505-85c6-c5ede28fd2ad',
857
+ code: 'read_locations',
858
+ label: 'Read Locations',
859
+ resource: 'locations',
860
+ createdAt: '2026-02-12T08:46:31.545Z',
861
+ description: 'View store locations and warehouses — addresses, hours, and inventory assignments.',
862
+ use_cases: ['Store locator features', 'Multi-location inventory visibility'],
863
+ commonly_paired_with: ['read_inventory', 'read_shipping'],
864
+ },
865
+ {
866
+ id: '2e1b5c94-32d1-49a3-bc3b-b1a85cd1b888',
867
+ code: 'write_locations',
868
+ label: 'Write Locations',
869
+ resource: 'locations',
870
+ createdAt: '2026-02-12T08:46:31.255Z',
871
+ description: 'Create and update locations. Includes read_locations.',
872
+ use_cases: ['Multi-location management tools', 'Warehouse setup automation'],
873
+ commonly_paired_with: ['write_inventory'],
874
+ },
875
+ ],
876
+ themes: [
877
+ {
878
+ id: 'a78d0d9b-0de9-4a26-ae80-77d189810a43',
879
+ code: 'read_themes',
880
+ label: 'Read Themes',
881
+ resource: 'themes',
882
+ createdAt: '2026-02-12T08:46:52.995Z',
883
+ description: 'View storefront themes and templates.',
884
+ use_cases: ['Theme analysis', 'Design audit tools'],
885
+ commonly_paired_with: ['read_content'],
886
+ },
887
+ {
888
+ id: '5e390a72-c9f8-447f-8d3c-7504d19c4c03',
889
+ code: 'write_themes',
890
+ label: 'Write Themes',
891
+ resource: 'themes',
892
+ createdAt: '2026-02-12T08:46:52.665Z',
893
+ description: 'Create and modify themes. Includes read_themes.',
894
+ use_cases: ['Theme builders', 'A/B testing tools', 'Page builders'],
895
+ commonly_paired_with: ['write_content', 'write_files'],
896
+ },
897
+ ],
898
+ markets: [
899
+ {
900
+ id: '4e301e82-0b94-46b9-8c1c-2f0e959339fe',
901
+ code: 'read_markets',
902
+ label: 'Read Markets',
903
+ resource: 'markets',
904
+ createdAt: '2026-02-12T08:46:48.800Z',
905
+ description: 'View market configurations — multi-currency and regional selling settings.',
906
+ use_cases: ['International expansion dashboards', 'Market performance comparison'],
907
+ commonly_paired_with: ['read_locales', 'read_products'],
908
+ },
909
+ {
910
+ id: '1c3e1143-f01d-46ea-9163-506e819e889d',
911
+ code: 'write_markets',
912
+ label: 'Write Markets',
913
+ resource: 'markets',
914
+ createdAt: '2026-02-12T08:46:48.400Z',
915
+ description: 'Create and configure markets. Includes read_markets.',
916
+ use_cases: ['International expansion tools', 'Market configuration automation'],
917
+ commonly_paired_with: ['write_locales', 'write_products'],
918
+ },
919
+ ],
920
+ reports: [
921
+ {
922
+ id: 'cdd7d0a6-e144-45d8-948f-56f949c53faa',
923
+ code: 'read_reports',
924
+ label: 'Read Reports',
925
+ resource: 'reports',
926
+ createdAt: '2026-02-12T08:46:44.190Z',
927
+ description: 'Access and generate custom reports on sales, inventory, customers.',
928
+ use_cases: ['Custom reporting dashboards', 'Data export tools', 'Financial reports'],
929
+ commonly_paired_with: ['read_analytics', 'read_orders'],
930
+ },
931
+ {
932
+ id: '23016fc4-e7d0-4cda-8bf6-d9c7e7a5fb52',
933
+ code: 'write_reports',
934
+ label: 'Write Reports',
935
+ resource: 'reports',
936
+ createdAt: '2026-02-12T08:46:43.880Z',
937
+ description: 'Create and schedule custom reports. Includes read_reports.',
938
+ use_cases: ['Automated report generation', 'Scheduled data exports'],
939
+ commonly_paired_with: ['read_orders', 'read_products'],
940
+ },
941
+ ],
942
+ locales: [
943
+ {
944
+ id: 'e9d07b59-2757-44a9-ade1-c08e07f694a9',
945
+ code: 'read_locales',
946
+ label: 'Read Locales',
947
+ resource: 'locales',
948
+ createdAt: '2026-02-12T08:46:48.095Z',
949
+ description: 'View language and locale settings for multi-language stores.',
950
+ use_cases: ['Translation management', 'Locale-aware content display'],
951
+ commonly_paired_with: ['read_markets', 'read_content'],
952
+ },
953
+ {
954
+ id: 'cd12d037-5a42-4434-9761-b1af076c6852',
955
+ code: 'write_locales',
956
+ label: 'Write Locales',
957
+ resource: 'locales',
958
+ createdAt: '2026-02-12T08:46:47.785Z',
959
+ description: 'Create and manage locale settings. Includes read_locales.',
960
+ use_cases: ['Translation management tools', 'Auto-translation services'],
961
+ commonly_paired_with: ['write_markets', 'write_content'],
962
+ },
963
+ ],
964
+ publications: [
965
+ {
966
+ id: '54fa765c-00ce-4db7-b420-19e534181ed8',
967
+ code: 'read_publications',
968
+ label: 'Read Publications',
969
+ resource: 'publications',
970
+ createdAt: '2026-02-12T08:46:42.885Z',
971
+ description: 'View product publication status — which products are visible on which channels.',
972
+ use_cases: ['Channel visibility dashboards', 'Product syndication tools'],
973
+ commonly_paired_with: ['read_products', 'read_channels'],
974
+ },
975
+ {
976
+ id: '6824a934-6b0a-42c0-a1c4-b9a46f6b5c6c',
977
+ code: 'write_publications',
978
+ label: 'Write Publications',
979
+ resource: 'publications',
980
+ createdAt: '2026-02-12T08:46:42.575Z',
981
+ description: 'Control product visibility on channels. Includes read_publications.',
982
+ use_cases: ['Bulk publish/unpublish tools', 'Channel management automation'],
983
+ commonly_paired_with: ['write_products', 'write_channels'],
984
+ },
985
+ ],
986
+ settings: [
987
+ {
988
+ id: 'e2468aea-a218-404d-b80b-e16c27ce215a',
989
+ code: 'read_settings',
990
+ label: 'Read Settings',
991
+ resource: 'settings',
992
+ createdAt: '2026-02-01T12:21:17.478Z',
993
+ description: 'View store-wide settings — checkout, tax, notification, and general configurations.',
994
+ use_cases: ['Store audit tools', 'Configuration backup'],
995
+ commonly_paired_with: [],
996
+ },
997
+ {
998
+ id: '5af4403a-7193-4c34-8767-995ff75df69e',
999
+ code: 'write_settings',
1000
+ label: 'Write Settings',
1001
+ resource: 'settings',
1002
+ createdAt: '2026-02-01T12:21:17.678Z',
1003
+ description: 'Modify store settings. Includes read_settings.',
1004
+ use_cases: ['Store setup automation', 'Configuration management tools'],
1005
+ commonly_paired_with: [],
1006
+ },
1007
+ {
1008
+ id: '9f77b645-ab8b-4d16-86be-c893927e08d0',
1009
+ code: 'delete_settings',
1010
+ label: 'Delete Settings',
1011
+ resource: 'settings',
1012
+ createdAt: '2026-02-01T12:21:17.878Z',
1013
+ description: 'Delete store settings. Includes all settings permissions.',
1014
+ use_cases: ['Configuration reset tools'],
1015
+ commonly_paired_with: ['write_settings'],
1016
+ },
1017
+ ],
1018
+ webhooks: [
1019
+ {
1020
+ id: 'b53a6288-8c27-4ee6-89de-c3ab0cbf45da',
1021
+ code: 'read_webhooks',
1022
+ label: 'Read Webhooks',
1023
+ resource: 'webhooks',
1024
+ createdAt: '2026-02-01T12:21:16.738Z',
1025
+ description: 'View webhook subscriptions — see which events the app is listening to.',
1026
+ use_cases: ['Webhook management dashboards', 'Integration health monitoring'],
1027
+ commonly_paired_with: ['read_orders', 'read_products'],
1028
+ },
1029
+ {
1030
+ id: '702ae668-59b6-48c2-9a92-92c39fbb63c8',
1031
+ code: 'write_webhooks',
1032
+ label: 'Write Webhooks',
1033
+ resource: 'webhooks',
1034
+ createdAt: '2026-02-01T12:21:17.139Z',
1035
+ description: 'Create and manage webhook subscriptions — register URLs for real-time event notifications. Includes read_webhooks.',
1036
+ use_cases: [
1037
+ 'Register for order/product/app events',
1038
+ 'Integration setup automation',
1039
+ 'Real-time sync with external systems',
1040
+ ],
1041
+ commonly_paired_with: ['read_orders', 'read_products'],
1042
+ },
1043
+ {
1044
+ id: '64e22053-7dee-4417-816a-5e78ac954e3d',
1045
+ code: 'delete_webhooks',
1046
+ label: 'Delete Webhooks',
1047
+ resource: 'webhooks',
1048
+ createdAt: '2026-02-01T12:21:17.280Z',
1049
+ description: 'Delete webhook subscriptions. Includes all webhooks permissions.',
1050
+ use_cases: ['Webhook cleanup during app uninstall'],
1051
+ commonly_paired_with: ['write_webhooks'],
1052
+ },
1053
+ ],
1054
+ apps: [
1055
+ {
1056
+ id: '9bca0790-64e0-48e3-af0a-4b94ebc42bff',
1057
+ code: 'read_apps',
1058
+ label: 'Read Apps',
1059
+ resource: 'apps',
1060
+ createdAt: '2026-02-12T08:46:22.240Z',
1061
+ description: 'View installed apps on the merchant\'s store.',
1062
+ use_cases: ['Integration platform dashboards', 'App compatibility checks'],
1063
+ commonly_paired_with: [],
1064
+ },
1065
+ ],
1066
+ };
1067
+ /**
1068
+ * Flat set of all valid scope codes for quick validation.
1069
+ */
1070
+ export const ALL_SCOPE_CODES = new Set(Object.values(SCOPES_BY_RESOURCE).flatMap((scopes) => scopes.map((s) => s.code)));
1071
+ /**
1072
+ * Look up which resource a scope code belongs to.
1073
+ */
1074
+ export function getResourceForScope(code) {
1075
+ for (const [resource, scopes] of Object.entries(SCOPES_BY_RESOURCE)) {
1076
+ if (scopes.some((s) => s.code === code)) {
1077
+ return resource;
1078
+ }
1079
+ }
1080
+ return undefined;
1081
+ }
1082
+ //# sourceMappingURL=scopes-data.js.map