@checkstack/auth-common 0.3.0 → 0.4.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @checkstack/auth-common
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - df6ac7b: Added onboarding flow and user profile
8
+
3
9
  ## 0.3.0
4
10
 
5
11
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/auth-common",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
package/src/routes.ts CHANGED
@@ -11,4 +11,6 @@ export const authRoutes = createRoutes("auth", {
11
11
  forgotPassword: "/forgot-password",
12
12
  resetPassword: "/reset-password",
13
13
  changePassword: "/change-password",
14
+ profile: "/profile",
15
+ onboarding: "/onboarding",
14
16
  });
@@ -109,6 +109,26 @@ export const authContract = {
109
109
  access: [],
110
110
  }).output(RegistrationStatusSchema),
111
111
 
112
+ getOnboardingStatus: proc({
113
+ operationType: "query",
114
+ userType: "anonymous",
115
+ access: [],
116
+ }).output(z.object({ needsOnboarding: z.boolean() })),
117
+
118
+ completeOnboarding: proc({
119
+ operationType: "mutation",
120
+ userType: "anonymous",
121
+ access: [],
122
+ })
123
+ .input(
124
+ z.object({
125
+ name: z.string().min(1),
126
+ email: z.string().email(),
127
+ password: z.string(),
128
+ }),
129
+ )
130
+ .output(z.object({ success: z.boolean() })),
131
+
112
132
  // ==========================================================================
113
133
  // AUTHENTICATED ENDPOINTS (userType: "authenticated")
114
134
  // ==========================================================================
@@ -119,6 +139,32 @@ export const authContract = {
119
139
  access: [],
120
140
  }).output(z.object({ accessRules: z.array(z.string()) })),
121
141
 
142
+ getCurrentUserProfile: proc({
143
+ operationType: "query",
144
+ userType: "user",
145
+ access: [],
146
+ }).output(
147
+ z.object({
148
+ id: z.string(),
149
+ name: z.string(),
150
+ email: z.string(),
151
+ hasCredentialAccount: z.boolean(),
152
+ }),
153
+ ),
154
+
155
+ updateCurrentUser: proc({
156
+ operationType: "mutation",
157
+ userType: "user",
158
+ access: [],
159
+ })
160
+ .input(
161
+ z.object({
162
+ name: z.string().min(1).optional(),
163
+ email: z.string().email().optional(),
164
+ }),
165
+ )
166
+ .output(z.void()),
167
+
122
168
  // ==========================================================================
123
169
  // USER MANAGEMENT (userType: "user" with access)
124
170
  // ==========================================================================
@@ -179,7 +225,7 @@ export const authContract = {
179
225
  name: z.string(),
180
226
  description: z.string().optional(),
181
227
  accessRules: z.array(z.string()),
182
- })
228
+ }),
183
229
  )
184
230
  .output(z.void()),
185
231
 
@@ -194,7 +240,7 @@ export const authContract = {
194
240
  name: z.string().optional(),
195
241
  description: z.string().optional(),
196
242
  accessRules: z.array(z.string()),
197
- })
243
+ }),
198
244
  )
199
245
  .output(z.void()),
200
246
 
@@ -226,7 +272,7 @@ export const authContract = {
226
272
  id: z.string(),
227
273
  enabled: z.boolean(),
228
274
  config: z.record(z.string(), z.unknown()).optional(),
229
- })
275
+ }),
230
276
  )
231
277
  .output(z.object({ success: z.boolean() })),
232
278
 
@@ -301,7 +347,7 @@ export const authContract = {
301
347
  email: z.string(),
302
348
  name: z.string().nullable(),
303
349
  })
304
- .optional()
350
+ .optional(),
305
351
  ),
306
352
 
307
353
  filterUsersByAccessRule: proc({
@@ -313,7 +359,7 @@ export const authContract = {
313
359
  z.object({
314
360
  userIds: z.array(z.string()),
315
361
  accessRule: z.string(),
316
- })
362
+ }),
317
363
  )
318
364
  .output(z.array(z.string())),
319
365
 
@@ -335,8 +381,8 @@ export const authContract = {
335
381
  createdById: z.string(),
336
382
  createdAt: z.coerce.date(),
337
383
  lastUsedAt: z.coerce.date().optional().nullable(),
338
- })
339
- )
384
+ }),
385
+ ),
340
386
  ),
341
387
 
