@happyvertical/smrt-profiles 0.43.9 → 0.44.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.
Files changed (42) hide show
  1. package/dist/chunks/{ApiKey-CMm509C4.js → ApiKey-BTC7nWG1.js} +15 -5
  2. package/dist/chunks/ApiKey-BTC7nWG1.js.map +1 -0
  3. package/dist/chunks/{ApiKeyCollection-C6p7XgTz.js → ApiKeyCollection-DsxaLEwc.js} +4 -3
  4. package/dist/chunks/ApiKeyCollection-DsxaLEwc.js.map +1 -0
  5. package/dist/chunks/{AuditLogCollection-lJfGFdIQ.js → AuditLogCollection-N5ItRtEK.js} +2 -2
  6. package/dist/chunks/{AuditLogCollection-lJfGFdIQ.js.map → AuditLogCollection-N5ItRtEK.js.map} +1 -1
  7. package/dist/chunks/{NostrIdentity-CgdM4ng0.js → NostrIdentity-C39j4O4k.js} +14 -6
  8. package/dist/chunks/{NostrIdentity-CgdM4ng0.js.map → NostrIdentity-C39j4O4k.js.map} +1 -1
  9. package/dist/chunks/{NostrIdentityCollection-BnHZOsUI.js → NostrIdentityCollection-PzvQ54Nm.js} +2 -2
  10. package/dist/chunks/{NostrIdentityCollection-BnHZOsUI.js.map → NostrIdentityCollection-PzvQ54Nm.js.map} +1 -1
  11. package/dist/chunks/{OidcIdentity-B9rltBDe.js → OidcIdentity-n-2FPfas.js} +13 -5
  12. package/dist/chunks/{OidcIdentity-B9rltBDe.js.map → OidcIdentity-n-2FPfas.js.map} +1 -1
  13. package/dist/chunks/{OidcIdentityCollection-D2JuUZZL.js → OidcIdentityCollection-BssJC4zV.js} +3 -3
  14. package/dist/chunks/{OidcIdentityCollection-D2JuUZZL.js.map → OidcIdentityCollection-BssJC4zV.js.map} +1 -1
  15. package/dist/chunks/{ProfileAssetCollection-BzB55xtX.js → ProfileAssetCollection-DIG1R_FG.js} +3 -3
  16. package/dist/chunks/{ProfileAssetCollection-BzB55xtX.js.map → ProfileAssetCollection-DIG1R_FG.js.map} +1 -1
  17. package/dist/chunks/{ProfileCollection-WlRQ7bj3.js → ProfileCollection-BLwatLeO.js} +24 -24
  18. package/dist/chunks/{ProfileCollection-WlRQ7bj3.js.map → ProfileCollection-BLwatLeO.js.map} +1 -1
  19. package/dist/chunks/{ProfileMetadataCollection-Ceq-QV-1.js → ProfileMetadataCollection-BdkdHPud.js} +2 -2
  20. package/dist/chunks/{ProfileMetadataCollection-Ceq-QV-1.js.map → ProfileMetadataCollection-BdkdHPud.js.map} +1 -1
  21. package/dist/chunks/{ProfileMetafieldCollection-CM374Dbh.js → ProfileMetafieldCollection-BELgOOlR.js} +2 -2
  22. package/dist/chunks/{ProfileMetafieldCollection-CM374Dbh.js.map → ProfileMetafieldCollection-BELgOOlR.js.map} +1 -1
  23. package/dist/chunks/{ProfileRelationshipCollection-DuPcpzp1.js → ProfileRelationshipCollection-CHMfPvwh.js} +5 -5
  24. package/dist/chunks/{ProfileRelationshipCollection-DuPcpzp1.js.map → ProfileRelationshipCollection-CHMfPvwh.js.map} +1 -1
  25. package/dist/chunks/{ProfileRelationshipTermCollection-Bw32vYB8.js → ProfileRelationshipTermCollection-CTb37cus.js} +2 -2
  26. package/dist/chunks/{ProfileRelationshipTermCollection-Bw32vYB8.js.map → ProfileRelationshipTermCollection-CTb37cus.js.map} +1 -1
  27. package/dist/chunks/{ProfileRelationshipType-CZm2X1qY.js → ProfileRelationshipType-Ck3ARPkG.js} +2 -2
  28. package/dist/chunks/{ProfileRelationshipType-CZm2X1qY.js.map → ProfileRelationshipType-Ck3ARPkG.js.map} +1 -1
  29. package/dist/chunks/{ProfileRelationshipTypeCollection-CtoeCpp_.js → ProfileRelationshipTypeCollection-DKHnZ_fV.js} +3 -3
  30. package/dist/chunks/{ProfileRelationshipTypeCollection-CtoeCpp_.js.map → ProfileRelationshipTypeCollection-DKHnZ_fV.js.map} +1 -1
  31. package/dist/chunks/{oidcProvisioningPrimitives-BEBZWkLD.js → oidcProvisioningPrimitives-2qppM9Ak.js} +4 -4
  32. package/dist/chunks/{oidcProvisioningPrimitives-BEBZWkLD.js.map → oidcProvisioningPrimitives-2qppM9Ak.js.map} +1 -1
  33. package/dist/chunks/{resolveIdentity-B2ro8ggX.js → resolveIdentity-CW-fl8Iv.js} +16 -16
  34. package/dist/chunks/{resolveIdentity-B2ro8ggX.js.map → resolveIdentity-CW-fl8Iv.js.map} +1 -1
  35. package/dist/index.js +22 -22
  36. package/dist/internal/oidc-provisioning.js +2 -2
  37. package/dist/manifest.json +344 -10
  38. package/dist/smrt-knowledge.json +220 -13
  39. package/dist/utils.js +4 -4
  40. package/package.json +6 -6
  41. package/dist/chunks/ApiKey-CMm509C4.js.map +0 -1
  42. package/dist/chunks/ApiKeyCollection-C6p7XgTz.js.map +0 -1
