@happyvertical/smrt-users 0.57.17 → 0.57.19

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.
Files changed (54) hide show
  1. package/AGENTS.md +21 -0
  2. package/README.md +134 -4
  3. package/agents/retention.md +3 -2
  4. package/dist/chunks/{PasswordCredentialService-CyB9FmYp.js → PasswordCredentialService-DezdsV_v.js} +40 -3
  5. package/dist/chunks/PasswordCredentialService-DezdsV_v.js.map +1 -0
  6. package/dist/chunks/TerminalAuthService-CM-L6VyR.js +4012 -0
  7. package/dist/chunks/TerminalAuthService-CM-L6VyR.js.map +1 -0
  8. package/dist/collections/PasskeyChallengeCollection.d.ts +37 -0
  9. package/dist/collections/PasskeyChallengeCollection.d.ts.map +1 -0
  10. package/dist/collections/PasskeyCredentialCollection.d.ts +66 -0
  11. package/dist/collections/PasskeyCredentialCollection.d.ts.map +1 -0
  12. package/dist/collections/SessionCollection.d.ts.map +1 -1
  13. package/dist/collections/index.d.ts +2 -0
  14. package/dist/collections/index.d.ts.map +1 -1
  15. package/dist/index.d.ts +4 -4
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +15 -6
  18. package/dist/index.js.map +1 -1
  19. package/dist/manifest.json +1302 -428
  20. package/dist/models/PasskeyChallenge.d.ts +32 -0
  21. package/dist/models/PasskeyChallenge.d.ts.map +1 -0
  22. package/dist/models/PasskeyCredential.d.ts +50 -0
  23. package/dist/models/PasskeyCredential.d.ts.map +1 -0
  24. package/dist/models/Session.d.ts +23 -0
  25. package/dist/models/Session.d.ts.map +1 -1
  26. package/dist/models/index.d.ts +2 -0
  27. package/dist/models/index.d.ts.map +1 -1
  28. package/dist/operator.js +1 -1
  29. package/dist/retention.d.ts +3 -1
  30. package/dist/retention.d.ts.map +1 -1
  31. package/dist/services/PasskeyCredentialService.d.ts +382 -0
  32. package/dist/services/PasskeyCredentialService.d.ts.map +1 -0
  33. package/dist/services/SessionService.d.ts.map +1 -1
  34. package/dist/services/index.d.ts +1 -0
  35. package/dist/services/index.d.ts.map +1 -1
  36. package/dist/smrt-knowledge.json +407 -9
  37. package/dist/svelte/auth.d.ts +9 -3
  38. package/dist/svelte/auth.d.ts.map +1 -1
  39. package/dist/svelte/index.d.ts +2 -0
  40. package/dist/svelte/index.d.ts.map +1 -1
  41. package/dist/svelte/index.js +1 -0
  42. package/dist/svelte/passkey.d.ts +58 -0
  43. package/dist/svelte/passkey.d.ts.map +1 -0
  44. package/dist/svelte/passkey.js +97 -0
  45. package/dist/sveltekit/index.d.ts +1 -0
  46. package/dist/sveltekit/index.d.ts.map +1 -1
  47. package/dist/sveltekit/passkey-handlers.d.ts +117 -0
  48. package/dist/sveltekit/passkey-handlers.d.ts.map +1 -0
  49. package/dist/sveltekit.js +259 -69
  50. package/dist/sveltekit.js.map +1 -1
  51. package/package.json +15 -13
  52. package/dist/chunks/PasswordCredentialService-CyB9FmYp.js.map +0 -1
  53. package/dist/chunks/TerminalAuthService-CCbM_G1V.js +0 -3012
  54. package/dist/chunks/TerminalAuthService-CCbM_G1V.js.map +0 -1
@@ -2,7 +2,7 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-users",
5
- "packageVersion": "0.57.17",
5
+ "packageVersion": "0.57.19",
6
6
  "objects": {
7
7
  "@happyvertical/smrt-users:AccessRequestCollection": {
8
8
  "name": "accessrequestcollection",
@@ -3128,6 +3128,449 @@
3128
3128
  },
3129
3129
  "importPath": "@happyvertical/smrt-users"
3130
3130
  },