342
388
  createApplication: proc({
@@ -348,7 +394,7 @@ export const authContract = {
348
394
  z.object({
349
395
  name: z.string().min(1).max(100),
350
396
  description: z.string().max(500).optional(),
351
- })
397
+ }),
352
398
  )
353
399
  .output(
354
400
  z.object({
@@ -361,7 +407,7 @@ export const authContract = {
361
407
  createdAt: z.coerce.date(),
362
408
  }),
363
409
  secret: z.string(),
364
- })
410
+ }),
365
411
  ),
366
412
 
367
413
  updateApplication: proc({
@@ -375,7 +421,7 @@ export const authContract = {
375
421
  name: z.string().optional(),
376
422
  description: z.string().optional().nullable(),
377
423
  roles: z.array(z.string()).optional(),
378
- })
424
+ }),
379
425
  )
380
426
  .output(z.void()),
381
427
 
@@ -411,8 +457,8 @@ export const authContract = {
411
457
  description: z.string().optional().nullable(),
412
458
  memberCount: z.number(),
413
459
  isManager: z.boolean(),
414
- })
415
- )
460
+ }),
461
+ ),
416
462
  ),
417
463
 
418
464
  getTeam: proc({
@@ -428,13 +474,13 @@ export const authContract = {
428
474
  name: z.string(),
429
475
  description: z.string().optional().nullable(),
430
476
  members: z.array(
431
- z.object({ id: z.string(), name: z.string(), email: z.string() })
477
+ z.object({ id: z.string(), name: z.string(), email: z.string() }),
432
478
  ),
433
479
  managers: z.array(
434
- z.object({ id: z.string(), name: z.string(), email: z.string() })
480
+ z.object({ id: z.string(), name: z.string(), email: z.string() }),
435
481
  ),
436
482
  })
437
- .optional()
483
+ .optional(),
438
484
  ),
439
485
 
440
486
  createTeam: proc({
@@ -446,7 +492,7 @@ export const authContract = {
446
492
  z.object({
447
493
  name: z.string().min(1).max(100),
448
494
  description: z.string().max(500).optional(),
449
- })
495
+ }),
450
496
  )
451
497
  .output(z.object({ id: z.string() })),
452
498
 
@@ -460,7 +506,7 @@ export const authContract = {
460
506
  id: z.string(),
461
507
  name: z.string().optional(),
462
508
  description: z.string().optional().nullable(),
463
- })
509
+ }),
464
510
  )
465
511
  .output(z.void()),
466
512
 
@@ -517,8 +563,8 @@ export const authContract = {
517
563
  teamName: z.string(),
518
564
  canRead: z.boolean(),
519
565
  canManage: z.boolean(),
520
- })
521
- )
566
+ }),
567
+ ),
522
568
  ),
523
569
 
524
570
  setResourceTeamAccess: proc({
@@ -533,7 +579,7 @@ export const authContract = {
533
579
  teamId: z.string(),
534
580
  canRead: z.boolean().optional(),
535
581
  canManage: z.boolean().optional(),
536
- })
582
+ }),
537
583
  )
538
584
  .output(z.void()),
539
585
 
@@ -547,7 +593,7 @@ export const authContract = {
547
593
  resourceType: z.string(),
548
594
  resourceId: z.string(),
549
595
  teamId: z.string(),
550
- })
596
+ }),
551
597
  )
552
598
  .output(z.void()),
553
599
 
@@ -569,7 +615,7 @@ export const authContract = {
569
615
  resourceType: z.string(),
570
616
  resourceId: z.string(),
571
617
  teamOnly: z.boolean(),
572
- })
618
+ }),
573
619
  )
574
620
  .output(z.void()),
575
621
 
@@ -590,7 +636,7 @@ export const authContract = {
590
636
  resourceId: z.string(),
591
637
  action: z.enum(["read", "manage"]),
592
638
  hasGlobalAccess: z.boolean(),
593
- })
639
+ }),
594
640
  )
595
641
  .output(z.object({ hasAccess: z.boolean() })),
596
642
 
@@ -607,7 +653,7 @@ export const authContract = {
607
653
  resourceIds: z.array(z.string()),
608
654
  action: z.enum(["read", "manage"]),
609
655
  hasGlobalAccess: z.boolean(),
610
- })
656
+ }),
611
657
  )
612
658
  .output(z.array(z.string())),
613
659