@vibes.diy/api-types 2.0.0-dev-cli-e → 2.0.0-dev-cli-g

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/msg-types.js DELETED
@@ -1,1089 +0,0 @@
1
- import { type } from "arktype";
2
- import { fileSystemItem, MetaItem } from "./types.js";
3
- import { BlockMsgs, CoercedDate, FileSystemRef, LLMRequest, PromptMsgs } from "@vibes.diy/call-ai-v2";
4
- import { AIParams, ActiveEntry, EnablePublicAccess, EnableRequest, ActiveACL, KVString } from "./invite.js";
5
- export const ClerkClaimParams = type({
6
- "nick?": "string",
7
- email: "string",
8
- email_verified: "boolean",
9
- "external_id?": "string | null",
10
- first: "string",
11
- image_url: "string",
12
- last: "string",
13
- name: "string | null",
14
- public_meta: "unknown",
15
- });
16
- export const ClerkClaim = type({
17
- "azp?": "string",
18
- "exp?": "number",
19
- "iat?": "number",
20
- "iss?": "string",
21
- "jti?": "string",
22
- "nbf?": "number",
23
- params: ClerkClaimParams,
24
- role: "string",
25
- sub: "string",
26
- userId: "string",
27
- "aud?": "string | string[]",
28
- "app_metadata?": "unknown",
29
- });
30
- export const FPCloudClaim = type({
31
- "azp?": "string",
32
- "iss?": "string",
33
- "sub?": "string",
34
- "aud?": "string | string[]",
35
- "exp?": "number",
36
- "nbf?": "number",
37
- "iat?": "number",
38
- "jti?": "string",
39
- userId: "string",
40
- email: "string.email",
41
- "nickname?": "string",
42
- "provider?": "'github' | 'google'",
43
- created: type("number | string").pipe((v) => new Date(v)),
44
- tenants: type({
45
- id: "string",
46
- role: "'admin' | 'member' | 'owner'",
47
- }).array(),
48
- ledgers: type({
49
- id: "string",
50
- role: "'admin' | 'member' | 'owner'",
51
- right: "'read' | 'write'",
52
- }).array(),
53
- selected: {
54
- "appId?": "string",
55
- tenant: "string",
56
- ledger: "string",
57
- },
58
- });
59
- export const dashAuthType = type({
60
- type: "'clerk'|'device-id'|'ucan'",
61
- token: "string",
62
- });
63
- export const vibeUserEnv = type("Record<string, string>");
64
- const baseFileProps = type({
65
- filename: type("string").narrow((s) => {
66
- if (!s.startsWith("/"))
67
- return false;
68
- if (s.includes("//"))
69
- return false;
70
- if (s.includes("/../"))
71
- return false;
72
- if (s.includes("/./"))
73
- return false;
74
- return true;
75
- }),
76
- "entryPoint?": "boolean",
77
- "mimetype?": "string",
78
- });
79
- export const VibeCodeBlock = type({
80
- type: "'code-block'",
81
- lang: "string",
82
- content: "string",
83
- }).and(baseFileProps);
84
- export function isVibeCodeBlock(obj) {
85
- return !(VibeCodeBlock(obj) instanceof type.errors);
86
- }
87
- export const VibeCodeRef = type({
88
- type: "'code-ref'",
89
- refId: "string",
90
- }).and(baseFileProps);
91
- export const VibeStrAssetBlock = type({
92
- type: "'str-asset-block'",
93
- content: "string",
94
- }).and(baseFileProps);
95
- export const VibeStrAssetRef = type({
96
- type: "'str-asset-ref'",
97
- refId: "string",
98
- }).and(baseFileProps);
99
- export const VibeUint8AssetBlock = type({
100
- type: "'uint8-asset-block'",
101
- content: type.instanceOf(Uint8Array),
102
- }).and(baseFileProps);
103
- export const VibeUint8AssetRef = type({
104
- type: "'uint8-asset-ref'",
105
- refId: "string",
106
- }).and(baseFileProps);
107
- export const vibeFile = type(VibeCodeBlock.or(VibeCodeRef).or(VibeStrAssetBlock).or(VibeStrAssetRef).or(VibeUint8AssetBlock).or(VibeUint8AssetRef));
108
- export const reqOpenChat = type({
109
- type: "'vibes.diy.req-open-chat'",
110
- auth: dashAuthType,
111
- "appSlug?": "string",
112
- "userSlug?": "string",
113
- "chatId?": "string",
114
- mode: "'creation'|'application'",
115
- });
116
- export const resOpenChat = type({
117
- type: "'vibes.diy.res-open-chat'",
118
- appSlug: "string",
119
- userSlug: "string",
120
- chatId: "string",
121
- mode: "'creation'|'application'",
122
- });
123
- export function isResOpenChat(obj) {
124
- return !(resOpenChat(obj) instanceof type.errors);
125
- }
126
- export const resError = type({
127
- type: "'vibes.diy.error'",
128
- message: "string",
129
- "code?": "string",
130
- "stack?": "string[]",
131
- });
132
- export const reqCreationPromptChatSection = type({
133
- type: "'vibes.diy.req-prompt-chat-section'",
134
- mode: "'creation'",
135
- auth: dashAuthType,
136
- chatId: "string",
137
- outerTid: "string",
138
- prompt: LLMRequest,
139
- });
140
- export function isReqCreationPromptChatSection(obj) {
141
- return !(reqCreationPromptChatSection(obj) instanceof type.errors);
142
- }
143
- export const reqPromptApplicationChatSection = type({
144
- type: "'vibes.diy.req-prompt-chat-section'",
145
- mode: "'application'",
146
- auth: dashAuthType,
147
- chatId: "string",
148
- outerTid: "string",
149
- prompt: LLMRequest,
150
- });
151
- export function isReqPromptApplicationChatSection(obj) {
152
- return !(reqPromptApplicationChatSection(obj) instanceof type.errors);
153
- }
154
- export const reqPromptChatSection = reqCreationPromptChatSection.or(reqPromptApplicationChatSection);
155
- export const resPromptChatSection = type({
156
- type: "'vibes.diy.res-prompt-chat-section'",
157
- mode: "'creation'|'application'",
158
- chatId: "string",
159
- userSlug: "string",
160
- appSlug: "string",
161
- promptId: "string",
162
- outerTid: "string",
163
- });
164
- export function isResPromptChatSection(obj) {
165
- return !(resPromptChatSection(obj) instanceof type.errors);
166
- }
167
- export const reqAddFS = type({
168
- type: "'vibes.diy.req-add-fs'",
169
- auth: dashAuthType,
170
- chatId: "string",
171
- outerTid: "string",
172
- fs: [vibeFile, "[]"],
173
- });
174
- export function isReqAddFS(obj) {
175
- return !(reqAddFS(obj) instanceof type.errors);
176
- }
177
- export const resAddFS = type({
178
- type: "'vibes.diy.res-add-fs'",
179
- chatId: "string",
180
- outerTid: "string",
181
- }).and(FileSystemRef);
182
- export function isResAddFS(obj) {
183
- return !(resAddFS(obj) instanceof type.errors);
184
- }
185
- export const PromptAndBlockMsgs = PromptMsgs.or(BlockMsgs);
186
- export const sectionEvent = type({
187
- type: "'vibes.diy.section-event'",
188
- chatId: "string",
189
- promptId: "string",
190
- blockSeq: "number",
191
- timestamp: CoercedDate,
192
- blocks: [PromptAndBlockMsgs, "[]"],
193
- });
194
- export function isSectionEvent(obj) {
195
- return !(sectionEvent(obj) instanceof type.errors);
196
- }
197
- export const FSMode = type("'production'|'dev'");
198
- export const AppSlugUserSlug = type({
199
- appSlug: "string",
200
- userSlug: "string",
201
- });
202
- export const OptAppSlugUserSlug = type({
203
- "appSlug?": "string",
204
- userSlug: "string",
205
- });
206
- export const AppSlugOptUserSlug = type({
207
- appSlug: "string",
208
- "userSlug?": "string",
209
- });
210
- export const OptAppSlugOptUserSlug = type({
211
- "appSlug?": "string",
212
- "userSlug?": "string",
213
- });
214
- export const NeedOneAppSlugUserSlug = AppSlugUserSlug.or(OptAppSlugUserSlug).or(AppSlugOptUserSlug).or(OptAppSlugOptUserSlug);
215
- export const ReqEnsureAppSlug = type({
216
- type: "'vibes.diy.req-ensure-app-slug'",
217
- auth: dashAuthType,
218
- mode: FSMode,
219
- "env?": vibeUserEnv,
220
- fileSystem: [vibeFile, "[]"],
221
- }).and(NeedOneAppSlugUserSlug);
222
- export const resEnsureAppSlugOk = type({
223
- type: "'vibes.diy.res-ensure-app-slug'",
224
- env: vibeUserEnv,
225
- fileSystem: [fileSystemItem, "[]"],
226
- }).and(FileSystemRef);
227
- export const resEnsureAppSlugRequireLogin = type({
228
- type: "'vibes.diy.error'",
229
- message: "string",
230
- code: "'require-login'",
231
- "stack?": "string[]",
232
- });
233
- export function isResEnsureAppSlugOk(obj) {
234
- return !(resEnsureAppSlugOk(obj) instanceof type.errors);
235
- }
236
- export const resEnsureAppSlugUserSlugInvalid = type({
237
- type: "'vibes.diy.error'",
238
- message: "string",
239
- code: "'user-slug-invalid'",
240
- "stack?": "string[]",
241
- });
242
- export function isResEnsureAppSlugUserSlugInvalid(obj) {
243
- return !(resEnsureAppSlugUserSlugInvalid(obj) instanceof type.errors);
244
- }
245
- export const resEnsureAppSlugInvalid = type({
246
- type: "'vibes.diy.error'",
247
- message: "string",
248
- code: "'app-slug-invalid'",
249
- "stack?": "string[]",
250
- });
251
- export function isResEnsureAppSlugInvalid(obj) {
252
- return !(resEnsureAppSlugInvalid(obj) instanceof type.errors);
253
- }
254
- export const resEnsureAppSlugError = resEnsureAppSlugRequireLogin.or(resEnsureAppSlugUserSlugInvalid).or(resEnsureAppSlugInvalid);
255
- export const resEnsureAppSlug = resEnsureAppSlugOk.or(resEnsureAppSlugError);
256
- export function isResEnsureAppSlug(obj) {
257
- return !(resEnsureAppSlug(obj) instanceof type.errors);
258
- }
259
- export const reqGetChatDetails = type({
260
- type: "'vibes.diy.req-get-chat-details'",
261
- auth: dashAuthType,
262
- userSlug: "string",
263
- appSlug: "string",
264
- });
265
- export const resChatDetailsPrompt = type({
266
- prompt: "string",
267
- fsId: "string",
268
- created: "string",
269
- });
270
- export const resGetChatDetails = type({
271
- type: "'vibes.diy.res-get-chat-details'",
272
- chatId: "string",
273
- userSlug: "string",
274
- appSlug: "string",
275
- prompts: resChatDetailsPrompt.array(),
276
- });
277
- export function isResGetChatDetails(obj) {
278
- return !(resGetChatDetails(obj) instanceof type.errors);
279
- }
280
- export const reqGetAppByFsId = type({
281
- type: "'vibes.diy.req-get-app-by-fsid'",
282
- "auth?": dashAuthType,
283
- "fsId?": "string",
284
- appSlug: "string",
285
- userSlug: "string",
286
- "token?": "string",
287
- });
288
- export function isReqGetAppByFsId(obj) {
289
- return !(reqGetAppByFsId(obj) instanceof type.errors);
290
- }
291
- export const resGetAppByFsId = type({
292
- type: "'vibes.diy.res-get-app-by-fsid'",
293
- "error?": "string",
294
- appSlug: "string",
295
- userSlug: "string",
296
- "fsId?": "string",
297
- mode: "'production'|'dev'",
298
- grant: "'revoked-access'|'pending-request'| 'granted-access.editor'|'granted-access.viewer'|'owner'|'not-found'|'not-grant'|'public-access'|'accepted-email-invite'|'req-login.invite'|'req-login.request'",
299
- releaseSeq: "number",
300
- env: vibeUserEnv,
301
- fileSystem: [fileSystemItem, "[]"],
302
- meta: MetaItem.array(),
303
- created: "string",
304
- });
305
- export function isResGetAppByFsId(obj) {
306
- return !(resGetAppByFsId(obj) instanceof type.errors);
307
- }
308
- export const reqGetByUserSlugAppSlug = type({
309
- type: "'vibes.diy.req-get-by-user-slug-app-slug'",
310
- auth: dashAuthType,
311
- userSlug: "string",
312
- appSlug: "string",
313
- });
314
- export const reqListUserSlugAppSlug = type({
315
- type: "'vibes.diy.req-list-user-slug-app-slug'",
316
- auth: dashAuthType,
317
- "userSlug?": "string",
318
- "appSlug?": "string",
319
- });
320
- export function isReqListUserSlugAppSlug(obj) {
321
- return !(reqListUserSlugAppSlug(obj) instanceof type.errors);
322
- }
323
- export const resListUserSlugAppSlugItem = type({
324
- userId: "string",
325
- userSlug: "string",
326
- appSlugs: type("string").array(),
327
- });
328
- export const resListUserSlugAppSlug = type({
329
- type: "'vibes.diy.res-list-user-slug-app-slug'",
330
- items: resListUserSlugAppSlugItem.array(),
331
- });
332
- export function isResListUserSlugAppSlug(obj) {
333
- return !(resListUserSlugAppSlug(obj) instanceof type.errors);
334
- }
335
- export function isReqGetByUserSlugAppSlug(obj) {
336
- return !(reqGetByUserSlugAppSlug(obj) instanceof type.errors);
337
- }
338
- export const resGetByUserSlugAppSlug = type({
339
- type: "'vibes.diy.res-get-by-user-slug-app-slug'",
340
- }).and(FileSystemRef);
341
- export function isResGetByUserSlugAppSlug(obj) {
342
- const res = resGetByUserSlugAppSlug(obj);
343
- if (res instanceof type.errors) {
344
- console.error(`Invalid resGetByUserSlugAppSlug:`, obj, res.summary);
345
- }
346
- return !(resGetByUserSlugAppSlug(obj) instanceof type.errors);
347
- }
348
- export const msgBase = type({
349
- tid: "string",
350
- src: "string",
351
- dst: "string",
352
- ttl: "number",
353
- payload: "unknown",
354
- });
355
- export function isMsgBase(obj) {
356
- return !(msgBase(obj) instanceof type.errors);
357
- }
358
- export const w3cMessageEventBox = type({
359
- type: "'MessageEvent'",
360
- event: type({
361
- data: "unknown",
362
- origin: "string|null",
363
- lastEventId: "string",
364
- source: "unknown",
365
- ports: "unknown",
366
- }).partial(),
367
- });
368
- export const w3cCloseEventBox = type({
369
- type: "'CloseEvent'",
370
- event: type({
371
- wasClean: "boolean",
372
- code: "number",
373
- reason: "string",
374
- }),
375
- });
376
- export const w3cErrorEventBox = type({
377
- type: "'ErrorEvent'",
378
- event: type({
379
- message: "string",
380
- filename: "string",
381
- lineno: "number",
382
- colno: "number",
383
- error: "unknown",
384
- }).partial(),
385
- });
386
- export const w3CWebSocketEvent = w3cMessageEventBox.or(w3cCloseEventBox).or(w3cErrorEventBox);
387
- export const userSettingShareing = type({
388
- type: "'sharing'",
389
- grants: type({
390
- grant: "'allow' | 'deny'",
391
- appSlug: "string",
392
- userSlug: "string",
393
- dbName: "string",
394
- }).array(),
395
- });
396
- export function isUserSettingSharing(obj) {
397
- return !(userSettingShareing(obj) instanceof type.errors);
398
- }
399
- export const userSettingItem = userSettingShareing;
400
- export const reqEnsureUserSettings = type({
401
- type: "'vibes.diy.req-ensure-user-settings'",
402
- auth: dashAuthType,
403
- settings: userSettingItem.array(),
404
- });
405
- export const resEnsureUserSettings = type({
406
- type: "'vibes.diy.res-ensure-user-settings'",
407
- userId: "string",
408
- settings: userSettingItem.array(),
409
- updated: "string",
410
- created: "string",
411
- });
412
- export function isResEnsureUserSettings(obj) {
413
- return !(resEnsureUserSettings(obj) instanceof type.errors);
414
- }
415
- export const reqEnsureAppSettingsBase = type({
416
- type: "'vibes.diy.req-ensure-app-settings'",
417
- "auth?": dashAuthType,
418
- appSlug: "string",
419
- userSlug: "string",
420
- });
421
- export function isReqEnsureAppSettingsBase(obj) {
422
- return !(reqEnsureAppSettingsBase(obj) instanceof type.errors);
423
- }
424
- export const reqEnsureAppSettingsAcl = type({
425
- aclEntry: type({
426
- entry: ActiveACL,
427
- op: "'delete' | 'upsert'",
428
- }),
429
- }).and(reqEnsureAppSettingsBase);
430
- export function isReqEnsureAppSettingsAcl(obj) {
431
- return !(reqEnsureAppSettingsAcl(obj) instanceof type.errors);
432
- }
433
- export const reqPublicAccess = type({
434
- publicAccess: {
435
- enable: "boolean",
436
- },
437
- }).and(reqEnsureAppSettingsBase);
438
- export function isReqPublicAccess(obj) {
439
- return !(reqPublicAccess(obj) instanceof type.errors);
440
- }
441
- export const reqRequest = type({
442
- request: {
443
- enable: "boolean",
444
- "autoAcceptViewRequest?": "boolean",
445
- },
446
- }).and(reqEnsureAppSettingsBase);
447
- export function isReqRequest(obj) {
448
- return !(reqRequest(obj) instanceof type.errors);
449
- }
450
- export const reqEnsureAppSettingsTitle = type({
451
- title: "string",
452
- }).and(reqEnsureAppSettingsBase);
453
- export function isReqEnsureAppSettingsTitle(obj) {
454
- return !(reqEnsureAppSettingsTitle(obj) instanceof type.errors);
455
- }
456
- export const reqEnsureAppSettingsApp = type({
457
- app: AIParams.partial(),
458
- }).and(reqEnsureAppSettingsBase);
459
- export function isReqEnsureAppSettingsApp(obj) {
460
- return !(reqEnsureAppSettingsApp(obj) instanceof type.errors);
461
- }
462
- export const reqEnsureAppSettingsChat = type({
463
- chat: AIParams.partial(),
464
- }).and(reqEnsureAppSettingsBase);
465
- export function isReqEnsureAppSettingsChat(obj) {
466
- return !(reqEnsureAppSettingsChat(obj) instanceof type.errors);
467
- }
468
- export const reqEnsureAppSettingsEnv = type({
469
- env: KVString.array(),
470
- }).and(reqEnsureAppSettingsBase);
471
- export function isReqEnsureAppSettingsEnv(obj) {
472
- return !(reqEnsureAppSettingsEnv(obj) instanceof type.errors);
473
- }
474
- export function isReqEnsureAppSettings(obj) {
475
- return (isReqEnsureAppSettingsTitle(obj) ||
476
- isReqEnsureAppSettingsApp(obj) ||
477
- isReqEnsureAppSettingsChat(obj) ||
478
- isReqEnsureAppSettingsEnv(obj) ||
479
- isReqEnsureAppSettingsBase(obj));
480
- }
481
- export const AppSettings = type({
482
- entries: ActiveEntry.array(),
483
- entry: type({
484
- settings: {
485
- "title?": "string",
486
- "app?": AIParams.partial(),
487
- "chat?": AIParams.partial(),
488
- env: KVString.array(),
489
- },
490
- publicAccess: EnablePublicAccess.optional(),
491
- enableRequest: EnableRequest.optional(),
492
- }),
493
- });
494
- export const resEnsureAppSettings = type({
495
- type: "'vibes.diy.res-ensure-app-settings'",
496
- userId: "string",
497
- appSlug: "string",
498
- ledger: "string",
499
- userSlug: "string",
500
- tenant: "string",
501
- "error?": "string",
502
- settings: AppSettings,
503
- updated: "string",
504
- created: "string",
505
- });
506
- export function isResEnsureAppSettings(obj) {
507
- return !(resEnsureAppSettings(obj) instanceof type.errors);
508
- }
509
- export const reqListApplicationChats = type({
510
- type: "'vibes.diy.req-list-application-chats'",
511
- auth: dashAuthType,
512
- "appSlug?": "string",
513
- "userSlug?": "string",
514
- "limit?": "number",
515
- "cursor?": "string",
516
- });
517
- export const resListApplicationChatsItem = type({
518
- chatId: "string",
519
- appSlug: "string",
520
- userSlug: "string",
521
- created: "string",
522
- });
523
- export const resListApplicationChats = type({
524
- type: "'vibes.diy.res-list-application-chats'",
525
- items: resListApplicationChatsItem.array(),
526
- "nextCursor?": "string",
527
- });
528
- export function isResListApplicationChats(obj) {
529
- return !(resListApplicationChats(obj) instanceof type.errors);
530
- }
531
- export const Pager = type({
532
- "limit?": "number",
533
- "cursor?": "string",
534
- });
535
- export const KeyGrantKey = type({
536
- appSlug: "string",
537
- userSlug: "string",
538
- grantType: "'invite' | 'request'",
539
- key: "string",
540
- });
541
- export const ResKeyGrantItem = type({
542
- entry: ActiveACL,
543
- "grantUserId?": "string",
544
- grantType: "'invite' | 'request'",
545
- key: "string",
546
- updated: "string",
547
- });
548
- export const ReqListKeyGrants = type({
549
- type: "'vibes.diy.req-list-key-grants'",
550
- auth: dashAuthType,
551
- pager: Pager,
552
- }).and(KeyGrantKey.omit("key"));
553
- export function isReqListKeyGrants(obj) {
554
- return !(ReqListKeyGrants(obj) instanceof type.errors);
555
- }
556
- export const ResListKeyGrants = type({
557
- type: "'vibes.diy.res-list-key-grants'",
558
- items: type({
559
- key: "string",
560
- entry: ActiveACL,
561
- "grantUserId?": "string",
562
- updated: "string",
563
- created: "string",
564
- }).array(),
565
- "nextCursor?": "string",
566
- }).and(KeyGrantKey.omit("key"));
567
- export function isResListKeyGrants(obj) {
568
- return !(ResListKeyGrants(obj) instanceof type.errors);
569
- }
570
- export const ReqUpsertKeyGrant = type({
571
- type: "'vibes.diy.req-upsert-key-grant'",
572
- auth: dashAuthType,
573
- appSlug: "string",
574
- userSlug: "string",
575
- entry: ActiveACL,
576
- });
577
- export function isReqUpsertKeyGrant(obj) {
578
- return !(ReqUpsertKeyGrant(obj) instanceof type.errors);
579
- }
580
- export const ResUpsertKeyGrant = type({
581
- type: "'vibes.diy.res-upsert-key-grant'",
582
- })
583
- .and(KeyGrantKey)
584
- .and(ResKeyGrantItem);
585
- export function isResUpsertKeyGrant(obj) {
586
- return !(ResUpsertKeyGrant(obj) instanceof type.errors);
587
- }
588
- export const ReqDeleteKeyGrant = type({
589
- type: "'vibes.diy.req-delete-key-grant'",
590
- auth: dashAuthType,
591
- }).and(KeyGrantKey);
592
- export function isReqDeleteKeyGrant(obj) {
593
- return !(ReqDeleteKeyGrant(obj) instanceof type.errors);
594
- }
595
- export const ResDeleteKeyGrant = type({
596
- type: "'vibes.diy.res-delete-key-grant'",
597
- deleted: "boolean",
598
- }).and(KeyGrantKey);
599
- export function isResDeleteKeyGrant(obj) {
600
- return !(ResDeleteKeyGrant(obj) instanceof type.errors);
601
- }
602
- const GrantListBase = type({
603
- appSlug: "string",
604
- userSlug: "string",
605
- auth: dashAuthType,
606
- pager: Pager,
607
- });
608
- export const ForeignInfo = type({ "givenEmail?": "string", "claims?": ClerkClaim });
609
- export const InviteForeignInfo = ForeignInfo;
610
- export const ReqRedeemInvite = type({
611
- type: "'vibes.diy.req-redeem-invite'",
612
- auth: dashAuthType,
613
- token: "string",
614
- });
615
- export function isReqRedeemInvite(obj) {
616
- return !(ReqRedeemInvite(obj) instanceof type.errors);
617
- }
618
- export const ResRedeemInviteOK = type({
619
- type: "'vibes.diy.res-redeem-invite'",
620
- appSlug: "string",
621
- userSlug: "string",
622
- emailKey: "string",
623
- role: "'editor' | 'viewer'",
624
- state: "'accepted'",
625
- });
626
- export function isResRedeemInviteOK(obj) {
627
- return !(ResRedeemInviteOK(obj) instanceof type.errors);
628
- }
629
- export const ResRedeemInviteError = type({
630
- type: "'vibes.diy.error'",
631
- message: "string",
632
- code: "'redeem-invite-failed'",
633
- "stack?": "string[]",
634
- });
635
- export function isResRedeemInviteError(obj) {
636
- return !(ResRedeemInviteError(obj) instanceof type.errors);
637
- }
638
- export const ResRedeemInvite = ResRedeemInviteOK.or(ResRedeemInviteError);
639
- export function isResRedeemInvite(obj) {
640
- return !(ResRedeemInvite(obj) instanceof type.errors);
641
- }
642
- export const InviteGrantItem = type({
643
- emailKey: "string",
644
- state: "'pending' | 'accepted' | 'revoked'",
645
- role: "'editor' | 'viewer'",
646
- tokenOrGrantUserId: "string",
647
- foreignInfo: InviteForeignInfo,
648
- updated: "string",
649
- created: "string",
650
- });
651
- export const ReqCreateInvite = type({
652
- type: "'vibes.diy.req-create-invite'",
653
- auth: dashAuthType,
654
- appSlug: "string",
655
- userSlug: "string",
656
- invitedEmail: "string",
657
- role: "'editor' | 'viewer'",
658
- });
659
- export function isReqCreateInvite(obj) {
660
- return !(ReqCreateInvite(obj) instanceof type.errors);
661
- }
662
- export const ResCreateInvite = type({
663
- type: "'vibes.diy.res-create-invite'",
664
- appSlug: "string",
665
- userSlug: "string",
666
- }).and(InviteGrantItem);
667
- export function isResCreateInvite(obj) {
668
- return !(ResCreateInvite(obj) instanceof type.errors);
669
- }
670
- export const ReqHasAccessInvite = type({
671
- type: "'vibes.diy.req-has-access-invite'",
672
- auth: dashAuthType,
673
- appSlug: "string",
674
- userSlug: "string",
675
- });
676
- export function isReqHasAccessInvite(obj) {
677
- return !(ReqHasAccessInvite(obj) instanceof type.errors);
678
- }
679
- export const ResHasAccessInviteBase = type({
680
- type: "'vibes.diy.res-has-access-invite'",
681
- appSlug: "string",
682
- userSlug: "string",
683
- });
684
- export const ResHasAccessInviteNotFound = type({
685
- state: "'not-found'",
686
- }).and(ResHasAccessInviteBase);
687
- export function isResHasAccessInviteNotFound(obj) {
688
- return !(ResHasAccessInviteNotFound(obj) instanceof type.errors);
689
- }
690
- export const ResHasAccessInviteRevoke = type({
691
- state: "'revoked'",
692
- }).and(ResHasAccessInviteBase);
693
- export function isResHasAccessInviteRevoke(obj) {
694
- return !(ResHasAccessInviteRevoke(obj) instanceof type.errors);
695
- }
696
- export const ResHasAccessInviteAccepted = ResHasAccessInviteBase.and(type({ state: "'accepted'", role: "'editor' | 'viewer'", tokenOrGrantUserId: "string" }));
697
- export function isResHasAccessInviteAccepted(obj) {
698
- return !(ResHasAccessInviteAccepted(obj) instanceof type.errors);
699
- }
700
- export const ResHasAccessInvitePending = ResHasAccessInviteBase.and(type({ state: "'pending'", role: "'editor' | 'viewer'", tokenOrGrantUserId: "string" }));
701
- export function isResHasAccessInvitePending(obj) {
702
- return !(ResHasAccessInvitePending(obj) instanceof type.errors);
703
- }
704
- export const ResHasAccessInvite = ResHasAccessInviteNotFound.or(ResHasAccessInviteRevoke)
705
- .or(ResHasAccessInviteAccepted)
706
- .or(ResHasAccessInvitePending);
707
- export function isResHasAccessInvite(obj) {
708
- return !(ResHasAccessInvite(obj) instanceof type.errors);
709
- }
710
- export const ReqInviteSetRole = type({
711
- type: "'vibes.diy.req-invite-set-role'",
712
- auth: dashAuthType,
713
- appSlug: "string",
714
- userSlug: "string",
715
- emailKey: "string",
716
- role: "'editor' | 'viewer'",
717
- });
718
- export function isReqInviteSetRole(obj) {
719
- return !(ReqInviteSetRole(obj) instanceof type.errors);
720
- }
721
- export const ResInviteSetRole = type({
722
- type: "'vibes.diy.res-invite-set-role'",
723
- appSlug: "string",
724
- userSlug: "string",
725
- emailKey: "string",
726
- role: "'editor' | 'viewer'",
727
- });
728
- export function isResInviteSetRole(obj) {
729
- return !(ResInviteSetRole(obj) instanceof type.errors);
730
- }
731
- export const ReqRevokeInvite = type({
732
- type: "'vibes.diy.req-revoke-invite'",
733
- auth: dashAuthType,
734
- appSlug: "string",
735
- userSlug: "string",
736
- emailKey: "string",
737
- "delete?": "boolean",
738
- });
739
- export function isReqRevokeInvite(obj) {
740
- return !(ReqRevokeInvite(obj) instanceof type.errors);
741
- }
742
- export const ResRevokeInvite = type({
743
- type: "'vibes.diy.res-revoke-invite'",
744
- appSlug: "string",
745
- userSlug: "string",
746
- emailKey: "string",
747
- deleted: "boolean",
748
- });
749
- export function isResRevokeInvite(obj) {
750
- return !(ResRevokeInvite(obj) instanceof type.errors);
751
- }
752
- export const ReqListInviteGrants = type({
753
- type: "'vibes.diy.req-list-invite-grants'",
754
- }).and(GrantListBase);
755
- export function isReqListInviteGrants(obj) {
756
- return !(ReqListInviteGrants(obj) instanceof type.errors);
757
- }
758
- export const ResListInviteGrants = type({
759
- type: "'vibes.diy.res-list-invite-grants'",
760
- appSlug: "string",
761
- userSlug: "string",
762
- items: InviteGrantItem.array(),
763
- "nextCursor?": "string",
764
- });
765
- export function isResListInviteGrants(obj) {
766
- return !(ResListInviteGrants(obj) instanceof type.errors);
767
- }
768
- export const ReqRequestAccess = type({
769
- type: "'vibes.diy.req-request-access'",
770
- auth: dashAuthType,
771
- appSlug: "string",
772
- userSlug: "string",
773
- });
774
- export function isReqRequestAccess(obj) {
775
- return !(ReqRequestAccess(obj) instanceof type.errors);
776
- }
777
- export const ResRequestAccessBase = type({
778
- type: "'vibes.diy.res-request-access'",
779
- appSlug: "string",
780
- userSlug: "string",
781
- foreignUserId: "string",
782
- foreignInfo: ForeignInfo,
783
- updated: "string",
784
- created: "string",
785
- });
786
- export const ResRequestAccessPending = type({ state: "'pending'" }).and(ResRequestAccessBase);
787
- export function isResRequestAccessPending(obj) {
788
- return !(ResRequestAccessPending(obj) instanceof type.errors);
789
- }
790
- export const ResRequestAccessApproved = type({ state: "'approved'", role: "'editor' | 'viewer'" }).and(ResRequestAccessBase);
791
- export function isResRequestAccessApproved(obj) {
792
- return !(ResRequestAccessApproved(obj) instanceof type.errors);
793
- }
794
- export const ResRequestAccessRevoked = type({ state: "'revoked'", role: "'editor' | 'viewer'" }).and(ResRequestAccessBase);
795
- export function isResRequestAccessRevoked(obj) {
796
- return !(ResRequestAccessRevoked(obj) instanceof type.errors);
797
- }
798
- export const ResRequestAccess = ResRequestAccessPending.or(ResRequestAccessApproved).or(ResRequestAccessRevoked);
799
- export function isResRequestAccess(obj) {
800
- return !(ResRequestAccess(obj) instanceof type.errors);
801
- }
802
- export const ReqApproveRequest = type({
803
- type: "'vibes.diy.req-approve-request'",
804
- auth: dashAuthType,
805
- appSlug: "string",
806
- userSlug: "string",
807
- foreignUserId: "string",
808
- role: "'editor' | 'viewer'",
809
- });
810
- export function isReqApproveRequest(obj) {
811
- return !(ReqApproveRequest(obj) instanceof type.errors);
812
- }
813
- export const ResApproveRequest = type({
814
- type: "'vibes.diy.res-approve-request'",
815
- appSlug: "string",
816
- userSlug: "string",
817
- foreignUserId: "string",
818
- role: "'editor' | 'viewer'",
819
- state: "'approved'",
820
- updated: "string",
821
- });
822
- export function isResApproveRequest(obj) {
823
- return !(ResApproveRequest(obj) instanceof type.errors);
824
- }
825
- export const ReqRequestSetRole = type({
826
- type: "'vibes.diy.req-request-set-role'",
827
- auth: dashAuthType,
828
- appSlug: "string",
829
- userSlug: "string",
830
- foreignUserId: "string",
831
- role: "'editor' | 'viewer'",
832
- });
833
- export function isReqRequestSetRole(obj) {
834
- return !(ReqRequestSetRole(obj) instanceof type.errors);
835
- }
836
- export const ResRequestSetRole = type({
837
- type: "'vibes.diy.res-request-set-role'",
838
- appSlug: "string",
839
- userSlug: "string",
840
- foreignUserId: "string",
841
- role: "'editor' | 'viewer'",
842
- });
843
- export function isResRequestSetRole(obj) {
844
- return !(ResRequestSetRole(obj) instanceof type.errors);
845
- }
846
- export const ReqRevokeRequest = type({
847
- type: "'vibes.diy.req-revoke-request'",
848
- auth: dashAuthType,
849
- appSlug: "string",
850
- userSlug: "string",
851
- foreignUserId: "string",
852
- "delete?": "boolean",
853
- });
854
- export function isReqRevokeRequest(obj) {
855
- return !(ReqRevokeRequest(obj) instanceof type.errors);
856
- }
857
- export const ResRevokeRequest = type({
858
- type: "'vibes.diy.res-revoke-request'",
859
- appSlug: "string",
860
- userSlug: "string",
861
- foreignUserId: "string",
862
- deleted: "boolean",
863
- });
864
- export function isResRevokeRequest(obj) {
865
- return !(ResRevokeRequest(obj) instanceof type.errors);
866
- }
867
- export const ReqHasAccessRequest = type({
868
- type: "'vibes.diy.req-has-access-request'",
869
- auth: dashAuthType,
870
- appSlug: "string",
871
- userSlug: "string",
872
- });
873
- export function isReqHasAccessRequest(obj) {
874
- return !(ReqHasAccessRequest(obj) instanceof type.errors);
875
- }
876
- export const ResHasAccessRequestBase = type({
877
- type: "'vibes.diy.res-has-access-request'",
878
- appSlug: "string",
879
- userSlug: "string",
880
- });
881
- export const ResHasAccessRequestNotFound = type({
882
- state: "'not-found'",
883
- }).and(ResHasAccessRequestBase);
884
- export function isResHasAccessRequestNotFound(obj) {
885
- return !(ResHasAccessRequestNotFound(obj) instanceof type.errors);
886
- }
887
- export const ResHasAccessRequestPending = ResHasAccessRequestBase.and(type({ state: "'pending'", role: "'editor' | 'viewer' | undefined | null" }));
888
- export function isResHasAccessRequestPending(obj) {
889
- return !(ResHasAccessRequestPending(obj) instanceof type.errors);
890
- }
891
- export const ResHasAccessRequestApproved = type({
892
- state: "'approved'",
893
- role: "'editor' | 'viewer'",
894
- }).and(ResHasAccessRequestBase);
895
- export function isResHasAccessRequestApproved(obj) {
896
- return !(ResHasAccessRequestApproved(obj) instanceof type.errors);
897
- }
898
- export const ResHasAccessRequestRevoked = type({
899
- state: "'revoked'",
900
- }).and(ResHasAccessRequestBase);
901
- export function isResHasAccessRequestRevoked(obj) {
902
- return !(ResHasAccessRequestRevoked(obj) instanceof type.errors);
903
- }
904
- export const ResHasAccessRequest = ResHasAccessRequestNotFound.or(ResHasAccessRequestPending)
905
- .or(ResHasAccessRequestApproved)
906
- .or(ResHasAccessRequestRevoked);
907
- export function isResHasAccessRequest(obj) {
908
- return !(ResHasAccessRequest(obj) instanceof type.errors);
909
- }
910
- export const ResFlowOwnerError = type({
911
- type: "'vibes.diy.error'",
912
- message: "string",
913
- code: "'owner-error'",
914
- "stack?": "string[]",
915
- });
916
- export function isResFlowOwnerError(obj) {
917
- return !(ResFlowOwnerError(obj) instanceof type.errors);
918
- }
919
- export const ResRequestAccessError = type({
920
- type: "'vibes.diy.error'",
921
- message: "string",
922
- code: "'request-access-app-not-found' | 'request-access-not-enabled'",
923
- "stack?": "string[]",
924
- });
925
- export function isResRequestAccessError(obj) {
926
- return !(ResRequestAccessError(obj) instanceof type.errors);
927
- }
928
- export const ResApproveRequestError = type({
929
- type: "'vibes.diy.error'",
930
- message: "string",
931
- code: "'approve-request-not-found'",
932
- "stack?": "string[]",
933
- });
934
- export const ResRequestSetRoleError = type({
935
- type: "'vibes.diy.error'",
936
- message: "string",
937
- code: "'request-set-role-not-found'",
938
- "stack?": "string[]",
939
- });
940
- export const ResRequestAccessFlow = ResRequestAccess.or(ResRequestAccessError).or(ResFlowOwnerError);
941
- export function isResRequestAccessFlow(obj) {
942
- return !(ResRequestAccessFlow(obj) instanceof type.errors);
943
- }
944
- export const ResHasAccessRequestFlow = ResHasAccessRequest.or(ResFlowOwnerError);
945
- export function isResHasAccessRequestFlow(obj) {
946
- return !(ResHasAccessRequestFlow(obj) instanceof type.errors);
947
- }
948
- export const ReqListRequestGrants = type({
949
- type: "'vibes.diy.req-list-request-grants'",
950
- }).and(GrantListBase);
951
- export function isReqListRequestGrants(obj) {
952
- return !(ReqListRequestGrants(obj) instanceof type.errors);
953
- }
954
- export const ResListRequestGrants = type({
955
- type: "'vibes.diy.res-list-request-grants'",
956
- appSlug: "string",
957
- userSlug: "string",
958
- items: type({
959
- foreignUserId: "string",
960
- state: "'pending' | 'approved' | 'revoked'",
961
- role: "'editor' | 'viewer' | undefined | null",
962
- foreignInfo: type({
963
- "claims?": ClerkClaim.partial(),
964
- }),
965
- tick: "string",
966
- updated: "string",
967
- created: "string",
968
- }).array(),
969
- "nextCursor?": "string",
970
- });
971
- export function isResListRequestGrants(obj) {
972
- const x = ResListRequestGrants(obj);
973
- if (x instanceof type.errors) {
974
- console.error("ResListRequestGrants validation error:", x.summary);
975
- }
976
- return !(x instanceof type.errors);
977
- }
978
- export const evtNewFsId = type({
979
- type: "'vibes.diy.evt-new-fs-id'",
980
- userSlug: "string",
981
- appSlug: "string",
982
- fsId: "string",
983
- sessionToken: "string",
984
- vibeUrl: "string",
985
- });
986
- export function isEvtNewFsId(obj) {
987
- return !(evtNewFsId(obj) instanceof type.errors);
988
- }
989
- export const evtAppSetting = type({
990
- type: "'vibes.diy.evt-app-setting'",
991
- userSlug: "string",
992
- appSlug: "string",
993
- settings: ActiveEntry.array(),
994
- });
995
- export function isEvtAppSetting(obj) {
996
- return !(evtAppSetting(obj) instanceof type.errors);
997
- }
998
- export const evtInviteGrant = type({
999
- cud: "'create' | 'update' | 'delete'",
1000
- type: "'vibes.diy.evt-invite-grant'",
1001
- userSlug: "string",
1002
- appSlug: "string",
1003
- userId: "string",
1004
- state: "'pending' | 'approved' | 'revoked'",
1005
- role: "'editor' | 'viewer' | undefined | null",
1006
- foreignInfo: ForeignInfo,
1007
- emailKey: "string",
1008
- tokenOrGrantUserId: "string",
1009
- });
1010
- export function isEvtInviteGrant(obj) {
1011
- return !(evtInviteGrant(obj) instanceof type.errors);
1012
- }
1013
- export const evtRequestGrant = type({
1014
- cud: "'create' | 'update' | 'delete'",
1015
- type: "'vibes.diy.evt-request-grant'",
1016
- userSlug: "string",
1017
- appSlug: "string",
1018
- userId: "string",
1019
- foreignUserId: "string",
1020
- state: "'pending' | 'approved' | 'revoked'",
1021
- role: "'editor' | 'viewer' | undefined | null",
1022
- foreignInfo: ForeignInfo,
1023
- });
1024
- export function isEvtRequestGrant(obj) {
1025
- return !(evtRequestGrant(obj) instanceof type.errors);
1026
- }
1027
- export const ResSetModeFs = type({
1028
- type: "'vibes.diy.res-set-mode-fs'",
1029
- fsId: "string",
1030
- appSlug: "string",
1031
- userSlug: "string",
1032
- mode: FSMode,
1033
- });
1034
- export function isResSetModeFs(obj) {
1035
- return !(ResSetModeFs(obj) instanceof type.errors);
1036
- }
1037
- export const ReqSetModeFs = type({
1038
- type: "'vibes.diy.req-set-mode-fs'",
1039
- auth: dashAuthType,
1040
- fsId: "string",
1041
- appSlug: "string",
1042
- userSlug: "string",
1043
- mode: FSMode,
1044
- });
1045
- export const reqSetModeFs = ReqSetModeFs;
1046
- export function isReqSetModeFs(obj) {
1047
- return !(ReqSetModeFs(obj) instanceof type.errors);
1048
- }
1049
- export const ReqFPCloudToken = type({
1050
- type: "'vibes.diy.req-fpcloud-token'",
1051
- auth: dashAuthType,
1052
- userSlug: "string",
1053
- appSlug: "string",
1054
- dbName: "string",
1055
- });
1056
- export function isReqFPCloudToken(obj) {
1057
- return !(ReqFPCloudToken(obj) instanceof type.errors);
1058
- }
1059
- export const ResFPCloudTokenNoGrant = type({
1060
- type: "'vibes.diy.res-fpcloud-token'",
1061
- grant: "'no-grant'",
1062
- });
1063
- export function isResFPCloudTokenNoGrant(obj) {
1064
- return !(ResFPCloudTokenNoGrant(obj) instanceof type.errors);
1065
- }
1066
- export const Token = type({
1067
- expiresInSec: "number",
1068
- token: "string",
1069
- claims: FPCloudClaim,
1070
- });
1071
- export const ResFPCloudTokenGrant = type({
1072
- type: "'vibes.diy.res-fpcloud-token'",
1073
- grant: "'public' | 'owner' | 'request-editor' | 'request-viewer' | 'invite-editor' | 'invite-viewer'",
1074
- token: Token,
1075
- fpCloudUrl: "string",
1076
- appSlug: "string",
1077
- userSlug: "string",
1078
- dbName: "string",
1079
- ledger: "string",
1080
- tenant: "string",
1081
- });
1082
- export function isResFPCloudTokenGrant(obj) {
1083
- return !(ResFPCloudTokenGrant(obj) instanceof type.errors);
1084
- }
1085
- export const ResFPCloudToken = ResFPCloudTokenGrant.or(ResFPCloudTokenNoGrant);
1086
- export function isResFPCloudToken(obj) {
1087
- return !(ResFPCloudToken(obj) instanceof type.errors);
1088
- }
1089
- //# sourceMappingURL=msg-types.js.map