3131
+ "@happyvertical/smrt-users:UsersPasskeyChallengeCollection": {
3132
+ "name": "userspasskeychallengecollection",
3133
+ "className": "UsersPasskeyChallengeCollection",
3134
+ "qualifiedName": "@happyvertical/smrt-users:UsersPasskeyChallengeCollection",
3135
+ "collection": "userspasskeychallenges",
3136
+ "filePath": "/home/runner/work/smrt/smrt/packages/users/src/collections/PasskeyChallengeCollection.ts",
3137
+ "packageName": "@happyvertical/smrt-users",
3138
+ "fields": {},
3139
+ "methods": {
3140
+ "consume": {
3141
+ "name": "consume",
3142
+ "async": true,
3143
+ "parameters": [
3144
+ {
3145
+ "name": "challengeHash",
3146
+ "type": "string",
3147
+ "optional": false
3148
+ },
3149
+ {
3150
+ "name": "purpose",
3151
+ "type": "PasskeyChallengePurpose",
3152
+ "optional": false
3153
+ },
3154
+ {
3155
+ "name": "expiresAt",
3156
+ "type": "Date",
3157
+ "optional": false
3158
+ }
3159
+ ],
3160
+ "returnType": "Promise<boolean>",
3161
+ "isStatic": false,
3162
+ "isPublic": true
3163
+ },
3164
+ "deleteExpired": {
3165
+ "name": "deleteExpired",
3166
+ "async": true,
3167
+ "parameters": [
3168
+ {
3169
+ "name": "options",
3170
+ "type": "object",
3171
+ "optional": true,
3172
+ "memberTypes": [
3173
+ "boolean"
3174
+ ]
3175
+ }
3176
+ ],
3177
+ "returnType": "Promise<number>",
3178
+ "isStatic": false,
3179
+ "isPublic": true
3180
+ }
3181
+ },
3182
+ "decoratorConfig": {
3183
+ "tableName": "users_passkey_challenges",
3184
+ "api": false,
3185
+ "mcp": false,
3186
+ "cli": false
3187
+ },
3188
+ "extends": "SmrtCollection",
3189
+ "extendsTypeArg": "UsersPasskeyChallenge",
3190
+ "exportName": "UsersPasskeyChallengeCollection",
3191
+ "collectionExportName": "UsersPasskeyChallengeCollectionCollection",
3192
+ "schema": {
3193
+ "tableName": "users_passkey_challenges",
3194
+ "ddl": "CREATE TABLE IF NOT EXISTS \"users_passkey_challenges\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"challenge_hash\" TEXT NOT NULL UNIQUE,\n \"purpose\" TEXT NOT NULL,\n \"expires_at\" TIMESTAMP NOT NULL\n);",
3195
+ "columns": {
3196
+ "id": {
3197
+ "type": "UUID",
3198
+ "primaryKey": true,
3199
+ "referenceKind": "id",
3200
+ "notNull": true
3201
+ },
3202
+ "slug": {
3203
+ "type": "TEXT",
3204
+ "notNull": true
3205
+ },
3206
+ "context": {
3207
+ "type": "TEXT",
3208
+ "notNull": true,
3209
+ "default": ""
3210
+ },
3211
+ "created_at": {
3212
+ "type": "TIMESTAMP",
3213
+ "notNull": true,
3214
+ "default": "current_timestamp"
3215
+ },
3216
+ "updated_at": {
3217
+ "type": "TIMESTAMP",
3218
+ "notNull": true,
3219
+ "default": "current_timestamp"
3220
+ },
3221
+ "challenge_hash": {
3222
+ "type": "TEXT",
3223
+ "notNull": true,
3224
+ "unique": true
3225
+ },
3226
+ "purpose": {
3227
+ "type": "TEXT",
3228
+ "notNull": true,
3229
+ "unique": false
3230
+ },
3231
+ "expires_at": {
3232
+ "type": "TIMESTAMP",
3233
+ "notNull": true,
3234
+ "unique": false
3235
+ }
3236
+ },
3237
+ "indexes": [
3238
+ {
3239
+ "name": "users_passkey_challenges_slug_context_idx",
3240
+ "columns": [
3241
+ "slug",
3242
+ "context"
3243
+ ],
3244
+ "unique": true
3245
+ },
3246
+ {
3247
+ "name": "users_passkey_challenges_expires_at_idx",
3248
+ "columns": [
3249
+ "expires_at"
3250
+ ]
3251
+ },
3252
+ {
3253
+ "name": "users_passkey_challenges_created_at_idx",
3254
+ "columns": [
3255
+ "created_at"
3256
+ ]
3257
+ }
3258
+ ],
3259
+ "version": "895dcef7"
3260
+ },
3261
+ "importPath": "@happyvertical/smrt-users"
3262
+ },
3263
+ "@happyvertical/smrt-users:UsersPasskeyCredentialCollection": {
3264
+ "name": "userspasskeycredentialcollection",
3265
+ "className": "UsersPasskeyCredentialCollection",
3266
+ "qualifiedName": "@happyvertical/smrt-users:UsersPasskeyCredentialCollection",
3267
+ "collection": "userspasskeycredentials",
3268
+ "filePath": "/home/runner/work/smrt/smrt/packages/users/src/collections/PasskeyCredentialCollection.ts",
3269
+ "packageName": "@happyvertical/smrt-users",
3270
+ "fields": {},
3271
+ "methods": {
3272
+ "findByCredentialId": {
3273
+ "name": "findByCredentialId",
3274
+ "async": true,
3275
+ "parameters": [
3276
+ {
3277
+ "name": "credentialId",
3278
+ "type": "string",
3279
+ "optional": false
3280
+ }
3281
+ ],
3282
+ "returnType": "Promise<UsersPasskeyCredential | null>",
3283
+ "isStatic": false,
3284
+ "isPublic": true
3285
+ },
3286
+ "listByUserId": {
3287
+ "name": "listByUserId",
3288
+ "async": true,
3289
+ "parameters": [
3290
+ {
3291
+ "name": "userId",
3292
+ "type": "string",
3293
+ "optional": false
3294
+ }
3295
+ ],
3296
+ "returnType": "Promise<UsersPasskeyCredential[]>",
3297
+ "isStatic": false,
3298
+ "isPublic": true
3299
+ },
3300
+ "countByUserId": {
3301
+ "name": "countByUserId",
3302
+ "async": true,
3303
+ "parameters": [
3304
+ {
3305
+ "name": "userId",
3306
+ "type": "string",
3307
+ "optional": false
3308
+ }
3309
+ ],
3310
+ "returnType": "Promise<number>",
3311
+ "isStatic": false,
3312
+ "isPublic": true
3313
+ },
3314
+ "findOwned": {
3315
+ "name": "findOwned",
3316
+ "async": true,
3317
+ "parameters": [
3318
+ {
3319
+ "name": "id",
3320
+ "type": "string",
3321
+ "optional": false
3322
+ },
3323
+ {
3324
+ "name": "userId",
3325
+ "type": "string",
3326
+ "optional": false
3327
+ }
3328
+ ],
3329
+ "returnType": "Promise<UsersPasskeyCredential | null>",
3330
+ "isStatic": false,
3331
+ "isPublic": true
3332
+ },
3333
+ "insertIfAbsent": {
3334
+ "name": "insertIfAbsent",
3335
+ "async": true,
3336
+ "parameters": [
3337
+ {
3338
+ "name": "write",
3339
+ "type": "PasskeyCredentialWrite",
3340
+ "optional": false
3341
+ }
3342
+ ],
3343
+ "returnType": "Promise<UsersPasskeyCredential | null>",
3344
+ "isStatic": false,
3345
+ "isPublic": true
3346
+ },
3347
+ "recordUseIfCurrent": {
3348
+ "name": "recordUseIfCurrent",
3349
+ "async": true,
3350
+ "parameters": [
3351
+ {
3352
+ "name": "id",
3353
+ "type": "string",
3354
+ "optional": false
3355
+ },
3356
+ {
3357
+ "name": "userId",
3358
+ "type": "string",
3359
+ "optional": false
3360
+ },
3361
+ {
3362
+ "name": "expectedSignCount",
3363
+ "type": "number",
3364
+ "optional": false
3365
+ },
3366
+ {
3367
+ "name": "newSignCount",
3368
+ "type": "number",
3369
+ "optional": false
3370
+ },
3371
+ {
3372
+ "name": "backedUp",
3373
+ "type": "boolean",
3374
+ "optional": false
3375
+ },
3376
+ {
3377
+ "name": "now",
3378
+ "type": "Date",
3379
+ "optional": true
3380
+ }
3381
+ ],
3382
+ "returnType": "Promise<boolean>",
3383
+ "isStatic": false,
3384
+ "isPublic": true
3385
+ },
3386
+ "renameOwned": {
3387
+ "name": "renameOwned",
3388
+ "async": true,
3389
+ "parameters": [
3390
+ {
3391
+ "name": "id",
3392
+ "type": "string",
3393
+ "optional": false
3394
+ },
3395
+ {
3396
+ "name": "userId",
3397
+ "type": "string",
3398
+ "optional": false
3399
+ },
3400
+ {
3401
+ "name": "name",
3402
+ "type": "string",
3403
+ "optional": false
3404
+ }
3405
+ ],
3406
+ "returnType": "Promise<boolean>",
3407
+ "isStatic": false,
3408
+ "isPublic": true
3409
+ },
3410
+ "deleteOwned": {
3411
+ "name": "deleteOwned",
3412
+ "async": true,
3413
+ "parameters": [
3414
+ {
3415
+ "name": "id",
3416
+ "type": "string",
3417
+ "optional": false
3418
+ },
3419
+ {
3420
+ "name": "userId",
3421
+ "type": "string",
3422
+ "optional": false
3423
+ }
3424
+ ],
3425
+ "returnType": "Promise<boolean>",
3426
+ "isStatic": false,
3427
+ "isPublic": true
3428
+ },
3429
+ "deleteAllForUser": {
3430
+ "name": "deleteAllForUser",
3431
+ "async": true,
3432
+ "parameters": [
3433
+ {
3434
+ "name": "userId",
3435
+ "type": "string",
3436
+ "optional": false
3437
+ }
3438
+ ],
3439
+ "returnType": "Promise<number>",
3440
+ "isStatic": false,
3441
+ "isPublic": true
3442
+ }
3443
+ },
3444
+ "decoratorConfig": {
3445
+ "tableName": "users_passkey_credentials",
3446
+ "api": false,
3447
+ "mcp": false,
3448
+ "cli": false
3449
+ },
3450
+ "extends": "SmrtCollection",
3451
+ "extendsTypeArg": "UsersPasskeyCredential",
3452
+ "exportName": "UsersPasskeyCredentialCollection",
3453
+ "collectionExportName": "UsersPasskeyCredentialCollectionCollection",
3454
+ "schema": {
3455
+ "tableName": "users_passkey_credentials",
3456
+ "ddl": "CREATE TABLE IF NOT EXISTS \"users_passkey_credentials\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"user_id\" UUID NOT NULL,\n \"credential_id\" TEXT NOT NULL UNIQUE,\n \"public_key\" TEXT NOT NULL,\n \"sign_count\" INTEGER NOT NULL DEFAULT 0,\n \"transports\" TEXT,\n \"name\" TEXT NOT NULL,\n \"aaguid\" TEXT,\n \"backed_up\" BOOLEAN NOT NULL DEFAULT FALSE,\n \"device_type\" TEXT,\n \"last_used_at\" TIMESTAMP,\n \"created_by\" TEXT\n);",
3457
+ "columns": {
3458
+ "id": {
3459
+ "type": "UUID",
3460
+ "primaryKey": true,
3461
+ "referenceKind": "id",
3462
+ "notNull": true
3463
+ },
3464
+ "slug": {
3465
+ "type": "TEXT",
3466
+ "notNull": true
3467
+ },
3468
+ "context": {
3469
+ "type": "TEXT",
3470
+ "notNull": true,
3471
+ "default": ""
3472
+ },
3473
+ "created_at": {
3474
+ "type": "TIMESTAMP",
3475
+ "notNull": true,
3476
+ "default": "current_timestamp"
3477
+ },
3478
+ "updated_at": {
3479
+ "type": "TIMESTAMP",
3480
+ "notNull": true,
3481
+ "default": "current_timestamp"
3482
+ },
3483
+ "user_id": {
3484
+ "type": "UUID",
3485
+ "referenceKind": "foreignKey",
3486
+ "notNull": true,
3487
+ "unique": false,
3488
+ "foreignKey": {
3489
+ "table": "users",
3490
+ "column": "id",
3491
+ "onDelete": "NO ACTION",
3492
+ "onUpdate": "CASCADE"
3493
+ }
3494
+ },
3495
+ "credential_id": {
3496
+ "type": "TEXT",
3497
+ "notNull": true,
3498
+ "unique": true
3499
+ },
3500
+ "public_key": {
3501
+ "type": "TEXT",
3502
+ "notNull": true,
3503
+ "unique": false
3504
+ },
3505
+ "sign_count": {
3506
+ "type": "INTEGER",
3507
+ "notNull": true,
3508
+ "unique": false,
3509
+ "default": 0
3510
+ },
3511
+ "transports": {
3512
+ "type": "TEXT",
3513
+ "notNull": false,
3514
+ "unique": false
3515
+ },
3516
+ "name": {
3517
+ "type": "TEXT",
3518
+ "notNull": true,
3519
+ "unique": false
3520
+ },
3521
+ "aaguid": {
3522
+ "type": "TEXT",
3523
+ "notNull": false,
3524
+ "unique": false
3525
+ },
3526
+ "backed_up": {
3527
+ "type": "BOOLEAN",
3528
+ "notNull": true,
3529
+ "unique": false,
3530
+ "default": false
3531
+ },
3532
+ "device_type": {
3533
+ "type": "TEXT",
3534
+ "notNull": false,
3535
+ "unique": false
3536
+ },
3537
+ "last_used_at": {
3538
+ "type": "TIMESTAMP",
3539
+ "notNull": false,
3540
+ "unique": false
3541
+ },
3542
+ "created_by": {
3543
+ "type": "TEXT",
3544
+ "notNull": false,
3545
+ "unique": false
3546
+ }
3547
+ },
3548
+ "indexes": [
3549
+ {
3550
+ "name": "users_passkey_credentials_slug_context_idx",
3551
+ "columns": [
3552
+ "slug",
3553
+ "context"
3554
+ ],
3555
+ "unique": true
3556
+ },
3557
+ {
3558
+ "name": "users_passkey_credentials_created_at_idx",
3559
+ "columns": [
3560
+ "created_at"
3561
+ ]
3562
+ },
3563
+ {
3564
+ "name": "users_passkey_credentials_user_id_idx",
3565
+ "columns": [
3566
+ "user_id"
3567
+ ]
3568
+ }
3569
+ ],
3570
+ "version": "4483d2e2"
3571
+ },
3572
+ "importPath": "@happyvertical/smrt-users"
3573
+ },
3131
3574
  "@happyvertical/smrt-users:UsersPasswordCredentialCollection": {
3132
3575
  "name": "userspasswordcredentialcollection",
3133
3576
  "className": "UsersPasswordCredentialCollection",
@@ -10387,7 +10830,200 @@
10387
10830
  "onUpdate": "CASCADE"
10388
10831
  }
10389
10832
  },
