bazis 0.115.0 → 0.115.1

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.
@@ -232,7 +232,7 @@ export class CodexAppServerClient implements CodexClient {
232
232
  if (method === "account/updated") this.modelCache = undefined;
233
233
  }, () => { this.clearLogin(); this.modelCache = undefined; });
234
234
  const initialized = await client.request("initialize", {
235
- clientInfo: { name: "bazis", title: "Bazis", version: "0.115.0" }, capabilities: { experimentalApi: true },
235
+ clientInfo: { name: "bazis", title: "Bazis", version: "0.115.1" }, capabilities: { experimentalApi: true },
236
236
  }, 15_000, signal);
237
237
  if (resolve(text(initialized.codexHome, 4096)) !== this.paths.home) throw new CodexError("PROTOCOL_ERROR");
238
238
  client.notify("initialized");
@@ -708,7 +708,7 @@ export class OwnedStoreCatalogReader {
708
708
  const output: OwnedCatalogColumnV1[] = [], relationKinds = new Map(relations.map(relation => [relation.oid, relation.kind]));
709
709
  for (let offset = 0; offset < relationOids.length; offset += 1024) {
710
710
  const batch = relationOids.slice(offset, offset + 1024), parameter = this.encodePgOidArrayParameter(batch), issuedLimit = budget.remaining + 1;
711
- const result = await this.source.query(`SELECT a.attrelid::pg_catalog.text AS relation_oid,a.attnum::pg_catalog.text AS attnum,a.attname AS column_name,a.attisdropped AS dropped,a.attislocal AS local,a.attinhcount::pg_catalog.text AS inheritance_count,pg_catalog.format_type(a.atttypid,a.atttypmod) AS physical_type,a.atttypid::pg_catalog.text AS type_oid,a.attnotnull AS not_null,d.oid::pg_catalog.text AS default_object_oid,pg_catalog.pg_get_expr(d.adbin,d.adrelid) AS default_expression,a.attidentity AS identity_code,a.attgenerated AS generated_code,a.attcollation::pg_catalog.text AS collation_oid,t.typcollation::pg_catalog.text AS type_default_collation_oid,a.attstorage AS storage_code,t.typstorage AS type_default_storage_code,a.attcompression AS compression_code,a.atthasdef AS has_default FROM pg_catalog.pg_attribute AS a LEFT JOIN pg_catalog.pg_type AS t ON t.oid=a.atttypid LEFT JOIN pg_catalog.pg_attrdef AS d ON d.adrelid=a.attrelid AND d.adnum=a.attnum WHERE a.attrelid=ANY($1::pg_catalog.oid[]) AND a.attnum>0 ORDER BY a.attrelid,a.attnum LIMIT ${issuedLimit}`, [parameter], operation);
711
+ const result = await this.source.query(`SELECT a.attrelid::pg_catalog.text AS relation_oid,a.attnum::pg_catalog.text AS attnum,a.attname AS column_name,a.attisdropped AS dropped,a.attislocal AS local,a.attinhcount::pg_catalog.text AS inheritance_count,pg_catalog.format_type(a.atttypid,a.atttypmod) AS physical_type,a.atttypid::pg_catalog.text AS type_oid,a.attnotnull AS not_null,d.oid::pg_catalog.text AS default_object_oid,pg_catalog.pg_get_expr(d.adbin,d.adrelid) AS default_expression,a.attidentity AS identity_code,a.attgenerated AS generated_code,a.attcollation::pg_catalog.text AS collation_oid,t.typcollation::pg_catalog.text AS type_default_collation_oid,a.attstorage AS storage_code,t.typstorage AS type_default_storage_code,a.attcompression AS compression_code,a.atthasdef AS has_default FROM pg_catalog.pg_attribute AS a LEFT JOIN pg_catalog.pg_type AS t ON t.oid=a.atttypid LEFT JOIN pg_catalog.pg_attrdef AS d ON d.adrelid=a.attrelid AND d.adnum=a.attnum WHERE a.attrelid=ANY($1::pg_catalog.oid[]) AND a.attnum>0 AND NOT a.attisdropped ORDER BY a.attrelid,a.attnum LIMIT ${issuedLimit}`, [parameter], operation);
712
712
  const rows = selectOwnedStoreRows(result, [
713
713
  "relation_oid", "attnum", "column_name", "dropped", "local", "inheritance_count", "physical_type", "type_oid", "not_null", "default_object_oid", "default_expression", "identity_code", "generated_code", "collation_oid", "type_default_collation_oid", "storage_code", "type_default_storage_code", "compression_code", "has_default"
714
714
  ], issuedLimit);
@@ -1128,13 +1128,17 @@ function verifyOwnedStoreCatalogModelsV1(snapshot: OwnedStoreCatalogSnapshotV1,
1128
1128
  readonly default: CanonicalDefault;
1129
1129
  readonly generation: "none" | "identityByDefault" | "uuidDefault";
1130
1130
  }>();
1131
+ // A column added and dropped outside bazis stays in pg_attribute as a
1132
+ // dropped attribute: it holds no reachable data and cannot be removed
1133
+ // without rewriting the table. The reader skips such attributes, so live
1134
+ // columns may have gaps in attnum; their order is what counts.
1131
1135
  const tableColumns = columns.get(relation.oid) ?? [];
1132
1136
  if (snapshot.columns.some((column) => !owned.has(column.relationOid) && !declaredToastRelationOids.has(column.relationOid)) || tableColumns.length !== expectedTable.columns.length)
1133
1137
  bad();
1134
1138
  const orderedColumns = [...tableColumns].sort((a, b) => Number(a.attnum) - Number(b.attnum));
1135
1139
  for (let index = 0; index < orderedColumns.length; index++) {
1136
1140
  const column = orderedColumns[index]!, modelColumn = expectedTable.columns[index]!;
1137
- if (column.name !== modelColumn.column || column.attnum !== String(index + 1) || column.dropped || !column.local || column.inheritanceCount !== "0" || column.typeOid === "0" || BigInt(column.typeOid) >= 12000n || !["integer", "real", "text", "boolean", "datetime", "json", "uuid"].includes(column.physicalType) || column.collationOid !== column.typeDefaultCollationOid || column.storageCode !== column.typeDefaultStorageCode || column.compressionCode !== "" || column.generation === "other")
1141
+ if (column.name !== modelColumn.column || column.dropped || !column.local || column.inheritanceCount !== "0" || column.typeOid === "0" || BigInt(column.typeOid) >= 12000n || !["integer", "real", "text", "boolean", "datetime", "json", "uuid"].includes(column.physicalType) || column.collationOid !== column.typeDefaultCollationOid || column.storageCode !== column.typeDefaultStorageCode || column.compressionCode !== "" || column.generation === "other")
1138
1142
  bad();
1139
1143
  const expectedGeneration = modelColumn.generation;
1140
1144
  if (column.generation !== expectedGeneration || (column.generation === "none" && (column.identityCode !== "" || column.generatedCode !== "")) || (column.generation === "identityByDefault" && (column.identityCode !== "d" || column.generatedCode !== "")) || (column.generation === "uuidDefault" && (column.identityCode !== "" || column.generatedCode !== "")))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bazis",
3
- "version": "0.115.0",
3
+ "version": "0.115.1",
4
4
  "description": "Modular backend framework for Bun in TypeScript: DI wired by codegen, HTTP, a PostgreSQL ORM, JWT, WebSocket, agents and a CLI.",
5
5
  "license": "MIT",
6
6
  "author": "Alexander Alenin",