@vrplatform/kysely 1.3.45-5070 → 1.3.45-5103

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.
Files changed (89) hide show
  1. package/build/.data.tar +0 -0
  2. package/build/main/local/generate.js +8 -8
  3. package/build/main/local/generate.js.map +1 -1
  4. package/build/main/local/index.js +5 -4
  5. package/build/main/local/index.js.map +1 -1
  6. package/build/main/migration.d.ts +7 -0
  7. package/build/main/migration.js +11 -0
  8. package/build/main/migration.js.map +1 -0
  9. package/build/main/v1.generated.d.ts +158 -154
  10. package/build/main/v1.generated.js.map +1 -1
  11. package/build/migrations-v2/0000000000000-baseline.ts +5 -0
  12. package/build/migrations-v2/0000000000001-public-audit-events-v2.ts +137 -0
  13. package/build/module/local/generate.js +8 -8
  14. package/build/module/local/generate.js.map +1 -1
  15. package/build/module/local/index.js +5 -4
  16. package/build/module/local/index.js.map +1 -1
  17. package/build/module/migration.d.ts +7 -0
  18. package/build/module/migration.js +8 -0
  19. package/build/module/migration.js.map +1 -0
  20. package/build/module/v1.generated.d.ts +158 -154
  21. package/build/module/v1.generated.js.map +1 -1
  22. package/package.json +3 -3
  23. package/build/migrations/0000000000001-init.ts +0 -5
  24. package/build/migrations/0000000000009-drop-store-schema.ts +0 -14
  25. package/build/migrations/0000000000010-bank-rules.ts +0 -190
  26. package/build/migrations/0000000000011-bank-rule-line-adjustments.ts +0 -65
  27. package/build/migrations/0000000000012-bank-rule-conditions.ts +0 -45
  28. package/build/migrations/0000000000013-bank-rule-name-unique.ts +0 -15
  29. package/build/migrations/0000000000014-bank-rule-drop-legacy-conditions.ts +0 -41
  30. package/build/migrations/0000000000015-booking-channel-logo-dev-provider.ts +0 -70
  31. package/build/migrations/0000000000016-owner-statement-draft-status.ts +0 -22
  32. package/build/migrations/0000000000017-tenant-migration-markers.ts +0 -18
  33. package/build/migrations/0000000000018-security-deposits-payable-category.ts +0 -63
  34. package/build/migrations/0000000000019-tenant-app-settings.ts +0 -76
  35. package/build/migrations/0000000000020-operating-opening-trial-balance.ts +0 -36
  36. package/build/migrations/0000000000021-audit-foreign-key-indexes.ts +0 -77
  37. package/build/migrations/0000000000022-opening-trial-balance-combined-columns.ts +0 -30
  38. package/build/migrations/0000000000023-journal-entry-currency-mismatch-reason.ts +0 -14
  39. package/build/migrations/0000000000024-listing-parent.ts +0 -37
  40. package/build/migrations/0000000000025-journal-entry-parent-listing.ts +0 -26
  41. package/build/migrations/0000000000026-booking-channel-logo-slots.ts +0 -89
  42. package/build/migrations/0000000000027-list-browse-performance-indexes.ts +0 -52
  43. package/build/migrations/0000000000028-flow-setting-status-jsonb.ts +0 -20
  44. package/build/migrations/0000000000029-tenant-slug.ts +0 -328
  45. package/build/migrations/0000000000030-pms-accounting-windows.ts +0 -50
  46. package/build/migrations/0000000000031-owner-statement-projection-listing-revision.ts +0 -20
  47. package/build/migrations/0000000000032-flow-event-listening.ts +0 -28
  48. package/build/migrations/0000000000033-opening-trial-balance-transaction.ts +0 -272
  49. package/build/migrations/0000000000034-historic-general-ledger.ts +0 -24
  50. package/build/migrations/0000000000035-tenant-regional-placement.ts +0 -37
  51. package/build/migrations/0000000000036-control-plane-projection-events.ts +0 -43
  52. package/build/migrations/0000000000037-tenant-guide-onboarding.ts +0 -21
  53. package/build/migrations/0000000000038-tracking-event-analytics-sink.ts +0 -31
  54. package/build/migrations/0000000000039-crunchy-region.ts +0 -86
  55. package/build/migrations/0000000000040-hostaway-region.ts +0 -72
  56. package/build/migrations/0000000000041-audit-tenant-fk.ts +0 -66
  57. package/build/migrations/0000000000042-ramp-staging-connect-params.ts +0 -35
  58. package/build/migrations/0000000000043-gl-pms-accounting-window-guard.ts +0 -125
  59. package/build/migrations/0000000000044-tenant-cross-region-fks.ts +0 -45
  60. package/build/migrations/0000000000045-cloudflare-region-env.ts +0 -100
  61. package/build/migrations/0000000000046-control-plane-outbox-alias.ts +0 -46
  62. package/build/migrations/0000000000047-ramp-contact-last-4-digits.ts +0 -16
  63. package/build/migrations/0000000000047-tenant-status-backfill.ts +0 -40
  64. package/build/migrations/0000000000048-tenant-status-constraint.ts +0 -24
  65. package/build/migrations/0000000000049-health-tenant-issues.ts +0 -69
  66. package/build/migrations/0000000000050-partner-webhooks.ts +0 -135
  67. package/build/migrations/0000000000051-health-webhook-runtime-grants.ts +0 -42
  68. package/build/migrations/0000000000052-feature-approval-team-enablement.ts +0 -13
  69. package/build/migrations/0000000000053-health-webhook-enums.ts +0 -296
  70. package/build/migrations/0000000000054-user-secondary-emails-jsonb.ts +0 -25
  71. package/build/migrations/0000000000055-outbound-webhooks-v1.ts +0 -221
  72. package/build/migrations/0000000000056-connection-webhook-version.ts +0 -18
  73. package/build/migrations/0000000000057-sync-webhook-version.ts +0 -18
  74. package/build/migrations/0000000000058-reservation-webhook-version.ts +0 -18
  75. package/build/migrations/0000000000059-listing-webhook-version.ts +0 -18
  76. package/build/migrations/0000000000060-owner-statement-webhook-version.ts +0 -19
  77. package/build/migrations/0000000000061-transaction-webhook-version.ts +0 -18
  78. package/build/migrations/0000000000062-plaid-connect-session.ts +0 -102
  79. package/build/migrations/0000000000063-pgcrypto.ts +0 -27
  80. package/build/migrations/0000000000064-partner-api-foundation.ts +0 -36
  81. package/build/migrations/0000000000065-canonical-jsonb-shapes.ts +0 -231
  82. package/build/migrations/0000000000066-source-delete-fk-indexes.ts +0 -20
  83. package/build/migrations/0000000000067-remove-opening-trial-balance-account-columns.ts +0 -34
  84. package/build/migrations/0000000000068-bank-record-account-delete-cascade.ts +0 -26
  85. package/build/migrations/0000000000069-account-connections.ts +0 -204
  86. package/build/migrations/0000000000070-provider-payment-projection-indexes.ts +0 -53
  87. package/build/migrations/0000000000071-tenant-app-settings-shape.ts +0 -39
  88. package/build/migrations/0000000000072-tenant-app-settings-shape-validation.ts +0 -11
  89. package/build/migrations/0000000000073-public-audit-events.ts +0 -241
