@farthershore/client 0.4.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 +8 -0
- package/README.md +4 -2
- package/dist/index.js +148 -96
- package/dist/types/api.generated.d.ts +3 -33
- package/dist/types/credentials.d.ts +6 -2
- package/dist/types/generated/schemas.d.ts +19 -14
- package/dist/types/helpers/refs.d.ts +2 -2
- package/dist/types/operations/billing.d.ts +0 -7
- package/dist/types/operations/businesses.d.ts +5 -6
- package/dist/types/operations/define.d.ts +7 -1
- package/dist/types/operations/index.d.ts +13 -41
- package/dist/types/operations/organizations.d.ts +0 -12
- package/dist/types/operations/platform.d.ts +6 -6
- package/dist/types/operations/webhooks.d.ts +2 -2
- 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", {
|
|
@@ -723,13 +746,13 @@ var PLATFORM_PERMISSION_CATALOG = {
|
|
|
723
746
|
"webhook:delivery_read": permission("webhook:delivery_read", {
|
|
724
747
|
effect: "read",
|
|
725
748
|
allowedTargetKinds: BUSINESS,
|
|
726
|
-
defaultRoles:
|
|
749
|
+
defaultRoles: BUILDER_ROLES,
|
|
727
750
|
delegation: "maker_token"
|
|
728
751
|
}),
|
|
729
752
|
"webhook:read": permission("webhook:read", {
|
|
730
753
|
effect: "read",
|
|
731
754
|
allowedTargetKinds: BUSINESS,
|
|
732
|
-
defaultRoles:
|
|
755
|
+
defaultRoles: BUILDER_ROLES,
|
|
733
756
|
delegation: "maker_token"
|
|
734
757
|
}),
|
|
735
758
|
"webhook:test": permission("webhook:test", {
|
|
@@ -771,6 +794,9 @@ function validatePlatformPermissionCatalog() {
|
|
|
771
794
|
if (metadata.defaultRoles.length === 0) {
|
|
772
795
|
throw new Error(`Platform permission has no default role: ${permission2}`);
|
|
773
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
|
+
}
|
|
774
800
|
}
|
|
775
801
|
}
|
|
776
802
|
validatePlatformPermissionCatalog();
|
|
@@ -1517,8 +1543,7 @@ var PLATFORM_OPERATION_DEFINITIONS = [
|
|
|
1517
1543
|
})),
|
|
1518
1544
|
// Connecting Stripe is a browser-only OAuth/onboarding handshake with Stripe
|
|
1519
1545
|
// (credential administration). Reading the connection and disconnecting a
|
|
1520
|
-
// per-business override
|
|
1521
|
-
// `farthershore stripe status|disconnect`.
|
|
1546
|
+
// per-business override have distinct read and human-only permissions.
|
|
1522
1547
|
{
|
|
1523
1548
|
key: "stripe_connection.create",
|
|
1524
1549
|
class: "operate",
|
|
@@ -1528,6 +1553,28 @@ var PLATFORM_OPERATION_DEFINITIONS = [
|
|
|
1528
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>`."
|
|
1529
1554
|
}
|
|
1530
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
|
+
},
|
|
1531
1578
|
...["read", "delete"].map((action) => ({
|
|
1532
1579
|
key: `stripe_connection.${action}`,
|
|
1533
1580
|
class: "operate",
|
|
@@ -1628,6 +1675,14 @@ var AGENT_OPERATION_AUTHORIZATIONS = {
|
|
|
1628
1675
|
permission: "git_connection:update",
|
|
1629
1676
|
targetKind: "organization"
|
|
1630
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
|
+
},
|
|
1631
1686
|
"stripe_connection.create": {
|
|
1632
1687
|
permission: "stripe_connection:create",
|
|
1633
1688
|
targetKind: "organization"
|
|
@@ -2221,7 +2276,7 @@ function validatePlatformOperationCatalog(operations) {
|
|
|
2221
2276
|
if (operation2.agentVisibility === "excluded") {
|
|
2222
2277
|
const core = AGENT_OPERATION_AUTHORIZATIONS[operation2.key];
|
|
2223
2278
|
const validBoundary = operation2.unavailable !== void 0 && EXCLUDED_AGENT_REASONS.has(operation2.unavailable.reason);
|
|
2224
|
-
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));
|
|
2225
2280
|
if (operation2.authorization !== void 0 || !validBoundary && !validEligibility) {
|
|
2226
2281
|
throw new Error(`Excluded operation ${operation2.key} has an invalid agent visibility binding`);
|
|
2227
2282
|
}
|
|
@@ -2246,7 +2301,7 @@ var PLATFORM_OPERATIONS = PLATFORM_OPERATION_DEFINITIONS.map((operation2) => {
|
|
|
2246
2301
|
};
|
|
2247
2302
|
}
|
|
2248
2303
|
const core = AGENT_OPERATION_AUTHORIZATIONS[operation2.key];
|
|
2249
|
-
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));
|
|
2250
2305
|
if (excludedByPrincipalEligibility) {
|
|
2251
2306
|
return {
|
|
2252
2307
|
...operation2,
|
|
@@ -2277,6 +2332,13 @@ for (const key of Object.keys(AGENT_OPERATION_AUTHORIZATIONS)) {
|
|
|
2277
2332
|
throw new Error(`Authorization binding references unknown operation: ${key}`);
|
|
2278
2333
|
}
|
|
2279
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
|
+
}
|
|
2280
2342
|
|
|
2281
2343
|
// ../contracts/dist/operation-spec.js
|
|
2282
2344
|
var SPECS = {
|
|
@@ -2389,8 +2451,8 @@ var SPECS = {
|
|
|
2389
2451
|
},
|
|
2390
2452
|
// DECISION: NEITHER side → destructive. Rollbacks are destructive: they replace the live release customers are served.
|
|
2391
2453
|
"business.rollback": {
|
|
2392
|
-
summary: "Roll back a prior business publish
|
|
2393
|
-
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.",
|
|
2394
2456
|
destructive: true,
|
|
2395
2457
|
oneTimeSecret: false,
|
|
2396
2458
|
preview: false,
|
|
@@ -3687,6 +3749,7 @@ var STREAMING_EXEMPT_CONTENT_TYPE_SET = new Set(STREAMING_EXEMPT_CONTENT_TYPES);
|
|
|
3687
3749
|
|
|
3688
3750
|
// ../contracts/dist/error-codes.js
|
|
3689
3751
|
var ERROR_CODES = {
|
|
3752
|
+
HUMAN_ONLY_ACTION: "HUMAN_ONLY_ACTION",
|
|
3690
3753
|
// --- Generic / cross-cutting ---------------------------------------
|
|
3691
3754
|
VALIDATION_ERROR: "VALIDATION_ERROR",
|
|
3692
3755
|
CONFLICT: "CONFLICT",
|
|
@@ -3768,6 +3831,7 @@ var ERROR_CODES = {
|
|
|
3768
3831
|
/** The owner role always holds every permission — it can never be edited,
|
|
3769
3832
|
* reduced, or deleted, on either the builder or subscriber plane. */
|
|
3770
3833
|
OWNER_ROLE_IMMUTABLE: "OWNER_ROLE_IMMUTABLE",
|
|
3834
|
+
SUBSCRIBER_ROLE_IMMUTABLE: "SUBSCRIBER_ROLE_IMMUTABLE",
|
|
3771
3835
|
/** Floor→rows: the seeded account-role rows (`account_admin` /
|
|
3772
3836
|
* `account_member`) replace the fixed bundles. They cannot be created,
|
|
3773
3837
|
* deleted, renamed, or referenced from assignments/defaultRoleKey — and
|
|
@@ -3902,6 +3966,11 @@ var ERROR_CODES = {
|
|
|
3902
3966
|
// someone connects Stripe, so "try again shortly" is never true here.
|
|
3903
3967
|
STRIPE_NOT_CONNECTED: "STRIPE_NOT_CONNECTED",
|
|
3904
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",
|
|
3905
3974
|
// A Stripe API call the route depended on failed (e.g. balance
|
|
3906
3975
|
// retrieve or account delete during product disconnect). The human
|
|
3907
3976
|
// `message` carries the upstream Stripe error text; the route blocks
|
|
@@ -4133,6 +4202,12 @@ function previewOperation(entry) {
|
|
|
4133
4202
|
return { ...entry, preview: true };
|
|
4134
4203
|
}
|
|
4135
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
|
+
);
|
|
4136
4211
|
return encodeURIComponent(value);
|
|
4137
4212
|
}
|
|
4138
4213
|
function withQuery(path, params) {
|
|
@@ -4514,17 +4589,6 @@ var billingOperations = {
|
|
|
4514
4589
|
`/businesses/${seg(businessId)}/stripe/status`
|
|
4515
4590
|
)
|
|
4516
4591
|
}),
|
|
4517
|
-
"billing.stripe.delete": operation({
|
|
4518
|
-
op: "stripe_connection.delete",
|
|
4519
|
-
run: (ctx, { businessId, deleteAccount }) => send(
|
|
4520
|
-
ctx,
|
|
4521
|
-
"POST",
|
|
4522
|
-
`/businesses/${seg(businessId)}/stripe/disconnect`,
|
|
4523
|
-
{
|
|
4524
|
-
deleteAccount: deleteAccount === true
|
|
4525
|
-
}
|
|
4526
|
-
)
|
|
4527
|
-
}),
|
|
4528
4592
|
"billing.taxSettings.read": operation({
|
|
4529
4593
|
op: "tax_settings.read",
|
|
4530
4594
|
run: (ctx, { businessId }) => send(
|
|
@@ -4581,10 +4645,6 @@ var businessOperations = {
|
|
|
4581
4645
|
op: "business.create",
|
|
4582
4646
|
run: (ctx, data) => send(ctx, "POST", "/businesses", data)
|
|
4583
4647
|
}),
|
|
4584
|
-
"businesses.delete": operation({
|
|
4585
|
-
op: "business.delete",
|
|
4586
|
-
run: (ctx, { businessId }) => send(ctx, "DELETE", business(businessId))
|
|
4587
|
-
}),
|
|
4588
4648
|
"businesses.routes.read": operation({
|
|
4589
4649
|
op: "business.routes.read",
|
|
4590
4650
|
run: (ctx, { businessId, env }) => send(ctx, "GET", withQuery(`${business(businessId)}/routes`, { env }))
|
|
@@ -4991,10 +5051,6 @@ var organizationOperations = {
|
|
|
4991
5051
|
op: "organization.create",
|
|
4992
5052
|
run: (ctx, data) => send(ctx, "POST", "/builder/organizations", data)
|
|
4993
5053
|
}),
|
|
4994
|
-
"organizations.delete": operation({
|
|
4995
|
-
op: "organization.delete",
|
|
4996
|
-
run: (ctx, { organizationId }) => send(ctx, "DELETE", org(organizationId))
|
|
4997
|
-
}),
|
|
4998
5054
|
"organizations.overview.read": operation({
|
|
4999
5055
|
op: "organization.overview.read",
|
|
5000
5056
|
run: (ctx, { organizationId }) => send(ctx, "GET", `${org(organizationId)}/overview`)
|
|
@@ -5065,12 +5121,6 @@ var organizationOperations = {
|
|
|
5065
5121
|
`${org(organizationId)}/members/${seg(memberUserId)}`
|
|
5066
5122
|
)
|
|
5067
5123
|
}),
|
|
5068
|
-
"organizations.ownership.transfer": operation({
|
|
5069
|
-
op: "organization.ownership.transfer",
|
|
5070
|
-
run: (ctx, { organizationId, newOwnerUserId }) => send(ctx, "POST", `${org(organizationId)}/ownership/transfer`, {
|
|
5071
|
-
newOwnerUserId
|
|
5072
|
-
})
|
|
5073
|
-
}),
|
|
5074
5124
|
"organizations.invitation.create": operation({
|
|
5075
5125
|
op: "organization.invitation.create",
|
|
5076
5126
|
run: (ctx, { organizationId, ...data }) => send(ctx, "POST", `${org(organizationId)}/invitations`, data)
|
|
@@ -6199,7 +6249,7 @@ function diagnosticsOf(parsed) {
|
|
|
6199
6249
|
}
|
|
6200
6250
|
|
|
6201
6251
|
// src/version.ts
|
|
6202
|
-
var CLIENT_VERSION = "0.
|
|
6252
|
+
var CLIENT_VERSION = "0.5.0";
|
|
6203
6253
|
var CLIENT_PRODUCT = `@farthershore/client/${CLIENT_VERSION}`;
|
|
6204
6254
|
|
|
6205
6255
|
// src/transport.ts
|
|
@@ -6885,12 +6935,14 @@ async function joinShared(shared, signal) {
|
|
|
6885
6935
|
function isExchangeCredential(rawToken) {
|
|
6886
6936
|
return rawToken.startsWith("fscli_") || rawToken.startsWith("mk_");
|
|
6887
6937
|
}
|
|
6888
|
-
function cliExchangeCredentials(rawToken) {
|
|
6889
|
-
|
|
6890
|
-
|
|
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_");
|
|
6891
6943
|
let cliAccess = null;
|
|
6892
6944
|
let cliAccessRefreshAt = 0;
|
|
6893
|
-
async function listCliOrganizations(context, signal,
|
|
6945
|
+
async function listCliOrganizations(context, signal, options2) {
|
|
6894
6946
|
if (!isUserCliCredential) {
|
|
6895
6947
|
throw new FartherShoreError(
|
|
6896
6948
|
"Organization switching requires a user CLI login.",
|
|
@@ -6904,14 +6956,14 @@ function cliExchangeCredentials(rawToken) {
|
|
|
6904
6956
|
{
|
|
6905
6957
|
headers: { Authorization: `Bearer ${rawToken}` },
|
|
6906
6958
|
signal,
|
|
6907
|
-
...
|
|
6959
|
+
...options2?.retry === "none" ? { retry: "none" } : {}
|
|
6908
6960
|
},
|
|
6909
6961
|
"read"
|
|
6910
6962
|
);
|
|
6911
6963
|
return data;
|
|
6912
6964
|
}
|
|
6913
6965
|
let organizationResolution = null;
|
|
6914
|
-
function resolveExchangeOrganization(context, signal,
|
|
6966
|
+
function resolveExchangeOrganization(context, signal, options2) {
|
|
6915
6967
|
if (!isUserCliCredential) {
|
|
6916
6968
|
return Promise.resolve(
|
|
6917
6969
|
context.organizationId ?? context.requiredOrganizationId
|
|
@@ -6923,7 +6975,7 @@ function cliExchangeCredentials(rawToken) {
|
|
|
6923
6975
|
return Promise.reject(requestAborted(error));
|
|
6924
6976
|
}
|
|
6925
6977
|
if (!organizationResolution) {
|
|
6926
|
-
const resolution = lookUpExchangeOrganization(context,
|
|
6978
|
+
const resolution = lookUpExchangeOrganization(context, options2);
|
|
6927
6979
|
organizationResolution = resolution;
|
|
6928
6980
|
resolution.catch(() => {
|
|
6929
6981
|
if (organizationResolution === resolution) {
|
|
@@ -6933,10 +6985,10 @@ function cliExchangeCredentials(rawToken) {
|
|
|
6933
6985
|
}
|
|
6934
6986
|
return joinShared(organizationResolution, signal);
|
|
6935
6987
|
}
|
|
6936
|
-
async function lookUpExchangeOrganization(context,
|
|
6988
|
+
async function lookUpExchangeOrganization(context, options2) {
|
|
6937
6989
|
const selector = context.organizationId ?? context.requiredOrganizationId;
|
|
6938
6990
|
if (!selector) return void 0;
|
|
6939
|
-
const available = await listCliOrganizations(context, void 0,
|
|
6991
|
+
const available = await listCliOrganizations(context, void 0, options2);
|
|
6940
6992
|
const matches = available.organizations.filter(
|
|
6941
6993
|
(organization) => organization.id === selector || organization.slug === selector
|
|
6942
6994
|
);
|
|
@@ -6958,14 +7010,14 @@ function cliExchangeCredentials(rawToken) {
|
|
|
6958
7010
|
return selected.id;
|
|
6959
7011
|
}
|
|
6960
7012
|
let exchangeInFlight = null;
|
|
6961
|
-
function exchangeCliToken(context, signal,
|
|
7013
|
+
function exchangeCliToken(context, signal, options2) {
|
|
6962
7014
|
let flight = exchangeInFlight;
|
|
6963
7015
|
if (!flight) {
|
|
6964
7016
|
const controller = new AbortController();
|
|
6965
7017
|
const created = {
|
|
6966
7018
|
controller,
|
|
6967
7019
|
waiters: 0,
|
|
6968
|
-
promise: mintAccessToken(context, controller.signal,
|
|
7020
|
+
promise: mintAccessToken(context, controller.signal, options2)
|
|
6969
7021
|
};
|
|
6970
7022
|
const clear = () => {
|
|
6971
7023
|
if (exchangeInFlight === created) exchangeInFlight = null;
|
|
@@ -7002,11 +7054,11 @@ function cliExchangeCredentials(rawToken) {
|
|
|
7002
7054
|
leave(false);
|
|
7003
7055
|
}
|
|
7004
7056
|
}
|
|
7005
|
-
async function mintAccessToken(context, signal,
|
|
7057
|
+
async function mintAccessToken(context, signal, options2) {
|
|
7006
7058
|
const organizationId = await resolveExchangeOrganization(
|
|
7007
7059
|
context,
|
|
7008
7060
|
signal,
|
|
7009
|
-
|
|
7061
|
+
options2
|
|
7010
7062
|
);
|
|
7011
7063
|
const { data, headers, receivedAt } = await context.sendJson(
|
|
7012
7064
|
"POST",
|
|
@@ -7018,7 +7070,7 @@ function cliExchangeCredentials(rawToken) {
|
|
|
7018
7070
|
},
|
|
7019
7071
|
body: organizationId ? JSON.stringify({ organizationId }) : void 0,
|
|
7020
7072
|
signal,
|
|
7021
|
-
...
|
|
7073
|
+
...options2?.retry === "none" ? { retry: "none" } : {}
|
|
7022
7074
|
},
|
|
7023
7075
|
"read"
|
|
7024
7076
|
);
|
|
@@ -7057,14 +7109,14 @@ function cliExchangeCredentials(rawToken) {
|
|
|
7057
7109
|
refreshable: true,
|
|
7058
7110
|
getAccessToken,
|
|
7059
7111
|
listOrganizations: listCliOrganizations,
|
|
7060
|
-
async selectedOrganizationId(context, signal,
|
|
7112
|
+
async selectedOrganizationId(context, signal, options2) {
|
|
7061
7113
|
const selected = await resolveExchangeOrganization(
|
|
7062
7114
|
context,
|
|
7063
7115
|
signal,
|
|
7064
|
-
|
|
7116
|
+
options2
|
|
7065
7117
|
);
|
|
7066
7118
|
if (selected) return selected;
|
|
7067
|
-
if (!cliAccess) await exchangeCliToken(context, signal,
|
|
7119
|
+
if (!cliAccess) await exchangeCliToken(context, signal, options2);
|
|
7068
7120
|
return cliAccess?.organizationId;
|
|
7069
7121
|
}
|
|
7070
7122
|
});
|