firebird-wasm 0.2.0 → 0.3.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.
Files changed (64) hide show
  1. package/CHANGELOG.md +168 -0
  2. package/README.md +4 -1
  3. package/dist/.tsbuildinfo.build +1 -1
  4. package/dist/browser/engine-transport.d.ts +56 -5
  5. package/dist/browser/engine-transport.d.ts.map +1 -1
  6. package/dist/browser/engine-transport.js +271 -8
  7. package/dist/browser/engine-transport.js.map +1 -1
  8. package/dist/browser/firebird-browser.d.ts +228 -7
  9. package/dist/browser/firebird-browser.d.ts.map +1 -1
  10. package/dist/browser/firebird-browser.js +334 -26
  11. package/dist/browser/firebird-browser.js.map +1 -1
  12. package/dist/browser/index.d.ts +8 -2
  13. package/dist/browser/index.d.ts.map +1 -1
  14. package/dist/browser/index.js +19 -3
  15. package/dist/browser/index.js.map +1 -1
  16. package/dist/browser/opfs-fs.d.ts +72 -0
  17. package/dist/browser/opfs-fs.d.ts.map +1 -0
  18. package/dist/browser/opfs-fs.js +249 -0
  19. package/dist/browser/opfs-fs.js.map +1 -0
  20. package/dist/browser/shared-transport.d.ts +8 -2
  21. package/dist/browser/shared-transport.d.ts.map +1 -1
  22. package/dist/browser/shared-transport.js +29 -2
  23. package/dist/browser/shared-transport.js.map +1 -1
  24. package/dist/browser/statement-types.d.ts +18 -0
  25. package/dist/browser/statement-types.d.ts.map +1 -0
  26. package/dist/browser/statement-types.js +39 -0
  27. package/dist/browser/statement-types.js.map +1 -0
  28. package/dist/browser/value-types.d.ts +173 -0
  29. package/dist/browser/value-types.d.ts.map +1 -0
  30. package/dist/browser/value-types.js +222 -0
  31. package/dist/browser/value-types.js.map +1 -0
  32. package/dist/browser/worker-entry.d.ts.map +1 -1
  33. package/dist/browser/worker-entry.js +38 -1
  34. package/dist/browser/worker-entry.js.map +1 -1
  35. package/dist/browser/worker-protocol.d.ts +1 -1
  36. package/dist/browser/worker-protocol.d.ts.map +1 -1
  37. package/dist/browser/worker-transport.d.ts +8 -2
  38. package/dist/browser/worker-transport.d.ts.map +1 -1
  39. package/dist/browser/worker-transport.js +26 -2
  40. package/dist/browser/worker-transport.js.map +1 -1
  41. package/dist/firebird.d.ts +58 -5
  42. package/dist/firebird.d.ts.map +1 -1
  43. package/dist/firebird.js +161 -52
  44. package/dist/firebird.js.map +1 -1
  45. package/dist/index.d.ts +4 -1
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js +9 -1
  48. package/dist/index.js.map +1 -1
  49. package/dist/sql-tag.d.ts +184 -0
  50. package/dist/sql-tag.d.ts.map +1 -0
  51. package/dist/sql-tag.js +287 -0
  52. package/dist/sql-tag.js.map +1 -0
  53. package/dist/statement-types.d.ts +23 -0
  54. package/dist/statement-types.d.ts.map +1 -0
  55. package/dist/statement-types.js +44 -0
  56. package/dist/statement-types.js.map +1 -0
  57. package/dist/types.d.ts +62 -0
  58. package/dist/types.d.ts.map +1 -1
  59. package/dist/wasm/firebird-embedded.js +1 -1
  60. package/dist/wasm/firebird-embedded.wasm +0 -0
  61. package/dist/wasm-loader.d.ts +38 -2
  62. package/dist/wasm-loader.d.ts.map +1 -1
  63. package/dist/wasm-loader.js.map +1 -1
  64. package/package.json +3 -2