package/build/.data.tar CHANGED
Binary file
@@ -45,11 +45,14 @@ const pglite_1 = require("@electric-sql/pglite");
45
45
  const kysely_1 = require("kysely");
46
46
  const kysely_codegen_1 = __importDefault(require("kysely-codegen"));
47
47
  const kysely_pglite_dialect_1 = require("kysely-pglite-dialect");
48
+ const migration_1 = require("../migration");
48
49
  const plugins_1 = require("../plugins");
49
50
  async function normalizeGeneratedTypes(root) {
50
51
  const outFile = path.join(root, 'src/v1.generated.ts');
51
52
  const current = await Bun.file(outFile).text();
52
- const next = current.replace('export type Timestamp = ColumnType<Date, Date | string, Date | string>;', 'export type Timestamp = ColumnType<Date | string, Date | string, Date | string>;');
53
+ const next = current
54
+ .replace('export type Timestamp = ColumnType<Date, Date | string, Date | string>;', 'export type Timestamp = ColumnType<Date | string, Date | string, Date | string>;')
55
+ .replace(' slug: string;\n', ' slug: Generated<string>;\n');
53
56
  if (next !== current) {
54
57
  await Bun.write(outFile, next);
55
58
  }
@@ -69,14 +72,14 @@ async function migrateKysely(root, kysely) {
69
72
  console.log('init migrating kysely ....');
70
73
  const migrator = new kysely_1.Migrator({
71
74
  db: kysely,
72
- migrationTableSchema: 'core',
73
- migrationTableName: 'kysely_migration',
74
- migrationLockTableName: 'kysely_migration_lock',
75
+ migrationTableSchema: migration_1.appMigrationEpoch.tableSchema,
76
+ migrationTableName: migration_1.appMigrationEpoch.tableName,
77
+ migrationLockTableName: migration_1.appMigrationEpoch.lockTableName,
75
78
  provider: new kysely_1.FileMigrationProvider({
76
79
  fs: node_fs_1.promises,
77
80
  path,
78
81
  // This needs to be an absolute path.
79
- migrationFolder: path.join(root, 'migrations'),
82
+ migrationFolder: path.join(root, migration_1.appMigrationEpoch.folder),
80
83
  }),
81
84
  });
82
85
  console.log('migrating kysely ....');
@@ -123,9 +126,6 @@ async function generateDump(root, dumpPath) {
123
126
  outFile: path.join(root, 'src/v1.generated.ts'),
124
127
  defaultSchemas: ['xxx'],
125
128
  camelCase: true,
126
- typeMapping: {
127
- date: 'string',
128
- },
129
129
  dialect: kysely_codegen_1.default.getDialect('postgres'),
130
130
  })
131
131
  .catch(() => {
@@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AAC;IAC3B,MAAM,OAAO,GAAG,IAAI,qCAAa,CAAC,MAAM,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,IAAA,mBAAS,EAAC,OAAO,EAAE;QAChC,cAAc,EAAE,cAAc;QAC9B,GAAG,EAAE,SAAS;KACf,CAAC,CAAC;IAEH,MAAM,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,yCAAyC;QACzC,MAAM,eAAe,EAAE,CAAC;QACxB,cAAc;QACd,0EAA0E;QAC1E,IAAI;IACN,CAAC,CAAC;IAEF,iFAAiF;IAEjF,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 { FileMigrationProvider, type Kysely, Migrator } from 'kysely';\nimport codegen from 'kysely-codegen';\nimport { PGliteDialect } from 'kysely-pglite-dialect';\nimport { getKysely } from '../plugins';\nimport type { DB } from '../v1.generated';\n\nasync function normalizeGeneratedTypes(root: string) {\n const outFile = path.join(root, 'src/v1.generated.ts');\n const current = await Bun.file(outFile).text();\n const next = current.replace(\n 'export type Timestamp = ColumnType<Date, Date | string, Date | string>;',\n 'export type Timestamp = ColumnType<Date | string, Date | string, Date | string>;'\n );\n\n if (next !== current) {\n await Bun.write(outFile, next);\n }\n}\n\nasync function migrate(root: string, 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 const raw = await Bun.file(join(root, migration)).text();\n // `pg_dump` (v17+) prepends `\\restrict`/`\\unrestrict` psql meta commands\n // which PostgreSQL-compatible parsers (like PGlite) cannot execute.\n const sanitized = raw.replace(/^\\s*\\\\(?:un)?restrict.*$/gim, '');\n await client.exec(sanitized);\n }\n}\n\nasync function migrateKysely(root: string, kysely: Kysely<DB>) {\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\nasync function generateDump(root: string, dumpPath: string) {\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(root, 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 PGliteDialect(main);\n const kysely = getKysely(dialect, {\n repositoryName: 'localTesting',\n log: undefined,\n });\n await migrateKysely(root, 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 typeMapping: {\n date: 'string',\n },\n dialect: codegen.getDialect('postgres'),\n })\n .catch(() => {\n console.error('failed to generate kysely');\n process.exit(1);\n });\n await normalizeGeneratedTypes(root);\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 createLocalKysely(root: string, dumpPath: string) {\n let isDestroyed = false;\n //const now = performance.now();\n\n const dump = await generateDump(root, dumpPath);\n\n const pglite = new PGlite({ loadDataDir: dump });\n // warm up\n await pglite.sql`SELECT 1`;\n const dialect = new PGliteDialect(pglite);\n const kysely = getKysely(dialect, {\n repositoryName: 'localTesting',\n log: undefined,\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();\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":"generate.js","sourceRoot":"src/","sources":["local/generate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2HA,8CA6BC;AAxJD,qCAAyC;AACzC,+CAA0C;AAC1C,gDAAkC;AAClC,yCAAiC;AACjC,iDAA8C;AAC9C,mCAAsE;AACtE,oEAAqC;AACrC,iEAAsD;AACtD,4CAAiD;AACjD,wCAAuC;AAGvC,KAAK,UAAU,uBAAuB,CAAC,IAAY;IACjD,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/C,MAAM,IAAI,GAAG,OAAO;SACjB,OAAO,CACN,yEAAyE,EACzE,kFAAkF,CACnF;SACA,OAAO,CAAC,mBAAmB,EAAE,8BAA8B,CAAC,CAAC;IAEhE,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,MAAM,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;AACH,CAAC;AA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C,OAAO,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;YACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC5B,CAAC;AAEM,KAAK,UAAU,iBAAiB,CAAC,IAAY,EAAE,QAAgB;IACpE,IAAI,WAAW,GAAG,KAAK,CAAC;IACxB,gCAAgC;IAEhC,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAEhD,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,UAAU;IACV,MAAM,MAAM,CAAC,GAAG,CAAA,UAAU,CAAC;IAC3B,MAAM,OAAO,GAAG,IAAI,qCAAa,CAAC,MAAM,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,IAAA,mBAAS,EAAC,OAAO,EAAE;QAChC,cAAc,EAAE,cAAc;QAC9B,GAAG,EAAE,SAAS;KACf,CAAC,CAAC;IAEH,MAAM,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,yCAAyC;QACzC,MAAM,eAAe,EAAE,CAAC;QACxB,cAAc;QACd,0EAA0E;QAC1E,IAAI;IACN,CAAC,CAAC;IAEF,iFAAiF;IAEjF,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 { FileMigrationProvider, type Kysely, Migrator } from 'kysely';\nimport codegen from 'kysely-codegen';\nimport { PGliteDialect } from 'kysely-pglite-dialect';\nimport { appMigrationEpoch } from '../migration';\nimport { getKysely } from '../plugins';\nimport type { DB } from '../v1.generated';\n\nasync function normalizeGeneratedTypes(root: string) {\n const outFile = path.join(root, 'src/v1.generated.ts');\n const current = await Bun.file(outFile).text();\n const next = current\n .replace(\n 'export type Timestamp = ColumnType<Date, Date | string, Date | string>;',\n 'export type Timestamp = ColumnType<Date | string, Date | string, Date | string>;'\n )\n .replace(' slug: string;\\n', ' slug: Generated<string>;\\n');\n\n if (next !== current) {\n await Bun.write(outFile, next);\n }\n}\n\nasync function migrate(root: string, 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 const raw = await Bun.file(join(root, migration)).text();\n // `pg_dump` (v17+) prepends `\\restrict`/`\\unrestrict` psql meta commands\n // which PostgreSQL-compatible parsers (like PGlite) cannot execute.\n const sanitized = raw.replace(/^\\s*\\\\(?:un)?restrict.*$/gim, '');\n await client.exec(sanitized);\n }\n}\n\nasync function migrateKysely(root: string, kysely: Kysely<DB>) {\n console.log('init migrating kysely ....');\n const migrator = new Migrator({\n db: kysely,\n migrationTableSchema: appMigrationEpoch.tableSchema,\n migrationTableName: appMigrationEpoch.tableName,\n migrationLockTableName: appMigrationEpoch.lockTableName,\n provider: new FileMigrationProvider({\n fs,\n path,\n // This needs to be an absolute path.\n migrationFolder: path.join(root, appMigrationEpoch.folder),\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\nasync function generateDump(root: string, dumpPath: string) {\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(root, 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 PGliteDialect(main);\n const kysely = getKysely(dialect, {\n repositoryName: 'localTesting',\n log: undefined,\n });\n await migrateKysely(root, 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 await normalizeGeneratedTypes(root);\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 createLocalKysely(root: string, dumpPath: string) {\n let isDestroyed = false;\n //const now = performance.now();\n\n const dump = await generateDump(root, dumpPath);\n\n const pglite = new PGlite({ loadDataDir: dump });\n // warm up\n await pglite.sql`SELECT 1`;\n const dialect = new PGliteDialect(pglite);\n const kysely = getKysely(dialect, {\n repositoryName: 'localTesting',\n log: undefined,\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();\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"]}
@@ -40,6 +40,7 @@ const path = __importStar(require("node:path"));
40
40
  const pglite_1 = require("@electric-sql/pglite");
41
41
  const kysely_1 = require("kysely");
42
42
  const kysely_pglite_dialect_1 = require("kysely-pglite-dialect");
43
+ const migration_1 = require("../migration");
43
44
  const plugins_1 = require("../plugins");
44
45
  const digest_1 = require("./digest");
45
46
  exports.root = path.join(__dirname, '../..');
@@ -47,13 +48,13 @@ exports.dumpPath = path.join(exports.root, '.data.tar');
47
48
  async function migrateToLatest(kysely) {
48
49
  const migrator = new kysely_1.Migrator({
49
50
  db: kysely,
50
- migrationTableSchema: 'core',
51
- migrationTableName: 'kysely_migration',
52
- migrationLockTableName: 'kysely_migration_lock',
51
+ migrationTableSchema: migration_1.appMigrationEpoch.tableSchema,
52
+ migrationTableName: migration_1.appMigrationEpoch.tableName,
53
+ migrationLockTableName: migration_1.appMigrationEpoch.lockTableName,
53
54
  provider: new kysely_1.FileMigrationProvider({
54
55
  fs: node_fs_1.promises,
55
56
  path,
56
- migrationFolder: path.join(exports.root, 'migrations'),
57
+ migrationFolder: path.join(exports.root, migration_1.appMigrationEpoch.folder),
57
58
  }),
58
59
  });
59
60
  const { error } = await migrator.migrateToLatest();
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"src/","sources":["local/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,wCAgCC;AApED,qCAAyC;AACzC,gDAAkC;AAClC,iDAA8C;AAC9C,mCAAyE;AACzE,iEAAsD;AACtD,wCAAuC;AAEvC,qCAA8E;AAEjE,QAAA,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AACrC,QAAA,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,YAAI,EAAE,WAAW,CAAC,CAAC;AAOrD,KAAK,UAAU,eAAe,CAAC,MAAmC;IAChE,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,CA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AC","sourcesContent":["import { promises as fs } from 'node:fs';\nimport * as path from 'node:path';\nimport { PGlite } from '@electric-sql/pglite';\nimport { FileMigrationProvider, type LogConfig, Migrator } from 'kysely';\nimport { PGliteDialect } from 'kysely-pglite-dialect';\nimport { getKysely } from '../plugins';\nimport type { DB } from '../v1.generated';\nimport { ensureDigestFunction, ensureGenRandomBytesFunction } from './digest';\n\nexport const root = path.join(__dirname, '../..');\nexport const dumpPath = path.join(root, '.data.tar');\n\nexport type UseLocalKyselyOptions = {\n repositoryName?: string;\n log?: true | LogConfig;\n};\n\nasync function migrateToLatest(kysely: import('kysely').Kysely<DB>) {\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 migrationFolder: path.join(root, 'migrations'),\n }),\n });\n\n const { error } = await migrator.migrateToLatest();\n if (error) {\n throw error;\n }\n}\n\nexport async function useLocalKysely(args: UseLocalKyselyOptions = {}) {\n let isDestroyed = false;\n // const now = performance.now();\n\n const dump = Bun.file(dumpPath);\n\n const pglite = new PGlite({\n loadDataDir: dump,\n });\n const dialect = new PGliteDialect(pglite);\n const kysely = getKysely(dialect, {\n repositoryName: args?.repositoryName ?? 'localTesting',\n log: args?.log,\n });\n await ensureDigestFunction(kysely);\n await ensureGenRandomBytesFunction(kysely);\n await migrateToLatest(kysely as import('kysely').Kysely<DB>);\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();\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":"index.js","sourceRoot":"src/","sources":["local/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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C,cAAc,EAAE,IAAI,EAAE,cAAc,IAAI,cAAc;QACtD,GAAG,EAAE,IAAI,EAAE,GAAG;KACf,CAAC,CAAC;IACH,MAAM,IAAA,6BAAoB,EAAC,MAAM,CAAC,CAAC;IACnC,MAAM,IAAA,qCAA4B,EAAC,MAAM,CAAC,CAAC;IAC3C,MAAM,eAAe,CAAC,MAAqC,CAAC,CAAC;IAE7D,MAAM,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,wCAAwC;QACxC,MAAM,eAAe,EAAE,CAAC;QACxB,cAAc;QACd,0EAA0E;QAC1E,IAAI;IACN,CAAC,CAAC;IAEF,iFAAiF;IAEjF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { promises as fs } from 'node:fs';\nimport * as path from 'node:path';\nimport { PGlite } from '@electric-sql/pglite';\nimport { FileMigrationProvider, type LogConfig, Migrator } from 'kysely';\nimport { PGliteDialect } from 'kysely-pglite-dialect';\nimport { appMigrationEpoch } from '../migration';\nimport { getKysely } from '../plugins';\nimport type { DB } from '../v1.generated';\nimport { ensureDigestFunction, ensureGenRandomBytesFunction } from './digest';\n\nexport const root = path.join(__dirname, '../..');\nexport const dumpPath = path.join(root, '.data.tar');\n\nexport type UseLocalKyselyOptions = {\n repositoryName?: string;\n log?: true | LogConfig;\n};\n\nasync function migrateToLatest(kysely: import('kysely').Kysely<DB>) {\n const migrator = new Migrator({\n db: kysely,\n migrationTableSchema: appMigrationEpoch.tableSchema,\n migrationTableName: appMigrationEpoch.tableName,\n migrationLockTableName: appMigrationEpoch.lockTableName,\n provider: new FileMigrationProvider({\n fs,\n path,\n migrationFolder: path.join(root, appMigrationEpoch.folder),\n }),\n });\n\n const { error } = await migrator.migrateToLatest();\n if (error) {\n throw error;\n }\n}\n\nexport async function useLocalKysely(args: UseLocalKyselyOptions = {}) {\n let isDestroyed = false;\n // const now = performance.now();\n\n const dump = Bun.file(dumpPath);\n\n const pglite = new PGlite({\n loadDataDir: dump,\n });\n const dialect = new PGliteDialect(pglite);\n const kysely = getKysely(dialect, {\n repositoryName: args?.repositoryName ?? 'localTesting',\n log: args?.log,\n });\n await ensureDigestFunction(kysely);\n await ensureGenRandomBytesFunction(kysely);\n await migrateToLatest(kysely as import('kysely').Kysely<DB>);\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();\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"]}
@@ -0,0 +1,7 @@
1
+ export declare const appMigrationEpoch: {
2
+ readonly baseline: "0000000000000-baseline";
3
+ readonly folder: "migrations-v2";
4
+ readonly lockTableName: "kysely_migration_lock";
5
+ readonly tableName: "kysely_migration";
6
+ readonly tableSchema: "kysely_v2";
7
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.appMigrationEpoch = void 0;
4
+ exports.appMigrationEpoch = {
5
+ baseline: '0000000000000-baseline',
6
+ folder: 'migrations-v2',
7
+ lockTableName: 'kysely_migration_lock',
8
+ tableName: 'kysely_migration',
9
+ tableSchema: 'kysely_v2',
10
+ };
11
+ //# sourceMappingURL=migration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration.js","sourceRoot":"src/","sources":["migration.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG;IAC/B,QAAQ,EAAE,wBAAwB;IAClC,MAAM,EAAE,eAAe;IACvB,aAAa,EAAE,uBAAuB;IACtC,SAAS,EAAE,kBAAkB;IAC7B,WAAW,EAAE,WAAW;CAChB,CAAC","sourcesContent":["export const appMigrationEpoch = {\n baseline: '0000000000000-baseline',\n folder: 'migrations-v2',\n lockTableName: 'kysely_migration_lock',\n tableName: 'kysely_migration',\n tableSchema: 'kysely_v2',\n} as const;\n"]}
@@ -6,6 +6,8 @@ import type { ColumnType } from "kysely";
6
6
  export type AccountingJournalEntryInactiveReason = "cancelledReservationLine" | "currencyMismatch" | "generalLedgerStartAt" | "inactiveAccount" | "listingInactive" | "nonPostingAccount" | "reservationGeneralLedgerStatusInactive" | "transactionInactive" | "unknownInactiveReason";
7
7
  export type AccountingJournalEntryLedger = "historical" | "operating" | "trust";
8
8
  export type AccountingTransactionAttachmentStatus = "attached" | "deleting" | "ready" | "uploading";
9
+ export type ArrayType<T> = ArrayTypeImpl<T> extends (infer U)[] ? U[] : ArrayTypeImpl<T>;
10
+ export type ArrayTypeImpl<T> = T extends ColumnType<infer S, infer I, infer U> ? ColumnType<S[], I[], U[]> : T[];
9
11
  export type AuditActionActorType = "api_key" | "automation" | "sync" | "system" | "user";
10
12
  export type AuditEffectAttemptStatus = "completed" | "failed" | "running" | "skipped_locked";
11
13
  export type AuditEffectStatus = "claimed" | "completed" | "dead_letter" | "failed" | "pending" | "running";
@@ -13,11 +15,11 @@ export type AuditJournalDeltaOperation = "delete" | "insert" | "update";
13
15
  export type AuditPublicEventAccountingStatus = "blocked" | "changed" | "failed" | "mixed" | "not_applicable" | "pending" | "unchanged";
14
16
  export type AuditPublicEventOperation = "archive" | "create" | "delete" | "execute" | "recalculate" | "restore" | "update";
15
17
  export type AuditSourceType = "api" | "automation" | "integration" | "portal" | "sync" | "system";
18
+ export type Generated<T> = T extends ColumnType<infer S, infer I, infer U> ? ColumnType<S, I | undefined, U> : ColumnType<T, T | undefined, T>;
16
19
  export type HealthTenantIssueCategory = "criticalToSystem" | "criticalToUser";
17
20
  export type HealthTenantIssueCode = "brokenConnections" | "cancelledReservationPaidWithoutAdjustment" | "closedPeriodUnattachedJournalEntries" | "duplicatedPayments" | "endedOwnershipNonZeroBalance" | "listingOwnershipPeriodNotFoundOnActiveJournals" | "missingOwnershipOrDeactivation" | "operatingBankAccountsWithoutOpex" | "outdatedConnections" | "partnerBillingInactive" | "partnerInactive" | "pmsMissingAccountingStart" | "publishedStatementUnpaid" | "reservationCurrencyMismatch" | "reservationGuestTotalsMismatch" | "reservationPaymentProjectionMismatch" | "teamInactive" | "unbalancedJournalEntries" | "unbalancedTransactionJournalEntries" | "unpaidReservations";
18
21
  export type HealthTenantIssueSeverity = "error" | "warning";
19
22
  export type HealthTenantIssueStatus = "open" | "resolved";
20
- export type Generated<T> = T extends ColumnType<infer S, infer I, infer U> ? ColumnType<S, I | undefined, U> : ColumnType<T, T | undefined, T>;
21
23
  export type Int8 = ColumnType<string, bigint | number | string, bigint | number | string>;
22
24
  export type Json = JsonValue;
23
25
  export type JsonArray = JsonValue[];
@@ -31,6 +33,7 @@ export type PublicFlowType = "pull" | "push";
31
33
  export type PublicPlaidConnectMode = "create" | "replace" | "update";
32
34
  export type PublicPlaidConnectStatus = "awaitingConfiguration" | "completed" | "configuring" | "credentialsStored" | "discoveringAccounts" | "exchangeOutcomeUnknown" | "exchanging" | "expired" | "failed" | "pendingLink";
33
35
  export type PublicRecurringFeeConditionOperator = "<" | "<=" | "=" | ">" | ">=";
36
+ export type Timestamp = ColumnType<Date | string, Date | string, Date | string>;
34
37
  export type WebhookApiVersion = "2026-07-01";
35
38
  export type WebhookDeliveryStatus = "canceled" | "delivering" | "failed" | "queued" | "retrying" | "succeeded";
36
39
  export type WebhookEventType = "connection.changed" | "listing.changed" | "reservation.changed" | "statement.status.changed" | "sync.status.changed" | "team.issues.changed" | "transaction.changed" | "webhook.test";
@@ -38,7 +41,6 @@ export type WebhookResourceType = "connection" | "listing" | "reservation" | "st
38
41
  export type WebhookSubscriptionEventType = "connection.changed" | "listing.changed" | "reservation.changed" | "statement.status.changed" | "sync.status.changed" | "team.issues.changed" | "transaction.changed";
39
42
  export type WebhookSubscriptionScope = "managedTeams" | "self";
40
43
  export type WebhookSubscriptionStatus = "active" | "disabled" | "pending";
41
- export type Timestamp = ColumnType<Date | string, Date | string, Date | string>;
42
44
  export interface AccountingAccount {
43
45
  bankingCategory: string | null;
44
46
  bankingCurrency: string | null;
@@ -86,23 +88,6 @@ export interface AccountingAccountCategory {
86
88
  export interface AccountingAccountClassification {
87
89
  name: string;
88
90
  }
89
- export interface AccountingAccountReservationLineType {
90
- accountId: string | null;
91
- bookingChannel: string | null;
92
- createdAt: Generated<Timestamp>;
93
- id: Generated<string>;
94
- lineType: string;
95
- revenueRecognition: string | null;
96
- status: Generated<string | null>;
97
- tenantId: string;
98
- updatedAt: Generated<Timestamp>;
99
- }
100
- export interface AccountingAccountReservationRevRec {
101
- name: string;
102
- }
103
- export interface AccountingAccountType {
104
- name: string;
105
- }
106
91
  export interface AccountingAccountConnection {
107
92
  accountId: string | null;
108
93
  category: Generated<string | null>;
@@ -126,6 +111,23 @@ export interface AccountingAccountConnection {
126
111
  uniqueRef: string | null;
127
112
  updatedAt: Generated<Timestamp>;
128
113
  }
114
+ export interface AccountingAccountReservationLineType {
115
+ accountId: string | null;
116
+ bookingChannel: string | null;
117
+ createdAt: Generated<Timestamp>;
118
+ id: Generated<string>;
119
+ lineType: string;
120
+ revenueRecognition: string | null;
121
+ status: Generated<string | null>;
122
+ tenantId: string;
123
+ updatedAt: Generated<Timestamp>;
124
+ }
125
+ export interface AccountingAccountReservationRevRec {
126
+ name: string;
127
+ }
128
+ export interface AccountingAccountType {
129
+ name: string;
130
+ }
129
131
  export interface AccountingBankAccountCategory {
130
132
  name: string;
131
133
  }
@@ -133,8 +135,8 @@ export interface AccountingBankAccountType {
133
135
  name: string;
134
136
  }
135
137
  export interface AccountingBankRecord {
136
- accountId: string | null;
137
138
  accountConnectionId: string | null;
139
+ accountId: string | null;
138
140
  calculatedCentBalance: number | null;
139
141
  calculatedCentTotalCorrection: number | null;
140
142
  centBalance: number | null;
@@ -579,18 +581,18 @@ export interface AuditPublicEvent {
579
581
  actorName: string | null;
580
582
  actorType: AuditActionActorType;
581
583
  affectedAccountIds: Generated<string[]>;
582
- affectedAccounts: Generated<Json>;
583
- affectedOwnerStatementIds: Generated<string[]>;
584
- affectedOwnershipPeriodIds: Generated<string[]>;
585
- affectedPeriods: Generated<string[]>;
586
- changedDimensions: Generated<string[]>;
584
+ changedEntityTypes: Generated<string[]>;
585
+ changedPaths: Generated<string[]>;
587
586
  entityChanges: Generated<Json>;
588
587
  entityName: string | null;
589
588
  entityUniqueRef: string | null;
590
589
  id: Generated<string>;
590
+ hasChanges: Generated<boolean>;
591
+ netEffect: Generated<Json>;
591
592
  occurredAt: Timestamp;
592
593
  operation: AuditPublicEventOperation;
593
594
  projectionFingerprint: string;
595
+ projectionVersion: Generated<number>;
594
596
  requestId: string | null;
595
597
  revision: Generated<number>;
596
598
  rootEntityId: string;
@@ -601,23 +603,19 @@ export interface AuditPublicEvent {
601
603
  tenantId: string;
602
604
  updatedAt: Generated<Timestamp>;
603
605
  }
604
- export interface AuditPublicEventPostingChange {
605
- accountCategoryId: string | null;
606
- accountCategoryName: string | null;
607
- accountClassification: string | null;
608
- accountId: string | null;
609
- accountName: string | null;
610
- afterCentTotal: Int8 | null;
611
- beforeCentTotal: Int8 | null;
612
- currency: string | null;
606
+ export interface AuditPublicEventEntryChange {
607
+ accountIdAfter: string | null;
608
+ accountIdBefore: string | null;
609
+ afterSnapshot: Json | null;
610
+ beforeSnapshot: Json | null;
611
+ causedBy: Json | null;
612
+ changedAt: Timestamp;
613
+ changedFields: Generated<string[]>;
613
614
  eventId: string;
614
- id: Generated<string>;
615
- ledger: string | null;
616
- ownerStatementId: string | null;
617
- ownershipPeriodId: string | null;
618
- party: string | null;
619
- postingDate: Timestamp | null;
620
- status: string | null;
615
+ eventRevision: number;
616
+ id: string;
617
+ journalEntryId: string;
618
+ operation: AuditJournalDeltaOperation;
621
619
  tenantId: string;
622
620
  }
623
621
  export interface AuditPublicEventProjectionState {
@@ -876,6 +874,35 @@ export interface HdbCatalogHdbVersion {
876
874
  upgradedOn: Timestamp;
877
875
  version: string;
878
876
  }
877
+ export interface HealthTenantIssue {
878
+ affected: number;
879
+ category: HealthTenantIssueCategory;
880
+ code: HealthTenantIssueCode;
881
+ contentHash: string;
882
+ context: Json;
883
+ createdAt: Generated<Timestamp>;
884
+ firstSeenAt: Timestamp;
885
+ id: Generated<string>;
886
+ lastChangedAt: Timestamp;
887
+ message: string;
888
+ openedAt: Timestamp;
889
+ resolvedAt: Timestamp | null;
890
+ severity: HealthTenantIssueSeverity;
891
+ snapshotVersion: Int8;
892
+ status: HealthTenantIssueStatus;
893
+ tenantId: string;
894
+ updatedAt: Generated<Timestamp>;
895
+ version: Int8;
896
+ }
897
+ export interface HealthTenantIssueSnapshot {
898
+ computedAt: Timestamp | null;
899
+ contentHash: string | null;
900
+ createdAt: Generated<Timestamp>;
901
+ dirtyAt: Generated<Timestamp>;
902
+ tenantId: string;
903
+ updatedAt: Generated<Timestamp>;
904
+ version: Generated<Int8>;
905
+ }
879
906
  export interface PublicAccountCollection {
880
907
  automationId: string | null;
881
908
  connectionId: string;
@@ -1070,24 +1097,6 @@ export interface PublicControlPlaneProjectionEvent {
1070
1097
  eventVersion: number;
1071
1098
  payload: Generated<Json>;
1072
1099
  }
1073
- export interface PublicPlaidConnectSession {
1074
- connectionId: string | null;
1075
- createdAt: Generated<Timestamp>;
1076
- environment: string;
1077
- errorCode: string | null;
1078
- errorRetryable: boolean | null;
1079
- expiresAt: Timestamp;
1080
- id: Generated<string>;
1081
- itemId: string | null;
1082
- leaseExpiresAt: Timestamp | null;
1083
- linkSessionId: string | null;
1084
- mode: PublicPlaidConnectMode;
1085
- result: Json | null;
1086
- status: Generated<PublicPlaidConnectStatus>;
1087
- syncId: string | null;
1088
- tenantId: string;
1089
- updatedAt: Generated<Timestamp>;
1090
- }
1091
1100
  export interface PublicCurrency {
1092
1101
  name: string;
1093
1102
  }
@@ -1500,6 +1509,24 @@ export interface PublicPaymentStatus {
1500
1509
  export interface PublicPaymentType {
1501
1510
  name: string;
1502
1511
  }
1512
+ export interface PublicPlaidConnectSession {
1513
+ connectionId: string | null;
1514
+ createdAt: Generated<Timestamp>;
1515
+ environment: string;
1516
+ errorCode: string | null;
1517
+ errorRetryable: boolean | null;
1518
+ expiresAt: Timestamp;
1519
+ id: Generated<string>;
1520
+ itemId: string | null;
1521
+ leaseExpiresAt: Timestamp | null;
1522
+ linkSessionId: string | null;
1523
+ mode: PublicPlaidConnectMode;
1524
+ result: Json | null;
1525
+ status: Generated<PublicPlaidConnectStatus>;
1526
+ syncId: string | null;
1527
+ tenantId: string;
1528
+ updatedAt: Generated<Timestamp>;
1529
+ }
1503
1530
  export interface PublicRecurringFee {
1504
1531
  bookingChannelsFilter: string[] | null;
1505
1532
  createdAt: Generated<Timestamp>;
@@ -1755,6 +1782,9 @@ export interface PublicTenant {
1755
1782
  addressCountry: string | null;
1756
1783
  addressLine1: string | null;
1757
1784
  addressPostcode: string | null;
1785
+ /**
1786
+ * JSON column for app-owned tenant settings exposed through APIs.
1787
+ */
1758
1788
  appSettings: Json | null;
1759
1789
  billingAddressData: Json | null;
1760
1790
  billingAddressId: string | null;
@@ -1783,6 +1813,9 @@ export interface PublicTenant {
1783
1813
  defaultRevenueRecognition: string | null;
1784
1814
  email: string | null;
1785
1815
  featureFlags: Generated<Json | null>;
1816
+ /**
1817
+ * JSON column for explicit VRPilot onboarding guide state.
1818
+ */
1786
1819
  guideOnboarding: Json | null;
1787
1820
  historicalStatementsImportedAt: Timestamp | null;
1788
1821
  id: Generated<string>;
@@ -1932,34 +1965,72 @@ export interface PublicWebhook {
1932
1965
  types2: string[] | null;
1933
1966
  url: string;
1934
1967
  }
1935
- export interface HealthTenantIssue {
1936
- affected: number;
1937
- category: HealthTenantIssueCategory;
1938
- code: HealthTenantIssueCode;
1939
- contentHash: string;
1940
- context: Json;
1968
+ export interface TrackingEvent {
1941
1969
  createdAt: Generated<Timestamp>;
1942
- firstSeenAt: Timestamp;
1943
1970
  id: Generated<string>;
1944
- lastChangedAt: Timestamp;
1945
- message: string;
1946
- openedAt: Timestamp;
1947
- resolvedAt: Timestamp | null;
1948
- severity: HealthTenantIssueSeverity;
1949
- snapshotVersion: Int8;
1950
- status: HealthTenantIssueStatus;
1971
+ name: string;
1972
+ packageName: string;
1973
+ props: Json;
1974
+ tenantId: string | null;
1975
+ timestamp: Generated<Timestamp | null>;
1976
+ trackedAt: Generated<Timestamp | null>;
1977
+ userId: string | null;
1978
+ }
1979
+ export interface TrackingIntercomConversation {
1980
+ answer: string;
1981
+ conversationId: Int8;
1982
+ createdAt: Generated<Timestamp>;
1983
+ id: Generated<string>;
1984
+ isRelevant: boolean;
1985
+ outcome: string;
1986
+ question: string;
1987
+ summary: string;
1988
+ tags: string;
1989
+ }
1990
+ export interface TrackingIntercomConversationUser {
1991
+ conversationId: string;
1992
+ createdAt: Generated<Timestamp>;
1993
+ id: Generated<string>;
1994
+ userId: string;
1995
+ }
1996
+ export interface TrackingIntercomReport {
1997
+ action: string;
1998
+ category: string;
1999
+ createdAt: Generated<Timestamp>;
2000
+ id: Generated<string>;
2001
+ summary: string;
2002
+ tags: string;
2003
+ }
2004
+ export interface TrackingIntercomReportConversation {
2005
+ conversationId: string;
2006
+ id: Generated<string>;
2007
+ reportId: string;
2008
+ }
2009
+ export interface TrackingMetricCache {
2010
+ connectionId: Generated<string>;
2011
+ date: Timestamp;
2012
+ name: Generated<string>;
2013
+ refreshedAt: Generated<Timestamp>;
2014
+ status: Generated<string>;
1951
2015
  tenantId: string;
1952
- updatedAt: Generated<Timestamp>;
1953
- version: Int8;
2016
+ total: Numeric;
2017
+ type: string;
1954
2018
  }
1955
- export interface HealthTenantIssueSnapshot {
1956
- computedAt: Timestamp | null;
1957
- contentHash: string | null;
2019
+ export interface TrackingMonitorConnection {
2020
+ appId: string;
2021
+ connectionId: string;
1958
2022
  createdAt: Generated<Timestamp>;
1959
- dirtyAt: Generated<Timestamp>;
2023
+ id: Generated<string>;
2024
+ message: string | null;
2025
+ status: string | null;
2026
+ syncedAt: Timestamp | null;
1960
2027
  tenantId: string;
1961
- updatedAt: Generated<Timestamp>;
1962
- version: Generated<Int8>;
2028
+ triggerRef: string | null;
2029
+ updatedAt: Timestamp | null;
2030
+ version: number | null;
2031
+ }
2032
+ export interface TrackingMonitorConnectionState {
2033
+ name: string;
1963
2034
  }
1964
2035
  export interface WebhookDelivery {
1965
2036
  apiVersion: WebhookApiVersion;
@@ -2012,7 +2083,7 @@ export interface WebhookSubscription {
2012
2083
  createdAt: Generated<Timestamp>;
2013
2084
  description: string | null;
2014
2085
  disabledAt: Timestamp | null;
2015
- eventTypes: WebhookSubscriptionEventType[];
2086
+ eventTypes: ArrayType<WebhookSubscriptionEventType>;
2016
2087
  id: Generated<string>;
2017
2088
  ownerTenantId: string;
2018
2089
  revision: Generated<Int8>;
@@ -2032,73 +2103,6 @@ export interface WebhookSubscriptionSecret {
2032
2103
  revokedAt: Timestamp | null;
2033
2104
  subscriptionId: string;
2034
2105
  }
2035
- export interface TrackingEvent {
2036
- createdAt: Generated<Timestamp>;
2037
- id: Generated<string>;
2038
- name: string;
2039
- packageName: string;
2040
- props: Json;
2041
- tenantId: string | null;
2042
- timestamp: Generated<Timestamp | null>;
2043
- trackedAt: Generated<Timestamp | null>;
2044
- userId: string | null;
2045
- }
2046
- export interface TrackingIntercomConversation {
2047
- answer: string;
2048
- conversationId: Int8;
2049
- createdAt: Generated<Timestamp>;
2050
- id: Generated<string>;
2051
- isRelevant: boolean;
2052
- outcome: string;
2053
- question: string;
2054
- summary: string;
2055
- tags: string;
2056
- }
2057
- export interface TrackingIntercomConversationUser {
2058
- conversationId: string;
2059
- createdAt: Generated<Timestamp>;
2060
- id: Generated<string>;
2061
- userId: string;
2062
- }
2063
- export interface TrackingIntercomReport {
2064
- action: string;
2065
- category: string;
2066
- createdAt: Generated<Timestamp>;
2067
- id: Generated<string>;
2068
- summary: string;
2069
- tags: string;
2070
- }
2071
- export interface TrackingIntercomReportConversation {
2072
- conversationId: string;
2073
- id: Generated<string>;
2074
- reportId: string;
2075
- }
2076
- export interface TrackingMetricCache {
2077
- connectionId: Generated<string>;
2078
- date: Timestamp;
2079
- name: Generated<string>;
2080
- refreshedAt: Generated<Timestamp>;
2081
- status: Generated<string>;
2082
- tenantId: string;
2083
- total: Numeric;
2084
- type: string;
2085
- }
2086
- export interface TrackingMonitorConnection {
2087
- appId: string;
2088
- connectionId: string;
2089
- createdAt: Generated<Timestamp>;
2090
- id: Generated<string>;
2091
- message: string | null;
2092
- status: string | null;
2093
- syncedAt: Timestamp | null;
2094
- tenantId: string;
2095
- triggerRef: string | null;
2096
- updatedAt: Timestamp | null;
2097
- version: number | null;
2098
- }
2099
- export interface TrackingMonitorConnectionState {
2100
- name: string;
2101
- }
2102
2106
  export interface DB {
2103
2107
  "accounting.account": AccountingAccount;
2104
2108
  "accounting.accountAssignment": AccountingAccountAssignment;
@@ -2106,10 +2110,10 @@ export interface DB {
2106
2110
  "accounting.accountAssignmentType": AccountingAccountAssignmentType;
2107
2111
  "accounting.accountCategory": AccountingAccountCategory;
2108
2112
  "accounting.accountClassification": AccountingAccountClassification;
2113
+ "accounting.accountConnection": AccountingAccountConnection;
2109
2114
  "accounting.accountReservationLineType": AccountingAccountReservationLineType;
2110
2115
  "accounting.accountReservationRevRec": AccountingAccountReservationRevRec;
2111
2116
  "accounting.accountType": AccountingAccountType;
2112
- "accounting.accountConnection": AccountingAccountConnection;
2113
2117
  "accounting.bankAccountCategory": AccountingBankAccountCategory;
2114
2118
  "accounting.bankAccountType": AccountingBankAccountType;
2115
2119
  "accounting.bankRecord": AccountingBankRecord;
@@ -2148,7 +2152,7 @@ export interface DB {
2148
2152
  "audit.journalDelta": AuditJournalDelta;
2149
2153
  "audit.mutation": AuditMutation;
2150
2154
  "audit.publicEvent": AuditPublicEvent;
2151
- "audit.publicEventPostingChange": AuditPublicEventPostingChange;
2155
+ "audit.publicEventEntryChange": AuditPublicEventEntryChange;
2152
2156
  "audit.publicEventProjectionState": AuditPublicEventProjectionState;
2153
2157
  "core.activeStatus": CoreActiveStatus;
2154
2158
  "core.change": CoreChange;
@@ -2166,8 +2170,6 @@ export interface DB {
2166
2170
  "core.syncStatus": CoreSyncStatus;
2167
2171
  "core.syncSubtask": CoreSyncSubtask;
2168
2172
  "core.syncType": CoreSyncType;
2169
- "health.tenantIssue": HealthTenantIssue;
2170
- "health.tenantIssueSnapshot": HealthTenantIssueSnapshot;
2171
2173
  "hdbCatalog.eventInvocationLogs": HdbCatalogEventInvocationLogs;
2172
2174
  "hdbCatalog.eventLog": HdbCatalogEventLog;
2173
2175
  "hdbCatalog.hdbActionLog": HdbCatalogHdbActionLog;
@@ -2180,6 +2182,8 @@ export interface DB {
2180
2182
  "hdbCatalog.hdbSchemaNotifications": HdbCatalogHdbSchemaNotifications;
2181
2183
  "hdbCatalog.hdbSourceCatalogVersion": HdbCatalogHdbSourceCatalogVersion;
2182
2184
  "hdbCatalog.hdbVersion": HdbCatalogHdbVersion;
2185
+ "health.tenantIssue": HealthTenantIssue;
2186
+ "health.tenantIssueSnapshot": HealthTenantIssueSnapshot;
2183
2187
  "public.accountCollection": PublicAccountCollection;
2184
2188
  "public.accountCollectionType": PublicAccountCollectionType;
2185
2189
  "public.address": PublicAddress;
@@ -2194,7 +2198,6 @@ export interface DB {
2194
2198
  "public.connectionRoute": PublicConnectionRoute;
2195
2199
  "public.controlPlaneOutbox": PublicControlPlaneOutbox;
2196
2200
  "public.controlPlaneProjectionEvent": PublicControlPlaneProjectionEvent;
2197
- "public.plaidConnectSession": PublicPlaidConnectSession;
2198
2201
  "public.currency": PublicCurrency;
2199
2202
  "public.duplicateEmails": PublicDuplicateEmails;
2200
2203
  "public.emailTemplate": PublicEmailTemplate;
@@ -2233,6 +2236,7 @@ export interface DB {
2233
2236
  "public.paymentLineClassification": PublicPaymentLineClassification;
2234
2237
  "public.paymentStatus": PublicPaymentStatus;
2235
2238
  "public.paymentType": PublicPaymentType;
2239
+ "public.plaidConnectSession": PublicPlaidConnectSession;
2236
2240
  "public.recurringFee": PublicRecurringFee;
2237
2241
  "public.recurringFeeAccount": PublicRecurringFeeAccount;
2238
2242
  "public.recurringFeeAccountCondition": PublicRecurringFeeAccountCondition;