10390
- "effect": {
10833
+ "effect": {
10834
+ "type": "TEXT",
10835
+ "notNull": false,
10836
+ "unique": false
10837
+ }
10838
+ },
10839
+ "indexes": [
10840
+ {
10841
+ "name": "membership_overrides_membership_id_permission_id_idx",
10842
+ "columns": [
10843
+ "membership_id",
10844
+ "permission_id"
10845
+ ],
10846
+ "unique": true
10847
+ },
10848
+ {
10849
+ "name": "membership_overrides_slug_context_idx",
10850
+ "columns": [
10851
+ "slug",
10852
+ "context"
10853
+ ]
10854
+ },
10855
+ {
10856
+ "name": "membership_overrides_created_at_idx",
10857
+ "columns": [
10858
+ "created_at"
10859
+ ]
10860
+ },
10861
+ {
10862
+ "name": "membership_overrides_permission_id_idx",
10863
+ "columns": [
10864
+ "permission_id"
10865
+ ]
10866
+ }
10867
+ ],
10868
+ "version": "25fe9da8"
10869
+ },
10870
+ "importPath": "@happyvertical/smrt-users"
10871
+ },
10872
+ "@happyvertical/smrt-users:UsersOAuthClient": {
10873
+ "name": "usersoauthclient",
10874
+ "className": "UsersOAuthClient",
10875
+ "qualifiedName": "@happyvertical/smrt-users:UsersOAuthClient",
10876
+ "collection": "usersoauthclients",
10877
+ "filePath": "/home/runner/work/smrt/smrt/packages/users/src/models/OAuthAuthorization.ts",
10878
+ "packageName": "@happyvertical/smrt-users",
10879
+ "fields": {
10880
+ "clientId": {
10881
+ "type": "text",
10882
+ "required": true,
10883
+ "_meta": {
10884
+ "required": true,
10885
+ "unique": true
10886
+ }
10887
+ },
10888
+ "redirectUris": {
10889
+ "type": "text",
10890
+ "required": false
10891
+ },
10892
+ "allowedScopes": {
10893
+ "type": "text",
10894
+ "required": false
10895
+ },
10896
+ "tokenEndpointAuthMethod": {
10897
+ "type": "text",
10898
+ "required": false,
10899
+ "default": "none",
10900
+ "enum": [
10901
+ "none",
10902
+ "client_secret_post"
10903
+ ]
10904
+ },
10905
+ "secretHash": {
10906
+ "type": "text",
10907
+ "required": false,
10908
+ "_meta": {
10909
+ "nullable": true,
10910
+ "sensitive": true
10911
+ },
10912
+ "sensitive": true
10913
+ },
10914
+ "allowedResources": {
10915
+ "type": "text",
10916
+ "required": false
10917
+ },
10918
+ "createdAt": {
10919
+ "type": "datetime",
10920
+ "required": false,
10921
+ "_meta": {}
10922
+ }
10923
+ },
10924
+ "methods": {
10925
+ "getRedirectUris": {
10926
+ "name": "getRedirectUris",
10927
+ "async": false,
10928
+ "parameters": [],
10929
+ "returnType": "string[]",
10930
+ "isStatic": false,
10931
+ "isPublic": true
10932
+ },
10933
+ "getAllowedScopes": {
10934
+ "name": "getAllowedScopes",
10935
+ "async": false,
10936
+ "parameters": [],
10937
+ "returnType": "string[]",
10938
+ "isStatic": false,
10939
+ "isPublic": true
10940
+ },
10941
+ "getAllowedResources": {
10942
+ "name": "getAllowedResources",
10943
+ "async": false,
10944
+ "parameters": [],
10945
+ "returnType": "string[] | undefined",
10946
+ "isStatic": false,
10947
+ "isPublic": true
10948
+ }
10949
+ },
10950
+ "decoratorConfig": {
10951
+ "tableName": "users_oauth_clients",
10952
+ "sensitive": true,
10953
+ "api": {
10954
+ "include": []
10955
+ },
10956
+ "mcp": {
10957
+ "include": []
10958
+ },
10959
+ "cli": false
10960
+ },
10961
+ "extends": "SmrtObject",
10962
+ "exportName": "UsersOAuthClient",
10963
+ "collectionExportName": "UsersOAuthClientCollection",
10964
+ "validationRules": [
10965
+ {
10966
+ "field": "clientId",
10967
+ "rule": "required",
10968
+ "fieldType": "text"
10969
+ }
10970
+ ],
10971
+ "schema": {
10972
+ "tableName": "users_oauth_clients",
10973
+ "ddl": "CREATE TABLE IF NOT EXISTS \"users_oauth_clients\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"client_id\" TEXT NOT NULL UNIQUE,\n \"redirect_uris\" TEXT,\n \"allowed_scopes\" TEXT,\n \"token_endpoint_auth_method\" TEXT DEFAULT 'none',\n \"secret_hash\" TEXT,\n \"allowed_resources\" TEXT\n);",
10974
+ "columns": {
10975
+ "id": {
10976
+ "type": "UUID",
10977
+ "primaryKey": true,
10978
+ "referenceKind": "id",
10979
+ "notNull": true
10980
+ },
10981
+ "slug": {
10982
+ "type": "TEXT",
10983
+ "notNull": true
10984
+ },
10985
+ "context": {
10986
+ "type": "TEXT",
10987
+ "notNull": true,
10988
+ "default": ""
10989
+ },
10990
+ "created_at": {
10991
+ "type": "TIMESTAMP",
10992
+ "notNull": true,
10993
+ "default": "current_timestamp"
10994
+ },
10995
+ "updated_at": {
10996
+ "type": "TIMESTAMP",
10997
+ "notNull": true,
10998
+ "default": "current_timestamp"
10999
+ },
11000
+ "client_id": {
11001
+ "type": "TEXT",
11002
+ "notNull": true,
11003
+ "unique": true
11004
+ },
11005
+ "redirect_uris": {
11006
+ "type": "TEXT",
11007
+ "notNull": false,
11008
+ "unique": false
11009
+ },
11010
+ "allowed_scopes": {
11011
+ "type": "TEXT",
11012
+ "notNull": false,
11013
+ "unique": false
11014
+ },
11015
+ "token_endpoint_auth_method": {
11016
+ "type": "TEXT",
11017
+ "notNull": false,
11018
+ "unique": false,
11019
+ "default": "none"
11020
+ },
11021
+ "secret_hash": {
11022
+ "type": "TEXT",
11023
+ "notNull": false,
11024
+ "unique": false
11025
+ },
11026
+ "allowed_resources": {
10391
11027
  "type": "TEXT",
10392
11028
  "notNull": false,
10393
11029
  "unique": false
@@ -10395,117 +11031,130 @@
10395
11031
  },
10396
11032
  "indexes": [
10397
11033
  {
10398
- "name": "membership_overrides_membership_id_permission_id_idx",
10399
- "columns": [
10400
- "membership_id",
10401
- "permission_id"
10402
- ],
10403
- "unique": true
10404
- },
10405
- {
10406
- "name": "membership_overrides_slug_context_idx",
11034
+ "name": "users_oauth_clients_slug_context_idx",
10407
11035
  "columns": [
10408
11036
  "slug",
10409
11037
  "context"
10410
- ]
11038
+ ],
11039
+ "unique": true
10411
11040
  },
10412
11041
  {
10413
- "name": "membership_overrides_created_at_idx",
11042
+ "name": "users_oauth_clients_created_at_idx",
10414
11043
  "columns": [
10415
11044
  "created_at"
10416
11045
  ]
10417
- },
10418
- {
10419
- "name": "membership_overrides_permission_id_idx",
10420
- "columns": [
10421
- "permission_id"
10422
- ]
10423
11046
  }
10424
11047
  ],
10425
- "version": "25fe9da8"
11048
+ "version": "0ecda18c"
10426
11049
  },
10427
11050
  "importPath": "@happyvertical/smrt-users"
10428
11051
  },