@@ -0,0 +1,184 @@
1
+ /**
2
+ * sql-tag.ts – the `` sql`…` `` template tag.
3
+ *
4
+ * Interpolation in a SQL string is the classic injection bug, and the usual
5
+ * advice — "use parameters" — is awkward enough that people don't:
6
+ *
7
+ * ```ts
8
+ * await db.query('SELECT * FROM items WHERE id = ? AND name = ?', [id, name]);
9
+ * ```
10
+ *
11
+ * The values sit far from the holes they fill, and adding a condition means
12
+ * editing two places and keeping them in the same order. The tag closes that
13
+ * distance without giving up parameter binding:
14
+ *
15
+ * ```ts
16
+ * await db.query(sql`SELECT * FROM items WHERE id = ${id} AND name = ${name}`);
17
+ * ```
18
+ *
19
+ * Every `${…}` becomes a `?` and its value is bound, so a value can never be
20
+ * read as SQL. That is the whole safety property, and it holds no matter what
21
+ * the value contains — `"'; DROP TABLE items --"` is a five-word string, not a
22
+ * statement.
23
+ *
24
+ * What a tagged template cannot do is parameterise the parts of a statement
25
+ * that are not values: table and column names, `ORDER BY` direction, whole
26
+ * conditions. Those need text, and text is where injection lives again, so the
27
+ * three ways to produce it are named and separate — {@link SqlTag.identifier},
28
+ * {@link SqlTag.join}, and {@link SqlTag.unsafe}. Only the last is a loaded
29
+ * gun, and it says so at the call site.
30
+ *
31
+ * Fragments nest, which is what makes conditional SQL bearable:
32
+ *
33
+ * ```ts
34
+ * const active = onlyActive ? sql`AND active = ${true}` : sql``;
35
+ * await db.query(sql`SELECT * FROM items WHERE owner = ${user} ${active}`);
36
+ * ```
37
+ *
38
+ * Placeholders renumber themselves because Firebird's are positional `?`
39
+ * rather than `$1` — splicing a fragment is concatenation on both the text and
40
+ * the parameter list, with no renumbering to get wrong.
41
+ */
42
+ import type { QueryParams, TransactionOptions } from './types';
43
+ /**
44
+ * A piece of SQL and the values bound to its placeholders.
45
+ *
46
+ * Produced by {@link sql}, accepted anywhere `(sql, params)` is. Both fields
47
+ * are readable, which is what makes a query loggable before it runs.
48
+ */
49
+ export declare class SqlFragment {
50
+ /** Statement text, with a `?` for every bound value. */
51
+ readonly sql: string;
52
+ /** Values for the placeholders, in order. */
53
+ readonly params: QueryParams;
54
+ constructor(
55
+ /** Statement text, with a `?` for every bound value. */
56
+ sql: string,
57
+ /** Values for the placeholders, in order. */
58
+ params: QueryParams);
59
+ }
60
+ /**
61
+ * SQL text that is spliced in literally, with nothing bound.
62
+ *
63
+ * There is no way to make this safe in general — that is the point of keeping
64
+ * it a distinct type rather than letting any string through. It exists because
65
+ * identifiers and syntax cannot be parameters.
66
+ */
67
+ export declare class RawSql {
68
+ readonly sql: string;
69
+ constructor(sql: string);
70
+ }
71
+ /** True if `value` came from {@link sql}. */
72
+ export declare function isSqlFragment(value: unknown): value is SqlFragment;
73
+ /** The shape of {@link sql}: callable as a tag, with helpers hanging off it. */
74
+ export interface SqlTag {
75
+ (strings: TemplateStringsArray, ...values: unknown[]): SqlFragment;
76
+ /**
77
+ * Quote a table or column name so it can be interpolated as text.
78
+ *
79
+ * ```ts
80
+ * await db.query(sql`SELECT * FROM ${sql.identifier(table)} WHERE id = ${id}`);
81
+ * ```
82
+ *
83
+ * The name is quoted verbatim, with any `"` doubled, so it cannot end the
84
+ * quoting and start a statement.
85
+ *
86
+ * **Firebird folds unquoted names to upper case, and quoting turns that
87
+ * off.** A table created as `CREATE TABLE items` is stored as `ITEMS`, and
88
+ * `sql.identifier('items')` produces `"items"`, which will not find it. Pass
89
+ * the name in its stored case — usually upper. This helper deliberately does
90
+ * not upper-case for you: names created *with* quotes keep whatever case
91
+ * they were given, and mangling those would be the worse failure of the two,
92
+ * because it would corrupt a name that was previously correct.
93
+ */
94
+ identifier(name: string): RawSql;
95
+ /**
96
+ * Join values or fragments with a separator, as one fragment.
97
+ *
98
+ * The `IN` list problem: `WHERE id IN ${ids}` cannot work, because one
99
+ * placeholder binds one value.
100
+ *
101
+ * ```ts
102
+ * await db.query(sql`SELECT * FROM items WHERE id IN (${sql.join(ids)})`);
103
+ * // SELECT * FROM items WHERE id IN (?, ?, ?)
104
+ * ```
105
+ *
106
+ * Elements may be fragments, which is how a list of conditions is built:
107
+ *
108
+ * ```ts
109
+ * sql`WHERE ${sql.join(conditions, ' AND ')}`
110
+ * ```
111
+ *
112
+ * Note the parentheses above are written by the caller, not added here —
113
+ * `join` has no way to know whether it is filling an `IN` list or an
114
+ * `AND` chain.
115
+ *
116
+ * @throws if `values` is empty. `IN ()` is a syntax error in Firebird and an
117
+ * empty `AND` chain is an empty `WHERE`, so there is no text this could
118
+ * return that is not a bug somewhere later. An empty list usually means
119
+ * the caller wants "match nothing" (`1 = 0`) or "no filter" (`1 = 1`), and
120
+ * only the caller knows which.
121
+ */
122
+ join(values: readonly unknown[], separator?: string): SqlFragment;
123
+ /**
124
+ * Splice text in literally, escaping nothing.
125
+ *
126
+ * For syntax that cannot be a parameter and is not an identifier — a sort
127
+ * direction, a `FIRST`/`SKIP` clause built by hand.
128
+ *
129
+ * ```ts
130
+ * const dir = ascending ? sql.unsafe('ASC') : sql.unsafe('DESC');
131
+ * await db.query(sql`SELECT * FROM items ORDER BY name ${dir}`);
132
+ * ```
133
+ *
134
+ * Named `unsafe` because it is: anything reaching it from outside the
135
+ * program is an injection. The name is the warning, and it shows up at the
136
+ * call site during review rather than in this file.
137
+ */
138
+ unsafe(text: string): RawSql;
139
+ }
140
+ /**
141
+ * Build a {@link SqlFragment} from a template literal.
142
+ *
143
+ * See the module comment for what this is for and what it cannot do.
144
+ */
145
+ export declare const sql: SqlTag;
146
+ /** A statement in the form the backends bind: text plus positional values. */
147
+ export interface Statement {
148
+ sql: string;
149
+ params: QueryParams;
150
+ }
151
+ /**
152
+ * Normalise the two calling conventions into one.
153
+ *
154
+ * `query()` and `exec()` take either a string with its parameters or a
155
+ * fragment carrying its own, and every backend needs the same reduction.
156
+ *
157
+ * @throws if a fragment is given alongside parameters. It reads as though the
158
+ * two combine, and they cannot: the fragment's placeholders are already
159
+ * filled, so the extra values would bind to nothing. Silently ignoring them
160
+ * would run a query the caller did not write.
161
+ */
162
+ export declare function toStatement(sql: string | SqlFragment, params?: QueryParams): Statement;
163
+ /**
164
+ * Resolve `query()`'s two shapes: `(sql, params, options)` and
165
+ * `(fragment, options)`.
166
+ *
167
+ * A fragment carries its own parameters, so the slot that would have held them
168
+ * is free — and making the caller write `query(fragment, undefined, options)`
169
+ * to reach the third argument would be a poor trade for the tag's ergonomics.
170
+ * The two are told apart by whether the argument is an array, which is
171
+ * unambiguous: parameters are always one, options never are.
172
+ *
173
+ * @throws if a string statement is given a second argument that is not an
174
+ * array. `query('… WHERE id = ?', 5)` reads as though it binds 5, and taking
175
+ * it for transaction options instead would run the statement with no
176
+ * parameters at all — the engine then complains about a placeholder count,
177
+ * naming nothing the caller wrote. TypeScript rules this out; untyped
178
+ * JavaScript, which the browser build is used from, does not.
179
+ */
180
+ export declare function resolveQueryCall(sql: string | SqlFragment, paramsOrOptions?: QueryParams | TransactionOptions, maybeOptions?: TransactionOptions): {
181
+ statement: Statement;
182
+ options: TransactionOptions;
183
+ };
184
+ //# sourceMappingURL=sql-tag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sql-tag.d.ts","sourceRoot":"","sources":["../src/sql-tag.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAkB/D;;;;;GAKG;AACH,qBAAa,WAAW;IAEpB,wDAAwD;IACxD,QAAQ,CAAC,GAAG,EAAE,MAAM;IACpB,6CAA6C;IAC7C,QAAQ,CAAC,MAAM,EAAE,WAAW;;IAH5B,wDAAwD;IAC/C,GAAG,EAAE,MAAM;IACpB,6CAA6C;IACpC,MAAM,EAAE,WAAW;CAM/B;AAED;;;;;;GAMG;AACH,qBAAa,MAAM;IACL,QAAQ,CAAC,GAAG,EAAE,MAAM;gBAAX,GAAG,EAAE,MAAM;CAGjC;AAED,6CAA6C;AAC7C,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAMlE;AAcD,gFAAgF;AAChF,MAAM,WAAW,MAAM;IACrB,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,WAAW,CAAC;IAEnE;;;;;;;;;;;;;;;;;OAiBG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,IAAI,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IAElE;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B;AAkHD;;;;GAIG;AACH,eAAO,MAAM,GAAG,EAAE,MAAyD,CAAC;AAM5E,8EAA8E;AAC9E,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,WAAW,CAAC;CACrB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,GAAG,WAAW,EACzB,MAAM,GAAE,WAAgB,GACvB,SAAS,CAgCX;AAgBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,GAAG,WAAW,EACzB,eAAe,GAAE,WAAW,GAAG,kBAAuB,EACtD,YAAY,GAAE,kBAAuB,GACpC;IAAE,SAAS,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,kBAAkB,CAAA;CAAE,CAoBvD"}
@@ -0,0 +1,287 @@
1
+ "use strict";
2
+ /**
3
+ * sql-tag.ts – the `` sql`…` `` template tag.
4
+ *
5
+ * Interpolation in a SQL string is the classic injection bug, and the usual
6
+ * advice — "use parameters" — is awkward enough that people don't:
7
+ *
8
+ * ```ts
9
+ * await db.query('SELECT * FROM items WHERE id = ? AND name = ?', [id, name]);
10
+ * ```
11
+ *
12
+ * The values sit far from the holes they fill, and adding a condition means
13
+ * editing two places and keeping them in the same order. The tag closes that
14
+ * distance without giving up parameter binding:
15
+ *
16
+ * ```ts
17
+ * await db.query(sql`SELECT * FROM items WHERE id = ${id} AND name = ${name}`);
18
+ * ```
19
+ *
20
+ * Every `${…}` becomes a `?` and its value is bound, so a value can never be
21
+ * read as SQL. That is the whole safety property, and it holds no matter what
22
+ * the value contains — `"'; DROP TABLE items --"` is a five-word string, not a
23
+ * statement.
24
+ *
25
+ * What a tagged template cannot do is parameterise the parts of a statement
26
+ * that are not values: table and column names, `ORDER BY` direction, whole
27
+ * conditions. Those need text, and text is where injection lives again, so the
28
+ * three ways to produce it are named and separate — {@link SqlTag.identifier},
29
+ * {@link SqlTag.join}, and {@link SqlTag.unsafe}. Only the last is a loaded
30
+ * gun, and it says so at the call site.
31
+ *
32
+ * Fragments nest, which is what makes conditional SQL bearable:
33
+ *
34
+ * ```ts
35
+ * const active = onlyActive ? sql`AND active = ${true}` : sql``;
36
+ * await db.query(sql`SELECT * FROM items WHERE owner = ${user} ${active}`);
37
+ * ```
38
+ *
39
+ * Placeholders renumber themselves because Firebird's are positional `?`
40
+ * rather than `$1` — splicing a fragment is concatenation on both the text and
41
+ * the parameter list, with no renumbering to get wrong.
42
+ */
43
+ Object.defineProperty(exports, "__esModule", { value: true });
44
+ exports.sql = exports.RawSql = exports.SqlFragment = void 0;
45
+ exports.isSqlFragment = isSqlFragment;
46
+ exports.toStatement = toStatement;
47
+ exports.resolveQueryCall = resolveQueryCall;
48
+ // ---------------------------------------------------------------------------
49
+ // Fragments
50
+ // ---------------------------------------------------------------------------
51
+ /**
52
+ * Brands, registered globally rather than per module instance.
53
+ *
54
+ * `instanceof` would be the obvious check and is wrong here: this package has
55
+ * two entry points, and an application that reaches both — or that ends up
56
+ * with two installed copies — gets two `SqlFragment` classes whose instances
57
+ * fail each other's `instanceof`. A `Symbol.for` key is the same symbol in
58
+ * every copy, so the check survives that.
59
+ */
60
+ const FRAGMENT = Symbol.for('firebird-wasm.SqlFragment');
61
+ const RAW = Symbol.for('firebird-wasm.RawSql');
62
+ /**
63
+ * A piece of SQL and the values bound to its placeholders.
64
+ *
65
+ * Produced by {@link sql}, accepted anywhere `(sql, params)` is. Both fields
66
+ * are readable, which is what makes a query loggable before it runs.
67
+ */
68
+ class SqlFragment {
69
+ constructor(
70
+ /** Statement text, with a `?` for every bound value. */
71
+ sql,
72
+ /** Values for the placeholders, in order. */
73
+ params) {
74
+ this.sql = sql;
75
+ this.params = params;
76
+ // Non-enumerable so the brand stays out of spreads, `JSON.stringify` and
77
+ // anything else that walks own keys.
78
+ Object.defineProperty(this, FRAGMENT, { value: true });
79
+ }
80
+ }
81
+ exports.SqlFragment = SqlFragment;
82
+ /**
83
+ * SQL text that is spliced in literally, with nothing bound.
84
+ *
85
+ * There is no way to make this safe in general — that is the point of keeping
86
+ * it a distinct type rather than letting any string through. It exists because
87
+ * identifiers and syntax cannot be parameters.
88
+ */
89
+ class RawSql {
90
+ constructor(sql) {
91
+ this.sql = sql;
92
+ Object.defineProperty(this, RAW, { value: true });
93
+ }
94
+ }
95
+ exports.RawSql = RawSql;
96
+ /** True if `value` came from {@link sql}. */
97
+ function isSqlFragment(value) {
98
+ return (typeof value === 'object' &&
99
+ value !== null &&
100
+ value[FRAGMENT] === true);
101
+ }
102
+ function isRawSql(value) {
103
+ return (typeof value === 'object' &&
104
+ value !== null &&
105
+ value[RAW] === true);
106
+ }
107
+ function tag(strings, ...values) {
108
+ let text = '';
109
+ const params = [];
110
+ for (let i = 0; i < strings.length; i++) {
111
+ const chunk = strings[i];
112
+ // Cooked strings are `undefined` for an invalid escape sequence — legal in
113
+ // a tagged template since ES2018, where it hands the tag a hole rather
114
+ // than a syntax error. Concatenating it would put the text "undefined"
115
+ // into the statement, which fails later and somewhere else.
116
+ if (chunk === undefined) {
117
+ throw new SyntaxError(`sql\`…\` contains an invalid escape sequence in segment ${i}; ` +
118
+ 'use sql.unsafe() if the text is meant to be literal');
119
+ }
120
+ text += chunk;
121
+ if (i < values.length) {
122
+ text += interpolate(values[i], params, i, 'template');
123
+ }
124
+ }
125
+ return new SqlFragment(text, params);
126
+ }
127
+ /**
128
+ * Render one `${…}`, appending to `params` when it binds.
129
+ *
130
+ * `where` names the caller, because the two callers fail differently and a
131
+ * message that describes the wrong one sends the reader to the wrong line —
132
+ * see {@link join}.
133
+ *
134
+ * @returns the text this value contributes.
135
+ */
136
+ function interpolate(value, params, index, where) {
137
+ if (isSqlFragment(value)) {
138
+ // A loop rather than push(...spread): every parameter would otherwise
139
+ // become a separate argument, and a large enough list overflows the call
140
+ // stack with a RangeError that names neither the list nor the limit.
141
+ for (const param of value.params)
142
+ params.push(param);
143
+ return value.sql;
144
+ }
145
+ if (isRawSql(value)) {
146
+ return value.sql;
147
+ }
148
+ if (Array.isArray(value)) {
149
+ // One placeholder binds one value, so an array here is always a mistake —
150
+ // and always the same mistake, which is worth naming precisely. Left to
151
+ // the parameter encoder it surfaces as "unsupported type object" at bind
152
+ // time, which does not suggest the fix.
153
+ throw new TypeError(where === 'join'
154
+ ? `Element ${index} passed to sql.join() is an array. sql.join() does ` +
155
+ 'not flatten, because a nested list has no unambiguous SQL form — ' +
156
+ 'flatten it first, or join the inner lists yourself'
157
+ : `Value ${index} in sql\`…\` is an array, which cannot bind to a ` +
158
+ 'single placeholder; use sql.join(values) to expand it into a list');
159
+ }
160
+ params.push(value);
161
+ return '?';
162
+ }
163
+ function identifier(name) {
164
+ if (typeof name !== 'string' || name.length === 0) {
165
+ throw new TypeError('sql.identifier() needs a non-empty name');
166
+ }
167
+ if (name.includes('\0')) {
168
+ // Firebird would reject it, but not before the NUL had truncated the
169
+ // statement in whatever handled it first.
170
+ throw new TypeError('sql.identifier() cannot contain a NUL character');
171
+ }
172
+ return new RawSql(`"${name.replace(/"/g, '""')}"`);
173
+ }
174
+ function join(values, separator = ', ') {
175
+ if (values.length === 0) {
176
+ throw new RangeError('sql.join() needs at least one value: an empty list has no valid SQL ' +
177
+ 'form (IN () is a syntax error). Guard the empty case with the ' +
178
+ 'condition you actually mean — 1 = 0 to match nothing, 1 = 1 to ' +
179
+ 'match everything');
180
+ }
181
+ let text = '';
182
+ const params = [];
183
+ values.forEach((value, index) => {
184
+ if (index > 0)
185
+ text += separator;
186
+ text += interpolate(value, params, index, 'join');
187
+ });
188
+ return new SqlFragment(text, params);
189
+ }
190
+ function unsafe(text) {
191
+ if (typeof text !== 'string') {
192
+ throw new TypeError('sql.unsafe() needs a string');
193
+ }
194
+ return new RawSql(text);
195
+ }
196
+ /**
197
+ * Build a {@link SqlFragment} from a template literal.
198
+ *
199
+ * See the module comment for what this is for and what it cannot do.
200
+ */
201
+ exports.sql = Object.assign(tag, { identifier, join, unsafe });
202
+ /**
203
+ * Normalise the two calling conventions into one.
204
+ *
205
+ * `query()` and `exec()` take either a string with its parameters or a
206
+ * fragment carrying its own, and every backend needs the same reduction.
207
+ *
208
+ * @throws if a fragment is given alongside parameters. It reads as though the
209
+ * two combine, and they cannot: the fragment's placeholders are already
210
+ * filled, so the extra values would bind to nothing. Silently ignoring them
211
+ * would run a query the caller did not write.
212
+ */
213
+ function toStatement(sql, params = []) {
214
+ if (typeof sql === 'string') {
215
+ return { sql, params };
216
+ }
217
+ if (isSqlFragment(sql)) {
218
+ if (params.length > 0) {
219
+ throw new TypeError('A sql`…` fragment already carries its parameters; passing more would ' +
220
+ 'bind them to nothing. Interpolate the values into the template ' +
221
+ 'instead');
222
+ }
223
+ return { sql: sql.sql, params: sql.params };
224
+ }
225
+ // Anything else would have been passed through as the statement text, and
226
+ // an object reaches the engine as "[object Object]" — a syntax error that
227
+ // names a token rather than the argument, with the fragment's values
228
+ // silently dropped.
229
+ //
230
+ // The look-alike this catches is not hypothetical. `SqlFragment` is
231
+ // structurally `{ sql, params }`, so a plain object of that shape type-checks
232
+ // against the fragment overload, and the brand is a symbol, which neither
233
+ // `structuredClone` nor `JSON` carries: a fragment built in a Worker and
234
+ // posted to the main thread arrives as exactly such a look-alike.
235
+ throw new TypeError(`Expected a SQL string or a sql\`…\` fragment, got ${describe(sql)}. ` +
236
+ 'A fragment does not survive structuredClone or JSON — it carries a ' +
237
+ 'symbol brand — so rebuild it on the receiving side rather than sending it');
238
+ }
239
+ /** Name a value for an error message, without dumping its contents. */
240
+ function describe(value) {
241
+ if (value === null)
242
+ return 'null';
243
+ if (Array.isArray(value))
244
+ return 'an array';
245
+ if (typeof value !== 'object')
246
+ return `a ${typeof value}`;
247
+ const name = value.constructor?.name;
248
+ const looksLikeFragment = 'sql' in value && 'params' in value;
249
+ return looksLikeFragment
250
+ ? `a { sql, params } object that is not a fragment (${name ?? 'object'})`
251
+ : `a ${name ?? 'object'}`;
252
+ }
253
+ /**
254
+ * Resolve `query()`'s two shapes: `(sql, params, options)` and
255
+ * `(fragment, options)`.
256
+ *
257
+ * A fragment carries its own parameters, so the slot that would have held them
258
+ * is free — and making the caller write `query(fragment, undefined, options)`
259
+ * to reach the third argument would be a poor trade for the tag's ergonomics.
260
+ * The two are told apart by whether the argument is an array, which is
261
+ * unambiguous: parameters are always one, options never are.
262
+ *
263
+ * @throws if a string statement is given a second argument that is not an
264
+ * array. `query('… WHERE id = ?', 5)` reads as though it binds 5, and taking
265
+ * it for transaction options instead would run the statement with no
266
+ * parameters at all — the engine then complains about a placeholder count,
267
+ * naming nothing the caller wrote. TypeScript rules this out; untyped
268
+ * JavaScript, which the browser build is used from, does not.
269
+ */
270
+ function resolveQueryCall(sql, paramsOrOptions = [], maybeOptions = {}) {
271
+ if (Array.isArray(paramsOrOptions)) {
272
+ return {
273
+ statement: toStatement(sql, paramsOrOptions),
274
+ options: maybeOptions,
275
+ };
276
+ }
277
+ if (typeof sql === 'string') {
278
+ throw new TypeError(`Expected an array of parameters, got ${describe(paramsOrOptions)}. ` +
279
+ 'Transaction options go in the second argument only for a sql`…` ' +
280
+ 'fragment, which carries its own parameters');
281
+ }
282
+ return {
283
+ statement: toStatement(sql, []),
284
+ options: paramsOrOptions,
285
+ };
286
+ }
287
+ //# sourceMappingURL=sql-tag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sql-tag.js","sourceRoot":"","sources":["../src/sql-tag.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;;;AAqDH,sCAMC;AAiOD,kCAmCC;AAiCD,4CAwBC;AApXD,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E;;;;;;;;GAQG;AACH,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;AACzD,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;AAE/C;;;;;GAKG;AACH,MAA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AC9D,OAAO,iBAAiB;QACtB,CAAC,CAAC,oDAAoD,IAAI,IAAI,QAAQ,GAAG;QACzE,CAAC,CAAC,KAAK,IAAI,IAAI,QAAQ,EAAE,CAAC;AAC9B,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,gBAAgB,CAC9B,GAAyB,EACzB,kBAAoD,EAAE,EACtD,eAAmC,EAAE;IAErC,IAAI,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;QACnC,OAAO;YACL,SAAS,EAAE,WAAW,CAAC,GAAG,EAAE,eAAe,CAAC;YAC5C,OAAO,EAAE,YAAY;SACtB,CAAC;IACJ,CAAC;IAED,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5B,MAAM,IAAI,SAAS,CACjB,wCAAwC,QAAQ,CAAC,eAAe,CAAC,IAAI;YACnE,kEAAkE;YAClE,4CAA4C,CAC/C,CAAC;IACJ,CAAC;IAED,OAAO;QACL,SAAS,EAAE,WAAW,CAAC,GAAG,EAAE,EAAE,CAAC;QAC/B,OAAO,EAAE,eAAqC;KAC/C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * statement-types.ts – names for Firebird's statement-type codes.
3
+ *
4
+ * The engine reports what a statement *is* as one of the `isc_info_sql_stmt_*`
5
+ * constants. A caller asking `describeQuery()` what they have wants the name,
6
+ * not the number — the number is only meaningful next to a copy of
7
+ * `iberror.h`.
8
+ *
9
+ * Shared by both backends rather than per-backend: `node-firebird-driver`'s
10
+ * `StatementType` enum is these same codes, so one table describes what either
11
+ * one reports and the two cannot drift into naming the same statement
12
+ * differently.
13
+ */
14
+ import type { StatementKind } from './types';
15
+ /**
16
+ * Name a statement-type code.
17
+ *
18
+ * An unrecognised code is `'UNKNOWN'` rather than an error: a Firebird release
19
+ * may add one, and a name this library has not learned yet is no reason to
20
+ * fail a description that is otherwise complete.
21
+ */
22
+ export declare function statementKind(code: number): StatementKind;
23
+ //# sourceMappingURL=statement-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statement-types.d.ts","sourceRoot":"","sources":["../src/statement-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAoB7C;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAEzD"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ /**
3
+ * statement-types.ts – names for Firebird's statement-type codes.
4
+ *
5
+ * The engine reports what a statement *is* as one of the `isc_info_sql_stmt_*`
6
+ * constants. A caller asking `describeQuery()` what they have wants the name,
7
+ * not the number — the number is only meaningful next to a copy of
8
+ * `iberror.h`.
9
+ *
10
+ * Shared by both backends rather than per-backend: `node-firebird-driver`'s
11
+ * `StatementType` enum is these same codes, so one table describes what either
12
+ * one reports and the two cannot drift into naming the same statement
13
+ * differently.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.statementKind = statementKind;
17
+ // From firebird/impl/consts_pub.h (isc_info_sql_stmt_*).
18
+ const NAMES = {
19
+ 1: 'SELECT',
20
+ 2: 'INSERT',
21
+ 3: 'UPDATE',
22
+ 4: 'DELETE',
23
+ 5: 'DDL',
24
+ 6: 'GET_SEGMENT',
25
+ 7: 'PUT_SEGMENT',
26
+ 8: 'EXEC_PROCEDURE',
27
+ 9: 'START_TRANS',
28
+ 10: 'COMMIT',
29
+ 11: 'ROLLBACK',
30
+ 12: 'SELECT_FOR_UPD',
31
+ 13: 'SET_GENERATOR',
32
+ 14: 'SAVEPOINT',
33
+ };
34
+ /**
35
+ * Name a statement-type code.
36
+ *
37
+ * An unrecognised code is `'UNKNOWN'` rather than an error: a Firebird release
38
+ * may add one, and a name this library has not learned yet is no reason to
39
+ * fail a description that is otherwise complete.
40
+ */
41
+ function statementKind(code) {
42
+ return NAMES[code] ?? 'UNKNOWN';
43
+ }
44
+ //# sourceMappingURL=statement-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statement-types.js","sourceRoot":"","sources":["../src/statement-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;AA6BH,sCAEC;AA3BD,yDAAyD;AACzD,MAAM,KAAK,GAAkC;IAC3C,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,aAAa;IAChB,CAAC,EAAE,aAAa;IAChB,CAAC,EAAE,gBAAgB;IACnB,CAAC,EAAE,aAAa;IAChB,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,UAAU;IACd,EAAE,EAAE,gBAAgB;IACpB,EAAE,EAAE,eAAe;IACnB,EAAE,EAAE,WAAW;CAChB,CAAC;AAEF;;;;;;GAMG;AACH,SAAgB,aAAa,CAAC,IAAY;IACxC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC;AAClC,CAAC"}
package/dist/types.d.ts CHANGED
@@ -85,4 +85,66 @@ export interface TransactionOptions {
85
85
  isolationLevel?: IsolationLevel;
86
86
  readOnly?: boolean;
87
87
  }
