@happyvertical/smrt-users 0.44.1 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as MembershipCollection, A as UserEmailKeyBackfillError, B as PermissionCatalogService, C as decodeOidcTransaction, Ct as SessionStatus, Dt as UsersCliAuthRequest, E as resolveOidcProviderConfig, Et as UserStatus, F as TenantHierarchyError, G as syncPermissionCatalog, H as deriveOperationPermissionSlug, I as MAX_TENANT_HIERARCHY_DEPTH, J as Role, K as RolePermission, L as Tenant, M as TenantPermissionOverrideCollection, N as TenantPermissionOverride, O as OidcProvisioningError, P as TenantCollection, Q as MembershipOverride, R as DEFAULT_ROLE_PERMISSION_PATTERNS, S as OidcLoginService, St as OverrideEffect, T as getUsersOidcConfig, Tt as TenantStatus, U as normalizeOperationPermissionAction, V as deriveOperationPermissionCollectionName, W as registerPermissionDefinitions, X as Permission, Y as PermissionCollection, Z as MembershipOverrideCollection, _ as readMobileBearerToken, _t as AccessRequestStatus, a as TerminalAuthRateLimitError, at as GroupCollection, b as PermissionResolver, bt as DEFAULT_TENANT_POLICY, c as assertOperationPermission, ct as UsersCliAuthApproveLimit, d as getCurrentSessionPermissionContext, dt as normalizeEmail, et as Membership, f as getRequestScopedDatabase, ft as UsersCliAuthRequestCollection, g as MobileAuthService, gt as generateSessionId, h as MobileAuthError, ht as Session, i as TerminalAuthError, it as GroupMember, j as backfillUserEmailKeys, k as UserCollection, l as checkOperationPermission, lt as User, m as withSessionPermissionContext, mt as DEFAULT_SESSION_TTL, n as DEFAULT_CLI_AUTH_REQUEST_TTL_SECONDS, nt as GroupRole, o as TerminalAuthService, ot as Group, p as withPrincipalPermissionContext, pt as SessionCollection, q as RoleCollection, r as DEFAULT_CLI_SESSION_TTL_SECONDS, rt as GroupMemberCollection, s as OperationPermissionError, st as UsersCliAuthApproveLimitCollection, t as DEFAULT_CLI_AUTH_POLL_INTERVAL_SECONDS, tt as GroupRoleCollection, u as hasOperationPermission, ut as isValidEmail, v as validateMobileRedirectUri, vt as DEFAULT_ROLES, w as encodeOidcTransaction, wt as TenantPermissionEffect, x as OidcLoginError, xt as MembershipStatus, y as SessionService, yt as DEFAULT_ROLE_SLUGS, z as RolePermissionCollection } from "./chunks/TerminalAuthService-Ct7GHB_F.js";
1
+ import { $ as MembershipCollection, A as UserEmailKeyBackfillError, B as PermissionCatalogService, C as decodeOidcTransaction, Ct as SessionStatus, Dt as UsersCliAuthRequest, E as resolveOidcProviderConfig, Et as UserStatus, F as TenantHierarchyError, G as syncPermissionCatalog, H as deriveOperationPermissionSlug, I as MAX_TENANT_HIERARCHY_DEPTH, J as Role, K as RolePermission, L as Tenant, M as TenantPermissionOverrideCollection, N as TenantPermissionOverride, O as OidcProvisioningError, P as TenantCollection, Q as MembershipOverride, R as DEFAULT_ROLE_PERMISSION_PATTERNS, S as OidcLoginService, St as OverrideEffect, T as getUsersOidcConfig, Tt as TenantStatus, U as normalizeOperationPermissionAction, V as deriveOperationPermissionCollectionName, W as registerPermissionDefinitions, X as Permission, Y as PermissionCollection, Z as MembershipOverrideCollection, _ as readMobileBearerToken, _t as AccessRequestStatus, a as TerminalAuthRateLimitError, at as GroupCollection, b as PermissionResolver, bt as DEFAULT_TENANT_POLICY, c as assertOperationPermission, ct as UsersCliAuthApproveLimit, d as getCurrentSessionPermissionContext, dt as normalizeEmail, et as Membership, f as getRequestScopedDatabase, ft as UsersCliAuthRequestCollection, g as MobileAuthService, gt as generateSessionId, h as MobileAuthError, ht as Session, i as TerminalAuthError, it as GroupMember, j as backfillUserEmailKeys, k as UserCollection, l as checkOperationPermission, lt as User, m as withSessionPermissionContext, mt as DEFAULT_SESSION_TTL, n as DEFAULT_CLI_AUTH_REQUEST_TTL_SECONDS, nt as GroupRole, o as TerminalAuthService, ot as Group, p as withPrincipalPermissionContext, pt as SessionCollection, q as RoleCollection, r as DEFAULT_CLI_SESSION_TTL_SECONDS, rt as GroupMemberCollection, s as OperationPermissionError, st as UsersCliAuthApproveLimitCollection, t as DEFAULT_CLI_AUTH_POLL_INTERVAL_SECONDS, tt as GroupRoleCollection, u as hasOperationPermission, ut as isValidEmail, v as validateMobileRedirectUri, vt as DEFAULT_ROLES, w as encodeOidcTransaction, wt as TenantPermissionEffect, x as OidcLoginError, xt as MembershipStatus, y as SessionService, yt as DEFAULT_ROLE_SLUGS, z as RolePermissionCollection } from "./chunks/TerminalAuthService-DEobPLL2.js";
2
2
  import { ObjectRegistry, SmrtCollection, SmrtObject, field, findManifestEntryByQualifiedName, isUniqueViolationError, registerRetentionTask, smrt, unregisterRetentionTask } from "@happyvertical/smrt-core";