@@ -3,12 +3,12 @@
3
3
  "sensitiveFieldsExcluded": true,
4
4
  "generatedAt": "1970-01-01T00:00:00.000Z",
5
5
  "packageName": "@happyvertical/smrt-profiles",
6
- "packageVersion": "0.43.9",
6
+ "packageVersion": "0.44.0",
7
7
  "sourceManifestPath": "dist/manifest.json",
8
8
  "agentDocPath": "AGENTS.md",
9
9
  "sourceHashes": {
10
- "manifest": "e701c3fbe17f1afbc5344f03a527dc19d169b970c1b20e84bc473d1a33f4fe0a",
11
- "packageJson": "fe785197cd57257b829b5e5858c08e985eedb59fe289d4a701722618e027d086",
10
+ "manifest": "c6b13a8c8625ebfc738ec6a28f69fd5424bb5da1f7d2d314abe41da6dbbd16eb",
11
+ "packageJson": "b0922d3f1c1bb8332c0204e3482396b63482efc4376b8b4ae03df47ae018b949",
12
12
  "agents": "475e041f9b6a04721dda5d475337a22f72c80c8fdc8be95acca5011535744b15"
13
13
  },
14
14
  "exports": [
@@ -2227,6 +2227,7 @@
2227
2227
  "addAsset",
2228
2228
  "addMetadata",
2229
2229
  "addRelationship",
2230
+ "claimRevision",
2230
2231
  "classifyConstraintError",
2231
2232
  "clearEmbeddings",
2232
2233
  "delete",
@@ -2292,7 +2293,8 @@
2292
2293
  "toPlainObject",
2293
2294
  "toPublicJSON",
2294
2295
  "updateMetadata",
2295
- "withDatabase"
2296
+ "withDatabase",
2297
+ "withTransaction"
2296
2298
  ],
2297
2299
  "methodSignatures": [
2298
2300
  {
@@ -2332,6 +2334,14 @@
2332
2334
  ],
2333
2335
  "returns": "Promise<void>"
2334
2336
  },
2337
+ {
2338
+ "name": "claimRevision",
2339
+ "async": true,
2340
+ "params": [
2341
+ "expectedUpdatedAt: Date | string"
2342
+ ],
2343
+ "returns": "Promise"
2344
+ },
2335
2345
  {
2336
2346
  "name": "classifyConstraintError",
2337
2347
  "static": true,
@@ -2783,6 +2793,14 @@
2783
2793
  "operation: Function"
2784
2794
  ],
2785
2795
  "returns": "Promise<T>"
2796
+ },
2797
+ {
2798
+ "name": "withTransaction",
2799
+ "async": true,
2800
+ "params": [
2801
+ "operation: Function"
2802
+ ],
2803
+ "returns": "Promise<T>"
2786
2804
  }
2787
2805
  ],
2788
2806
  "tenant": {
@@ -3045,6 +3063,7 @@
3045
3063
  ],
3046
3064
  "methods": [
3047
3065
  "_setLoadedRelationship",
3066
+ "claimRevision",
3048
3067
  "classifyConstraintError",
3049
3068
  "clearEmbeddings",
3050
3069
  "delete",
@@ -3087,7 +3106,8 @@
3087
3106
  "toPlainObject",
3088
3107
  "toPublicJSON",
3089
3108
  "validate",
3090
- "withDatabase"
3109
+ "withDatabase",
3110
+ "withTransaction"
3091
3111
  ],
3092
3112
  "methodSignatures": [
3093
3113
  {
@@ -3098,6 +3118,14 @@
3098
3118
  ],
3099
3119
  "returns": "void"
3100
3120
  },
3121
+ {
3122
+ "name": "claimRevision",
3123
+ "async": true,
3124
+ "params": [
3125
+ "expectedUpdatedAt: Date | string"
3126
+ ],
3127
+ "returns": "Promise"
3128
+ },
3101
3129
  {
3102
3130
  "name": "classifyConstraintError",
3103
3131
  "static": true,
@@ -3334,6 +3362,9 @@
3334
3362
  {
3335
3363
  "name": "save",
3336
3364
  "async": true,
3365
+ "params": [
3366
+ "options?: SmrtSaveOptions"
3367
+ ],
3337
3368
  "returns": "any"
3338
3369
  },
3339
3370
  {
@@ -3372,6 +3403,14 @@
3372
3403
  "operation: Function"
3373
3404
  ],
3374
3405
  "returns": "Promise<T>"
3406
+ },
3407
+ {
3408
+ "name": "withTransaction",
3409
+ "async": true,
3410
+ "params": [
3411
+ "operation: Function"
3412
+ ],
3413
+ "returns": "Promise<T>"
3375
3414
  }
