@vercel/board 0.48.1 → 0.50.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/dist/{access-C06pIr0M.mjs → access-BbgmsAFF.mjs} +29 -17
- package/dist/access.d.mts +2 -2
- package/dist/access.mjs +5 -5
- package/dist/{actors-Dkyg-oo0.mjs → actors-CX2D22hL.mjs} +4 -3
- package/dist/{auth-B9-wXQ-x.mjs → auth-DJDTfgAL.mjs} +2 -2
- package/dist/{auth-li3lKwJG.d.mts → auth-Z9-Khvvw.d.mts} +1 -1
- package/dist/{backend-UBP6HimX.d.mts → backend-CcaaS9Xl.d.mts} +31 -8
- package/dist/backend-local.d.mts +1 -1
- package/dist/backend-local.mjs +1 -1
- package/dist/{chat-provider-iN0DFsSE.d.mts → chat-provider-DQ1GHm4o.d.mts} +2 -2
- package/dist/{chat-provider-kNWd6MQC.mjs → chat-provider-HJ7y_ipp.mjs} +2 -2
- package/dist/cli-commands.d.mts +1 -1
- package/dist/cli-commands.mjs +1 -1
- package/dist/cli-embedded.d.mts +8 -2
- package/dist/cli-embedded.mjs +10 -4
- package/dist/cli.mjs +6 -6
- package/dist/client-C2T4eaXd.d.mts +544 -0
- package/dist/{commands-CJsOA-hf.d.mts → commands-Cm4sODIu.d.mts} +12 -8
- package/dist/{commands-Dk6_cHLS.mjs → commands-nN8WpvCe.mjs} +75 -58
- package/dist/{conformance-CDP8y2Zm.mjs → conformance-Cr-umDl0.mjs} +102 -20
- package/dist/conformance.d.mts +1 -1
- package/dist/conformance.mjs +1 -1
- package/dist/{engine-BQ0hJw2w.mjs → engine-DJZ8Xy_g.mjs} +10 -7
- package/dist/{errors-QhkdzI-o.mjs → errors-DYF4hhIc.mjs} +53 -174
- package/dist/{events-B-qyxNsJ.mjs → events-BdOCmnZh.mjs} +3 -3
- package/dist/{exports-BzSG0_wL.mjs → exports-CuD-Mxkw.mjs} +389 -118
- package/dist/{exports-inhbjAWi.d.mts → exports-lmr6UHHc.d.mts} +4 -4
- package/dist/{external-BuVTXT1R.mjs → external-D2jq_DEQ.mjs} +1 -1
- package/dist/{index-B0Fnhvk7.d.mts → index-_KxJu15n.d.mts} +2 -2
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +4 -4
- package/dist/index.node.d.mts +7 -7
- package/dist/index.node.mjs +4 -4
- package/dist/inspect/app.js +39 -39
- package/dist/inspect/engine.js +3 -3
- package/dist/inspect-CZeoSm7E.mjs +272 -0
- package/dist/inspect-UCcPViyA.mjs +2 -0
- package/dist/inspect.d.mts +17 -0
- package/dist/inspect.mjs +196 -0
- package/dist/{local-BdKxz-Dn.mjs → local-BVSFSSYf.mjs} +165 -61
- package/dist/{main-BgiViRZ8.mjs → main-B016auoG.mjs} +227 -49
- package/dist/{memory-CMm-Fk_A.mjs → memory-C2lzMV_t.mjs} +2 -2
- package/dist/{middleware-CT6vMNUc.mjs → middleware-DUKIITFZ.mjs} +3 -3
- package/dist/{page-D-OzDOAX.mjs → page-7KWSGxyC.mjs} +12 -2
- package/dist/page-CN77B014.mjs +2 -0
- package/dist/profile-header-Cj0Cb1cf.mjs +163 -0
- package/dist/{provider-DC3WHUXo.d.mts → provider-Dwb_9mnu.d.mts} +3 -529
- package/dist/{routes-CjA6Mp4D.d.mts → routes-B6SEA9yw.d.mts} +130 -4
- package/dist/{routes-ABXf3CKq.mjs → routes-BE0y6wCk.mjs} +40 -14
- package/dist/{schemas-7VFdomFB.mjs → schemas-CUSTEFIy.mjs} +11 -3
- package/dist/{serve-C2Jbr7pR.mjs → serve-B10e7QaY.mjs} +5 -5
- package/dist/{server-EOQC5Gtq.mjs → server-ViWNvg5q.mjs} +61 -29
- package/dist/{serving-BNdiReQT.mjs → serving-SbqeWqlA.mjs} +1 -1
- package/dist/{inspect-n9brh-TT.mjs → shell-DmpmgOPC.mjs} +25 -274
- package/dist/{sql-IEbO5vXs.mjs → sql-iABdyCiz.mjs} +18 -5
- package/dist/{sqlite-CVG8XKHm.mjs → sqlite-28EMrmk7.mjs} +2 -2
- package/dist/{sqlite-db-BJjPQYx4.mjs → sqlite-db-Ckd-ceNe.mjs} +1 -1
- package/dist/sync-chat-sdk.d.mts +2 -2
- package/dist/sync-chat-sdk.mjs +2 -2
- package/dist/sync-github.d.mts +2 -2
- package/dist/sync-github.mjs +3 -3
- package/dist/sync-linear.d.mts +3 -3
- package/dist/sync-linear.mjs +3 -3
- package/dist/sync-slack.d.mts +3 -3
- package/dist/sync-slack.mjs +11 -7
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +2 -2
- package/dist/{tags-BpFo6q0_.mjs → tags-D0qra0Qy.mjs} +1 -1
- package/dist/{task-batch-D4p9N8lN.mjs → task-batch-9lVDG3d-.mjs} +10 -11
- package/dist/{tokens-BCp4EWTQ.mjs → tokens-C-iK0Cku.mjs} +2 -2
- package/dist/version-C70RLVEK.mjs +5 -0
- package/docs/01-board/01-mounting.md +8 -0
- package/docs/01-board/03-identity.md +3 -2
- package/docs/01-board/04-messages.md +6 -2
- package/docs/01-board/05-reading.md +17 -2
- package/docs/01-board/09-access.md +40 -6
- package/docs/01-board/11-tasks.md +3 -3
- package/docs/02-sync/01-overview.md +2 -1
- package/docs/03-guides/02-inspector.md +31 -0
- package/docs/03-guides/06-sandboxed-agents.md +22 -21
- package/docs/04-reference/01-cli.md +91 -33
- package/docs/04-reference/02-board.md +20 -7
- package/docs/04-reference/03-http.md +9 -6
- package/docs/04-reference/05-conformance.md +7 -0
- package/package.json +5 -1
- package/dist/inspect-BB-XUPuz.mjs +0 -2
- package/dist/page-Dr9Aqlej.mjs +0 -2
|
@@ -835,8 +835,19 @@ type GrantChange = {
|
|
|
835
835
|
revoked?: {
|
|
836
836
|
readonly can: WrittenCan;
|
|
837
837
|
};
|
|
838
|
+
/**
|
|
839
|
+
* What the caller may do once the change has landed, as `caller` and `own` are on the grants it
|
|
840
|
+
* applies to: judged for a lockout. Left out, as for a caller that said to go ahead, none is.
|
|
841
|
+
*/
|
|
842
|
+
then?: {
|
|
843
|
+
readonly caller: Access;
|
|
844
|
+
readonly own: Access;
|
|
845
|
+
};
|
|
838
846
|
};
|
|
839
|
-
/**
|
|
847
|
+
/**
|
|
848
|
+
* Why `checkGrantChange` refuses a change, and where: `pattern` is the spot it failed at. A
|
|
849
|
+
* `lockout` is a change the caller may make, and couldn't take back.
|
|
850
|
+
*/
|
|
840
851
|
type GrantChangeRefusal = {
|
|
841
852
|
reason: 'reach';
|
|
842
853
|
pattern: ChannelPattern;
|
|
@@ -845,6 +856,10 @@ type GrantChangeRefusal = {
|
|
|
845
856
|
reason: 'admission';
|
|
846
857
|
pattern: ChannelPattern;
|
|
847
858
|
permission: Permission;
|
|
859
|
+
} | {
|
|
860
|
+
reason: 'lockout';
|
|
861
|
+
pattern: ChannelPattern;
|
|
862
|
+
permission: 'manage';
|
|
848
863
|
};
|
|
849
864
|
/**
|
|
850
865
|
* Whether a caller may change grants so: make or widen one (`changed`), or revoke one or remove
|
|
@@ -860,6 +875,10 @@ type GrantChangeRefusal = {
|
|
|
860
875
|
* - **Admission:** wherever `everyone` gives something, `caller` has it too, since any principal a
|
|
861
876
|
* grant lets in gets what `everyone` gives. A revoke or a removal lets no one in, so it's judged
|
|
862
877
|
* by reach alone, at the patterns of the grant as it was.
|
|
878
|
+
* - **Lockout:** a change that passes both, and takes the caller's own `manage` at a pattern it
|
|
879
|
+
* names, is one the caller couldn't take back: closing `security/` to everyone closes it to
|
|
880
|
+
* whoever closes it, unless a grant keeps them in. Judged only with `then`, what the caller may
|
|
881
|
+
* do once the change has landed, so a caller that says to go ahead is let through.
|
|
863
882
|
*
|
|
864
883
|
* It looks only at the spots where access can change: the grants' patterns, the `everyone`
|
|
865
884
|
* grants', and the caller's own, from `summary()`. It does no I/O, so a board and Vercel's API run
|
|
@@ -906,6 +925,9 @@ declare const MessagesQuery: z.ZodObject<{
|
|
|
906
925
|
before: z.ZodOptional<z.ZodString>;
|
|
907
926
|
limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
908
927
|
}, z.core.$strip>;
|
|
928
|
+
/** How many threads a read lists without a `limit`, and with one at most. */
|
|
929
|
+
declare const THREADS_LIMIT_DEFAULT = 50;
|
|
930
|
+
declare const THREADS_LIMIT_MAX = 500;
|
|
909
931
|
/**
|
|
910
932
|
* `limit` counts threads: each thread with a matching message, by its latest reply. `before` is a page's
|
|
911
933
|
* `older`, for the threads last active before it; it pages backward, so it takes no `after`.
|
|
@@ -1153,7 +1175,7 @@ declare const PrincipalInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1153
1175
|
}, z.core.$strict>], "kind">;
|
|
1154
1176
|
/** What a grant lets its principals do: a map from channel pattern to `'all'` or a list, `[]` for none. Kept as written. */
|
|
1155
1177
|
declare const GrantCan: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodArray<z.ZodString>]>>;
|
|
1156
|
-
/**
|
|
1178
|
+
/** What `POST /grants` takes: a grant, and `lockMeOut` to make one its caller couldn't take back. */
|
|
1157
1179
|
declare const GrantBody: z.ZodObject<{
|
|
1158
1180
|
principals: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1159
1181
|
kind: z.ZodLiteral<"user">;
|
|
@@ -1187,7 +1209,56 @@ declare const GrantBody: z.ZodObject<{
|
|
|
1187
1209
|
kind: z.ZodLiteral<"everyone">;
|
|
1188
1210
|
}, z.core.$strict>], "kind">>;
|
|
1189
1211
|
can: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodArray<z.ZodString>]>>;
|
|
1212
|
+
lockMeOut: z.ZodOptional<z.ZodBoolean>;
|
|
1213
|
+
}, z.core.$strict>;
|
|
1214
|
+
/** How many grants one write makes. */
|
|
1215
|
+
declare const GRANT_BATCH_MAX = 16;
|
|
1216
|
+
/**
|
|
1217
|
+
* Several grants made in one write, all of them or none, judged together: each by the grants as
|
|
1218
|
+
* they are, and what it leaves its caller with by the grants as they'd be with all of them. So a
|
|
1219
|
+
* lock and the grant that keeps its maker in go in one request, in any order.
|
|
1220
|
+
*/
|
|
1221
|
+
declare const CreateGrantsBody: z.ZodObject<{
|
|
1222
|
+
grants: z.ZodArray<z.ZodObject<{
|
|
1223
|
+
principals: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1224
|
+
kind: z.ZodLiteral<"user">;
|
|
1225
|
+
email: z.ZodOptional<z.ZodString>;
|
|
1226
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
1227
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1228
|
+
kind: z.ZodLiteral<"project">;
|
|
1229
|
+
project: z.ZodString;
|
|
1230
|
+
environments: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1231
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1232
|
+
kind: z.ZodLiteral<"github">;
|
|
1233
|
+
repository: z.ZodString;
|
|
1234
|
+
workflow: z.ZodOptional<z.ZodString>;
|
|
1235
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
1236
|
+
event: z.ZodOptional<z.ZodString>;
|
|
1237
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1238
|
+
kind: z.ZodLiteral<"oidc">;
|
|
1239
|
+
issuer: z.ZodString;
|
|
1240
|
+
claims: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
1241
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1242
|
+
kind: z.ZodLiteral<"all-users">;
|
|
1243
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1244
|
+
kind: z.ZodLiteral<"all-projects">;
|
|
1245
|
+
environments: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1246
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1247
|
+
kind: z.ZodLiteral<"app">;
|
|
1248
|
+
app: z.ZodString;
|
|
1249
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1250
|
+
kind: z.ZodLiteral<"all-apps">;
|
|
1251
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1252
|
+
kind: z.ZodLiteral<"everyone">;
|
|
1253
|
+
}, z.core.$strict>], "kind">>;
|
|
1254
|
+
can: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodArray<z.ZodString>]>>;
|
|
1255
|
+
}, z.core.$strict>>;
|
|
1256
|
+
lockMeOut: z.ZodOptional<z.ZodBoolean>;
|
|
1190
1257
|
}, z.core.$strict>;
|
|
1258
|
+
/** What revoking a grant takes: nothing, or `lockMeOut`. */
|
|
1259
|
+
declare const RevokeGrantBody: z.ZodOptional<z.ZodObject<{
|
|
1260
|
+
lockMeOut: z.ZodOptional<z.ZodBoolean>;
|
|
1261
|
+
}, z.core.$strict>>;
|
|
1191
1262
|
/**
|
|
1192
1263
|
* Which grant decides a channel, and what it gives, for the caller or a principal it names: a
|
|
1193
1264
|
* `user` (by email, or by ID where the board can't look one up), a `project` in one `environment`
|
|
@@ -1272,6 +1343,7 @@ declare const UpdateGrantBody: z.ZodObject<{
|
|
|
1272
1343
|
kind: z.ZodLiteral<"everyone">;
|
|
1273
1344
|
}, z.core.$strict>], "kind">>>;
|
|
1274
1345
|
can: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodArray<z.ZodString>]>>>;
|
|
1346
|
+
lockMeOut: z.ZodOptional<z.ZodBoolean>;
|
|
1275
1347
|
}, z.core.$strict>;
|
|
1276
1348
|
/**
|
|
1277
1349
|
* A schema version to register, for good: `name` and `version` are its ID (`sandbox@1`), and
|
|
@@ -1776,11 +1848,18 @@ type PrincipalInput = z.input<typeof PrincipalInput>;
|
|
|
1776
1848
|
type CanAt = 'all' | 'none' | readonly Permission[];
|
|
1777
1849
|
/** A grant's `can`, as a handle takes it: each channel pattern and what it gives. */
|
|
1778
1850
|
type GrantCan = Readonly<Record<string, CanAt>>;
|
|
1779
|
-
/**
|
|
1851
|
+
/** A grant, as a handle takes it: who it names, and what they may do. */
|
|
1780
1852
|
type GrantInput = {
|
|
1781
1853
|
principals: readonly PrincipalInput[];
|
|
1782
1854
|
can: GrantCan;
|
|
1783
1855
|
};
|
|
1856
|
+
/**
|
|
1857
|
+
* What a grant write takes beside its change. `lockMeOut` goes ahead with one you couldn't take
|
|
1858
|
+
* back: it takes your own `manage` at a pattern it names, and is 409 `grant_lockout` without it.
|
|
1859
|
+
*/
|
|
1860
|
+
type GrantWriteOptions = {
|
|
1861
|
+
lockMeOut?: boolean;
|
|
1862
|
+
};
|
|
1784
1863
|
/** What `updateGrant` takes: principals to add, principals to remove (by who they are, environments aside), and a `can` that replaces the grant's. */
|
|
1785
1864
|
type UpdateGrantInput = {
|
|
1786
1865
|
add?: readonly PrincipalInput[];
|
|
@@ -2635,6 +2714,49 @@ declare const routes: {
|
|
|
2635
2714
|
kind: z.ZodLiteral<"everyone">;
|
|
2636
2715
|
}, z.core.$strict>], "kind">>;
|
|
2637
2716
|
can: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodArray<z.ZodString>]>>;
|
|
2717
|
+
lockMeOut: z.ZodOptional<z.ZodBoolean>;
|
|
2718
|
+
}, z.core.$strict>;
|
|
2719
|
+
};
|
|
2720
|
+
/** Several grants in one write, all or none, judged together. */
|
|
2721
|
+
readonly createGrants: {
|
|
2722
|
+
readonly method: 'POST';
|
|
2723
|
+
readonly path: '/grants/batch';
|
|
2724
|
+
readonly body: z.ZodObject<{
|
|
2725
|
+
grants: z.ZodArray<z.ZodObject<{
|
|
2726
|
+
principals: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2727
|
+
kind: z.ZodLiteral<"user">;
|
|
2728
|
+
email: z.ZodOptional<z.ZodString>;
|
|
2729
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
2730
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2731
|
+
kind: z.ZodLiteral<"project">;
|
|
2732
|
+
project: z.ZodString;
|
|
2733
|
+
environments: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2734
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2735
|
+
kind: z.ZodLiteral<"github">;
|
|
2736
|
+
repository: z.ZodString;
|
|
2737
|
+
workflow: z.ZodOptional<z.ZodString>;
|
|
2738
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
2739
|
+
event: z.ZodOptional<z.ZodString>;
|
|
2740
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2741
|
+
kind: z.ZodLiteral<"oidc">;
|
|
2742
|
+
issuer: z.ZodString;
|
|
2743
|
+
claims: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
2744
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2745
|
+
kind: z.ZodLiteral<"all-users">;
|
|
2746
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2747
|
+
kind: z.ZodLiteral<"all-projects">;
|
|
2748
|
+
environments: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2749
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2750
|
+
kind: z.ZodLiteral<"app">;
|
|
2751
|
+
app: z.ZodString;
|
|
2752
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2753
|
+
kind: z.ZodLiteral<"all-apps">;
|
|
2754
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2755
|
+
kind: z.ZodLiteral<"everyone">;
|
|
2756
|
+
}, z.core.$strict>], "kind">>;
|
|
2757
|
+
can: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodArray<z.ZodString>]>>;
|
|
2758
|
+
}, z.core.$strict>>;
|
|
2759
|
+
lockMeOut: z.ZodOptional<z.ZodBoolean>;
|
|
2638
2760
|
}, z.core.$strict>;
|
|
2639
2761
|
};
|
|
2640
2762
|
readonly updateGrant: {
|
|
@@ -2704,6 +2826,7 @@ declare const routes: {
|
|
|
2704
2826
|
kind: z.ZodLiteral<"everyone">;
|
|
2705
2827
|
}, z.core.$strict>], "kind">>>;
|
|
2706
2828
|
can: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodArray<z.ZodString>]>>>;
|
|
2829
|
+
lockMeOut: z.ZodOptional<z.ZodBoolean>;
|
|
2707
2830
|
}, z.core.$strict>;
|
|
2708
2831
|
};
|
|
2709
2832
|
/** Which grant decides a channel, for the caller or, with `manage` at `*`, a principal it names. */
|
|
@@ -2727,6 +2850,9 @@ declare const routes: {
|
|
|
2727
2850
|
readonly revokeGrant: {
|
|
2728
2851
|
readonly method: 'POST';
|
|
2729
2852
|
readonly path: '/grants/:id/revoke';
|
|
2853
|
+
readonly body: z.ZodOptional<z.ZodObject<{
|
|
2854
|
+
lockMeOut: z.ZodOptional<z.ZodBoolean>;
|
|
2855
|
+
}, z.core.$strict>>;
|
|
2730
2856
|
};
|
|
2731
2857
|
/** Every schema: the built-ins, then the board's own. Anyone the board lets in reads them. */
|
|
2732
2858
|
readonly schemas: {
|
|
@@ -3281,4 +3407,4 @@ declare const routes: {
|
|
|
3281
3407
|
};
|
|
3282
3408
|
type RouteName = keyof typeof routes;
|
|
3283
3409
|
//#endregion
|
|
3284
|
-
export {
|
|
3410
|
+
export { MessageView as $, TasksQueryInput as $t, FailTaskBody as A, Actor as An, SourceJoinBody as At, InboxEntry as B, Link as Bn, SyncImportBody as Bt, Discovery as C, PERMISSIONS as Cn, SchedulesQuery as Ct, EventsQueryInput as D, compileAccess as Dn, SchemaInput as Dt, EventsQuery as E, checkGrantChange as En, SchemaBody as Et, GrantInput as F, Labels as Fn, SyncCopiesQuery as Ft, LABEL_CONDITIONS_MAX as G, SyncedView as Gt, InboxNextQuery as H, SyncReceiptBody as Ht, GrantView as I, ExternalAuthor as In, SyncCopiesView as It, LinkView as J, TaskClaim as Jt, LEASE_DEFAULT_S as K, THREADS_LIMIT_DEFAULT as Kt, GrantWriteOptions as L, ExternalEvent as Ln, SyncFindInput as Lt, GRANT_BATCH_MAX as M, Attachment as Mn, SourceRead as Mt, GrantBody as N, Author as Nn, SourceReadQuery as Nt, ExplainQuery as O, parseCan as On, SchemaView as Ot, GrantCan as P, CAN_MAX as Pn, SyncBody as Pt, Me as Q, TasksQuery as Qt, INBOX_EVENT_ID_MAX as R, ExternalFile as Rn, SyncFindQuery as Rt, DeleteBody as S, Level as Sn, ScheduleView as St, EventsPage as T, WrittenCan as Tn, SchedulesQueryOutput as Tt, InboxPushBody as U, SyncReceiptInput as Ut, InboxItem as V, SyncImportInput as Vt, InboxQuery as W, SyncThreadView as Wt, MatchView as X, TaskView as Xt, LinkedQuery as Y, TaskNeedsBody as Yt, MatchesQuery as Z, TasksPage as Zt, CreateTaskBody as _, Grant as _n, RevokeGrantBody as _t, BlockTaskBody as a, TypingBody as an, PostInput as at, CreateTasksInput as b, GrantShape as bn, ScheduleBodyOutput as bt, CanAt as c, UpdateGrantInput as cn, REGISTERED_WATCHERS_MAX as ct, ClaimReadyTaskBody as d, routes as dn, RegisterBody as dt, ThreadSummaryView as en, MessagesPage as et, ClaimReadyTaskInput as f, Access as fn, RegisterInput as ft, CreateGrantsBody as g, FULL_ACCESS as gn, ResolvedSyncTarget as gt, CreateChannelBody as h, ChannelPattern as hn, RenewTaskBody as ht, AssignTaskBody as i, ThreadsQueryInput as in, PostBody as it, FiltersInput as j, ExternalCopy as jn, SourceMessage as jt, Explanation as k, union as kn, SourceJoin as kt, CancelTaskBody as l, UploadStartBody as ln, ReactBody as lt, CompleteTaskBody as m, Can as mn, ReleaseTaskBody as mt, ActorView as n, ThreadsPage as nn, MessagesQueryInput as nt, BlockView as o, TypingResult as on, PrincipalInput as ot, ClaimTaskBody as p, AccessSummary as pn, RegistrationView as pt, LabelBody as q, THREADS_LIMIT_MAX as qt, ApiError as r, ThreadsQuery as rn, ParsedFilters as rt, BoardEventView as s, UpdateGrantBody as sn, PrincipalView as st, AckBody as t, ThreadView as tn, MessagesQuery as tt, ChannelView as u, UploadTicket as un, Ref as ut, CreateTaskInput as v, GrantChange as vn, RouteName as vt, EditBody as w, Permission as wn, SchedulesQueryInput as wt, CreatedTasksQuery as x, InvalidCan as xn, ScheduleInput as xt, CreateTasksBody as y, GrantChangeRefusal as yn, ScheduleBody as yt, InboxAckBody as z, ExternalLink as zn, SyncFindView as zt };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as
|
|
3
|
-
import { a as Link, i as ExternalTarget, n as ExternalEvent, o as Origin, t as ExternalAuthor } from "./external-
|
|
1
|
+
import { a as DIRECT_UPLOAD_BYTES_MAX } from "./profile-header-Cj0Cb1cf.mjs";
|
|
2
|
+
import { C as SentTaskNote, M as platformAvatar, N as storable, S as SentTaskHoldKind, _ as NewLabels, c as EDITED_HOLD, d as LabelKey, f as LabelValue, g as MessageText, k as TaskState, l as Emoji, m as MESSAGE_TEXT_MAX, o as CHANNEL_PATTERN_MAX, p as Labels, r as AttachmentId, s as ChannelPath, t as ActorId, w as SentText } from "./schemas-CUSTEFIy.mjs";
|
|
3
|
+
import { a as Link, i as ExternalTarget, n as ExternalEvent, o as Origin, t as ExternalAuthor } from "./external-D2jq_DEQ.mjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
//#region src/api/routes.ts
|
|
6
6
|
/**
|
|
@@ -75,7 +75,7 @@ const PostBody = z.object({
|
|
|
75
75
|
re: Ref.optional(),
|
|
76
76
|
/** May be empty when the message has attachments. */
|
|
77
77
|
text: z.string().default(""),
|
|
78
|
-
labels:
|
|
78
|
+
labels: NewLabels.optional(),
|
|
79
79
|
noSync: z.boolean().optional(),
|
|
80
80
|
/**
|
|
81
81
|
* External targets a new thread starts with: `slack:#incidents`, `github:owner/repo:12`. The
|
|
@@ -110,7 +110,7 @@ const ScheduleBody = z.object({
|
|
|
110
110
|
channel: ChannelPath.optional(),
|
|
111
111
|
re: Ref.optional(),
|
|
112
112
|
text: z.string().default(""),
|
|
113
|
-
labels:
|
|
113
|
+
labels: NewLabels.optional(),
|
|
114
114
|
noSync: z.boolean().optional(),
|
|
115
115
|
attachments: z.array(AttachmentId).optional(),
|
|
116
116
|
in: Duration.optional(),
|
|
@@ -160,7 +160,7 @@ const CreateTaskBody = z.object({
|
|
|
160
160
|
re: Ref.optional(),
|
|
161
161
|
/** As long as a post's text may be: the backend says how long that is. */
|
|
162
162
|
text: z.string().optional(),
|
|
163
|
-
labels:
|
|
163
|
+
labels: NewLabels.optional(),
|
|
164
164
|
noSync: z.boolean().optional(),
|
|
165
165
|
/** IDs from `POST /attachments`, as a post takes them. */
|
|
166
166
|
attachments: z.array(AttachmentId).optional(),
|
|
@@ -197,7 +197,7 @@ const CreateTasksBody = z.object({
|
|
|
197
197
|
key: TaskKey.optional(),
|
|
198
198
|
/** May be empty when the task's root has attachments. As long as a post's text may be: the backend says how long that is. */
|
|
199
199
|
text: z.string(),
|
|
200
|
-
labels:
|
|
200
|
+
labels: NewLabels.optional(),
|
|
201
201
|
noSync: z.boolean().optional(),
|
|
202
202
|
/** IDs from `POST /attachments`, as a post takes them. */
|
|
203
203
|
attachments: z.array(AttachmentId).optional(),
|
|
@@ -328,11 +328,29 @@ const PrincipalInput = z.discriminatedUnion("kind", [
|
|
|
328
328
|
]);
|
|
329
329
|
/** What a grant lets its principals do: a map from channel pattern to `'all'` or a list, `[]` for none. Kept as written. */
|
|
330
330
|
const GrantCan = z.record(z.string().min(1).max(CHANNEL_PATTERN_MAX), CanGrant);
|
|
331
|
+
/**
|
|
332
|
+
* Says to go ahead with a grant change its caller couldn't take back: one that takes their own
|
|
333
|
+
* `manage` at a pattern it names, which is 409 `grant_lockout` without it.
|
|
334
|
+
*/
|
|
335
|
+
const LockMeOut = z.boolean().optional();
|
|
331
336
|
/** A grant: who it names, and one `can` for all of them. The same principals again are another grant. */
|
|
332
|
-
const
|
|
337
|
+
const GrantSpec = z.strictObject({
|
|
333
338
|
principals: z.array(PrincipalInput).min(1).max(32),
|
|
334
339
|
can: GrantCan
|
|
335
340
|
});
|
|
341
|
+
/** What `POST /grants` takes: a grant, and `lockMeOut` to make one its caller couldn't take back. */
|
|
342
|
+
const GrantBody = GrantSpec.extend({ lockMeOut: LockMeOut });
|
|
343
|
+
/**
|
|
344
|
+
* Several grants made in one write, all of them or none, judged together: each by the grants as
|
|
345
|
+
* they are, and what it leaves its caller with by the grants as they'd be with all of them. So a
|
|
346
|
+
* lock and the grant that keeps its maker in go in one request, in any order.
|
|
347
|
+
*/
|
|
348
|
+
const CreateGrantsBody = z.strictObject({
|
|
349
|
+
grants: z.array(GrantSpec).min(1).max(16),
|
|
350
|
+
lockMeOut: LockMeOut
|
|
351
|
+
});
|
|
352
|
+
/** What revoking a grant takes: nothing, or `lockMeOut`. */
|
|
353
|
+
const RevokeGrantBody = z.strictObject({ lockMeOut: LockMeOut }).optional();
|
|
336
354
|
/**
|
|
337
355
|
* Which grant decides a channel, and what it gives, for the caller or a principal it names: a
|
|
338
356
|
* `user` (by email, or by ID where the board can't look one up), a `project` in one `environment`
|
|
@@ -362,7 +380,8 @@ const ExplainQuery = z.object({
|
|
|
362
380
|
const UpdateGrantBody = z.strictObject({
|
|
363
381
|
add: z.array(PrincipalInput).min(1).max(32).optional(),
|
|
364
382
|
remove: z.array(PrincipalInput).min(1).max(32).optional(),
|
|
365
|
-
can: GrantCan.optional()
|
|
383
|
+
can: GrantCan.optional(),
|
|
384
|
+
lockMeOut: LockMeOut
|
|
366
385
|
}).refine((body) => body.add !== void 0 || body.remove !== void 0 || body.can !== void 0, "name principals to add or remove, or a can");
|
|
367
386
|
/**
|
|
368
387
|
* A schema version to register, for good: `name` and `version` are its ID (`sandbox@1`), and
|
|
@@ -498,7 +517,7 @@ const SyncImportBody = z.discriminatedUnion("op", [
|
|
|
498
517
|
channel: ChannelPath.optional(),
|
|
499
518
|
re: Ref.optional(),
|
|
500
519
|
text: z.string().max(MESSAGE_TEXT_MAX).default(""),
|
|
501
|
-
labels:
|
|
520
|
+
labels: NewLabels.optional(),
|
|
502
521
|
noSync: z.boolean().optional(),
|
|
503
522
|
attachments: z.array(AttachmentId).max(10).optional(),
|
|
504
523
|
links: z.array(ImportLink).max(10).optional(),
|
|
@@ -533,7 +552,7 @@ const SyncImportBody = z.discriminatedUnion("op", [
|
|
|
533
552
|
op: z.literal("labels"),
|
|
534
553
|
...Imported,
|
|
535
554
|
...Changed,
|
|
536
|
-
set:
|
|
555
|
+
set: NewLabels.optional(),
|
|
537
556
|
unset: z.array(LabelKey).optional(),
|
|
538
557
|
/** As a label write's: what the labels must be now, a value or null for none. */
|
|
539
558
|
if: z.record(LabelKey, LabelValue.nullable()).optional()
|
|
@@ -628,7 +647,7 @@ const ReactBody = z.object({
|
|
|
628
647
|
*/
|
|
629
648
|
const CreateChannelBody = z.strictObject({ path: ChannelPath });
|
|
630
649
|
const LabelBody = z.object({
|
|
631
|
-
set:
|
|
650
|
+
set: NewLabels.optional(),
|
|
632
651
|
unset: z.array(LabelKey).optional(),
|
|
633
652
|
/**
|
|
634
653
|
* What the message's labels must be now: a key's value, or null for one that mustn't be set.
|
|
@@ -838,6 +857,12 @@ const routes = {
|
|
|
838
857
|
path: "/grants",
|
|
839
858
|
body: GrantBody
|
|
840
859
|
},
|
|
860
|
+
/** Several grants in one write, all or none, judged together. */
|
|
861
|
+
createGrants: {
|
|
862
|
+
method: "POST",
|
|
863
|
+
path: "/grants/batch",
|
|
864
|
+
body: CreateGrantsBody
|
|
865
|
+
},
|
|
841
866
|
updateGrant: {
|
|
842
867
|
method: "PATCH",
|
|
843
868
|
path: "/grants/:id",
|
|
@@ -851,7 +876,8 @@ const routes = {
|
|
|
851
876
|
},
|
|
852
877
|
revokeGrant: {
|
|
853
878
|
method: "POST",
|
|
854
|
-
path: "/grants/:id/revoke"
|
|
879
|
+
path: "/grants/:id/revoke",
|
|
880
|
+
body: RevokeGrantBody
|
|
855
881
|
},
|
|
856
882
|
/** Every schema: the built-ins, then the board's own. Anyone the board lets in reads them. */
|
|
857
883
|
schemas: {
|
|
@@ -1005,4 +1031,4 @@ const routes = {
|
|
|
1005
1031
|
}
|
|
1006
1032
|
};
|
|
1007
1033
|
//#endregion
|
|
1008
|
-
export {
|
|
1034
|
+
export { Ref as A, SyncBody as B, InboxQuery as C, MessagesQuery as D, MatchesQuery as E, ScheduleBody as F, TaskNeedsBody as G, SyncFindQuery as H, SchedulesQuery as I, TypingBody as J, TasksQuery as K, SchemaBody as L, ReleaseTaskBody as M, RenewTaskBody as N, PostBody as O, RevokeGrantBody as P, SourceJoinBody as R, InboxPushBody as S, LinkedQuery as T, SyncImportBody as U, SyncCopiesQuery as V, SyncReceiptBody as W, UploadStartBody as X, UpdateGrantBody as Y, routes as Z, FailTaskBody as _, ClaimReadyTaskBody as a, InboxAckBody as b, CreateChannelBody as c, CreateTasksBody as d, CreatedTasksQuery as f, ExplainQuery as g, EventsQuery as h, CancelTaskBody as i, RegisterBody as j, ReactBody as k, CreateGrantsBody as l, EditBody as m, AssignTaskBody as n, ClaimTaskBody as o, DeleteBody as p, ThreadsQuery as q, BlockTaskBody as r, CompleteTaskBody as s, AckBody as t, CreateTaskBody as u, Filters as v, LabelBody as w, InboxNextQuery as x, GrantBody as y, SourceReadQuery as z };
|
|
@@ -34,9 +34,17 @@ const MessageId = z.number().int().positive();
|
|
|
34
34
|
*/
|
|
35
35
|
const INHERITED = /* @__PURE__ */ new Set([...Object.getOwnPropertyNames(Object.prototype), "prototype"]);
|
|
36
36
|
const notInherited = (name) => !INHERITED.has(name);
|
|
37
|
-
|
|
38
|
-
const
|
|
37
|
+
/** What a refused key is told: the key itself, and the rule, so the next try needn't guess it. */
|
|
38
|
+
const notALabelKey = (issue) => `${JSON.stringify(String(issue.input))} isn't a label key: one is 1 to 64 lowercase letters, numbers, ., _, and -, starting with a letter or number`;
|
|
39
|
+
const LabelKey = z.string().max(64, { error: notALabelKey }).regex(/^[a-z0-9][a-z0-9_.-]*$/, { error: notALabelKey }).refine(notInherited, "label key is a reserved name");
|
|
40
|
+
const LabelValue = z.string().max(256, { error: (issue) => `a label value is at most 256 characters, and this one has ${String(issue.input).length}` }).refine(storable, "label value has a NUL character or a lone surrogate");
|
|
39
41
|
const Labels = z.record(LabelKey, LabelValue);
|
|
42
|
+
/**
|
|
43
|
+
* A label value as a write sets it: no control characters either, so a value can't break the line
|
|
44
|
+
* a reader shows it on (`vb read` prints labels inline). Labels already in a log keep what they have.
|
|
45
|
+
*/
|
|
46
|
+
const NewLabelValue = LabelValue.refine((value) => !/\p{Cc}/u.test(value), "label value has a control character");
|
|
47
|
+
const NewLabels = z.record(LabelKey, NewLabelValue);
|
|
40
48
|
/** Normalized short names, as Chat SDK names them: `eyes`, `check`, `thumbs_up`. */
|
|
41
49
|
const Emoji = z.string().max(64).regex(/^[a-z0-9_+-]+$/, "invalid emoji name").refine(notInherited, "emoji name is a reserved name");
|
|
42
50
|
/** `vercel:user:u_abc123`, or `vercel:user:u_abc123+claude` for a profile. */
|
|
@@ -113,4 +121,4 @@ const TaskHoldKind = z.string().regex(/^[a-z0-9][a-z0-9_.-]{0,63}$/, "a kind is
|
|
|
113
121
|
/** A registered watcher's ID: a profile name, since its writes are by that profile. */
|
|
114
122
|
const RemoteWatcherId = z.string().regex(/^[A-Za-z][A-Za-z0-9-]{0,31}$/, "ids start with a letter and use up to 32 letters, numbers, and hyphens");
|
|
115
123
|
//#endregion
|
|
116
|
-
export {
|
|
124
|
+
export { actorKind as A, SentTaskNote as C, TaskHoldKind as D, TASK_NOTE_MAX as E, platformAvatar as M, storable as N, TaskNote as O, toStorable as P, SentTaskHoldKind as S, TASK_LABEL as T, NewLabels as _, CAN_MAX as a, RemoteWatcherId as b, EDITED_HOLD as c, LabelKey as d, LabelValue as f, MessageText as g, MessageId as h, Author as i, authorView as j, TaskState as k, Emoji as l, MESSAGE_TEXT_MAX as m, Attachment as n, CHANNEL_PATTERN_MAX as o, Labels as p, AttachmentId as r, ChannelPath as s, ActorId as t, Handle as u, OPEN_TASK_STATES as v, SentText as w, SeenActorKind as x, RESERVED_LABEL_PREFIX as y };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { f as BoardError, p as createBoardClient, t as HttpError } from "./errors-
|
|
2
|
-
import { i as LOGINS, r as LOGIN } from "./auth-
|
|
3
|
-
import {
|
|
4
|
-
import { t as oidcTokens } from "./tokens-
|
|
5
|
-
import { t as local } from "./local-
|
|
1
|
+
import { f as BoardError, p as createBoardClient, t as HttpError } from "./errors-DYF4hhIc.mjs";
|
|
2
|
+
import { i as LOGINS, r as LOGIN } from "./auth-DJDTfgAL.mjs";
|
|
3
|
+
import { h as localTokenFile, t as board } from "./server-ViWNvg5q.mjs";
|
|
4
|
+
import { t as oidcTokens } from "./tokens-C-iK0Cku.mjs";
|
|
5
|
+
import { t as local } from "./local-BVSFSSYf.mjs";
|
|
6
6
|
import { mkdir, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
7
7
|
import { userInfo } from "node:os";
|
|
8
8
|
import { dirname, join, resolve } from "node:path";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./schemas-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { n as formatProfileHeader } from "./profile-header-Cj0Cb1cf.mjs";
|
|
2
|
+
import "./schemas-CUSTEFIy.mjs";
|
|
3
|
+
import { Z as routes } from "./routes-BE0y6wCk.mjs";
|
|
4
|
+
import { f as BoardError, p as createBoardClient, t as HttpError } from "./errors-DYF4hhIc.mjs";
|
|
5
|
+
import { g as keyId, p as DERIVED_ID } from "./middleware-DUKIITFZ.mjs";
|
|
6
|
+
import { l as METHODS, o as compileWatcher } from "./task-batch-9lVDG3d-.mjs";
|
|
7
|
+
import { c as PROTOCOL_ROUTES, d as deployedOnVercel, l as withoutToken, o as createVercel, r as createBoard, u as tailWatchers } from "./exports-CuD-Mxkw.mjs";
|
|
7
8
|
import { execFile } from "node:child_process";
|
|
8
9
|
import { createHash } from "node:crypto";
|
|
9
10
|
import { mkdir, readFile, readdir, stat, unlink, writeFile } from "node:fs/promises";
|
|
@@ -140,10 +141,11 @@ function handFetch(send) {
|
|
|
140
141
|
}
|
|
141
142
|
/**
|
|
142
143
|
* A request to Vercel's API as you: through the fetch the CLI that runs board's hands it with its
|
|
143
|
-
* login, which adds its credentials, or with `login` as a Bearer token, through `send`.
|
|
144
|
+
* login, which adds its credentials, or with `login` as a Bearer token, through `send`. A token
|
|
145
|
+
* the run was passed goes as a Bearer token always: the app's fetch would add its own login's.
|
|
144
146
|
*/
|
|
145
147
|
function asYou(input, init, login, send = fetch) {
|
|
146
|
-
if (handedFetch && loginHanded()) return handedFetch(input, init);
|
|
148
|
+
if (passed === null && handedFetch && loginHanded()) return handedFetch(input, init);
|
|
147
149
|
const headers = new Headers(input instanceof Request ? input.headers : void 0);
|
|
148
150
|
new Headers(init.headers).forEach((value, name) => headers.set(name, value));
|
|
149
151
|
headers.set("authorization", `Bearer ${login}`);
|
|
@@ -152,13 +154,28 @@ function asYou(input, init, login, send = fetch) {
|
|
|
152
154
|
headers
|
|
153
155
|
});
|
|
154
156
|
}
|
|
155
|
-
/**
|
|
156
|
-
|
|
157
|
+
/** The token someone passed the CLI that runs board's for this run (`vercel board --token`), while there is one. */
|
|
158
|
+
let passed = null;
|
|
159
|
+
/** Where `vb whoami` says a passed token came from. */
|
|
160
|
+
const PASSED = "the token you passed";
|
|
157
161
|
/**
|
|
158
|
-
*
|
|
159
|
-
*
|
|
162
|
+
* Hands board the token someone passed the CLI that runs it, as `vercel board --token` does: the
|
|
163
|
+
* Vercel login for this run, ahead of everything the environment holds, a deployment's own token
|
|
164
|
+
* and `BOARD_TOKEN` included. Whoever passed it said who to be, which no variable does. Board
|
|
165
|
+
* sends it itself, as a Bearer token, never through a handed fetch. Null takes it back.
|
|
160
166
|
*/
|
|
161
|
-
|
|
167
|
+
function handToken(token) {
|
|
168
|
+
passed = token;
|
|
169
|
+
}
|
|
170
|
+
/** The token this run was passed, or null. */
|
|
171
|
+
const passedToken = () => passed;
|
|
172
|
+
/** Whether the login is one a CLI handed over (`createApp`'s `token` or `login`, or `VERCEL_AUTH_TOKEN`). */
|
|
173
|
+
const loginHanded = () => passed !== null || handed$1 !== null || !!process.env.VERCEL_AUTH_TOKEN;
|
|
174
|
+
/**
|
|
175
|
+
* Your Vercel login: what the CLI that runs board's hands it, as `vercel board` does (the token
|
|
176
|
+
* it was passed, its `login`, or `VERCEL_AUTH_TOKEN`), or else what `vercel login` saved.
|
|
177
|
+
*/
|
|
178
|
+
const vercelLogin = () => passed !== null ? Promise.resolve(passed) : handed$1 ? handed$1() : process.env.VERCEL_AUTH_TOKEN ? Promise.resolve(process.env.VERCEL_AUTH_TOKEN) : getVercelToken();
|
|
162
179
|
/**
|
|
163
180
|
* A handed login's token, which its tokens for boards are cached by: null for `vercel login`'s own. One
|
|
164
181
|
* that fails fails the request: `vercel login`'s, cached or in the `vercel` on PATH, can be someone
|
|
@@ -264,8 +281,9 @@ function boardUrl() {
|
|
|
264
281
|
}
|
|
265
282
|
/**
|
|
266
283
|
* How a client reaches the board at `url` from Node: through Deployment Protection, with a token
|
|
267
|
-
* from `token`,
|
|
268
|
-
*
|
|
284
|
+
* from `token`, the login a CLI that runs board's was passed (`handToken`), `BOARD_TOKEN`, a local
|
|
285
|
+
* board's token file (`vb serve`), GitHub Actions, the Vercel runtime, or your Vercel CLI login,
|
|
286
|
+
* in that order. Who you are is the token's to say: the board
|
|
269
287
|
* names you from what it verifies. A board with no Vercel project has no token for your login to
|
|
270
288
|
* mint, so a request goes to it with none: what verifies its callers may know you another way, as
|
|
271
289
|
* a board behind `tailscale serve` does.
|
|
@@ -286,6 +304,15 @@ function connect(url, options = {}) {
|
|
|
286
304
|
let cached = null;
|
|
287
305
|
let source = null;
|
|
288
306
|
let person = null;
|
|
307
|
+
/** A token minted with your Vercel login, which `from` names. */
|
|
308
|
+
const asPerson = async (discovered, from) => {
|
|
309
|
+
person ??= personToken(url, discovered).finally(() => {
|
|
310
|
+
person = null;
|
|
311
|
+
});
|
|
312
|
+
const minted = await person;
|
|
313
|
+
source = from;
|
|
314
|
+
return minted;
|
|
315
|
+
};
|
|
289
316
|
const mint = async () => {
|
|
290
317
|
if (options.token !== void 0) {
|
|
291
318
|
const token = typeof options.token === "function" ? await options.token() : options.token;
|
|
@@ -294,6 +321,10 @@ function connect(url, options = {}) {
|
|
|
294
321
|
expiresAt: expiry(token)
|
|
295
322
|
};
|
|
296
323
|
}
|
|
324
|
+
if (passed !== null) {
|
|
325
|
+
const discovered = await discover();
|
|
326
|
+
if (discovered.project_id) return asPerson(discovered, PASSED);
|
|
327
|
+
}
|
|
297
328
|
if (process.env.BOARD_TOKEN) {
|
|
298
329
|
const token = process.env.BOARD_TOKEN;
|
|
299
330
|
source = "BOARD_TOKEN";
|
|
@@ -331,12 +362,7 @@ function connect(url, options = {}) {
|
|
|
331
362
|
token: null,
|
|
332
363
|
expiresAt: Date.now() + 3e5
|
|
333
364
|
};
|
|
334
|
-
|
|
335
|
-
person = null;
|
|
336
|
-
});
|
|
337
|
-
const minted = await person;
|
|
338
|
-
source = "vercel login";
|
|
339
|
-
return minted;
|
|
365
|
+
return asPerson(discovered, "vercel login");
|
|
340
366
|
};
|
|
341
367
|
const token = async () => {
|
|
342
368
|
if (options.token !== void 0 || !cached || cached.expiresAt - 6e4 < Date.now()) cached = await mint();
|
|
@@ -659,7 +685,8 @@ const describe = (error) => ((error instanceof Error ? error.message : String(er
|
|
|
659
685
|
const rethrow = (error) => {
|
|
660
686
|
if (error instanceof BoardError) throw new HttpError(error.status >= 400 ? error.status : 502, error.code, error.message, {
|
|
661
687
|
...error.hint !== void 0 ? { hint: error.hint } : {},
|
|
662
|
-
origin: error.origin
|
|
688
|
+
origin: error.origin,
|
|
689
|
+
...error.retryAfter !== void 0 ? { retryAfter: error.retryAfter } : {}
|
|
663
690
|
});
|
|
664
691
|
if (error instanceof HttpError || error instanceof Error && error.name === "AbortError") throw error;
|
|
665
692
|
throw new HttpError(502, "unreachable", `the board didn't answer: ${describe(error)}`);
|
|
@@ -918,12 +945,16 @@ function http(url, options = {}) {
|
|
|
918
945
|
const deployed = () => process.env.VERCEL === "1" || !!process.env.VERCEL_OIDC_TOKEN;
|
|
919
946
|
/** Off a deployment, a credential Vercel's API takes, set for board: what a sandbox or CI passes. */
|
|
920
947
|
const boardToken = () => deployed() ? null : process.env.BOARD_TOKEN || null;
|
|
948
|
+
/** Whether what goes is a Vercel login: a token passed for this run, or with no deployment's token and no `BOARD_TOKEN`, yours. */
|
|
949
|
+
const asLogin = () => passedToken() !== null || !deployed() && !boardToken();
|
|
921
950
|
/**
|
|
922
|
-
* A token Vercel's API takes: this
|
|
923
|
-
* login, the one the CLI that runs
|
|
924
|
-
* your `vercel login`.
|
|
951
|
+
* A token Vercel's API takes: the one this run was passed (`vercel board --token`), or else this
|
|
952
|
+
* deployment's OIDC token, or else `BOARD_TOKEN`, or your Vercel login, the one the CLI that runs
|
|
953
|
+
* board's hands it (`vercel board`'s, or `VERCEL_AUTH_TOKEN`) or your `vercel login`.
|
|
925
954
|
*/
|
|
926
955
|
async function token() {
|
|
956
|
+
const passed = passedToken();
|
|
957
|
+
if (passed !== null) return passed;
|
|
927
958
|
if (deployed()) return getVercelOidcToken();
|
|
928
959
|
const set = boardToken();
|
|
929
960
|
if (set) return set;
|
|
@@ -936,6 +967,7 @@ async function token() {
|
|
|
936
967
|
}
|
|
937
968
|
/** Where `token` comes from, in words: what `vb whoami` says. */
|
|
938
969
|
function credentialSource() {
|
|
970
|
+
if (passedToken() !== null) return PASSED;
|
|
939
971
|
if (deployed()) return "Vercel OIDC";
|
|
940
972
|
if (boardToken()) return "BOARD_TOKEN";
|
|
941
973
|
return loginHanded() ? "the Vercel CLI" : "vercel login";
|
|
@@ -976,7 +1008,7 @@ async function team() {
|
|
|
976
1008
|
const environment = {
|
|
977
1009
|
fetch: () => async (input, init = {}) => {
|
|
978
1010
|
const credential = await token();
|
|
979
|
-
if (
|
|
1011
|
+
if (asLogin()) return asYou(input, init, credential);
|
|
980
1012
|
const headers = new Headers(init.headers);
|
|
981
1013
|
headers.set("authorization", `Bearer ${credential}`);
|
|
982
1014
|
return globalThis.fetch(input, {
|
|
@@ -1008,10 +1040,10 @@ function vercel(options = {}) {
|
|
|
1008
1040
|
function board(options = {}) {
|
|
1009
1041
|
return createBoard(options, {
|
|
1010
1042
|
backend: (fetch) => process.env.BOARD_URL?.trim() ? http() : vercel(fetch ? { fetch } : {}),
|
|
1011
|
-
sync: () => import("./engine-
|
|
1012
|
-
serving: () => import("./serving-
|
|
1043
|
+
sync: () => import("./engine-DJZ8Xy_g.mjs"),
|
|
1044
|
+
serving: () => import("./serving-SbqeWqlA.mjs"),
|
|
1013
1045
|
sandbox: (url, token) => sandboxHeaders(url, url, token)
|
|
1014
1046
|
});
|
|
1015
1047
|
}
|
|
1016
1048
|
//#endregion
|
|
1017
|
-
export { vercel as a,
|
|
1049
|
+
export { vercelProjectFile as _, vercel as a, boardUrl as c, environmentProfile as d, handFetch as f, projectDir as g, localTokenFile as h, handTeam as i, configDir as l, handToken as m, credentialSource as n, http as o, handLogin as p, credentialed as r, PASSED as s, board as t, connect as u };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as ownTeamId, n as discoveryIdentity, r as ownProjectId, t as oidcTokens } from "./tokens-
|
|
1
|
+
import { i as ownTeamId, n as discoveryIdentity, r as ownProjectId, t as oidcTokens } from "./tokens-C-iK0Cku.mjs";
|
|
2
2
|
export { discoveryIdentity, oidcTokens, ownProjectId, ownTeamId };
|