@happyvertical/smrt-cli 0.55.1 → 0.55.3

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 (28) hide show
  1. package/AGENTS.md +1 -1
  2. package/agents/db-migrate-concurrency.md +55 -0
  3. package/dist/{AuditLogCollection-WDHL-_AF-G2UOSM3H.js → AuditLogCollection-WDHL-_AF-Bgyxf5sF.js} +1 -1
  4. package/dist/{OidcIdentity-BjRu3n1g-CzvSN6Wz.js → OidcIdentity-BUblgQLs-B4mzosmT.js} +3 -3
  5. package/dist/{OidcIdentityCollection-B4jYh36_-6UWtXCwi.js → OidcIdentityCollection-ClOyaHeF-DqB9Ex4b.js} +4 -4
  6. package/dist/{ProfileAssetCollection-HeMtjBc0-Cz4MOeSB.js → ProfileAssetCollection-CRMcjLJ--CIoZ9Fd2.js} +6 -6
  7. package/dist/{ProfileCollection-Bt6IJK49-CFyOiVFz.js → ProfileCollection-C4INKh7Y-DU6dPYSG.js} +24 -19
  8. package/dist/{ProfileLinkCollection-u1hhzKTm-CAfIjZ4f.js → ProfileLinkCollection-DFfZRsgv-qtgfWKFC.js} +5 -5
  9. package/dist/{ProfileMetadataCollection-BIYKy4Y3-CqcaAHAJ.js → ProfileMetadataCollection-BIYKy4Y3-BS9BY4vO.js} +1 -1
  10. package/dist/{ProfileMetafieldCollection-Buz7gzag-BNRo6e4x.js → ProfileMetafieldCollection-Buz7gzag-DyUWqbh9.js} +1 -1
  11. package/dist/{ProfileRelationshipCollection-C4g_QLI4-DeJzJ_hF.js → ProfileRelationshipCollection-C4g_QLI4-Ci7IHfeW.js} +1 -1
  12. package/dist/ProfileTypeCollection-B7kwi1mU-6KYMumQp.js +103 -0
  13. package/dist/commands/utilities.d.ts.map +1 -1
  14. package/dist/{commands-CboMy2vr.js → commands-KDgVSMM3.js} +46 -27
  15. package/dist/{config-hqNo4lzH.js → config-CdJRSMRi.js} +2 -1
  16. package/dist/config.d.ts.map +1 -1
  17. package/dist/{dist-F98s-wG1.js → dist-C8iSkjym.js} +4 -4
  18. package/dist/{dist-m9bKxs6w.js → dist-CTMZBIem.js} +16 -15
  19. package/dist/dist-CoCIu5cW.js +21 -0
  20. package/dist/{dist-N7UoPf_4.js → dist-DQg_1csT.js} +3 -3
  21. package/dist/{dist-wrk3GKo3.js → dist-DRSQUACn.js} +26 -6
  22. package/dist/index.js +14 -14
  23. package/dist/{json-validator-BiAdsE1O.js → json-validator-CF2oQNDw.js} +1 -1
  24. package/dist/oidcProvisioningPrimitives-DNP9EZlU-CUDQKgU2.js +93 -0
  25. package/dist/{resolveIdentity-CvGDegU6-BePPF1Iv.js → resolveIdentity-CkyqvctR-DFVUhcM1.js} +17 -17
  26. package/package.json +16 -16
  27. package/dist/dist-CkONQFUR.js +0 -20
  28. package/dist/oidcProvisioningPrimitives-CYood-2M-DKUWB1oI.js +0 -171
@@ -47,7 +47,7 @@ var TenantIsolationError = class extends Error {
47
47
  }
48
48
  };
49
49
  //#endregion
50
- //#region ../tenancy/dist/chunks/testing-Bp23qg6E.js
50
+ //#region ../tenancy/dist/chunks/testing-Cs_C_Q-y.js
51
51
  var logger$1 = createLogger({ level: "info" });