3376
3415
  ],
3377
3416
  "tenant": {
@@ -3526,6 +3565,7 @@
3526
3565
  "relationships": [],
3527
3566
  "methods": [
3528
3567
  "_setLoadedRelationship",
3568
+ "claimRevision",
3529
3569
  "classifyConstraintError",
3530
3570
  "clearEmbeddings",
3531
3571
  "delete",
@@ -3570,7 +3610,8 @@
3570
3610
  "toPlainObject",
3571
3611
  "toPublicJSON",
3572
3612
  "validateValue",
3573
- "withDatabase"
3613
+ "withDatabase",
3614
+ "withTransaction"
3574
3615
  ],
3575
3616
  "methodSignatures": [
3576
3617
  {
@@ -3581,6 +3622,14 @@
3581
3622
  ],
3582
3623
  "returns": "void"
3583
3624
  },
3625
+ {
3626
+ "name": "claimRevision",
3627
+ "async": true,
3628
+ "params": [
3629
+ "expectedUpdatedAt: Date | string"
3630
+ ],
3631
+ "returns": "Promise"
3632
+ },
3584
3633
  {
3585
3634
  "name": "classifyConstraintError",
3586
3635
  "static": true,
@@ -3838,6 +3887,9 @@
3838
3887
  {
3839
3888
  "name": "save",
3840
3889
  "async": true,
3890
+ "params": [
3891
+ "options?: SmrtSaveOptions"
3892
+ ],
3841
3893
  "returns": "any"
3842
3894
  },
3843
3895
  {
@@ -3879,6 +3931,14 @@
3879
3931
  "operation: Function"
3880
3932
  ],
3881
3933
  "returns": "Promise<T>"
3934
+ },
3935
+ {
3936
+ "name": "withTransaction",
3937
+ "async": true,
3938
+ "params": [
3939
+ "operation: Function"
3940
+ ],
3941
+ "returns": "Promise<T>"
3882
3942
  }
3883
3943
  ],
3884
3944
  "tenant": {
@@ -4075,6 +4135,7 @@
4075
4135
  "methods": [
4076
4136
  "_setLoadedRelationship",
4077
4137
  "addTerm",
4138
+ "claimRevision",
4078
4139
  "classifyConstraintError",
4079
4140
  "clearEmbeddings",
4080
4141
  "delete",
@@ -4119,7 +4180,8 @@
4119
4180
  "toJSON",
4120
4181
  "toPlainObject",
4121
4182
  "toPublicJSON",
4122
- "withDatabase"
4183
+ "withDatabase",
4184
+ "withTransaction"
4123
4185
  ],
4124
4186
  "methodSignatures": [
4125
4187
  {
@@ -4139,6 +4201,14 @@
4139
4201
  ],
4140
4202
  "returns": "Promise<void>"
4141
4203
  },
4204
+ {
4205
+ "name": "claimRevision",
4206
+ "async": true,
4207
+ "params": [
4208
+ "expectedUpdatedAt: Date | string"
4209
+ ],
4210
+ "returns": "Promise"
4211
+ },
4142
4212
  {
4143
4213
  "name": "classifyConstraintError",
4144
4214
  "static": true,
@@ -4393,6 +4463,9 @@
4393
4463
  {
4394
4464
  "name": "save",
4395
4465
  "async": true,
4466
+ "params": [
4467
+ "options?: SmrtSaveOptions"
4468
+ ],
4396
4469
  "returns": "any"
4397
4470
  },
4398
4471
  {
@@ -4426,6 +4499,14 @@
4426
4499
  "operation: Function"
4427
4500
  ],
4428
4501
  "returns": "Promise<T>"
4502
+ },
4503
+ {
4504
+ "name": "withTransaction",
4505
+ "async": true,
4506
+ "params": [
4507
+ "operation: Function"
4508
+ ],
4509
+ "returns": "Promise<T>"
4429
4510
  }
4430
4511
  ],
4431
4512
  "tenant": {
@@ -4575,6 +4656,7 @@
4575
4656
  ],
4576
4657
  "methods": [
4577
4658
  "_setLoadedRelationship",
4659
+ "claimRevision",
4578
4660
  "classifyConstraintError",
4579
4661
  "clearEmbeddings",
4580
4662
  "delete",
@@ -4618,7 +4700,8 @@
4618
4700
  "toJSON",
4619
4701
  "toPlainObject",
4620
4702
  "toPublicJSON",
4621
- "withDatabase"
4703
+ "withDatabase",
4704
+ "withTransaction"
4622
4705
  ],
