@hyphacommerce/cli 0.0.0-stage → 0.1.0-beta.3

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,1133 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "hypha.config.toml",
4
+ "description": "Hypha's settings for one deployment. Secrets (`DATABASE_URL`, `HYPHA_SECRET_KEY`, the\nS3 keys, the email provider's password or key) stay in environment variables and\nhave no key here.",
5
+ "type": "object",
6
+ "properties": {
7
+ "agents": {
8
+ "$ref": "#/$defs/Agents",
9
+ "default": {
10
+ "enabled": true,
11
+ "preview_timeout": "5s",
12
+ "preview_token_lifetime": "15m",
13
+ "proposal_lifetime": "7d",
14
+ "writes": "apply"
15
+ }
16
+ },
17
+ "auth": {
18
+ "$ref": "#/$defs/Auth",
19
+ "default": {
20
+ "invite_lifetime": "7d",
21
+ "password_reset_lifetime": "1h",
22
+ "password_reset_resend_after": "5m",
23
+ "second_factor_lock": "15m",
24
+ "second_factor_window": "5m",
25
+ "session_lifetime": "7d"
26
+ }
27
+ },
28
+ "categories": {
29
+ "$ref": "#/$defs/Categories",
30
+ "default": {
31
+ "max_depth": 5
32
+ }
33
+ },
34
+ "customers": {
35
+ "$ref": "#/$defs/Customers",
36
+ "default": {
37
+ "erasure_delay": "10d",
38
+ "login_code_lifetime": "10m",
39
+ "login_code_resend_after": "1m",
40
+ "session_lifetime": "30d"
41
+ }
42
+ },
43
+ "database": {
44
+ "$ref": "#/$defs/Database",
45
+ "default": {
46
+ "pool_timeout": "5s",
47
+ "statement_cache": true
48
+ }
49
+ },
50
+ "email": {
51
+ "$ref": "#/$defs/Email",
52
+ "default": {
53
+ "sender": "log",
54
+ "smtp": {
55
+ "host": "localhost",
56
+ "port": 587,
57
+ "tls": "starttls"
58
+ }
59
+ }
60
+ },
61
+ "jobs": {
62
+ "$ref": "#/$defs/Jobs",
63
+ "default": {
64
+ "discount_schedule": {
65
+ "enabled": true,
66
+ "interval": "1m"
67
+ },
68
+ "dispatch": {
69
+ "batch": 100,
70
+ "enabled": true,
71
+ "interval": "2s",
72
+ "lease": "2m"
73
+ },
74
+ "enabled": true,
75
+ "idle_interval": "1m",
76
+ "media_sweep": {
77
+ "enabled": true,
78
+ "interval": "1h"
79
+ },
80
+ "price_list_schedule": {
81
+ "enabled": true,
82
+ "interval": "1m"
83
+ },
84
+ "prune": {
85
+ "agent_calls_after": "30d",
86
+ "enabled": true,
87
+ "events_after": "30d",
88
+ "extension_calls_after": "30d",
89
+ "idempotency_keys_after": "1d",
90
+ "interval": "1h",
91
+ "sessions_after": "30d"
92
+ },
93
+ "search_sync": {
94
+ "batch": 50,
95
+ "enabled": true,
96
+ "interval": "2s",
97
+ "lease": "2m"
98
+ },
99
+ "send_notifications": {
100
+ "batch": 20,
101
+ "enabled": true,
102
+ "interval": "2s",
103
+ "lease": "2m",
104
+ "retry": [
105
+ "1m",
106
+ "5m",
107
+ "30m",
108
+ "2h",
109
+ "6h"
110
+ ]
111
+ }
112
+ }
113
+ },
114
+ "media": {
115
+ "$ref": "#/$defs/Media",
116
+ "default": {
117
+ "abandoned_after": "1d",
118
+ "download_expires": "15m",
119
+ "s3": {
120
+ "create_bucket": false,
121
+ "region": "auto"
122
+ },
123
+ "transforms": "none",
124
+ "upload_expires": "15m"
125
+ }
126
+ },
127
+ "outbound": {
128
+ "$ref": "#/$defs/Outbound",
129
+ "default": {
130
+ "allow_private": false
131
+ }
132
+ },
133
+ "rate_limits": {
134
+ "$ref": "#/$defs/RateLimits",
135
+ "default": {
136
+ "agent_call": {
137
+ "burst": 120,
138
+ "per": "500ms"
139
+ },
140
+ "agent_write": {
141
+ "burst": 20,
142
+ "per": "3s"
143
+ },
144
+ "cart_create_ip": {
145
+ "burst": 20,
146
+ "per": "3s"
147
+ },
148
+ "code_email_from_ip": {
149
+ "burst": 3,
150
+ "per": "5m"
151
+ },
152
+ "code_ip": {
153
+ "burst": 5,
154
+ "per": "1m"
155
+ },
156
+ "customer_login_email_from_ip": {
157
+ "burst": 5,
158
+ "per": "1m"
159
+ },
160
+ "customer_login_ip": {
161
+ "burst": 10,
162
+ "per": "30s"
163
+ },
164
+ "discount_code_cart": {
165
+ "burst": 5,
166
+ "per": "12s"
167
+ },
168
+ "discount_code_ip": {
169
+ "burst": 10,
170
+ "per": "6s"
171
+ },
172
+ "invite_ip": {
173
+ "burst": 10,
174
+ "per": "30s"
175
+ },
176
+ "login_email": {
177
+ "burst": 50,
178
+ "per": "72s"
179
+ },
180
+ "login_email_from_ip": {
181
+ "burst": 5,
182
+ "per": "1m"
183
+ },
184
+ "login_ip": {
185
+ "burst": 10,
186
+ "per": "30s"
187
+ },
188
+ "mfa_ip": {
189
+ "burst": 10,
190
+ "per": "30s"
191
+ },
192
+ "oauth_ip": {
193
+ "burst": 20,
194
+ "per": "3s"
195
+ },
196
+ "reset_confirm_ip": {
197
+ "burst": 10,
198
+ "per": "30s"
199
+ },
200
+ "reset_email_from_ip": {
201
+ "burst": 3,
202
+ "per": "5m"
203
+ },
204
+ "reset_ip": {
205
+ "burst": 5,
206
+ "per": "1m"
207
+ },
208
+ "shipping_quotes_cart": {
209
+ "burst": 10,
210
+ "per": "2s"
211
+ },
212
+ "spore_public": {
213
+ "burst": 120,
214
+ "per": "250ms"
215
+ }
216
+ }
217
+ },
218
+ "server": {
219
+ "$ref": "#/$defs/Server",
220
+ "default": {
221
+ "bind": "127.0.0.1:3000",
222
+ "max_body": "2MiB",
223
+ "shutdown_grace": "10s",
224
+ "trusted_proxies": []
225
+ }
226
+ },
227
+ "spores": {
228
+ "description": "Settings for the spores this API is built with: one table per spore,\n`[spores.<name>]`, read by the spore itself; its keys are the spore's to document. A\ntable for a spore the build doesn't have stops startup.",
229
+ "type": "object",
230
+ "additionalProperties": {
231
+ "type": "object",
232
+ "additionalProperties": true
233
+ }
234
+ },
235
+ "webhooks": {
236
+ "$ref": "#/$defs/Webhooks",
237
+ "default": {
238
+ "give_up_after": "3d",
239
+ "retry": [
240
+ "1m",
241
+ "5m",
242
+ "30m",
243
+ "2h",
244
+ "6h"
245
+ ],
246
+ "retry_then_every": "12h"
247
+ }
248
+ }
249
+ },
250
+ "additionalProperties": false,
251
+ "$defs": {
252
+ "AgentWrites": {
253
+ "description": "The most any agent may write (`agents.writes`).",
254
+ "oneOf": [
255
+ {
256
+ "description": "Each agent's grant decides.",
257
+ "type": "string",
258
+ "const": "apply"
259
+ },
260
+ {
261
+ "description": "No agent applies a write itself: each is proposed, for a person to approve.",
262
+ "type": "string",
263
+ "const": "propose"
264
+ },
265
+ {
266
+ "description": "Agents only read.",
267
+ "type": "string",
268
+ "const": "off"
269
+ }
270
+ ]
271
+ },
272
+ "Agents": {
273
+ "description": "Agents, and previews of writes (`Hypha-Preview`), which anyone may ask for.",
274
+ "type": "object",
275
+ "properties": {
276
+ "enabled": {
277
+ "description": "Whether agents may act at all: `false` refuses every agent's credentials, whatever\ntheir grants say.",
278
+ "type": "boolean",
279
+ "default": true
280
+ },
281
+ "preview_timeout": {
282
+ "description": "How long one statement of a previewed write may run before it's cut off (the\npreview then fails): a preview holds the locks its write takes until it's rolled\nback. 100 milliseconds to 30 seconds; 5 seconds by default.",
283
+ "$ref": "#/$defs/Duration",
284
+ "default": "5s"
285
+ },
286
+ "preview_token_lifetime": {
287
+ "description": "How long a preview's token (`Hypha-Preview-Token`) can apply its write. 1 minute to\n1 day; 15 minutes by default.",
288
+ "$ref": "#/$defs/Duration",
289
+ "default": "15m"
290
+ },
291
+ "proposal_lifetime": {
292
+ "description": "How long a proposal waits for a person before it expires. 1 hour to 90 days; 7\ndays by default.",
293
+ "$ref": "#/$defs/Duration",
294
+ "default": "7d"
295
+ },
296
+ "writes": {
297
+ "description": "The most any agent may write, whatever its grant says (`HYPHA_AGENT_WRITES` too):\n`apply` (grants decide), `propose` (every write waits for a person to approve it) or\n`off` (agents only read; no previews or proposals either).",
298
+ "$ref": "#/$defs/AgentWrites",
299
+ "default": "apply"
300
+ }
301
+ },
302
+ "additionalProperties": false
303
+ },
304
+ "Auth": {
305
+ "description": "How long staff sessions and auth's emailed tokens last. Each is at most 365 days.",
306
+ "type": "object",
307
+ "properties": {
308
+ "invite_lifetime": {
309
+ "description": "How long an invite works. At least 1 minute.",
310
+ "$ref": "#/$defs/Duration",
311
+ "default": "7d"
312
+ },
313
+ "locked_accounts": {
314
+ "description": "Staff accounts locked against changing themselves, by login email: a public\ndemo's shared login. They keep what their role allows, but can't change their\nname, password, two-factor setup or other sessions (`403 account_locked`), see only\ntheir own session, and get no password reset emails.",
315
+ "type": "array",
316
+ "items": {
317
+ "type": "string"
318
+ }
319
+ },
320
+ "password_reset_lifetime": {
321
+ "description": "How long an emailed password reset link works.",
322
+ "$ref": "#/$defs/Duration",
323
+ "default": "1h"
324
+ },
325
+ "password_reset_resend_after": {
326
+ "description": "While the latest reset link is younger than this, unused and still working,\nasking again sends nothing.",
327
+ "$ref": "#/$defs/Duration",
328
+ "default": "5m"
329
+ },
330
+ "second_factor_lock": {
331
+ "description": "How long second-factor checks stop after 5 wrong codes in a row.",
332
+ "$ref": "#/$defs/Duration",
333
+ "default": "15m"
334
+ },
335
+ "second_factor_window": {
336
+ "description": "How long, after the password, the second factor may be entered.",
337
+ "$ref": "#/$defs/Duration",
338
+ "default": "5m"
339
+ },
340
+ "session_lifetime": {
341
+ "description": "How long a session lasts from login. At least 1 minute.",
342
+ "$ref": "#/$defs/Duration",
343
+ "default": "7d"
344
+ }
345
+ },
346
+ "additionalProperties": false
347
+ },
348
+ "Categories": {
349
+ "description": "The product category tree.",
350
+ "type": "object",
351
+ "properties": {
352
+ "max_depth": {
353
+ "description": "How many levels categories nest, 1 to 10. Lowering it leaves deeper categories\nwhere they are: it applies to creating and moving.",
354
+ "type": "integer",
355
+ "format": "uint8",
356
+ "default": 5,
357
+ "maximum": 255,
358
+ "minimum": 0
359
+ }
360
+ },
361
+ "additionalProperties": false
362
+ },
363
+ "Customers": {
364
+ "description": "Customers and their personal data.",
365
+ "type": "object",
366
+ "properties": {
367
+ "erasure_delay": {
368
+ "description": "How long a requested erasure of a customer's personal data can be cancelled\nbefore the job runs it. At least 1 hour; 10 days by default. A merchant under a\nretention duty sets it longer.",
369
+ "$ref": "#/$defs/Duration",
370
+ "default": "10d"
371
+ },
372
+ "login_code_lifetime": {
373
+ "description": "How long a sign-in code emailed to a customer works. At least 1 minute; 10 minutes\nby default.",
374
+ "$ref": "#/$defs/Duration",
375
+ "default": "10m"
376
+ },
377
+ "login_code_resend_after": {
378
+ "description": "While a customer's latest code is younger than this, asking for another sends\nnothing. Shorter than `login_code_lifetime`; 1 minute by default.",
379
+ "$ref": "#/$defs/Duration",
380
+ "default": "1m"
381
+ },
382
+ "session_lifetime": {
383
+ "description": "How long a customer stays signed in on the storefront without using the session;\nevery use within it starts the count again. At least 1 minute; 30 days by default.",
384
+ "$ref": "#/$defs/Duration",
385
+ "default": "30d"
386
+ }
387
+ },
388
+ "additionalProperties": false
389
+ },
390
+ "Database": {
391
+ "description": "The Postgres connection pool. The URL is `DATABASE_URL`, never here.",
392
+ "type": "object",
393
+ "properties": {
394
+ "max_connections": {
395
+ "description": "The most connections open at once. Unset: the pool's default, 4 per CPU.",
396
+ "type": [
397
+ "integer",
398
+ "null"
399
+ ],
400
+ "format": "uint32",
401
+ "minimum": 0
402
+ },
403
+ "pool_timeout": {
404
+ "description": "How long a request waits for a pooled connection (or for a new one to open, or an\nold one to be checked) before it fails.",
405
+ "$ref": "#/$defs/Duration",
406
+ "default": "5s"
407
+ },
408
+ "statement_cache": {
409
+ "description": "Prepare each query once per connection and reuse it, instead of having Postgres\nplan it on every call (most of its work for simple reads). Turn it off behind a\npooler in transaction mode that doesn't keep prepared statements (PgBouncer\nbefore 1.21, or without `max_prepared_statements`).",
410
+ "type": "boolean",
411
+ "default": true
412
+ }
413
+ },
414
+ "additionalProperties": false
415
+ },
416
+ "DispatchJob": {
417
+ "description": "Delivering events: fanning them out to apps and handlers, and running what's due.",
418
+ "type": "object",
419
+ "properties": {
420
+ "batch": {
421
+ "description": "Events fanned out, deliveries run, or old rows pruned per step (1 to 1,000).",
422
+ "type": "integer",
423
+ "format": "uint32",
424
+ "default": 100,
425
+ "minimum": 0
426
+ },
427
+ "enabled": {
428
+ "type": "boolean",
429
+ "default": true
430
+ },
431
+ "interval": {
432
+ "$ref": "#/$defs/Duration",
433
+ "default": "2s"
434
+ },
435
+ "lease": {
436
+ "description": "How long a runner holds the deliveries it took; past it, another may take them.\nAt least 1 minute: the slowest webhook may take 45 seconds.",
437
+ "$ref": "#/$defs/Duration",
438
+ "default": "2m"
439
+ }
440
+ },
441
+ "additionalProperties": false
442
+ },
443
+ "Duration": {
444
+ "description": "A whole number and a unit: ms, s, m, h or d.",
445
+ "type": "string",
446
+ "examples": [
447
+ "30s",
448
+ "5m",
449
+ "1h",
450
+ "7d"
451
+ ],
452
+ "pattern": "^\\s*[0-9]+(ms|s|m|h|d)\\s*$"
453
+ },
454
+ "Email": {
455
+ "description": "How emails go out: order confirmations, shipping updates, staff invites and password\nresets.",
456
+ "type": "object",
457
+ "properties": {
458
+ "from": {
459
+ "description": "The address emails come from, on a domain the provider verified; the shop's name\n(notification settings) is shown with it. Required unless `sender` is `log`.\n`HYPHA_EMAIL_FROM` wins.",
460
+ "type": [
461
+ "string",
462
+ "null"
463
+ ]
464
+ },
465
+ "sender": {
466
+ "description": "Who sends them: `log` writes each one to the log instead (development only),\n`smtp` uses `email.smtp` (not on Workers), `resend` Resend's API with the key in\n`HYPHA_RESEND_API_KEY`. `HYPHA_EMAIL_SENDER` wins.",
467
+ "$ref": "#/$defs/EmailSender",
468
+ "default": "log"
469
+ },
470
+ "smtp": {
471
+ "$ref": "#/$defs/Smtp",
472
+ "default": {
473
+ "host": "localhost",
474
+ "port": 587,
475
+ "tls": "starttls"
476
+ }
477
+ }
478
+ },
479
+ "additionalProperties": false
480
+ },
481
+ "EmailSender": {
482
+ "description": "Who sends emails.",
483
+ "oneOf": [
484
+ {
485
+ "description": "Written to the log, not sent.",
486
+ "type": "string",
487
+ "const": "log"
488
+ },
489
+ {
490
+ "description": "An SMTP server (`email.smtp`): any provider's, or Mailpit locally.",
491
+ "type": "string",
492
+ "const": "smtp"
493
+ },
494
+ {
495
+ "description": "Resend's API; the key is `HYPHA_RESEND_API_KEY`.",
496
+ "type": "string",
497
+ "const": "resend"
498
+ }
499
+ ]
500
+ },
501
+ "Job": {
502
+ "description": "A job that runs every `interval`, and again at once while it has more to do.",
503
+ "type": "object",
504
+ "properties": {
505
+ "enabled": {
506
+ "type": "boolean",
507
+ "default": true
508
+ },
509
+ "interval": {
510
+ "$ref": "#/$defs/Duration",
511
+ "default": "1h"
512
+ }
513
+ },
514
+ "additionalProperties": false
515
+ },
516
+ "Jobs": {
517
+ "description": "Background jobs. Set `enabled = false` on instances that only serve requests, and\nkeep them on in one. A Workers host runs them from Cron triggers and ignores the\nintervals.",
518
+ "type": "object",
519
+ "properties": {
520
+ "discount_schedule": {
521
+ "description": "Announcing discounts' windows opening and closing (`discount.started` /\n`.ended`), so storefront caches and promotion badges follow. Carts themselves\nfollow the clock without it. A Workers host runs it on the minute's ticks that have\nwork.",
522
+ "$ref": "#/$defs/Job",
523
+ "default": {
524
+ "enabled": true,
525
+ "interval": "1m"
526
+ }
527
+ },
528
+ "dispatch": {
529
+ "$ref": "#/$defs/DispatchJob",
530
+ "default": {
531
+ "batch": 100,
532
+ "enabled": true,
533
+ "interval": "2s",
534
+ "lease": "2m"
535
+ }
536
+ },
537
+ "enabled": {
538
+ "description": "`false`: this instance runs no jobs, whatever the jobs below say.",
539
+ "type": "boolean",
540
+ "default": true
541
+ },
542
+ "idle_interval": {
543
+ "description": "The longest a job with nothing to do waits before looking again. An idle job\ndoubles its wait from its `interval` up to this, and drops back as soon as it\nfinds work; writes wake the dispatcher (and it search) at once, so changes don't\nwait for it. Long enough, a database that bills while busy can rest.",
544
+ "$ref": "#/$defs/Duration",
545
+ "default": "1m"
546
+ },
547
+ "media_sweep": {
548
+ "$ref": "#/$defs/Job",
549
+ "default": {
550
+ "enabled": true,
551
+ "interval": "1h"
552
+ }
553
+ },
554
+ "price_list_schedule": {
555
+ "description": "Announcing price lists' windows opening and closing (`price_list.started` /\n`.ended`), so search and storefront caches follow. Prices themselves follow the\nclock without it. A Workers host runs it on the minute's ticks that have work.",
556
+ "$ref": "#/$defs/Job",
557
+ "default": {
558
+ "enabled": true,
559
+ "interval": "1m"
560
+ }
561
+ },
562
+ "prune": {
563
+ "$ref": "#/$defs/PruneJob",
564
+ "default": {
565
+ "agent_calls_after": "30d",
566
+ "enabled": true,
567
+ "events_after": "30d",
568
+ "extension_calls_after": "30d",
569
+ "idempotency_keys_after": "1d",
570
+ "interval": "1h",
571
+ "sessions_after": "30d"
572
+ }
573
+ },
574
+ "search_sync": {
575
+ "$ref": "#/$defs/SearchSyncJob",
576
+ "default": {
577
+ "batch": 50,
578
+ "enabled": true,
579
+ "interval": "2s",
580
+ "lease": "2m"
581
+ }
582
+ },
583
+ "send_notifications": {
584
+ "$ref": "#/$defs/SendNotificationsJob",
585
+ "default": {
586
+ "batch": 20,
587
+ "enabled": true,
588
+ "interval": "2s",
589
+ "lease": "2m",
590
+ "retry": [
591
+ "1m",
592
+ "5m",
593
+ "30m",
594
+ "2h",
595
+ "6h"
596
+ ]
597
+ }
598
+ }
599
+ },
600
+ "additionalProperties": false
601
+ },
602
+ "Media": {
603
+ "description": "File storage and asset URLs. Media is off without `s3.endpoint`.",
604
+ "type": "object",
605
+ "properties": {
606
+ "abandoned_after": {
607
+ "description": "How long an unfinished upload is kept before the sweep deletes it. At least\n`upload_expires`.",
608
+ "$ref": "#/$defs/Duration",
609
+ "default": "1d"
610
+ },
611
+ "download_expires": {
612
+ "description": "How long a private file's download URL works (1 minute to 7 days).",
613
+ "$ref": "#/$defs/Duration",
614
+ "default": "15m"
615
+ },
616
+ "public_url": {
617
+ "description": "Where public files are served from, e.g. a CDN. Unset: every file gets a signed\nURL. `HYPHA_MEDIA_URL` wins.",
618
+ "type": [
619
+ "string",
620
+ "null"
621
+ ]
622
+ },
623
+ "s3": {
624
+ "$ref": "#/$defs/S3",
625
+ "default": {
626
+ "create_bucket": false,
627
+ "region": "auto"
628
+ }
629
+ },
630
+ "transforms": {
631
+ "description": "How thumbnails are made from public image URLs. `HYPHA_MEDIA_TRANSFORMS` wins.",
632
+ "$ref": "#/$defs/Transforms",
633
+ "default": "none"
634
+ },
635
+ "upload_expires": {
636
+ "description": "How long an upload URL works (1 minute to 7 days).",
637
+ "$ref": "#/$defs/Duration",
638
+ "default": "15m"
639
+ }
640
+ },
641
+ "additionalProperties": false
642
+ },
643
+ "Outbound": {
644
+ "description": "Calls to URLs merchants configure (rate apps, webhooks).",
645
+ "type": "object",
646
+ "properties": {
647
+ "allow_private": {
648
+ "description": "Lets those calls reach private and loopback addresses, for apps on localhost.\nDevelopment only. `HYPHA_ALLOW_PRIVATE_CALLBACKS` wins.",
649
+ "type": "boolean",
650
+ "default": false
651
+ }
652
+ },
653
+ "additionalProperties": false
654
+ },
655
+ "PruneJob": {
656
+ "description": "Deleting what's past keeping.",
657
+ "type": "object",
658
+ "properties": {
659
+ "agent_calls_after": {
660
+ "description": "How long the log of agents' calls is kept.",
661
+ "$ref": "#/$defs/Duration",
662
+ "default": "30d"
663
+ },
664
+ "enabled": {
665
+ "type": "boolean",
666
+ "default": true
667
+ },
668
+ "events_after": {
669
+ "description": "How long events, and their deliveries, are kept. At least a day longer than\n`webhooks.give_up_after`, so no delivery is deleted while it's still due.",
670
+ "$ref": "#/$defs/Duration",
671
+ "default": "30d"
672
+ },
673
+ "extension_calls_after": {
674
+ "description": "How long the log of calls to apps' extension points is kept.",
675
+ "$ref": "#/$defs/Duration",
676
+ "default": "30d"
677
+ },
678
+ "idempotency_keys_after": {
679
+ "description": "How long an `Idempotency-Key` is honoured. At least 1 hour.",
680
+ "$ref": "#/$defs/Duration",
681
+ "default": "1d"
682
+ },
683
+ "interval": {
684
+ "$ref": "#/$defs/Duration",
685
+ "default": "1h"
686
+ },
687
+ "sessions_after": {
688
+ "description": "How long a session is kept after it ended (expired or revoked).",
689
+ "$ref": "#/$defs/Duration",
690
+ "default": "30d"
691
+ }
692
+ },
693
+ "additionalProperties": false
694
+ },
695
+ "Quota": {
696
+ "description": "Up to `burst` requests at once, then one more each `per`.",
697
+ "type": "object",
698
+ "properties": {
699
+ "burst": {
700
+ "description": "At least 1.",
701
+ "type": "integer",
702
+ "format": "uint32",
703
+ "minimum": 0
704
+ },
705
+ "per": {
706
+ "$ref": "#/$defs/Duration"
707
+ }
708
+ },
709
+ "additionalProperties": false,
710
+ "required": [
711
+ "burst",
712
+ "per"
713
+ ]
714
+ },
715
+ "RateLimits": {
716
+ "description": "Limits on the routes that need no credentials, and on the storefront routes that call\nrate apps. Counted per instance.",
717
+ "type": "object",
718
+ "properties": {
719
+ "agent_call": {
720
+ "description": "An agent's calls, per agent: reads, previews, proposals and writes.",
721
+ "$ref": "#/$defs/Quota",
722
+ "default": {
723
+ "burst": 120,
724
+ "per": "500ms"
725
+ }
726
+ },
727
+ "agent_write": {
728
+ "description": "An agent's writes and proposals, per agent: few, since each changes the store or\nasks a person to look.",
729
+ "$ref": "#/$defs/Quota",
730
+ "default": {
731
+ "burst": 20,
732
+ "per": "3s"
733
+ }
734
+ },
735
+ "cart_create_ip": {
736
+ "description": "Creating carts, per client address.",
737
+ "$ref": "#/$defs/Quota",
738
+ "default": {
739
+ "burst": 20,
740
+ "per": "3s"
741
+ }
742
+ },
743
+ "code_email_from_ip": {
744
+ "description": "A customer asking for a sign-in code, per email and address.",
745
+ "$ref": "#/$defs/Quota",
746
+ "default": {
747
+ "burst": 3,
748
+ "per": "5m"
749
+ }
750
+ },
751
+ "code_ip": {
752
+ "description": "A customer asking for a sign-in code, per client address.",
753
+ "$ref": "#/$defs/Quota",
754
+ "default": {
755
+ "burst": 5,
756
+ "per": "1m"
757
+ }
758
+ },
759
+ "customer_login_email_from_ip": {
760
+ "description": "A customer signing in with a code, per email and address: guesses at one account\nfrom one place (the fifth wrong code voids it anyway).",
761
+ "$ref": "#/$defs/Quota",
762
+ "default": {
763
+ "burst": 5,
764
+ "per": "1m"
765
+ }
766
+ },
767
+ "customer_login_ip": {
768
+ "description": "A customer signing in with a code, per client address.",
769
+ "$ref": "#/$defs/Quota",
770
+ "default": {
771
+ "burst": 10,
772
+ "per": "30s"
773
+ }
774
+ },
775
+ "discount_code_cart": {
776
+ "description": "Entering a discount code, per cart.",
777
+ "$ref": "#/$defs/Quota",
778
+ "default": {
779
+ "burst": 5,
780
+ "per": "12s"
781
+ }
782
+ },
783
+ "discount_code_ip": {
784
+ "description": "Entering a discount code on a cart, per client address: single-use codes are\nguessable.",
785
+ "$ref": "#/$defs/Quota",
786
+ "default": {
787
+ "burst": 10,
788
+ "per": "6s"
789
+ }
790
+ },
791
+ "invite_ip": {
792
+ "description": "Accepting an invite, per client address.",
793
+ "$ref": "#/$defs/Quota",
794
+ "default": {
795
+ "burst": 10,
796
+ "per": "30s"
797
+ }
798
+ },
799
+ "login_email": {
800
+ "description": "Logging in, per email from anywhere: guessing spread over many addresses.",
801
+ "$ref": "#/$defs/Quota",
802
+ "default": {
803
+ "burst": 50,
804
+ "per": "72s"
805
+ }
806
+ },
807
+ "login_email_from_ip": {
808
+ "description": "Logging in, per email and address: guesses at one account from one place.",
809
+ "$ref": "#/$defs/Quota",
810
+ "default": {
811
+ "burst": 5,
812
+ "per": "1m"
813
+ }
814
+ },
815
+ "login_ip": {
816
+ "description": "Logging in, per client address.",
817
+ "$ref": "#/$defs/Quota",
818
+ "default": {
819
+ "burst": 10,
820
+ "per": "30s"
821
+ }
822
+ },
823
+ "mfa_ip": {
824
+ "description": "The second factor, per client address.",
825
+ "$ref": "#/$defs/Quota",
826
+ "default": {
827
+ "burst": 10,
828
+ "per": "30s"
829
+ }
830
+ },
831
+ "oauth_ip": {
832
+ "description": "The OAuth endpoints (authorize, token, revoke), per client address.",
833
+ "$ref": "#/$defs/Quota",
834
+ "default": {
835
+ "burst": 20,
836
+ "per": "3s"
837
+ }
838
+ },
839
+ "reset_confirm_ip": {
840
+ "description": "Setting a new password with a reset token, per client address.",
841
+ "$ref": "#/$defs/Quota",
842
+ "default": {
843
+ "burst": 10,
844
+ "per": "30s"
845
+ }
846
+ },
847
+ "reset_email_from_ip": {
848
+ "description": "Asking for a password reset, per email and address.",
849
+ "$ref": "#/$defs/Quota",
850
+ "default": {
851
+ "burst": 3,
852
+ "per": "5m"
853
+ }
854
+ },
855
+ "reset_ip": {
856
+ "description": "Asking for a password reset, per client address.",
857
+ "$ref": "#/$defs/Quota",
858
+ "default": {
859
+ "burst": 5,
860
+ "per": "1m"
861
+ }
862
+ },
863
+ "shipping_quotes_cart": {
864
+ "description": "Shipping quotes, per cart: each may call rate apps.",
865
+ "$ref": "#/$defs/Quota",
866
+ "default": {
867
+ "burst": 10,
868
+ "per": "2s"
869
+ }
870
+ },
871
+ "spore_public": {
872
+ "description": "Spores' public routes (`/spores/<name>/…`: a payment provider's webhooks), per\nclient address, all spores together.",
873
+ "$ref": "#/$defs/Quota",
874
+ "default": {
875
+ "burst": 120,
876
+ "per": "250ms"
877
+ }
878
+ }
879
+ },
880
+ "additionalProperties": false
881
+ },
882
+ "S3": {
883
+ "description": "An S3-compatible bucket (R2, S3, MinIO). The keys are `HYPHA_S3_ACCESS_KEY_ID` and\n`HYPHA_S3_SECRET_ACCESS_KEY`, never here.",
884
+ "type": "object",
885
+ "properties": {
886
+ "bucket": {
887
+ "description": "Required with an endpoint. `HYPHA_S3_BUCKET` wins.",
888
+ "type": [
889
+ "string",
890
+ "null"
891
+ ]
892
+ },
893
+ "create_bucket": {
894
+ "description": "Creates the bucket on startup if it's missing. Development only.\n`HYPHA_S3_CREATE_BUCKET` wins.",
895
+ "type": "boolean",
896
+ "default": false
897
+ },
898
+ "endpoint": {
899
+ "description": "The S3 API's URL. Unset: media is off. `HYPHA_S3_ENDPOINT` wins.",
900
+ "type": [
901
+ "string",
902
+ "null"
903
+ ]
904
+ },
905
+ "region": {
906
+ "description": "`HYPHA_S3_REGION` wins.",
907
+ "type": "string",
908
+ "default": "auto"
909
+ }
910
+ },
911
+ "additionalProperties": false
912
+ },
913
+ "SearchSyncJob": {
914
+ "description": "Keeping search up to date: rebuilding the products events marked.",
915
+ "type": "object",
916
+ "properties": {
917
+ "batch": {
918
+ "description": "Products rebuilt per step, each in every market (1 to 1,000).",
919
+ "type": "integer",
920
+ "format": "uint32",
921
+ "default": 50,
922
+ "minimum": 0
923
+ },
924
+ "enabled": {
925
+ "type": "boolean",
926
+ "default": true
927
+ },
928
+ "interval": {
929
+ "$ref": "#/$defs/Duration",
930
+ "default": "2s"
931
+ },
932
+ "lease": {
933
+ "description": "How long a runner holds the products it took; past it, another may take them.\nAt least 10 seconds.",
934
+ "$ref": "#/$defs/Duration",
935
+ "default": "2m"
936
+ }
937
+ },
938
+ "additionalProperties": false
939
+ },
940
+ "SendNotificationsJob": {
941
+ "description": "Sending the emails the store queued: order emails and resends. Staff invites and\npassword resets are sent by their request, not by this job.",
942
+ "type": "object",
943
+ "properties": {
944
+ "batch": {
945
+ "description": "Emails sent per step (1 to 1,000).",
946
+ "type": "integer",
947
+ "format": "uint32",
948
+ "default": 20,
949
+ "minimum": 0
950
+ },
951
+ "enabled": {
952
+ "type": "boolean",
953
+ "default": true
954
+ },
955
+ "interval": {
956
+ "$ref": "#/$defs/Duration",
957
+ "default": "2s"
958
+ },
959
+ "lease": {
960
+ "description": "How long a runner holds the emails it took; past it, another may take them (and\na provider without idempotency keys, SMTP, may then get one twice). At least 20\nseconds: a send may take 15.",
961
+ "$ref": "#/$defs/Duration",
962
+ "default": "2m"
963
+ },
964
+ "retry": {
965
+ "description": "The waits after each failure the provider says may pass (a timeout, a 5xx, a\nrate limit), in order; after the last, the email fails for good and staff can\nresend it. At most 20, each 1 second to 365 days.",
966
+ "type": "array",
967
+ "default": [
968
+ "1m",
969
+ "5m",
970
+ "30m",
971
+ "2h",
972
+ "6h"
973
+ ],
974
+ "items": {
975
+ "$ref": "#/$defs/Duration"
976
+ }
977
+ }
978
+ },
979
+ "additionalProperties": false
980
+ },
981
+ "Server": {
982
+ "description": "The HTTP server.",
983
+ "type": "object",
984
+ "properties": {
985
+ "admin_url": {
986
+ "description": "Where the admin panel lives, for links in emails; unset, emails show the bare\ntoken. `HYPHA_ADMIN_URL` wins.",
987
+ "type": [
988
+ "string",
989
+ "null"
990
+ ]
991
+ },
992
+ "bind": {
993
+ "description": "The address to listen on, `host:port`. `HYPHA_BIND` wins, then `PORT` (as\n`0.0.0.0:$PORT`, as platforms like Fly.io and Render expect).",
994
+ "type": "string",
995
+ "default": "127.0.0.1:3000"
996
+ },
997
+ "max_body": {
998
+ "description": "The largest request body accepted: 1KiB to 64MiB. Files don't count: they're\nuploaded to storage directly. Below 256KiB, a product's longest description may\nnot fit.",
999
+ "$ref": "#/$defs/Size",
1000
+ "default": "2MiB"
1001
+ },
1002
+ "public_url": {
1003
+ "description": "The API's public base URL (`https://api.shop.example`), as apps reach it: the\nOAuth issuer and endpoints in its metadata, the `issuer` of token answers, the\n`iss` of app session tokens, a private app's `token_endpoint`. Unset, it's\nderived from each request: `X-Forwarded-Host` and `-Proto` from a trusted proxy\n(`trusted_proxies`), else the `Host` header. `HYPHA_PUBLIC_URL` wins.",
1004
+ "type": [
1005
+ "string",
1006
+ "null"
1007
+ ]
1008
+ },
1009
+ "shutdown_grace": {
1010
+ "description": "How long stopping waits for jobs, and then for background work, to finish. At\nleast 1 second.",
1011
+ "$ref": "#/$defs/Duration",
1012
+ "default": "10s"
1013
+ },
1014
+ "trusted_proxies": {
1015
+ "description": "The proxies and load balancers whose `X-Forwarded-For` is believed: CIDR ranges\nor addresses. Behind one, set it, or every client shares one rate limit.\n`HYPHA_TRUSTED_PROXIES` (comma-separated) wins.",
1016
+ "type": "array",
1017
+ "default": [],
1018
+ "items": {
1019
+ "type": "string"
1020
+ }
1021
+ }
1022
+ },
1023
+ "additionalProperties": false
1024
+ },
1025
+ "Size": {
1026
+ "description": "A whole number and a unit: B, KiB, MiB or GiB (KB, MB and GB are powers of 1,000).",
1027
+ "type": "string",
1028
+ "examples": [
1029
+ "512KiB",
1030
+ "2MiB"
1031
+ ],
1032
+ "pattern": "^\\s*[0-9]+(B|KiB|MiB|GiB|KB|MB|GB)\\s*$"
1033
+ },
1034
+ "Smtp": {
1035
+ "description": "The SMTP server, when `email.sender` is `smtp`. The password is `HYPHA_SMTP_PASSWORD`,\nnever here.",
1036
+ "type": "object",
1037
+ "properties": {
1038
+ "host": {
1039
+ "description": "The server's host name. `HYPHA_SMTP_HOST` wins.",
1040
+ "type": "string",
1041
+ "default": "localhost"
1042
+ },
1043
+ "port": {
1044
+ "description": "Its port: usually 587 with `starttls`, 465 with `tls`, 25 or 1025 (Mailpit) with\n`none`. `HYPHA_SMTP_PORT` wins.",
1045
+ "type": "integer",
1046
+ "format": "uint16",
1047
+ "default": 587,
1048
+ "maximum": 65535,
1049
+ "minimum": 0
1050
+ },
1051
+ "tls": {
1052
+ "description": "How the connection is encrypted. `HYPHA_SMTP_TLS` wins.",
1053
+ "$ref": "#/$defs/SmtpTls",
1054
+ "default": "starttls"
1055
+ },
1056
+ "username": {
1057
+ "description": "The login, if the server wants one; its password is `HYPHA_SMTP_PASSWORD`.",
1058
+ "type": [
1059
+ "string",
1060
+ "null"
1061
+ ]
1062
+ }
1063
+ },
1064
+ "additionalProperties": false
1065
+ },
1066
+ "SmtpTls": {
1067
+ "description": "How an SMTP connection is encrypted.",
1068
+ "oneOf": [
1069
+ {
1070
+ "description": "Plain text: a server on this machine or network (Mailpit) only.",
1071
+ "type": "string",
1072
+ "const": "none"
1073
+ },
1074
+ {
1075
+ "description": "Plain, then upgraded with STARTTLS, which is required (port 587).",
1076
+ "type": "string",
1077
+ "const": "starttls"
1078
+ },
1079
+ {
1080
+ "description": "TLS from the first byte (port 465).",
1081
+ "type": "string",
1082
+ "const": "tls"
1083
+ }
1084
+ ]
1085
+ },
1086
+ "Transforms": {
1087
+ "description": "How thumbnails are made.",
1088
+ "oneOf": [
1089
+ {
1090
+ "description": "No resizing: the thumbnail is the original.",
1091
+ "type": "string",
1092
+ "const": "none"
1093
+ },
1094
+ {
1095
+ "description": "Cloudflare Image Transformations on the media domain's zone.",
1096
+ "type": "string",
1097
+ "const": "cloudflare"
1098
+ }
1099
+ ]
1100
+ },
1101
+ "Webhooks": {
1102
+ "description": "When failed deliveries (webhooks and in-process handlers) are tried again.",
1103
+ "type": "object",
1104
+ "properties": {
1105
+ "give_up_after": {
1106
+ "description": "No attempt is planned more than this long after the first; then the delivery\nfails for good (and can be retried from the admin). At least the first wait, at\nmost 365 days.",
1107
+ "$ref": "#/$defs/Duration",
1108
+ "default": "3d"
1109
+ },
1110
+ "retry": {
1111
+ "description": "The waits after the first failures, in order (at most 20, each at most 365 days).",
1112
+ "type": "array",
1113
+ "default": [
1114
+ "1m",
1115
+ "5m",
1116
+ "30m",
1117
+ "2h",
1118
+ "6h"
1119
+ ],
1120
+ "items": {
1121
+ "$ref": "#/$defs/Duration"
1122
+ }
1123
+ },
1124
+ "retry_then_every": {
1125
+ "description": "The wait after each later failure. At most 365 days.",
1126
+ "$ref": "#/$defs/Duration",
1127
+ "default": "12h"
1128
+ }
1129
+ },
1130
+ "additionalProperties": false
1131
+ }
1132
+ }
1133
+ }