52
52
  var DEFAULT_CONFIG = {
53
53
  mode: "required",
@@ -169,12 +169,24 @@ function resolveSelectorClass(selector) {
169
169
  const matches = ObjectRegistry.findClassesByName(selector);
170
170
  return matches.length === 1 ? matches[0] : void 0;
171
171
  }
172
+ function declaresFieldInChain(registered, fieldName) {
173
+ if (registered.fields.has(fieldName)) return true;
174
+ if (registered.inheritedFields?.has(fieldName)) return true;
175
+ const visited = /* @__PURE__ */ new Set([registered.constructor]);
176
+ let ctor = Object.getPrototypeOf(registered.constructor);
177
+ while (typeof ctor === "function" && !visited.has(ctor)) {
178
+ visited.add(ctor);
179
+ if (ObjectRegistry.getClassByConstructor(ctor)?.fields.has(fieldName)) return true;
180
+ ctor = Object.getPrototypeOf(ctor);
181
+ }
182
+ return false;
183
+ }
172
184
  function auditSelector(selector, config) {
173
185
  const registered = resolveSelectorClass(selector);
174
186
  if (!registered) return [];
175
187
  const className = registered.qualifiedName || registered.name;
176
188
  const findings = [];
177
- if (!registered.fields.has(config.field)) {
189
+ if (!declaresFieldInChain(registered, config.field)) {
178
190
  findings.push({
179
191
  selector,
180
192
  className,
@@ -222,7 +234,10 @@ function warnOnRegistrationMismatch(selector) {
222
234
  var KEY = /* @__PURE__ */ Symbol.for("smrt:tenant-global-read-scope");
223
235
  var root = globalThis;
224
236
  root[KEY] ??= new AsyncLocalStorage();
225
- root[KEY];
237
+ var storage = root[KEY];
238
+ function runTenantGlobalReadScope(tenantId, callback) {
239
+ return storage.run(tenantId, callback);
240
+ }
226
241
  function assertTenantReadAllowed(tenantId, label) {
227
242
  const tenantContext = getCurrentTenant();
228
243
  if (tenantContext && !isSuperAdminBypass() && tenantContext.tenantId !== tenantId) throw new TenantIsolationError(`Tenant isolation violation in ${label}: context tenant is '${tenantContext.tenantId}' but query requested '${tenantId}'`, {
@@ -230,6 +245,11 @@ function assertTenantReadAllowed(tenantId, label) {
230
245
  attemptedTenantId: tenantId
231
246
  });
232
247
  }
248
+ async function withTenantGlobalRead(tenantId, callback) {
249
+ if (typeof tenantId !== "string" || !tenantId.trim()) throw new Error("withTenantGlobalRead requires a nonempty tenant ID");
250
+ assertTenantReadAllowed(tenantId, "withTenantGlobalRead");
251
+ return runTenantGlobalReadScope(tenantId, callback);
252
+ }
233
253
  async function queryGlobal(collection) {
234
254
  const metaType = collection.getStiChildMetaType();
235
255
  const where = metaType ? "WHERE _meta_type = ? AND tenant_id IS NULL" : "WHERE tenant_id IS NULL";
@@ -246,7 +266,7 @@ async function queryWithGlobals(collection, tenantId, label) {
246
266
  createLogger({ level: "info" });
247
267
  //#endregion
248
268
  //#region ../tenancy/dist/index.js
249
- ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-tenancy","packageVersion":"0.55.1","objects":{"@happyvertical/smrt-tenancy:BillingRelationship":{"name":"billingrelationship","className":"BillingRelationship","qualifiedName":"@happyvertical/smrt-tenancy:BillingRelationship","collection":"billingrelationships","filePath":"/home/runner/work/smrt/smrt/packages/tenancy/src/billing-relationship.ts","packageName":"@happyvertical/smrt-tenancy","fields":{"childTenantId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-users:Tenant","_meta":{"required":true}},"resellerTenantId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-users:Tenant","_meta":{"required":true}},"billingOwnerMode":{"type":"text","required":false,"default":"self"}},"methods":{},"decoratorConfig":{"tableName":"_smrt_billing_relationships","conflictColumns":["child_tenant_id"],"api":false,"cli":false,"mcp":false},"extends":"SmrtObject","exportName":"BillingRelationship","collectionExportName":"BillingRelationshipCollection","validationRules":[{"field":"childTenantId","rule":"required","fieldType":"crossPackageRef"},{"field":"resellerTenantId","rule":"required","fieldType":"crossPackageRef"}],"schema":{"tableName":"_smrt_billing_relationships","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_billing_relationships\\" (\\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 \\"child_tenant_id\\" UUID NOT NULL,\\n \\"reseller_tenant_id\\" UUID NOT NULL,\\n \\"billing_owner_mode\\" TEXT DEFAULT 'self'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"child_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"reseller_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"billing_owner_mode":{"type":"TEXT","notNull":false,"unique":false,"default":"self"}},"indexes":[{"name":"_smrt_billing_relationships_child_tenant_id_idx","columns":["child_tenant_id"],"unique":true},{"name":"_smrt_billing_relationships_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_billing_relationships_created_at_idx","columns":["created_at"]},{"name":"_smrt_billing_relationships_reseller_tenant_id_idx","columns":["reseller_tenant_id"]}],"version":"4d7f410a"},"importPath":"@happyvertical/smrt-tenancy"},"@happyvertical/smrt-tenancy:BillingRelationshipCollection":{"name":"billingrelationshipcollection","className":"BillingRelationshipCollection","qualifiedName":"@happyvertical/smrt-tenancy:BillingRelationshipCollection","collection":"billingrelationships","filePath":"/home/runner/work/smrt/smrt/packages/tenancy/src/billing-relationship.ts","packageName":"@happyvertical/smrt-tenancy","fields":{},"methods":{},"decoratorConfig":{"tableName":"_smrt_billing_relationships","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"BillingRelationship","exportName":"BillingRelationshipCollection","collectionExportName":"BillingRelationshipCollectionCollection","schema":{"tableName":"_smrt_billing_relationships","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_billing_relationships\\" (\\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 \\"child_tenant_id\\" UUID NOT NULL,\\n \\"reseller_tenant_id\\" UUID NOT NULL,\\n \\"billing_owner_mode\\" TEXT DEFAULT 'self'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"child_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"reseller_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"billing_owner_mode":{"type":"TEXT","notNull":false,"unique":false,"default":"self"}},"indexes":[{"name":"_smrt_billing_relationships_child_tenant_id_idx","columns":["child_tenant_id"],"unique":true},{"name":"_smrt_billing_relationships_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_billing_relationships_created_at_idx","columns":["created_at"]},{"name":"_smrt_billing_relationships_reseller_tenant_id_idx","columns":["reseller_tenant_id"]}],"version":"4d7f410a"},"importPath":"@happyvertical/smrt-tenancy"}},"moduleType":"smrt","smrtDependencies":["@happyvertical/smrt-core"],"stampsConstructors":true}`));
269
+ ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-tenancy","packageVersion":"0.55.3","objects":{"@happyvertical/smrt-tenancy:BillingRelationship":{"name":"billingrelationship","className":"BillingRelationship","qualifiedName":"@happyvertical/smrt-tenancy:BillingRelationship","collection":"billingrelationships","filePath":"/home/runner/work/smrt/smrt/packages/tenancy/src/billing-relationship.ts","packageName":"@happyvertical/smrt-tenancy","fields":{"childTenantId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-users:Tenant","_meta":{"required":true}},"resellerTenantId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-users:Tenant","_meta":{"required":true}},"billingOwnerMode":{"type":"text","required":false,"default":"self","enum":["self","reseller"]}},"methods":{},"decoratorConfig":{"tableName":"_smrt_billing_relationships","conflictColumns":["child_tenant_id"],"api":false,"cli":false,"mcp":false},"extends":"SmrtObject","exportName":"BillingRelationship","collectionExportName":"BillingRelationshipCollection","validationRules":[{"field":"childTenantId","rule":"required","fieldType":"crossPackageRef"},{"field":"resellerTenantId","rule":"required","fieldType":"crossPackageRef"}],"schema":{"tableName":"_smrt_billing_relationships","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_billing_relationships\\" (\\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 \\"child_tenant_id\\" UUID NOT NULL,\\n \\"reseller_tenant_id\\" UUID NOT NULL,\\n \\"billing_owner_mode\\" TEXT DEFAULT 'self'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"child_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"reseller_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"billing_owner_mode":{"type":"TEXT","notNull":false,"unique":false,"default":"self"}},"indexes":[{"name":"_smrt_billing_relationships_child_tenant_id_idx","columns":["child_tenant_id"],"unique":true},{"name":"_smrt_billing_relationships_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_billing_relationships_created_at_idx","columns":["created_at"]},{"name":"_smrt_billing_relationships_reseller_tenant_id_idx","columns":["reseller_tenant_id"]}],"version":"4d7f410a"},"importPath":"@happyvertical/smrt-tenancy"},"@happyvertical/smrt-tenancy:BillingRelationshipCollection":{"name":"billingrelationshipcollection","className":"BillingRelationshipCollection","qualifiedName":"@happyvertical/smrt-tenancy:BillingRelationshipCollection","collection":"billingrelationships","filePath":"/home/runner/work/smrt/smrt/packages/tenancy/src/billing-relationship.ts","packageName":"@happyvertical/smrt-tenancy","fields":{},"methods":{},"decoratorConfig":{"tableName":"_smrt_billing_relationships","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"BillingRelationship","exportName":"BillingRelationshipCollection","collectionExportName":"BillingRelationshipCollectionCollection","schema":{"tableName":"_smrt_billing_relationships","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_billing_relationships\\" (\\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 \\"child_tenant_id\\" UUID NOT NULL,\\n \\"reseller_tenant_id\\" UUID NOT NULL,\\n \\"billing_owner_mode\\" TEXT DEFAULT 'self'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"child_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"reseller_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"billing_owner_mode":{"type":"TEXT","notNull":false,"unique":false,"default":"self"}},"indexes":[{"name":"_smrt_billing_relationships_child_tenant_id_idx","columns":["child_tenant_id"],"unique":true},{"name":"_smrt_billing_relationships_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_billing_relationships_created_at_idx","columns":["created_at"]},{"name":"_smrt_billing_relationships_reseller_tenant_id_idx","columns":["reseller_tenant_id"]}],"version":"4d7f410a"},"importPath":"@happyvertical/smrt-tenancy"}},"moduleType":"smrt","smrtDependencies":["@happyvertical/smrt-core"],"stampsConstructors":true}`));
250
270
  var __defProp$2 = Object.defineProperty;
251
271
  var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
252
272
  var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$2(obj, key, {
@@ -361,7 +381,7 @@ var __exportAll = (all, no_symbols) => {
361
381
  if (!no_symbols) __defProp$1(target, Symbol.toStringTag, { value: "Module" });
362
382
  return target;
363
383
  };
364
- ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-prompts","packageVersion":"0.55.1","objects":{"@happyvertical/smrt-prompts:PromptOverrideCollection":{"name":"promptoverridecollection","className":"PromptOverrideCollection","qualifiedName":"@happyvertical/smrt-prompts:PromptOverrideCollection","collection":"promptoverrides","filePath":"/home/runner/work/smrt/smrt/packages/prompts/src/collections/PromptOverrideCollection.ts","packageName":"@happyvertical/smrt-prompts","fields":{},"methods":{"getAppOverride":{"name":"getAppOverride","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"options","type":"object","optional":true,"memberTypes":["string"]}],"returnType":"Promise<PromptOverride | null>","isStatic":false,"isPublic":true},"getTenantOverride":{"name":"getTenantOverride","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"tenantId","type":"string","optional":false},{"name":"options","type":"object","optional":true,"memberTypes":["string"]}],"returnType":"Promise<PromptOverride | null>","isStatic":false,"isPublic":true},"getResolutionLayers":{"name":"getResolutionLayers","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"tenantId","type":"string | null","optional":true,"unionBranches":[{"type":"string"},{"type":"null"}]},{"name":"options","type":"object","optional":true,"memberTypes":["string"]}],"returnType":"Promise<object>","isStatic":false,"isPublic":true},"getOverrideMapForKeys":{"name":"getOverrideMapForKeys","async":true,"parameters":[{"name":"keys","type":"string[]","optional":false},{"name":"scopeType","type":"PromptOverrideScopeType","optional":false},{"name":"scopeId","type":"string","optional":false}],"returnType":"Promise<Map<string, PromptOverride>>","isStatic":false,"isPublic":true},"findByScope":{"name":"findByScope","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"scopeType","type":"PromptOverrideScopeType","optional":false},{"name":"scopeId","type":"string","optional":false}],"returnType":"Promise<PromptOverride | null>","isStatic":false,"isPublic":true},"setTemplateOverride":{"name":"setTemplateOverride","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"scopeType","type":"PromptOverrideScopeType","optional":false},{"name":"scopeId","type":"string","optional":false},{"name":"template","type":"string | null","optional":false,"unionBranches":[{"type":"string"},{"type":"null"}]}],"returnType":"Promise<PromptOverride>","isStatic":false,"isPublic":true},"removeOverride":{"name":"removeOverride","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"scopeType","type":"PromptOverrideScopeType","optional":false},{"name":"scopeId","type":"string","optional":false}],"returnType":"Promise<boolean>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"_smrt_prompt_overrides","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"PromptOverride","exportName":"PromptOverrideCollection","collectionExportName":"PromptOverrideCollectionCollection","schema":{"tableName":"_smrt_prompt_overrides","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_prompt_overrides\\" (\\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 \\"key\\" TEXT NOT NULL DEFAULT '',\\n \\"tenant_id\\" UUID,\\n \\"template\\" TEXT,\\n \\"profile\\" TEXT,\\n \\"model\\" TEXT,\\n \\"params\\" TEXT\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"key":{"type":"TEXT","notNull":true,"unique":false,"default":""},"tenant_id":{"type":"UUID","notNull":false,"unique":false},"template":{"type":"TEXT","notNull":false,"unique":false},"profile":{"type":"TEXT","notNull":false,"unique":false},"model":{"type":"TEXT","notNull":false,"unique":false},"params":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_prompt_overrides_key_context_idx","columns":["key","context"],"unique":true},{"name":"_smrt_prompt_overrides_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_prompt_overrides_created_at_idx","columns":["created_at"]}],"version":"38f505e7"},"importPath":"@happyvertical/smrt-prompts"},"@happyvertical/smrt-prompts:PromptOverride":{"name":"promptoverride","className":"PromptOverride","qualifiedName":"@happyvertical/smrt-prompts:PromptOverride","collection":"promptoverrides","filePath":"/home/runner/work/smrt/smrt/packages/prompts/src/models/PromptOverride.ts","packageName":"@happyvertical/smrt-prompts","fields":{"key":{"type":"text","required":true,"default":"","_meta":{"required":true}},"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true}},"template":{"type":"text","required":false,"_meta":{"nullable":true}},"profile":{"type":"text","required":false,"_meta":{"nullable":true}},"model":{"type":"text","required":false,"_meta":{"nullable":true}},"params":{"type":"text","required":false,"_meta":{"nullable":true}}},"methods":{"getParams":{"name":"getParams","async":false,"parameters":[],"returnType":"PromptParams","isStatic":false,"isPublic":true},"setParams":{"name":"setParams","async":false,"parameters":[{"name":"params","type":"PromptParams | null","optional":false,"unionBranches":[{"type":"PromptParams"},{"type":"null"}]}],"returnType":"void","isStatic":false,"isPublic":true},"toPromptLayer":{"name":"toPromptLayer","async":false,"parameters":[],"returnType":"PromptLayer","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"delete":{"name":"delete","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"_smrt_prompt_overrides","conflictColumns":["key","context"],"api":false,"cli":false,"mcp":false},"extends":"SmrtObject","exportName":"PromptOverride","collectionExportName":"PromptOverrideCollection","validationRules":[{"field":"key","rule":"required","fieldType":"text"}],"schema":{"tableName":"_smrt_prompt_overrides","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_prompt_overrides\\" (\\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 \\"key\\" TEXT NOT NULL DEFAULT '',\\n \\"tenant_id\\" UUID,\\n \\"template\\" TEXT,\\n \\"profile\\" TEXT,\\n \\"model\\" TEXT,\\n \\"params\\" TEXT\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"key":{"type":"TEXT","notNull":true,"unique":false,"default":""},"tenant_id":{"type":"UUID","notNull":false,"unique":false},"template":{"type":"TEXT","notNull":false,"unique":false},"profile":{"type":"TEXT","notNull":false,"unique":false},"model":{"type":"TEXT","notNull":false,"unique":false},"params":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_prompt_overrides_key_context_idx","columns":["key","context"],"unique":true},{"name":"_smrt_prompt_overrides_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_prompt_overrides_created_at_idx","columns":["created_at"]}],"version":"38f505e7"},"importPath":"@happyvertical/smrt-prompts"}},"moduleType":"smrt","smrtDependencies":["@happyvertical/smrt-core","@happyvertical/smrt-tenancy"],"stampsConstructors":true}`));
384
+ ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-prompts","packageVersion":"0.55.3","objects":{"@happyvertical/smrt-prompts:PromptOverrideCollection":{"name":"promptoverridecollection","className":"PromptOverrideCollection","qualifiedName":"@happyvertical/smrt-prompts:PromptOverrideCollection","collection":"promptoverrides","filePath":"/home/runner/work/smrt/smrt/packages/prompts/src/collections/PromptOverrideCollection.ts","packageName":"@happyvertical/smrt-prompts","fields":{},"methods":{"getAppOverride":{"name":"getAppOverride","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"options","type":"object","optional":true,"memberTypes":["string"]}],"returnType":"Promise<PromptOverride | null>","isStatic":false,"isPublic":true},"getTenantOverride":{"name":"getTenantOverride","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"tenantId","type":"string","optional":false},{"name":"options","type":"object","optional":true,"memberTypes":["string"]}],"returnType":"Promise<PromptOverride | null>","isStatic":false,"isPublic":true},"getResolutionLayers":{"name":"getResolutionLayers","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"tenantId","type":"string | null","optional":true,"unionBranches":[{"type":"string"},{"type":"null"}]},{"name":"options","type":"object","optional":true,"memberTypes":["string"]}],"returnType":"Promise<object>","isStatic":false,"isPublic":true},"getOverrideMapForKeys":{"name":"getOverrideMapForKeys","async":true,"parameters":[{"name":"keys","type":"string[]","optional":false},{"name":"scopeType","type":"PromptOverrideScopeType","optional":false},{"name":"scopeId","type":"string","optional":false}],"returnType":"Promise<Map<string, PromptOverride>>","isStatic":false,"isPublic":true},"findByScope":{"name":"findByScope","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"scopeType","type":"PromptOverrideScopeType","optional":false},{"name":"scopeId","type":"string","optional":false}],"returnType":"Promise<PromptOverride | null>","isStatic":false,"isPublic":true},"setTemplateOverride":{"name":"setTemplateOverride","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"scopeType","type":"PromptOverrideScopeType","optional":false},{"name":"scopeId","type":"string","optional":false},{"name":"template","type":"string | null","optional":false,"unionBranches":[{"type":"string"},{"type":"null"}]}],"returnType":"Promise<PromptOverride>","isStatic":false,"isPublic":true},"removeOverride":{"name":"removeOverride","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"scopeType","type":"PromptOverrideScopeType","optional":false},{"name":"scopeId","type":"string","optional":false}],"returnType":"Promise<boolean>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"_smrt_prompt_overrides","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"PromptOverride","exportName":"PromptOverrideCollection","collectionExportName":"PromptOverrideCollectionCollection","schema":{"tableName":"_smrt_prompt_overrides","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_prompt_overrides\\" (\\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 \\"key\\" TEXT NOT NULL DEFAULT '',\\n \\"tenant_id\\" UUID,\\n \\"template\\" TEXT,\\n \\"profile\\" TEXT,\\n \\"model\\" TEXT,\\n \\"params\\" TEXT\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"key":{"type":"TEXT","notNull":true,"unique":false,"default":""},"tenant_id":{"type":"UUID","notNull":false,"unique":false},"template":{"type":"TEXT","notNull":false,"unique":false},"profile":{"type":"TEXT","notNull":false,"unique":false},"model":{"type":"TEXT","notNull":false,"unique":false},"params":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_prompt_overrides_key_context_idx","columns":["key","context"],"unique":true},{"name":"_smrt_prompt_overrides_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_prompt_overrides_created_at_idx","columns":["created_at"]}],"version":"38f505e7"},"importPath":"@happyvertical/smrt-prompts"},"@happyvertical/smrt-prompts:PromptOverride":{"name":"promptoverride","className":"PromptOverride","qualifiedName":"@happyvertical/smrt-prompts:PromptOverride","collection":"promptoverrides","filePath":"/home/runner/work/smrt/smrt/packages/prompts/src/models/PromptOverride.ts","packageName":"@happyvertical/smrt-prompts","fields":{"key":{"type":"text","required":true,"default":"","_meta":{"required":true}},"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true}},"template":{"type":"text","required":false,"_meta":{"nullable":true}},"profile":{"type":"text","required":false,"_meta":{"nullable":true}},"model":{"type":"text","required":false,"_meta":{"nullable":true}},"params":{"type":"text","required":false,"_meta":{"nullable":true}}},"methods":{"getParams":{"name":"getParams","async":false,"parameters":[],"returnType":"PromptParams","isStatic":false,"isPublic":true},"setParams":{"name":"setParams","async":false,"parameters":[{"name":"params","type":"PromptParams | null","optional":false,"unionBranches":[{"type":"PromptParams"},{"type":"null"}]}],"returnType":"void","isStatic":false,"isPublic":true},"toPromptLayer":{"name":"toPromptLayer","async":false,"parameters":[],"returnType":"PromptLayer","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"delete":{"name":"delete","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"_smrt_prompt_overrides","conflictColumns":["key","context"],"api":false,"cli":false,"mcp":false},"extends":"SmrtObject","exportName":"PromptOverride","collectionExportName":"PromptOverrideCollection","validationRules":[{"field":"key","rule":"required","fieldType":"text"}],"schema":{"tableName":"_smrt_prompt_overrides","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_prompt_overrides\\" (\\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 \\"key\\" TEXT NOT NULL DEFAULT '',\\n \\"tenant_id\\" UUID,\\n \\"template\\" TEXT,\\n \\"profile\\" TEXT,\\n \\"model\\" TEXT,\\n \\"params\\" TEXT\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"key":{"type":"TEXT","notNull":true,"unique":false,"default":""},"tenant_id":{"type":"UUID","notNull":false,"unique":false},"template":{"type":"TEXT","notNull":false,"unique":false},"profile":{"type":"TEXT","notNull":false,"unique":false},"model":{"type":"TEXT","notNull":false,"unique":false},"params":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_prompt_overrides_key_context_idx","columns":["key","context"],"unique":true},{"name":"_smrt_prompt_overrides_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_prompt_overrides_created_at_idx","columns":["created_at"]}],"version":"38f505e7"},"importPath":"@happyvertical/smrt-prompts"}},"moduleType":"smrt","smrtDependencies":["@happyvertical/smrt-core","@happyvertical/smrt-tenancy"],"stampsConstructors":true}`));
365
385
  var PROMPT_CACHE_TTL_MS = 3e4;
