yggio-prisma 0.0.14 → 0.0.15

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/README.md CHANGED
@@ -176,7 +176,7 @@ Prisma writes and reads in UTC, a `TIMESTAMP` is UTC by MySQL's definition.
176
176
  | `DECIMAL(p,s)`, the default `DECIMAL(65,30)` | `decimal(p,s)`, the core's narrowest width for the digits | a decimal at its precision and scale (`decimal` 38 and 18) to 65 digits and scale 30; `bigdecimal` refused | `Decimal @db.Decimal(p,s)` |
177
177
  | `DATETIME(n)`, `TIMESTAMP(n)` | `datetime64(s)` at 0 digits, `ms` to 3, `us` to 6, UTC | `datetime64(unit, zone)` | `DateTime @db.DateTime(0 \| 3 \| 6)`; a nanosecond column at six, sent as a `Date` floored to the millisecond - no cast cuts it |
178
178
  | `DATE`, `TIME(n)` | `date32`, `time(unit)` (`time32`/`time64`, the core's width) | `date32`, `date64`, `time32`, `time64` | `DateTime @db.Date`, `@db.Time(n)` |
179
- | `VARCHAR(n)`, `CHAR(n)`, `TEXT` | `utf8` | text; a code (`mic`, `ccy`, `lei`, ...) and `timezone` | `String @db.Text`, the key `@db.VarChar(191)`; `@db.VarChar(n)`, `@db.Char(n)`; a code `@db.VarChar(64)` |
179
+ | `VARCHAR(n)`, `CHAR(n)`, `TEXT` | `utf8` | text; a code (`mic`, `ccy`, `lei`, ...) and `timezone` | `String @db.Text`, the key and an indexed column `@db.VarChar(191)`; `@db.VarChar(n)`, `@db.Char(n)`; a code `@db.VarChar(64)` |
180
180
  | `BINARY(16)`; `BINARY(n)`, `VARBINARY(n)`, `BLOB` | `uuid`; `fixed_binary(n)`, `sized_binary(n)`, `binary` | `uuid`; `fixed_binary`, `sized_binary`, `binary` | `Bytes @db.Binary(16)`; `@db.Binary(n)`, `@db.VarBinary(n)`, `Bytes` |
181
181
  | `JSON` | `utf8`, the text; the map, struct or serie the generated model states | `map`, `struct`, `serie` | `Json` |
182
182
  | `ENUM` | the kind a generated model states; else the kind its name spells (`Side` is `side`) where every member is the kind's, as the core reads them; else `utf8` | `side`, `state`, `marketdatakind`, `marketdatatype`, `timeinforce` | `enum Side { UKNW BUY ... }` from the kinds' member tables |
@@ -193,9 +193,43 @@ precision, scale, unit, widths - never off its text. Each model is keyed by
193
193
  the one column its field's `SORT:by` names (`rowKey`: `underlying` by `code`,
194
194
  `mic` by `mic`, `legalentity` by `lei`), else by `STATED_KEYS` with their
