@tstdl/base 0.93.43 → 0.93.44

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/orm/sqls.d.ts CHANGED
@@ -60,8 +60,8 @@ export type TsHeadlineOptions = {
60
60
  */
61
61
  fragmentDelimiter?: string;
62
62
  };
63
- export declare function enumValue<T extends EnumerationObject>(enumeration: T, dbEnum: PgEnumFromEnumeration<T>, value: EnumerationValue<T>): SQL<string>;
64
- export declare function singleReferenceCheck<T extends EnumerationObject>(enumeration: T, dbEnum: PgEnumFromEnumeration<T>, discriminator: Column, columns: Column[], columnMapping: Record<EnumerationValue<T>, Column | null>): SQL;
63
+ export declare function enumValue<T extends EnumerationObject>(enumeration: T, dbEnum: PgEnumFromEnumeration<T> | string | null, value: EnumerationValue<T>): SQL<string>;
64
+ export declare function singleReferenceCheck<T extends EnumerationObject>(enumeration: T, dbEnum: PgEnumFromEnumeration<T> | string | null, discriminator: Column, columns: Column[], columnMapping: Record<EnumerationValue<T>, Column | null>): SQL;
65
65
  export declare function array<T>(values: SQL<T>[]): SQL<T[]>;
66
66
  export declare function array<T = unknown>(values: SQLChunk[]): SQL<T[]>;
67
67
  export declare function autoAlias<T>(column: AnyColumn<{
package/orm/sqls.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { objectEntries } from '../utils/object/object.js';
2
- import { assertDefined, isDefined, isNotNull, isNumber, isString } from '../utils/type-guards.js';
2
+ import { assertDefined, isDefined, isNotNull, isNull, isNumber, isString } from '../utils/type-guards.js';
3
3
  import { and, eq, sql, Table } from 'drizzle-orm';
4
4
  import { getEnumName } from './enums.js';
5
5
  /** Drizzle SQL helper for getting the current transaction's timestamp. Returns a Date object. */
@@ -9,9 +9,13 @@ export const RANDOM_UUID_V4 = sql `gen_random_uuid()`;
9
9
  /** Drizzle SQL helper for generating a random UUID (v7). Returns a Uuid string. */
10
10
  export const RANDOM_UUID_V7 = sql `uuidv7()`;
11
11
  export function enumValue(enumeration, dbEnum, value) {
12
- const enumName = getEnumName(enumeration);
13
- assertDefined(enumName, 'Enumeration is not registered.');
14
- return sql `'${sql.raw(String(value))}'::${dbEnum}`;
12
+ if (isNull(dbEnum)) {
13
+ const enumName = getEnumName(enumeration);
14
+ assertDefined(enumName, 'Enumeration is not registered.');
15
+ return enumValue(enumeration, enumName, value);
16
+ }
17
+ const enumType = isString(dbEnum) ? sql `"${sql.raw(dbEnum)}"` : dbEnum;
18
+ return sql `'${sql.raw(String(value))}'::${enumType}`;
15
19
  }
16
20
  export function singleReferenceCheck(enumeration, dbEnum, discriminator, columns, columnMapping) {
17
21
  const whens = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.93.43",
3
+ "version": "0.93.44",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -136,7 +136,7 @@
136
136
  },
137
137
  "peerDependencies": {
138
138
  "@google-cloud/storage": "^7.17",
139
- "@google/genai": "^1.29",
139
+ "@google/genai": "^1.30",
140
140
  "@tstdl/angular": "^0.93",
141
141
  "@zxcvbn-ts/core": "^3.0",
142
142
  "@zxcvbn-ts/language-common": "^3.0",
@@ -146,7 +146,7 @@
146
146
  "file-type": "^21.1",
147
147
  "handlebars": "^4.7",
148
148
  "minio": "^8.0",
149
- "mjml": "^4.16",
149
+ "mjml": "^4.17",
150
150
  "nodemailer": "^7.0",
151
151
  "pg": "^8.16",
152
152
  "playwright": "^1.56",
@@ -162,7 +162,7 @@
162
162
  }
163
163
  },
164
164
  "devDependencies": {
165
- "@stylistic/eslint-plugin": "5.5",
165
+ "@stylistic/eslint-plugin": "5.6",
166
166
  "@types/koa__router": "12.0",
167
167
  "@types/luxon": "3.7",
168
168
  "@types/mjml": "4.7",
@@ -178,7 +178,7 @@
178
178
  "typedoc-plugin-markdown": "4.9",
179
179
  "typedoc-plugin-missing-exports": "4.1",
180
180
  "typescript": "5.9",
181
- "typescript-eslint": "8.46"
181
+ "typescript-eslint": "8.47"
182
182
  },
183
183
  "overrides": {
184
184
  "drizzle-kit": {