366
386
  var promptCache = /* @__PURE__ */ new Map();
367
387
  var cacheGenerations = /* @__PURE__ */ new Map();
@@ -1018,4 +1038,4 @@ async function resolvePrompt(key, options = {}) {
1018
1038
  };
1019
1039
  }
1020
1040
  //#endregion
1021
- export { queryGlobal as a, isSystemContext as c, tenantId as i, withSystemContext as l, resolvePrompt as n, queryWithGlobals as o, TenantScoped as r, getTenantId as s, definePrompt as t };
1041
+ export { queryGlobal as a, getTenantId as c, tenantId as i, isSystemContext as l, resolvePrompt as n, queryWithGlobals as o, TenantScoped as r, withTenantGlobalRead as s, definePrompt as t, withSystemContext as u };
package/dist/index.js CHANGED
@@ -49,63 +49,63 @@ var _playgroundCommands = null;
49
49
  var _workbenchCommands = null;
50
50
  async function getGnodeCommands() {
51
51
  if (!_gnodeCommands) {
52
- const { gnodeCommands } = await import("./commands-CboMy2vr.js");
52
+ const { gnodeCommands } = await import("./commands-KDgVSMM3.js");
53
53
  _gnodeCommands = gnodeCommands;
54
54
  }
55
55
  return _gnodeCommands;
56
56
  }
