relq 1.0.3 → 1.0.4

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.
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.requireInit = exports.progressBar = exports.formatDuration = exports.formatBytes = exports.select = exports.confirm = exports.success = exports.hint = exports.warning = exports.error = exports.fatal = exports.createSpinner = exports.colors = void 0;
36
+ exports.requireInit = exports.progressBar = exports.formatDuration = exports.formatBytes = exports.select = exports.success = exports.hint = exports.warning = exports.error = exports.fatal = exports.createSpinner = exports.colors = void 0;
37
37
  exports.info = info;
38
38
  exports.getWorkingTreeStatus = getWorkingTreeStatus;
39
39
  exports.requireRepository = requireRepository;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.success = exports.confirm = exports.requireInit = exports.hint = exports.warning = exports.error = exports.fatal = exports.formatDuration = exports.formatBytes = exports.progressBar = exports.createSpinner = exports.colors = void 0;
3
+ exports.success = exports.requireInit = exports.hint = exports.warning = exports.error = exports.fatal = exports.formatDuration = exports.formatBytes = exports.progressBar = exports.createSpinner = exports.colors = void 0;
4
4
  var cli_utils_1 = require("./cli-utils.cjs");
5
5
  Object.defineProperty(exports, "colors", { enumerable: true, get: function () { return cli_utils_1.colors; } });
6
6
  Object.defineProperty(exports, "createSpinner", { enumerable: true, get: function () { return cli_utils_1.createSpinner; } });
@@ -107,6 +107,13 @@ function quoteColumnRef(name) {
107
107
  }
108
108
  return name;
109
109
  }
110
+ function normalizePgType(pgType) {
111
+ if (pgType.startsWith('_')) {
112
+ const baseType = pgType.slice(1);
113
+ return `${baseType}[]`;
114
+ }
115
+ return pgType;
116
+ }
110
117
  function generateExtensionSQL(extensionName) {
111
118
  const quotedName = extensionName.includes('-') ? `"${extensionName}"` : extensionName;
112
119
  return `CREATE EXTENSION IF NOT EXISTS ${quotedName};`;
@@ -212,7 +219,8 @@ function generateTableSQL(table, options = {}) {
212
219
  }
213
220
  function generateColumnSQL(col) {
214
221
  const parts = [];
215
- parts.push(`${quoteIdentifier(col.name).padEnd(28)}${col.dataType}`);
222
+ const normalizedType = normalizePgType(col.dataType);
223
+ parts.push(`${quoteIdentifier(col.name).padEnd(28)}${normalizedType}`);
216
224
  if (col.dataType.endsWith('[]')) {
217
225
  }
218
226
  if (col.isGenerated && col.generationExpression) {
package/dist/config.d.ts CHANGED
@@ -642,5 +642,24 @@ export declare function validateConfig(config: RelqConfig): {
642
642
  valid: boolean;
643
643
  errors: string[];
644
644
  };
645
+ interface Blob$1 extends BunConsumerConvenienceMethods {
646
+ // We have to specify bytes again even though it comes from
647
+ // BunConsumerConvenienceMethods, because inheritance in TypeScript is
648
+ // slightly different from just "copying in the methods" (the difference is
649
+ // related to how type parameters are resolved)
650
+ bytes(): Promise<Uint8Array<ArrayBuffer>>;
651
+ /**
652
+ * Consume the blob as a FormData instance
653
+ */
654
+ formData(): Promise<FormData>;
655
+ /**
656
+ * Consume the blob as an ArrayBuffer
657
+ */
658
+ arrayBuffer(): Promise<ArrayBuffer>;
659
+ /**
660
+ * Returns a readable stream of the blob's contents
661
+ */
662
+ stream(): ReadableStream<Uint8Array<ArrayBuffer>>;
663
+ }
645
664
 
646
665
  export {};
@@ -91,6 +91,13 @@ function quoteColumnRef(name) {
91
91
  }
92
92
  return name;
93
93
  }
94
+ function normalizePgType(pgType) {
95
+ if (pgType.startsWith('_')) {
96
+ const baseType = pgType.slice(1);
97
+ return `${baseType}[]`;
98
+ }
99
+ return pgType;
100
+ }
94
101
  export function generateExtensionSQL(extensionName) {
95
102
  const quotedName = extensionName.includes('-') ? `"${extensionName}"` : extensionName;
96
103
  return `CREATE EXTENSION IF NOT EXISTS ${quotedName};`;
@@ -196,7 +203,8 @@ export function generateTableSQL(table, options = {}) {
196
203
  }
197
204
  function generateColumnSQL(col) {
198
205
  const parts = [];
199
- parts.push(`${quoteIdentifier(col.name).padEnd(28)}${col.dataType}`);
206
+ const normalizedType = normalizePgType(col.dataType);
207
+ parts.push(`${quoteIdentifier(col.name).padEnd(28)}${normalizedType}`);
200
208
  if (col.dataType.endsWith('[]')) {
201
209
  }
202
210
  if (col.isGenerated && col.generationExpression) {
@@ -886,7 +886,8 @@ export declare const enumType: <T extends string>(name: string, values: readonly
886
886
  };
887
887
  /** @deprecated Use pgComposite() instead for better type inference */
888
888
  export declare const compositeType: <T>(typeName: string, columnName?: string) => ColumnBuilder<T, ColumnConfig<T>>;
889
- declare const SQL_BRAND: unique symbol;
889
+ /** SQL expression brand - marks a value as SQL expression for runtime detection */
890
+ export declare const SQL_BRAND: unique symbol;
890
891
  export type SqlExpression<T> = T & {
891
892
  readonly [SQL_BRAND]: true;
892
893
  readonly $sql: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "relq",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "The Fully-Typed PostgreSQL ORM for TypeScript",
5
5
  "author": "Olajide Mathew O. <olajide.mathew@yuniq.solutions>",
6
6
  "license": "MIT",