195
195
  reasons (`fixmsg` and `plugin` state no order, keyed by `uuid` and
196
- `pluginid`; `fxrate`'s `crosscode, transunix` is an order and no key, keyed by
197
- `uuid`): the key a `merge` upserts by. `mysql/prisma.config.ts` reads the
198
- server from `MYSQL_URL`.
196
+ `pluginid`; `fxrate`'s `crosscode, markettimestamp` is an order and no key, keyed by
197
+ `uuid`): the key a `merge` upserts by. Each model is indexed by what its
198
+ field declares (`rowIndexes`): one `@@index` over the columns its
199
+ `PARTITION:by` marks - an identity entry, never a transform such as
200
+ `months(markettimestamp)` - then the keys its `SORT:by` names - `fxrate` by
201
+ `crosscode, markettimestamp` - none where that is the key itself (`underlying`
202
+ by `code`, `fixdefinition` by `category, tag, name`); a message declares no layout, so
203
+ `STATED_INDEXES` gives `fixmsg` the three the message search reads,
204
+ `(underlyingcategory, markettimestamp)`, `(underlyingcode, markettimestamp)` and `(crosscode, markettimestamp)`.
205
+ MySQL indexes no `TEXT`, so an indexed text column is `VARCHAR(191)`, as a
206
+ key is; an index over a `JSON` or `BLOB` column is refused by name.
207
+ `mysql/prisma.config.ts` reads the server from `MYSQL_URL`.
208
+
209
+ ### Search
210
+
211
+ `searchWhere(text, underlyings, model, options)` is the core's one message
212
+ search - `fix.Underlyings.messageSearch(text, modelField(model), { registry,
213
+ limit, since, until })` - compiled by `compilePlan`, which takes the core's
214
+ `Plan` as it takes a text. A text the `uuid` column reads is that message
215
+ alone; else the branches OR-ed, each carrying its own pruning: the
216
+ underlying rows the text names, `underlyingcode in [...]` within their categories
217
+ `underlyingcategory in [...]`; the plugins `registry` names, `plugincode` or
218
+ `lastplugincode in [...]`; for a text with no blank, `crosscode` and
219
+ `underlyingcode` equalities, and `mic` where the text is a listed market; the
220
+ `like` prune over `crosscode`, `underlyingcode` and `text` only where neither an
221
+ underlying nor a plugin resolved. The window `markettimestamp >= since` and
222
+ `markettimestamp < until` (nanoseconds) bounds every branch, and the rows come
223
+ newest first (`orderBy: [{ markettimestamp: 'desc' }]`), so the three indexes
224
+ above answer each branch. MySQL's text equality folds case and pads, so the
225
+ text clauses only prune and the residual rechecks the rows natively.
226
+
227
+ ```js
228
+ const seed = yggio.fix.Underlyings.seeded()
229
+ const { args, residual } = searchWhere('AAPL', seed, model, { yggio, provider: 'mysql', since: 1_790_812_800_000_000_000n })
230
+ const pruned = await prisma.fixmsg.findMany(args)
231
+ const rows = residual?.filter === undefined ? pruned : filterRows(pruned, residual.filter, model, null, yggio)
232
+ ```
199
233
 
200
234
  ```js
201
235
  // The rows a model answered, as Arrow under the crate's field: landed under the model, cast by the core.
package/dist/index.cjs CHANGED
@@ -50,7 +50,8 @@ function writeDocument(document) {
50
50
  return text.replace(/"\\u0000yggio-bigint:(-?\d+)"/g, "$1");
51
51
  }
52
52
  function readPlan(plan, yggio) {
53
- const document = typeof plan === "string" ? readDocument(yggio.Plan.parse(plan).intoJson()) : plan;
53
+ const core = typeof plan === "string" ? yggio.Plan.parse(plan) : plan instanceof yggio.Plan ? plan : null;
54
+ const document = core === null ? plan : readDocument(core.intoJson());
54
55
  for (const key of Object.keys(document)) {
55
56
  if (!READ_SECTIONS.has(key)) throw new PlanRefused(`the plan's ${key === "joins" ? "join" : key} section is refused: a plan over a Prisma model reads that model alone`);
56
57
  }
@@ -141,6 +142,21 @@ function rowKey(field) {
141
142
  const by = field.sort.by;
142
143
  return by !== null && by.length === 1 && field.getField(by[0]) !== null ? by[0] : null;
143
144
  }
145
+ var STATED_INDEXES = {
146
+ fixmsg: [
147
+ ["underlyingcategory", "markettimestamp"],
148
+ ["underlyingcode", "markettimestamp"],
149
+ ["crosscode", "markettimestamp"]
150
+ ]
151
+ };
152
+ function rowIndexes(field, key = rowKey(field)) {
153
+ const stated = STATED_INDEXES[field.name];
154
+ if (stated !== void 0) return stated.map((index) => [...index]);
155
+ const columns = [.../* @__PURE__ */ new Set([...field.partitionFieldNames(), ...field.sort.by ?? []])];
156
+ const keys = key === null ? [] : typeof key === "string" ? [key] : key;
157
+ const keyed = columns.length === keys.length && columns.every((column, at) => column === keys[at]);
158
+ return columns.length === 0 || keyed ? [] : [columns];
159
+ }
144
160
  function fractionUnit(digits) {
145
161
  return digits <= 0 ? "s" : digits <= 3 ? "ms" : "us";
146
162
  }