4623
4706
  "methodSignatures": [
4624
4707
  {
@@ -4629,6 +4712,14 @@
4629
4712
  ],
4630
4713
  "returns": "void"
4631
4714
  },
4715
+ {
4716
+ "name": "claimRevision",
4717
+ "async": true,
4718
+ "params": [
4719
+ "expectedUpdatedAt: Date | string"
4720
+ ],
4721
+ "returns": "Promise"
4722
+ },
4632
4723
  {
4633
4724
  "name": "classifyConstraintError",
4634
4725
  "static": true,
@@ -4876,6 +4967,9 @@
4876
4967
  {
4877
4968
  "name": "save",
4878
4969
  "async": true,
4970
+ "params": [
4971
+ "options?: SmrtSaveOptions"
4972
+ ],
4879
4973
  "returns": "any"
4880
4974
  },
4881
4975
  {
@@ -4909,6 +5003,14 @@
4909
5003
  "operation: Function"
4910
5004
  ],
4911
5005
  "returns": "Promise<T>"
5006
+ },
5007
+ {
5008
+ "name": "withTransaction",
5009
+ "async": true,
5010
+ "params": [
5011
+ "operation: Function"
5012
+ ],
5013
+ "returns": "Promise<T>"
4912
5014
  }
4913
5015
  ],
4914
5016
  "tableStrategy": "sti",
@@ -5041,6 +5143,7 @@
5041
5143
  "relationships": [],
5042
5144
  "methods": [
5043
5145
  "_setLoadedRelationship",
5146
+ "claimRevision",
5044
5147
  "classifyConstraintError",
5045
5148
  "clearEmbeddings",
5046
5149
  "delete",
@@ -5085,7 +5188,8 @@
5085
5188
  "toJSON",
5086
5189
  "toPlainObject",
5087
5190
  "toPublicJSON",
5088
- "withDatabase"
5191
+ "withDatabase",
5192
+ "withTransaction"
5089
5193
  ],
5090
5194
  "methodSignatures": [
5091
5195
  {
@@ -5096,6 +5200,14 @@
5096
5200
  ],
5097
5201
  "returns": "void"
5098
5202
  },
5203
+ {
5204
+ "name": "claimRevision",
5205
+ "async": true,
5206
+ "params": [
5207
+ "expectedUpdatedAt: Date | string"
5208
+ ],
5209
+ "returns": "Promise"
5210
+ },
5099
5211
  {
5100
5212
  "name": "classifyConstraintError",
5101
5213
  "static": true,
@@ -5362,6 +5474,9 @@
5362
5474
  {
5363
5475
  "name": "save",
5364
5476
  "async": true,
5477
+ "params": [
5478
+ "options?: SmrtSaveOptions"
5479
+ ],
5365
5480
  "returns": "any"
5366
5481
  },
5367
5482
  {
@@ -5395,6 +5510,14 @@
5395
5510
  "operation: Function"
5396
5511
  ],
5397
5512
  "returns": "Promise<T>"
5513
+ },
5514
+ {
5515
+ "name": "withTransaction",
5516
+ "async": true,
5517
+ "params": [
5518
+ "operation: Function"
5519
+ ],
5520
+ "returns": "Promise<T>"
5398
5521
  }
5399
5522
  ],
5400
5523
  "tableStrategy": "sti",
@@ -5523,6 +5646,7 @@
5523
5646
  "relationships": [],
5524
5647
  "methods": [
5525
5648
  "_setLoadedRelationship",
5649
+ "claimRevision",
5526
5650
  "classifyConstraintError",
5527
5651
  "clearEmbeddings",
5528
5652
  "delete",
@@ -5564,7 +5688,8 @@
5564
5688
  "toJSON",
5565
5689
  "toPlainObject",
5566
5690
  "toPublicJSON",
5567
- "withDatabase"
5691
+ "withDatabase",
5692
+ "withTransaction"
5568
5693
  ],
5569
5694
  "methodSignatures": [
5570
5695
  {
@@ -5575,6 +5700,14 @@
5575
5700
  ],
5576
5701
  "returns": "void"
5577
5702
  },
5703
+ {
5704
+ "name": "claimRevision",
5705
+ "async": true,
5706
+ "params": [
5707
+ "expectedUpdatedAt: Date | string"
5708
+ ],
5709
+ "returns": "Promise"
5710
+ },
5578
5711
  {
5579
5712
  "name": "classifyConstraintError",
5580
5713
  "static": true,
@@ -5815,6 +5948,9 @@
5815
5948
  {
5816
5949
  "name": "save",
5817
5950
  "async": true,
5951
+ "params": [
5952
+ "options?: SmrtSaveOptions"
5953
+ ],
5818
5954
  "returns": "any"
5819
5955
  },
5820
5956
  {
@@ -5848,6 +5984,14 @@
5848
5984
  "operation: Function"
5849
5985
  ],
5850
5986
  "returns": "Promise<T>"
5987
+ },
5988
+ {
5989
+ "name": "withTransaction",
5990
+ "async": true,
5991
+ "params": [
5992
+ "operation: Function"
5993
+ ],
5994
+ "returns": "Promise<T>"
5851
5995
  }
