@farthershore/client 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +10 -2
- package/dist/index.js +221 -111
- package/dist/types/api.generated.d.ts +18 -38
- package/dist/types/credentials.d.ts +6 -2
- package/dist/types/envelope.d.ts +2 -0
- package/dist/types/errors.d.ts +13 -0
- package/dist/types/generated/schemas.d.ts +71 -28
- package/dist/types/helpers/refs.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/operations/agents.d.ts +9 -9
- package/dist/types/operations/agreements.d.ts +7 -7
- package/dist/types/operations/analytics.d.ts +5 -5
- package/dist/types/operations/audit-notifications.d.ts +6 -6
- package/dist/types/operations/auth.d.ts +4 -4
- package/dist/types/operations/backends.d.ts +8 -11
- package/dist/types/operations/billing.d.ts +3 -10
- package/dist/types/operations/businesses.d.ts +29 -30
- package/dist/types/operations/change-sets.d.ts +6 -6
- package/dist/types/operations/consumers.d.ts +13 -13
- package/dist/types/operations/define.d.ts +13 -3
- package/dist/types/operations/environments.d.ts +5 -4
- package/dist/types/operations/frontend.d.ts +2 -2
- package/dist/types/operations/index.d.ts +307 -220
- package/dist/types/operations/maker-tokens.d.ts +9 -9
- package/dist/types/operations/organizations.d.ts +19 -31
- package/dist/types/operations/personas.d.ts +8 -8
- package/dist/types/operations/plans-usage.d.ts +3 -3
- package/dist/types/operations/platform.d.ts +18 -18
- package/dist/types/operations/portal.d.ts +11 -11
- package/dist/types/operations/promo-codes.d.ts +15 -5
- package/dist/types/operations/variables.d.ts +22 -8
- package/dist/types/operations/webhooks.d.ts +107 -14
- package/dist/types/surface-types.d.ts +16 -10
- package/dist/types/types.d.ts +4 -1
- package/dist/types/version.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
// ../contracts/dist/platform-authorization.js
|
|
2
|
-
var PLATFORM_DEFAULT_ROLES = [
|
|
2
|
+
var PLATFORM_DEFAULT_ROLES = [
|
|
3
|
+
"owner",
|
|
4
|
+
"admin",
|
|
5
|
+
"member",
|
|
6
|
+
"subscriber"
|
|
7
|
+
];
|
|
3
8
|
function delegationAllowsMakerToken(delegation) {
|
|
4
9
|
return delegation === "maker_token";
|
|
5
10
|
}
|
|
6
|
-
var
|
|
11
|
+
var BUILDER_ROLES = ["owner", "admin", "member"];
|
|
12
|
+
var BUILDER_ROLES_AND_SUBSCRIBER = PLATFORM_DEFAULT_ROLES;
|
|
7
13
|
var OWNER_ADMIN = ["owner", "admin"];
|
|
8
14
|
var OWNER_ONLY = ["owner"];
|
|
9
15
|
var BUSINESS = ["business"];
|
|
@@ -44,7 +50,7 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
44
50
|
"auth_provider_connection:read": permission("auth_provider_connection:read", {
|
|
45
51
|
effect: "read",
|
|
46
52
|
allowedTargetKinds: BUSINESS,
|
|
47
|
-
defaultRoles:
|
|
53
|
+
defaultRoles: BUILDER_ROLES,
|
|
48
54
|
delegation: "browser_only"
|
|
49
55
|
}),
|
|
50
56
|
"auth_provider_connection:update": permission("auth_provider_connection:update", {
|
|
@@ -56,7 +62,7 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
56
62
|
"agent:read": permission("agent:read", {
|
|
57
63
|
effect: "read",
|
|
58
64
|
allowedTargetKinds: BUSINESS,
|
|
59
|
-
defaultRoles:
|
|
65
|
+
defaultRoles: BUILDER_ROLES,
|
|
60
66
|
delegation: "maker_token"
|
|
61
67
|
}),
|
|
62
68
|
"agreement:amend": permission("agreement:amend", {
|
|
@@ -74,19 +80,19 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
74
80
|
"agreement:read": permission("agreement:read", {
|
|
75
81
|
effect: "read",
|
|
76
82
|
allowedTargetKinds: BUSINESS,
|
|
77
|
-
defaultRoles:
|
|
83
|
+
defaultRoles: BUILDER_ROLES,
|
|
78
84
|
delegation: "maker_token"
|
|
79
85
|
}),
|
|
80
86
|
"analytics:read": permission("analytics:read", {
|
|
81
87
|
effect: "read",
|
|
82
88
|
allowedTargetKinds: BUSINESS,
|
|
83
|
-
defaultRoles:
|
|
89
|
+
defaultRoles: BUILDER_ROLES,
|
|
84
90
|
delegation: "maker_token"
|
|
85
91
|
}),
|
|
86
92
|
"apply_timeline:read": permission("apply_timeline:read", {
|
|
87
93
|
effect: "read",
|
|
88
94
|
allowedTargetKinds: BUSINESS,
|
|
89
|
-
defaultRoles:
|
|
95
|
+
defaultRoles: BUILDER_ROLES,
|
|
90
96
|
delegation: "maker_token"
|
|
91
97
|
}),
|
|
92
98
|
"audit_log:export": permission("audit_log:export", {
|
|
@@ -98,13 +104,13 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
98
104
|
"audit_log:read": permission("audit_log:read", {
|
|
99
105
|
effect: "read",
|
|
100
106
|
allowedTargetKinds: BUSINESS_OR_ORGANIZATION,
|
|
101
|
-
defaultRoles:
|
|
107
|
+
defaultRoles: BUILDER_ROLES,
|
|
102
108
|
delegation: "maker_token"
|
|
103
109
|
}),
|
|
104
110
|
"auth_context:read": permission("auth_context:read", {
|
|
105
111
|
effect: "read",
|
|
106
112
|
allowedTargetKinds: SELF,
|
|
107
|
-
defaultRoles:
|
|
113
|
+
defaultRoles: BUILDER_ROLES_AND_SUBSCRIBER,
|
|
108
114
|
delegation: "maker_token"
|
|
109
115
|
}),
|
|
110
116
|
"auth_context:issue": permission("auth_context:issue", {
|
|
@@ -128,7 +134,7 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
128
134
|
"automation_rule:read": permission("automation_rule:read", {
|
|
129
135
|
effect: "read",
|
|
130
136
|
allowedTargetKinds: BUSINESS,
|
|
131
|
-
defaultRoles:
|
|
137
|
+
defaultRoles: BUILDER_ROLES,
|
|
132
138
|
delegation: "maker_token"
|
|
133
139
|
}),
|
|
134
140
|
"automation_rule:update": permission("automation_rule:update", {
|
|
@@ -158,7 +164,7 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
158
164
|
"backend:read": permission("backend:read", {
|
|
159
165
|
effect: "read",
|
|
160
166
|
allowedTargetKinds: BUSINESS,
|
|
161
|
-
defaultRoles:
|
|
167
|
+
defaultRoles: BUILDER_ROLES,
|
|
162
168
|
delegation: "maker_token"
|
|
163
169
|
}),
|
|
164
170
|
"brand:update": permission("brand:update", {
|
|
@@ -176,7 +182,7 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
176
182
|
"bulletin:read": permission("bulletin:read", {
|
|
177
183
|
effect: "read",
|
|
178
184
|
allowedTargetKinds: BUSINESS,
|
|
179
|
-
defaultRoles:
|
|
185
|
+
defaultRoles: BUILDER_ROLES,
|
|
180
186
|
delegation: "maker_token"
|
|
181
187
|
}),
|
|
182
188
|
"bulletin:resolve": permission("bulletin:resolve", {
|
|
@@ -201,7 +207,8 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
201
207
|
effect: "write",
|
|
202
208
|
allowedTargetKinds: BUSINESS,
|
|
203
209
|
defaultRoles: OWNER_ADMIN,
|
|
204
|
-
|
|
210
|
+
humanOnly: true,
|
|
211
|
+
delegation: "browser_only"
|
|
205
212
|
}),
|
|
206
213
|
"business:docs_update": permission("business:docs_update", {
|
|
207
214
|
effect: "write",
|
|
@@ -238,7 +245,7 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
238
245
|
"business:read": permission("business:read", {
|
|
239
246
|
effect: "read",
|
|
240
247
|
allowedTargetKinds: BUSINESS_OR_ORGANIZATION,
|
|
241
|
-
defaultRoles:
|
|
248
|
+
defaultRoles: BUILDER_ROLES,
|
|
242
249
|
delegation: "maker_token"
|
|
243
250
|
}),
|
|
244
251
|
"business:rollback": permission("business:rollback", {
|
|
@@ -250,7 +257,7 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
250
257
|
"business_dependents:read": permission("business_dependents:read", {
|
|
251
258
|
effect: "read",
|
|
252
259
|
allowedTargetKinds: BUSINESS,
|
|
253
|
-
defaultRoles:
|
|
260
|
+
defaultRoles: BUILDER_ROLES,
|
|
254
261
|
delegation: "maker_token"
|
|
255
262
|
}),
|
|
256
263
|
"business_variable:create": permission("business_variable:create", {
|
|
@@ -268,13 +275,13 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
268
275
|
"business_variable:operation_read": permission("business_variable:operation_read", {
|
|
269
276
|
effect: "read",
|
|
270
277
|
allowedTargetKinds: BUSINESS,
|
|
271
|
-
defaultRoles:
|
|
278
|
+
defaultRoles: BUILDER_ROLES,
|
|
272
279
|
delegation: "maker_token"
|
|
273
280
|
}),
|
|
274
281
|
"business_variable:read": permission("business_variable:read", {
|
|
275
282
|
effect: "read",
|
|
276
283
|
allowedTargetKinds: BUSINESS,
|
|
277
|
-
defaultRoles:
|
|
284
|
+
defaultRoles: BUILDER_ROLES,
|
|
278
285
|
delegation: "maker_token"
|
|
279
286
|
}),
|
|
280
287
|
"business_variable:revoke": permission("business_variable:revoke", {
|
|
@@ -316,7 +323,7 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
316
323
|
"consumer:read": permission("consumer:read", {
|
|
317
324
|
effect: "read",
|
|
318
325
|
allowedTargetKinds: BUSINESS,
|
|
319
|
-
defaultRoles:
|
|
326
|
+
defaultRoles: BUILDER_ROLES,
|
|
320
327
|
delegation: "maker_token"
|
|
321
328
|
}),
|
|
322
329
|
"consumer:remove": permission("consumer:remove", {
|
|
@@ -334,7 +341,7 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
334
341
|
"denial:read": permission("denial:read", {
|
|
335
342
|
effect: "read",
|
|
336
343
|
allowedTargetKinds: BUSINESS,
|
|
337
|
-
defaultRoles:
|
|
344
|
+
defaultRoles: BUILDER_ROLES,
|
|
338
345
|
delegation: "maker_token"
|
|
339
346
|
}),
|
|
340
347
|
"environment:create": permission("environment:create", {
|
|
@@ -352,13 +359,13 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
352
359
|
"environment:read": permission("environment:read", {
|
|
353
360
|
effect: "read",
|
|
354
361
|
allowedTargetKinds: BUSINESS,
|
|
355
|
-
defaultRoles:
|
|
362
|
+
defaultRoles: BUILDER_ROLES,
|
|
356
363
|
delegation: "maker_token"
|
|
357
364
|
}),
|
|
358
365
|
"frontend:read": permission("frontend:read", {
|
|
359
366
|
effect: "read",
|
|
360
367
|
allowedTargetKinds: BUSINESS,
|
|
361
|
-
defaultRoles:
|
|
368
|
+
defaultRoles: BUILDER_ROLES,
|
|
362
369
|
delegation: "maker_token"
|
|
363
370
|
}),
|
|
364
371
|
"frontend:rollback": permission("frontend:rollback", {
|
|
@@ -394,7 +401,7 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
394
401
|
"knowledge:read": permission("knowledge:read", {
|
|
395
402
|
effect: "read",
|
|
396
403
|
allowedTargetKinds: BUSINESS_OR_SELF,
|
|
397
|
-
defaultRoles:
|
|
404
|
+
defaultRoles: BUILDER_ROLES,
|
|
398
405
|
delegation: "maker_token"
|
|
399
406
|
}),
|
|
400
407
|
"maker_token:create": permission("maker_token:create", {
|
|
@@ -430,13 +437,13 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
430
437
|
"notification:preferences_read": permission("notification:preferences_read", {
|
|
431
438
|
effect: "read",
|
|
432
439
|
allowedTargetKinds: BUSINESS,
|
|
433
|
-
defaultRoles:
|
|
440
|
+
defaultRoles: BUILDER_ROLES,
|
|
434
441
|
delegation: "user_session_only"
|
|
435
442
|
}),
|
|
436
443
|
"notification:preferences_update": permission("notification:preferences_update", {
|
|
437
444
|
effect: "write",
|
|
438
445
|
allowedTargetKinds: BUSINESS,
|
|
439
|
-
defaultRoles:
|
|
446
|
+
defaultRoles: BUILDER_ROLES,
|
|
440
447
|
delegation: "user_session_only"
|
|
441
448
|
}),
|
|
442
449
|
"organization:create": permission("organization:create", {
|
|
@@ -449,20 +456,21 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
449
456
|
effect: "write",
|
|
450
457
|
allowedTargetKinds: ORGANIZATION,
|
|
451
458
|
defaultRoles: OWNER_ONLY,
|
|
452
|
-
|
|
459
|
+
humanOnly: true,
|
|
460
|
+
delegation: "browser_only"
|
|
453
461
|
}),
|
|
454
|
-
//
|
|
455
|
-
// (`farthershore organization ownership-transfer`); a MakerToken never can.
|
|
462
|
+
// Ownership transfer requires a freshly verified person in the dashboard.
|
|
456
463
|
"organization:ownership_transfer": permission("organization:ownership_transfer", {
|
|
457
464
|
effect: "write",
|
|
458
465
|
allowedTargetKinds: ORGANIZATION,
|
|
459
466
|
defaultRoles: OWNER_ONLY,
|
|
460
|
-
|
|
467
|
+
humanOnly: true,
|
|
468
|
+
delegation: "browser_only"
|
|
461
469
|
}),
|
|
462
470
|
"organization:read": permission("organization:read", {
|
|
463
471
|
effect: "read",
|
|
464
472
|
allowedTargetKinds: ORGANIZATION_OR_SELF,
|
|
465
|
-
defaultRoles:
|
|
473
|
+
defaultRoles: BUILDER_ROLES_AND_SUBSCRIBER,
|
|
466
474
|
delegation: "maker_token"
|
|
467
475
|
}),
|
|
468
476
|
"organization:manage_billing": permission("organization:manage_billing", {
|
|
@@ -474,7 +482,7 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
474
482
|
"organization_role:read": permission("organization_role:read", {
|
|
475
483
|
effect: "read",
|
|
476
484
|
allowedTargetKinds: ORGANIZATION,
|
|
477
|
-
defaultRoles:
|
|
485
|
+
defaultRoles: BUILDER_ROLES,
|
|
478
486
|
delegation: "user_session_only"
|
|
479
487
|
}),
|
|
480
488
|
"organization_role:create": permission("organization_role:create", {
|
|
@@ -498,13 +506,13 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
498
506
|
"organization_bulletin:read": permission("organization_bulletin:read", {
|
|
499
507
|
effect: "read",
|
|
500
508
|
allowedTargetKinds: ORGANIZATION,
|
|
501
|
-
defaultRoles:
|
|
509
|
+
defaultRoles: BUILDER_ROLES,
|
|
502
510
|
delegation: "maker_token"
|
|
503
511
|
}),
|
|
504
512
|
"organization_invitation:accept": permission("organization_invitation:accept", {
|
|
505
513
|
effect: "write",
|
|
506
514
|
allowedTargetKinds: SELF,
|
|
507
|
-
defaultRoles:
|
|
515
|
+
defaultRoles: BUILDER_ROLES_AND_SUBSCRIBER,
|
|
508
516
|
delegation: "user_session_only"
|
|
509
517
|
}),
|
|
510
518
|
"organization_invitation:create": permission("organization_invitation:create", {
|
|
@@ -519,7 +527,7 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
519
527
|
// `organization` — the org's outstanding SENT invitations
|
|
520
528
|
// (GET /builder/organizations/:orgId/invitations, team-tab redesign).
|
|
521
529
|
allowedTargetKinds: ORGANIZATION_OR_SELF,
|
|
522
|
-
defaultRoles:
|
|
530
|
+
defaultRoles: BUILDER_ROLES,
|
|
523
531
|
delegation: "user_session_only"
|
|
524
532
|
}),
|
|
525
533
|
"organization_invitation:revoke": permission("organization_invitation:revoke", {
|
|
@@ -531,16 +539,18 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
531
539
|
"organization_member:list": permission("organization_member:list", {
|
|
532
540
|
effect: "read",
|
|
533
541
|
allowedTargetKinds: ORGANIZATION,
|
|
534
|
-
defaultRoles:
|
|
542
|
+
defaultRoles: BUILDER_ROLES,
|
|
535
543
|
delegation: "user_session_only"
|
|
536
544
|
}),
|
|
537
545
|
"organization_member:remove": permission("organization_member:remove", {
|
|
546
|
+
humanOnlyWhen: "target_owner",
|
|
538
547
|
effect: "write",
|
|
539
548
|
allowedTargetKinds: ORGANIZATION,
|
|
540
549
|
defaultRoles: OWNER_ADMIN,
|
|
541
550
|
delegation: "user_session_only"
|
|
542
551
|
}),
|
|
543
552
|
"organization_member:update": permission("organization_member:update", {
|
|
553
|
+
humanOnlyWhen: "target_owner",
|
|
544
554
|
effect: "write",
|
|
545
555
|
allowedTargetKinds: ORGANIZATION,
|
|
546
556
|
defaultRoles: OWNER_ADMIN,
|
|
@@ -555,7 +565,7 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
555
565
|
"persona:read": permission("persona:read", {
|
|
556
566
|
effect: "read",
|
|
557
567
|
allowedTargetKinds: BUSINESS,
|
|
558
|
-
defaultRoles:
|
|
568
|
+
defaultRoles: BUILDER_ROLES,
|
|
559
569
|
delegation: "maker_token"
|
|
560
570
|
}),
|
|
561
571
|
"persona:revoke": permission("persona:revoke", {
|
|
@@ -573,7 +583,7 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
573
583
|
"plan:read": permission("plan:read", {
|
|
574
584
|
effect: "read",
|
|
575
585
|
allowedTargetKinds: BUSINESS,
|
|
576
|
-
defaultRoles:
|
|
586
|
+
defaultRoles: BUILDER_ROLES,
|
|
577
587
|
delegation: "maker_token"
|
|
578
588
|
}),
|
|
579
589
|
// Subscriber-RBAC R1 — subscribing the ORG to an external product commits
|
|
@@ -617,7 +627,7 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
617
627
|
"promo_code:read": permission("promo_code:read", {
|
|
618
628
|
effect: "read",
|
|
619
629
|
allowedTargetKinds: BUSINESS,
|
|
620
|
-
defaultRoles:
|
|
630
|
+
defaultRoles: BUILDER_ROLES,
|
|
621
631
|
delegation: "maker_token"
|
|
622
632
|
}),
|
|
623
633
|
"promo_code:update": permission("promo_code:update", {
|
|
@@ -629,7 +639,7 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
629
639
|
"rbac:read": permission("rbac:read", {
|
|
630
640
|
effect: "read",
|
|
631
641
|
allowedTargetKinds: BUSINESS,
|
|
632
|
-
defaultRoles:
|
|
642
|
+
defaultRoles: BUILDER_ROLES,
|
|
633
643
|
delegation: "maker_token"
|
|
634
644
|
}),
|
|
635
645
|
"resource_count:report": permission("resource_count:report", {
|
|
@@ -647,7 +657,7 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
647
657
|
"runtime_token:read": permission("runtime_token:read", {
|
|
648
658
|
effect: "read",
|
|
649
659
|
allowedTargetKinds: BUSINESS,
|
|
650
|
-
defaultRoles:
|
|
660
|
+
defaultRoles: BUILDER_ROLES,
|
|
651
661
|
delegation: "maker_token"
|
|
652
662
|
}),
|
|
653
663
|
"runtime_token:revoke": permission("runtime_token:revoke", {
|
|
@@ -662,21 +672,34 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
662
672
|
defaultRoles: OWNER_ADMIN,
|
|
663
673
|
delegation: "maker_token"
|
|
664
674
|
}),
|
|
675
|
+
// Permanently closing (deleting) a Stripe Connect account — the org default
|
|
676
|
+
// or a business override — is an irreversible, money-adjacent decision kept
|
|
677
|
+
// for a signed-in human owner in the dashboard: no CLI session, no MCP tool,
|
|
678
|
+
// no MakerToken. A deliberate exception to CLI/MCP authz parity, declared
|
|
679
|
+
// unavailable on the `stripe_connection.close` operation.
|
|
680
|
+
"stripe_connection:close": permission("stripe_connection:close", {
|
|
681
|
+
effect: "write",
|
|
682
|
+
allowedTargetKinds: ORGANIZATION,
|
|
683
|
+
defaultRoles: OWNER_ONLY,
|
|
684
|
+
humanOnly: true,
|
|
685
|
+
delegation: "browser_only"
|
|
686
|
+
}),
|
|
665
687
|
"stripe_connection:create": permission("stripe_connection:create", {
|
|
666
688
|
effect: "write",
|
|
667
689
|
allowedTargetKinds: ORGANIZATION,
|
|
668
690
|
defaultRoles: OWNER_ONLY,
|
|
691
|
+
humanOnly: true,
|
|
669
692
|
delegation: "browser_only"
|
|
670
693
|
}),
|
|
671
694
|
// Connecting Stripe is a browser-only OAuth/onboarding handshake, but reading
|
|
672
|
-
//
|
|
673
|
-
//
|
|
674
|
-
// status|disconnect`). Neither is delegable to a MakerToken.
|
|
695
|
+
// Connection status can be read by a signed-in CLI session. Disconnecting
|
|
696
|
+
// requires a freshly verified person in the dashboard.
|
|
675
697
|
"stripe_connection:delete": permission("stripe_connection:delete", {
|
|
676
698
|
effect: "write",
|
|
677
699
|
allowedTargetKinds: ORGANIZATION,
|
|
678
700
|
defaultRoles: OWNER_ONLY,
|
|
679
|
-
|
|
701
|
+
humanOnly: true,
|
|
702
|
+
delegation: "browser_only"
|
|
680
703
|
}),
|
|
681
704
|
"stripe_connection:read": permission("stripe_connection:read", {
|
|
682
705
|
effect: "read",
|
|
@@ -687,7 +710,7 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
687
710
|
"tax_settings:read": permission("tax_settings:read", {
|
|
688
711
|
effect: "read",
|
|
689
712
|
allowedTargetKinds: BUSINESS,
|
|
690
|
-
defaultRoles:
|
|
713
|
+
defaultRoles: BUILDER_ROLES,
|
|
691
714
|
delegation: "maker_token"
|
|
692
715
|
}),
|
|
693
716
|
"tax_settings:update": permission("tax_settings:update", {
|
|
@@ -699,7 +722,7 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
699
722
|
"usage:read": permission("usage:read", {
|
|
700
723
|
effect: "read",
|
|
701
724
|
allowedTargetKinds: BUSINESS,
|
|
702
|
-
defaultRoles:
|
|
725
|
+
defaultRoles: BUILDER_ROLES,
|
|
703
726
|
delegation: "maker_token"
|
|
704
727
|
}),
|
|
705
728
|
"webhook:create": permission("webhook:create", {
|
|
@@ -714,16 +737,22 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
714
737
|
defaultRoles: OWNER_ADMIN,
|
|
715
738
|
delegation: "maker_token"
|
|
716
739
|
}),
|
|
740
|
+
"webhook:delivery_payload_read": permission("webhook:delivery_payload_read", {
|
|
741
|
+
effect: "read",
|
|
742
|
+
allowedTargetKinds: BUSINESS,
|
|
743
|
+
defaultRoles: OWNER_ADMIN,
|
|
744
|
+
delegation: "user_session_only"
|
|
745
|
+
}),
|
|
717
746
|
"webhook:delivery_read": permission("webhook:delivery_read", {
|
|
718
747
|
effect: "read",
|
|
719
748
|
allowedTargetKinds: BUSINESS,
|
|
720
|
-
defaultRoles:
|
|
749
|
+
defaultRoles: BUILDER_ROLES,
|
|
721
750
|
delegation: "maker_token"
|
|
722
751
|
}),
|
|
723
752
|
"webhook:read": permission("webhook:read", {
|
|
724
753
|
effect: "read",
|
|
725
754
|
allowedTargetKinds: BUSINESS,
|
|
726
|
-
defaultRoles:
|
|
755
|
+
defaultRoles: BUILDER_ROLES,
|
|
727
756
|
delegation: "maker_token"
|
|
728
757
|
}),
|
|
729
758
|
"webhook:test": permission("webhook:test", {
|
|
@@ -765,6 +794,9 @@ function validatePlatformPermissionCatalog() {
|
|
|
765
794
|
if (metadata.defaultRoles.length === 0) {
|
|
766
795
|
throw new Error(`Platform permission has no default role: ${permission2}`);
|
|
767
796
|
}
|
|
797
|
+
if (metadata.defaultRoles.includes("subscriber") && metadata.allowedTargetKinds.includes("business")) {
|
|
798
|
+
throw new Error(`The subscriber role must hold no business-targeting permission: ${permission2}`);
|
|
799
|
+
}
|
|
768
800
|
}
|
|
769
801
|
}
|
|
770
802
|
validatePlatformPermissionCatalog();
|
|
@@ -1056,6 +1088,11 @@ var PLATFORM_OPERATION_DEFINITIONS = [
|
|
|
1056
1088
|
{ key: "bulletin.read", class: "operate", domain: "agents" },
|
|
1057
1089
|
{ key: "bulletin.ack", class: "operate", domain: "agents" },
|
|
1058
1090
|
{ key: "bulletin.resolve", class: "operate", domain: "agents" },
|
|
1091
|
+
{
|
|
1092
|
+
key: "webhook.delivery.payload.read",
|
|
1093
|
+
class: "operate",
|
|
1094
|
+
domain: WEBHOOKS_DOMAIN
|
|
1095
|
+
},
|
|
1059
1096
|
{ key: "webhook.delivery.read", class: "operate", domain: WEBHOOKS_DOMAIN },
|
|
1060
1097
|
{ key: "promo_code.read", class: "operate", domain: PROMO_CODES_DOMAIN },
|
|
1061
1098
|
{ key: "promo_code.create", class: "operate", domain: PROMO_CODES_DOMAIN },
|
|
@@ -1506,8 +1543,7 @@ var PLATFORM_OPERATION_DEFINITIONS = [
|
|
|
1506
1543
|
})),
|
|
1507
1544
|
// Connecting Stripe is a browser-only OAuth/onboarding handshake with Stripe
|
|
1508
1545
|
// (credential administration). Reading the connection and disconnecting a
|
|
1509
|
-
// per-business override
|
|
1510
|
-
// `farthershore stripe status|disconnect`.
|
|
1546
|
+
// per-business override have distinct read and human-only permissions.
|
|
1511
1547
|
{
|
|
1512
1548
|
key: "stripe_connection.create",
|
|
1513
1549
|
class: "operate",
|
|
@@ -1517,6 +1553,28 @@ var PLATFORM_OPERATION_DEFINITIONS = [
|
|
|
1517
1553
|
detail: "Connect Stripe from the signed-in dashboard (Connections or the business's Billing tab). The Stripe onboarding handshake is browser-only; check the result with `farthershore stripe status <business>`."
|
|
1518
1554
|
}
|
|
1519
1555
|
},
|
|
1556
|
+
{
|
|
1557
|
+
key: "stripe_connection.payout.update",
|
|
1558
|
+
class: "operate",
|
|
1559
|
+
domain: "billing",
|
|
1560
|
+
unavailable: {
|
|
1561
|
+
reason: "credential_administration",
|
|
1562
|
+
detail: "Change the payout account in the dashboard after signing in again and typing the organization name."
|
|
1563
|
+
}
|
|
1564
|
+
},
|
|
1565
|
+
// Closing (permanently deleting) a Stripe Connect account is browser-only by
|
|
1566
|
+
// product decision: the dashboard owner danger zone is the only surface. The
|
|
1567
|
+
// Disconnection (`stripe_connection.delete`) also requires a person in the
|
|
1568
|
+
// dashboard, even though it deletes nothing at Stripe.
|
|
1569
|
+
{
|
|
1570
|
+
key: "stripe_connection.close",
|
|
1571
|
+
class: "operate",
|
|
1572
|
+
domain: "billing",
|
|
1573
|
+
unavailable: {
|
|
1574
|
+
reason: "credential_administration",
|
|
1575
|
+
detail: "Close or disconnect a Stripe account from the signed-in dashboard after signing in again and typing the name. Closing is permanent."
|
|
1576
|
+
}
|
|
1577
|
+
},
|
|
1520
1578
|
...["read", "delete"].map((action) => ({
|
|
1521
1579
|
key: `stripe_connection.${action}`,
|
|
1522
1580
|
class: "operate",
|
|
@@ -1617,6 +1675,14 @@ var AGENT_OPERATION_AUTHORIZATIONS = {
|
|
|
1617
1675
|
permission: "git_connection:update",
|
|
1618
1676
|
targetKind: "organization"
|
|
1619
1677
|
},
|
|
1678
|
+
"stripe_connection.payout.update": {
|
|
1679
|
+
permission: "stripe_connection:create",
|
|
1680
|
+
targetKind: "organization"
|
|
1681
|
+
},
|
|
1682
|
+
"stripe_connection.close": {
|
|
1683
|
+
permission: "stripe_connection:close",
|
|
1684
|
+
targetKind: "organization"
|
|
1685
|
+
},
|
|
1620
1686
|
"stripe_connection.create": {
|
|
1621
1687
|
permission: "stripe_connection:create",
|
|
1622
1688
|
targetKind: "organization"
|
|
@@ -2050,6 +2116,10 @@ var AGENT_OPERATION_AUTHORIZATIONS = {
|
|
|
2050
2116
|
},
|
|
2051
2117
|
"webhook.create": { permission: "webhook:create", targetKind: "business" },
|
|
2052
2118
|
"webhook.delete": { permission: "webhook:delete", targetKind: "business" },
|
|
2119
|
+
"webhook.delivery.payload.read": {
|
|
2120
|
+
permission: "webhook:delivery_payload_read",
|
|
2121
|
+
targetKind: "business"
|
|
2122
|
+
},
|
|
2053
2123
|
"webhook.delivery.read": {
|
|
2054
2124
|
permission: "webhook:delivery_read",
|
|
2055
2125
|
targetKind: "business"
|
|
@@ -2206,7 +2276,7 @@ function validatePlatformOperationCatalog(operations) {
|
|
|
2206
2276
|
if (operation2.agentVisibility === "excluded") {
|
|
2207
2277
|
const core = AGENT_OPERATION_AUTHORIZATIONS[operation2.key];
|
|
2208
2278
|
const validBoundary = operation2.unavailable !== void 0 && EXCLUDED_AGENT_REASONS.has(operation2.unavailable.reason);
|
|
2209
|
-
const validEligibility = operation2.unavailable === void 0 && core !== void 0 && core.permission !== LOCAL_REPOSITORY_WRITE_PERMISSION && PLATFORM_PERMISSION_CATALOG[core.permission].delegation === "browser_only";
|
|
2279
|
+
const validEligibility = operation2.unavailable === void 0 && core !== void 0 && core.permission !== LOCAL_REPOSITORY_WRITE_PERMISSION && (PLATFORM_PERMISSION_CATALOG[core.permission].delegation === "browser_only" || isHumanOnlyOperation(operation2.key));
|
|
2210
2280
|
if (operation2.authorization !== void 0 || !validBoundary && !validEligibility) {
|
|
2211
2281
|
throw new Error(`Excluded operation ${operation2.key} has an invalid agent visibility binding`);
|
|
2212
2282
|
}
|
|
@@ -2231,7 +2301,7 @@ var PLATFORM_OPERATIONS = PLATFORM_OPERATION_DEFINITIONS.map((operation2) => {
|
|
|
2231
2301
|
};
|
|
2232
2302
|
}
|
|
2233
2303
|
const core = AGENT_OPERATION_AUTHORIZATIONS[operation2.key];
|
|
2234
|
-
const excludedByPrincipalEligibility = core !== void 0 && core.permission !== LOCAL_REPOSITORY_WRITE_PERMISSION && PLATFORM_PERMISSION_CATALOG[core.permission].delegation === "browser_only";
|
|
2304
|
+
const excludedByPrincipalEligibility = core !== void 0 && core.permission !== LOCAL_REPOSITORY_WRITE_PERMISSION && (PLATFORM_PERMISSION_CATALOG[core.permission].delegation === "browser_only" || isHumanOnlyOperation(operation2.key));
|
|
2235
2305
|
if (excludedByPrincipalEligibility) {
|
|
2236
2306
|
return {
|
|
2237
2307
|
...operation2,
|
|
@@ -2262,6 +2332,13 @@ for (const key of Object.keys(AGENT_OPERATION_AUTHORIZATIONS)) {
|
|
|
2262
2332
|
throw new Error(`Authorization binding references unknown operation: ${key}`);
|
|
2263
2333
|
}
|
|
2264
2334
|
}
|
|
2335
|
+
function operationAuthorizationFor(key) {
|
|
2336
|
+
return AGENT_OPERATION_AUTHORIZATIONS[key];
|
|
2337
|
+
}
|
|
2338
|
+
function isHumanOnlyOperation(key) {
|
|
2339
|
+
const permission2 = operationAuthorizationFor(key)?.permission;
|
|
2340
|
+
return permission2 !== void 0 && permission2 !== LOCAL_REPOSITORY_WRITE_PERMISSION && PLATFORM_PERMISSION_CATALOG[permission2].humanOnly === true;
|
|
2341
|
+
}
|
|
2265
2342
|
|
|
2266
2343
|
// ../contracts/dist/operation-spec.js
|
|
2267
2344
|
var SPECS = {
|
|
@@ -2374,8 +2451,8 @@ var SPECS = {
|
|
|
2374
2451
|
},
|
|
2375
2452
|
// DECISION: NEITHER side → destructive. Rollbacks are destructive: they replace the live release customers are served.
|
|
2376
2453
|
"business.rollback": {
|
|
2377
|
-
summary: "Roll back a prior business publish
|
|
2378
|
-
description: "Roll back a prior business publish
|
|
2454
|
+
summary: "Roll back a prior business publish",
|
|
2455
|
+
description: "Roll back a prior business publish. Pass the prior publish id as publishId; the receipt returns rollbackPublishId for the new rollback.",
|
|
2379
2456
|
destructive: true,
|
|
2380
2457
|
oneTimeSecret: false,
|
|
2381
2458
|
preview: false,
|
|
@@ -2477,7 +2554,7 @@ var SPECS = {
|
|
|
2477
2554
|
},
|
|
2478
2555
|
"environment.create": {
|
|
2479
2556
|
summary: "Create a preview environment bound to a git branch",
|
|
2480
|
-
description: "Create a preview environment
|
|
2557
|
+
description: "Create a preview environment from its env/NAME branch. The environment name is derived from the branch; names are lowercase slugs of at most 63 characters.",
|
|
2481
2558
|
destructive: false,
|
|
2482
2559
|
oneTimeSecret: false,
|
|
2483
2560
|
preview: false,
|
|
@@ -2634,10 +2711,12 @@ var SPECS = {
|
|
|
2634
2711
|
// webhook list and delete it; deliveries need the id it never received.
|
|
2635
2712
|
reconcile: { op: "webhook.read" }
|
|
2636
2713
|
},
|
|
2637
|
-
// DECISION: NEITHER side → destructive (+ oneTimeSecret, already declared).
|
|
2714
|
+
// DECISION: NEITHER side → destructive (+ oneTimeSecret, already declared).
|
|
2715
|
+
// Rotation returns a new secret once. Readable retired secrets get a 24h
|
|
2716
|
+
// dual-sign window; unreadable ones are dropped immediately.
|
|
2638
2717
|
"webhook.rotate_secret": {
|
|
2639
|
-
summary: "Issue a new signing secret (returned once);
|
|
2640
|
-
description: "Issue a replacement signing secret for a webhook endpoint. Returns the new secret once
|
|
2718
|
+
summary: "Issue a new signing secret (returned once); readable old secrets verify for 24h",
|
|
2719
|
+
description: "Issue a replacement signing secret for a webhook endpoint. Returns the new secret once. When the old secret is readable, deliveries carry both signatures for 24 hours. Repairing an unreadable old secret drops it immediately and returns previousSecretExpiresAt: null; install the new secret before deliveries can verify.",
|
|
2641
2720
|
destructive: true,
|
|
2642
2721
|
oneTimeSecret: true,
|
|
2643
2722
|
preview: false,
|
|
@@ -2650,9 +2729,16 @@ var SPECS = {
|
|
|
2650
2729
|
oneTimeSecret: false,
|
|
2651
2730
|
preview: false
|
|
2652
2731
|
},
|
|
2732
|
+
"webhook.delivery.payload.read": {
|
|
2733
|
+
summary: "Read a webhook delivery payload and response",
|
|
2734
|
+
description: "Read the exact webhook event envelope and the last response diagnostic. Requires webhook:delivery_payload_read, available to owner and admin user sessions only. Response diagnostics are capped at 4096 characters; unreachable endpoints get a plain-language reason that never names a host or IP.",
|
|
2735
|
+
destructive: false,
|
|
2736
|
+
oneTimeSecret: false,
|
|
2737
|
+
preview: false
|
|
2738
|
+
},
|
|
2653
2739
|
"webhook.delivery.read": {
|
|
2654
2740
|
summary: "List recent delivery attempts for a webhook endpoint",
|
|
2655
|
-
description: "List recent delivery attempts for a webhook endpoint.
|
|
2741
|
+
description: "List recent delivery attempts for a webhook endpoint. Lists omit payloads and response bodies. Single-delivery reads include them only with webhook:delivery_payload_read.",
|
|
2656
2742
|
destructive: false,
|
|
2657
2743
|
oneTimeSecret: false,
|
|
2658
2744
|
preview: false,
|
|
@@ -2850,7 +2936,7 @@ var SPECS = {
|
|
|
2850
2936
|
},
|
|
2851
2937
|
"business_variable.read": {
|
|
2852
2938
|
summary: "List variables: FS_PUBLIC_* values, secret metadata only",
|
|
2853
|
-
description: "Lists variables. Returns readable FS_PUBLIC_* values; every other variable is a write-only secret and only its lifecycle metadata is returned.",
|
|
2939
|
+
description: "Lists variables. Returns readable FS_PUBLIC_* values; every other variable is a write-only secret and only its lifecycle metadata is returned. Each entry includes its business or environment scope and source environmentId.",
|
|
2854
2940
|
destructive: false,
|
|
2855
2941
|
oneTimeSecret: false,
|
|
2856
2942
|
preview: false
|
|
@@ -3663,6 +3749,7 @@ var STREAMING_EXEMPT_CONTENT_TYPE_SET = new Set(STREAMING_EXEMPT_CONTENT_TYPES);
|
|
|
3663
3749
|
|
|
3664
3750
|
// ../contracts/dist/error-codes.js
|
|
3665
3751
|
var ERROR_CODES = {
|
|
3752
|
+
HUMAN_ONLY_ACTION: "HUMAN_ONLY_ACTION",
|
|
3666
3753
|
// --- Generic / cross-cutting ---------------------------------------
|
|
3667
3754
|
VALIDATION_ERROR: "VALIDATION_ERROR",
|
|
3668
3755
|
CONFLICT: "CONFLICT",
|
|
@@ -3710,6 +3797,7 @@ var ERROR_CODES = {
|
|
|
3710
3797
|
ORGANIZATION_NOT_FOUND: "ORGANIZATION_NOT_FOUND",
|
|
3711
3798
|
ORG_HAS_ACTIVE_SUBSCRIPTIONS: "ORG_HAS_ACTIVE_SUBSCRIPTIONS",
|
|
3712
3799
|
ORGANIZATION_HAS_PAID_SUBSCRIBERS: "ORGANIZATION_HAS_PAID_SUBSCRIBERS",
|
|
3800
|
+
BILLING_AUTHORITY_RECONCILIATION_REQUIRED: "BILLING_AUTHORITY_RECONCILIATION_REQUIRED",
|
|
3713
3801
|
BUSINESS_HAS_PAID_SUBSCRIBERS: "BUSINESS_HAS_PAID_SUBSCRIBERS",
|
|
3714
3802
|
// PR-H: returned with HTTP 409 from DELETE /builder/organizations/:orgId
|
|
3715
3803
|
// (and the defense-in-depth Clerk-deletion guard) when the org still has
|
|
@@ -3743,6 +3831,7 @@ var ERROR_CODES = {
|
|
|
3743
3831
|
/** The owner role always holds every permission — it can never be edited,
|
|
3744
3832
|
* reduced, or deleted, on either the builder or subscriber plane. */
|
|
3745
3833
|
OWNER_ROLE_IMMUTABLE: "OWNER_ROLE_IMMUTABLE",
|
|
3834
|
+
SUBSCRIBER_ROLE_IMMUTABLE: "SUBSCRIBER_ROLE_IMMUTABLE",
|
|
3746
3835
|
/** Floor→rows: the seeded account-role rows (`account_admin` /
|
|
3747
3836
|
* `account_member`) replace the fixed bundles. They cannot be created,
|
|
3748
3837
|
* deleted, renamed, or referenced from assignments/defaultRoleKey — and
|
|
@@ -3877,6 +3966,11 @@ var ERROR_CODES = {
|
|
|
3877
3966
|
// someone connects Stripe, so "try again shortly" is never true here.
|
|
3878
3967
|
STRIPE_NOT_CONNECTED: "STRIPE_NOT_CONNECTED",
|
|
3879
3968
|
STRIPE_BALANCE_OUTSTANDING: "STRIPE_BALANCE_OUTSTANDING",
|
|
3969
|
+
// POST /builder/stripe/close (409): the Connect account cannot be closed
|
|
3970
|
+
// yet. `details.blockers` names every reason found — money-bearing
|
|
3971
|
+
// subscriptions, a non-zero Stripe balance, open disputes — so the
|
|
3972
|
+
// dashboard can explain all of them at once.
|
|
3973
|
+
STRIPE_ACCOUNT_CLOSE_BLOCKED: "STRIPE_ACCOUNT_CLOSE_BLOCKED",
|
|
3880
3974
|
// A Stripe API call the route depended on failed (e.g. balance
|
|
3881
3975
|
// retrieve or account delete during product disconnect). The human
|
|
3882
3976
|
// `message` carries the upstream Stripe error text; the route blocks
|
|
@@ -4003,7 +4097,7 @@ var RUNTIME_ERROR_CODE_TO_ERROR_CODE = {
|
|
|
4003
4097
|
var RUNTIME_ERROR_CODE_VALUES = Object.values(RUNTIME_ERROR_CODES);
|
|
4004
4098
|
function paidSubscriberDeletionMessage(code) {
|
|
4005
4099
|
if (code === ERROR_CODES.BUSINESS_HAS_PAID_SUBSCRIBERS) {
|
|
4006
|
-
return "Cancel or migrate
|
|
4100
|
+
return "Cancel or migrate paid subscriptions and resolve remaining purchased or promotional credit, including credit held by archived customers, before deleting this business.";
|
|
4007
4101
|
}
|
|
4008
4102
|
if (code === ERROR_CODES.ORGANIZATION_HAS_PAID_SUBSCRIBERS) {
|
|
4009
4103
|
return "Cancel or migrate the paid subscribers of every business in this organization before deleting it.";
|
|
@@ -4011,6 +4105,17 @@ function paidSubscriberDeletionMessage(code) {
|
|
|
4011
4105
|
return void 0;
|
|
4012
4106
|
}
|
|
4013
4107
|
|
|
4108
|
+
// ../contracts/dist/request-id.js
|
|
4109
|
+
var REQUEST_ID_HEADER = "x-request-id";
|
|
4110
|
+
var MAX_REQUEST_ID_LENGTH = 128;
|
|
4111
|
+
var REQUEST_ID_PATTERN = /^[A-Za-z0-9._:-]+$/;
|
|
4112
|
+
function isValidRequestId(value) {
|
|
4113
|
+
return typeof value === "string" && value.length > 0 && value.length <= MAX_REQUEST_ID_LENGTH && REQUEST_ID_PATTERN.test(value);
|
|
4114
|
+
}
|
|
4115
|
+
function adoptableRequestId(value) {
|
|
4116
|
+
return isValidRequestId(value) ? value : null;
|
|
4117
|
+
}
|
|
4118
|
+
|
|
4014
4119
|
// src/errors.ts
|
|
4015
4120
|
var FartherShoreError = class extends Error {
|
|
4016
4121
|
constructor(message, status, extra) {
|
|
@@ -4026,6 +4131,7 @@ var FartherShoreError = class extends Error {
|
|
|
4026
4131
|
this.retryable = extra?.retryable;
|
|
4027
4132
|
this.retryDisposition = extra?.retryDisposition;
|
|
4028
4133
|
this.outcomeUnknown = extra?.outcomeUnknown;
|
|
4134
|
+
this.requestId = adoptableRequestId(extra?.requestId) ?? adoptableRequestId(extra?.headers?.get?.(REQUEST_ID_HEADER)) ?? void 0;
|
|
4029
4135
|
if (extra?.headers !== void 0)
|
|
4030
4136
|
Object.defineProperty(this, "headers", {
|
|
4031
4137
|
value: extra.headers,
|
|
@@ -4048,6 +4154,12 @@ var FartherShoreError = class extends Error {
|
|
|
4048
4154
|
* the client never repeats such a write on its own.
|
|
4049
4155
|
*/
|
|
4050
4156
|
outcomeUnknown;
|
|
4157
|
+
/**
|
|
4158
|
+
* The id the server logged the failed request under — quote it when
|
|
4159
|
+
* reporting the failure. From the error envelope, else a valid
|
|
4160
|
+
* `x-request-id` response header; absent when no answer arrived.
|
|
4161
|
+
*/
|
|
4162
|
+
requestId;
|
|
4051
4163
|
/** Plain data (no `cause`, no stack) — safe to serialize and log. */
|
|
4052
4164
|
toJSON() {
|
|
4053
4165
|
const json = {
|
|
@@ -4063,6 +4175,7 @@ var FartherShoreError = class extends Error {
|
|
|
4063
4175
|
json.retryDisposition = this.retryDisposition;
|
|
4064
4176
|
if (this.outcomeUnknown !== void 0)
|
|
4065
4177
|
json.outcomeUnknown = this.outcomeUnknown;
|
|
4178
|
+
if (this.requestId !== void 0) json.requestId = this.requestId;
|
|
4066
4179
|
return json;
|
|
4067
4180
|
}
|
|
4068
4181
|
};
|
|
@@ -4083,9 +4196,18 @@ var FartherShoreTransportError = class extends FartherShoreError {
|
|
|
4083
4196
|
|
|
4084
4197
|
// src/operations/define.ts
|
|
4085
4198
|
function operation(entry) {
|
|
4086
|
-
return entry;
|
|
4199
|
+
return { ...entry, preview: false };
|
|
4200
|
+
}
|
|
4201
|
+
function previewOperation(entry) {
|
|
4202
|
+
return { ...entry, preview: true };
|
|
4087
4203
|
}
|
|
4088
4204
|
function seg(value) {
|
|
4205
|
+
if (typeof value !== "string" || value === "" || value === "." || value === "..")
|
|
4206
|
+
throw new FartherShoreError(
|
|
4207
|
+
'A path parameter must be a non-empty string other than "." or "..".',
|
|
4208
|
+
400,
|
|
4209
|
+
{ code: "INVALID_INPUT" }
|
|
4210
|
+
);
|
|
4089
4211
|
return encodeURIComponent(value);
|
|
4090
4212
|
}
|
|
4091
4213
|
function withQuery(path, params) {
|
|
@@ -4419,11 +4541,11 @@ var backendOperations = {
|
|
|
4419
4541
|
})
|
|
4420
4542
|
)
|
|
4421
4543
|
}),
|
|
4422
|
-
"backends.create":
|
|
4544
|
+
"backends.create": previewOperation({
|
|
4423
4545
|
op: "backend.create",
|
|
4424
4546
|
run: (ctx, { businessId, ...data }) => send(ctx, "POST", backends(businessId), data)
|
|
4425
4547
|
}),
|
|
4426
|
-
"backends.bind":
|
|
4548
|
+
"backends.bind": previewOperation({
|
|
4427
4549
|
op: "backend.bind",
|
|
4428
4550
|
run: (ctx, { businessId, backend, ...data }) => send(ctx, "PATCH", `${backends(businessId)}/${seg(backend)}`, data)
|
|
4429
4551
|
}),
|
|
@@ -4467,17 +4589,6 @@ var billingOperations = {
|
|
|
4467
4589
|
`/businesses/${seg(businessId)}/stripe/status`
|
|
4468
4590
|
)
|
|
4469
4591
|
}),
|
|
4470
|
-
"billing.stripe.delete": operation({
|
|
4471
|
-
op: "stripe_connection.delete",
|
|
4472
|
-
run: (ctx, { businessId, deleteAccount }) => send(
|
|
4473
|
-
ctx,
|
|
4474
|
-
"POST",
|
|
4475
|
-
`/businesses/${seg(businessId)}/stripe/disconnect`,
|
|
4476
|
-
{
|
|
4477
|
-
deleteAccount: deleteAccount === true
|
|
4478
|
-
}
|
|
4479
|
-
)
|
|
4480
|
-
}),
|
|
4481
4592
|
"billing.taxSettings.read": operation({
|
|
4482
4593
|
op: "tax_settings.read",
|
|
4483
4594
|
run: (ctx, { businessId }) => send(
|
|
@@ -4534,10 +4645,6 @@ var businessOperations = {
|
|
|
4534
4645
|
op: "business.create",
|
|
4535
4646
|
run: (ctx, data) => send(ctx, "POST", "/businesses", data)
|
|
4536
4647
|
}),
|
|
4537
|
-
"businesses.delete": operation({
|
|
4538
|
-
op: "business.delete",
|
|
4539
|
-
run: (ctx, { businessId }) => send(ctx, "DELETE", business(businessId))
|
|
4540
|
-
}),
|
|
4541
4648
|
"businesses.routes.read": operation({
|
|
4542
4649
|
op: "business.routes.read",
|
|
4543
4650
|
run: (ctx, { businessId, env }) => send(ctx, "GET", withQuery(`${business(businessId)}/routes`, { env }))
|
|
@@ -4580,7 +4687,7 @@ var businessOperations = {
|
|
|
4580
4687
|
withQuery(`${business(businessId)}/deployments`, { env })
|
|
4581
4688
|
)
|
|
4582
4689
|
}),
|
|
4583
|
-
"businesses.publish":
|
|
4690
|
+
"businesses.publish": previewOperation({
|
|
4584
4691
|
op: "business.publish",
|
|
4585
4692
|
run: (ctx, { businessId, ...body }) => send(
|
|
4586
4693
|
ctx,
|
|
@@ -4696,7 +4803,7 @@ var changeSetOperations = {
|
|
|
4696
4803
|
return entry;
|
|
4697
4804
|
}
|
|
4698
4805
|
}),
|
|
4699
|
-
"changeSets.propose":
|
|
4806
|
+
"changeSets.propose": previewOperation({
|
|
4700
4807
|
op: "change_set.propose",
|
|
4701
4808
|
run: (ctx, { businessId, subscriberId, env, ...body }) => send(
|
|
4702
4809
|
ctx,
|
|
@@ -4870,7 +4977,7 @@ var frontendOperations = {
|
|
|
4870
4977
|
})
|
|
4871
4978
|
)
|
|
4872
4979
|
}),
|
|
4873
|
-
"frontend.rollback":
|
|
4980
|
+
"frontend.rollback": previewOperation({
|
|
4874
4981
|
op: "frontend.rollback",
|
|
4875
4982
|
run: (ctx, { businessId, ...data }) => send(
|
|
4876
4983
|
ctx,
|
|
@@ -4944,10 +5051,6 @@ var organizationOperations = {
|
|
|
4944
5051
|
op: "organization.create",
|
|
4945
5052
|
run: (ctx, data) => send(ctx, "POST", "/builder/organizations", data)
|
|
4946
5053
|
}),
|
|
4947
|
-
"organizations.delete": operation({
|
|
4948
|
-
op: "organization.delete",
|
|
4949
|
-
run: (ctx, { organizationId }) => send(ctx, "DELETE", org(organizationId))
|
|
4950
|
-
}),
|
|
4951
5054
|
"organizations.overview.read": operation({
|
|
4952
5055
|
op: "organization.overview.read",
|
|
4953
5056
|
run: (ctx, { organizationId }) => send(ctx, "GET", `${org(organizationId)}/overview`)
|
|
@@ -5018,12 +5121,6 @@ var organizationOperations = {
|
|
|
5018
5121
|
`${org(organizationId)}/members/${seg(memberUserId)}`
|
|
5019
5122
|
)
|
|
5020
5123
|
}),
|
|
5021
|
-
"organizations.ownership.transfer": operation({
|
|
5022
|
-
op: "organization.ownership.transfer",
|
|
5023
|
-
run: (ctx, { organizationId, newOwnerUserId }) => send(ctx, "POST", `${org(organizationId)}/ownership/transfer`, {
|
|
5024
|
-
newOwnerUserId
|
|
5025
|
-
})
|
|
5026
|
-
}),
|
|
5027
5124
|
"organizations.invitation.create": operation({
|
|
5028
5125
|
op: "organization.invitation.create",
|
|
5029
5126
|
run: (ctx, { organizationId, ...data }) => send(ctx, "POST", `${org(organizationId)}/invitations`, data)
|
|
@@ -5557,6 +5654,14 @@ var webhookOperations = {
|
|
|
5557
5654
|
"GET",
|
|
5558
5655
|
`${webhook(businessId, webhookId)}/deliveries/${seg(deliveryId)}`
|
|
5559
5656
|
)
|
|
5657
|
+
}),
|
|
5658
|
+
"webhooks.delivery.payload.read": operation({
|
|
5659
|
+
op: "webhook.delivery.payload.read",
|
|
5660
|
+
run: (ctx, { businessId, webhookId, deliveryId }) => send(
|
|
5661
|
+
ctx,
|
|
5662
|
+
"GET",
|
|
5663
|
+
`${webhook(businessId, webhookId)}/deliveries/${seg(deliveryId)}/payload`
|
|
5664
|
+
)
|
|
5560
5665
|
})
|
|
5561
5666
|
};
|
|
5562
5667
|
|
|
@@ -6118,6 +6223,7 @@ function errorEnvelopeOf(body) {
|
|
|
6118
6223
|
if (typeof raw.retryable === "boolean") envelope.retryable = raw.retryable;
|
|
6119
6224
|
if (raw.retryDisposition === "safe_to_repeat" || raw.retryDisposition === "reconcile_before_repeat")
|
|
6120
6225
|
envelope.retryDisposition = raw.retryDisposition;
|
|
6226
|
+
if (typeof raw.requestId === "string") envelope.requestId = raw.requestId;
|
|
6121
6227
|
return envelope;
|
|
6122
6228
|
}
|
|
6123
6229
|
function retrySignalOf(envelope) {
|
|
@@ -6143,7 +6249,7 @@ function diagnosticsOf(parsed) {
|
|
|
6143
6249
|
}
|
|
6144
6250
|
|
|
6145
6251
|
// src/version.ts
|
|
6146
|
-
var CLIENT_VERSION = "0.
|
|
6252
|
+
var CLIENT_VERSION = "0.5.0";
|
|
6147
6253
|
var CLIENT_PRODUCT = `@farthershore/client/${CLIENT_VERSION}`;
|
|
6148
6254
|
|
|
6149
6255
|
// src/transport.ts
|
|
@@ -6236,7 +6342,8 @@ function outcomeUnknownError(status, envelope, fallbackMessage, parsed, headers)
|
|
|
6236
6342
|
param: envelope?.param,
|
|
6237
6343
|
retryable: false,
|
|
6238
6344
|
retryDisposition: "reconcile_before_repeat",
|
|
6239
|
-
outcomeUnknown: true
|
|
6345
|
+
outcomeUnknown: true,
|
|
6346
|
+
requestId: envelope?.requestId
|
|
6240
6347
|
});
|
|
6241
6348
|
}
|
|
6242
6349
|
function requestAbortedError(cause) {
|
|
@@ -6388,7 +6495,8 @@ function httpError(res, policy, parsed) {
|
|
|
6388
6495
|
// `diagnosticsOf` keeps the TOP-LEVEL sibling arrays readable too.
|
|
6389
6496
|
details: envelope?.details ?? diagnosticsOf(parsed),
|
|
6390
6497
|
retryable: envelope?.retryable,
|
|
6391
|
-
retryDisposition: envelope?.retryDisposition
|
|
6498
|
+
retryDisposition: envelope?.retryDisposition,
|
|
6499
|
+
requestId: envelope?.requestId
|
|
6392
6500
|
}
|
|
6393
6501
|
);
|
|
6394
6502
|
}
|
|
@@ -6827,12 +6935,14 @@ async function joinShared(shared, signal) {
|
|
|
6827
6935
|
function isExchangeCredential(rawToken) {
|
|
6828
6936
|
return rawToken.startsWith("fscli_") || rawToken.startsWith("mk_");
|
|
6829
6937
|
}
|
|
6830
|
-
function cliExchangeCredentials(rawToken) {
|
|
6831
|
-
|
|
6832
|
-
|
|
6938
|
+
function cliExchangeCredentials(rawToken, options = {}) {
|
|
6939
|
+
const oauth = options.oauth === true && !isExchangeCredential(rawToken);
|
|
6940
|
+
if (!oauth && !isExchangeCredential(rawToken))
|
|
6941
|
+
return bearerCredentials(rawToken);
|
|
6942
|
+
const isUserCliCredential = oauth || rawToken.startsWith("fscli_");
|
|
6833
6943
|
let cliAccess = null;
|
|
6834
6944
|
let cliAccessRefreshAt = 0;
|
|
6835
|
-
async function listCliOrganizations(context, signal,
|
|
6945
|
+
async function listCliOrganizations(context, signal, options2) {
|
|
6836
6946
|
if (!isUserCliCredential) {
|
|
6837
6947
|
throw new FartherShoreError(
|
|
6838
6948
|
"Organization switching requires a user CLI login.",
|
|
@@ -6846,14 +6956,14 @@ function cliExchangeCredentials(rawToken) {
|
|
|
6846
6956
|
{
|
|
6847
6957
|
headers: { Authorization: `Bearer ${rawToken}` },
|
|
6848
6958
|
signal,
|
|
6849
|
-
...
|
|
6959
|
+
...options2?.retry === "none" ? { retry: "none" } : {}
|
|
6850
6960
|
},
|
|
6851
6961
|
"read"
|
|
6852
6962
|
);
|
|
6853
6963
|
return data;
|
|
6854
6964
|
}
|
|
6855
6965
|
let organizationResolution = null;
|
|
6856
|
-
function resolveExchangeOrganization(context, signal,
|
|
6966
|
+
function resolveExchangeOrganization(context, signal, options2) {
|
|
6857
6967
|
if (!isUserCliCredential) {
|
|
6858
6968
|
return Promise.resolve(
|
|
6859
6969
|
context.organizationId ?? context.requiredOrganizationId
|
|
@@ -6865,7 +6975,7 @@ function cliExchangeCredentials(rawToken) {
|
|
|
6865
6975
|
return Promise.reject(requestAborted(error));
|
|
6866
6976
|
}
|
|
6867
6977
|
if (!organizationResolution) {
|
|
6868
|
-
const resolution = lookUpExchangeOrganization(context,
|
|
6978
|
+
const resolution = lookUpExchangeOrganization(context, options2);
|
|
6869
6979
|
organizationResolution = resolution;
|
|
6870
6980
|
resolution.catch(() => {
|
|
6871
6981
|
if (organizationResolution === resolution) {
|
|
@@ -6875,10 +6985,10 @@ function cliExchangeCredentials(rawToken) {
|
|
|
6875
6985
|
}
|
|
6876
6986
|
return joinShared(organizationResolution, signal);
|
|
6877
6987
|
}
|
|
6878
|
-
async function lookUpExchangeOrganization(context,
|
|
6988
|
+
async function lookUpExchangeOrganization(context, options2) {
|
|
6879
6989
|
const selector = context.organizationId ?? context.requiredOrganizationId;
|
|
6880
6990
|
if (!selector) return void 0;
|
|
6881
|
-
const available = await listCliOrganizations(context, void 0,
|
|
6991
|
+
const available = await listCliOrganizations(context, void 0, options2);
|
|
6882
6992
|
const matches = available.organizations.filter(
|
|
6883
6993
|
(organization) => organization.id === selector || organization.slug === selector
|
|
6884
6994
|
);
|
|
@@ -6900,14 +7010,14 @@ function cliExchangeCredentials(rawToken) {
|
|
|
6900
7010
|
return selected.id;
|
|
6901
7011
|
}
|
|
6902
7012
|
let exchangeInFlight = null;
|
|
6903
|
-
function exchangeCliToken(context, signal,
|
|
7013
|
+
function exchangeCliToken(context, signal, options2) {
|
|
6904
7014
|
let flight = exchangeInFlight;
|
|
6905
7015
|
if (!flight) {
|
|
6906
7016
|
const controller = new AbortController();
|
|
6907
7017
|
const created = {
|
|
6908
7018
|
controller,
|
|
6909
7019
|
waiters: 0,
|
|
6910
|
-
promise: mintAccessToken(context, controller.signal,
|
|
7020
|
+
promise: mintAccessToken(context, controller.signal, options2)
|
|
6911
7021
|
};
|
|
6912
7022
|
const clear = () => {
|
|
6913
7023
|
if (exchangeInFlight === created) exchangeInFlight = null;
|
|
@@ -6944,11 +7054,11 @@ function cliExchangeCredentials(rawToken) {
|
|
|
6944
7054
|
leave(false);
|
|
6945
7055
|
}
|
|
6946
7056
|
}
|
|
6947
|
-
async function mintAccessToken(context, signal,
|
|
7057
|
+
async function mintAccessToken(context, signal, options2) {
|
|
6948
7058
|
const organizationId = await resolveExchangeOrganization(
|
|
6949
7059
|
context,
|
|
6950
7060
|
signal,
|
|
6951
|
-
|
|
7061
|
+
options2
|
|
6952
7062
|
);
|
|
6953
7063
|
const { data, headers, receivedAt } = await context.sendJson(
|
|
6954
7064
|
"POST",
|
|
@@ -6960,7 +7070,7 @@ function cliExchangeCredentials(rawToken) {
|
|
|
6960
7070
|
},
|
|
6961
7071
|
body: organizationId ? JSON.stringify({ organizationId }) : void 0,
|
|
6962
7072
|
signal,
|
|
6963
|
-
...
|
|
7073
|
+
...options2?.retry === "none" ? { retry: "none" } : {}
|
|
6964
7074
|
},
|
|
6965
7075
|
"read"
|
|
6966
7076
|
);
|
|
@@ -6999,14 +7109,14 @@ function cliExchangeCredentials(rawToken) {
|
|
|
6999
7109
|
refreshable: true,
|
|
7000
7110
|
getAccessToken,
|
|
7001
7111
|
listOrganizations: listCliOrganizations,
|
|
7002
|
-
async selectedOrganizationId(context, signal,
|
|
7112
|
+
async selectedOrganizationId(context, signal, options2) {
|
|
7003
7113
|
const selected = await resolveExchangeOrganization(
|
|
7004
7114
|
context,
|
|
7005
7115
|
signal,
|
|
7006
|
-
|
|
7116
|
+
options2
|
|
7007
7117
|
);
|
|
7008
7118
|
if (selected) return selected;
|
|
7009
|
-
if (!cliAccess) await exchangeCliToken(context, signal,
|
|
7119
|
+
if (!cliAccess) await exchangeCliToken(context, signal, options2);
|
|
7010
7120
|
return cliAccess?.organizationId;
|
|
7011
7121
|
}
|
|
7012
7122
|
});
|