@tstdl/base 0.93.32 → 0.93.33

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/decorators.js CHANGED
@@ -177,7 +177,7 @@ export function ParadeIndex(options) {
177
177
  return createDecorator({ class: true, property: true }, (data, metadata) => {
178
178
  match(metadata.metadataType)
179
179
  .with('type', () => {
180
- const existing = (metadata.data.tryGet('orm') ?? {}).paradeIndex;
180
+ const existing = metadata.data.tryGet('orm')?.paradeIndex;
181
181
  const merged = merge(existing, options);
182
182
  return createTableDecorator({ paradeIndex: merged })(data.constructor);
183
183
  })
@@ -22,7 +22,7 @@ declare const getCurrentTransactionalContext: {
22
22
  export { getCurrentTransactionalContext, isInTransactionalContext, runInTransactionalContext };
23
23
  export declare abstract class Transactional<ContextData = unknown> {
24
24
  #private;
25
- readonly session: PgTransaction | Database;
25
+ readonly session: Database | PgTransaction;
26
26
  readonly isInTransaction: boolean;
27
27
  constructor();
28
28
  /**
package/orm/sqls.d.ts CHANGED
@@ -6,6 +6,8 @@ import type { Uuid } from './types.js';
6
6
  export declare const TRANSACTION_TIMESTAMP: SQL<Date>;
7
7
  /** Drizzle SQL helper for generating a random UUID (v4). Returns a Uuid string. */
8
8
  export declare const RANDOM_UUID_V4: SQL<Uuid>;
9
+ /** Drizzle SQL helper for generating a random UUID (v7). Returns a Uuid string. */
10
+ export declare const RANDOM_UUID_V7: SQL<Uuid>;
9
11
  /** Represents valid units for PostgreSQL interval values. */
10
12
  export type IntervalUnit = 'millennium' | 'millenniums' | 'millennia' | 'century' | 'centuries' | 'decade' | 'decades' | 'year' | 'years' | 'day' | 'days' | 'hour' | 'hours' | 'minute' | 'minutes' | 'second' | 'seconds' | 'millisecond' | 'milliseconds' | 'microsecond' | 'microseconds';
11
13
  export type TsHeadlineOptions = {
package/orm/sqls.js CHANGED
@@ -10,6 +10,8 @@ import { sql, Table } from 'drizzle-orm';
10
10
  export const TRANSACTION_TIMESTAMP = sql `transaction_timestamp()`;
11
11
  /** Drizzle SQL helper for generating a random UUID (v4). Returns a Uuid string. */
12
12
  export const RANDOM_UUID_V4 = sql `gen_random_uuid()`;
13
+ /** Drizzle SQL helper for generating a random UUID (v7). Returns a Uuid string. */
14
+ export const RANDOM_UUID_V7 = sql `uuidv7()`;
13
15
  export function array(values) {
14
16
  const valueString = sql.join(values, sql.raw(', '));
15
17
  return sql `ARRAY[${valueString}]`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.93.32",
3
+ "version": "0.93.33",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -143,7 +143,7 @@
143
143
  "@zxcvbn-ts/language-de": "^3.0",
144
144
  "@zxcvbn-ts/language-en": "^3.0",
145
145
  "drizzle-orm": "^0.44",
146
- "file-type": "^21.0",
146
+ "file-type": "^21.1",
147
147
  "handlebars": "^4.7",
148
148
  "minio": "^8.0",
149
149
  "mjml": "^4.16",
package/test1.js CHANGED
@@ -1,4 +1,6 @@
1
1
  import './polyfills.js';
2
+ import { AiService } from './ai/ai.service.js';
3
+ import { configureAiService } from './ai/module.js';
2
4
  import { Application, provideInitializer, provideModule, provideSignalHandler } from './application/index.js';
3
5
  import { migrateAuditSchema } from './audit/index.js';
4
6
  import { configureAuthenticationServer } from './authentication/server/module.js';
@@ -23,6 +25,13 @@ const config = {
23
25
  };
24
26
  async function bootstrap() {
25
27
  const injector = inject(Injector);
28
+ configureAiService({
29
+ vertex: {
30
+ project: '922353391551', // insolytics-application
31
+ location: 'europe-west3',
32
+ },
33
+ keyFile: '/home/patrick/.secret-files/insolytics-application-service-key.json',
34
+ });
26
35
  configureOrm({
27
36
  repositoryConfig: {
28
37
  schema: 'test',
@@ -51,6 +60,18 @@ async function bootstrap() {
51
60
  }
52
61
  async function main(_cancellationSignal) {
53
62
  const repository = injectRepository(Test);
63
+ const aiService = inject(AiService);
64
+ const aiResult = await aiService.generate({
65
+ contents: [{
66
+ role: 'user',
67
+ parts: [
68
+ { text: 'asd' },
69
+ ],
70
+ }],
71
+ });
72
+ console.log('AI Result:', aiResult);
73
+ if (1 + 1 == 2)
74
+ process.exit(0);
54
75
  if (await repository.count() == 0) {
55
76
  await repository.insertMany(testData);
56
77
  }
@@ -58,7 +79,7 @@ async function main(_cancellationSignal) {
58
79
  const benchmarkResult = await timedBenchmarkAsync(1000, async () => {
59
80
  result = await repository.search({
60
81
  query: {
61
- $parade: { fields: ['content'], query: 'vitamins' },
82
+ $parade: { fields: ['content'], query: 'vitumins', distance: 2 },
62
83
  },
63
84
  highlight: { source: 'content', includePositions: true },
64
85
  score: true,