5852
5996
  ],
5853
5997
  "tenant": {
@@ -6054,6 +6198,7 @@
6054
6198
  "addAsset",
6055
6199
  "addMetadata",
6056
6200
  "addRelationship",
6201
+ "claimRevision",
6057
6202
  "classifyConstraintError",
6058
6203
  "clearEmbeddings",
6059
6204
  "delete",
@@ -6119,7 +6264,8 @@
6119
6264
  "toPlainObject",
6120
6265
  "toPublicJSON",
6121
6266
  "updateMetadata",
6122
- "withDatabase"
6267
+ "withDatabase",
6268
+ "withTransaction"
6123
6269
  ],
6124
6270
  "methodSignatures": [
6125
6271
  {
@@ -6159,6 +6305,14 @@
6159
6305
  ],
6160
6306
  "returns": "Promise<void>"
6161
6307
  },
6308
+ {
6309
+ "name": "claimRevision",
6310
+ "async": true,
6311
+ "params": [
6312
+ "expectedUpdatedAt: Date | string"
6313
+ ],
6314
+ "returns": "Promise"
6315
+ },
6162
6316
  {
6163
6317
  "name": "classifyConstraintError",
6164
6318
  "static": true,
@@ -6552,6 +6706,9 @@
6552
6706
  {
6553
6707
  "name": "save",
6554
6708
  "async": true,
6709
+ "params": [
6710
+ "options?: SmrtSaveOptions"
6711
+ ],
6555
6712
  "returns": "any"
6556
6713
  },
6557
6714
  {
@@ -6610,6 +6767,14 @@
6610
6767
  "operation: Function"
6611
6768
  ],
6612
6769
  "returns": "Promise<T>"
6770
+ },
6771
+ {
6772
+ "name": "withTransaction",
6773
+ "async": true,
6774
+ "params": [
6775
+ "operation: Function"
6776
+ ],
6777
+ "returns": "Promise<T>"
6613
6778
  }
6614
6779
  ],
6615
6780
  "tableStrategy": "sti",
@@ -6732,6 +6897,7 @@
6732
6897
  "addAsset",
6733
6898
  "addMetadata",
6734
6899
  "addRelationship",
6900
+ "claimRevision",
6735
6901
  "classifyConstraintError",
6736
6902
  "clearEmbeddings",
6737
6903
  "delete",
@@ -6797,7 +6963,8 @@
6797
6963
  "toPlainObject",
6798
6964
  "toPublicJSON",
6799
6965
  "updateMetadata",
6800
- "withDatabase"
6966
+ "withDatabase",
6967
+ "withTransaction"
6801
6968
  ],
6802
6969
  "methodSignatures": [
6803
6970
  {
@@ -6837,6 +7004,14 @@
6837
7004
  ],
6838
7005
  "returns": "Promise<void>"
6839
7006
  },
7007
+ {
7008
+ "name": "claimRevision",
7009
+ "async": true,
7010
+ "params": [
7011
+ "expectedUpdatedAt: Date | string"
7012
+ ],
7013
+ "returns": "Promise"
7014
+ },
6840
7015
  {
6841
7016
  "name": "classifyConstraintError",
6842
7017
  "static": true,
@@ -7230,6 +7405,9 @@
7230
7405
  {
7231
7406
  "name": "save",
7232
7407
  "async": true,
7408
+ "params": [
7409
+ "options?: SmrtSaveOptions"
7410
+ ],
7233
7411
  "returns": "any"
7234
7412
  },
7235
7413
  {
@@ -7288,6 +7466,14 @@
7288
7466
  "operation: Function"
7289
7467
  ],
7290
7468
  "returns": "Promise<T>"
7469
+ },
7470
+ {
7471
+ "name": "withTransaction",
7472
+ "async": true,
7473
+ "params": [
7474
+ "operation: Function"
7475
+ ],
7476
+ "returns": "Promise<T>"
7291
7477
  }
7292
7478
  ],
7293
7479
  "tableStrategy": "sti",
@@ -7410,6 +7596,7 @@
7410
7596
  "addAsset",
7411
7597
  "addMetadata",
7412
7598
  "addRelationship",
7599
+ "claimRevision",
7413
7600
  "classifyConstraintError",
7414
7601
  "clearEmbeddings",
7415
7602
  "delete",
@@ -7475,7 +7662,8 @@
7475
7662
  "toPlainObject",
7476
7663
  "toPublicJSON",
7477
7664
  "updateMetadata",
7478
- "withDatabase"
7665
+ "withDatabase",
7666
+ "withTransaction"
7479
7667
  ],
7480
7668
  "methodSignatures": [
7481
7669
  {
@@ -7515,6 +7703,14 @@
7515
7703
  ],
7516
7704
  "returns": "Promise<void>"
7517
7705
  },
