@memberjunction/sqlglot-ts 6.1.0-edge.4 → 6.1.0-edge.5

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.
@@ -30,10 +30,20 @@ export interface MJPostgresTranspilerOptions {
30
30
  * registry, e.g. collected from the baselines), so seed INSERTs targeting those
31
31
  * tables get their 1/0 values coerced to TRUE/FALSE.
32
32
  */
33
- extraBitColumns?: string[];
33
+ extraBitColumns?: readonly BitColumnRef[];
34
34
  /** Per-invocation timeout in ms (default 120000 — baselines are large). */
35
35
  timeoutMs?: number;
36
36
  }
37
+ /**
38
+ * One entry in the cross-file BIT/BOOLEAN registry: a `[table, column]` pair, both LOWERCASED —
39
+ * the wire shape the dialect emits from `--collect-bitcols` and reads back from
40
+ * `MJ_EXTRA_BIT_COLS_FILE` (`[["entityfield","allowsnull"], …]`).
41
+ *
42
+ * Previously typed as `string[]`, which type-checked only because the value is passed straight
43
+ * back out as JSON and never indexed — a `"Table.Column"` string would have serialized fine and
44
+ * silently matched nothing.
45
+ */
46
+ export type BitColumnRef = readonly [table: string, column: string];
37
47
  /**
38
48
  * One-shot transpiler for MemberJunction T-SQL → PostgreSQL via the MJ sqlglot
39
49
  * dialect (`mj_postgres.py`). Unlike `SqlGlotClient` (a long-lived FastAPI
@@ -54,7 +64,7 @@ export interface MJPostgresTranspilerOptions {
54
64
  export declare class MJPostgresTranspiler {
55
65
  private readonly pythonPath;
56
66
  private readonly dialectPath;
57
- private readonly extraBitColumns;
67
+ private extraBitColumns;
58
68
  private readonly timeoutMs;
59
69
  /** Lazily-written temp file holding the bit-col registry JSON. `undefined` = not yet computed, `null` = none. */
60
70
  private bitColsFile;