88
+ /**
89
+ * What each row is.
90
+ *
91
+ * - `'object'` (default) keys every value by its upper-cased column name.
92
+ * - `'array'` gives the values in column order, positionally.
93
+ *
94
+ * Names live in `fields` either way, so `'array'` loses nothing — it trades
95
+ * the convenience of `row.NAME` for `row[1]`, and for that it skips building
96
+ * one object per row.
97
+ */
98
+ export type RowMode = 'object' | 'array';
99
+ /**
100
+ * Options accepted by `query()`.
101
+ *
102
+ * A superset of {@link TransactionOptions}: a query may start a transaction of
103
+ * its own, and it decides the shape of what comes back.
104
+ */
105
+ export interface QueryOptions extends TransactionOptions {
106
+ /**
107
+ * How to shape each row.
108
+ *
109
+ * `'array'` is worth reaching for on large result sets and on columns whose
110
+ * names collide: `SELECT a.ID, b.ID` has two columns and, in object mode,
111
+ * one `ID` key — the second value wins and the first is unreachable.
112
+ * Positional rows keep both.
113
+ *
114
+ * @default 'object'
115
+ */
116
+ rowMode?: RowMode;
117
+ }
118
+ /** A row in `rowMode: 'array'` — values in column order. */
119
+ export type ArrayRow = unknown[];
120
+ /**
121
+ * What a statement is, from Firebird's `isc_info_sql_stmt_*` codes.
122
+ *
123
+ * `'UNKNOWN'` covers a code this library does not name rather than a failure
124
+ * to describe the statement.
125
+ */
126
+ export type StatementKind = 'SELECT' | 'INSERT' | 'UPDATE' | 'DELETE' | 'DDL' | 'GET_SEGMENT' | 'PUT_SEGMENT' | 'EXEC_PROCEDURE' | 'START_TRANS' | 'COMMIT' | 'ROLLBACK' | 'SELECT_FOR_UPD' | 'SET_GENERATOR' | 'SAVEPOINT' | 'UNKNOWN';
127
+ /**
128
+ * The shape of a statement, without running it.
129
+ *
130
+ * Returned by `describeQuery()`. Parameters are positional `?` in Firebird and
131
+ * carry no names, so a `ParamInfo` has everything a {@link FieldInfo} has
132
+ * except a meaningful one.
133
+ */
134
+ export interface QueryDescription {
135
+ /**
136
+ * One entry per `?`, in order.
137
+ *
138
+ * `undefined` where the backend cannot report them — the Node driver
139
+ * exposes no input metadata, and an empty array there would claim the
140
+ * statement takes no parameters.
141
+ */
142
+ params?: FieldInfo[];
143
+ /** One entry per result column, in order. Empty for a statement returning none. */
144
+ fields: FieldInfo[];
145
+ /** What kind of statement it is. */
146
+ statementType: StatementKind;
147
+ /** Whether executing it yields rows. */
148
+ hasResultSet: boolean;
149
+ }
88
150
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,2EAA2E;IAC3E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gDAAgD;IACh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