3
3
  import { createHash } from "node:crypto";
4
4
  import { TenantScoped, tenantId } from "@happyvertical/smrt-tenancy";
@@ -953,7 +953,7 @@ var MagicLinkService = class MagicLinkService {
953
953
  * The caller is responsible for emailing the token to the user.
954
954
  */
955
955
  async generate(email) {
956
- const { SignJWT } = await import("./chunks/TerminalAuthService-Ct7GHB_F.js").then((n) => n.D);
956
+ const { SignJWT } = await import("./chunks/TerminalAuthService-DEobPLL2.js").then((n) => n.D);
957
957
  const key = await this.getSigningKey();
958
958
  const nonce = crypto.randomUUID();
959
959
  const normalizedEmail = normalizeEmail(email);
@@ -982,7 +982,7 @@ var MagicLinkService = class MagicLinkService {
982
982
  * @throws {MagicLinkError} If the token is invalid, expired, or already used
983
983
  */
984
984
  async verify(token) {
985
- const { jwtVerify, errors } = await import("./chunks/TerminalAuthService-Ct7GHB_F.js").then((n) => n.D);
985
+ const { jwtVerify, errors } = await import("./chunks/TerminalAuthService-DEobPLL2.js").then((n) => n.D);
986
986
  const key = await this.getSigningKey();
987
987
  let payload;
988
988
  try {
@@ -2,7 +2,7 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-users",
5
- "packageVersion": "0.44.1",
5
+ "packageVersion": "0.45.0",
6
6
  "objects": {
7
7
  "@happyvertical/smrt-users:AccessRequestCollection": {
8
8
  "name": "accessrequestcollection",
@@ -5430,554 +5430,6 @@
5430
5430
  }
5431
5431
  },
5432
5432
  "methods": {
5433
- "withDatabase": {
5434
- "name": "withDatabase",
5435
- "async": true,
5436
- "parameters": [
5437
- {
5438
- "name": "db",
5439
- "type": "DatabaseInterface",
5440
- "optional": false
5441
- },
5442
- {
5443
- "name": "operation",
5444
- "type": "Function",
5445
- "optional": false
5446
- }
5447
- ],
5448
- "returnType": "Promise<T>",
5449
- "isStatic": false,
5450
- "isPublic": true
5451
- },
5452
- "getAiUsageSnapshot": {
5453
- "name": "getAiUsageSnapshot",
5454
- "async": false,
5455
- "parameters": [],
5456
- "returnType": "AiUsageSnapshot | undefined",
5457
- "isStatic": false,
5458
- "isPublic": true
5459
- },
5460
- "resetAiUsage": {
5461
- "name": "resetAiUsage",
5462
- "async": false,
5463
- "parameters": [],
5464
- "returnType": "void",
5465
- "isStatic": false,
5466
- "isPublic": true
5467
- },
5468
- "listAiUsage": {
5469
- "name": "listAiUsage",
5470
- "async": true,
5471
- "parameters": [
5472
- {
5473
- "name": "options",
5474
- "type": "AiUsageListOptions",
5475
- "optional": true
5476
- }
5477
- ],
5478
- "returnType": "Promise<SmrtAiUsageRecord[]>",
5479
- "isStatic": false,
5480
- "isPublic": true
5481
- },
5482
- "summarizeAiUsage": {
5483
- "name": "summarizeAiUsage",
5484
- "async": true,
5485
- "parameters": [
5486
- {
5487
- "name": "options",
5488
- "type": "AiUsageSummaryOptions",
5489
- "optional": true
5490
- }
5491
- ],
5492
- "returnType": "Promise<Record<string, AiUsageStats>>",
5493
- "isStatic": false,
5494
- "isPublic": true
5495
- },
5496
- "destroy": {
5497
- "name": "destroy",
5498
- "async": false,
5499
- "parameters": [],
5500
- "returnType": "void",
5501
- "isStatic": false,
5502
- "isPublic": true
5503
- },
5504
- "markAsPersisted": {
5505
- "name": "markAsPersisted",
5506
- "async": false,
5507
- "parameters": [],
5508
- "returnType": "void",
5509
- "isStatic": false,
5510
- "isPublic": true
5511
- },
5512
- "requireInsertOnSave": {
5513
- "name": "requireInsertOnSave",
5514
- "async": false,
5515
- "parameters": [],
5516
- "returnType": "void",
5517
- "isStatic": false,
5518
- "isPublic": true
5519
- },
5520
- "withTransaction": {
5521
- "name": "withTransaction",
5522
- "async": true,
5523
- "parameters": [
5524
- {
5525
- "name": "operation",
5526
- "type": "Function",
5527
- "optional": false
5528
- }
5529
- ],
5530
- "returnType": "Promise<T>",
5531
- "isStatic": false,
5532
- "isPublic": true
5533
- },
5534
- "initialize": {
5535
- "name": "initialize",
5536
- "async": true,
5537
- "parameters": [],
5538
- "returnType": "Promise",
5539
- "isStatic": false,
5540
- "isPublic": true
5541
- },
5542
- "loadDataFromDb": {
5543
- "name": "loadDataFromDb",
5544
- "async": true,
5545
- "parameters": [
5546
- {
5547
- "name": "data",
5548
- "type": "Record<string>",
5549
- "optional": false
5550
- }
5551
- ],
5552
- "returnType": "any",
5553
- "isStatic": false,
5554
- "isPublic": true
5555
- },
5556
- "getFields": {
5557
- "name": "getFields",
5558
- "async": true,
5559
- "parameters": [],
5560
- "returnType": "Promise<any>",
5561
- "isStatic": false,
5562
- "isPublic": true
5563
- },
5564
- "toJSON": {
5565
- "name": "toJSON",
5566
- "async": false,
5567
- "parameters": [],
5568
- "returnType": "any",
5569
- "isStatic": false,
5570
- "isPublic": true
5571
- },
5572
- "toPlainObject": {
5573
- "name": "toPlainObject",
5574
- "async": false,
5575
- "parameters": [],
5576
- "returnType": "Record<string>",
5577
- "isStatic": false,
5578
- "isPublic": true
5579
- },
5580
- "toPublicJSON": {
5581
- "name": "toPublicJSON",
5582
- "async": false,
5583
- "parameters": [
5584
- {
5585
- "name": "options",
5586
- "type": "PublicJsonOptions",
5587
- "optional": true
5588
- }
5589
- ],
5590
- "returnType": "Record<string>",
5591
- "isStatic": false,
5592
- "isPublic": true
5593
- },
5594
- "getId": {
5595
- "name": "getId",
5596
- "async": true,
5597
- "parameters": [],
5598
- "returnType": "any",
5599
- "isStatic": false,
5600
- "isPublic": true
5601
- },
5602
- "getSlug": {
5603
- "name": "getSlug",
5604
- "async": true,
5605
- "parameters": [],
5606
- "returnType": "any",
5607
- "isStatic": false,
5608
- "isPublic": true
5609
- },
5610
- "getSavedId": {
5611
- "name": "getSavedId",
5612
- "async": true,
5613
- "parameters": [],
5614
- "returnType": "any",
5615
- "isStatic": false,
5616
- "isPublic": true
5617
- },
5618
- "isSaved": {
5619
- "name": "isSaved",
5620
- "async": true,
5621
- "parameters": [],
5622
- "returnType": "any",
5623
- "isStatic": false,
5624
- "isPublic": true
5625
- },
5626
- "save": {
5627
- "name": "save",
5628
- "async": true,
5629
- "parameters": [
5630
- {
5631
- "name": "options",
5632
- "type": "SmrtSaveOptions",
5633
- "optional": true
5634
- }
5635
- ],
5636
- "returnType": "any",
5637
- "isStatic": false,
5638
- "isPublic": true
5639
- },
5640
- "claimRevision": {
5641
- "name": "claimRevision",
5642
- "async": true,
5643
- "parameters": [
5644
- {
5645
- "name": "expectedUpdatedAt",
5646
- "type": "Date | string",
5647
- "optional": false
5648
- }
5649
- ],
5650
- "returnType": "Promise",
5651
- "isStatic": false,
5652
- "isPublic": true
5653
- },
5654
- "classifyConstraintError": {
5655
- "name": "classifyConstraintError",
5656
- "async": false,
5657
- "parameters": [
5658
- {
5659
- "name": "message",
5660
- "type": "string",
5661
- "optional": false
5662
- }
5663
- ],
5664
- "returnType": "'unique' | 'not_null' | null",
5665
- "isStatic": true,
5666
- "isPublic": true
5667
- },
5668
- "loadFromId": {
5669
- "name": "loadFromId",
5670
- "async": true,
5671
- "parameters": [],
5672
- "returnType": "any",
5673
- "isStatic": false,
5674
- "isPublic": true
5675
- },
5676
- "loadFromSlug": {
5677
- "name": "loadFromSlug",
5678
- "async": true,
5679
- "parameters": [],
5680
- "returnType": "any",
5681
- "isStatic": false,
5682
- "isPublic": true
5683
- },
5684
- "is": {
5685
- "name": "is",
5686
- "async": true,
5687
- "parameters": [
5688
- {
5689
- "name": "criteria",
5690
- "type": "string",
5691
- "optional": false
5692
- },
5693
- {
5694
- "name": "options",
5695
- "type": "AiOperationOptions",
5696
- "optional": true
5697
- }
5698
- ],
5699
- "returnType": "any",
5700
- "isStatic": false,
5701
- "isPublic": true
5702
- },
5703
- "do": {
5704
- "name": "do",
5705
- "async": true,
5706
- "parameters": [
5707
- {
5708
- "name": "instructions",
5709
- "type": "string",
5710
- "optional": false
5711
- },
5712
- {
5713
- "name": "options",
5714
- "type": "AiOperationOptions",
5715
- "optional": true
5716
- }
5717
- ],
5718
- "returnType": "any",
5719
- "isStatic": false,
5720
- "isPublic": true
5721
- },
5722
- "describe": {
5723
- "name": "describe",
5724
- "async": true,
5725
- "parameters": [
5726
- {
5727
- "name": "options",
5728
- "type": "AiOperationOptions",
5729
- "optional": true
5730
- }
5731
- ],
5732
- "returnType": "any",
5733
- "isStatic": false,
5734
- "isPublic": true
5735
- },
5736
- "delete": {
5737
- "name": "delete",
5738
- "async": true,
5739
- "parameters": [
5740
- {
5741
- "name": "options",
5742
- "type": "SmrtDeleteOptions",
5743
- "optional": true
5744
- }
5745
- ],
5746
- "returnType": "Promise<void>",
5747
- "isStatic": false,
5748
- "isPublic": true
5749
- },
5750
- "isRelatedLoaded": {
5751
- "name": "isRelatedLoaded",
5752
- "async": false,
5753
- "parameters": [
5754
- {
5755
- "name": "fieldName",
5756
- "type": "string",
5757
- "optional": false
5758
- }
5759
- ],
5760
- "returnType": "boolean",
5761
- "isStatic": false,
5762
- "isPublic": true
5763
- },
5764
- "_setLoadedRelationship": {
5765
- "name": "_setLoadedRelationship",
5766
- "async": false,
5767
- "parameters": [
5768
- {
5769
- "name": "fieldName",
5770
- "type": "string",
5771
- "optional": false
5772
- },
5773
- {
5774
- "name": "value",
5775
- "type": "any",
5776
- "optional": false
5777
- }
5778
- ],
5779
- "returnType": "void",
5780
- "isStatic": false,
5781
- "isPublic": true
5782
- },
5783
- "loadRelated": {
5784
- "name": "loadRelated",
5785
- "async": true,
5786
- "parameters": [
5787
- {
5788
- "name": "fieldName",
5789
- "type": "string",
5790
- "optional": false
5791
- },
5792
- {
5793
- "name": "opts",
5794
- "type": "LoadRelatedOptions",
5795
- "optional": true
5796
- }
5797
- ],
5798
- "returnType": "Promise<any>",
5799
- "isStatic": false,
5800
- "isPublic": true
5801
- },
5802
- "loadRelatedMany": {
5803
- "name": "loadRelatedMany",
5804
- "async": true,
5805
- "parameters": [
5806
- {
5807
- "name": "fieldName",
5808
- "type": "string",
5809
- "optional": false
5810
- },
5811
- {
5812
- "name": "opts",
5813
- "type": "LoadRelatedOptions",
5814
- "optional": true
5815
- }
5816
- ],
5817
- "returnType": "Promise<any[]>",
5818
- "isStatic": false,
5819
- "isPublic": true
5820
- },
5821
- "getRelated": {
5822
- "name": "getRelated",
5823
- "async": true,
5824
- "parameters": [
5825
- {
5826
- "name": "fieldName",
5827
- "type": "string",
5828
- "optional": false
5829
- },
5830
- {
5831
- "name": "opts",
5832
- "type": "LoadRelatedOptions",
5833
- "optional": true
5834
- }
5835
- ],
5836
- "returnType": "Promise<any>",
5837
- "isStatic": false,
5838
- "isPublic": true
5839
- },
5840
- "getAvailableTools": {
5841
- "name": "getAvailableTools",
5842
- "async": false,
5843
- "parameters": [],
5844
- "returnType": "AITool[]",
5845
- "isStatic": false,
5846
- "isPublic": true
5847
- },
5848
- "executeToolCall": {
5849
- "name": "executeToolCall",
5850
- "async": true,
5851
- "parameters": [
5852
- {
5853
- "name": "toolCall",
5854
- "type": "ToolCall",
5855
- "optional": false
5856
- }
5857
- ],
5858
- "returnType": "Promise<ToolCallResult>",
5859
- "isStatic": false,
5860
- "isPublic": true
5861
- },
5862
- "remember": {
5863
- "name": "remember",
5864
- "async": true,
5865
- "parameters": [
5866
- {
5867
- "name": "options",
5868
- "type": "object",
5869
- "optional": false
5870
- }
5871
- ],
5872
- "returnType": "Promise<void>",
5873
- "isStatic": false,
5874
- "isPublic": true
5875
- },
5876
- "recall": {
5877
- "name": "recall",
5878
- "async": true,
5879
- "parameters": [
5880
- {
5881
- "name": "options",
5882
- "type": "object",
5883
- "optional": false
5884
- }
5885
- ],
5886
- "returnType": "Promise",
5887
- "isStatic": false,
5888
- "isPublic": true
5889
- },
5890
- "recallAll": {
5891
- "name": "recallAll",
5892
- "async": true,
5893
- "parameters": [
5894
- {
5895
- "name": "options",
5896
- "type": "object",
5897
- "optional": true
5898
- }
5899
- ],
5900
- "returnType": "Promise<Map<string>>",
5901
- "isStatic": false,
5902
- "isPublic": true
5903
- },
5904
- "forget": {
5905
- "name": "forget",
5906
- "async": true,
5907
- "parameters": [
5908
- {
5909
- "name": "options",
5910
- "type": "object",
5911
- "optional": false
5912
- }
5913
- ],
5914
- "returnType": "Promise<void>",
5915
- "isStatic": false,
5916
- "isPublic": true
5917
- },
5918
- "forgetScope": {
5919
- "name": "forgetScope",
5920
- "async": true,
5921
- "parameters": [
5922
- {
5923
- "name": "options",
5924
- "type": "object",
5925
- "optional": false
5926
- }
5927
- ],
5928
- "returnType": "Promise<number>",
5929
- "isStatic": false,
5930
- "isPublic": true
5931
- },
5932
- "generateEmbeddings": {
5933
- "name": "generateEmbeddings",
5934
- "async": true,
5935
- "parameters": [
5936
- {
5937
- "name": "options",
5938
- "type": "GenerateEmbeddingsOptions",
5939
- "optional": true
5940
- }
5941
- ],
5942
- "returnType": "Promise<void>",
5943
- "isStatic": false,
5944
- "isPublic": true
5945
- },
5946
- "getEmbedding": {
5947
- "name": "getEmbedding",
5948
- "async": true,
5949
- "parameters": [
5950
- {
5951
- "name": "fieldName",
5952
- "type": "string",
5953
- "optional": false
5954
- },
5955
- {
5956
- "name": "model",
5957
- "type": "string",
5958
- "optional": true
5959
- }
5960
- ],
5961
- "returnType": "Promise<number[] | null>",
5962
- "isStatic": false,
5963
- "isPublic": true
5964
- },
5965
- "hasStaleEmbeddings": {
5966
- "name": "hasStaleEmbeddings",
5967
- "async": true,
5968
- "parameters": [],
5969
- "returnType": "Promise<boolean>",
5970
- "isStatic": false,
5971
- "isPublic": true
5972
- },
5973
- "clearEmbeddings": {
5974
- "name": "clearEmbeddings",
5975
- "async": true,
5976
- "parameters": [],
5977
- "returnType": "Promise<void>",
5978
- "isStatic": false,
5979
- "isPublic": true
5980
- },
5981
5433
  "isActive": {
5982
5434
  "name": "isActive",
5983
5435
  "async": false,