relq 1.0.10 → 1.0.12

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.
@@ -346,10 +346,9 @@ var require_postgres_interval = __commonJS((exports2, module2) => {
346
346
 
347
347
  // node_modules/postgres-bytea/index.js
348
348
  var require_postgres_bytea = __commonJS((exports2, module2) => {
349
- var bufferFrom = Buffer.from || Buffer;
350
349
  module2.exports = function parseBytea(input) {
351
350
  if (/^\\x/.test(input)) {
352
- return bufferFrom(input.substr(2), "hex");
351
+ return new Buffer(input.substr(2), "hex");
353
352
  }
354
353
  var output = "";
355
354
  var i = 0;
@@ -373,7 +372,7 @@ var require_postgres_bytea = __commonJS((exports2, module2) => {
373
372
  }
374
373
  }
375
374
  }
376
- return bufferFrom(output, "binary");
375
+ return new Buffer(output, "binary");
377
376
  };
378
377
  });
379
378
 
@@ -346,10 +346,9 @@ var require_postgres_interval = __commonJS((exports2, module2) => {
346
346
 
347
347
  // node_modules/postgres-bytea/index.js
348
348
  var require_postgres_bytea = __commonJS((exports2, module2) => {
349
- var bufferFrom = Buffer.from || Buffer;
350
349
  module2.exports = function parseBytea(input) {
351
350
  if (/^\\x/.test(input)) {
352
- return bufferFrom(input.substr(2), "hex");
351
+ return new Buffer(input.substr(2), "hex");
353
352
  }
354
353
  var output = "";
355
354
  var i = 0;
@@ -373,7 +372,7 @@ var require_postgres_bytea = __commonJS((exports2, module2) => {
373
372
  }
374
373
  }
375
374
  }
376
- return bufferFrom(output, "binary");
375
+ return new Buffer(output, "binary");
377
376
  };
378
377
  });
379
378
 
@@ -393,3 +393,7 @@ async function main() {
393
393
  process.exit(1);
394
394
  }
395
395
  }
396
+ const fromDev = process.argv.filter(arg => arg.endsWith('index.ts')).length > 0;
397
+ if (fromDev) {
398
+ main().catch(console.error);
399
+ }
@@ -42,6 +42,7 @@ exports.getSchemaPath = getSchemaPath;
42
42
  exports.requireValidConfig = requireValidConfig;
43
43
  exports.requireValidSchema = requireValidSchema;
44
44
  const config_1 = require("../../config/config.cjs");
45
+ const cli_utils_1 = require("./cli-utils.cjs");
45
46
  const env_loader_1 = require("./env-loader.cjs");
46
47
  const fs = __importStar(require("fs"));
47
48
  const path = __importStar(require("path"));
@@ -116,9 +117,10 @@ function validateConfig(config) {
116
117
  }
117
118
  return errors;
118
119
  }
119
- function getSchemaPath(config, defaultPath = './db/schema.ts') {
120
- if (!config)
121
- return defaultPath;
120
+ function getSchemaPath(config) {
121
+ if (!config) {
122
+ return (0, cli_utils_1.fatal)('Configuration is required', 'Schema path must be defined in relq.config.ts');
123
+ }
122
124
  if (typeof config.schema === 'string' && config.schema.length > 0) {
123
125
  return config.schema;
124
126
  }
@@ -131,7 +133,7 @@ function getSchemaPath(config, defaultPath = './db/schema.ts') {
131
133
  if (config.typeGeneration?.output) {
132
134
  return config.typeGeneration.output;
133
135
  }
134
- return defaultPath;
136
+ return (0, cli_utils_1.fatal)('Schema path not configured', "Add schema: './path/to/schema.ts' to relq.config.ts");
135
137
  }
136
138
  async function requireValidConfig(config, options) {
137
139
  const errors = validateConfig(config);
@@ -333,10 +333,9 @@ var require_postgres_interval = __commonJS((exports, module) => {
333
333
 
334
334
  // node_modules/postgres-bytea/index.js
335
335
  var require_postgres_bytea = __commonJS((exports, module) => {
336
- var bufferFrom = Buffer.from || Buffer;
337
336
  module.exports = function parseBytea(input) {
338
337
  if (/^\\x/.test(input)) {
339
- return bufferFrom(input.substr(2), "hex");
338
+ return new Buffer(input.substr(2), "hex");
340
339
  }
341
340
  var output = "";
342
341
  var i = 0;
@@ -360,7 +359,7 @@ var require_postgres_bytea = __commonJS((exports, module) => {
360
359
  }
361
360
  }
362
361
  }
363
- return bufferFrom(output, "binary");
362
+ return new Buffer(output, "binary");
364
363
  };
365
364
  });
366
365
 
@@ -324,10 +324,9 @@ var require_postgres_interval = __commonJS((exports, module) => {
324
324
 
325
325
  // node_modules/postgres-bytea/index.js
326
326
  var require_postgres_bytea = __commonJS((exports, module) => {
327
- var bufferFrom = Buffer.from || Buffer;
328
327
  module.exports = function parseBytea(input) {
329
328
  if (/^\\x/.test(input)) {
330
- return bufferFrom(input.substr(2), "hex");
329
+ return new Buffer(input.substr(2), "hex");
331
330
  }
332
331
  var output = "";
333
332
  var i = 0;
@@ -351,7 +350,7 @@ var require_postgres_bytea = __commonJS((exports, module) => {
351
350
  }
352
351
  }
353
352
  }
354
- return bufferFrom(output, "binary");
353
+ return new Buffer(output, "binary");
355
354
  };
356
355
  });
357
356
 
@@ -358,3 +358,7 @@ async function main() {
358
358
  }
359
359
  }
360
360
  export { main };
361
+ const fromDev = process.argv.filter(arg => arg.endsWith('index.ts')).length > 0;
362
+ if (fromDev) {
363
+ main().catch(console.error);
364
+ }
@@ -1,4 +1,5 @@
1
1
  import { loadConfig as baseLoadConfig } from "../../config/config.js";
2
+ import { fatal } from "./cli-utils.js";
2
3
  import { loadEnvConfig } from "./env-loader.js";
3
4
  import * as fs from 'fs';
4
5
  import * as path from 'path';
@@ -73,9 +74,10 @@ export function validateConfig(config) {
73
74
  }
74
75
  return errors;
75
76
  }
76
- export function getSchemaPath(config, defaultPath = './db/schema.ts') {
77
- if (!config)
78
- return defaultPath;
77
+ export function getSchemaPath(config) {
78
+ if (!config) {
79
+ return fatal('Configuration is required', 'Schema path must be defined in relq.config.ts');
80
+ }
79
81
  if (typeof config.schema === 'string' && config.schema.length > 0) {
80
82
  return config.schema;
81
83
  }
@@ -88,7 +90,7 @@ export function getSchemaPath(config, defaultPath = './db/schema.ts') {
88
90
  if (config.typeGeneration?.output) {
89
91
  return config.typeGeneration.output;
90
92
  }
91
- return defaultPath;
93
+ return fatal('Schema path not configured', "Add schema: './path/to/schema.ts' to relq.config.ts");
92
94
  }
93
95
  export async function requireValidConfig(config, options) {
94
96
  const errors = validateConfig(config);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "relq",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "The Fully-Typed PostgreSQL ORM for TypeScript",
5
5
  "author": "Olajide Mathew O. <olajide.mathew@yuniq.solutions>",
6
6
  "license": "MIT",