7706
+ {
7707
+ "name": "claimRevision",
7708
+ "async": true,
7709
+ "params": [
7710
+ "expectedUpdatedAt: Date | string"
7711
+ ],
7712
+ "returns": "Promise"
7713
+ },
7518
7714
  {
7519
7715
  "name": "classifyConstraintError",
7520
7716
  "static": true,
@@ -7908,6 +8104,9 @@
7908
8104
  {
7909
8105
  "name": "save",
7910
8106
  "async": true,
8107
+ "params": [
8108
+ "options?: SmrtSaveOptions"
8109
+ ],
7911
8110
  "returns": "any"
7912
8111
  },
7913
8112
  {
@@ -7966,6 +8165,14 @@
7966
8165
  "operation: Function"
7967
8166
  ],
7968
8167
  "returns": "Promise<T>"
8168
+ },
8169
+ {
8170
+ "name": "withTransaction",
8171
+ "async": true,
8172
+ "params": [
8173
+ "operation: Function"
8174
+ ],
8175
+ "returns": "Promise<T>"
7969
8176
  }
7970
8177
  ],
7971
8178
  "tableStrategy": "sti",
package/dist/utils.js CHANGED
@@ -1,17 +1,17 @@
1
1
  //#region src/utils.ts
2
2
  async function getProfileMetadata(profileId, options = {}) {
3
- const { ProfileMetadataCollection } = await import("./chunks/ProfileMetadataCollection-Ceq-QV-1.js").then((n) => n.n);
3
+ const { ProfileMetadataCollection } = await import("./chunks/ProfileMetadataCollection-BdkdHPud.js").then((n) => n.n);
4
4
  return await (await ProfileMetadataCollection.create(options)).getMetadataObject(profileId);
5
5
  }
6
6
  async function setProfileMetadata(profileId, metafieldSlug, value, options = {}) {
7
- const { ProfileCollection } = await import("./chunks/ProfileCollection-WlRQ7bj3.js").then((n) => n.r);
7
+ const { ProfileCollection } = await import("./chunks/ProfileCollection-BLwatLeO.js").then((n) => n.r);
8
8
  const profile = await (await ProfileCollection.create(options)).get({ id: profileId });
9
9
  if (!profile) throw new Error(`Profile '${profileId}' not found`);
10
10
  await profile.addMetadata(metafieldSlug, value);
11
11
  }