10429
- "@happyvertical/smrt-users:UsersOAuthClient": {
10430
- "name": "usersoauthclient",
10431
- "className": "UsersOAuthClient",
10432
- "qualifiedName": "@happyvertical/smrt-users:UsersOAuthClient",
10433
- "collection": "usersoauthclients",
11052
+ "@happyvertical/smrt-users:UsersOAuthAuthorizationCode": {
11053
+ "name": "usersoauthauthorizationcode",
11054
+ "className": "UsersOAuthAuthorizationCode",
11055
+ "qualifiedName": "@happyvertical/smrt-users:UsersOAuthAuthorizationCode",
11056
+ "collection": "usersoauthauthorizationcodes",
10434
11057
  "filePath": "/home/runner/work/smrt/smrt/packages/users/src/models/OAuthAuthorization.ts",
10435
11058
  "packageName": "@happyvertical/smrt-users",
10436
11059
  "fields": {
10437
- "clientId": {
11060
+ "authorizationId": {
11061
+ "type": "text",
11062
+ "required": false,
11063
+ "_meta": {
11064
+ "nullable": true,
11065
+ "indexed": true
11066
+ }
11067
+ },
11068
+ "codeHash": {
10438
11069
  "type": "text",
10439
11070
  "required": true,
10440
11071
  "_meta": {
10441
11072
  "required": true,
10442
- "unique": true
11073
+ "unique": true,
11074
+ "sensitive": true
11075
+ },
11076
+ "sensitive": true
11077
+ },
11078
+ "clientId": {
11079
+ "type": "text",
11080
+ "required": false,
11081
+ "_meta": {
11082
+ "indexed": true
10443
11083
  }
10444
11084
  },
10445
- "redirectUris": {
11085
+ "subject": {
11086
+ "type": "text",
11087
+ "required": false,
11088
+ "_meta": {
11089
+ "indexed": true
11090
+ }
11091
+ },
11092
+ "tenantId": {
11093
+ "type": "text",
11094
+ "required": false,
11095
+ "_meta": {
11096
+ "nullable": true,
11097
+ "indexed": true
11098
+ }
11099
+ },
11100
+ "claims": {
10446
11101
  "type": "text",
10447
11102
  "required": false
10448
11103
  },
10449
- "allowedScopes": {
11104
+ "redirectUri": {
10450
11105
  "type": "text",
10451
11106
  "required": false
10452
11107
  },
10453
- "tokenEndpointAuthMethod": {
11108
+ "scopes": {
10454
11109
  "type": "text",
10455
- "required": false,
10456
- "default": "none",
10457
- "enum": [
10458
- "none",
10459
- "client_secret_post"
10460
- ]
11110
+ "required": false
10461
11111
  },
10462
- "secretHash": {
11112
+ "resource": {
10463
11113
  "type": "text",
10464
11114
  "required": false,
10465
11115
  "_meta": {
10466
- "nullable": true,
10467
- "sensitive": true
10468
- },
10469
- "sensitive": true
11116
+ "nullable": true
11117
+ }
10470
11118
  },
10471
- "allowedResources": {
11119
+ "codeChallenge": {
10472
11120
  "type": "text",
10473
11121
  "required": false
10474
11122
  },
10475
- "createdAt": {
11123
+ "expiresAt": {
10476
11124
  "type": "datetime",
10477
11125
  "required": false,
10478
- "_meta": {}
11126
+ "_meta": {
11127
+ "indexed": true
11128
+ }
11129
+ },
11130
+ "consumedAt": {
11131
+ "type": "datetime",
11132
+ "required": false,
11133
+ "_meta": {
11134
+ "nullable": true
11135
+ }
10479
11136
  }
10480
11137
  },
10481
11138
  "methods": {
10482
- "getRedirectUris": {
10483
- "name": "getRedirectUris",
10484
- "async": false,
10485
- "parameters": [],
10486
- "returnType": "string[]",
10487
- "isStatic": false,
10488
- "isPublic": true
10489
- },
10490
- "getAllowedScopes": {
10491
- "name": "getAllowedScopes",
11139
+ "getScopes": {
11140
+ "name": "getScopes",
10492
11141
  "async": false,
10493
11142
  "parameters": [],
10494
11143
  "returnType": "string[]",
10495
11144
  "isStatic": false,
10496
11145
  "isPublic": true
10497
11146
  },
10498
- "getAllowedResources": {
10499
- "name": "getAllowedResources",
11147
+ "getClaims": {
11148
+ "name": "getClaims",
10500
11149
  "async": false,
10501
11150
  "parameters": [],
10502
- "returnType": "string[] | undefined",
11151
+ "returnType": "OAuthTokenClaims",
10503
11152
  "isStatic": false,
10504
11153
  "isPublic": true
10505
11154
  }
10506
11155
  },
10507
11156
  "decoratorConfig": {
10508
- "tableName": "users_oauth_clients",
11157
+ "tableName": "users_oauth_authorization_codes",
10509
11158
  "sensitive": true,
10510
11159
  "api": {
10511
11160
  "include": []
@@ -10513,21 +11162,26 @@
10513
11162
  "mcp": {
10514
11163
  "include": []
10515
11164
  },
10516
- "cli": false
11165
+ "cli": false,
11166
+ "conflictColumns": [
11167
+ "tenant_id",
11168
+ "slug",
11169
+ "context"
11170
+ ]
10517
11171
  },
10518
11172
  "extends": "SmrtObject",
10519
- "exportName": "UsersOAuthClient",
10520
- "collectionExportName": "UsersOAuthClientCollection",
11173
+ "exportName": "UsersOAuthAuthorizationCode",
11174
+ "collectionExportName": "UsersOAuthAuthorizationCodeCollection",
10521
11175
  "validationRules": [
10522
11176
  {
10523
- "field": "clientId",
11177
+ "field": "codeHash",
10524
11178
  "rule": "required",
10525
11179
  "fieldType": "text"
10526
11180
  }
10527
11181
  ],
10528
11182
  "schema": {
10529
- "tableName": "users_oauth_clients",
10530
- "ddl": "CREATE TABLE IF NOT EXISTS \"users_oauth_clients\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"client_id\" TEXT NOT NULL UNIQUE,\n \"redirect_uris\" TEXT,\n \"allowed_scopes\" TEXT,\n \"token_endpoint_auth_method\" TEXT DEFAULT 'none',\n \"secret_hash\" TEXT,\n \"allowed_resources\" TEXT\n);",
11183
+ "tableName": "users_oauth_authorization_codes",
11184
+ "ddl": "CREATE TABLE IF NOT EXISTS \"users_oauth_authorization_codes\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"authorization_id\" TEXT,\n \"code_hash\" TEXT NOT NULL UNIQUE,\n \"client_id\" TEXT,\n \"subject\" TEXT,\n \"tenant_id\" TEXT,\n \"claims\" TEXT,\n \"redirect_uri\" TEXT,\n \"scopes\" TEXT,\n \"resource\" TEXT,\n \"code_challenge\" TEXT,\n \"expires_at\" TIMESTAMP,\n \"consumed_at\" TIMESTAMP\n);",
10531
11185
  "columns": {
10532
11186
  "id": {
10533
11187
  "type": "UUID",
@@ -10554,63 +11208,124 @@
10554
11208
  "notNull": true,
10555
11209
  "default": "current_timestamp"
10556
11210
  },
10557
- "client_id": {
11211
+ "authorization_id": {
11212
+ "type": "TEXT",
11213
+ "notNull": false,
11214
+ "unique": false
11215
+ },
11216
+ "code_hash": {
10558
11217
  "type": "TEXT",
10559
11218
  "notNull": true,
10560
11219
  "unique": true
10561
11220
  },
10562
- "redirect_uris": {
11221
+ "client_id": {
10563
11222
  "type": "TEXT",
10564
11223
  "notNull": false,
10565
11224
  "unique": false
10566
11225
  },
10567
- "allowed_scopes": {
11226
+ "subject": {
10568
11227
  "type": "TEXT",
10569
11228
  "notNull": false,
10570
11229
  "unique": false
10571
11230
  },
10572
- "token_endpoint_auth_method": {
11231
+ "tenant_id": {
10573
11232
  "type": "TEXT",
10574
11233
  "notNull": false,
10575
- "unique": false,
10576
- "default": "none"
11234
+ "unique": false
10577
11235
  },
10578
- "secret_hash": {
11236
+ "claims": {
10579
11237
  "type": "TEXT",
10580
11238
  "notNull": false,
10581
11239
  "unique": false
10582
11240
  },
10583
- "allowed_resources": {
11241
+ "redirect_uri": {
11242
+ "type": "TEXT",
11243
+ "notNull": false,
11244
+ "unique": false
11245
+ },
11246
+ "scopes": {
11247
+ "type": "TEXT",
11248
+ "notNull": false,
11249
+ "unique": false
11250
+ },
11251
+ "resource": {
11252
+ "type": "TEXT",
11253
+ "notNull": false,
11254
+ "unique": false
11255
+ },
11256
+ "code_challenge": {
10584
11257
  "type": "TEXT",
10585
11258
  "notNull": false,
10586
11259
  "unique": false
11260
+ },
11261
+ "expires_at": {
11262
+ "type": "TIMESTAMP",
11263
+ "notNull": false,
11264
+ "unique": false
11265
+ },
11266
+ "consumed_at": {
11267
+ "type": "TIMESTAMP",
11268
+ "notNull": false,
11269
+ "unique": false
10587
11270
  }
10588
11271
  },
10589
11272
  "indexes": [
10590
11273
  {
10591
- "name": "users_oauth_clients_slug_context_idx",
11274
+ "name": "users_oauth_authorization_codes_tenant_id_slug_idx",
10592
11275
  "columns": [
11276
+ "tenant_id",
10593
11277
  "slug",
10594
11278
  "context"
10595
11279
  ],
10596
- "unique": true
11280
+ "unique": true,
11281
+ "nullsNotDistinct": true
10597
11282
  },
10598
11283
  {
10599
- "name": "users_oauth_clients_created_at_idx",
11284
+ "name": "users_oauth_authorization_codes_authorization_id_idx",
11285
+ "columns": [
11286
+ "authorization_id"
11287
+ ]
11288
+ },
11289
+ {
11290
+ "name": "users_oauth_authorization_codes_client_id_idx",
11291
+ "columns": [
11292
+ "client_id"
11293
+ ]
11294
+ },
11295
+ {
11296
+ "name": "users_oauth_authorization_codes_subject_idx",
11297
+ "columns": [
11298
+ "subject"
11299
+ ]
11300
+ },
11301
+ {
11302
+ "name": "users_oauth_authorization_codes_tenant_id_idx",
11303
+ "columns": [
11304
+ "tenant_id"
11305
+ ]
11306
+ },
11307
+ {
11308
+ "name": "users_oauth_authorization_codes_expires_at_idx",
11309
+ "columns": [
11310
+ "expires_at"
11311
+ ]
11312
+ },
11313
+ {
11314
+ "name": "users_oauth_authorization_codes_created_at_idx",
10600
11315
  "columns": [
10601
11316
  "created_at"
10602
11317
  ]
10603
11318
  }
10604
11319
  ],
10605
- "version": "0ecda18c"
11320
+ "version": "f5c5d615"
10606
11321
  },
10607
11322
  "importPath": "@happyvertical/smrt-users"
10608
11323
  },
10609
- "@happyvertical/smrt-users:UsersOAuthAuthorizationCode": {
10610
- "name": "usersoauthauthorizationcode",
10611
- "className": "UsersOAuthAuthorizationCode",
10612
- "qualifiedName": "@happyvertical/smrt-users:UsersOAuthAuthorizationCode",
10613
- "collection": "usersoauthauthorizationcodes",
11324
+ "@happyvertical/smrt-users:UsersOAuthRefreshGrant": {
11325
+ "name": "usersoauthrefreshgrant",
11326
+ "className": "UsersOAuthRefreshGrant",
11327
+ "qualifiedName": "@happyvertical/smrt-users:UsersOAuthRefreshGrant",
11328
+ "collection": "usersoauthrefreshgrants",
10614
11329
  "filePath": "/home/runner/work/smrt/smrt/packages/users/src/models/OAuthAuthorization.ts",
10615
11330
  "packageName": "@happyvertical/smrt-users",
10616
11331
  "fields": {
@@ -10622,7 +11337,7 @@
10622
11337
  "indexed": true
10623
11338
  }
10624
11339
  },
10625
- "codeHash": {
11340
+ "tokenHash": {
10626
11341
  "type": "text",
10627
11342
  "required": true,
10628
11343
  "_meta": {
@@ -10632,6 +11347,13 @@
10632
11347
  },
10633
11348
  "sensitive": true
10634
11349
  },
11350
+ "familyId": {
11351
+ "type": "text",
11352
+ "required": false,
11353
+ "_meta": {
11354
+ "indexed": true
11355
+ }
11356
+ },
10635
11357
  "clientId": {
10636
11358
  "type": "text",
10637
11359
  "required": false,
@@ -10652,13 +11374,9 @@
10652
11374
  "_meta": {
10653
11375
  "nullable": true,
10654
11376
  "indexed": true
10655
- }
10656
- },
10657
- "claims": {
10658
- "type": "text",
10659
- "required": false
11377
+ }
10660
11378
  },
10661
- "redirectUri": {
11379
+ "claims": {
10662
11380
  "type": "text",
10663
11381
  "required": false
10664
11382
  },
@@ -10673,10 +11391,6 @@
10673
11391
  "nullable": true
10674
11392
  }
10675
11393
  },
10676
- "codeChallenge": {
10677
- "type": "text",
10678
- "required": false
10679
- },
10680
11394
  "expiresAt": {
10681
11395
  "type": "datetime",
10682
11396
  "required": false,
@@ -10690,6 +11404,14 @@
10690
11404
  "_meta": {
10691
11405
  "nullable": true
10692
11406
  }
11407
+ },
11408
+ "revokedAt": {
11409
+ "type": "datetime",
11410
+ "required": false,
11411
+ "_meta": {
11412
+ "nullable": true,
11413
+ "indexed": true
11414
+ }
10693
11415
  }
10694
11416
  },
10695
11417
  "methods": {
@@ -10711,7 +11433,7 @@
10711
11433
  }
10712
11434
  },
10713
11435
  "decoratorConfig": {
10714
- "tableName": "users_oauth_authorization_codes",
11436
+ "tableName": "users_oauth_refresh_grants",
10715
11437
  "sensitive": true,
10716
11438
  "api": {
10717
11439
  "include": []
@@ -10727,18 +11449,18 @@
10727
11449
  ]
10728
11450
  },
10729
11451
  "extends": "SmrtObject",
10730
- "exportName": "UsersOAuthAuthorizationCode",
10731
- "collectionExportName": "UsersOAuthAuthorizationCodeCollection",
11452
+ "exportName": "UsersOAuthRefreshGrant",
11453
+ "collectionExportName": "UsersOAuthRefreshGrantCollection",
10732
11454
  "validationRules": [
10733
11455
  {
10734
- "field": "codeHash",
11456
+ "field": "tokenHash",
10735
11457
  "rule": "required",
10736
11458
  "fieldType": "text"
10737
11459
  }
10738
11460
  ],
10739
11461
  "schema": {
10740
- "tableName": "users_oauth_authorization_codes",
10741
- "ddl": "CREATE TABLE IF NOT EXISTS \"users_oauth_authorization_codes\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"authorization_id\" TEXT,\n \"code_hash\" TEXT NOT NULL UNIQUE,\n \"client_id\" TEXT,\n \"subject\" TEXT,\n \"tenant_id\" TEXT,\n \"claims\" TEXT,\n \"redirect_uri\" TEXT,\n \"scopes\" TEXT,\n \"resource\" TEXT,\n \"code_challenge\" TEXT,\n \"expires_at\" TIMESTAMP,\n \"consumed_at\" TIMESTAMP\n);",
11462
+ "tableName": "users_oauth_refresh_grants",
11463
+ "ddl": "CREATE TABLE IF NOT EXISTS \"users_oauth_refresh_grants\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"authorization_id\" TEXT,\n \"token_hash\" TEXT NOT NULL UNIQUE,\n \"family_id\" TEXT,\n \"client_id\" TEXT,\n \"subject\" TEXT,\n \"tenant_id\" TEXT,\n \"claims\" TEXT,\n \"scopes\" TEXT,\n \"resource\" TEXT,\n \"expires_at\" TIMESTAMP,\n \"consumed_at\" TIMESTAMP,\n \"revoked_at\" TIMESTAMP\n);",
10742
11464
  "columns": {
10743
11465
  "id": {
10744
11466
  "type": "UUID",
@@ -10770,32 +11492,32 @@
10770
11492
  "notNull": false,
10771
11493
  "unique": false
10772
11494
  },
10773
- "code_hash": {
11495
+ "token_hash": {
10774
11496
  "type": "TEXT",
10775
11497
  "notNull": true,
10776
11498
  "unique": true
10777
11499
  },
10778
- "client_id": {
11500
+ "family_id": {
10779
11501
  "type": "TEXT",
10780
11502
  "notNull": false,
10781
11503
  "unique": false
10782
11504
  },
10783
- "subject": {
11505
+ "client_id": {
10784
11506
  "type": "TEXT",
10785
11507
  "notNull": false,
10786
11508
  "unique": false
10787
11509
  },
10788
- "tenant_id": {
11510
+ "subject": {
10789
11511
  "type": "TEXT",
10790
11512
  "notNull": false,
10791
11513
  "unique": false
10792
11514
  },
10793
- "claims": {
11515
+ "tenant_id": {
10794
11516
  "type": "TEXT",
10795
11517
  "notNull": false,
10796
11518
  "unique": false
10797
11519
  },
10798
- "redirect_uri": {
11520
+ "claims": {
10799
11521
  "type": "TEXT",
10800
11522
  "notNull": false,
10801
11523
  "unique": false
@@ -10810,17 +11532,17 @@
10810
11532
  "notNull": false,
10811
11533
  "unique": false
10812
11534
  },
10813
- "code_challenge": {
10814
- "type": "TEXT",
11535
+ "expires_at": {
11536
+ "type": "TIMESTAMP",
10815
11537
  "notNull": false,
10816
11538
  "unique": false
10817
11539
  },
10818
- "expires_at": {
11540
+ "consumed_at": {
10819
11541
  "type": "TIMESTAMP",
10820
11542
  "notNull": false,
10821
11543
  "unique": false
10822
11544
  },
10823
- "consumed_at": {
11545
+ "revoked_at": {
10824
11546
  "type": "TIMESTAMP",
10825
11547
  "notNull": false,
10826
11548
  "unique": false
@@ -10828,7 +11550,7 @@
10828
11550
  },
10829
11551
  "indexes": [
10830
11552
  {
10831
- "name": "users_oauth_authorization_codes_tenant_id_slug_idx",
11553
+ "name": "users_oauth_refresh_grants_tenant_id_slug_idx",
10832
11554
  "columns": [
10833
11555
  "tenant_id",
10834
11556
  "slug",
@@ -10838,63 +11560,67 @@
10838
11560
  "nullsNotDistinct": true
10839
11561
  },
10840
11562
  {
10841
- "name": "users_oauth_authorization_codes_authorization_id_idx",
11563
+ "name": "users_oauth_refresh_grants_authorization_id_idx",
10842
11564
  "columns": [
10843
11565
  "authorization_id"
10844
11566
  ]
10845
11567
  },
10846
11568
  {
10847
- "name": "users_oauth_authorization_codes_client_id_idx",
11569
+ "name": "users_oauth_refresh_grants_family_id_idx",
11570
+ "columns": [
11571
+ "family_id"
11572
+ ]
11573
+ },
11574
+ {
11575
+ "name": "users_oauth_refresh_grants_client_id_idx",
10848
11576
  "columns": [
10849
11577
  "client_id"
10850
11578
  ]
10851
11579
  },
10852
11580
  {
10853
- "name": "users_oauth_authorization_codes_subject_idx",
11581
+ "name": "users_oauth_refresh_grants_subject_idx",
10854
11582
  "columns": [
10855
11583
  "subject"
10856
11584
  ]
10857
11585
  },
10858
11586
  {
10859
- "name": "users_oauth_authorization_codes_tenant_id_idx",
11587
+ "name": "users_oauth_refresh_grants_tenant_id_idx",
10860
11588
  "columns": [
10861
11589
  "tenant_id"
10862
11590
  ]
10863
11591
  },
10864
11592
  {
10865
- "name": "users_oauth_authorization_codes_expires_at_idx",
11593
+ "name": "users_oauth_refresh_grants_expires_at_idx",
10866
11594
  "columns": [
10867
11595
  "expires_at"
10868
11596
  ]
10869
11597
  },
10870
11598
  {
10871
- "name": "users_oauth_authorization_codes_created_at_idx",
11599
+ "name": "users_oauth_refresh_grants_revoked_at_idx",
11600
+ "columns": [
11601
+ "revoked_at"
11602
+ ]
11603
+ },
11604
+ {
11605
+ "name": "users_oauth_refresh_grants_created_at_idx",
10872
11606
  "columns": [
10873
11607
  "created_at"
10874
11608
  ]
10875
11609
  }
10876
11610
  ],
10877
- "version": "f5c5d615"
11611
+ "version": "d332998e"
10878
11612
  },
10879
11613
  "importPath": "@happyvertical/smrt-users"
10880
11614
  },
10881
- "@happyvertical/smrt-users:UsersOAuthRefreshGrant": {
10882
- "name": "usersoauthrefreshgrant",
10883
- "className": "UsersOAuthRefreshGrant",
10884
- "qualifiedName": "@happyvertical/smrt-users:UsersOAuthRefreshGrant",
10885
- "collection": "usersoauthrefreshgrants",
11615
+ "@happyvertical/smrt-users:UsersOAuthAccessTokenRevocation": {
11616
+ "name": "usersoauthaccesstokenrevocation",
11617
+ "className": "UsersOAuthAccessTokenRevocation",
11618
+ "qualifiedName": "@happyvertical/smrt-users:UsersOAuthAccessTokenRevocation",
11619
+ "collection": "usersoauthaccesstokenrevocations",
10886
11620
  "filePath": "/home/runner/work/smrt/smrt/packages/users/src/models/OAuthAuthorization.ts",
10887
11621
  "packageName": "@happyvertical/smrt-users",
10888
11622
  "fields": {
10889
- "authorizationId": {
10890
- "type": "text",
10891
- "required": false,
10892
- "_meta": {
10893
- "nullable": true,
10894
- "indexed": true
10895
- }
10896
- },
10897
- "tokenHash": {
11623
+ "jti": {
10898
11624
  "type": "text",
10899
11625
  "required": true,
10900
11626
  "_meta": {
@@ -10904,21 +11630,127 @@
10904
11630
  },
10905
11631
  "sensitive": true
10906
11632
  },
10907
- "familyId": {
10908
- "type": "text",
11633
+ "expiresAt": {
11634
+ "type": "datetime",
10909
11635
  "required": false,
10910
11636
  "_meta": {
10911
11637
  "indexed": true
10912
11638
  }
11639
+ }
11640
+ },
11641
+ "methods": {},
11642
+ "decoratorConfig": {
11643
+ "tableName": "users_oauth_access_token_revocations",
11644
+ "sensitive": true,
11645
+ "api": {
11646
+ "include": []
10913
11647
  },
10914
- "clientId": {
11648
+ "mcp": {
11649
+ "include": []
11650
+ },
11651
+ "cli": false
11652
+ },
11653
+ "extends": "SmrtObject",
11654
+ "exportName": "UsersOAuthAccessTokenRevocation",
11655
+ "collectionExportName": "UsersOAuthAccessTokenRevocationCollection",
11656
+ "validationRules": [
11657
+ {
11658
+ "field": "jti",
11659
+ "rule": "required",
11660
+ "fieldType": "text"
11661
+ }
11662
+ ],
11663
+ "schema": {
11664
+ "tableName": "users_oauth_access_token_revocations",
11665
+ "ddl": "CREATE TABLE IF NOT EXISTS \"users_oauth_access_token_revocations\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"jti\" TEXT NOT NULL UNIQUE,\n \"expires_at\" TIMESTAMP\n);",
11666
+ "columns": {
11667
+ "id": {
11668
+ "type": "UUID",
11669
+ "primaryKey": true,
11670
+ "referenceKind": "id",
11671
+ "notNull": true
11672
+ },
11673
+ "slug": {
11674
+ "type": "TEXT",
11675
+ "notNull": true
11676
+ },
11677
+ "context": {
11678
+ "type": "TEXT",
11679
+ "notNull": true,
11680
+ "default": ""
11681
+ },
11682
+ "created_at": {
11683
+ "type": "TIMESTAMP",
11684
+ "notNull": true,
11685
+ "default": "current_timestamp"
11686
+ },
11687
+ "updated_at": {
11688
+ "type": "TIMESTAMP",
11689
+ "notNull": true,
11690
+ "default": "current_timestamp"
11691
+ },
11692
+ "jti": {
11693
+ "type": "TEXT",
11694
+ "notNull": true,
11695
+ "unique": true
11696
+ },
11697
+ "expires_at": {
11698
+ "type": "TIMESTAMP",
11699
+ "notNull": false,
11700
+ "unique": false
11701
+ }
11702
+ },
11703
+ "indexes": [
11704
+ {
11705
+ "name": "users_oauth_access_token_revocations_slug_context_idx",
11706
+ "columns": [
11707
+ "slug",
11708
+ "context"
11709
+ ],
11710
+ "unique": true
11711
+ },
11712
+ {
11713
+ "name": "users_oauth_access_token_revocations_expires_at_idx",
11714
+ "columns": [
11715
+ "expires_at"
11716
+ ]
11717
+ },
11718
+ {
11719
+ "name": "users_oauth_access_token_revocations_created_at_idx",
11720
+ "columns": [
11721
+ "created_at"
11722
+ ]
11723
+ }
11724
+ ],
11725
+ "version": "79147089"
11726
+ },
11727
+ "importPath": "@happyvertical/smrt-users"
11728
+ },
11729
+ "@happyvertical/smrt-users:UsersOAuthAuthorization": {
11730
+ "name": "usersoauthauthorization",
11731
+ "className": "UsersOAuthAuthorization",
11732
+ "qualifiedName": "@happyvertical/smrt-users:UsersOAuthAuthorization",
11733
+ "collection": "usersoauthauthorizations",
11734
+ "description": "A consent decision bound to a server-side session; never exposes its bearer.",
11735
+ "filePath": "/home/runner/work/smrt/smrt/packages/users/src/models/OAuthAuthorization.ts",
11736
+ "packageName": "@happyvertical/smrt-users",
11737
+ "fields": {
11738
+ "subject": {
10915
11739
  "type": "text",
10916
11740
  "required": false,
10917
11741
  "_meta": {
10918
11742
  "indexed": true
10919
11743
  }
10920
11744
  },
10921
- "subject": {
11745
+ "sessionId": {
11746
+ "type": "text",
11747
+ "required": false,
11748
+ "_meta": {
11749
+ "sensitive": true
11750
+ },
11751
+ "sensitive": true
11752
+ },
11753
+ "clientId": {
10922
11754
  "type": "text",
10923
11755
  "required": false,
10924
11756
  "_meta": {
@@ -10929,15 +11761,14 @@
10929
11761
  "type": "text",
10930
11762
  "required": false,
10931
11763
  "_meta": {
10932
- "nullable": true,
10933
- "indexed": true
11764
+ "nullable": true
10934
11765
  }
10935
11766
  },
10936
- "claims": {
11767
+ "scopes": {
10937
11768
  "type": "text",
10938
11769
  "required": false
10939
11770
  },
10940
- "scopes": {
11771
+ "permissionCeiling": {
10941
11772
  "type": "text",
10942
11773
  "required": false
10943
11774
  },
@@ -10948,49 +11779,34 @@
10948
11779
  "nullable": true
10949
11780
  }
10950
11781
  },
10951
- "expiresAt": {
10952
- "type": "datetime",
10953
- "required": false,
10954
- "_meta": {
10955
- "indexed": true
10956
- }
10957
- },
10958
- "consumedAt": {
10959
- "type": "datetime",
10960
- "required": false,
10961
- "_meta": {
10962
- "nullable": true
10963
- }
10964
- },
10965
11782
  "revokedAt": {
10966
11783
  "type": "datetime",
10967
11784
  "required": false,
10968
11785
  "_meta": {
10969
- "nullable": true,
10970
- "indexed": true
11786
+ "nullable": true
10971
11787
  }
10972
11788
  }
10973
11789
  },
10974
11790
  "methods": {
10975
- "getScopes": {
10976
- "name": "getScopes",
11791
+ "getPermissionCeiling": {
11792
+ "name": "getPermissionCeiling",
10977
11793
  "async": false,
10978
11794
  "parameters": [],
10979
11795
  "returnType": "string[]",
10980
11796
  "isStatic": false,
10981
11797
  "isPublic": true
10982
11798
  },
10983
- "getClaims": {
10984
- "name": "getClaims",
11799
+ "getScopes": {
11800
+ "name": "getScopes",
10985
11801
  "async": false,
10986
11802
  "parameters": [],
10987
- "returnType": "OAuthTokenClaims",
11803
+ "returnType": "string[]",
10988
11804
  "isStatic": false,
10989
11805
  "isPublic": true
10990
11806
  }
10991
11807
  },
10992
11808
  "decoratorConfig": {
10993
- "tableName": "users_oauth_refresh_grants",
11809
+ "tableName": "users_oauth_authorizations",
10994
11810
  "sensitive": true,
10995
11811
  "api": {
10996
11812
  "include": []
@@ -11006,18 +11822,11 @@
11006
11822
  ]
11007
11823
  },
11008
11824
  "extends": "SmrtObject",
11009
- "exportName": "UsersOAuthRefreshGrant",
11010
- "collectionExportName": "UsersOAuthRefreshGrantCollection",
11011
- "validationRules": [
11012
- {
11013
- "field": "tokenHash",
11014
- "rule": "required",
11015
- "fieldType": "text"
11016
- }
11017
- ],
11825
+ "exportName": "UsersOAuthAuthorization",
11826
+ "collectionExportName": "UsersOAuthAuthorizationCollection",
11018
11827
  "schema": {
11019
- "tableName": "users_oauth_refresh_grants",
11020
- "ddl": "CREATE TABLE IF NOT EXISTS \"users_oauth_refresh_grants\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"authorization_id\" TEXT,\n \"token_hash\" TEXT NOT NULL UNIQUE,\n \"family_id\" TEXT,\n \"client_id\" TEXT,\n \"subject\" TEXT,\n \"tenant_id\" TEXT,\n \"claims\" TEXT,\n \"scopes\" TEXT,\n \"resource\" TEXT,\n \"expires_at\" TIMESTAMP,\n \"consumed_at\" TIMESTAMP,\n \"revoked_at\" TIMESTAMP\n);",
11828
+ "tableName": "users_oauth_authorizations",
11829
+ "ddl": "CREATE TABLE IF NOT EXISTS \"users_oauth_authorizations\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"subject\" TEXT,\n \"session_id\" TEXT,\n \"client_id\" TEXT,\n \"tenant_id\" TEXT,\n \"scopes\" TEXT,\n \"permission_ceiling\" TEXT,\n \"resource\" TEXT,\n \"revoked_at\" TIMESTAMP\n);",
11021
11830
  "columns": {
11022
11831
  "id": {
11023
11832
  "type": "UUID",
@@ -11044,17 +11853,12 @@
11044
11853
  "notNull": true,
11045
11854
  "default": "current_timestamp"
11046
11855
  },
11047
- "authorization_id": {
11856
+ "subject": {
11048
11857
  "type": "TEXT",
11049
11858
  "notNull": false,
11050
11859
  "unique": false
11051
11860
  },
11052
- "token_hash": {
11053
- "type": "TEXT",
11054
- "notNull": true,
11055
- "unique": true
11056
- },
11057
- "family_id": {
11861
+ "session_id": {
11058
11862
  "type": "TEXT",
11059
11863
  "notNull": false,
11060
11864
  "unique": false
@@ -11064,22 +11868,17 @@
11064
11868
  "notNull": false,
11065
11869
  "unique": false
11066
11870
  },
11067
- "subject": {
11068
- "type": "TEXT",
11069
- "notNull": false,
11070
- "unique": false
11071
- },
11072
11871
  "tenant_id": {
11073
11872
  "type": "TEXT",
11074
11873
  "notNull": false,
11075
11874
  "unique": false
11076
11875
  },
11077
- "claims": {
11876
+ "scopes": {
11078
11877
  "type": "TEXT",
11079
11878
  "notNull": false,
11080
11879
  "unique": false
11081
11880
  },
11082
- "scopes": {
11881
+ "permission_ceiling": {
11083
11882
  "type": "TEXT",
11084
11883
  "notNull": false,
11085
11884
  "unique": false
@@ -11089,16 +11888,6 @@
11089
11888
  "notNull": false,
11090
11889
  "unique": false
11091
11890
  },
11092
- "expires_at": {
11093
- "type": "TIMESTAMP",
11094
- "notNull": false,
11095
- "unique": false
11096
- },
11097
- "consumed_at": {
11098
- "type": "TIMESTAMP",
11099
- "notNull": false,
11100
- "unique": false
11101
- },
11102
11891
  "revoked_at": {
11103
11892
  "type": "TIMESTAMP",
11104
11893
  "notNull": false,
@@ -11107,7 +11896,7 @@
11107
11896
  },
11108
11897
  "indexes": [
11109
11898
  {
11110
- "name": "users_oauth_refresh_grants_tenant_id_slug_idx",
11899
+ "name": "users_oauth_authorizations_tenant_id_slug_idx",
11111
11900
  "columns": [
11112
11901
  "tenant_id",
11113
11902
  "slug",
@@ -11117,109 +11906,201 @@
11117
11906
  "nullsNotDistinct": true
11118
11907
  },
11119
11908
  {
11120
- "name": "users_oauth_refresh_grants_authorization_id_idx",
11121
- "columns": [
11122
- "authorization_id"
11123
- ]
11124
- },
11125
- {
11126
- "name": "users_oauth_refresh_grants_family_id_idx",
11909
+ "name": "users_oauth_authorizations_subject_idx",
11127
11910
  "columns": [
11128
- "family_id"
11911
+ "subject"
11129
11912
  ]
11130
11913
  },
11131
11914
  {
11132
- "name": "users_oauth_refresh_grants_client_id_idx",
11915
+ "name": "users_oauth_authorizations_client_id_idx",
11133
11916
  "columns": [
11134
11917
  "client_id"
11135
11918
  ]
11136
11919
  },
11137
11920
  {
11138
- "name": "users_oauth_refresh_grants_subject_idx",
11921
+ "name": "users_oauth_authorizations_created_at_idx",
11139
11922
  "columns": [
11140
- "subject"
11923
+ "created_at"
11141
11924
  ]
11925
+ }
11926
+ ],
11927
+ "version": "291f8816"
11928
+ },
11929
+ "importPath": "@happyvertical/smrt-users"
11930
+ },
11931
+ "@happyvertical/smrt-users:UsersOAuthRefreshFamily": {
11932
+ "name": "usersoauthrefreshfamily",
11933
+ "className": "UsersOAuthRefreshFamily",
11934
+ "qualifiedName": "@happyvertical/smrt-users:UsersOAuthRefreshFamily",
11935
+ "collection": "usersoauthrefreshfamilies",
11936
+ "description": "Stable lock row: rotation and revocation always serialize on this family.",
11937
+ "filePath": "/home/runner/work/smrt/smrt/packages/users/src/models/OAuthAuthorization.ts",
11938
+ "packageName": "@happyvertical/smrt-users",
11939
+ "fields": {
11940
+ "authorizationId": {
11941
+ "type": "text",
11942
+ "required": false,
11943
+ "_meta": {
11944
+ "nullable": true,
11945
+ "indexed": true
11946
+ }
11947
+ },
11948
+ "revokedAt": {
11949
+ "type": "datetime",
11950
+ "required": false,
11951
+ "_meta": {
11952
+ "nullable": true
11953
+ }
11954
+ }
11955
+ },
11956
+ "methods": {},
11957
+ "decoratorConfig": {
11958
+ "tableName": "users_oauth_refresh_families",
11959
+ "sensitive": true,
11960
+ "api": {
11961
+ "include": []
11962
+ },
11963
+ "mcp": {
11964
+ "include": []
11965
+ },
11966
+ "cli": false
11967
+ },
11968
+ "extends": "SmrtObject",
11969
+ "exportName": "UsersOAuthRefreshFamily",
11970
+ "collectionExportName": "UsersOAuthRefreshFamilyCollection",
11971
+ "schema": {
11972
+ "tableName": "users_oauth_refresh_families",
11973
+ "ddl": "CREATE TABLE IF NOT EXISTS \"users_oauth_refresh_families\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"authorization_id\" TEXT,\n \"revoked_at\" TIMESTAMP\n);",
11974
+ "columns": {
11975
+ "id": {
11976
+ "type": "UUID",
11977
+ "primaryKey": true,
11978
+ "referenceKind": "id",
11979
+ "notNull": true
11142
11980
  },
11143
- {
11144
- "name": "users_oauth_refresh_grants_tenant_id_idx",
11145
- "columns": [
11146
- "tenant_id"
11147
- ]
11981
+ "slug": {
11982
+ "type": "TEXT",
11983
+ "notNull": true
11984
+ },
11985
+ "context": {
11986
+ "type": "TEXT",
11987
+ "notNull": true,
11988
+ "default": ""
11989
+ },
11990
+ "created_at": {
11991
+ "type": "TIMESTAMP",
11992
+ "notNull": true,
11993
+ "default": "current_timestamp"
11994
+ },
11995
+ "updated_at": {
11996
+ "type": "TIMESTAMP",
11997
+ "notNull": true,
11998
+ "default": "current_timestamp"
11148
11999
  },
12000
+ "authorization_id": {
12001
+ "type": "TEXT",
12002
+ "notNull": false,
12003
+ "unique": false
12004
+ },
12005
+ "revoked_at": {
12006
+ "type": "TIMESTAMP",
12007
+ "notNull": false,
12008
+ "unique": false
12009
+ }
12010
+ },
12011
+ "indexes": [
11149
12012
  {
11150
- "name": "users_oauth_refresh_grants_expires_at_idx",
12013
+ "name": "users_oauth_refresh_families_slug_context_idx",
11151
12014
  "columns": [
11152
- "expires_at"
11153
- ]
12015
+ "slug",
12016
+ "context"
12017
+ ],
12018
+ "unique": true
11154
12019
  },
11155
12020
  {
11156
- "name": "users_oauth_refresh_grants_revoked_at_idx",
12021
+ "name": "users_oauth_refresh_families_authorization_id_idx",
11157
12022
  "columns": [
11158
- "revoked_at"
12023
+ "authorization_id"
11159
12024
  ]
11160
12025
  },
11161
12026
  {
11162
- "name": "users_oauth_refresh_grants_created_at_idx",
12027
+ "name": "users_oauth_refresh_families_created_at_idx",
11163
12028
  "columns": [
11164
12029
  "created_at"
11165
12030
  ]
11166
12031
  }
11167
12032
  ],
11168
- "version": "d332998e"
12033
+ "version": "37392f31"
11169
12034
  },
11170
12035
  "importPath": "@happyvertical/smrt-users"
11171
12036
  },
11172
- "@happyvertical/smrt-users:UsersOAuthAccessTokenRevocation": {
11173
- "name": "usersoauthaccesstokenrevocation",
11174
- "className": "UsersOAuthAccessTokenRevocation",
11175
- "qualifiedName": "@happyvertical/smrt-users:UsersOAuthAccessTokenRevocation",
11176
- "collection": "usersoauthaccesstokenrevocations",
11177
- "filePath": "/home/runner/work/smrt/smrt/packages/users/src/models/OAuthAuthorization.ts",
12037
+ "@happyvertical/smrt-users:UsersPasskeyChallenge": {
12038
+ "name": "userspasskeychallenge",
12039
+ "className": "UsersPasskeyChallenge",
12040
+ "qualifiedName": "@happyvertical/smrt-users:UsersPasskeyChallenge",
12041
+ "collection": "userspasskeychallenges",
12042
+ "filePath": "/home/runner/work/smrt/smrt/packages/users/src/models/PasskeyChallenge.ts",
11178
12043
  "packageName": "@happyvertical/smrt-users",
11179
12044
  "fields": {
11180
- "jti": {
12045
+ "challengeHash": {
11181
12046
  "type": "text",
11182
12047
  "required": true,
11183
12048
  "_meta": {
11184
12049
  "required": true,
11185
- "unique": true,
11186
- "sensitive": true
12050
+ "unique": true
12051
+ }
12052
+ },
12053
+ "purpose": {
12054
+ "type": "text",
12055
+ "required": true,
12056
+ "_meta": {
12057
+ "required": true
11187
12058
  },
11188
- "sensitive": true
12059
+ "enum": [
12060
+ "authentication",
12061
+ "registration"
12062
+ ]
11189
12063
  },
11190
12064
  "expiresAt": {
11191
12065
  "type": "datetime",
11192
- "required": false,
12066
+ "required": true,
11193
12067
  "_meta": {
12068
+ "required": true,
11194
12069
  "indexed": true
11195
12070
  }
11196
12071
  }
11197
12072
  },
11198
12073
  "methods": {},
11199
12074
  "decoratorConfig": {
11200
- "tableName": "users_oauth_access_token_revocations",
12075
+ "tableName": "users_passkey_challenges",
11201
12076
  "sensitive": true,
11202
- "api": {
11203
- "include": []
11204
- },
11205
- "mcp": {
11206
- "include": []
11207
- },
11208
- "cli": false
12077
+ "api": false,
12078
+ "cli": false,
12079
+ "mcp": false
11209
12080
  },
11210
12081
  "extends": "SmrtObject",
11211
- "exportName": "UsersOAuthAccessTokenRevocation",
11212
- "collectionExportName": "UsersOAuthAccessTokenRevocationCollection",
12082
+ "exportName": "UsersPasskeyChallenge",
12083
+ "collectionExportName": "UsersPasskeyChallengeCollection",
11213
12084
  "validationRules": [
11214
12085
  {
11215
- "field": "jti",
12086
+ "field": "challengeHash",
11216
12087
  "rule": "required",
11217
12088
  "fieldType": "text"
12089
+ },
12090
+ {
12091
+ "field": "purpose",
12092
+ "rule": "required",
12093
+ "fieldType": "text"
12094
+ },
12095
+ {
12096
+ "field": "expiresAt",
12097
+ "rule": "required",
12098
+ "fieldType": "datetime"
11218
12099
  }
11219
12100
  ],
11220
12101
  "schema": {
11221
- "tableName": "users_oauth_access_token_revocations",
11222
- "ddl": "CREATE TABLE IF NOT EXISTS \"users_oauth_access_token_revocations\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"jti\" TEXT NOT NULL UNIQUE,\n \"expires_at\" TIMESTAMP\n);",
12102
+ "tableName": "users_passkey_challenges",
12103
+ "ddl": "CREATE TABLE IF NOT EXISTS \"users_passkey_challenges\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"challenge_hash\" TEXT NOT NULL UNIQUE,\n \"purpose\" TEXT NOT NULL,\n \"expires_at\" TIMESTAMP NOT NULL\n);",
11223
12104
  "columns": {
11224
12105
  "id": {
11225
12106
  "type": "UUID",
@@ -11246,20 +12127,25 @@
11246
12127
  "notNull": true,
11247
12128
  "default": "current_timestamp"
11248
12129
  },
11249
- "jti": {
12130
+ "challenge_hash": {
11250
12131
  "type": "TEXT",
11251
12132
  "notNull": true,
11252
12133
  "unique": true
11253
12134
  },
12135
+ "purpose": {
12136
+ "type": "TEXT",
12137
+ "notNull": true,
12138
+ "unique": false
12139
+ },
11254
12140
  "expires_at": {
11255
12141
  "type": "TIMESTAMP",
11256
- "notNull": false,
12142
+ "notNull": true,
11257
12143
  "unique": false
11258
12144
  }
11259
12145
  },
11260
12146
  "indexes": [
11261
12147
  {
11262
- "name": "users_oauth_access_token_revocations_slug_context_idx",
12148
+ "name": "users_passkey_challenges_slug_context_idx",
11263
12149
  "columns": [
11264
12150
  "slug",
11265
12151
  "context"
@@ -11267,77 +12153,116 @@
11267
12153
  "unique": true
11268
12154
  },
11269
12155
  {
11270
- "name": "users_oauth_access_token_revocations_expires_at_idx",
12156
+ "name": "users_passkey_challenges_expires_at_idx",
11271
12157
  "columns": [
11272
12158
  "expires_at"
11273
12159
  ]
11274
12160
  },
11275
12161
  {
11276
- "name": "users_oauth_access_token_revocations_created_at_idx",
12162
+ "name": "users_passkey_challenges_created_at_idx",
11277
12163
  "columns": [
11278
12164
  "created_at"
11279
12165
  ]
11280
12166
  }
11281
12167
  ],
11282
- "version": "79147089"
12168
+ "version": "895dcef7"
11283
12169
  },
11284
12170
  "importPath": "@happyvertical/smrt-users"
11285
12171
  },
11286
- "@happyvertical/smrt-users:UsersOAuthAuthorization": {
11287
- "name": "usersoauthauthorization",
11288
- "className": "UsersOAuthAuthorization",
11289
- "qualifiedName": "@happyvertical/smrt-users:UsersOAuthAuthorization",
11290
- "collection": "usersoauthauthorizations",
11291
- "description": "A consent decision bound to a server-side session; never exposes its bearer.",
11292
- "filePath": "/home/runner/work/smrt/smrt/packages/users/src/models/OAuthAuthorization.ts",
12172
+ "@happyvertical/smrt-users:UsersPasskeyCredential": {
12173
+ "name": "userspasskeycredential",
12174
+ "className": "UsersPasskeyCredential",
12175
+ "qualifiedName": "@happyvertical/smrt-users:UsersPasskeyCredential",
12176
+ "collection": "userspasskeycredentials",
12177
+ "filePath": "/home/runner/work/smrt/smrt/packages/users/src/models/PasskeyCredential.ts",
11293
12178
  "packageName": "@happyvertical/smrt-users",
11294
12179
  "fields": {
11295
- "subject": {
11296
- "type": "text",
11297
- "required": false,
12180
+ "userId": {
12181
+ "type": "foreignKey",
12182
+ "required": true,
12183
+ "related": "User",
11298
12184
  "_meta": {
11299
- "indexed": true
12185
+ "required": true
11300
12186
  }
11301
12187
  },
11302
- "sessionId": {
12188
+ "credentialId": {
11303
12189
  "type": "text",
11304
- "required": false,
12190
+ "required": true,
12191
+ "_meta": {
12192
+ "required": true,
12193
+ "unique": true,
12194
+ "sensitive": true
12195
+ },
12196
+ "sensitive": true
12197
+ },
12198
+ "publicKey": {
12199
+ "type": "text",
12200
+ "required": true,
11305
12201
  "_meta": {
12202
+ "required": true,
11306
12203
  "sensitive": true
11307
12204
  },
11308
12205
  "sensitive": true
11309
12206
  },
11310
- "clientId": {
12207
+ "signCount": {
12208
+ "type": "integer",
12209
+ "required": true,
12210
+ "default": 0,
12211
+ "_meta": {
12212
+ "required": true,
12213
+ "default": 0
12214
+ }
12215
+ },
12216
+ "transports": {
12217
+ "type": "text",
12218
+ "required": false,
12219
+ "_meta": {
12220
+ "nullable": true
12221
+ }
12222
+ },
12223
+ "name": {
11311
12224
  "type": "text",
11312
- "required": false,
12225
+ "required": true,
11313
12226
  "_meta": {
11314
- "indexed": true
12227
+ "required": true
11315
12228
  }
11316
12229
  },
11317
- "tenantId": {
12230
+ "aaguid": {
11318
12231
  "type": "text",
11319
12232
  "required": false,
11320
12233
  "_meta": {
11321
12234
  "nullable": true
11322
12235
  }
11323
12236
  },
11324
- "scopes": {
11325
- "type": "text",
11326
- "required": false
12237
+ "backedUp": {
12238
+ "type": "boolean",
12239
+ "required": true,
12240
+ "default": false,
12241
+ "_meta": {
12242
+ "required": true,
12243
+ "default": false
12244
+ }
11327
12245
  },
11328
- "permissionCeiling": {
12246
+ "deviceType": {
11329
12247
  "type": "text",
11330
- "required": false
12248
+ "required": false,
12249
+ "_meta": {
12250
+ "nullable": true
12251
+ },
12252
+ "enum": [
12253
+ "singleDevice",
12254
+ "multiDevice"
12255
+ ]
11331
12256
  },
11332
- "resource": {
11333
- "type": "text",
12257
+ "lastUsedAt": {
12258
+ "type": "datetime",
11334
12259
  "required": false,
11335
12260
  "_meta": {
11336
12261
  "nullable": true
11337
12262
  }
11338
12263
  },
11339
- "revokedAt": {
11340
- "type": "datetime",
12264
+ "createdBy": {
12265
+ "type": "text",
11341
12266
  "required": false,
11342
12267
  "_meta": {
11343
12268
  "nullable": true
@@ -11345,45 +12270,76 @@
11345
12270
  }
11346
12271
  },
11347
12272
  "methods": {
11348
- "getPermissionCeiling": {
11349
- "name": "getPermissionCeiling",
12273
+ "getTransports": {
12274
+ "name": "getTransports",
11350
12275
  "async": false,
11351
12276
  "parameters": [],
11352
12277
  "returnType": "string[]",
11353
12278
  "isStatic": false,
11354
12279
  "isPublic": true
11355
12280
  },
11356
- "getScopes": {
11357
- "name": "getScopes",
12281
+ "setTransports": {
12282
+ "name": "setTransports",
11358
12283
  "async": false,
11359
- "parameters": [],
11360
- "returnType": "string[]",
12284
+ "parameters": [
12285
+ {
12286
+ "name": "value",
12287
+ "type": "any",
12288
+ "optional": false,
12289
+ "typeUnresolved": true
12290
+ }
12291
+ ],
12292
+ "returnType": "void",
11361
12293
  "isStatic": false,
11362
12294
  "isPublic": true
11363
12295
  }
11364
12296
  },
11365
12297
  "decoratorConfig": {
11366
- "tableName": "users_oauth_authorizations",
12298
+ "tableName": "users_passkey_credentials",
11367
12299
  "sensitive": true,
11368
- "api": {
11369
- "include": []
11370
- },
11371
- "mcp": {
11372
- "include": []
11373
- },
12300
+ "api": false,
11374
12301
  "cli": false,
11375
- "conflictColumns": [
11376
- "tenant_id",
11377
- "slug",
11378
- "context"
11379
- ]
12302
+ "mcp": false
11380
12303
  },
11381
12304
  "extends": "SmrtObject",
11382
- "exportName": "UsersOAuthAuthorization",
11383
- "collectionExportName": "UsersOAuthAuthorizationCollection",
12305
+ "exportName": "UsersPasskeyCredential",
12306
+ "collectionExportName": "UsersPasskeyCredentialCollection",
12307
+ "displayLabelField": "name",
12308
+ "validationRules": [
12309
+ {
12310
+ "field": "userId",
12311
+ "rule": "required",
12312
+ "fieldType": "foreignKey"
12313
+ },
12314
+ {
12315
+ "field": "credentialId",
12316
+ "rule": "required",
12317
+ "fieldType": "text"
12318
+ },
12319
+ {
12320
+ "field": "publicKey",
12321
+ "rule": "required",
12322
+ "fieldType": "text"
12323
+ },
12324
+ {
12325
+ "field": "signCount",
12326
+ "rule": "required",
12327
+ "fieldType": "integer"
12328
+ },
12329
+ {
12330
+ "field": "name",
12331
+ "rule": "required",
12332
+ "fieldType": "text"
12333
+ },
12334
+ {
12335
+ "field": "backedUp",
12336
+ "rule": "required",
12337
+ "fieldType": "boolean"
12338
+ }
12339
+ ],
11384
12340
  "schema": {
11385
- "tableName": "users_oauth_authorizations",
11386
- "ddl": "CREATE TABLE IF NOT EXISTS \"users_oauth_authorizations\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"subject\" TEXT,\n \"session_id\" TEXT,\n \"client_id\" TEXT,\n \"tenant_id\" TEXT,\n \"scopes\" TEXT,\n \"permission_ceiling\" TEXT,\n \"resource\" TEXT,\n \"revoked_at\" TIMESTAMP\n);",
12341
+ "tableName": "users_passkey_credentials",
12342
+ "ddl": "CREATE TABLE IF NOT EXISTS \"users_passkey_credentials\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"user_id\" UUID NOT NULL,\n \"credential_id\" TEXT NOT NULL UNIQUE,\n \"public_key\" TEXT NOT NULL,\n \"sign_count\" INTEGER NOT NULL DEFAULT 0,\n \"transports\" TEXT,\n \"name\" TEXT NOT NULL,\n \"aaguid\" TEXT,\n \"backed_up\" BOOLEAN NOT NULL DEFAULT FALSE,\n \"device_type\" TEXT,\n \"last_used_at\" TIMESTAMP,\n \"created_by\" TEXT\n);",
11387
12343
  "columns": {
11388
12344
  "id": {
11389
12345
  "type": "UUID",
@@ -11410,164 +12366,74 @@
11410
12366
  "notNull": true,
11411
12367
  "default": "current_timestamp"
11412
12368
  },
11413
- "subject": {
11414
- "type": "TEXT",
11415
- "notNull": false,
11416
- "unique": false
12369
+ "user_id": {
12370
+ "type": "UUID",
12371
+ "referenceKind": "foreignKey",
12372
+ "notNull": true,
12373
+ "unique": false,
12374
+ "foreignKey": {
12375
+ "table": "users",
12376
+ "column": "id",
12377
+ "onDelete": "NO ACTION",
12378
+ "onUpdate": "CASCADE"
12379
+ }
11417
12380
  },
11418
- "session_id": {
12381
+ "credential_id": {
11419
12382
  "type": "TEXT",
11420
- "notNull": false,
11421
- "unique": false
12383
+ "notNull": true,
12384
+ "unique": true
11422
12385
  },
11423
- "client_id": {
12386
+ "public_key": {
11424
12387
  "type": "TEXT",
11425
- "notNull": false,
12388
+ "notNull": true,
11426
12389
  "unique": false
11427
12390
  },
11428
- "tenant_id": {
12391
+ "sign_count": {
12392
+ "type": "INTEGER",
12393
+ "notNull": true,
12394
+ "unique": false,
12395
+ "default": 0
12396
+ },
12397
+ "transports": {
11429
12398
  "type": "TEXT",
11430
12399
  "notNull": false,
11431
12400
  "unique": false
11432
12401
  },
11433
- "scopes": {
12402
+ "name": {
11434
12403
  "type": "TEXT",
11435
- "notNull": false,
12404
+ "notNull": true,
11436
12405
  "unique": false
11437
12406
  },
11438
- "permission_ceiling": {
12407
+ "aaguid": {
11439
12408
  "type": "TEXT",
11440
12409
  "notNull": false,
11441
12410
  "unique": false
11442
12411
  },
11443
- "resource": {
12412
+ "backed_up": {
12413
+ "type": "BOOLEAN",
12414
+ "notNull": true,
12415
+ "unique": false,
12416
+ "default": false
12417
+ },
12418
+ "device_type": {
11444
12419
  "type": "TEXT",
11445
12420
  "notNull": false,
11446
12421
  "unique": false
11447
12422
  },
11448
- "revoked_at": {
12423
+ "last_used_at": {
11449
12424
  "type": "TIMESTAMP",
11450
12425
  "notNull": false,
11451
12426
  "unique": false
11452
- }
11453
- },
11454
- "indexes": [
11455
- {
11456
- "name": "users_oauth_authorizations_tenant_id_slug_idx",
11457
- "columns": [
11458
- "tenant_id",
11459
- "slug",
11460
- "context"
11461
- ],
11462
- "unique": true,
11463
- "nullsNotDistinct": true
11464
- },
11465
- {
11466
- "name": "users_oauth_authorizations_subject_idx",
11467
- "columns": [
11468
- "subject"
11469
- ]
11470
- },
11471
- {
11472
- "name": "users_oauth_authorizations_client_id_idx",
11473
- "columns": [
11474
- "client_id"
11475
- ]
11476
- },
11477
- {
11478
- "name": "users_oauth_authorizations_created_at_idx",
11479
- "columns": [
11480
- "created_at"
11481
- ]
11482
- }
11483
- ],
11484
- "version": "291f8816"
11485
- },
11486
- "importPath": "@happyvertical/smrt-users"
11487
- },
11488
- "@happyvertical/smrt-users:UsersOAuthRefreshFamily": {
11489
- "name": "usersoauthrefreshfamily",
11490
- "className": "UsersOAuthRefreshFamily",
11491
- "qualifiedName": "@happyvertical/smrt-users:UsersOAuthRefreshFamily",
11492
- "collection": "usersoauthrefreshfamilies",
11493
- "description": "Stable lock row: rotation and revocation always serialize on this family.",
11494
- "filePath": "/home/runner/work/smrt/smrt/packages/users/src/models/OAuthAuthorization.ts",
11495
- "packageName": "@happyvertical/smrt-users",
11496
- "fields": {
11497
- "authorizationId": {
11498
- "type": "text",
11499
- "required": false,
11500
- "_meta": {
11501
- "nullable": true,
11502
- "indexed": true
11503
- }
11504
- },
11505
- "revokedAt": {
11506
- "type": "datetime",
11507
- "required": false,
11508
- "_meta": {
11509
- "nullable": true
11510
- }
11511
- }
11512
- },
11513
- "methods": {},
11514
- "decoratorConfig": {
11515
- "tableName": "users_oauth_refresh_families",
11516
- "sensitive": true,
11517
- "api": {
11518
- "include": []
11519
- },
11520
- "mcp": {
11521
- "include": []
11522
- },
11523
- "cli": false
11524
- },
11525
- "extends": "SmrtObject",
11526
- "exportName": "UsersOAuthRefreshFamily",
11527
- "collectionExportName": "UsersOAuthRefreshFamilyCollection",
11528
- "schema": {
11529
- "tableName": "users_oauth_refresh_families",
11530
- "ddl": "CREATE TABLE IF NOT EXISTS \"users_oauth_refresh_families\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"authorization_id\" TEXT,\n \"revoked_at\" TIMESTAMP\n);",
11531
- "columns": {
11532
- "id": {
11533
- "type": "UUID",
11534
- "primaryKey": true,
11535
- "referenceKind": "id",
11536
- "notNull": true
11537
- },
11538
- "slug": {
11539
- "type": "TEXT",
11540
- "notNull": true
11541
- },
11542
- "context": {
11543
- "type": "TEXT",
11544
- "notNull": true,
11545
- "default": ""
11546
- },
11547
- "created_at": {
11548
- "type": "TIMESTAMP",
11549
- "notNull": true,
11550
- "default": "current_timestamp"
11551
- },
11552
- "updated_at": {
11553
- "type": "TIMESTAMP",
11554
- "notNull": true,
11555
- "default": "current_timestamp"
11556
12427
  },
11557
- "authorization_id": {
12428
+ "created_by": {
11558
12429
  "type": "TEXT",
11559
12430
  "notNull": false,
11560
12431
  "unique": false
11561
- },
11562
- "revoked_at": {
11563
- "type": "TIMESTAMP",
11564
- "notNull": false,
11565
- "unique": false
11566
12432
  }
11567
12433
  },
11568
12434
  "indexes": [
11569
12435
  {
11570
- "name": "users_oauth_refresh_families_slug_context_idx",
12436
+ "name": "users_passkey_credentials_slug_context_idx",
11571
12437
  "columns": [
11572
12438
  "slug",
11573
12439
  "context"
@@ -11575,19 +12441,19 @@
11575
12441
  "unique": true
11576
12442
  },
11577
12443
  {
11578
- "name": "users_oauth_refresh_families_authorization_id_idx",
12444
+ "name": "users_passkey_credentials_created_at_idx",
11579
12445
  "columns": [
11580
- "authorization_id"
12446
+ "created_at"
11581
12447
  ]
11582
12448
  },
11583
12449
  {
11584
- "name": "users_oauth_refresh_families_created_at_idx",
12450
+ "name": "users_passkey_credentials_user_id_idx",
11585
12451
  "columns": [
11586
- "created_at"
12452
+ "user_id"
11587
12453
  ]
11588
12454
  }
11589
12455
  ],
11590
- "version": "37392f31"
12456
+ "version": "4483d2e2"
11591
12457
  },
11592
12458
  "importPath": "@happyvertical/smrt-users"
11593
12459
  },
@@ -12875,6 +13741,14 @@
12875
13741
  "isStatic": false,
12876
13742
  "isPublic": true
12877
13743
  },
13744
+ "getAuthenticatedAt": {
13745
+ "name": "getAuthenticatedAt",
13746
+ "async": false,
13747
+ "parameters": [],
13748
+ "returnType": "Date | null",
13749
+ "isStatic": false,
13750
+ "isPublic": true
13751
+ },
12878
13752
  "getPermissionCeiling": {
12879
13753
  "name": "getPermissionCeiling",
12880
13754
  "async": false,