@@ -69,6 +79,24 @@ export declare class MJPostgresTranspiler {
69
79
  * reused across calls; removed on process exit.
70
80
  */
71
81
  private getBitColsFile;
82
+ /**
83
+ * Extend the cross-file BIT/BOOLEAN registry after construction.
84
+ *
85
+ * The constructor registry is collected from the migration set's own baseline, which declares
86
+ * the tables that set DECLARES — never MJ core's. An Open App migration that seeds
87
+ * `__mj.EntityField` therefore had no type information for `AllowsNull` / `IsVirtual` /
88
+ * `IsPrimaryKey`, so BIT `0`/`1` passed through to a PostgreSQL BOOLEAN column and the statement
89
+ * failed with `column "X" is of type boolean but expression is of type integer` (issue #3839).
90
+ *
91
+ * Callers that hold a live PostgreSQL connection — `--bake-codegen` requires one — can supply
92
+ * the authoritative set from `information_schema`, which is both complete and correct for the
93
+ * core version actually installed, unlike a checked-in map that goes stale as columns are added.
94
+ *
95
+ * Must be called before the first `transpile()`: the registry file is materialised lazily and
96
+ * cached, so this invalidates that cache to keep late additions honest rather than silently
97
+ * ignored.
98
+ */
99
+ addExtraBitColumns(columns: readonly BitColumnRef[]): void;
72
100
  /** Transpile T-SQL to PostgreSQL. Statements the dialect can't emit land in `unhandled`. */
73
101
  transpile(tsql: string): Promise<MJPostgresTranspileResult>;
74
102
  /**
@@ -76,7 +104,7 @@ export declare class MJPostgresTranspiler {
76
104
  * given SQL — used to build the cross-file registry from baselines before
77
105
  * transpiling individual migrations.
78
106
  */
79
- collectBitColumns(sql: string): Promise<string[]>;
107
+ collectBitColumns(sql: string): Promise<BitColumnRef[]>;
80
108
  /** Verify the interpreter + sqlglot are available; throws with install guidance if not. */
81
109
  preflight(): Promise<void>;
82
110
  private runDialect;
@@ -1 +1 @@
1
- {"version":3,"file":"MJPostgresTranspiler.d.ts","sourceRoot":"","sources":["../src/MJPostgresTranspiler.ts"],"names":[],"mappings":"AAYA,gFAAgF;AAChF,MAAM,WAAW,oBAAoB;IACnC,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,mFAAmF;AACnF,MAAM,WAAW,yBAAyB;IACxC,mDAAmD;IACnD,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,uEAAuE;IACvE,SAAS,EAAE,oBAAoB,EAAE,CAAC;IAClC;;;;OAIG;IACH,OAA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AIG;IACH,OAAO,CAAC,EAAE,oBAAoB,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,2BAA2B;IAC1C;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IAC1C,2EAA2E;IAC3E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAuBpE;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,eAAe,CAAiB;IACxC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,iHAAiH;IACjH,OAAO,CAAC,WAAW,CAA4B;gBAEnC,OAAO,CAAC,EAAE,2BAA2B;IAOjD;;;;;;;;OAQG;IACH,OAAO,CAAC,cAAc;IAmBtB;;;;;;;;;;;;;;;;OAgBG;IACH,kBAAkB,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,GAAG,IAAI;IAQ1D,4FAA4F;IACtF,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC;IASjE;;;;OAIG;IACG,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAS7D,2FAA2F;IACrF,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAIhC,OAAO,CAAC,UAAU;CAuEnB"}
@@ -7,6 +7,10 @@ const __filename = fileURLToPath(import.meta.url);
7
7
  const __dirname = path.dirname(__filename);
8
8
  /** Process-unique sequence for temp bit-column registry files (no Date/random needed). */
9
9
  let bitColsFileSeq = 0;
10
+ /** Runtime narrow for a registry entry parsed from the dialect's JSON output. */
11
+ function isBitColumnRef(v) {
12
+ return Array.isArray(v) && v.length === 2 && typeof v[0] === 'string' && typeof v[1] === 'string';
13
+ }
10
14
  /**
11
15
  * Resolve the MJ dialect script path.
12
16
  * When running from dist/ the path is ../src/python/mj_postgres.py
@@ -44,7 +48,7 @@ export class MJPostgresTranspiler {
44
48
  constructor(options) {
45
49
  this.pythonPath = options?.pythonPath ?? process.env.MJ_SQLGLOT_PYTHON ?? 'python3';
46
50
  this.dialectPath = resolveDialectPath();
47
- this.extraBitColumns = options?.extraBitColumns ?? [];
51
+ this.extraBitColumns = [...(options?.extraBitColumns ?? [])];
48
52
  this.timeoutMs = options?.timeoutMs ?? 120_000;
49
53
  }
50
54
  /**
@@ -76,6 +80,32 @@ export class MJPostgresTranspiler {
76
80
  this.bitColsFile = file;
77
81
  return file;
78
82
  }
83
+ /**
84
+ * Extend the cross-file BIT/BOOLEAN registry after construction.
85
+ *
86
+ * The constructor registry is collected from the migration set's own baseline, which declares
87
+ * the tables that set DECLARES — never MJ core's. An Open App migration that seeds
88
+ * `__mj.EntityField` therefore had no type information for `AllowsNull` / `IsVirtual` /
89
+ * `IsPrimaryKey`, so BIT `0`/`1` passed through to a PostgreSQL BOOLEAN column and the statement
90
+ * failed with `column "X" is of type boolean but expression is of type integer` (issue #3839).
91
+ *
92
+ * Callers that hold a live PostgreSQL connection — `--bake-codegen` requires one — can supply
93
+ * the authoritative set from `information_schema`, which is both complete and correct for the
94
+ * core version actually installed, unlike a checked-in map that goes stale as columns are added.
95
+ *
96
+ * Must be called before the first `transpile()`: the registry file is materialised lazily and
97
+ * cached, so this invalidates that cache to keep late additions honest rather than silently
98
+ * ignored.
99
+ */
100
+ addExtraBitColumns(columns) {
101
+ if (columns.length === 0)
102
+ return;
103
+ const seen = new Map();
104
+ for (const c of [...this.extraBitColumns, ...columns])
105
+ seen.set(`${c[0]}\u0000${c[1]}`, c);
106
+ this.extraBitColumns = [...seen.values()];
107
+ this.bitColsFile = undefined;
108
+ }
79
109
  /** Transpile T-SQL to PostgreSQL. Statements the dialect can't emit land in `unhandled`. */
80
110
  async transpile(tsql) {
81
111
  const stdout = await this.runDialect([], tsql);
@@ -93,7 +123,7 @@ export class MJPostgresTranspiler {
93
123
  async collectBitColumns(sql) {
94
124
  const stdout = await this.runDialect(['--collect-bitcols'], sql);
95
125
  const parsed = JSON.parse(stdout);
96
- if (!Array.isArray(parsed)) {
126
+ if (!Array.isArray(parsed) || !parsed.every(isBitColumnRef)) {
97
127
  throw new Error(`MJPostgresTranspiler: unexpected --collect-bitcols output: ${stdout.slice(0, 200)}`);
98
128
  }
99
129
  return parsed;
@@ -1 +1 @@
1
- {"version":3,"file":"MJPostgresTranspiler.js","sourceRoot":"","sources":["../src/MJPostgresTranspiler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C,0FAA0F;AAC1F,IAAI,cAAc,GAAG,CAAC,CAAC;AAyCvB;;;;GAIG;AACH,SAAS,kBAAkB;IACzB,MAAM,UAAU,GAAG;QACjB,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,gBAAgB,CAAC,EAAE,aAAa;QAC/E,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,QAAQ,EAAE,gBAAgB,CAAC,EAAe,qBAAqB;KACxF,CAAC;IACF,KAAK,MAAM,SAA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C;gBACD,MAAM,CACJ,IAAI,KAAK,CACP,kDAAkD,IAAI,GAAG;oBACvD,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CACtD,CACF,CAAC;YACJ,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACxB,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { SqlGlotClient } from './SqlGlotClient.js';
2
2
  export { MJPostgresTranspiler } from './MJPostgresTranspiler.js';
3
- export type { MJPostgresTranspilerOptions, MJPostgresTranspileResult, MJUnhandledStatement, } from './MJPostgresTranspiler.js';
3
+ export type { MJPostgresTranspilerOptions, MJPostgresTranspileResult, MJUnhandledStatement, BitColumnRef, } from './MJPostgresTranspiler.js';
4
4
  export type { SQLDialect, ErrorLevel, TranspileOptions, TranspileResult, ParseOptions, ParseResult, SqlGlotClientOptions, HealthStatus, } from './types.js';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,YAAY,EACV,2BAA2B,EAC3B,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,YAAY,GACb,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,YAAY,EACV,2BAA2B,EAC3B,yBAAyB,EACzB,oBAAoB,EACpB,YAAY,GACb,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,YAAY,GACb,MAAM,YAAY,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/sqlglot-ts",
3
- "version": "6.1.0-edge.4",
3
+ "version": "6.1.0-edge.5",
4
4
  "description": "TypeScript wrapper for Python's sqlglot SQL transpiler. Manages a local Python FastAPI microservice to provide deterministic SQL dialect conversion.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",