57
57
  async function getGitCommands() {
58
58
  if (!_gitCommands) {
59
- const { gitCommands } = await import("./commands-CboMy2vr.js");
59
+ const { gitCommands } = await import("./commands-KDgVSMM3.js");
60
60
  _gitCommands = gitCommands;
61
61
  }
62
62
  return _gitCommands;
63
63
  }
64
64
  async function getGenerateCommands() {
65
65
  if (!_generateCommands) {
66
- const { generateCommands } = await import("./commands-CboMy2vr.js");
66
+ const { generateCommands } = await import("./commands-KDgVSMM3.js");
67
67
  _generateCommands = generateCommands;
68
68
  }
69
69
  return _generateCommands;
70
70
  }
71
71
  async function getInitCommands() {
72
72
  if (!_initCommands) {
73
- const { initCommands } = await import("./commands-CboMy2vr.js");
73
+ const { initCommands } = await import("./commands-KDgVSMM3.js");
74
74
  _initCommands = initCommands;
75
75
  }
76
76
  return _initCommands;
77
77
  }
78
78
  async function getUtilityCommands() {
79
79
  if (!_utilityCommands) {
80
- const { utilityCommands } = await import("./commands-CboMy2vr.js");
80
+ const { utilityCommands } = await import("./commands-KDgVSMM3.js");
81
81
  _utilityCommands = utilityCommands;
82
82
  }
83
83
  return _utilityCommands;
84
84
  }
