@vrplatform/kysely 1.3.45-6090 → 1.3.45-61
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 +0 -0
- package/build/main/control-plane/index.d.ts +175 -0
- package/build/main/control-plane/index.js.map +1 -1
- package/build/main/index.d.ts +2 -2
- package/build/main/index.js +111 -22
- package/build/main/index.js.map +1 -1
- package/build/main/local/generate.js +2 -0
- package/build/main/local/generate.js.map +1 -1
- package/build/main/local/index.js +12 -0
- package/build/main/local/index.js.map +1 -1
- package/build/main/query/listing/status.js +2 -6
- package/build/main/query/listing/status.js.map +1 -1
- package/build/main/query/tenant/status.js +2 -2
- package/build/main/query/tenant/status.js.map +1 -1
- package/build/main/test/index.d.ts +0 -3
- package/build/main/test/index.js +0 -9
- package/build/main/test/index.js.map +1 -1
- package/build/main/v1.generated.d.ts +253 -2
- package/build/main/v1.generated.js.map +1 -1
- package/build/migrations-v2/0000000000015-durable-flow-events.ts +163 -0
- package/build/migrations-v2/0000000000016-billing-listing-facts.ts +539 -0
- package/build/migrations-v2/0000000000016-managed-team-access.ts +34 -0
- package/build/migrations-v2/0000000000017-drop-trial-until.ts +42 -0
- package/build/migrations-v2/0000000000017-webhook-secret-reencryption-failures.ts +18 -0
- package/build/migrations-v2/0000000000018-accounting-integrity-monitoring.ts +276 -0
- package/build/migrations-v2/0000000000018-durable-flow-event-sensitive-input.ts +28 -0
- package/build/migrations-v2/0000000000019-accounting-integrity-run-shards.ts +26 -0
- package/build/migrations-v2/0000000000019-asynchronous-operations.ts +736 -0
- package/build/migrations-v2/0000000000020-accounting-integrity-case-classification.ts +52 -0
- package/build/migrations-v2/0000000000021-payment-line-classification-monitor-indexes.ts +31 -0
- package/build/migrations-v2/0000000000022-accounting-integrity-controlled-repairs.ts +281 -0
- package/build/migrations-v2/0000000000023-line-classification-usage.ts +325 -0
- package/build/migrations-v2/0000000000024-tenant-region-migration.ts +108 -0
- package/build/migrations-v2/0000000000025-partner-ach-denial-default.ts +30 -0
- package/build/migrations-v2/0000000000026-line-classification-usage-capture.ts +399 -0
- package/build/migrations-v2/0000000000027-payout-replacement-chain.ts +27 -0
- package/build/migrations-v2/0000000000028-accounting-integrity-operator-workflow.ts +108 -0
- package/build/migrations-v2/0000000000029-accounting-integrity-definition-artifacts.ts +40 -0
- package/build/migrations-v2/0000000000030-accounting-integrity-review-metadata-compatibility.ts +49 -0
- package/build/migrations-v2/0000000000031-ui-permission-role-simplification.ts +70 -0
- package/build/migrations-v2/0000000000032-tenant-delete-ownership-cascades.ts +44 -0
- package/build/module/control-plane/index.d.ts +175 -0
- package/build/module/control-plane/index.js.map +1 -1
- package/build/module/index.d.ts +2 -2
- package/build/module/index.js +113 -23
- package/build/module/index.js.map +1 -1
- package/build/module/local/generate.js +2 -0
- package/build/module/local/generate.js.map +1 -1
- package/build/module/local/index.js +12 -0
- package/build/module/local/index.js.map +1 -1
- package/build/module/query/listing/status.js +2 -6
- package/build/module/query/listing/status.js.map +1 -1
- package/build/module/query/tenant/status.js +2 -2
- package/build/module/query/tenant/status.js.map +1 -1
- package/build/module/test/index.d.ts +0 -3
- package/build/module/test/index.js +0 -9
- package/build/module/test/index.js.map +1 -1
- package/build/module/v1.generated.d.ts +253 -2
- package/build/module/v1.generated.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["local/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,wCAkQC;AA/SD,qCAAyC;AACzC,gDAAkC;AAClC,iDAA8C;AAC9C,mCAA8E;AAC9E,iEAAsD;AACtD,oDAA+E;AAE/E,4CAAiD;AACjD,wCAAuC;AAEvC,qCAA8E;AAEjE,QAAA,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AACrC,QAAA,QAAQ,GAAG,IAAI,CAAC,IAAI,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AO,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,MAAqB,CAAC;AAC/B,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, sql } from 'kysely';\nimport { PGliteDialect } from 'kysely-pglite-dialect';\nimport { type ControlPlaneDB, withControlPlaneSchema } from '../control-plane';\nimport type { ControlPlaneKysely } from '../index';\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\nexport type LocalKysely = import('kysely').Kysely<DB> & {\n controlPlaneKysely: ControlPlaneKysely;\n};\n\nasync function migrateToLatest<Database>(\n kysely: import('kysely').Kysely<Database>\n) {\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(\n args: UseLocalKyselyOptions = {}\n): Promise<LocalKysely> {\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<DB>(dialect, {\n repositoryName: args?.repositoryName ?? 'localTesting',\n log: args?.log,\n });\n await ensureDigestFunction(kysely);\n await ensureGenRandomBytesFunction(kysely);\n await migrateToLatest(kysely);\n\n await sql`alter schema public rename to regional_public`.execute(kysely);\n await sql`alter schema core rename to regional_core`.execute(kysely);\n await sql`create schema public`.execute(kysely);\n await sql`create schema core`.execute(kysely);\n\n const controlPlaneBootstrapKysely = getKysely<ControlPlaneDB>(dialect, {\n repositoryName: `${args.repositoryName ?? 'localTesting'}/control-plane-bootstrap`,\n });\n const controlPlaneMigrator = new Migrator({\n db: controlPlaneBootstrapKysely,\n migrationTableSchema: 'public',\n migrationTableName: 'control_plane_kysely_migration',\n migrationLockTableName: 'control_plane_kysely_migration_lock',\n provider: new FileMigrationProvider({\n fs,\n path,\n migrationFolder: path.join(root, 'control-plane-migrations'),\n }),\n });\n const { error: controlPlaneMigrationError } =\n await controlPlaneMigrator.migrateToLatest();\n if (controlPlaneMigrationError) {\n throw controlPlaneMigrationError;\n }\n\n await sql`alter table core.issue_message_overwrite set schema public`.execute(\n controlPlaneBootstrapKysely\n );\n await sql`drop schema core`.execute(controlPlaneBootstrapKysely);\n await sql`alter schema public rename to control_plane`.execute(\n controlPlaneBootstrapKysely\n );\n await sql`alter schema regional_public rename to public`.execute(\n controlPlaneBootstrapKysely\n );\n await sql`alter schema regional_core rename to core`.execute(\n controlPlaneBootstrapKysely\n );\n await sql`\n do $$\n declare\n definition text;\n begin\n select pg_get_functiondef(\n 'control_plane.normalize_tenant_slug(text)'::regprocedure\n ) into definition;\n execute replace(definition, 'public.', 'control_plane.');\n\n select pg_get_functiondef(\n 'control_plane.build_unique_tenant_slug(text,uuid)'::regprocedure\n ) into definition;\n execute replace(definition, 'public.', 'control_plane.');\n end;\n $$;\n `.execute(controlPlaneBootstrapKysely);\n await sql`\n insert into control_plane.app (\n authentication,\n category,\n color,\n created_at,\n icon,\n icon_round,\n id,\n info,\n name,\n type,\n version\n )\n select\n authentication,\n category,\n color,\n created_at,\n icon,\n icon_round,\n id,\n info,\n name,\n type,\n version\n from public.app\n on conflict (id) do nothing;\n `.execute(controlPlaneBootstrapKysely);\n await sql`\n insert into control_plane.currency (name)\n select name\n from public.currency\n on conflict (name) do nothing;\n `.execute(controlPlaneBootstrapKysely);\n await sql`\n insert into control_plane.booking_channel (\n channel_ref,\n color,\n created_at,\n icon,\n icon_provider,\n id,\n last_generate_run,\n logo,\n logo_provider,\n selected_booking_channel_icon_candidate_id,\n selected_booking_channel_logo_candidate_id,\n unique_ref,\n updated_at\n )\n select\n channel_ref,\n color,\n created_at,\n icon,\n icon_provider,\n id,\n last_generate_run,\n logo,\n logo_provider,\n selected_booking_channel_icon_candidate_id,\n selected_booking_channel_logo_candidate_id,\n unique_ref,\n updated_at\n from public.booking_channel\n on conflict (id) do nothing;\n `.execute(controlPlaneBootstrapKysely);\n await sql`\n insert into control_plane.booking_channel_icon_candidate (\n booking_channel_id,\n cloudflare_image_id,\n color,\n comment,\n created_at,\n external_icon,\n height,\n id,\n provider,\n source,\n updated_at,\n width\n )\n select\n booking_channel_id,\n cloudflare_image_id,\n color,\n comment,\n created_at,\n external_icon,\n height,\n id,\n provider,\n source,\n updated_at,\n width\n from public.booking_channel_icon_candidate\n on conflict (id) do nothing;\n `.execute(controlPlaneBootstrapKysely);\n await sql`\n insert into control_plane.tenant (\n billing_partner_id,\n billing_plan,\n created_at,\n data_region,\n id,\n name,\n partner_id,\n slug,\n status,\n storage_realm,\n type,\n unique_ref,\n updated_at\n )\n select\n billing_partner_id,\n billing_plan,\n created_at,\n data_region,\n id,\n name,\n partner_id,\n slug,\n status,\n storage_realm,\n type,\n unique_ref,\n updated_at\n from public.tenant\n on conflict (id) do nothing;\n `.execute(controlPlaneBootstrapKysely);\n await sql`\n insert into control_plane.token (\n created_at,\n expires_at,\n id,\n nano_id,\n payload,\n tenant_id,\n type,\n user_id\n )\n select\n created_at,\n expires_at,\n id,\n nano_id,\n payload,\n tenant_id,\n type,\n user_id\n from public.token\n on conflict (id) do nothing;\n `.execute(controlPlaneBootstrapKysely);\n\n const controlPlaneKysely = withControlPlaneSchema(\n getKysely<ControlPlaneDB>(dialect, {\n repositoryName: `${args.repositoryName ?? 'localTesting'}/control-plane`,\n log: args.log,\n }),\n 'control_plane',\n 'control_plane'\n );\n controlPlaneKysely.destroy = async () => {};\n Object.defineProperty(kysely, 'controlPlaneKysely', {\n value: controlPlaneKysely,\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 as LocalKysely;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["local/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,wCA+QC;AA7TD,qCAAyC;AACzC,gDAAkC;AAClC,iDAA8C;AAC9C,mCAA8E;AAC9E,iEAAsD;AACtD,oDAA+E;AAE/E,4CAAiD;AACjD,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;AAWrD,KAAK,UAAU,eAAe,CAC5B,MAAyC;IAEzC,MAAM,QAAQ,GAAG,IAAI,iBAAQ,CAAC;QAC5B,wBAAwB,EAAE,IAAI;QAC9B,EAAE,EAAE,MAAM;QACV,oBAAoB,EAAE,6BAAiB,CAAC,WAAW;QACnD,kBAAkB,EAAE,6BAAiB,CAAC,SAAS;QAC/C,sBAAsB,EAAE,6B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QACxC,MAAM,eAAe,EAAE,CAAC;QACxB,cAAc;QACd,0EAA0E;QAC1E,IAAI;IACN,CAAC,CAAC;IAEF,iFAAiF;IAEjF,OAAO,MAAqB,CAAC;AAC/B,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, sql } from 'kysely';\nimport { PGliteDialect } from 'kysely-pglite-dialect';\nimport { type ControlPlaneDB, withControlPlaneSchema } from '../control-plane';\nimport type { ControlPlaneKysely } from '../index';\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\nexport type LocalKysely = import('kysely').Kysely<DB> & {\n controlPlaneKysely: ControlPlaneKysely;\n};\n\nasync function migrateToLatest<Database>(\n kysely: import('kysely').Kysely<Database>\n) {\n const migrator = new Migrator({\n allowUnorderedMigrations: true,\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(\n args: UseLocalKyselyOptions = {}\n): Promise<LocalKysely> {\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<DB>(dialect, {\n repositoryName: args?.repositoryName ?? 'localTesting',\n log: args?.log,\n });\n await ensureDigestFunction(kysely);\n await ensureGenRandomBytesFunction(kysely);\n await migrateToLatest(kysely);\n\n await sql`alter schema public rename to regional_public`.execute(kysely);\n await sql`alter schema core rename to regional_core`.execute(kysely);\n await sql`create schema public`.execute(kysely);\n await sql`create schema core`.execute(kysely);\n\n const controlPlaneBootstrapKysely = getKysely<ControlPlaneDB>(dialect, {\n repositoryName: `${args.repositoryName ?? 'localTesting'}/control-plane-bootstrap`,\n });\n const controlPlaneMigrator = new Migrator({\n db: controlPlaneBootstrapKysely,\n migrationTableSchema: 'public',\n migrationTableName: 'control_plane_kysely_migration',\n migrationLockTableName: 'control_plane_kysely_migration_lock',\n provider: new FileMigrationProvider({\n fs,\n path,\n migrationFolder: path.join(root, 'control-plane-migrations'),\n }),\n });\n const { error: controlPlaneMigrationError } =\n await controlPlaneMigrator.migrateToLatest();\n if (controlPlaneMigrationError) {\n throw controlPlaneMigrationError;\n }\n\n await sql`alter table core.flow set schema public`.execute(\n controlPlaneBootstrapKysely\n );\n await sql`alter table core.issue_message_overwrite set schema public`.execute(\n controlPlaneBootstrapKysely\n );\n await sql`drop schema core`.execute(controlPlaneBootstrapKysely);\n await sql`alter schema public rename to control_plane`.execute(\n controlPlaneBootstrapKysely\n );\n await sql`alter schema regional_public rename to public`.execute(\n controlPlaneBootstrapKysely\n );\n await sql`alter schema regional_core rename to core`.execute(\n controlPlaneBootstrapKysely\n );\n await sql`\n do $$\n declare\n definition text;\n begin\n select pg_get_functiondef(\n 'control_plane.normalize_tenant_slug(text)'::regprocedure\n ) into definition;\n execute replace(definition, 'public.', 'control_plane.');\n\n select pg_get_functiondef(\n 'control_plane.build_unique_tenant_slug(text,uuid)'::regprocedure\n ) into definition;\n execute replace(definition, 'public.', 'control_plane.');\n\n select pg_get_functiondef(\n 'control_plane.refresh_operation_state(uuid)'::regprocedure\n ) into definition;\n execute replace(definition, 'public.', 'control_plane.');\n\n select pg_get_functiondef(\n 'control_plane.refresh_destructive_job_operation()'::regprocedure\n ) into definition;\n execute replace(definition, 'public.', 'control_plane.');\n end;\n $$;\n `.execute(controlPlaneBootstrapKysely);\n await sql`\n insert into control_plane.app (\n authentication,\n category,\n color,\n created_at,\n icon,\n icon_round,\n id,\n info,\n name,\n type,\n version\n )\n select\n authentication,\n category,\n color,\n created_at,\n icon,\n icon_round,\n id,\n info,\n name,\n type,\n version\n from public.app\n on conflict (id) do nothing;\n `.execute(controlPlaneBootstrapKysely);\n await sql`\n insert into control_plane.currency (name)\n select name\n from public.currency\n on conflict (name) do nothing;\n `.execute(controlPlaneBootstrapKysely);\n await sql`\n insert into control_plane.booking_channel (\n channel_ref,\n color,\n created_at,\n icon,\n icon_provider,\n id,\n last_generate_run,\n logo,\n logo_provider,\n selected_booking_channel_icon_candidate_id,\n selected_booking_channel_logo_candidate_id,\n unique_ref,\n updated_at\n )\n select\n channel_ref,\n color,\n created_at,\n icon,\n icon_provider,\n id,\n last_generate_run,\n logo,\n logo_provider,\n selected_booking_channel_icon_candidate_id,\n selected_booking_channel_logo_candidate_id,\n unique_ref,\n updated_at\n from public.booking_channel\n on conflict (id) do nothing;\n `.execute(controlPlaneBootstrapKysely);\n await sql`\n insert into control_plane.booking_channel_icon_candidate (\n booking_channel_id,\n cloudflare_image_id,\n color,\n comment,\n created_at,\n external_icon,\n height,\n id,\n provider,\n source,\n updated_at,\n width\n )\n select\n booking_channel_id,\n cloudflare_image_id,\n color,\n comment,\n created_at,\n external_icon,\n height,\n id,\n provider,\n source,\n updated_at,\n width\n from public.booking_channel_icon_candidate\n on conflict (id) do nothing;\n `.execute(controlPlaneBootstrapKysely);\n await sql`\n insert into control_plane.tenant (\n billing_partner_id,\n billing_plan,\n created_at,\n data_region,\n id,\n name,\n partner_id,\n slug,\n status,\n storage_realm,\n type,\n unique_ref,\n updated_at\n )\n select\n billing_partner_id,\n billing_plan,\n created_at,\n data_region,\n id,\n name,\n partner_id,\n slug,\n status,\n storage_realm,\n type,\n unique_ref,\n updated_at\n from public.tenant\n on conflict (id) do nothing;\n `.execute(controlPlaneBootstrapKysely);\n await sql`\n insert into control_plane.token (\n created_at,\n expires_at,\n id,\n nano_id,\n payload,\n tenant_id,\n type,\n user_id\n )\n select\n created_at,\n expires_at,\n id,\n nano_id,\n payload,\n tenant_id,\n type,\n user_id\n from public.token\n on conflict (id) do nothing;\n `.execute(controlPlaneBootstrapKysely);\n\n const controlPlaneKysely = withControlPlaneSchema(\n getKysely<ControlPlaneDB>(dialect, {\n repositoryName: `${args.repositoryName ?? 'localTesting'}/control-plane`,\n log: args.log,\n }),\n 'control_plane',\n 'control_plane'\n );\n controlPlaneKysely.destroy = async () => {};\n Object.defineProperty(kysely, 'controlPlaneKysely', {\n value: controlPlaneKysely,\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 as LocalKysely;\n}\n"]}
|
|
@@ -5,17 +5,13 @@ exports.whereListingIsActive = whereListingIsActive;
|
|
|
5
5
|
exports.selectListingStatus = selectListingStatus;
|
|
6
6
|
const utils_1 = require("@vrplatform/utils");
|
|
7
7
|
const isomorphic_1 = require("../../isomorphic");
|
|
8
|
+
const status_1 = require("../tenant/status");
|
|
8
9
|
function hasActiveListing(eb, today) {
|
|
9
10
|
return eb.exists(eb
|
|
10
11
|
.selectFrom('public.tenant as tenant')
|
|
11
|
-
.leftJoin('public.tenant as billingPartner', 'billingPartner.id', 'tenant.calculatedBillingPartnerId')
|
|
12
12
|
.select('tenant.id')
|
|
13
13
|
.whereRef('tenant.id', '=', 'l.tenantId')
|
|
14
|
-
.where(
|
|
15
|
-
.where((eb2) => eb2.or([
|
|
16
|
-
eb2('tenant.calculatedBillingPartnerId', 'is', null),
|
|
17
|
-
eb2('billingPartner.calculatedStatus', '=', 'active'),
|
|
18
|
-
]))
|
|
14
|
+
.where(status_1.whereTenantActive)
|
|
19
15
|
.where((eb2) => eb2.or([
|
|
20
16
|
eb2.and([
|
|
21
17
|
eb2('tenant.isGeneralLedger', '=', false),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"src/","sources":["query/listing/status.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"src/","sources":["query/listing/status.ts"],"names":[],"mappings":";;AAuFA,wDAKC;AAED,oDAKC;AAED,kDAUC;AA/GD,6CAAwC;AAExC,iDAAuC;AACvC,6CAAqD;AAErD,SAAS,gBAAgB,CACvB,EAAqD,EACrD,KAAa;IAEb,OAAO,EAAE,CAAC,MAAM,CACd,EAAE;SACC,UAAU,CAAC,yBAAyB,CAAC;SACrC,MAAM,CAAC,WAAW,CAAC;SACnB,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE,YAAY,CAAC;SACxC,KAAK,CAAC,0BAAiB,CAAC;SACxB,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CACb,GAAG,CAAC,EAAE,CAAC;QACL,GAAG,CAAC,GAAG,CAAC;YACN,GAAG,CAAC,wBAAwB,EAAE,GAAG,EAAE,KAAK,CAAC;YACzC,EAAE,CAAC,oBAAoB,EAAE,GAAG,EAAE,QAAQ,CAAC;SACxC,CAAC;QACF,GAAG,CAAC,GAAG,CAAC;YACN,GAAG,CAAC,wBAAwB,EAAE,GAAG,EAAE,IAAI,CAAC;YACxC,EAAE,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;SACxC,CAAC;KACH,CAAC,CACH;SACA,KAAK,CAAC,CAAC,CAAC,CACZ,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAC3B,EAAqD,EACrD,KAAa;IAEb,MAAM,MAAM,GAAG,IAAA,WAAG,EAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;IACnC,OAAO,EAAE,CAAC,MAAM,CACd,EAAE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N,GAAG,CAAC,wBAAwB,EAAE,GAAG,EAAE,IAAI,CAAC;YACxC,oBAAoB,CAAC,EAAE,EAAE,KAAK,CAAC;SAChC,CAAC;KACH,CAAC,CACH,CACJ,CAAC;AACJ,CAAC;AAED,SAAgB,sBAAsB,CACpC,EAAqD,EACrD,QAAgB,IAAA,WAAG,GAAE,CAAC,QAAQ,EAAE;IAEhC,OAAO,kBAAkB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACvC,CAAC;AAED,SAAgB,oBAAoB,CAClC,EAAqD,EACrD,QAAgB,IAAA,WAAG,GAAE,CAAC,QAAQ,EAAE;IAEhC,OAAO,gBAAgB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACrC,CAAC;AAED,SAAgB,mBAAmB,CACjC,EAAqD,EACrD,QAAgB,IAAA,WAAG,GAAE,CAAC,QAAQ,EAAE;IAEhC,OAAO,EAAE;SACN,IAAI,EAAE;SACN,IAAI,CAAC,sBAAsB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;SACvC,IAAI,CAAC,UAAU,CAAC;SAChB,IAAI,CAAC,QAAQ,CAAC;SACd,GAAG,EAAE,CAAC;AACX,CAAC","sourcesContent":["import { day } from '@vrplatform/utils';\nimport type { DB, ExpressionBuilder, PublicListing } from '../../isomorphic';\nimport { sql } from '../../isomorphic';\nimport { whereTenantActive } from '../tenant/status';\n\nfunction hasActiveListing(\n eb: ExpressionBuilder<DB & { l: PublicListing }, 'l'>,\n today: string\n) {\n return eb.exists(\n eb\n .selectFrom('public.tenant as tenant')\n .select('tenant.id')\n .whereRef('tenant.id', '=', 'l.tenantId')\n .where(whereTenantActive)\n .where((eb2) =>\n eb2.or([\n eb2.and([\n eb2('tenant.isGeneralLedger', '=', false),\n eb('l.calculatedStatus', '=', 'active'),\n ]),\n eb2.and([\n eb2('tenant.isGeneralLedger', '=', true),\n eb.not(hasInactiveOwnership(eb, today)),\n ]),\n ])\n )\n .limit(1)\n );\n}\n\nfunction hasInactiveOwnership(\n eb: ExpressionBuilder<DB & { l: PublicListing }, 'l'>,\n today: string\n) {\n const onDate = day(today).toDate();\n return eb.exists(\n eb\n .selectFrom('public.listingOwnershipPeriod as lop')\n .select('lop.id')\n .where(\n 'lop.listingId',\n '=',\n sql<string>`coalesce(${sql.ref('l.parentId')}, ${sql.ref('l.id')})`\n )\n .whereRef('lop.tenantId', '=', 'l.tenantId')\n .where('lop.setListingInactive', '=', true)\n .where((eb2) =>\n eb2.or([\n eb2.and([\n eb2('lop.startAt', '<=', onDate),\n eb2('lop.endAt', '>=', onDate),\n ]),\n eb2.and([\n eb2('lop.startAt', '<=', onDate),\n eb2('lop.endAt', 'is', null),\n ]),\n ])\n )\n .limit(1)\n );\n}\n\nfunction hasInactiveListing(\n eb: ExpressionBuilder<DB & { l: PublicListing }, 'l'>,\n today: string\n) {\n return eb.exists(\n eb\n .selectFrom('public.tenant as tenant')\n .select('tenant.id')\n .whereRef('tenant.id', '=', 'l.tenantId')\n .where((eb2) =>\n eb2.or([\n eb2.and([\n eb2('tenant.isGeneralLedger', '=', false),\n eb('l.calculatedStatus', '=', 'inactive'),\n ]),\n eb2.and([\n eb2('tenant.isGeneralLedger', '=', true),\n hasInactiveOwnership(eb, today),\n ]),\n ])\n )\n );\n}\n\nexport function whereListingIsInactive(\n eb: ExpressionBuilder<DB & { l: PublicListing }, 'l'>,\n today: string = day().yyyymmdd()\n) {\n return hasInactiveListing(eb, today);\n}\n\nexport function whereListingIsActive(\n eb: ExpressionBuilder<DB & { l: PublicListing }, 'l'>,\n today: string = day().yyyymmdd()\n) {\n return hasActiveListing(eb, today);\n}\n\nexport function selectListingStatus(\n eb: ExpressionBuilder<DB & { l: PublicListing }, 'l'>,\n today: string = day().yyyymmdd()\n) {\n return eb\n .case()\n .when(whereListingIsInactive(eb, today))\n .then('inactive')\n .else('active')\n .end();\n}\n"]}
|
|
@@ -8,11 +8,11 @@ const billing_partner_1 = require("./billing-partner");
|
|
|
8
8
|
function whereTenantActive(eb) {
|
|
9
9
|
return eb.and([
|
|
10
10
|
eb('tenant.calculatedStatus', '=', 'active'),
|
|
11
|
-
eb.exists(eb
|
|
11
|
+
eb.not(eb.exists(eb
|
|
12
12
|
.selectFrom('public.tenant as billingPartner')
|
|
13
13
|
.select('billingPartner.id')
|
|
14
14
|
.where('billingPartner.id', '=', eb.fn.coalesce('tenant.calculatedBillingPartnerId', eb.val((0, billing_partner_1.getCalculatedBillingPartnerId)({}))))
|
|
15
|
-
.where('billingPartner.calculatedStatus', '
|
|
15
|
+
.where('billingPartner.calculatedStatus', 'is distinct from', 'active'))),
|
|
16
16
|
]);
|
|
17
17
|
}
|
|
18
18
|
function whereTenantNotTestTeam(testTeamId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"src/","sources":["query/tenant/status.ts"],"names":[],"mappings":";;AAcA,
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"src/","sources":["query/tenant/status.ts"],"names":[],"mappings":";;AAcA,8CAwBC;AAED,wDAYC;AAED,0DAeC;AArED,iDAM0B;AAC1B,uDAAkE;AAOlE,SAAgB,iBAAiB,CAAC,EAA2B;IAC3D,OAAO,EAAE,CAAC,GAAG,CAAC;QACZ,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE,QAAQ,CAAC;QAC5C,EAAE,CAAC,GAAG,CACJ,EAAE,CAAC,MAAM,CACP,EAAE;aACC,UAAU,CAAC,iCAAiC,CAAC;aAC7C,MAAM,CAAC,mBAAmB,CAAC;aAC3B,KAAK,CACJ,mBAAmB,EACnB,GAAG,EACH,EAAE,CAAC,EAAE,CAAC,QAAQ,CACZ,mCAAmC,EACnC,EAAE,CAAC,GAAG,CAAC,IAAA,+CAA6B,EAAC,EAAE,CAAC,CAAC,CAC1C,CACF;aACA,KAAK,CACJ,iCAAiC,EACjC,kBAAkB,EAClB,QAAQ,CACT,CACJ,CACF;KACF,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,sBAAsB,CAAC,UAAkB;IACvD,OAAO,IAAA,gBAAG,EAAS;MACf,gBAAG,CAAC,GAAG,CAAC,WAAW,CAAC,OAAO,UAAU;;QAEnC,gBAAG,CAAC,GAAG,CAAC,kBAAkB,CAAC;WACxB,gBAAG,CAAC,GAAG,CAAC,kBAAkB,CAAC,OAAO,UAAU;;;QAG/C,gBAAG,CAAC,GAAG,CAAC,yBAAyB,CAAC;WAC/B,gBAAG,CAAC,GAAG,CAAC,yBAAyB,CAAC,OAAO,UAAU;;IAE1D,CAAC;AACL,CAAC;AAED,SAAgB,uBAAuB,CACrC,EAA2B,EAC3B,EACE,mBAAmB,GAAG,KAAK,MAGzB,EAAE;IAEN,OAAO,EAAE,CAAC,GAAG,CAAC;QACZ,iBAAiB,CAAC,EAAE,CAAC;QACrB,EAAE,CAAC,qBAAqB,EAAE,GAAG,EAAE,KAAK,CAAC;QACrC,GAAG,CAAC,mBAAmB;YACrB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,CAAC,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;KACpD,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n sql,\n type DB,\n type ExpressionBuilder,\n type PublicTenant,\n type SqlBool,\n} from '../../isomorphic';\nimport { getCalculatedBillingPartnerId } from './billing-partner';\n\ntype TenantExpressionBuilder = ExpressionBuilder<\n DB & { tenant: PublicTenant },\n 'tenant'\n>;\n\nexport function whereTenantActive(eb: TenantExpressionBuilder) {\n return eb.and([\n eb('tenant.calculatedStatus', '=', 'active'),\n eb.not(\n eb.exists(\n eb\n .selectFrom('public.tenant as billingPartner')\n .select('billingPartner.id')\n .where(\n 'billingPartner.id',\n '=',\n eb.fn.coalesce(\n 'tenant.calculatedBillingPartnerId',\n eb.val(getCalculatedBillingPartnerId({}))\n )\n )\n .where(\n 'billingPartner.calculatedStatus',\n 'is distinct from',\n 'active'\n )\n )\n ),\n ]);\n}\n\nexport function whereTenantNotTestTeam(testTeamId: string) {\n return sql<SqlBool>`(\n ${sql.ref('tenant.id')} != ${testTeamId}\n and (\n ${sql.ref('tenant.partnerId')} is null\n or ${sql.ref('tenant.partnerId')} != ${testTeamId}\n )\n and (\n ${sql.ref('tenant.billingPartnerId')} is null\n or ${sql.ref('tenant.billingPartnerId')} != ${testTeamId}\n )\n )`;\n}\n\nexport function whereTenantShouldBePaid(\n eb: TenantExpressionBuilder,\n {\n includePartnerTeams = false,\n }: {\n includePartnerTeams?: boolean;\n } = {}\n) {\n return eb.and([\n whereTenantActive(eb),\n eb('tenant.isOnboarding', '=', false),\n ...(includePartnerTeams\n ? []\n : [eb('tenant.calculatedIsBillable', '=', true)]),\n ]);\n}\n"]}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { type LocalKysely, type UseLocalKyselyOptions } from '../local';
|
|
2
|
-
declare global {
|
|
3
|
-
var __vrplatform_testSharedKysely: Promise<LocalKysely> | LocalKysely | undefined;
|
|
4
|
-
}
|
|
5
2
|
export declare function useTestAutoCleanupKysely(args?: UseLocalKyselyOptions): Promise<LocalKysely>;
|
|
6
3
|
type ReturnType = LocalKysely & {
|
|
7
4
|
[Symbol.dispose]: () => Promise<void>;
|
package/build/main/test/index.js
CHANGED
|
@@ -5,15 +5,6 @@ exports.useLocalKyselyResource = useLocalKyselyResource;
|
|
|
5
5
|
const bun_test_1 = require("bun:test");
|
|
6
6
|
const local_1 = require("../local");
|
|
7
7
|
async function useTestAutoCleanupKysely(args) {
|
|
8
|
-
if (process.env.VR_TEST_SHARED_KYSELY === '1') {
|
|
9
|
-
const existing = globalThis.__vrplatform_testSharedKysely;
|
|
10
|
-
if (!existing) {
|
|
11
|
-
const created = (0, local_1.useLocalKysely)(args);
|
|
12
|
-
globalThis.__vrplatform_testSharedKysely = created;
|
|
13
|
-
return created;
|
|
14
|
-
}
|
|
15
|
-
return await existing;
|
|
16
|
-
}
|
|
17
8
|
const kysely = await (0, local_1.useLocalKysely)(args);
|
|
18
9
|
(0, bun_test_1.afterAll)(async () => {
|
|
19
10
|
await kysely.destroy();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["test/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["test/index.ts"],"names":[],"mappings":";;AAOA,4DAQC;AAMD,wDAyBC;AA9CD,uCAAoC;AACpC,oCAIkB;AAEX,KAAK,UAAU,wBAAwB,CAAC,IAA4B;IACzE,MAAM,MAAM,GAAG,MAAM,IAAA,sBAAc,EAAC,IAAI,CAAC,CAAC;IAE1C,IAAA,mBAAQ,EAAC,KAAK,IAAI,EAAE;QAClB,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAMM,KAAK,UAAU,sBAAsB,CAC1C,IAA4B;IAE5B,MAAM,MAAM,GAAG,MAAM,IAAA,sBAAc,EAAC,IAAI,CAAC,CAAC;IAE1C,OAAO,IAAI,KAAK,CACd,EAAE,EACF;QACE,GAAG,CAAC,OAAO,EAAE,IAAI;YACf,8CAA8C;YAC9C,IAAI,IAAI,KAAK,MAAM,CAAC,YAAY,EAAE,CAAC;gBACjC,OAAO,KAAK,IAAI,EAAE;oBAChB,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;gBACzB,CAAC,CAAC;YACJ,CAAC;YACD,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACtB,OAAO,MAAM,CAAC;YAChB,CAAC;YACD,IAAI,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,UAAU,EAAE,CAAC;gBACvC,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACnC,CAAC;YACD,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC;KACF,CACY,CAAC;AAClB,CAAC","sourcesContent":["import { afterAll } from 'bun:test';\nimport {\n type LocalKysely,\n type UseLocalKyselyOptions,\n useLocalKysely,\n} from '../local';\n\nexport async function useTestAutoCleanupKysely(args?: UseLocalKyselyOptions) {\n const kysely = await useLocalKysely(args);\n\n afterAll(async () => {\n await kysely.destroy();\n });\n\n return kysely;\n}\n\ntype ReturnType = LocalKysely & {\n [Symbol.dispose]: () => Promise<void>;\n};\n\nexport async function useLocalKyselyResource(\n args?: UseLocalKyselyOptions\n): Promise<ReturnType> {\n const kysely = await useLocalKysely(args);\n\n return new Proxy(\n {},\n {\n get(_target, prop) {\n // somehow not working if using Symbol.dispose\n if (prop === Symbol.asyncDispose) {\n return async () => {\n await kysely.destroy();\n };\n }\n if (prop === 'kysely') {\n return kysely;\n }\n if (typeof kysely[prop] === 'function') {\n return kysely[prop].bind(kysely);\n }\n return kysely[prop];\n },\n }\n ) as ReturnType;\n}\n"]}
|
|
@@ -16,6 +16,22 @@ export type AuditPublicEventAccountingStatus = "blocked" | "changed" | "failed"
|
|
|
16
16
|
export type AuditPublicEventOperation = "archive" | "create" | "delete" | "execute" | "recalculate" | "restore" | "update";
|
|
17
17
|
export type AuditSourceType = "api" | "automation" | "integration" | "portal" | "sync" | "system";
|
|
18
18
|
export type Generated<T> = T extends ColumnType<infer S, infer I, infer U> ? ColumnType<S, I | undefined, U> : ColumnType<T, T | undefined, T>;
|
|
19
|
+
export type HealthAccountingIntegrityActionability = "automatically_repairable" | "blocked" | "code_fix_required" | "manual_repair" | "unknown";
|
|
20
|
+
export type HealthAccountingIntegrityCaseStatus = "open" | "resolved";
|
|
21
|
+
export type HealthAccountingIntegrityConfidence = "probable" | "proven" | "unknown";
|
|
22
|
+
export type HealthAccountingIntegrityDeliveryChannel = "sentry" | "slack";
|
|
23
|
+
export type HealthAccountingIntegrityDeliveryStatus = "dead_letter" | "delivered" | "failed" | "pending" | "processing" | "suppressed";
|
|
24
|
+
export type HealthAccountingIntegrityRepairPlanStatus = "active" | "canceled" | "completed" | "draft" | "failed" | "paused";
|
|
25
|
+
export type HealthAccountingIntegrityRepairScopeType = "case" | "tenant";
|
|
26
|
+
export type HealthAccountingIntegrityRepairStageStatus = "applying" | "approved" | "canceled" | "dry_run_passed" | "failed" | "paused" | "planned" | "verified" | "verifying";
|
|
27
|
+
export type HealthAccountingIntegrityRepairTargetStatus = "applied" | "applying" | "canceled" | "failed" | "paused" | "pending" | "verified" | "verifying";
|
|
28
|
+
export type HealthAccountingIntegrityRepairTransitionType = "approval_granted" | "approval_invalidated" | "canceled" | "completed" | "dry_run_passed" | "failed" | "paused" | "plan_activated" | "plan_created" | "stage_applying" | "stage_verified" | "target_applied" | "target_applying" | "target_verified" | "target_verifying";
|
|
29
|
+
export type HealthAccountingIntegrityResolutionClassification = "code_fix" | "configuration" | "data_repair" | "expected" | "false_positive" | "monitor_fix" | "unknown";
|
|
30
|
+
export type HealthAccountingIntegrityReviewStatus = "confirmed_issue" | "expected" | "false_positive" | "unreviewed";
|
|
31
|
+
export type HealthAccountingIntegrityRunStatus = "completed" | "failed" | "running" | "skipped";
|
|
32
|
+
export type HealthAccountingIntegritySeverity = "critical" | "error" | "info" | "warning";
|
|
33
|
+
export type HealthAccountingIntegrityTransitionType = "changed" | "opened" | "reopened" | "resolved" | "reviewed";
|
|
34
|
+
export type HealthAccountingIntegrityUrgency = "backlog" | "immediate" | "next_triage" | "none";
|
|
19
35
|
export type HealthTenantIssueCategory = "criticalToSystem" | "criticalToUser";
|
|
20
36
|
export type HealthTenantIssueCode = "brokenConnections" | "cancelledReservationPaidWithoutAdjustment" | "closedPeriodUnattachedJournalEntries" | "duplicatedPayments" | "endedOwnershipNonZeroBalance" | "listingOwnershipPeriodNotFoundOnActiveJournals" | "missingOwnershipOrDeactivation" | "operatingBankAccountsWithoutOpex" | "outdatedConnections" | "partnerBillingInactive" | "partnerInactive" | "pmsMissingAccountingStart" | "publishedStatementUnpaid" | "reservationCurrencyMismatch" | "reservationGuestTotalsMismatch" | "reservationPaymentProjectionMismatch" | "teamInactive" | "unbalancedJournalEntries" | "unbalancedTransactionJournalEntries" | "unpaidReservations";
|
|
21
37
|
export type HealthTenantIssueSeverity = "error" | "warning";
|
|
@@ -396,6 +412,7 @@ export interface AccountingTransaction {
|
|
|
396
412
|
paidStatus: Generated<string | null>;
|
|
397
413
|
recurringFeeId: string | null;
|
|
398
414
|
recurringPattern: Json | null;
|
|
415
|
+
recreatedFromTransactionId: string | null;
|
|
399
416
|
recurringTemplateId: string | null;
|
|
400
417
|
/**
|
|
401
418
|
* Human-readable system ID (EXP/DEP/PAY/TRF-XXX-XXXX-XXX depending on transaction.type).
|
|
@@ -876,6 +893,195 @@ export interface HdbCatalogHdbVersion {
|
|
|
876
893
|
upgradedOn: Timestamp;
|
|
877
894
|
version: string;
|
|
878
895
|
}
|
|
896
|
+
export interface HealthAccountingIntegrityCase {
|
|
897
|
+
actionability: HealthAccountingIntegrityActionability;
|
|
898
|
+
actual: Json;
|
|
899
|
+
assignedAt: Timestamp | null;
|
|
900
|
+
assignedTo: string | null;
|
|
901
|
+
caseKey: string;
|
|
902
|
+
code: string;
|
|
903
|
+
confidence: HealthAccountingIntegrityConfidence;
|
|
904
|
+
contentHash: string;
|
|
905
|
+
createdAt: Generated<Timestamp>;
|
|
906
|
+
dataRegion: string;
|
|
907
|
+
definitionVersion: number;
|
|
908
|
+
evidence: Json;
|
|
909
|
+
evidenceComplete: boolean;
|
|
910
|
+
expected: Json;
|
|
911
|
+
firstSeenAt: Timestamp;
|
|
912
|
+
gitRevision: string;
|
|
913
|
+
historicalIssueRefs: Json;
|
|
914
|
+
id: Generated<string>;
|
|
915
|
+
impact: Json;
|
|
916
|
+
lastChangedAt: Timestamp;
|
|
917
|
+
lastSeenAt: Timestamp;
|
|
918
|
+
lockAssessment: Json;
|
|
919
|
+
portalUrls: Json;
|
|
920
|
+
repair: Json;
|
|
921
|
+
resolutionClassification: HealthAccountingIntegrityResolutionClassification;
|
|
922
|
+
resolvedAt: Timestamp | null;
|
|
923
|
+
reviewStatus: Generated<HealthAccountingIntegrityReviewStatus>;
|
|
924
|
+
reviewRationale: string | null;
|
|
925
|
+
reviewedAt: Timestamp | null;
|
|
926
|
+
reviewedBy: string | null;
|
|
927
|
+
rootCause: string;
|
|
928
|
+
runId: string;
|
|
929
|
+
severity: HealthAccountingIntegritySeverity;
|
|
930
|
+
status: HealthAccountingIntegrityCaseStatus;
|
|
931
|
+
tenantId: string;
|
|
932
|
+
title: string;
|
|
933
|
+
updatedAt: Generated<Timestamp>;
|
|
934
|
+
urgency: HealthAccountingIntegrityUrgency;
|
|
935
|
+
verification: Json;
|
|
936
|
+
version: Generated<Int8>;
|
|
937
|
+
}
|
|
938
|
+
export interface HealthAccountingIntegrityOperatorEvent {
|
|
939
|
+
actorId: string;
|
|
940
|
+
caseId: string | null;
|
|
941
|
+
caseVersion: Int8 | null;
|
|
942
|
+
client: string;
|
|
943
|
+
createdAt: Generated<Timestamp>;
|
|
944
|
+
id: Generated<string>;
|
|
945
|
+
idempotencyKey: string;
|
|
946
|
+
payload: Json;
|
|
947
|
+
planId: string | null;
|
|
948
|
+
rationale: string | null;
|
|
949
|
+
requestId: string;
|
|
950
|
+
stageId: string | null;
|
|
951
|
+
targetId: string | null;
|
|
952
|
+
type: string;
|
|
953
|
+
}
|
|
954
|
+
export interface HealthAccountingIntegrityDelivery {
|
|
955
|
+
attempts: Generated<number>;
|
|
956
|
+
caseId: string | null;
|
|
957
|
+
channel: HealthAccountingIntegrityDeliveryChannel;
|
|
958
|
+
claimedAt: Timestamp | null;
|
|
959
|
+
claimId: string | null;
|
|
960
|
+
createdAt: Generated<Timestamp>;
|
|
961
|
+
dedupeKey: string;
|
|
962
|
+
deliveredAt: Timestamp | null;
|
|
963
|
+
eventType: string;
|
|
964
|
+
id: Generated<string>;
|
|
965
|
+
lastError: Json | null;
|
|
966
|
+
nextAttemptAt: Generated<Timestamp>;
|
|
967
|
+
payload: Json;
|
|
968
|
+
result: Json | null;
|
|
969
|
+
runId: string;
|
|
970
|
+
status: Generated<HealthAccountingIntegrityDeliveryStatus>;
|
|
971
|
+
updatedAt: Generated<Timestamp>;
|
|
972
|
+
}
|
|
973
|
+
export interface HealthAccountingIntegrityRepairPlan {
|
|
974
|
+
canceledAt: Timestamp | null;
|
|
975
|
+
code: string;
|
|
976
|
+
completedAt: Timestamp | null;
|
|
977
|
+
createdAt: Generated<Timestamp>;
|
|
978
|
+
createdBy: string;
|
|
979
|
+
dataRegion: string;
|
|
980
|
+
environment: string;
|
|
981
|
+
gitRevision: string;
|
|
982
|
+
id: Generated<string>;
|
|
983
|
+
linearRef: string | null;
|
|
984
|
+
recipeVersion: number;
|
|
985
|
+
status: Generated<HealthAccountingIntegrityRepairPlanStatus>;
|
|
986
|
+
title: string;
|
|
987
|
+
updatedAt: Generated<Timestamp>;
|
|
988
|
+
}
|
|
989
|
+
export interface HealthAccountingIntegrityRepairStage {
|
|
990
|
+
applyResult: Json | null;
|
|
991
|
+
approvalRef: string | null;
|
|
992
|
+
approvedAt: Timestamp | null;
|
|
993
|
+
approvedBy: string | null;
|
|
994
|
+
completedAt: Timestamp | null;
|
|
995
|
+
createdAt: Generated<Timestamp>;
|
|
996
|
+
dryRunResult: Json | null;
|
|
997
|
+
id: Generated<string>;
|
|
998
|
+
limits: Json;
|
|
999
|
+
manifest: Json;
|
|
1000
|
+
manifestHash: string;
|
|
1001
|
+
ordinal: number;
|
|
1002
|
+
planId: string;
|
|
1003
|
+
scopeType: HealthAccountingIntegrityRepairScopeType;
|
|
1004
|
+
startedAt: Timestamp | null;
|
|
1005
|
+
status: Generated<HealthAccountingIntegrityRepairStageStatus>;
|
|
1006
|
+
tenantId: string;
|
|
1007
|
+
updatedAt: Generated<Timestamp>;
|
|
1008
|
+
verificationResult: Json | null;
|
|
1009
|
+
}
|
|
1010
|
+
export interface HealthAccountingIntegrityRepairTarget {
|
|
1011
|
+
action: Json;
|
|
1012
|
+
applyResult: Json | null;
|
|
1013
|
+
auditActionId: string | null;
|
|
1014
|
+
beforeHash: string;
|
|
1015
|
+
beforeState: Json;
|
|
1016
|
+
caseContentHash: string;
|
|
1017
|
+
caseId: string;
|
|
1018
|
+
caseVersion: Int8;
|
|
1019
|
+
completedAt: Timestamp | null;
|
|
1020
|
+
createdAt: Generated<Timestamp>;
|
|
1021
|
+
effectPlan: Json;
|
|
1022
|
+
expectedResult: Json;
|
|
1023
|
+
id: Generated<string>;
|
|
1024
|
+
idempotencyKey: string;
|
|
1025
|
+
lockAssessment: Json;
|
|
1026
|
+
ordinal: number;
|
|
1027
|
+
stageId: string;
|
|
1028
|
+
startedAt: Timestamp | null;
|
|
1029
|
+
status: Generated<HealthAccountingIntegrityRepairTargetStatus>;
|
|
1030
|
+
targetKey: string;
|
|
1031
|
+
tenantId: string;
|
|
1032
|
+
updatedAt: Generated<Timestamp>;
|
|
1033
|
+
verificationResult: Json | null;
|
|
1034
|
+
}
|
|
1035
|
+
export interface HealthAccountingIntegrityRepairTransition {
|
|
1036
|
+
actor: string;
|
|
1037
|
+
createdAt: Generated<Timestamp>;
|
|
1038
|
+
id: Generated<string>;
|
|
1039
|
+
payload: Json;
|
|
1040
|
+
planId: string;
|
|
1041
|
+
stageId: string | null;
|
|
1042
|
+
targetId: string | null;
|
|
1043
|
+
type: HealthAccountingIntegrityRepairTransitionType;
|
|
1044
|
+
}
|
|
1045
|
+
export interface HealthAccountingIntegrityRun {
|
|
1046
|
+
caseCount: Generated<Int8>;
|
|
1047
|
+
changedCaseCount: Generated<Int8>;
|
|
1048
|
+
code: string;
|
|
1049
|
+
completedAt: Timestamp | null;
|
|
1050
|
+
createdAt: Generated<Timestamp>;
|
|
1051
|
+
dataRegion: string;
|
|
1052
|
+
definitionVersion: number;
|
|
1053
|
+
definitionVersionId: string | null;
|
|
1054
|
+
definitionArtifactHash: string | null;
|
|
1055
|
+
definitionTemplateId: string | null;
|
|
1056
|
+
definitionTemplateVersion: number | null;
|
|
1057
|
+
environment: string;
|
|
1058
|
+
error: Json | null;
|
|
1059
|
+
evaluationId: string;
|
|
1060
|
+
findingRowCount: Generated<Int8>;
|
|
1061
|
+
gitRevision: string;
|
|
1062
|
+
id: Generated<string>;
|
|
1063
|
+
openedCaseCount: Generated<Int8>;
|
|
1064
|
+
operatorDefinitionVersion: number | null;
|
|
1065
|
+
reopenedCaseCount: Generated<Int8>;
|
|
1066
|
+
resolvedCaseCount: Generated<Int8>;
|
|
1067
|
+
resolvesCases: Generated<boolean>;
|
|
1068
|
+
rowsScanned: Generated<Int8>;
|
|
1069
|
+
scopeTenantIds: string[] | null;
|
|
1070
|
+
shardKey: Generated<string>;
|
|
1071
|
+
startedAt: Timestamp;
|
|
1072
|
+
status: HealthAccountingIntegrityRunStatus;
|
|
1073
|
+
unchangedCaseCount: Generated<Int8>;
|
|
1074
|
+
updatedAt: Generated<Timestamp>;
|
|
1075
|
+
}
|
|
1076
|
+
export interface HealthAccountingIntegrityTransition {
|
|
1077
|
+
caseId: string;
|
|
1078
|
+
caseVersion: Int8;
|
|
1079
|
+
createdAt: Generated<Timestamp>;
|
|
1080
|
+
id: Generated<string>;
|
|
1081
|
+
payload: Json;
|
|
1082
|
+
runId: string;
|
|
1083
|
+
type: HealthAccountingIntegrityTransitionType;
|
|
1084
|
+
}
|
|
879
1085
|
export interface HealthReservationIssueSnapshot {
|
|
880
1086
|
computedAt: Timestamp | null;
|
|
881
1087
|
computedVersion: Generated<Int8>;
|
|
@@ -1220,6 +1426,36 @@ export interface PublicLatestDuplicateEmails {
|
|
|
1220
1426
|
name: string | null;
|
|
1221
1427
|
status: string | null;
|
|
1222
1428
|
}
|
|
1429
|
+
export interface PublicLineClassificationUsageCapture {
|
|
1430
|
+
createdAt: Generated<Timestamp>;
|
|
1431
|
+
firstSeenAt: Timestamp | null;
|
|
1432
|
+
id: Generated<string>;
|
|
1433
|
+
kind: string;
|
|
1434
|
+
lastSeenAt: Timestamp | null;
|
|
1435
|
+
name: string;
|
|
1436
|
+
tenantId: string;
|
|
1437
|
+
}
|
|
1438
|
+
export interface PublicLineClassificationUsage {
|
|
1439
|
+
appId: string | null;
|
|
1440
|
+
createdAt: Generated<Timestamp>;
|
|
1441
|
+
firstSeenAt: Generated<Timestamp>;
|
|
1442
|
+
kind: string;
|
|
1443
|
+
lastError: string | null;
|
|
1444
|
+
lastSeenAt: Generated<Timestamp>;
|
|
1445
|
+
mappingStatus: string | null;
|
|
1446
|
+
name: string;
|
|
1447
|
+
reportAttempts: Generated<number>;
|
|
1448
|
+
reportedRevision: Generated<number>;
|
|
1449
|
+
revision: Generated<number>;
|
|
1450
|
+
tenantId: string;
|
|
1451
|
+
updatedAt: Generated<Timestamp>;
|
|
1452
|
+
}
|
|
1453
|
+
export interface PublicLineClassificationUsageBackfill {
|
|
1454
|
+
completedAt: Timestamp | null;
|
|
1455
|
+
cursorId: string | null;
|
|
1456
|
+
source: string;
|
|
1457
|
+
updatedAt: Generated<Timestamp>;
|
|
1458
|
+
}
|
|
1223
1459
|
export interface PublicListing {
|
|
1224
1460
|
address: string | null;
|
|
1225
1461
|
addressCity: string | null;
|
|
@@ -1850,11 +2086,14 @@ export interface PublicTenant {
|
|
|
1850
2086
|
isTest: Generated<boolean | null>;
|
|
1851
2087
|
logo: string | null;
|
|
1852
2088
|
longTermStayNights: number | null;
|
|
2089
|
+
migratedAt: Timestamp | null;
|
|
1853
2090
|
migratedFromTenantId: string | null;
|
|
2091
|
+
migratedToRegion: string | null;
|
|
2092
|
+
migrationStatus: Generated<string>;
|
|
1854
2093
|
name: string;
|
|
1855
2094
|
ownerPortalShowDraftStatements: boolean | null;
|
|
1856
|
-
partnerId: Generated<string | null>;
|
|
1857
2095
|
partnerDeniedPermissions: Generated<string[]>;
|
|
2096
|
+
partnerId: Generated<string | null>;
|
|
1858
2097
|
/**
|
|
1859
2098
|
* JSON column to hold team settings like "owner_portal_show_reservation_totals" or "owner_portal_show_draft_statements
|
|
1860
2099
|
*/
|
|
@@ -1872,7 +2111,6 @@ export interface PublicTenant {
|
|
|
1872
2111
|
supportEmail: string | null;
|
|
1873
2112
|
supportPhone: string | null;
|
|
1874
2113
|
svixEndpoints: boolean | null;
|
|
1875
|
-
trialUntil: Timestamp | null;
|
|
1876
2114
|
type: Generated<string | null>;
|
|
1877
2115
|
uniqueRef: string | null;
|
|
1878
2116
|
updatedAt: Generated<Timestamp | null>;
|
|
@@ -1882,6 +2120,7 @@ export interface PublicTenantUser {
|
|
|
1882
2120
|
createdAt: Generated<Timestamp | null>;
|
|
1883
2121
|
id: Generated<string>;
|
|
1884
2122
|
lastInvitedAt: Timestamp | null;
|
|
2123
|
+
managedTeamAccess: Generated<"all" | "assigned">;
|
|
1885
2124
|
notificationPreferences: Generated<Json | null>;
|
|
1886
2125
|
permissionBundles: Generated<string[]>;
|
|
1887
2126
|
role: Generated<string | null>;
|
|
@@ -2208,6 +2447,15 @@ export interface DB {
|
|
|
2208
2447
|
"hdbCatalog.hdbSchemaNotifications": HdbCatalogHdbSchemaNotifications;
|
|
2209
2448
|
"hdbCatalog.hdbSourceCatalogVersion": HdbCatalogHdbSourceCatalogVersion;
|
|
2210
2449
|
"hdbCatalog.hdbVersion": HdbCatalogHdbVersion;
|
|
2450
|
+
"health.accountingIntegrityCase": HealthAccountingIntegrityCase;
|
|
2451
|
+
"health.accountingIntegrityOperatorEvent": HealthAccountingIntegrityOperatorEvent;
|
|
2452
|
+
"health.accountingIntegrityDelivery": HealthAccountingIntegrityDelivery;
|
|
2453
|
+
"health.accountingIntegrityRepairPlan": HealthAccountingIntegrityRepairPlan;
|
|
2454
|
+
"health.accountingIntegrityRepairStage": HealthAccountingIntegrityRepairStage;
|
|
2455
|
+
"health.accountingIntegrityRepairTarget": HealthAccountingIntegrityRepairTarget;
|
|
2456
|
+
"health.accountingIntegrityRepairTransition": HealthAccountingIntegrityRepairTransition;
|
|
2457
|
+
"health.accountingIntegrityRun": HealthAccountingIntegrityRun;
|
|
2458
|
+
"health.accountingIntegrityTransition": HealthAccountingIntegrityTransition;
|
|
2211
2459
|
"health.reservationIssueSnapshot": HealthReservationIssueSnapshot;
|
|
2212
2460
|
"health.tenantIssue": HealthTenantIssue;
|
|
2213
2461
|
"health.tenantIssueRuleState": HealthTenantIssueRuleState;
|
|
@@ -2239,6 +2487,9 @@ export interface DB {
|
|
|
2239
2487
|
"public.fileStorageSourceLink": PublicFileStorageSourceLink;
|
|
2240
2488
|
"public.fileStorageTag": PublicFileStorageTag;
|
|
2241
2489
|
"public.latestDuplicateEmails": PublicLatestDuplicateEmails;
|
|
2490
|
+
"public.lineClassificationUsage": PublicLineClassificationUsage;
|
|
2491
|
+
"public.lineClassificationUsageBackfill": PublicLineClassificationUsageBackfill;
|
|
2492
|
+
"public.lineClassificationUsageCapture": PublicLineClassificationUsageCapture;
|
|
2242
2493
|
"public.listing": PublicListing;
|
|
2243
2494
|
"public.listingCollection": PublicListingCollection;
|
|
2244
2495
|
"public.listingConnection": PublicListingConnection;
|