@opengeni/db 4.0.0-canary.3 → 4.0.0-canary.4

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
@@ -170,7 +170,7 @@ import {
170
170
  inspectRuntimeDatabasePosture,
171
171
  provisionRoles,
172
172
  runtimeDatabaseReadyCheck
173
- } from "./chunk-FRIYCNK2.js";
173
+ } from "./chunk-SOLRMQCL.js";
174
174
  import {
175
175
  CanonicalHumanIdentityAuthorityError,
176
176
  CanonicalHumanIdentityConflictError,
@@ -32897,6 +32897,12 @@ async function listWorkspaceArtifacts(db, workspaceId, options = {}) {
32897
32897
  const cursor = options.cursor ? decodeListCursor(options.cursor) : null;
32898
32898
  const visibility = and38(
32899
32899
  eq39(workspaceArtifacts.workspaceId, workspaceId),
32900
+ ...options.sourceSessionId ? [
32901
+ sql51`exists (select 1 from ${workspaceArtifactVersions} as published_version
32902
+ where published_version.artifact_id = ${workspaceArtifacts.id}
32903
+ and published_version.workspace_id = ${workspaceArtifacts.workspaceId}
32904
+ and published_version.source_session_id = ${options.sourceSessionId}::uuid)`
32905
+ ] : [],
32900
32906
  ...options.status ? [eq39(workspaceArtifacts.status, options.status)] : [],
32901
32907
  ...cursor ? [
32902
32908
  or9(
@@ -54688,7 +54694,7 @@ async function effectiveCodexCredentialPoolCondition(scopedDb, workspaceId) {
54688
54694
  async function lockOrganizationCodexSubscriptionSources(scopedDb, accountId) {
54689
54695
  const rows = await scopedDb.execute(sql68`
54690
54696
  select workspace_id
54691
- from list_organization_workspace_ids(${accountId}::uuid)
54697
+ from list_organization_codex_workspace_ids(${accountId}::uuid)
54692
54698
  order by workspace_id
54693
54699
  `);
54694
54700
  const workspaceIds = rows.map((row) => row.workspace_id);
@@ -54723,9 +54729,6 @@ async function setWorkspaceCodexSubscriptionModeInTransaction(scopedDb, input) {
54723
54729
  if (current.accountId !== input.accountId) {
54724
54730
  throw new Error("Codex source account does not match the workspace account");
54725
54731
  }
54726
- if (current.workspaceKind === "personal" && input.mode !== "automatic") {
54727
- throw new Error("personal workspaces always use workspace Codex subscriptions");
54728
- }
54729
54732
  const effectiveSourceBeforeMutation = input.effectiveSourceBeforeMutation ?? current.effectiveSource;
54730
54733
  let next = current;
54731
54734
  if (current.mode !== input.mode) {
@@ -56370,7 +56373,7 @@ async function wakeOrganizationCodexCapacityWaitersInTransaction(tx, input) {
56370
56373
  const wakeTargets = [];
56371
56374
  await setRlsContext(tx, { accountId: input.accountId, workspaceId: null });
56372
56375
  const workspaceRows = await tx.execute(sql68`
56373
- select workspace_id from list_organization_workspace_ids(${input.accountId}::uuid)
56376
+ select workspace_id from list_organization_codex_workspace_ids(${input.accountId}::uuid)
56374
56377
  order by workspace_id
56375
56378
  `);
56376
56379
  for (const { workspace_id: workspaceId } of workspaceRows) {