85
85
  async function getDispatchCommands() {
86
86
  if (!_dispatchCommands) {
87
- const { dispatchCommands } = await import("./commands-CboMy2vr.js");
87
+ const { dispatchCommands } = await import("./commands-KDgVSMM3.js");
88
88
  _dispatchCommands = dispatchCommands;
89
89
  }
90
90
  return _dispatchCommands;
91
91
  }
92
92
  async function getDocsCommands() {
93
93
  if (!_docsCommands) {
94
- const { docsCommands } = await import("./commands-CboMy2vr.js");
94
+ const { docsCommands } = await import("./commands-KDgVSMM3.js");
95
95
  _docsCommands = docsCommands;
96
96
  }
97
97
  return _docsCommands;
98
98
  }
99
99
  async function getPlaygroundCommands() {
100
100
  if (!_playgroundCommands) {
101
- const { playgroundCommands } = await import("./commands-CboMy2vr.js");
101
+ const { playgroundCommands } = await import("./commands-KDgVSMM3.js");
102
102
  _playgroundCommands = playgroundCommands;
103
103
  }
104
104
  return _playgroundCommands;
105
105
  }
106
106
  async function getWorkbenchCommands() {
107
107
  if (!_workbenchCommands) {
108
- const { workbenchCommands } = await import("./commands-CboMy2vr.js");
108
+ const { workbenchCommands } = await import("./commands-KDgVSMM3.js");
109
109
  _workbenchCommands = workbenchCommands;
110
110
  }
111
111
  return _workbenchCommands;
@@ -322,7 +322,7 @@ var CLIGenerator = class {
322
322
  if (verbose) console.log("[CLI] Loading external classes...");
323
323
  await this.loadExternalClasses();
324
324
  const { getPackageConfig } = await import("@happyvertical/smrt-config");
325
- const { DEFAULT_CLI_CONFIG } = await import("./config-hqNo4lzH.js").then((n) => n.n);
325
+ const { DEFAULT_CLI_CONFIG } = await import("./config-CdJRSMRi.js").then((n) => n.n);
326
326
  const config = getPackageConfig("cli", DEFAULT_CLI_CONFIG);
327
327
  const registeredCount = ObjectRegistry.getAllClasses().size;
328
328
  if (verbose || config.verbose) console.log(`[CLI] Successfully loaded ${registeredCount} SMRT objects`);
@@ -337,7 +337,7 @@ var CLIGenerator = class {
337
337
  */
338
338
  async loadLocalClasses() {
339
339
  const { getPackageConfig } = await import("@happyvertical/smrt-config");
340
- const { DEFAULT_CLI_CONFIG } = await import("./config-hqNo4lzH.js").then((n) => n.n);
340
+ const { DEFAULT_CLI_CONFIG } = await import("./config-CdJRSMRi.js").then((n) => n.n);
341
341
  const fs = await import("node:fs");
342
342
  const path = await import("node:path");
343
343
  const config = getPackageConfig("cli", DEFAULT_CLI_CONFIG);
@@ -382,7 +382,7 @@ var CLIGenerator = class {
382
382
  */
383
383
  async loadExternalClasses() {
384
384
  const { getPackageConfig } = await import("@happyvertical/smrt-config");
385
- const { DEFAULT_CLI_CONFIG } = await import("./config-hqNo4lzH.js").then((n) => n.n);
385
+ const { DEFAULT_CLI_CONFIG } = await import("./config-CdJRSMRi.js").then((n) => n.n);
386
386
  const { loadLocalTestManifestSync } = await import("@happyvertical/smrt-core/manifest");
387
387
  const fs = await import("node:fs");
388
388
  const path = await import("node:path");
@@ -1376,7 +1376,7 @@ var CLIGenerator = class {
1376
1376
  const { getConfig, getPackageConfig, getModuleConfig } = await import("@happyvertical/smrt-config");
1377
1377
  const smrtConfig = getConfig() || {};
1378
1378
  const moduleConfig = getModuleConfig(objectName.toLowerCase(), {});
1379
- const { DEFAULT_CLI_CONFIG } = await import("./config-hqNo4lzH.js").then((n) => n.n);
1379
+ const { DEFAULT_CLI_CONFIG } = await import("./config-CdJRSMRi.js").then((n) => n.n);
1380
1380
  const cliConfig = getPackageConfig("cli", DEFAULT_CLI_CONFIG);
1381
1381
  let db = this.context.db;
1382
1382
  if (!db && cliConfig?.database?.url) {
@@ -1479,7 +1479,7 @@ var CLIGenerator = class {
1479
1479
  let db = this.context.db;
1480
1480
  if (!db) {
1481
1481
  const { getPackageConfig } = await import("@happyvertical/smrt-config");
1482
- const { DEFAULT_CLI_CONFIG } = await import("./config-hqNo4lzH.js").then((n) => n.n);
1482
+ const { DEFAULT_CLI_CONFIG } = await import("./config-CdJRSMRi.js").then((n) => n.n);
1483
1483
  const config = getPackageConfig("cli", DEFAULT_CLI_CONFIG);
1484
1484
  const { getDatabase } = await import("@happyvertical/sql");
1485
1485
  db = await getDatabase({
@@ -85,7 +85,7 @@ async function resolveDataPath(explicitPath) {
85
85
  return resolved;
86
86
  }
87
87
  try {
88
- const { DEFAULT_CLI_CONFIG: defaultConfig } = await import("./config-hqNo4lzH.js").then((n) => n.n);
88
+ const { DEFAULT_CLI_CONFIG: defaultConfig } = await import("./config-CdJRSMRi.js").then((n) => n.n);
89
89
  const config = getPackageConfig("cli", defaultConfig);
90
90
  if (config.database?.url) {
91
91
  const dbUrl = config.database.url;
@@ -0,0 +1,93 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
+ import { n as __exportAll$1 } from "./NostrIdentity-AC8fAdxe-DKxKyu_a.js";
3
+ import { t as OidcIdentity } from "./OidcIdentity-BUblgQLs-B4mzosmT.js";
4
+ import { a as ProfileCollection, f as saveOidcRaceArbiter, i as Profile } from "./ProfileCollection-C4INKh7Y-DU6dPYSG.js";
5
+ import { t as ProfileTypeCollection } from "./ProfileTypeCollection-B7kwi1mU-6KYMumQp.js";
6
+ import { smrt } from "@happyvertical/smrt-core";
7
+ //#region ../profiles/dist/chunks/oidcProvisioningPrimitives-DNP9EZlU.js
8
+ var oidcProvisioningPrimitives_DNP9EZlU_exports = /* @__PURE__ */ __exportAll({
9
+ a: () => Person,
10
+ i: () => Organization,
11
+ n: () => insertOidcProvisioningIdentity,
12
+ o: () => ProfileTypes_exports,
13
+ r: () => Bot,
14
+ t: () => createOidcProvisioningPerson
15
+ });
16
+ var ProfileTypes_exports = /* @__PURE__ */ __exportAll$1({
17
+ Bot: () => Bot,
18
+ Organization: () => Organization,
19
+ Person: () => Person
20
+ });
21
+ var __defProp = Object.defineProperty;
22
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
23
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
24
+ enumerable: true,
25
+ configurable: true,
26
+ writable: true,
27
+ value
28
+ }) : obj[key] = value;
29
+ var __decorateClass = (decorators, target, key, kind) => {
30
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
31
+ for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
32
+ if (kind && result) __defProp(target, key, result);
33
+ return result;
34
+ };
35
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
36
+ var Person = class extends Profile {
37
+ constructor(options = {}) {
38
+ super(options);
39
+ }
40
+ };
41
+ __publicField(Person, "__smrtPackage__", "@happyvertical/smrt-profiles");
42
+ Person = __decorateClass([smrt({ tableStrategy: "sti" })], Person);
43
+ var Organization = class extends Profile {
44
+ constructor(options = {}) {
45
+ super(options);
46
+ }
47
+ };
48
+ __publicField(Organization, "__smrtPackage__", "@happyvertical/smrt-profiles");
49
+ Organization = __decorateClass([smrt({ tableStrategy: "sti" })], Organization);
50
+ var Bot = class extends Profile {
51
+ constructor(options = {}) {
52
+ super(options);
53
+ }
54
+ };
55
+ __publicField(Bot, "__smrtPackage__", "@happyvertical/smrt-profiles");
56
+ Bot = __decorateClass([smrt({ tableStrategy: "sti" })], Bot);
57
+ async function createOidcProvisioningPerson(db, input) {
58
+ const typeId = requireProvisioningId((await (await ProfileTypeCollection.create({ db })).getOrCreateGlobalBySlug("person", {
59
+ name: "Person",
60
+ description: "Individual person profile"
61
+ })).id, "Person ProfileType");
62
+ let profile = new Person({
63
+ db,
64
+ slug: `oidc-${crypto.randomUUID()}`,
65
+ tenantId: null,
66
+ typeId,
67
+ email: input.email ?? "",
68
+ name: input.name || input.preferredUsername || input.subject
69
+ });
70
+ await profile.initialize();
71
+ await saveOidcRaceArbiter(() => profile.save());
72
+ if (input.email) profile = await (await ProfileCollection.create({ db })).reserveCanonicalIdentityEmail(requireProvisioningId(profile.id, "Created Profile"), input.email);
73
+ return profile;
74
+ }
75
+ async function insertOidcProvisioningIdentity(db, input) {
76
+ const identity = new OidcIdentity({
77
+ db,
78
+ email: input.email ?? "",
79
+ issuer: input.issuer,
80
+ profileId: input.profileId,
81
+ provider: input.provider,
82
+ subject: input.subject
83
+ });
84
+ await identity.initialize();
85
+ await saveOidcRaceArbiter(() => identity.save());
86
+ return identity;
87
+ }
88
+ function requireProvisioningId(value, label) {
89
+ if (typeof value !== "string" || !value) throw new Error(`${label} did not produce an id.`);
90
+ return value;
91
+ }
92
+ //#endregion
93
+ export { insertOidcProvisioningIdentity as a, createOidcProvisioningPerson as i, Organization as n, oidcProvisioningPrimitives_DNP9EZlU_exports as o, Person as r, Bot as t };
@@ -1,13 +1,13 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { l as withSystemContext } from "./dist-wrk3GKo3.js";
2
+ import { u as withSystemContext } from "./dist-DRSQUACn.js";
3
3
  import { n as __exportAll$1, t as NostrIdentity, u as verifyAuthEvent } from "./NostrIdentity-AC8fAdxe-DKxKyu_a.js";
4
4
  import { t as ApiKey } from "./ApiKey-CVmlf3V6-BAeHuH48.js";
5
- import { t as OidcIdentity } from "./OidcIdentity-BjRu3n1g-CzvSN6Wz.js";
6
- import { c as coordinateOidcProvisioning, l as isOidcProvisioningRaceConflict, u as normalizeIdentityEmail } from "./ProfileCollection-Bt6IJK49-CFyOiVFz.js";
7
- import { a as createOidcProvisioningPerson, o as insertOidcProvisioningIdentity } from "./oidcProvisioningPrimitives-CYood-2M-DKUWB1oI.js";
5
+ import { t as OidcIdentity } from "./OidcIdentity-BUblgQLs-B4mzosmT.js";
6
+ import { c as coordinateOidcProvisioning, l as isOidcProvisioningRaceConflict, u as normalizeIdentityEmail } from "./ProfileCollection-C4INKh7Y-DU6dPYSG.js";
7
+ import { a as insertOidcProvisioningIdentity, i as createOidcProvisioningPerson } from "./oidcProvisioningPrimitives-DNP9EZlU-CUDQKgU2.js";
8
8
  import { resolveDatabase } from "@happyvertical/smrt-core";
9
- //#region ../profiles/dist/chunks/resolveIdentity-CvGDegU6.js
10
- var resolveIdentity_CvGDegU6_exports = /* @__PURE__ */ __exportAll({
9
+ //#region ../profiles/dist/chunks/resolveIdentity-CkyqvctR.js
10
+ var resolveIdentity_CkyqvctR_exports = /* @__PURE__ */ __exportAll({
11
11
  i: () => resolveIdentity_exports,
12
12
  n: () => createProfileFromOidc,
13
13
  r: () => resolveIdentity,
@@ -72,13 +72,13 @@ async function resolveIdentity(context) {
72
72
  };
73
73
  }
74
74
  async function findProfileByExternalId(provider, externalId, options) {
75
- const { OidcIdentityCollection } = await import("./OidcIdentityCollection-B4jYh36_-6UWtXCwi.js").then((n) => n.r).then((n) => n.r);
75
+ const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-DqB9Ex4b.js").then((n) => n.r).then((n) => n.r);
76
76
  const identities = await (await OidcIdentityCollection.create(options)).findByProvider(provider);
77
77
  for (const identity of identities) if (identity.subject === externalId || identity.email?.includes(externalId)) {
78
78
  const profile = await identity.getProfile();
79
79
  if (profile) return profile;
80
80
  }
81
- const { ProfileCollection } = await import("./ProfileCollection-Bt6IJK49-CFyOiVFz.js").then((n) => n.o).then((n) => n.r);
81
+ const { ProfileCollection } = await import("./ProfileCollection-C4INKh7Y-DU6dPYSG.js").then((n) => n.o).then((n) => n.r);
82
82
  const profiles = await (await ProfileCollection.create(options)).list({
83
83
  where: { email: `${externalId}@users.noreply.github.com` },
84
84
  limit: 1
@@ -99,7 +99,7 @@ async function reuseExistingOidcIdentityForProfile(profileId, claims, provider,
99
99
  createConcurrencyError: (cause) => new Error("Concurrent exact OIDC identity reuse did not converge.", cause === void 0 ? void 0 : { cause }),
100
100
  rebindRootResult: rebindOidcProfileResult,
101
101
  provision: (tx) => withSystemContext(async () => {
102
- const { OidcIdentityCollection } = await import("./OidcIdentityCollection-B4jYh36_-6UWtXCwi.js").then((n) => n.r).then((n) => n.r);
102
+ const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-DqB9Ex4b.js").then((n) => n.r).then((n) => n.r);
103
103
  const identity = await (await OidcIdentityCollection.create({ db: tx })).findBySubject(normalizedClaims.iss, normalizedClaims.sub);
104
104
  if (!identity) throw new Error("OidcIdentity.findOrCreate() no longer creates authentication links; use UserCollection.getOrCreateFromOidc() or createProfileFromOidc().");
105
105
  if (identity.profileId !== profileId) throw new Error(`OIDC identity ${normalizedClaims.iss} subject ${normalizedClaims.sub} belongs to a different Profile.`);
@@ -133,7 +133,7 @@ async function coordinateProfileOidcProvisioning(claims, provider, options) {
133
133
  });
134
134
  }
135
135
  async function provisionOidcProfile(claims, provider, options) {
136
- const { OidcIdentityCollection } = await import("./OidcIdentityCollection-B4jYh36_-6UWtXCwi.js").then((n) => n.r).then((n) => n.r);
136
+ const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-DqB9Ex4b.js").then((n) => n.r).then((n) => n.r);
137
137
  const existingIdentity = await (await OidcIdentityCollection.create(options)).findBySubject(claims.iss, claims.sub);
138
138
  if (existingIdentity) {
139
139
  const profile2 = await existingIdentity.getProfile();
@@ -148,7 +148,7 @@ async function provisionOidcProfile(claims, provider, options) {
148
148
  created: false
149
149
  };
150
150
  }
151
- const { ProfileCollection } = await import("./ProfileCollection-Bt6IJK49-CFyOiVFz.js").then((n) => n.o).then((n) => n.r);
151
+ const { ProfileCollection } = await import("./ProfileCollection-C4INKh7Y-DU6dPYSG.js").then((n) => n.o).then((n) => n.r);
152
152
  const profileCollection = await ProfileCollection.create(options);
153
153
  if (claims.email) {
154
154
  if (await profileCollection.findUniqueGlobalPersonByEmail(claims.email)) {
@@ -175,8 +175,8 @@ async function provisionOidcProfile(claims, provider, options) {
175
175
  };
176
176
  }
177
177
  async function rebindOidcProfileResult(result, rootDb) {
178
- const { OidcIdentityCollection } = await import("./OidcIdentityCollection-B4jYh36_-6UWtXCwi.js").then((n) => n.r).then((n) => n.r);
179
- const { ProfileCollection } = await import("./ProfileCollection-Bt6IJK49-CFyOiVFz.js").then((n) => n.o).then((n) => n.r);
178
+ const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-DqB9Ex4b.js").then((n) => n.r).then((n) => n.r);
179
+ const { ProfileCollection } = await import("./ProfileCollection-C4INKh7Y-DU6dPYSG.js").then((n) => n.o).then((n) => n.r);
180
180
  const profileId = requireOidcProfileId(result.profile.id);
181
181
  const identityId = requireOidcProfileId(result.oidcIdentity.id);
182
182
  const [profile, oidcIdentity] = await withSystemContext(async () => {
@@ -225,11 +225,11 @@ async function createProfileFromNostr(email, nostrData, options) {
225
225
  created: false
226
226
  };
227
227
  }
228
- const { Person } = await import("./oidcProvisioningPrimitives-CYood-2M-DKUWB1oI.js").then((n) => n.s).then((n) => n.o);
229
- const { ProfileTypeCollection } = await import("./oidcProvisioningPrimitives-CYood-2M-DKUWB1oI.js").then((n) => n.s).then((n) => n.c);
228
+ const { Person } = await import("./oidcProvisioningPrimitives-DNP9EZlU-CUDQKgU2.js").then((n) => n.o).then((n) => n.o);
229
+ const { ProfileTypeCollection } = await import("./ProfileTypeCollection-B7kwi1mU-6KYMumQp.js").then((n) => n.n).then((n) => n.n);
230
230
  let personType = await (await ProfileTypeCollection.create(options)).getBySlug("person");
231
231
  if (!personType) {
232
- const { ProfileType } = await import("./ProfileCollection-Bt6IJK49-CFyOiVFz.js").then((n) => n.o).then((n) => n.h);
232
+ const { ProfileType } = await import("./ProfileCollection-C4INKh7Y-DU6dPYSG.js").then((n) => n.o).then((n) => n.h);
233
233
  personType = new ProfileType({
234
234
  ...options,
235
235
  slug: "person",
@@ -266,4 +266,4 @@ async function createProfileFromNostr(email, nostrData, options) {
266
266
  };
267
267
  }
268
268
  //#endregion
269
- export { resolveIdentity_CvGDegU6_exports as i, createProfileFromOidc as n, resolveIdentity as r, createProfileFromNostr as t };
269
+ export { resolveIdentity_CkyqvctR_exports as i, createProfileFromOidc as n, resolveIdentity as r, createProfileFromNostr as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyvertical/smrt-cli",
3
- "version": "0.55.1",
3
+ "version": "0.55.3",
4
4
  "description": "Developer CLI for SMRT framework - introspection, testing, and project management",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -29,20 +29,20 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@happyvertical/ai": "^0.102.1",
33
- "@happyvertical/files": "^0.102.1",
34
- "@happyvertical/logger": "^0.102.1",
35
- "@happyvertical/smrt-agents": "0.55.1",
36
- "@happyvertical/smrt-app-runtime": "0.55.1",
37
- "@happyvertical/smrt-config": "0.55.1",
38
- "@happyvertical/smrt-core": "0.55.1",
39
- "@happyvertical/smrt-dev-mcp": "0.55.1",
40
- "@happyvertical/smrt-ledgers": "0.55.1",
41
- "@happyvertical/smrt-playground": "0.55.1",
42
- "@happyvertical/smrt-types": "0.55.1",
43
- "@happyvertical/smrt-users": "0.55.1",
44
- "@happyvertical/sql": "^0.102.1",
45
- "@happyvertical/utils": "^0.102.1",
32
+ "@happyvertical/ai": "^0.102.2",
33
+ "@happyvertical/files": "^0.102.2",
34
+ "@happyvertical/logger": "^0.102.2",
35
+ "@happyvertical/smrt-agents": "0.55.3",
36
+ "@happyvertical/smrt-app-runtime": "0.55.3",
37
+ "@happyvertical/smrt-config": "0.55.3",
38
+ "@happyvertical/smrt-core": "0.55.3",
39
+ "@happyvertical/smrt-dev-mcp": "0.55.3",
40
+ "@happyvertical/smrt-ledgers": "0.55.3",
41
+ "@happyvertical/smrt-playground": "0.55.3",
42
+ "@happyvertical/smrt-types": "0.55.3",
43
+ "@happyvertical/smrt-users": "0.55.3",
44
+ "@happyvertical/sql": "^0.102.2",
45
+ "@happyvertical/utils": "^0.102.2",
46
46
  "acorn": "^8.18.0",
47
47
  "fast-glob": "3.3.3",
48
48
  "tar": "^7.5.22",
@@ -80,7 +80,7 @@
80
80
  "clean": "rm -rf dist",
81
81
  "dev": "npm run build:watch",
82
82
  "test": "vitest run",
83
- "test:postgres": "node ../../scripts/run-with-ci-postgres.mjs -- pnpm exec vitest run --no-file-parallelism src/commands/__tests__/db-migrate-uuid.test.ts src/commands/__tests__/db-migrate-force-postgres.test.ts src/commands/__tests__/sti-upgrade.test.ts src/commands/__tests__/db-migrate-partial-apply-postgres.test.ts",
83
+ "test:postgres": "node ../../scripts/run-with-ci-postgres.mjs -- pnpm exec vitest run --no-file-parallelism src/commands/__tests__/db-migrate-uuid.test.ts src/commands/__tests__/db-migrate-force-postgres.test.ts src/commands/__tests__/sti-upgrade.test.ts src/commands/__tests__/db-migrate-partial-apply-postgres.test.ts src/commands/__tests__/db-migrate-concurrent-postgres.test.ts",
84
84
  "test:watch": "vitest",
85
85
  "typecheck": "tsc -p tsconfig.typecheck.json && tsc -p tsconfig.test.json",
86
86
  "cli": "tsx src/index.ts"
@@ -1,20 +0,0 @@
1
- import "./NostrIdentity-AC8fAdxe-DKxKyu_a.js";
2
- import "./ApiKey-CVmlf3V6-BAeHuH48.js";
3
- import "./ApiKeyCollection-CiiDNFdD-CMGF3_ul.js";
4
- import "./AuditLogCollection-WDHL-_AF-G2UOSM3H.js";
5
- import "./NostrIdentityCollection-CctlECpX-fkAPnK02.js";
6
- import "./OidcIdentity-BjRu3n1g-CzvSN6Wz.js";
7
- import "./OidcIdentityCollection-B4jYh36_-6UWtXCwi.js";
8
- import "./ProfileAssetCollection-HeMtjBc0-Cz4MOeSB.js";
9
- import { a as ProfileCollection } from "./ProfileCollection-Bt6IJK49-CFyOiVFz.js";
10
- import "./ProfileLinkCollection-u1hhzKTm-CAfIjZ4f.js";
11
- import "./ProfileMetadataCollection-BIYKy4Y3-CqcaAHAJ.js";
12
- import "./ProfileMetafieldCollection-Buz7gzag-BNRo6e4x.js";
13
- import "./ProfileRelationshipCollection-C4g_QLI4-DeJzJ_hF.js";
14
- import "./ProfileRelationshipTermCollection-C9J7mC7P-ChIFqjCg.js";
15
- import "./ProfileRelationshipType-U7IwF6Wf-DNavf24e.js";
16
- import "./ProfileRelationshipTypeCollection-_n22WqTb-DiZUWvev.js";
17
- import "./oidcProvisioningPrimitives-CYood-2M-DKUWB1oI.js";
18
- import "./resolveIdentity-CvGDegU6-BePPF1Iv.js";
19
- import "./dist-m9bKxs6w.js";
20
- export { ProfileCollection };