@@ -286,7 +302,7 @@ function mysqlColumn(name, dtype, nullable, options = {}) {
286
302
  const text = dtype.stringParameters;
287
303
  if (text?.fixed !== void 0) return column("String", `Char(${text.fixed})`);
288
304
  if (text?.max !== void 0) return column("String", `VarChar(${text.max})`);
289
- return column("String", options.key ? "VarChar(191)" : "Text");
305
+ return column("String", options.key || options.indexed ? "VarChar(191)" : "Text");
290
306
  }
291
307
  case "enum": {
292
308
  if (!KINDS.includes(id)) return refuse("has no MySQL column");
@@ -310,11 +326,20 @@ function mysqlModel(root, columns, options = {}) {
310
326
  const keys = typeof options.key === "string" ? [options.key] : options.key;
311
327
  if (keys.length === 0) throw new PlanRefused(`model ${root} names no key: pass key`);
312
328
  for (const key of keys) if (!columns.some((column) => column.name === key)) throw new PlanRefused(`model ${root} has no column ${key} to key by`);
329
+ const indexes = (options.indexes ?? []).map((index) => [...index]);
330
+ for (const index of indexes) {
331
+ if (index.length === 0) throw new PlanRefused(`model ${root} states an index of no column`);
332
+ for (const name of index) if (!columns.some((column) => column.name === name)) throw new PlanRefused(`model ${root} has no column ${name} to index`);
333
+ }
334
+ const indexed = new Set(indexes.flat());
313
335
  const compound = keys.length > 1;
314
336
  const enums = {};
315
337
  const fields = columns.map((held) => {
316
338
  const keyed = keys.includes(held.name);
317
- const column = mysqlColumn(held.name, held.dtype, held.nullable, { key: keyed, kinds: options.kinds });
339
+ const column = mysqlColumn(held.name, held.dtype, held.nullable, { key: keyed, indexed: indexed.has(held.name), kinds: options.kinds });
340
+ if (indexed.has(held.name) && column.native === null && (column.type === "Json" || column.type === "Bytes")) {
341
+ throw new PlanRefused(`model ${root} cannot index column ${held.name} (${column.datatype}): MySQL indexes no whole JSON or BLOB value`);
342
+ }
318
343
  const members = column.enum === void 0 ? void 0 : options.kinds?.[column.enum]?.map((member) => member.name);
319
344
  if (members !== void 0) enums[column.type] = members;
320
345
  return {
@@ -329,7 +354,7 @@ function mysqlModel(root, columns, options = {}) {
329
354
  ...members === void 0 ? {} : { values: members }
330
355
  };
331
356
  });
332
- return { name: root, fields, enums, primaryKey: compound ? { name: null, fields: keys } : null };
357
+ return { name: root, fields, enums, primaryKey: compound ? { name: null, fields: keys } : null, indexes };
333
358
  }
334
359
  function fieldColumns(field) {
335
360
  const out = [];
@@ -343,7 +368,7 @@ function fieldColumns(field) {
343
368
  function fieldModel(field, options = {}) {
344
369
  const key = options.key ?? rowKey(field) ?? void 0;
345
370
  if (key === void 0) throw new PlanRefused(`model ${field.name} names no key: its SORT:by names no one column, pass key`);
346
- return mysqlModel(field.name, fieldColumns(field), { ...options, key });
371
+ return mysqlModel(field.name, fieldColumns(field), { ...options, key, indexes: options.indexes ?? rowIndexes(field, key) });
347
372
  }
348
373
  var META_TABLES = ["fixmsg", "underlying", "mic", "legalentity", "plugin", "fxrate", "fixdefinition", "textline"];
349
374
  function fieldModels(yggio, kinds) {
@@ -380,7 +405,8 @@ function prismaSchema(models, options = {}) {
380
405
  const attributes = [field.isId ? "@id" : "", field.nativeType === void 0 || field.nativeType === null ? "" : `@db.${field.nativeType[0]}${field.nativeType[1].length === 0 ? "" : `(${field.nativeType[1].join(",")})`}`].filter((attribute) => attribute !== "");
381
406
  lines.push(` ${field.name.padEnd(width)} ${attributes.length === 0 ? type : `${type.padEnd(typeWidth)} ${attributes.join(" ")}`}`);
382
407
  }
383
- if (model.primaryKey) lines.push("", ` @@id([${model.primaryKey.fields.join(", ")}])`);
408
+ const blocks = [...model.primaryKey ? [` @@id([${model.primaryKey.fields.join(", ")}])`] : [], ...model.indexes.map((index) => ` @@index([${index.join(", ")}])`)];
409
+ if (blocks.length > 0) lines.push("", ...blocks);
384
410
  lines.push("}");
385
411
  }
386
412
  return `${lines.join("\n")}
@@ -599,35 +625,28 @@ function columnInput(kind, value, yggio) {
599
625
  return value;
600
626
  }
601
627
  var show = (value) => typeof value === "string" ? `'${value}'` : typeof value === "bigint" ? `${value}` : value instanceof Date ? value.toISOString() : JSON.stringify(value) ?? String(value);
602
- function termParameters(term, into = []) {
603
- if (Array.isArray(term)) {
604
- for (const item of term) termParameters(item, into);
605
- } else if (typeof term === "object" && term !== null) {
606
- const record = term;
607
- if (typeof record.parameter === "string") {
608
- if (!into.includes(record.parameter)) into.push(record.parameter);
609
- } else if (!("literal" in record)) {
610
- for (const value of Object.values(record)) termParameters(value, into);
611
- }
612
- }
613
- return into;
628
+ function paramValue(value) {
629
+ return typeof value === "object" && value !== null && !(value instanceof Date) && !ArrayBuffer.isView(value) && !Array.isArray(value) && isDecimal(value) ? value.toFixed() : value;
614
630
  }
615
- function parameterValue(name, params) {
616
- if (!params || !(name in params)) throw new PlanRefused(`parameter :${name} was not given`);
617
- return params[name];
631
+ function boundPlan(plan, params, yggio) {
632
+ const core = typeof plan === "string" ? yggio.Plan.parse(plan) : plan instanceof yggio.Plan ? plan : yggio.Plan.fromJson(writeDocument(plan));
633
+ try {
634
+ return core.bind(Object.fromEntries(Object.entries(params ?? {}).map(([name, value]) => [name, paramValue(value)])));
635
+ } catch (error) {
636
+ throw new PlanRefused(error.message);
637
+ }
618
638
  }
619
- function bindPlan(plan, field, params, yggio) {
620
- const plain = (term) => bindTerm(term, null);
621
- const bindTerm = (term, typed) => {
622
- if (Array.isArray(term)) return term.map((item) => bindTerm(item, null));
639
+ function typedLiterals(plan, field, yggio) {
640
+ const plain = (term) => typeTerm(term, null);
641
+ const typeTerm = (term, typed) => {
642
+ if (Array.isArray(term)) return term.map((item) => typeTerm(item, null));
623
643
  if (typeof term !== "object" || term === null) return term;
624
644
  const record = term;
625
- if (typeof record.parameter === "string") return readDocument(yggio.Term.literal(parameterValue(record.parameter, params)).intoJson());
626
645
  if ("literal" in record || "path" in record) return term;
627
646
  if (typed) {
628
- if (Array.isArray(record.and)) return { and: record.and.map((item) => bindTerm(item, typed)) };
629
- if (Array.isArray(record.or)) return { or: record.or.map((item) => bindTerm(item, typed)) };
630
- if (record.not !== void 0) return { not: bindTerm(record.not, typed) };
647
+ if (Array.isArray(record.and)) return { and: record.and.map((item) => typeTerm(item, typed)) };
648
+ if (Array.isArray(record.or)) return { or: record.or.map((item) => typeTerm(item, typed)) };
649
+ if (record.not !== void 0) return { not: typeTerm(record.not, typed) };
631
650
  if (Array.isArray(record.compare)) {
632
651
  const [left, op, right] = record.compare;
633
652
  return { compare: [operand(left, right, typed), op, operand(right, left, typed)] };
@@ -644,16 +663,15 @@ function bindPlan(plan, field, params, yggio) {
644
663
  return Object.fromEntries(Object.entries(record).map(([key, value]) => [key, plain(value)]));
645
664
  };
646
665
  const operand = (term, other, root) => {
647
- const isValue = (candidate) => typeof candidate.parameter === "string" || "literal" in candidate;
648
- if (!isValue(term) || isValue(other)) return plain(term);
649
- const value = typeof term.parameter === "string" ? parameterValue(term.parameter, params) : literalValue(term);
666
+ if (!("literal" in term) || "literal" in other) return plain(term);
667
+ const value = literalValue(term);
650
668
  if (value === void 0 || value === null) return plain(term);
651
669
  return termLiteral(root, other, value, yggio) ?? plain(term);
652
670
  };
653
671
  const out = {};
654
672
  for (const [key, section] of Object.entries(plan)) {
655
673
  if (section === void 0) continue;
656
- out[key] = key === "filter" ? bindTerm(section, field) : plain(section);
674
+ out[key] = key === "filter" ? typeTerm(section, field) : plain(section);
657
675
  }
658
676
  return out;
659
677
  }
@@ -869,9 +887,8 @@ function providerOf(provider) {
869
887
  function compilePlan(plan, model, options) {
870
888
  const { yggio, params } = options;
871
889
  const exactText = EXACT_TEXT.has(providerOf(options.provider) ?? "");
872
- const document = readPlan(plan, yggio);
890
+ const document = readPlan(boundPlan(plan, params, yggio), yggio);
873
891
  checkSource(document, model);
874
- for (const name of termParameters(document)) parameterValue(name, params);
875
892
  const field = options.field ?? modelField(model, yggio);
876
893
  const columns = new Map(modelColumns(model).filter((column) => !column.isList).map((column) => [column.name, column]));
877
894
  const scalar = (column, read) => columnScalar(field, column.name, read, yggio);
@@ -884,21 +901,21 @@ function compilePlan(plan, model, options) {
884
901
  if (operator === "eq") return nothing(column);
885
902
  if (!ranged) return null;
886
903
  const lower = operator === "gt" || operator === "gt_eq";
887
- const bound2 = scalar(column, lower ? Math.ceil(read) : Math.floor(read));
888
- return { where: { [column.name]: { [lower ? "gte" : "lte"]: prismaValue2(column, bound2) } }, recheck: false };
904
+ const bound = scalar(column, lower ? Math.ceil(read) : Math.floor(read));
905
+ return { where: { [column.name]: { [lower ? "gte" : "lte"]: prismaValue2(column, bound) } }, recheck: false };
889
906
  }
890
- const typed = scalar(column, read);
891
- if (isText(column) && !exactText) return operator === "eq" ? { where: { [column.name]: { equals: prismaValue2(column, typed) } }, recheck: true } : null;
907
+ const typed2 = scalar(column, read);
908
+ if (isText(column) && !exactText) return operator === "eq" ? { where: { [column.name]: { equals: prismaValue2(column, typed2) } }, recheck: true } : null;
892
909
  if (column.type === "DateTime") {
893
- const floor = instantDate(typed);
894
- const ceil = instantDate(typed, true);
910
+ const floor = instantDate(typed2);
911
+ const ceil = instantDate(typed2, true);
895
912
  if (floor && ceil && floor.getTime() !== ceil.getTime()) {
896
913
  if (operator === "not_eq") return null;
897
914
  if (operator === "eq") return { where: { [column.name]: { gte: floor, lte: ceil } }, recheck: true };
898
915
  return { where: { [column.name]: { [key]: operator === "gt" || operator === "gt_eq" ? floor : ceil } }, recheck: true };
899
916
  }
900
917
  }
901
- return { where: { [column.name]: { [key]: prismaValue2(column, typed) } }, recheck: false };
918
+ return { where: { [column.name]: { [key]: prismaValue2(column, typed2) } }, recheck: false };
902
919
  };
903
920
  const pushIn = (column, reads) => {
904
921
  if (!equatable(column)) return null;
@@ -906,15 +923,15 @@ function compilePlan(plan, model, options) {
906
923
  if (kept.length === 0) return nothing(column);
907
924
  const items = [];
908
925
  for (const read of kept) {
909
- const typed = scalar(column, read);
910
- if (column.type === "DateTime" && instantDate(typed)?.getTime() !== instantDate(typed, true)?.getTime()) return null;
911
- items.push(prismaValue2(column, typed));
926
+ const typed2 = scalar(column, read);
927
+ if (column.type === "DateTime" && instantDate(typed2)?.getTime() !== instantDate(typed2, true)?.getTime()) return null;
928
+ items.push(prismaValue2(column, typed2));
912
929
  }
913
930
  return { where: { [column.name]: { in: items } }, recheck: isText(column) && !exactText };
914
931
  };
915
932
  const pushTerm = (term) => {
916
933
  const value = (operand) => {
917
- const read = typeof operand.parameter === "string" ? parameterValue(operand.parameter, params) : literalValue(operand);
934
+ const read = literalRead(operand, yggio);
918
935
  return read === void 0 || read === null ? null : { value: read };
919
936
  };
920
937
  if (Array.isArray(term.compare)) {
@@ -1037,8 +1054,16 @@ function compilePlan(plan, model, options) {
1037
1054
  args.select = Object.fromEntries(selected.map((name) => [name, true]));
1038
1055
  pushed.push("select");
1039
1056
  }
1040
- const bound = isEmptyPlan(residual) ? null : bindPlan(residual, field, params, yggio);
1041
- return { args, residual: bound, complete: bound === null, pushed, columns: selected };
1057
+ const typed = isEmptyPlan(residual) ? null : typedLiterals(residual, field, yggio);
1058
+ return { args, residual: typed, complete: typed === null, pushed, columns: selected };
1059
+ }
1060
+ function literalRead(term, yggio) {
1061
+ const plain = literalValue(term);
1062
+ if (plain !== void 0) return plain;
1063
+ const literal = term.literal;
1064
+ const held = literal?.value?.value;
1065
+ if (literal?.dtype?.type !== "datetime64" || !Array.isArray(held)) return void 0;
1066
+ return yggio.DataType.fromJSON(literal.dtype).scalar(BigInt(held[0]));
1042
1067
  }
1043
1068
  function checkSource(document, model) {
1044
1069
  const source = document.from;
@@ -1109,47 +1134,12 @@ function prismaValue2(column, scalar) {
1109
1134
  return scalar.asJs();
1110
1135
  }
1111
1136
  }
1112
- var IDENTIFIER_COLUMNS = ["crosscode", "mic", "undcode"];
1113
- var TEXT_COLUMNS = ["crosscode", "undcode", "text"];
1114
- function searchPlan(text, underlyings, field, options) {
1115
- const { yggio } = options;
1116
- const term = text.trim();
1117
- if (term === "") return null;
1118
- const reads = (column) => {
1119
- if (field.getField(column) === null) return false;
1120
- try {
1121
- columnScalar(field, column, term, yggio);
1122
- return true;
1123
- } catch {
1124
- return false;
1125
- }
1126
- };
1127
- if (reads("uuid")) return { plan: "where uuid = :text", params: { text: term } };
1128
- const clauses = [];
1129
- const params = { text: term };
1130
- if (!/\s/.test(term)) {
1131
- for (const column of IDENTIFIER_COLUMNS) if (reads(column)) clauses.push(`${column} = :text`);
1132
- }
1133
- const codes = underlyings === null || field.getField("undcode") === null ? [] : underlyingCodes(underlyings, term, options.limit);
1134
- if (codes.length > 0) {
1135
- codes.forEach((code, at) => params[`code${at}`] = code);
1136
- clauses.push(`undcode in (${codes.map((_, at) => `:code${at}`).join(", ")})`);
1137
- } else {
1138
- params.pattern = `%${term}%`;
1139
- for (const column of TEXT_COLUMNS) if (field.getField(column) !== null) clauses.push(`${column} like :pattern`);
1140
- }
1141
- if (clauses.length === 0) return { plan: "where false", params: {} };
1142
- return { plan: `where ${clauses.join(" or ")}`, params };
1143
- }
1144
- function underlyingCodes(underlyings, text, limit) {
1145
- const rows = (limit === void 0 ? underlyings.search(text) : underlyings.search(text, limit)).toRecords();
1146
- return rows.map((row) => row.code).filter((code) => typeof code === "string");
1147
- }
1148
1137
  function searchWhere(text, underlyings, model, options) {
1138
+ const { registry, limit, since, until } = options;
1149
1139
  const field = options.field ?? modelField(model, options.yggio, null, options.provider);
1150
- const searched = searchPlan(text, underlyings, field, options);
1151
- if (searched === null) return { args: {}, residual: null, complete: true, pushed: [], columns: null };
1152
- return compilePlan(searched.plan, model, { ...options, field, params: searched.params });
1140
+ const plan = underlyings.messageSearch(text, field, { registry, limit, since, until });
1141
+ if (plan === null) return { args: {}, residual: null, complete: true, pushed: [], columns: null };
1142
+ return compilePlan(plan, model, { ...options, field });
1153
1143
  }
1154
1144
 
1155
1145
  // src/extension.ts
@@ -1291,8 +1281,9 @@ exports.KINDS = KINDS;
1291
1281
  exports.META_TABLES = META_TABLES;
1292
1282
  exports.PlanRefused = PlanRefused;
1293
1283
  exports.ROW = ROW;
1284
+ exports.STATED_INDEXES = STATED_INDEXES;
1294
1285
  exports.STATED_KEYS = STATED_KEYS;
1295
- exports.bindPlan = bindPlan;
1286
+ exports.boundPlan = boundPlan;
1296
1287
  exports.columnDatatype = columnDatatype;
1297
1288
  exports.columnLiteral = columnLiteral;
1298
1289
  exports.columnOf = columnOf;
@@ -1324,20 +1315,19 @@ exports.mysqlDatatype = mysqlDatatype;
1324
1315
  exports.mysqlModel = mysqlModel;
1325
1316
  exports.mysqlNative = mysqlNative;
1326
1317
  exports.outputValue = outputValue;
1327
- exports.parameterValue = parameterValue;
1328
1318
  exports.planColumns = planColumns;
1329
1319
  exports.prismaRows = prismaRows;
1330
1320
  exports.prismaSchema = prismaSchema;
1331
1321
  exports.prismaValue = prismaValue;
1332
1322
  exports.readDocument = readDocument;
1333
1323
  exports.readPlan = readPlan;
1324
+ exports.rowIndexes = rowIndexes;
1334
1325
  exports.rowKey = rowKey;
1335
1326
  exports.runPlan = runPlan;
1336
- exports.searchPlan = searchPlan;
1337
1327
  exports.searchWhere = searchWhere;
1338
1328
  exports.termColumns = termColumns;
1339
1329
  exports.termLiteral = termLiteral;
1340
- exports.termParameters = termParameters;
1330
+ exports.typedLiterals = typedLiterals;
1341
1331
  exports.unitDigits = unitDigits;
1342
1332
  exports.without = without;
1343
1333
  exports.writeDocument = writeDocument;