@vrplatform/kysely 1.2.25 → 1.2.27

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/build/.data.tar CHANGED
Binary file
@@ -1,16 +1,19 @@
1
- import { Kysely as K } from 'kysely';
1
+ import { Kysely as K, type Transaction as T } from 'kysely';
2
2
  import postgres, { type Sql } from 'postgres';
3
3
  export type { ColumnType, Expression, ExpressionBuilder, ExpressionOrFactory, Generated, Insertable, JSONColumnType, OperandExpression, Selectable, SqlBool, Updateable, } from 'kysely';
4
4
  export * from './v1.generated';
5
5
  import type { DB } from './v1.generated';
6
+ export type Transaction = T<DB>;
6
7
  export { sql } from 'kysely';
7
8
  export type Kysely = K<DB>;
8
9
  export type Postgres = Sql;
9
- export declare function useKysely(postgres: Sql): K<DB>;
10
+ export declare function useKysely(postgres: Sql, options?: {
11
+ log?: boolean;
12
+ }): K<DB>;
10
13
  export declare function useAsyncPostgres(connectionString: string, ssl?: boolean, retries?: number, delayMs?: number): Promise<postgres.Sql<{}>>;
11
14
  export declare function useAsyncKysely(connectionString: string, ssl?: boolean): Promise<K<DB>>;
12
- export declare function usePostgres(connectionString: string, ssl?: boolean): postgres.Sql<{}>;
13
- export declare function forceCloseAllPostgres(): Promise<void>;
15
+ export declare function usePostgres(connectionString?: string, ssl?: boolean): postgres.Sql<{}>;
16
+ export declare function forceCloseAllPostgres(timeoutMs?: number): Promise<(void | undefined)[]>;
14
17
  export declare class DatabaseError extends Error {
15
18
  constructor(message: string, cause: any);
16
19
  }
@@ -32,12 +32,13 @@ __exportStar(require("./v1.generated"), exports);
32
32
  const node_path_1 = require("node:path");
33
33
  var kysely_2 = require("kysely");
34
34
  Object.defineProperty(exports, "sql", { enumerable: true, get: function () { return kysely_2.sql; } });
