@opengeni/db 0.26.0 → 0.27.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.
@@ -135,6 +135,7 @@ __export(schema_exports, {
135
135
  workspaceInferenceControls: () => workspaceInferenceControls,
136
136
  workspaceInstructionPolicyActivationEvents: () => workspaceInstructionPolicyActivationEvents,
137
137
  workspaceInstructionPolicyHeads: () => workspaceInstructionPolicyHeads,
138
+ workspaceInstructionPolicyOnboardingProposals: () => workspaceInstructionPolicyOnboardingProposals,
138
139
  workspaceInstructionPolicyRevisions: () => workspaceInstructionPolicyRevisions,
139
140
  workspaceInstructionPolicySnapshots: () => workspaceInstructionPolicySnapshots,
140
141
  workspaceMemberships: () => workspaceMemberships,
@@ -317,6 +318,91 @@ var workspaceInstructionPolicyActivationEvents = pgTable(
317
318
  )
318
319
  })
319
320
  );
321
+ var workspaceInstructionPolicyOnboardingProposals = pgTable(
322
+ "workspace_instruction_policy_onboarding_proposals",
323
+ {
324
+ id: uuid("id").primaryKey().defaultRandom(),
325
+ operationId: uuid("operation_id").notNull(),
326
+ requestFingerprint: text("request_fingerprint").notNull(),
327
+ accountId: uuid("account_id").notNull(),
328
+ workspaceId: uuid("workspace_id").notNull(),
329
+ kind: text("kind").notNull(),
330
+ scope: text("scope").notNull(),
331
+ roleKey: text("role_key"),
332
+ sourceId: text("source_id").notNull(),
333
+ sourceVersion: text("source_version").notNull(),
334
+ confidenceBps: integer("confidence_bps").notNull(),
335
+ baselineRevisionId: uuid("baseline_revision_id"),
336
+ baselineRevision: bigint("baseline_revision", { mode: "number" }),
337
+ baselineContentHash: text("baseline_content_hash"),
338
+ baselineActivationVersion: bigint("baseline_activation_version", { mode: "number" }).notNull(),
339
+ baselineActivatedAt: timestamp("baseline_activated_at", { withTimezone: true }),
340
+ draftRevisionId: uuid("draft_revision_id").notNull(),
341
+ draftRevision: bigint("draft_revision", { mode: "number" }).notNull(),
342
+ draftContentHash: text("draft_content_hash").notNull(),
343
+ status: text("status").notNull().default("proposed"),
344
+ createdBySubjectId: text("created_by_subject_id").notNull(),
345
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
346
+ },
347
+ (table) => ({
348
+ workspaceOperation: uniqueIndex(
349
+ "workspace_instruction_policy_onboarding_proposals_workspace_operation_uq"
350
+ ).on(table.workspaceId, table.operationId),
351
+ sourceVersionTarget: uniqueIndex(
352
+ "workspace_instruction_policy_onboarding_proposals_source_version_target_uq"
353
+ ).on(
354
+ table.workspaceId,
355
+ table.kind,
356
+ table.scope,
357
+ sql`coalesce(${table.roleKey}, '')`,
358
+ table.sourceId,
359
+ table.sourceVersion
360
+ ),
361
+ workspaceTimeline: index(
362
+ "workspace_instruction_policy_onboarding_proposals_workspace_time_idx"
363
+ ).on(table.workspaceId, table.createdAt, table.id),
364
+ operationReceipt: check(
365
+ "workspace_instruction_policy_onboarding_proposals_operation_receipt_chk",
366
+ sql`${table.requestFingerprint} ~ '^[0-9a-f]{64}$'`
367
+ ),
368
+ target: check(
369
+ "workspace_instruction_policy_onboarding_proposals_target_chk",
370
+ sql`(
371
+ (${table.kind} = 'charter' and ${table.scope} = 'global' and ${table.roleKey} is null)
372
+ or (${table.kind} = 'policy' and ${table.scope} = 'global' and ${table.roleKey} is null)
373
+ or (${table.kind} = 'policy' and ${table.scope} = 'role' and ${table.roleKey} is not null)
374
+ )`
375
+ ),
376
+ source: check(
377
+ "workspace_instruction_policy_onboarding_proposals_source_chk",
378
+ sql`length(btrim(${table.sourceId})) between 1 and 512
379
+ and length(btrim(${table.sourceVersion})) between 1 and 256
380
+ and ${table.confidenceBps} between 0 and 10000`
381
+ ),
382
+ baseline: check(
383
+ "workspace_instruction_policy_onboarding_proposals_baseline_chk",
384
+ sql`(
385
+ ${table.baselineRevisionId} is null
386
+ and ${table.baselineRevision} is null
387
+ and ${table.baselineContentHash} is null
388
+ and ${table.baselineActivationVersion} = 0
389
+ and ${table.baselineActivatedAt} is null
390
+ ) or (
391
+ ${table.baselineRevisionId} is not null
392
+ and ${table.baselineRevision} > 0
393
+ and ${table.baselineContentHash} ~ '^[0-9a-f]{64}$'
394
+ and ${table.baselineActivationVersion} > 0
395
+ and ${table.baselineActivatedAt} is not null
396
+ )`
397
+ ),
398
+ draft: check(
399
+ "workspace_instruction_policy_onboarding_proposals_draft_chk",
400
+ sql`${table.draftRevision} > 0
401
+ and ${table.draftContentHash} ~ '^[0-9a-f]{64}$'
402
+ and ${table.status} = 'proposed'`
403
+ )
404
+ })
405
+ );
320
406
  var workspaceInstructionPolicySnapshots = pgTable(
321
407
  "workspace_instruction_policy_snapshots",
322
408
  {
@@ -6311,6 +6397,7 @@ export {
6311
6397
  workspaceInstructionPolicyRevisions,
6312
6398
  workspaceInstructionPolicyHeads,
6313
6399
  workspaceInstructionPolicyActivationEvents,
6400
+ workspaceInstructionPolicyOnboardingProposals,
6314
6401
  workspaceInstructionPolicySnapshots,
6315
6402
  preferenceRegistryPreferences,
6316
6403
  preferenceRegistryRevisions,
@@ -6449,4 +6536,4 @@ export {
6449
6536
  rigChanges,
6450
6537
  schema_exports
6451
6538
  };
6452
- //# sourceMappingURL=chunk-7WTDI7Y3.js.map
6539
+ //# sourceMappingURL=chunk-EX7CDSGH.js.map