12
12
  async function findProfilesByMeta(metafieldSlug, value, options = {}) {
13
- const { ProfileMetafieldCollection } = await import("./chunks/ProfileMetafieldCollection-CM374Dbh.js").then((n) => n.n);
14
- const { ProfileMetadataCollection } = await import("./chunks/ProfileMetadataCollection-Ceq-QV-1.js").then((n) => n.n);
13
+ const { ProfileMetafieldCollection } = await import("./chunks/ProfileMetafieldCollection-BELgOOlR.js").then((n) => n.n);
14
+ const { ProfileMetadataCollection } = await import("./chunks/ProfileMetadataCollection-BdkdHPud.js").then((n) => n.n);
15
15
  const metafield = await (await ProfileMetafieldCollection.create(options)).getBySlug(metafieldSlug);
16
16
  if (!metafield) throw new Error(`Metafield '${metafieldSlug}' not found`);
17
17
  return await (await ProfileMetadataCollection.create(options)).findProfilesByMetadata(metafield.id, value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyvertical/smrt-profiles",
3
- "version": "0.43.9",
3
+ "version": "0.44.0",
4
4
  "description": "Profile management system with relationships, metadata, and reciprocal associations for SMRT framework",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -34,10 +34,10 @@
34
34
  "@happyvertical/utils": "^0.89.4",
35
35
  "@noble/curves": "^1.9.7",
36
36
  "bech32": "^2.0.0",
37
- "@happyvertical/smrt-prompts": "0.43.9",
38
- "@happyvertical/smrt-core": "0.43.9",
39
- "@happyvertical/smrt-assets": "0.43.9",
40
- "@happyvertical/smrt-tenancy": "0.43.9"
37
+ "@happyvertical/smrt-assets": "0.44.0",
38
+ "@happyvertical/smrt-prompts": "0.44.0",
39
+ "@happyvertical/smrt-tenancy": "0.44.0",
40
+ "@happyvertical/smrt-core": "0.44.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@faker-js/faker": "^10.5.0",
@@ -46,7 +46,7 @@
46
46
  "typescript": "5.9.3",
47
47
  "vite": "8.1.4",
48
48
  "vitest": "4.1.10",
49
- "@happyvertical/smrt-vitest": "0.43.9"
49
+ "@happyvertical/smrt-vitest": "0.44.0"
50
50
  },
51
51
  "keywords": [
52
52
  "ai",
@@ -1 +0,0 @@
1
- {"version":3,"file":"ApiKey-CMm509C4.js","names":[],"sources":["../../src/models/ApiKey.ts"],"sourcesContent":["/**\n * ApiKey - API keys for CLI and CI authentication\n *\n * Provides secure API key management with hashing, scopes, and expiration.\n * Keys are stored as hashes - the plaintext is only returned on creation.\n */\n\nimport { createHash, randomBytes } from 'node:crypto';\nimport {\n field,\n foreignKey,\n SmrtObject,\n type SmrtObjectOptions,\n smrt,\n} from '@happyvertical/smrt-core';\nimport type { Profile } from './Profile';\n\nexport interface ApiKeyOptions extends SmrtObjectOptions {\n profileId?: string;\n name?: string;\n scopes?: string[];\n expiresAt?: Date | null;\n}\n\nexport interface GenerateKeyResult {\n key: string;\n apiKey: ApiKey;\n}\n\n@smrt({\n tableName: 'api_keys',\n api: { include: ['list', 'get'] },\n mcp: { include: ['list', 'get'] },\n // create/revoke are admin operations invoked in-process via the CLI; only\n // read-only list/get are exposed over HTTP.\n cli: { include: ['list', 'get', 'create', 'revoke'], skipApiCheck: true },\n})\nexport class ApiKey extends SmrtObject {\n /**\n * Link to the Profile (Person, Organization, Bot)\n */\n @foreignKey('Profile', { required: true })\n profileId?: string;\n\n /**\n * SHA-256 hash of the API key.\n *\n * Indexed: `verify()` looks keys up by this hash on every authenticated\n * request (#2364, epic #2382 finding A3).\n */\n @field({ indexed: true })\n keyHash: string = '';\n\n /**\n * First 8 characters of the key for identification (e.g., \"sk_live_a1b2...\")\n */\n keyPrefix: string = '';\n\n /**\n * Human-readable name for the key (e.g., \"CI Bot\", \"Local CLI\")\n */\n name: string = '';\n\n /**\n * Scopes/permissions for this key\n */\n scopes: string[] = [];\n\n /**\n * Last time this key was used\n */\n lastUsedAt: Date | null = null;\n\n /**\n * When this key expires (null = never)\n */\n expiresAt: Date | null = null;\n\n /**\n * When this key was revoked (null = active)\n */\n revokedAt: Date | null = null;\n\n constructor(options: ApiKeyOptions = {}) {\n super(options);\n if (options.profileId) this.profileId = options.profileId;\n if (options.name) this.name = options.name;\n if (options.scopes) this.scopes = options.scopes;\n if (options.expiresAt !== undefined) this.expiresAt = options.expiresAt;\n }\n\n /**\n * Get the linked Profile\n */\n async getProfile(): Promise<Profile | null> {\n return (await this.getRelated('profileId')) as Profile | null;\n }\n\n /**\n * Check if this key is valid (not expired, not revoked)\n */\n isValid(): boolean {\n if (this.revokedAt) return false;\n if (this.expiresAt && this.expiresAt < new Date()) return false;\n return true;\n }\n\n /**\n * Check if this key has a specific scope\n */\n hasScope(scope: string): boolean {\n return this.scopes.includes(scope) || this.scopes.includes('*');\n }\n\n /**\n * Revoke this key\n */\n async revoke(): Promise<void> {\n this.revokedAt = new Date();\n await this.save();\n }\n\n /**\n * Record usage of this key\n */\n async recordUsage(): Promise<void> {\n this.lastUsedAt = new Date();\n await this.save();\n }\n\n /**\n * Hash an API key\n */\n static hashKey(key: string): string {\n return createHash('sha256').update(key).digest('hex');\n }\n\n /**\n * Generate a new API key for a profile\n */\n static async generate(\n profile: Profile,\n options: {\n name: string;\n scopes?: string[];\n expiresAt?: Date | null;\n db?: SmrtObjectOptions['db'];\n },\n ): Promise<GenerateKeyResult> {\n // Generate a random key: sk_live_<32 random bytes as hex>\n const randomPart = randomBytes(32).toString('hex');\n const key = `sk_live_${randomPart}`;\n const keyPrefix = key.substring(0, 16);\n const keyHash = ApiKey.hashKey(key);\n\n const apiKey = new ApiKey({\n db: options.db || profile.options?.db,\n profileId: profile.id as string,\n name: options.name,\n scopes: options.scopes || ['*'],\n expiresAt: options.expiresAt ?? null,\n });\n apiKey.keyHash = keyHash;\n apiKey.keyPrefix = keyPrefix;\n\n await apiKey.initialize();\n await apiKey.save();\n\n return { key, apiKey };\n }\n\n /**\n * Verify an API key and return the ApiKey record if valid\n */\n static async verify(\n key: string,\n options: SmrtObjectOptions = {},\n ): Promise<ApiKey | null> {\n const keyHash = ApiKey.hashKey(key);\n\n const { ApiKeyCollection } = await import(\n '../collections/ApiKeyCollection'\n );\n const collection = await ApiKeyCollection.create(options);\n\n const apiKey = await collection.findOne({\n where: { keyHash },\n });\n\n if (!apiKey) return null;\n if (!apiKey.isValid()) return null;\n\n // Record usage\n await apiKey.recordUsage();\n\n return apiKey;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAqCO,IAAM,SAAN,cAAqB,WAAW;CAKrC;CASA,UAAkB;;;;CAKlB,YAAoB;;;;CAKpB,OAAe;;;;CAKf,SAAmB,CAAC;;;;CAKpB,aAA0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EACjB,OAAO,YAAY;EAEnB,MAAM,OAAO,WAAW;EACxB,MAAM,OAAO,KAAK;EAElB,OAAO;GAAE;GAAK;EAAO;CACvB;;;;CAKA,aAAa,OACX,KACA,UAA6B,CAAC,GACN;EACxB,MAAM,UAAU,OAAO,QAAQ,GAAG;EAElC,MAAM,EAAE,qBAAqB,MAAM,OACjC,iCAAA,CAAA,MAAA,MAAA,EAAA,CAAA;EAIF,MAAM,SAAS,OAAM,MAFI,iBAAiB,OAAO,OAAO,EAAA,CAExB,QAAQ,EACtC,OAAO,EAAE,QAAQ,EACnB,CAAC;EAED,IAAI,CAAC,QAAQ,OAAO;EACpB,IAAI,CAAC,OAAO,QAAQ,GAAG,OAAO;EAG9B,MAAM,OAAO,YAAY;EAEzB,OAAO;CACT;AACF;AA3JE,gBAAA,CADC,WAAW,WAAW,EAAE,UAAU,KAAK,CAAC,CAAA,GAJ9B,OAKX,WAAA,aAAA,CAAA;AASA,gBAAA,CADC,MAAM,EAAE,SAAS,KAAK,CAAC,CAAA,GAbb,OAcX,WAAA,WAAA,CAAA;AAdW,SAAN,gBAAA,CARN,KAAK;CACJ,WAAW;CACX,KAAK,EAAE,SAAS,CAAC,QAAQ,KAAK,EAAE;CAChC,KAAK,EAAE,SAAS,CAAC,QAAQ,KAAK,EAAE;CAGhC,KAAK;EAAE,SAAS;GAAC;GAAQ;GAAO;GAAU;EAAQ;EAAG,cAAc;CAAK;AAC1E,CAAC,CAAA,GACY,MAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ApiKeyCollection-C6p7XgTz.js","names":[],"sources":["../../src/collections/ApiKeyCollection.ts"],"sourcesContent":["/**\n * ApiKeyCollection - Collection for managing API keys\n */\n\nimport { SmrtCollection } from '@happyvertical/smrt-core';\nimport { ApiKey, type GenerateKeyResult } from '../models/ApiKey';\nimport type { Profile } from '../models/Profile';\n\nexport class ApiKeyCollection extends SmrtCollection<ApiKey> {\n static readonly _itemClass = ApiKey;\n\n /**\n * Find all keys for a profile\n */\n async findByProfile(profileId: string): Promise<ApiKey[]> {\n return await this.list({\n where: { profileId },\n });\n }\n\n /**\n * Find active (non-revoked, non-expired) keys for a profile\n */\n async findActiveByProfile(profileId: string): Promise<ApiKey[]> {\n const keys = await this.findByProfile(profileId);\n return keys.filter((key) => key.isValid());\n }\n\n /**\n * Find key by hash\n */\n async findByHash(keyHash: string): Promise<ApiKey | null> {\n return await this.findOne({\n where: { keyHash },\n });\n }\n\n /**\n * Verify an API key string and return the record if valid\n */\n async verify(key: string): Promise<ApiKey | null> {\n const keyHash = ApiKey.hashKey(key);\n const apiKey = await this.findByHash(keyHash);\n\n if (!apiKey) return null;\n if (!apiKey.isValid()) return null;\n\n // Record usage\n await apiKey.recordUsage();\n\n return apiKey;\n }\n\n /**\n * Generate a new key for a profile\n */\n async generateForProfile(\n profile: Profile,\n options: {\n name: string;\n scopes?: string[];\n expiresAt?: Date | null;\n },\n ): Promise<GenerateKeyResult> {\n return await ApiKey.generate(profile, {\n ...options,\n db: this.options.db,\n });\n }\n\n /**\n * Revoke all keys for a profile\n */\n async revokeAllForProfile(profileId: string): Promise<number> {\n const keys = await this.findActiveByProfile(profileId);\n for (const key of keys) {\n await key.revoke();\n }\n return keys.length;\n }\n\n /**\n * Revoke a specific key by prefix\n */\n async revokeByPrefix(keyPrefix: string): Promise<boolean> {\n const key = await this.findOne({\n where: { keyPrefix },\n });\n\n if (key?.isValid()) {\n await key.revoke();\n return true;\n }\n return false;\n }\n\n /**\n * Clean up expired keys (soft delete by setting revokedAt)\n */\n async cleanupExpired(): Promise<number> {\n const now = new Date();\n const allKeys = await this.list({});\n let cleaned = 0;\n\n for (const key of allKeys) {\n if (key.expiresAt && key.expiresAt < now && !key.revokedAt) {\n key.revokedAt = now;\n await key.save();\n cleaned++;\n }\n }\n\n return cleaned;\n }\n}\n"],"mappings":";;;;;AAQO,IAAM,mBAAN,cAA+B,eAAuB;CAC3D,OAAgB,aAAa;;;;CAK7B,MAAM,cAAc,WAAsC;EACxD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