35
- function useKysely(postgres) {
35
+ function useKysely(postgres, options = {}) {
36
36
  return new kysely_1.Kysely({
37
37
  dialect: new kysely_postgres_js_1.PostgresJSDialect({
38
38
  postgres,
39
39
  }),
40
40
  plugins: [new kysely_1.CamelCasePlugin()],
41
+ log: options?.log ? ['query', 'error'] : undefined,
41
42
  });
42
43
  }
43
44
  async function useAsyncPostgres(connectionString, ssl, retries = 5, delayMs = 2500) {
@@ -65,14 +66,16 @@ async function useAsyncKysely(connectionString, ssl) {
65
66
  }
66
67
  const connections = [];
67
68
  function usePostgres(connectionString, ssl) {
69
+ if (!connectionString)
70
+ throw new Error('No connection string');
68
71
  const pg = (0, postgres_1.default)(connectionString, {
69
72
  ssl: ssl ? 'require' : false,
70
73
  });
71
74
  connections.push(pg);
72
75
  return pg;
73
76
  }
74
- async function forceCloseAllPostgres() {
75
- await Promise.all(connections.map((pg) => pg.end().catch(() => undefined)));
77
+ async function forceCloseAllPostgres(timeoutMs = 5000) {
78
+ return await Promise.all(connections.map((pg) => pg.end({ timeout: timeoutMs }).catch(() => undefined)));
76
79
  }
77
80
  class DatabaseError extends Error {
78
81
  constructor(message, cause) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"src/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AA2BA,8BAOC;AAED,4CA0BC;AAED,wCAGC;AAGD,kCAMC;AAED,sDAEC;AAYD,8BA+BC;AA3HD,4CAAkD;AAClD,mCAAsD;AACtD,2DAAuD;AACvD,wDAA8C;AAe9C,iDAA+B;AAE/B,yCAA2C;AAG3C,iCAA6B;AAApB,6FAAA,GAAG,OAAA;AAIZ,SAAgB,SAAS,CAAC,QAAa;IACrC,OAAO,IAAI,eAAC,CAAK;QACf,OAAO,EAAE,IAAI,sCAAiB,CAAC;YAC7B,QAAQ;SACT,CAAC;QACF,OAAO,EAAE,CAAC,IAAI,wBAAe,EAAE,CAAC;KACjC,CAAC,CAAC;AACL,CAAC;AAEM,KAAK,UAAU,gBAAgB,CACpC,gBAAwB,EACxB,GAAa,EACb,OAAO,GAAG,CAAC,EACX,OAAO,GAAG,IAAI;IAEd,KAAK,IAAI,OAAO,GAAG,CAAC,E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AC,GAAG,CACT,IAAI,SAAS,qBAAqB,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,IAAI,CAC1E,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,IAAI,KAAK;YAAE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;;YAC5C,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;QAC3B,mBAAmB;QACnB,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC;QAC1B,MAAM,UAAU,GAAG,IAAA,sBAAc,EAAC,CAAC,CAAC,CAAC;QACrC,OAAO,UAAU,CAAC,KAAK,CAAC;QACxB,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC;QACzB,OAAO,CAAC,KAAK,CAAC,qBAAqB,SAAS,EAAE,EAAE,IAAA,sBAAc,EAAC,KAAK,CAAC,CAAC,CAAC;QACvE,OAAO,CAAC,GAAG,CACT,IAAI,SAAS,qBAAqB,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,IAAI,CAC1E,CAAC;QACF,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import { serializeError } from '@finalytic/utils';\nimport { CamelCasePlugin, Kysely as K } from 'kysely';\nimport { PostgresJSDialect } from 'kysely-postgres-js';\nimport postgres, { type Sql } from 'postgres';\n\nexport type {\n ColumnType,\n Expression,\n ExpressionBuilder,\n ExpressionOrFactory,\n Generated,\n Insertable,\n JSONColumnType,\n OperandExpression,\n Selectable,\n SqlBool,\n Updateable,\n} from 'kysely';\nexport * from './v1.generated';\n\nimport { join, relative } from 'node:path';\nimport type { DB } from './v1.generated';\n\nexport { sql } from 'kysely';\n\nexport type Kysely = K<DB>;\nexport type Postgres = Sql;\nexport function useKysely(postgres: Sql) {\n return new K<DB>({\n dialect: new PostgresJSDialect({\n postgres,\n }),\n plugins: [new CamelCasePlugin()],\n });\n}\n\nexport async function useAsyncPostgres(\n connectionString: string,\n ssl?: boolean,\n retries = 5,\n delayMs = 2500\n) {\n for (let attempt = 1; attempt <= retries; attempt++) {\n try {\n const sql = postgres(connectionString, {\n ssl: ssl ? 'require' : false,\n });\n\n await sql`select 1`;\n\n connections.push(sql);\n\n return sql;\n } catch (err) {\n if (attempt === retries) throw err;\n console.warn(\n `Postgres connection failed (attempt ${attempt}), retrying...`\n );\n await new Promise((res) => setTimeout(res, delayMs));\n }\n }\n throw new Error('Unable to connect to Postgres');\n}\n\nexport async function useAsyncKysely(connectionString: string, ssl?: boolean) {\n const sql = await useAsyncPostgres(connectionString, ssl);\n return useKysely(sql);\n}\n\nconst connections: postgres.Sql<any>[] = [];\nexport function usePostgres(connectionString: string, ssl?: boolean) {\n const pg = postgres(connectionString, {\n ssl: ssl ? 'require' : false,\n });\n connections.push(pg);\n return pg;\n}\n\nexport async function forceCloseAllPostgres() {\n await Promise.all(connections.map((pg) => pg.end().catch(() => undefined)));\n}\n\nexport class DatabaseError extends Error {\n constructor(message: string, cause: any) {\n super(message);\n this.cause = cause;\n }\n}\n\nconst dirname =\n typeof __dirname === 'string' ? join(__dirname, '../../..') : '';\n\nexport async function withStack<T>(a: Promise<T>) {\n // skip if we can't get the stack, probably in a worker\n if (!dirname) return await a;\n\n const now = performance.now();\n const error = new DatabaseError('Error in execute', undefined);\n const stack = error.stack?.split('\\n').slice(3) || undefined;\n const firstLine =\n stack?.length && stack[0]?.includes('(') && dirname\n ? relative(dirname, stack[0].split('(')[1].split(')')[0])\n : undefined;\n try {\n const result = await a;\n console.log(\n `[${firstLine}] Execution time: ${Math.round(performance.now() - now)}ms`\n );\n return result;\n } catch (e: any) {\n if (stack) error.stack = stack.join('\\n').trim();\n else error.stack = e.stack;\n // error.cause = e;\n error.message = e.message;\n const serialized = serializeError(e);\n delete serialized.stack;\n error.cause = serialized;\n console.error(`Error in execute: ${firstLine}`, serializeError(error));\n console.log(\n `[${firstLine}] Execution time: ${Math.round(performance.now() - now)}ms`\n );\n throw error;\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"src/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AA4BA,8BAQC;AAED,4CA0BC;AAED,wCAGC;AAGD,kCAOC;AAED,sDAMC;AAYD,8BA+BC;AAlID,4CAAkD;AAClD,mCAA6E;AAC7E,2DAAuD;AACvD,wDAA8C;AAe9C,iDAA+B;AAE/B,yCAA2C;AAI3C,iCAA6B;AAApB,6FAAA,GAAG,OAAA;AAIZ,SAAgB,SAAS,CAAC,QAAa,EAAE,UAA6B,EAAE;IACtE,OAAO,IAAI,eAAC,CAAK;QACf,OAAO,EAAE,IAAI,sCAAiB,CAAC;YAC7B,QAAQ;SACT,CAAC;QACF,OAAO,EAAE,CAAC,IAAI,wBAAe,EAAE,CAAC;QAChC,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS;KACnD,CAAC,CAAC;AACL,CAAC;AAEM,KAAK,UAAU,gBAAgB,CACpC,gBAAwB,EACxB,GAAa,EACb,OAAO,GAAG,CAAC,EACX,OAAO,GAAG,IAAI;IAEd,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC;QACpD,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,IAAA,kBAAQ,EAAC,gBAAgB,EAAE;gBACrC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK;aAC7B,CAAC,CAAC;YAEH,MAAM,GAAG,CAAA,UAAU,CAAC;YAEpB,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAEtB,OAAO,GAAG,CAAC;QACb,CAAC;QAAC,OAA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KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;;YAC5C,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;QAC3B,mBAAmB;QACnB,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC;QAC1B,MAAM,UAAU,GAAG,IAAA,sBAAc,EAAC,CAAC,CAAC,CAAC;QACrC,OAAO,UAAU,CAAC,KAAK,CAAC;QACxB,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC;QACzB,OAAO,CAAC,KAAK,CAAC,qBAAqB,SAAS,EAAE,EAAE,IAAA,sBAAc,EAAC,KAAK,CAAC,CAAC,CAAC;QACvE,OAAO,CAAC,GAAG,CACT,IAAI,SAAS,qBAAqB,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,IAAI,CAC1E,CAAC;QACF,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import { serializeError } from '@finalytic/utils';\nimport { CamelCasePlugin, Kysely as K, type Transaction as T } from 'kysely';\nimport { PostgresJSDialect } from 'kysely-postgres-js';\nimport postgres, { type Sql } from 'postgres';\n\nexport type {\n ColumnType,\n Expression,\n ExpressionBuilder,\n ExpressionOrFactory,\n Generated,\n Insertable,\n JSONColumnType,\n OperandExpression,\n Selectable,\n SqlBool,\n Updateable,\n} from 'kysely';\nexport * from './v1.generated';\n\nimport { join, relative } from 'node:path';\nimport type { DB } from './v1.generated';\n\nexport type Transaction = T<DB>;\nexport { sql } from 'kysely';\n\nexport type Kysely = K<DB>;\nexport type Postgres = Sql;\nexport function useKysely(postgres: Sql, options: { log?: boolean } = {}) {\n return new K<DB>({\n dialect: new PostgresJSDialect({\n postgres,\n }),\n plugins: [new CamelCasePlugin()],\n log: options?.log ? ['query', 'error'] : undefined,\n });\n}\n\nexport async function useAsyncPostgres(\n connectionString: string,\n ssl?: boolean,\n retries = 5,\n delayMs = 2500\n) {\n for (let attempt = 1; attempt <= retries; attempt++) {\n try {\n const sql = postgres(connectionString, {\n ssl: ssl ? 'require' : false,\n });\n\n await sql`select 1`;\n\n connections.push(sql);\n\n return sql;\n } catch (err) {\n if (attempt === retries) throw err;\n console.warn(\n `Postgres connection failed (attempt ${attempt}), retrying...`\n );\n await new Promise((res) => setTimeout(res, delayMs));\n }\n }\n throw new Error('Unable to connect to Postgres');\n}\n\nexport async function useAsyncKysely(connectionString: string, ssl?: boolean) {\n const sql = await useAsyncPostgres(connectionString, ssl);\n return useKysely(sql);\n}\n\nconst connections: postgres.Sql<any>[] = [];\nexport function usePostgres(connectionString?: string, ssl?: boolean) {\n if (!connectionString) throw new Error('No connection string');\n const pg = postgres(connectionString, {\n ssl: ssl ? 'require' : false,\n });\n connections.push(pg);\n return pg;\n}\n\nexport async function forceCloseAllPostgres(timeoutMs = 5000) {\n return await Promise.all(\n connections.map((pg) =>\n pg.end({ timeout: timeoutMs }).catch(() => undefined)\n )\n );\n}\n\nexport class DatabaseError extends Error {\n constructor(message: string, cause: any) {\n super(message);\n this.cause = cause;\n }\n}\n\nconst dirname =\n typeof __dirname === 'string' ? join(__dirname, '../../..') : '';\n\nexport async function withStack<T>(a: Promise<T>) {\n // skip if we can't get the stack, probably in a worker\n if (!dirname) return await a;\n\n const now = performance.now();\n const error = new DatabaseError('Error in execute', undefined);\n const stack = error.stack?.split('\\n').slice(3) || undefined;\n const firstLine =\n stack?.length && stack[0]?.includes('(') && dirname\n ? relative(dirname, stack[0].split('(')[1].split(')')[0])\n : undefined;\n try {\n const result = await a;\n console.log(\n `[${firstLine}] Execution time: ${Math.round(performance.now() - now)}ms`\n );\n return result;\n } catch (e: any) {\n if (stack) error.stack = stack.join('\\n').trim();\n else error.stack = e.stack;\n // error.cause = e;\n error.message = e.message;\n const serialized = serializeError(e);\n delete serialized.stack;\n error.cause = serialized;\n console.error(`Error in execute: ${firstLine}`, serializeError(error));\n console.log(\n `[${firstLine}] Execution time: ${Math.round(performance.now() - now)}ms`\n );\n throw error;\n }\n}\n"]}
@@ -68,7 +68,10 @@ async function migrateKysely(kysely) {
68
68
  }),
69
69
  });
70
70
  console.log('migrating kysely ....');
71
- const { error, results } = await migrator.migrateToLatest();
71
+ const { error, results } = await migrator.migrateToLatest().catch(() => {
72
+ console.error('failed to migrate');
73
+ process.exit(1);
74
+ });
72
75
  for (const it of results ?? []) {
73
76
  if (it.status === 'Success') {
74
77
  console.log(`migration "${it.migrationName}" was executed successfully`);
@@ -85,26 +88,44 @@ async function migrateKysely(kysely) {
85
88
  }
86
89
  const dumpPath = (0, node_path_1.join)(root, '.data.tar');
87
90
  const dumpFile = (async () => {
88
- const dataExists = await (0, promises_1.exists)(dumpPath);
91
+ const dataExists = await (0, promises_1.exists)(dumpPath).catch(() => false);
89
92
  if (!dataExists) {
90
93
  console.log('Creating initial dump');
91
94
  const main = new pglite_1.PGlite();
92
- await migrate(main);
95
+ await migrate(main).catch(async (err) => {
96
+ console.error('failed to migrate initial dump');
97
+ await Bun.write('../logs/migrate-initial-dump.json', JSON.stringify(err, null, 2));
98
+ process.exit(1);
99
+ });
93
100
  const { dialect } = new kysely_pglite_1.KyselyPGlite(main);
94
101
  const kysely = new kysely_1.Kysely({
95
102
  dialect,
96
103
  plugins: [new kysely_1.CamelCasePlugin()],
97
104
  });
98
- await migrateKysely(kysely);
99
- await kysely_codegen_1.default.generate({
105
+ await migrateKysely(kysely).catch(() => {
106
+ console.error('failed to migrate kysely');
107
+ process.exit(1);
108
+ });
109
+ await kysely_codegen_1.default
110
+ .generate({
100
111
  db: kysely,
101
112
  outFile: path.join(root, 'src/v1.generated.ts'),
102
113
  defaultSchemas: ['xxx'],
103
114
  camelCase: true,
104
115
  dialect: kysely_codegen_1.default.getDialect('postgres'),
116
+ })
117
+ .catch(() => {
118
+ console.error('failed to generate kysely');
119
+ process.exit(1);
120
+ });
121
+ const content = await main.dumpDataDir('none').catch(() => {
122
+ console.error('failed to dump data');
123
+ process.exit(1);
124
+ });
125
+ await Bun.write(dumpPath, content).catch(() => {
126
+ console.error('failed to write dump');
127
+ process.exit(1);
105
128
  });
106
- const content = await main.dumpDataDir('none');
107
- await Bun.write(dumpPath, content);
108
129
  return content;
109
130
  }
110
131
  return Bun.file(dumpPath);
@@ -1 +1 @@
1
- {"version":3,"file":"local.js","sourceRoot":"src/","sources":["local.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoFA,wCA8BC;AAlHD,qCAAyC;AACzC,+CAA0C;AAC1C,gDAAkC;AAClC,yCAAiC;AACjC,iDAA8C;AAC9C,mCAKgB;AAChB,oEAAqC;AACrC,iDAA6C;AAG7C,MAAM,IAAI,GAAG,IAAA,gBAAI,EAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AACnC,KAAK,UAAU,OAAO,CAAC,MAAc;IACnC,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IACrC,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC3C,IAAI,KAAK,EAAE,MAAM,SAAS,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,IAAA,gBAAI,EAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAClE,CAAC;AACH,CAAC;AAED,KAAK,UAAU,aAAa,CAAC,MAAmB;IAC9C,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;IAC1C,MAAM,QAAQ,GAAG,IAAI,iBAAQ,CAAC;QAC5B,EAAE,EAAE,MAAM;QACV,oBAAoB,EAAE,MAAM;QAC5B,kBAAkB,EAAE,kBAAkB;QACtC,sBAAsB,EAAE,uBAAuB;QAC/C,QAAQ,EAAE,IAAI,8BAAqB,CAAC;YAClC,EAAE,EAAF,kB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eAAe,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpD,MAAM,CAAC,OAAO,GAAG,KAAK,IAAI,EAAE;QAC1B,IAAI,WAAW;YAAE,OAAO;QACxB,WAAW,GAAG,IAAI,CAAC;QACnB,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;QACtC,MAAM,eAAe,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC/C,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC5C,OAAO,CAAC,GAAG,CACT,uBAAuB,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,WAAW,CAAC,IAAI,CACvE,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;IAE9E,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { promises as fs } from 'node:fs';\nimport { exists } from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { join } from 'node:path';\nimport { PGlite } from '@electric-sql/pglite';\nimport {\n CamelCasePlugin,\n FileMigrationProvider,\n Kysely,\n Migrator,\n} from 'kysely';\nimport codegen from 'kysely-codegen';\nimport { KyselyPGlite } from 'kysely-pglite';\nimport type { DB } from './v1.generated';\n\nconst root = join(__dirname, '..');\nasync function migrate(client: PGlite) {\n console.log('migrating pglite ....');\n const glob = new Bun.Glob('initial/*.sql');\n for await (const migration of glob.scan(root)) {\n await client.exec(await Bun.file(join(root, migration)).text());\n }\n}\n\nasync function migrateKysely(kysely: Kysely<any>) {\n console.log('init migrating kysely ....');\n const migrator = new Migrator({\n db: kysely,\n migrationTableSchema: 'core',\n migrationTableName: 'kysely_migration',\n migrationLockTableName: 'kysely_migration_lock',\n provider: new FileMigrationProvider({\n fs,\n path,\n // This needs to be an absolute path.\n migrationFolder: path.join(root, 'migrations'),\n }),\n });\n\n console.log('migrating kysely ....');\n const { error, results } = await migrator.migrateToLatest();\n\n for (const it of results ?? []) {\n if (it.status === 'Success') {\n console.log(`migration \"${it.migrationName}\" was executed successfully`);\n } else if (it.status === 'Error') {\n console.error(`failed to execute migration \"${it.migrationName}\"`);\n }\n }\n\n if (error) {\n console.error('failed to migrate');\n console.error(error);\n process.exit(1);\n }\n}\n\nconst dumpPath = join(root, '.data.tar');\nconst dumpFile = (async () => {\n const dataExists = await exists(dumpPath);\n if (!dataExists) {\n console.log('Creating initial dump');\n const main = new PGlite();\n await migrate(main);\n const { dialect } = new KyselyPGlite(main);\n const kysely = new Kysely<DB>({\n dialect,\n plugins: [new CamelCasePlugin()],\n });\n await migrateKysely(kysely);\n await codegen.generate({\n db: kysely,\n outFile: path.join(root, 'src/v1.generated.ts'),\n defaultSchemas: ['xxx'],\n camelCase: true,\n dialect: codegen.getDialect('postgres'),\n });\n const content = await main.dumpDataDir('none');\n await Bun.write(dumpPath, content);\n return content;\n }\n return Bun.file(dumpPath);\n})();\n\nexport async function useLocalKysely() {\n let isDestroyed = false;\n const now = performance.now();\n\n const dump = await dumpFile;\n\n const pglite = new PGlite({ loadDataDir: dump });\n // warm up\n await pglite.sql`SELECT 1`;\n const { dialect } = new KyselyPGlite(pglite);\n const kysely = new Kysely<DB>({\n dialect,\n plugins: [new CamelCasePlugin()],\n });\n\n const originalDestroy = kysely.destroy.bind(kysely);\n kysely.destroy = async () => {\n if (isDestroyed) return;\n isDestroyed = true;\n const destroyTime = performance.now();\n await originalDestroy().catch(() => undefined);\n await pglite.close().catch(() => undefined);\n console.log(\n `Database destroyed: ${Math.round(performance.now() - destroyTime)}ms`\n );\n };\n\n console.log(`Database initialized: ${Math.round(performance.now() - now)}ms`);\n\n return kysely;\n}\n"]}
1
+ {"version":3,"file":"local.js","sourceRoot":"src/","sources":["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OAAO,CAAC,GAAG,CACT,uBAAuB,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,WAAW,CAAC,IAAI,CACvE,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;IAE9E,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { promises as fs } from 'node:fs';\nimport { exists } from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { join } from 'node:path';\nimport { PGlite } from '@electric-sql/pglite';\nimport {\n CamelCasePlugin,\n FileMigrationProvider,\n Kysely,\n Migrator,\n} from 'kysely';\nimport codegen from 'kysely-codegen';\nimport { KyselyPGlite } from 'kysely-pglite';\nimport type { DB } from './v1.generated';\n\nconst root = join(__dirname, '..');\nasync function migrate(client: PGlite) {\n console.log('migrating pglite ....');\n const glob = new Bun.Glob('initial/*.sql');\n for await (const migration of glob.scan(root)) {\n await client.exec(await Bun.file(join(root, migration)).text());\n }\n}\n\nasync function migrateKysely(kysely: Kysely<any>) {\n console.log('init migrating kysely ....');\n const migrator = new Migrator({\n db: kysely,\n migrationTableSchema: 'core',\n migrationTableName: 'kysely_migration',\n migrationLockTableName: 'kysely_migration_lock',\n provider: new FileMigrationProvider({\n fs,\n path,\n // This needs to be an absolute path.\n migrationFolder: path.join(root, 'migrations'),\n }),\n });\n\n console.log('migrating kysely ....');\n const { error, results } = await migrator.migrateToLatest().catch(() => {\n console.error('failed to migrate');\n process.exit(1);\n });\n\n for (const it of results ?? []) {\n if (it.status === 'Success') {\n console.log(`migration \"${it.migrationName}\" was executed successfully`);\n } else if (it.status === 'Error') {\n console.error(`failed to execute migration \"${it.migrationName}\"`);\n }\n }\n\n if (error) {\n console.error('failed to migrate');\n console.error(error);\n process.exit(1);\n }\n}\n\nconst dumpPath = join(root, '.data.tar');\nconst dumpFile = (async () => {\n const dataExists = await exists(dumpPath).catch(() => false);\n if (!dataExists) {\n console.log('Creating initial dump');\n const main = new PGlite();\n await migrate(main).catch(async (err) => {\n console.error('failed to migrate initial dump');\n await Bun.write(\n '../logs/migrate-initial-dump.json',\n JSON.stringify(err as any, null, 2)\n );\n process.exit(1);\n });\n const { dialect } = new KyselyPGlite(main);\n const kysely = new Kysely<DB>({\n dialect,\n plugins: [new CamelCasePlugin()],\n });\n await migrateKysely(kysely).catch(() => {\n console.error('failed to migrate kysely');\n process.exit(1);\n });\n await codegen\n .generate({\n db: kysely,\n outFile: path.join(root, 'src/v1.generated.ts'),\n defaultSchemas: ['xxx'],\n camelCase: true,\n dialect: codegen.getDialect('postgres'),\n })\n .catch(() => {\n console.error('failed to generate kysely');\n process.exit(1);\n });\n const content = await main.dumpDataDir('none').catch(() => {\n console.error('failed to dump data');\n process.exit(1);\n });\n await Bun.write(dumpPath, content).catch(() => {\n console.error('failed to write dump');\n process.exit(1);\n });\n return content;\n }\n return Bun.file(dumpPath);\n})();\n\nexport async function useLocalKysely() {\n let isDestroyed = false;\n const now = performance.now();\n\n const dump = await dumpFile;\n\n const pglite = new PGlite({ loadDataDir: dump });\n // warm up\n await pglite.sql`SELECT 1`;\n const { dialect } = new KyselyPGlite(pglite);\n const kysely = new Kysely<DB>({\n dialect,\n plugins: [new CamelCasePlugin()],\n });\n\n const originalDestroy = kysely.destroy.bind(kysely);\n kysely.destroy = async () => {\n if (isDestroyed) return;\n isDestroyed = true;\n const destroyTime = performance.now();\n await originalDestroy().catch(() => undefined);\n await pglite.close().catch(() => undefined);\n console.log(\n `Database destroyed: ${Math.round(performance.now() - destroyTime)}ms`\n );\n };\n\n console.log(`Database initialized: ${Math.round(performance.now() - now)}ms`);\n\n return kysely;\n}\n"]}
@@ -1 +1,4 @@
1
- export declare function useTestKysely(): Promise<import("kysely").Kysely<import("./v1.generated").DB>>;
1
+ export declare function useTestKysely(cleanupStrategy: 'afterAll' | 'using' | 'manual'): Promise<{
2
+ kysely: import("kysely").Kysely<import("./v1.generated").DB>;
3
+ [Symbol.dispose]: () => Promise<void>;
4
+ }>;
@@ -3,11 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useTestKysely = useTestKysely;
4
4
  const bun_test_1 = require("bun:test");
5
5
  const local_1 = require("./local");
6
- async function useTestKysely() {
6
+ async function useTestKysely(cleanupStrategy) {
7
7
  const kysely = await (0, local_1.useLocalKysely)();
8
- (0, bun_test_1.afterAll)(async () => {
9
- await kysely.destroy();
10
- });
11
- return kysely;
8
+ if (cleanupStrategy === 'afterAll')
9
+ (0, bun_test_1.afterAll)(async () => {
10
+ await kysely.destroy();
11
+ });
12
+ return {
13
+ kysely,
14
+ [Symbol.dispose]: async () => {
15
+ await kysely.destroy();
16
+ },
17
+ };
12
18
  }
13
19
  //# sourceMappingURL=test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"test.js","sourceRoot":"src/","sources":["test.ts"],"names":[],"mappings":";;AAGA,sCAOC;AAVD,uCAAoC;AACpC,mCAAyC;AAElC,KAAK,UAAU,aAAa;IACjC,MAAM,MAAM,GAAG,MAAM,IAAA,sBAAc,GAAE,CAAC;IAEtC,IAAA,mBAAQ,EAAC,KAAK,IAAI,EAAE;QAClB,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { afterAll } from 'bun:test';\nimport { useLocalKysely } from './local';\n\nexport async function useTestKysely() {\n const kysely = await useLocalKysely();\n\n afterAll(async () => {\n await kysely.destroy();\n });\n return kysely;\n}\n"]}
1
+ {"version":3,"file":"test.js","sourceRoot":"src/","sources":["test.ts"],"names":[],"mappings":";;AAGA,sCAeC;AAlBD,uCAAoC;AACpC,mCAAyC;AAElC,KAAK,UAAU,aAAa,CACjC,eAAgD;IAEhD,MAAM,MAAM,GAAG,MAAM,IAAA,sBAAc,GAAE,CAAC;IAEtC,IAAI,eAAe,KAAK,UAAU;QAChC,IAAA,mBAAQ,EAAC,KAAK,IAAI,EAAE;YAClB,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,OAAO;QACL,MAAM;QACN,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,KAAK,IAAI,EAAE;YAC3B,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;QACzB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { afterAll } from 'bun:test';\nimport { useLocalKysely } from './local';\n\nexport async function useTestKysely(\n cleanupStrategy: 'afterAll' | 'using' | 'manual'\n) {\n const kysely = await useLocalKysely();\n\n if (cleanupStrategy === 'afterAll')\n afterAll(async () => {\n await kysely.destroy();\n });\n return {\n kysely,\n [Symbol.dispose]: async () => {\n await kysely.destroy();\n },\n };\n}\n"]}
@@ -1 +1 @@
1
- {"root":["../../src/index.ts","../../src/local.ts","../../src/test.ts","../../src/v0.generated.ts","../../src/v1.generated.ts"],"version":"5.9.2"}
1
+ {"root":["../../src/index.ts","../../src/local.ts","../../src/test.ts","../../src/v1.generated.ts"],"version":"5.9.3"}
@@ -289,31 +289,6 @@ export interface AccountingTransactionLine {
289
289
  export interface AccountingTransactionType {
290
290
  name: string;
291
291
  }
292
- export interface CoreAction {
293
- appId: string | null;
294
- automationId: string | null;
295
- connectionId: string | null;
296
- createdAt: Generated<Timestamp | null>;
297
- id: Generated<string>;
298
- inputJson: Json | null;
299
- isCurrent: boolean | null;
300
- jobId: string | null;
301
- jobIndex: number | null;
302
- jobPageId: string | null;
303
- jobPlanId: string | null;
304
- objectId: string | null;
305
- opId: string | null;
306
- outputJson: Json | null;
307
- refs: Json | null;
308
- schemaId: string | null;
309
- sourceId: string | null;
310
- status: string | null;
311
- tenantId: string | null;
312
- title: string | null;
313
- type: string | null;
314
- uniqueRef: string | null;
315
- updatedAt: Generated<Timestamp | null>;
316
- }
317
292
  export interface CoreActiveStatus {
318
293
  name: string;
319
294
  }
@@ -368,34 +343,6 @@ export interface CoreChangeSyncType {
368
343
  export interface CoreChangeType {
369
344
  name: string;
370
345
  }
371
- export interface CoreIssue {
372
- actionId: string | null;
373
- automationId: string | null;
374
- code: string | null;
375
- connectionId: string | null;
376
- createdAt: Generated<Timestamp | null>;
377
- extractId: string | null;
378
- extractPageId: string | null;
379
- id: Generated<string>;
380
- jobId: string | null;
381
- jobPageId: string | null;
382
- jobPlanId: string | null;
383
- kind: string | null;
384
- message: string | null;
385
- metadata: Generated<Json | null>;
386
- refId: Generated<string | null>;
387
- refType: string | null;
388
- refValue: string | null;
389
- status: string | null;
390
- subType: string | null;
391
- tenantId: string | null;
392
- type: string | null;
393
- uniqueRef: string | null;
394
- updatedAt: Generated<Timestamp | null>;
395
- }
396
- export interface CoreIssueKind {
397
- name: string;
398
- }
399
346
  export interface CoreIssueMessageOverwrite {
400
347
  createdAt: Generated<Timestamp | null>;
401
348
  id: Generated<string>;
@@ -403,98 +350,6 @@ export interface CoreIssueMessageOverwrite {
403
350
  pattern: string;
404
351
  updatedAt: Generated<Timestamp | null>;
405
352
  }
406
- export interface CoreIssueStatus {
407
- name: string;
408
- }
409
- export interface CoreIssueType {
410
- name: string;
411
- }
412
- export interface CoreJob {
413
- automationId: string | null;
414
- connectionId: string | null;
415
- createdAt: Generated<Timestamp | null>;
416
- id: Generated<string>;
417
- kind: string | null;
418
- metadata: Generated<Json | null>;
419
- params: Json | null;
420
- planId: string | null;
421
- rangeEnd: Timestamp | null;
422
- rangeStart: Timestamp | null;
423
- schemaId: string | null;
424
- status: Generated<string>;
425
- tenantId: string | null;
426
- title: string | null;
427
- type: string | null;
428
- updatedAt: Generated<Timestamp | null>;
429
- workflowId: string | null;
430
- }
431
- export interface CoreJobPage {
432
- createdAt: Generated<Timestamp | null>;
433
- cursor: string | null;
434
- id: Generated<string>;
435
- jobId: string | null;
436
- params: Json | null;
437
- status: Generated<string>;
438
- tenantId: string | null;
439
- title: string | null;
440
- updatedAt: Generated<Timestamp | null>;
441
- }
442
- export interface CoreJobPlan {
443
- automationId: string | null;
444
- connectionId: string | null;
445
- createdAt: Generated<Timestamp>;
446
- hypervisorRef: string | null;
447
- id: Generated<string>;
448
- isCurrentOnConnection: Generated<boolean | null>;
449
- params: Json | null;
450
- rangeEnd: Timestamp | null;
451
- rangeStart: Timestamp | null;
452
- status: Generated<string>;
453
- tenantId: string;
454
- title: string | null;
455
- triggeredByUserId: string | null;
456
- type: string | null;
457
- updatedAt: Generated<Timestamp>;
458
- workflowId: string | null;
459
- }
460
- export interface CoreSchema {
461
- appId: string | null;
462
- createdAt: Generated<Timestamp | null>;
463
- hasExternalLinks: boolean | null;
464
- id: Generated<string>;
465
- indexSchema: Json | null;
466
- jsonSchema: Json | null;
467
- kind: string | null;
468
- uniqueRef: string | null;
469
- updatedAt: Generated<Timestamp | null>;
470
- }
471
- export interface CoreSchemaKind {
472
- name: string;
473
- }
474
- export interface CoreSourceAction {
475
- actionId: string;
476
- createdAt: Generated<Timestamp>;
477
- id: Generated<string>;
478
- opId: string | null;
479
- sourceId: string;
480
- tenantId: string | null;
481
- updatedAt: Generated<Timestamp>;
482
- }
483
- export interface CoreSourceOp {
484
- actionId: string | null;
485
- createdAt: Generated<Timestamp | null>;
486
- fields: Generated<Json>;
487
- id: Generated<string>;
488
- jobId: string | null;
489
- jobPageId: string | null;
490
- jobPlanId: string | null;
491
- json: Json | null;
492
- kind: string;
493
- sourceId: string;
494
- tenantId: string;
495
- updatedAt: Generated<Timestamp | null>;
496
- version: Generated<number | null>;
497
- }
498
353
  export interface CoreSync {
499
354
  automationId: string | null;
500
355
  connectionId: string | null;
@@ -649,26 +504,6 @@ export interface PublicAccountCollection {
649
504
  export interface PublicAccountCollectionType {
650
505
  name: string;
651
506
  }
652
- export interface PublicAction {
653
- automationId: string | null;
654
- automationTaskId: string | null;
655
- connectionId: string | null;
656
- createdAt: Generated<Timestamp>;
657
- id: Generated<string>;
658
- inputFileId: string | null;
659
- jobTaskId: string | null;
660
- outputFileId: string | null;
661
- processTaskId: string | null;
662
- status: string | null;
663
- taskId: string | null;
664
- tenantId: string | null;
665
- type: string | null;
666
- uniqueRef: string | null;
667
- updatedAt: Generated<Timestamp>;
668
- }
669
- export interface PublicActionStatus {
670
- name: string;
671
- }
672
507
  export interface PublicAddress {
673
508
  city: string | null;
674
509
  country: string | null;
@@ -810,22 +645,6 @@ export interface PublicConnection {
810
645
  export interface PublicConnectionStatusTemporary {
811
646
  name: string;
812
647
  }
813
- export interface PublicCsvLine {
814
- connectionId: string;
815
- createdAt: Generated<Timestamp | null>;
816
- csv: string;
817
- date: Timestamp;
818
- fileId: string | null;
819
- fileUniqueRef: string | null;
820
- headers: string | null;
821
- id: Generated<string>;
822
- index: number | null;
823
- json: Json | null;
824
- tenantId: string;
825
- type: string;
826
- uniqueRef: string;
827
- updatedAt: Generated<Timestamp | null>;
828
- }
829
648
  export interface PublicCurrency {
830
649
  name: string;
831
650
  }
@@ -1028,19 +847,6 @@ export interface PublicListingPmsStatus {
1028
847
  export interface PublicListingStatus {
1029
848
  name: string;
1030
849
  }
1031
- export interface PublicMetric {
1032
- connectionId: string;
1033
- createdAt: Generated<Timestamp>;
1034
- date: Timestamp;
1035
- id: Generated<string>;
1036
- listingConnectionId: string | null;
1037
- metadata: Generated<Json>;
1038
- tenantId: string;
1039
- type: string;
1040
- uniqueRef: string | null;
1041
- updatedAt: Generated<Timestamp>;
1042
- value: number | null;
1043
- }
1044
850
  export interface PublicOwner {
1045
851
  addressId: string | null;
1046
852
  companyType: string | null;
@@ -1073,9 +879,12 @@ export interface PublicOwnerStatement {
1073
879
  centAccountingBalanceStart: number | null;
1074
880
  centBalanceEnd: Int8 | null;
1075
881
  centBalanceStart: Int8 | null;
882
+ centExpenses: Int8 | null;
883
+ centNetRevenue: Int8 | null;
1076
884
  centPayedOut: number | null;
1077
885
  centRentalRevenue: number | null;
1078
886
  centTotal: Int8 | null;
887
+ centTransfer: Int8 | null;
1079
888
  createdAt: Generated<Timestamp>;
1080
889
  currency: string | null;
1081
890
  endAt: Timestamp;
@@ -1095,16 +904,6 @@ export interface PublicOwnerStatement {
1095
904
  uniqueRef: string | null;
1096
905
  updatedAt: Generated<Timestamp>;
1097
906
  }
1098
- export interface PublicOwnerStatementIssue {
1099
- id: Generated<string>;
1100
- level: Generated<string>;
1101
- lineId: string | null;
1102
- message: string;
1103
- statementId: string | null;
1104
- tenantId: string;
1105
- type: string;
1106
- uniqueRef: string;
1107
- }
1108
907
  export interface PublicOwnerStatementLayout {
1109
908
  automationId: string | null;
1110
909
  connectionId: string | null;
@@ -1458,21 +1257,6 @@ export interface PublicReservationWithOccupancyStatus {
1458
1257
  updatedAt: Timestamp | null;
1459
1258
  userdata: Json | null;
1460
1259
  }
1461
- export interface PublicScheduledEvent {
1462
- createdAt: Generated<Timestamp>;
1463
- id: Generated<string>;
1464
- message: string | null;
1465
- objectId: string;
1466
- op: string;
1467
- scheduledAt: Timestamp | null;
1468
- status: Generated<string | null>;
1469
- tableName: string;
1470
- tenantId: string;
1471
- updatedAt: Generated<Timestamp>;
1472
- }
1473
- export interface PublicScheduledEventStatus {
1474
- name: string;
1475
- }
1476
1260
  export interface PublicSetting {
1477
1261
  automationId: string | null;
1478
1262
  connectionId: string | null;
@@ -1526,7 +1310,6 @@ export interface PublicSource {
1526
1310
  parentId: string | null;
1527
1311
  remoteId: string | null;
1528
1312
  reservationId: string | null;
1529
- schemaId: string | null;
1530
1313
  status: Generated<string | null>;
1531
1314
  tenantId: string;
1532
1315
  transformJson: Json | null;
@@ -1857,7 +1640,6 @@ export interface DB {
1857
1640
  "accounting.transaction": AccountingTransaction;
1858
1641
  "accounting.transactionLine": AccountingTransactionLine;
1859
1642
  "accounting.transactionType": AccountingTransactionType;
1860
- "core.action": CoreAction;
1861
1643
  "core.activeStatus": CoreActiveStatus;
1862
1644
  "core.change": CoreChange;
1863
1645
  "core.changeEntityType": CoreChangeEntityType;
@@ -1866,18 +1648,7 @@ export interface DB {
1866
1648
  "core.changeStatus": CoreChangeStatus;
1867
1649
  "core.changeSyncType": CoreChangeSyncType;
1868
1650
  "core.changeType": CoreChangeType;
1869
- "core.issue": CoreIssue;
1870
- "core.issueKind": CoreIssueKind;
1871
1651
  "core.issueMessageOverwrite": CoreIssueMessageOverwrite;
1872
- "core.issueStatus": CoreIssueStatus;
1873
- "core.issueType": CoreIssueType;
1874
- "core.job": CoreJob;
1875
- "core.jobPage": CoreJobPage;
1876
- "core.jobPlan": CoreJobPlan;
1877
- "core.schema": CoreSchema;
1878
- "core.schemaKind": CoreSchemaKind;
1879
- "core.sourceAction": CoreSourceAction;
1880
- "core.sourceOp": CoreSourceOp;
1881
1652
  "core.sync": CoreSync;
1882
1653
  "core.syncStatus": CoreSyncStatus;
1883
1654
  "core.syncSubtask": CoreSyncSubtask;
@@ -1896,8 +1667,6 @@ export interface DB {
1896
1667
  "hdbCatalog.hdbVersion": HdbCatalogHdbVersion;
1897
1668
  "public.accountCollection": PublicAccountCollection;
1898
1669
  "public.accountCollectionType": PublicAccountCollectionType;
1899
- "public.action": PublicAction;
1900
- "public.actionStatus": PublicActionStatus;
1901
1670
  "public.address": PublicAddress;
1902
1671
  "public.app": PublicApp;
1903
1672
  "public.auditLog": PublicAuditLog;
@@ -1908,7 +1677,6 @@ export interface DB {
1908
1677
  "public.bookingChannel": PublicBookingChannel;
1909
1678
  "public.connection": PublicConnection;
1910
1679
  "public.connectionStatusTemporary": PublicConnectionStatusTemporary;
1911
- "public.csvLine": PublicCsvLine;
1912
1680
  "public.currency": PublicCurrency;
1913
1681
  "public.duplicateEmails": PublicDuplicateEmails;
1914
1682
  "public.emailTemplate": PublicEmailTemplate;
@@ -1932,11 +1700,9 @@ export interface DB {
1932
1700
  "public.listingOwnershipPeriodMember": PublicListingOwnershipPeriodMember;
1933
1701
  "public.listingPmsStatus": PublicListingPmsStatus;
1934
1702
  "public.listingStatus": PublicListingStatus;
1935
- "public.metric": PublicMetric;
1936
1703
  "public.owner": PublicOwner;
1937
1704
  "public.ownerPmsStatus": PublicOwnerPmsStatus;
1938
1705
  "public.ownerStatement": PublicOwnerStatement;
1939
- "public.ownerStatementIssue": PublicOwnerStatementIssue;
1940
1706
  "public.ownerStatementLayout": PublicOwnerStatementLayout;
1941
1707
  "public.ownerStatementLayoutAccount": PublicOwnerStatementLayoutAccount;
1942
1708
  "public.ownerStatementLayoutListing": PublicOwnerStatementLayoutListing;
@@ -1964,8 +1730,6 @@ export interface DB {
1964
1730
  "public.reservation": PublicReservation;
1965
1731
  "public.reservationStatus": PublicReservationStatus;
1966
1732
  "public.reservationWithOccupancyStatus": PublicReservationWithOccupancyStatus;
1967
- "public.scheduledEvent": PublicScheduledEvent;
1968
- "public.scheduledEventStatus": PublicScheduledEventStatus;
1969
1733
  "public.setting": PublicSetting;
1970
1734
  "public.source": PublicSource;
1971
1735
  "public.task": PublicTask;