orchid-orm 1.58.1 → 1.58.3

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.
@@ -1,5 +1,4 @@
1
- import { ColumnSchemaConfig } from 'orchid-core';
2
- import { DefaultColumnTypes, DefaultSchemaConfig } from 'pqb';
1
+ import { ColumnSchemaConfig, DefaultColumnTypes, DefaultSchemaConfig } from 'pqb';
3
2
  export * from 'rake-db/node-postgres';
4
3
 
5
4
  declare module 'rake-db' {
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var rakeDb = require('rake-db');
4
- var orchidCore = require('orchid-core');
5
4
  var pqb = require('pqb');
6
5
  var path = require('node:path');
7
6
  var url = require('url');
@@ -25,7 +24,7 @@ const compareSqlExpressions = async (tableExpressions, adapter) => {
25
24
  `SELECT pg_get_viewdef('${viewName}') v`,
26
25
  `DROP VIEW ${viewName}`
27
26
  ].join("; ");
28
- const result = await adapter.query(combinedQueries, values).then((res) => res[1], orchidCore.noop);
27
+ const result = await adapter.query(combinedQueries, values).then((res) => res[1], pqb.noop);
29
28
  if (!result) {
30
29
  handle();
31
30
  return;
@@ -80,20 +79,20 @@ const promptCreateOrRename = (kind, name, drop, verifying) => {
80
79
  }
81
80
  const renameMessage = `rename ${kind}`;
82
81
  return rakeDb.promptSelect({
83
- message: `Create or rename ${orchidCore.colors.blueBold(
82
+ message: `Create or rename ${pqb.colors.blueBold(
84
83
  name
85
84
  )} ${kind} from another ${kind}?`,
86
85
  options: [
87
- `${orchidCore.colors.greenBold("+")} ${name} ${orchidCore.colors.pale(
86
+ `${pqb.colors.greenBold("+")} ${name} ${pqb.colors.pale(
88
87
  `create ${kind}`.padStart(
89
88
  hintPos + renameMessage.length - name.length - 4,
90
89
  " "
91
90
  )
92
91
  )}`,
93
92
  ...drop.map(
94
- (d) => `${orchidCore.colors.yellowBold("~")} ${d} ${orchidCore.colors.yellowBold(
93
+ (d) => `${pqb.colors.yellowBold("~")} ${d} ${pqb.colors.yellowBold(
95
94
  "=>"
96
- )} ${name} ${orchidCore.colors.pale(
95
+ )} ${name} ${pqb.colors.pale(
97
96
  renameMessage.padStart(
98
97
  hintPos + renameMessage.length - d.length - name.length - 8,
99
98
  " "
@@ -335,7 +334,7 @@ const addOrRenameColumns = async (config, dbStructure, {
335
334
  dbName: from,
336
335
  column: column.name(codeName)
337
336
  });
338
- const to = config.snakeCase ? orchidCore.toSnakeCase(key) : key;
337
+ const to = config.snakeCase ? pqb.toSnakeCase(key) : key;
339
338
  if (dbTableData.primaryKey) {
340
339
  renameColumn(dbTableData.primaryKey.columns, from, to);
341
340
  }
@@ -425,9 +424,9 @@ const changeColumns = async (adapter, config, structureToAstCtx, dbStructure, do
425
424
  } else if (action !== "recreate") {
426
425
  const to = codeColumn.data.name ?? codeKey;
427
426
  if (dbName !== to) {
428
- changeTableData.changeTableAst.shape[config.snakeCase ? dbName === orchidCore.toSnakeCase(codeKey) ? codeKey : dbName : dbName] = {
427
+ changeTableData.changeTableAst.shape[config.snakeCase ? dbName === pqb.toSnakeCase(codeKey) ? codeKey : dbName : dbName] = {
429
428
  type: "rename",
430
- name: config.snakeCase ? to === orchidCore.toSnakeCase(codeKey) ? codeKey : to : to
429
+ name: config.snakeCase ? to === pqb.toSnakeCase(codeKey) ? codeKey : to : to
431
430
  };
432
431
  }
433
432
  }
@@ -445,15 +444,15 @@ const compareColumns = async (adapter, domainsMap, ast, currentSchema, compareSq
445
444
  const dbBaseType = pqb.getColumnBaseType(dbColumn, domainsMap, dbType);
446
445
  const codeBaseType = pqb.getColumnBaseType(codeColumn, domainsMap, codeType);
447
446
  if (!typeCasts.get(dbBaseType)?.has(codeBaseType)) {
448
- if (!(dbColumn instanceof pqb.EnumColumn) || !(codeColumn instanceof pqb.EnumColumn) || !orchidCore.deepCompare(dbColumn.options, codeColumn.options)) {
447
+ if (!(dbColumn instanceof pqb.EnumColumn) || !(codeColumn instanceof pqb.EnumColumn) || !pqb.deepCompare(dbColumn.options, codeColumn.options)) {
449
448
  if (verifying) throw new AbortSignal();
450
449
  const tableName = rakeDb.concatSchemaAndName(changeTableData.changeTableAst);
451
450
  const abort = await rakeDb.promptSelect({
452
451
  message: `Cannot cast type of ${tableName}'s column ${key} from ${dbType} to ${codeType}`,
453
452
  options: [
454
- `${orchidCore.colors.yellowBold(
453
+ `${pqb.colors.yellowBold(
455
454
  `-/+`
456
- )} recreate the column, existing data will be ${orchidCore.colors.red(
455
+ )} recreate the column, existing data will be ${pqb.colors.red(
457
456
  "lost"
458
457
  )}`,
459
458
  `write migration manually`
@@ -496,7 +495,7 @@ const compareColumns = async (adapter, domainsMap, ast, currentSchema, compareSq
496
495
  }
497
496
  }
498
497
  }
499
- if (!orchidCore.deepCompare(
498
+ if (!pqb.deepCompare(
500
499
  dbData.identity,
501
500
  codeData.identity ? {
502
501
  always: false,
@@ -684,7 +683,7 @@ const processDomains = async (ast, adapter, domainsMap, dbStructure, {
684
683
  dbColumn
685
684
  );
686
685
  const found = codeDomains.filter(
687
- (codeDomain) => orchidCore.deepCompare(dbDomain.compare, codeDomain.compare)
686
+ (codeDomain) => pqb.deepCompare(dbDomain.compare, codeDomain.compare)
688
687
  );
689
688
  if ((domain.default || domain.checks?.length) && found.length) {
690
689
  for (const codeDomain of found) {
@@ -792,7 +791,7 @@ const pushCompareChecks = (compare, domain, found) => {
792
791
  const inCode = found.flatMap(
793
792
  (codeDomain) => codeDomain.column.data.checks?.map(
794
793
  (check) => typeof check === "string" ? check : check.sql
795
- ) || orchidCore.emptyArray
794
+ ) || pqb.emptyArray
796
795
  );
797
796
  compare.push(
798
797
  ...domain.checks.map((check) => ({
@@ -986,7 +985,7 @@ const changePrimaryKey = (config, columnsPrimaryKey, {
986
985
  ...columnsPrimaryKey,
987
986
  ...(config.snakeCase ? tablePrimaryKey?.columns.map((key) => ({
988
987
  key,
989
- name: orchidCore.toSnakeCase(key)
988
+ name: pqb.toSnakeCase(key)
990
989
  })) : tablePrimaryKey?.columns.map((key) => ({ key, name: key }))) ?? []
991
990
  ])
992
991
  ];
@@ -995,7 +994,7 @@ const changePrimaryKey = (config, columnsPrimaryKey, {
995
994
  )) {
996
995
  if (primaryKey.length === 1) {
997
996
  const { key } = primaryKey[0];
998
- const changes = shape[key] && orchidCore.toArray(shape[key]);
997
+ const changes = shape[key] && pqb.toArray(shape[key]);
999
998
  if (changes) {
1000
999
  for (const change of changes) {
1001
1000
  if (change.type !== "change") continue;
@@ -1231,7 +1230,7 @@ const pushCodeColumnItems = (config, codeItems, columnKey, name, column, key) =>
1231
1230
  ...index,
1232
1231
  options: options.include ? config.snakeCase ? {
1233
1232
  ...options,
1234
- include: orchidCore.toArray(options.include).map(orchidCore.toSnakeCase)
1233
+ include: pqb.toArray(options.include).map(pqb.toSnakeCase)
1235
1234
  } : options : options,
1236
1235
  columnKeys: [
1237
1236
  {
@@ -1256,12 +1255,12 @@ const pushCodeCompositeItems = (config, codeTable, codeItems, key) => {
1256
1255
  ...items.map((x) => ({
1257
1256
  ...x,
1258
1257
  columns: config.snakeCase ? x.columns.map(
1259
- (c) => "column" in c ? { ...c, column: orchidCore.toSnakeCase(c.column) } : c
1258
+ (c) => "column" in c ? { ...c, column: pqb.toSnakeCase(c.column) } : c
1260
1259
  ) : x.columns,
1261
1260
  columnKeys: x.columns,
1262
1261
  options: x.options.include && config.snakeCase ? {
1263
1262
  ...x.options,
1264
- include: orchidCore.toArray(x.options.include).map(orchidCore.toSnakeCase)
1263
+ include: pqb.toArray(x.options.include).map(pqb.toSnakeCase)
1265
1264
  } : x.options,
1266
1265
  includeKeys: x.options.include
1267
1266
  }))
@@ -1278,7 +1277,7 @@ const collectCodeComparableItemsType = (config, codeItems, key) => {
1278
1277
  normalizeItem(codeItem.options);
1279
1278
  return itemToComparable({
1280
1279
  ...codeItem.options,
1281
- include: codeItem.options.include === void 0 ? void 0 : config.snakeCase ? orchidCore.toArray(codeItem.options.include).map(orchidCore.toSnakeCase) : orchidCore.toArray(codeItem.options.include),
1280
+ include: codeItem.options.include === void 0 ? void 0 : config.snakeCase ? pqb.toArray(codeItem.options.include).map(pqb.toSnakeCase) : pqb.toArray(codeItem.options.include),
1282
1281
  columns: codeItem.columns,
1283
1282
  name: codeItem.options.name,
1284
1283
  columnKeys: codeItem.columnKeys,
@@ -1350,7 +1349,7 @@ const findMatchingItemWithoutSql = (dbItem, codeComparableItems, codeItems, skip
1350
1349
  for (let i = 0; i < codeComparableItems[key].length; i++) {
1351
1350
  if (skipCodeItems[key].has(i)) continue;
1352
1351
  const { columns: codeColumns, ...codeItem } = codeComparableItems[key][i];
1353
- if (dbColumns.length === codeColumns.length && !dbColumns.some((dbColumn, i2) => !orchidCore.deepCompare(dbColumn, codeColumns[i2]))) {
1352
+ if (dbColumns.length === codeColumns.length && !dbColumns.some((dbColumn, i2) => !pqb.deepCompare(dbColumn, codeColumns[i2]))) {
1354
1353
  let a = dbItemWithoutColumns;
1355
1354
  let b = codeItem;
1356
1355
  const codeName = b.name ?? (key === "indexes" ? rakeDb.getIndexName : rakeDb.getExcludeName)(
@@ -1368,7 +1367,7 @@ const findMatchingItemWithoutSql = (dbItem, codeComparableItems, codeItems, skip
1368
1367
  if (a.language && !b.language) {
1369
1368
  b.language = config.language ?? "english";
1370
1369
  }
1371
- if (orchidCore.deepCompare(a, b)) {
1370
+ if (pqb.deepCompare(a, b)) {
1372
1371
  found.push(codeItems[key][i]);
1373
1372
  rename.push(
1374
1373
  dbItemWithoutColumns.name !== codeName ? codeName : void 0
@@ -1381,7 +1380,7 @@ const findMatchingItemWithoutSql = (dbItem, codeComparableItems, codeItems, skip
1381
1380
  includeKeys,
1382
1381
  ...codeItemWithoutKeys
1383
1382
  } = codeItem;
1384
- if (orchidCore.deepCompare(dbItemWithoutColumns, codeItemWithoutKeys)) {
1383
+ if (pqb.deepCompare(dbItemWithoutColumns, codeItemWithoutKeys)) {
1385
1384
  found.push(codeItems[key][i]);
1386
1385
  rename.push(void 0);
1387
1386
  }
@@ -1519,7 +1518,7 @@ const processForeignKeys = (config, ast, changeTables, currentSchema, tableShape
1519
1518
  for (let i = 0; i < codeForeignKeys.length; i++) {
1520
1519
  const codeForeignKey = codeForeignKeys[i];
1521
1520
  const codeReferences = codeForeignKey.references;
1522
- if (orchidCore.deepCompare(dbReferences, codeReferences)) {
1521
+ if (pqb.deepCompare(dbReferences, codeReferences)) {
1523
1522
  found = true;
1524
1523
  codeForeignKeys.splice(i, 1);
1525
1524
  const codeName = codeForeignKey.codeConstraint.name ?? rakeDb.getConstraintName(
@@ -1633,8 +1632,8 @@ const collectCodeFkeys = (config, { codeTable, changeTableAst: { shape } }, curr
1633
1632
  {
1634
1633
  ...refs,
1635
1634
  fnOrTable,
1636
- columns: config.snakeCase ? refs.columns.map(orchidCore.toSnakeCase) : refs.columns,
1637
- foreignColumns: config.snakeCase ? refs.foreignColumns.map(orchidCore.toSnakeCase) : refs.foreignColumns
1635
+ columns: config.snakeCase ? refs.columns.map(pqb.toSnakeCase) : refs.columns,
1636
+ foreignColumns: config.snakeCase ? refs.foreignColumns.map(pqb.toSnakeCase) : refs.foreignColumns
1638
1637
  },
1639
1638
  currentSchema
1640
1639
  )
@@ -1658,7 +1657,7 @@ const parseForeignKey = (config, codeConstraint, references, currentSchema) => {
1658
1657
  foreignSchema: schema ?? currentSchema,
1659
1658
  foreignTable: table,
1660
1659
  columns,
1661
- foreignColumns: config.snakeCase ? foreignColumns.map(orchidCore.toSnakeCase) : foreignColumns,
1660
+ foreignColumns: config.snakeCase ? foreignColumns.map(pqb.toSnakeCase) : foreignColumns,
1662
1661
  match: mapMatchToDb[options?.match || "SIMPLE"],
1663
1662
  onUpdate: mapActionToDb[options?.onUpdate || "NO ACTION"],
1664
1663
  onDelete: mapActionToDb[options?.onDelete || "NO ACTION"]
@@ -1777,7 +1776,7 @@ const collectCodeChecks = ({
1777
1776
  const baseName = `${codeTable.table}_${columnName}_check`;
1778
1777
  codeChecks.push(
1779
1778
  ...column.data.checks.map((check) => {
1780
- const name = check.name || orchidCore.getFreeSetAlias(names, baseName, 1);
1779
+ const name = check.name || pqb.getFreeSetAlias(names, baseName, 1);
1781
1780
  names.add(name);
1782
1781
  return {
1783
1782
  check,
@@ -1792,7 +1791,7 @@ const collectCodeChecks = ({
1792
1791
  const { check } = constraint;
1793
1792
  if (check) {
1794
1793
  const baseName = `${codeTable.table}_check`;
1795
- const name = constraint.name || orchidCore.getFreeSetAlias(names, baseName, 1);
1794
+ const name = constraint.name || pqb.getFreeSetAlias(names, baseName, 1);
1796
1795
  names.add(name);
1797
1796
  codeChecks.push({
1798
1797
  check: { sql: check, name: constraint.name },
@@ -2180,7 +2179,7 @@ const report = (ast, config, currentSchema) => {
2180
2179
  if (typeof config.log === "object" && config.log.colors === false) {
2181
2180
  green = red = yellow = pale = (s) => s;
2182
2181
  } else {
2183
- ({ green, red, yellow, pale } = orchidCore.colors);
2182
+ ({ green, red, yellow, pale } = pqb.colors);
2184
2183
  }
2185
2184
  for (const a of ast) {
2186
2185
  switch (a.type) {
@@ -2223,7 +2222,7 @@ const report = (ast, config, currentSchema) => {
2223
2222
  const value = counters[key];
2224
2223
  if (value || key === "column") {
2225
2224
  summary.push(
2226
- `${value} ${orchidCore.pluralize(key, value, key === "index" ? "es" : "s")}`
2225
+ `${value} ${pqb.pluralize(key, value, key === "index" ? "es" : "s")}`
2227
2226
  );
2228
2227
  }
2229
2228
  }
@@ -2245,7 +2244,7 @@ const report = (ast, config, currentSchema) => {
2245
2244
  snakeCase: config.snakeCase
2246
2245
  };
2247
2246
  for (const key in a.shape) {
2248
- const changes = orchidCore.toArray(a.shape[key]);
2247
+ const changes = pqb.toArray(a.shape[key]);
2249
2248
  for (const change of changes) {
2250
2249
  if (change.type === "add" || change.type === "drop") {
2251
2250
  const column = change.item;
@@ -2259,25 +2258,25 @@ const report = (ast, config, currentSchema) => {
2259
2258
  );
2260
2259
  } else if (change.type === "change") {
2261
2260
  let name = change.from.column?.data.name ?? key;
2262
- if (config.snakeCase) name = orchidCore.toCamelCase(name);
2261
+ if (config.snakeCase) name = pqb.toCamelCase(name);
2263
2262
  const changes2 = [];
2264
2263
  inner.push(`${yellow("~ change column")} ${name}:`, changes2);
2265
2264
  changes2.push(`${yellow("from")}: `);
2266
2265
  const fromCode = change.from.column.toCode(toCodeCtx, key);
2267
2266
  for (const code2 of fromCode) {
2268
- orchidCore.addCode(changes2, code2);
2267
+ pqb.addCode(changes2, code2);
2269
2268
  }
2270
2269
  changes2.push(` ${yellow("to")}: `);
2271
2270
  const toCode = change.to.column.toCode(toCodeCtx, key);
2272
2271
  for (const code2 of toCode) {
2273
- orchidCore.addCode(changes2, code2);
2272
+ pqb.addCode(changes2, code2);
2274
2273
  }
2275
2274
  } else if (change.type === "rename") {
2276
2275
  inner.push(
2277
- `${yellow("~ rename column")} ${config.snakeCase ? orchidCore.toCamelCase(key) : key} ${yellow("=>")} ${change.name}`
2276
+ `${yellow("~ rename column")} ${config.snakeCase ? pqb.toCamelCase(key) : key} ${yellow("=>")} ${change.name}`
2278
2277
  );
2279
2278
  } else {
2280
- orchidCore.exhaustive(change.type);
2279
+ pqb.exhaustive(change.type);
2281
2280
  }
2282
2281
  }
2283
2282
  }
@@ -2464,10 +2463,10 @@ const report = (ast, config, currentSchema) => {
2464
2463
  break;
2465
2464
  }
2466
2465
  default:
2467
- orchidCore.exhaustive(a);
2466
+ pqb.exhaustive(a);
2468
2467
  }
2469
2468
  }
2470
- const result = orchidCore.codeToString(code, "", " ");
2469
+ const result = pqb.codeToString(code, "", " ");
2471
2470
  config.logger.log(result);
2472
2471
  };
2473
2472
  const dbItemName = ({ schema, name }, currentSchema) => {
@@ -2768,7 +2767,7 @@ const processHasAndBelongsToManyColumn = (column, habtmTables, codeItems) => {
2768
2767
  primaryKey: void 0,
2769
2768
  default: void 0
2770
2769
  };
2771
- shape[orchidCore.toCamelCase(key)] = column2;
2770
+ shape[pqb.toCamelCase(key)] = column2;
2772
2771
  }
2773
2772
  joinTable.shape = shape;
2774
2773
  joinTable.internal = {
@@ -2795,11 +2794,11 @@ const getTableInfosAndFKeys = (asts, config) => {
2795
2794
  const fkeys = {};
2796
2795
  for (const ast of asts) {
2797
2796
  if (ast.type === "table") {
2798
- const tableKey = orchidCore.toCamelCase(ast.name);
2797
+ const tableKey = pqb.toCamelCase(ast.name);
2799
2798
  const dbTableName = ast.schema ? `${ast.schema}.${ast.name}` : ast.name;
2800
2799
  let tablePath = path.resolve(config.basePath, generateTableTo(tableKey));
2801
2800
  if (!tablePath.endsWith(".ts")) tablePath += ".ts";
2802
- const name = orchidCore.toPascalCase(ast.name);
2801
+ const name = pqb.toPascalCase(ast.name);
2803
2802
  const info = {
2804
2803
  dbTableName,
2805
2804
  key: tableKey,
@@ -2825,15 +2824,15 @@ const appCodeGenTable = (tableInfos, fkeys, ast, baseTablePath, baseTableExporte
2825
2824
  const tableInfo = tableInfos[ast.schema ? `${ast.schema}.${ast.name}` : ast.name];
2826
2825
  const imports = {
2827
2826
  "orchid-orm": "Selectable, Insertable, Updatable",
2828
- [orchidCore.getImportPath(tableInfo.path, baseTablePath)]: baseTableExportedAs
2827
+ [pqb.getImportPath(tableInfo.path, baseTablePath)]: baseTableExportedAs
2829
2828
  };
2830
2829
  const props = [];
2831
2830
  if (ast.schema) {
2832
- props.push(`schema = ${orchidCore.singleQuote(ast.schema)};`);
2831
+ props.push(`schema = ${pqb.singleQuote(ast.schema)};`);
2833
2832
  }
2834
- props.push(`readonly table = ${orchidCore.singleQuote(ast.name)};`);
2833
+ props.push(`readonly table = ${pqb.singleQuote(ast.name)};`);
2835
2834
  if (ast.comment) {
2836
- props.push(`comment = ${orchidCore.singleQuote(ast.comment)};`);
2835
+ props.push(`comment = ${pqb.singleQuote(ast.comment)};`);
2837
2836
  }
2838
2837
  if (ast.noPrimaryKey === "ignore") {
2839
2838
  props.push("noPrimaryKey = true;");
@@ -2858,12 +2857,12 @@ const appCodeGenTable = (tableInfos, fkeys, ast, baseTablePath, baseTableExporte
2858
2857
  const belongsTo = fkeys[fullTableName];
2859
2858
  if (belongsTo) {
2860
2859
  for (const { table, references } of belongsTo) {
2861
- imports[orchidCore.getImportPath(tableInfo.path, table.path)] = table.className;
2860
+ imports[pqb.getImportPath(tableInfo.path, table.path)] = table.className;
2862
2861
  relations.push(
2863
2862
  `${table.key}: this.belongsTo(() => ${table.className}, {`,
2864
2863
  [
2865
- `columns: [${references.foreignColumns.map(orchidCore.singleQuote).join(", ")}],`,
2866
- `references: [${references.columns.map(orchidCore.singleQuote).join(", ")}],`
2864
+ `columns: [${references.foreignColumns.map(pqb.singleQuote).join(", ")}],`,
2865
+ `references: [${references.columns.map(pqb.singleQuote).join(", ")}],`
2867
2866
  ],
2868
2867
  "}),"
2869
2868
  );
@@ -2873,12 +2872,12 @@ const appCodeGenTable = (tableInfos, fkeys, ast, baseTablePath, baseTableExporte
2873
2872
  for (const { references } of ast.constraints) {
2874
2873
  if (!references) continue;
2875
2874
  const table = tableInfos[references.fnOrTable];
2876
- imports[orchidCore.getImportPath(tableInfo.path, table.path)] = table.className;
2875
+ imports[pqb.getImportPath(tableInfo.path, table.path)] = table.className;
2877
2876
  relations.push(
2878
2877
  `${table.key}: this.hasMany(() => ${table.className}, {`,
2879
2878
  [
2880
- `columns: [${references.columns.map(orchidCore.singleQuote).join(", ")}],`,
2881
- `references: [${references.foreignColumns.map(orchidCore.singleQuote).join(", ")}],`
2879
+ `columns: [${references.columns.map(pqb.singleQuote).join(", ")}],`,
2880
+ `references: [${references.foreignColumns.map(pqb.singleQuote).join(", ")}],`
2882
2881
  ],
2883
2882
  "}),"
2884
2883
  );
@@ -2900,7 +2899,7 @@ export class ${className} extends ${baseTableExportedAs} {`,
2900
2899
  ];
2901
2900
  return {
2902
2901
  ...tableInfo,
2903
- content: importsCode + "\n\n" + orchidCore.codeToString(code, "", " ")
2902
+ content: importsCode + "\n\n" + pqb.codeToString(code, "", " ")
2904
2903
  };
2905
2904
  };
2906
2905
  function importsToCode(imports) {
@@ -2926,14 +2925,14 @@ const appCodeGenUpdateDbFile = async (dbPath, tables, extensions, domains, curre
2926
2925
  if (extensions.length) {
2927
2926
  code += `
2928
2927
  extensions: [${extensions.map(
2929
- (ext) => ext.version ? `{ ${orchidCore.quoteObjectKey(ext.name, false)}: '${ext.version}' }` : orchidCore.singleQuote(ext.name)
2928
+ (ext) => ext.version ? `{ ${pqb.quoteObjectKey(ext.name, false)}: '${ext.version}' }` : pqb.singleQuote(ext.name)
2930
2929
  ).join(", ")}],`;
2931
2930
  }
2932
2931
  if (domains.length) {
2933
2932
  code += `
2934
2933
  domains: {
2935
2934
  ${domains.sort((a, b) => a.name > b.name ? 1 : -1).map(
2936
- (ast) => `${orchidCore.quoteObjectKey(
2935
+ (ast) => `${pqb.quoteObjectKey(
2937
2936
  ast.schema ? `${ast.schema}.${ast.name}` : ast.name,
2938
2937
  false
2939
2938
  )}: (t) => ${ast.baseType.toCode(
@@ -3001,7 +3000,7 @@ const makeTablesListChanges = (content, statements, object, tables, dbPath) => {
3001
3000
  const tablesArr = Object.values(tables);
3002
3001
  for (let i = 0; i < tablesArr.length; i++) {
3003
3002
  const { path, className, key } = tablesArr[i];
3004
- const importPath = orchidCore.getImportPath(dbPath, path);
3003
+ const importPath = pqb.getImportPath(dbPath, path);
3005
3004
  imports += `
3006
3005
  import { ${className} } from '${importPath}';`;
3007
3006
  tablesList += `${i === 0 && prependComma ? "," : ""}
@@ -3141,7 +3140,7 @@ const pull = async (adapters, config) => {
3141
3140
  await Promise.all(
3142
3141
  pendingFileWrites.map(
3143
3142
  ([path2, content2, options]) => fs.writeFile(path2, content2, options).then(() => {
3144
- config.logger?.log(`Created ${orchidCore.pathToLog(path2)}`);
3143
+ config.logger?.log(`Created ${pqb.pathToLog(path2)}`);
3145
3144
  })
3146
3145
  )
3147
3146
  );