@vrplatform/kysely 1.3.45-5991 → 1.3.45-6

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 (58) hide show
  1. package/build/.data.tar +0 -0
  2. package/build/main/control-plane/index.d.ts +177 -0
  3. package/build/main/control-plane/index.js.map +1 -1
  4. package/build/main/index.d.ts +2 -2
  5. package/build/main/index.js +111 -22
  6. package/build/main/index.js.map +1 -1
  7. package/build/main/local/generate.js +1 -0
  8. package/build/main/local/generate.js.map +1 -1
  9. package/build/main/local/index.js +1 -0
  10. package/build/main/local/index.js.map +1 -1
  11. package/build/main/query/listing/status.js +2 -6
  12. package/build/main/query/listing/status.js.map +1 -1
  13. package/build/main/query/tenant/status.d.ts +5 -8
  14. package/build/main/query/tenant/status.js +16 -20
  15. package/build/main/query/tenant/status.js.map +1 -1
  16. package/build/main/test/index.d.ts +0 -3
  17. package/build/main/test/index.js +0 -9
  18. package/build/main/test/index.js.map +1 -1
  19. package/build/main/v1.generated.d.ts +254 -1
  20. package/build/main/v1.generated.js.map +1 -1
  21. package/build/migrations-v2/0000000000012-trial-free-analytics-billing-status.ts +72 -0
  22. package/build/migrations-v2/0000000000013-ui-permission-bundles.ts +45 -0
  23. package/build/migrations-v2/0000000000014-ui-permission-bundle-top-up.ts +32 -0
  24. package/build/migrations-v2/0000000000016-managed-team-access.ts +34 -0
  25. package/build/migrations-v2/0000000000017-drop-trial-until.ts +42 -0
  26. package/build/migrations-v2/0000000000018-accounting-integrity-monitoring.ts +276 -0
  27. package/build/migrations-v2/0000000000019-accounting-integrity-run-shards.ts +26 -0
  28. package/build/migrations-v2/0000000000020-accounting-integrity-case-classification.ts +52 -0
  29. package/build/migrations-v2/0000000000021-payment-line-classification-monitor-indexes.ts +31 -0
  30. package/build/migrations-v2/0000000000022-accounting-integrity-controlled-repairs.ts +281 -0
  31. package/build/migrations-v2/0000000000023-line-classification-usage.ts +325 -0
  32. package/build/migrations-v2/0000000000024-tenant-region-migration.ts +108 -0
  33. package/build/migrations-v2/0000000000025-partner-ach-denial-default.ts +30 -0
  34. package/build/migrations-v2/0000000000026-line-classification-usage-capture.ts +399 -0
  35. package/build/migrations-v2/0000000000027-payout-replacement-chain.ts +27 -0
  36. package/build/migrations-v2/0000000000028-accounting-integrity-operator-workflow.ts +108 -0
  37. package/build/migrations-v2/0000000000029-accounting-integrity-definition-artifacts.ts +40 -0
  38. package/build/migrations-v2/0000000000030-accounting-integrity-review-metadata-compatibility.ts +49 -0
  39. package/build/module/control-plane/index.d.ts +177 -0
  40. package/build/module/control-plane/index.js.map +1 -1
  41. package/build/module/index.d.ts +2 -2
  42. package/build/module/index.js +113 -23
  43. package/build/module/index.js.map +1 -1
  44. package/build/module/local/generate.js +1 -0
  45. package/build/module/local/generate.js.map +1 -1
  46. package/build/module/local/index.js +1 -0
  47. package/build/module/local/index.js.map +1 -1
  48. package/build/module/query/listing/status.js +2 -6
  49. package/build/module/query/listing/status.js.map +1 -1
  50. package/build/module/query/tenant/status.d.ts +5 -8
  51. package/build/module/query/tenant/status.js +16 -20
  52. package/build/module/query/tenant/status.js.map +1 -1
  53. package/build/module/test/index.d.ts +0 -3
  54. package/build/module/test/index.js +0 -9
  55. package/build/module/test/index.js.map +1 -1
  56. package/build/module/v1.generated.d.ts +254 -1
  57. package/build/module/v1.generated.js.map +1 -1
  58. package/package.json +1 -1
@@ -0,0 +1,42 @@
1
+ import { type Kysely, sql } from 'kysely';
2
+
3
+ export async function up(db: Kysely<unknown>): Promise<void> {
4
+ await sql`
5
+ do $$
6
+ declare
7
+ definition text;
8
+ trigger_function regprocedure;
9
+ begin
10
+ for trigger_function in
11
+ select distinct p.oid::regprocedure
12
+ from pg_trigger as t
13
+ inner join pg_proc as p on p.oid = t.tgfoid
14
+ where t.tgrelid = 'public.tenant'::regclass
15
+ and not t.tgisinternal
16
+ and p.prosrc ilike '%trial_until%'
17
+ loop
18
+ definition := pg_get_functiondef(trigger_function);
19
+ definition := replace(definition, 'OLD."trial_until" , ', '');
20
+ definition := replace(definition, 'NEW."trial_until" , ', '');
21
+
22
+ if definition ilike '%trial_until%' then
23
+ raise exception
24
+ 'Could not remove trial_until from tenant trigger function %',
25
+ trigger_function;
26
+ end if;
27
+
28
+ execute definition;
29
+ end loop;
30
+ end;
31
+ $$;
32
+ `.execute(db);
33
+ await sql`
34
+ alter table public.tenant drop column if exists trial_until
35
+ `.execute(db);
36
+ }
37
+
38
+ export async function down(db: Kysely<unknown>): Promise<void> {
39
+ await sql`
40
+ alter table public.tenant add column trial_until date
41
+ `.execute(db);
42
+ }
@@ -0,0 +1,276 @@
1
+ import { type Kysely, sql } from 'kysely';
2
+
3
+ export async function up(db: Kysely<unknown>): Promise<void> {
4
+ await sql`
5
+ create type health.accounting_integrity_run_status as enum (
6
+ 'running',
7
+ 'completed',
8
+ 'failed',
9
+ 'skipped'
10
+ )
11
+ `.execute(db);
12
+ await sql`
13
+ create type health.accounting_integrity_case_status as enum (
14
+ 'open',
15
+ 'resolved'
16
+ )
17
+ `.execute(db);
18
+ await sql`
19
+ create type health.accounting_integrity_review_status as enum (
20
+ 'unreviewed',
21
+ 'confirmed_issue',
22
+ 'expected',
23
+ 'false_positive'
24
+ )
25
+ `.execute(db);
26
+ await sql`
27
+ create type health.accounting_integrity_actionability as enum (
28
+ 'automatically_repairable',
29
+ 'manual_repair',
30
+ 'blocked',
31
+ 'code_fix_required',
32
+ 'unknown'
33
+ )
34
+ `.execute(db);
35
+ await sql`
36
+ create type health.accounting_integrity_resolution_classification as enum (
37
+ 'code_fix',
38
+ 'configuration',
39
+ 'data_repair',
40
+ 'expected',
41
+ 'false_positive',
42
+ 'monitor_fix',
43
+ 'unknown'
44
+ )
45
+ `.execute(db);
46
+ await sql`
47
+ create type health.accounting_integrity_severity as enum (
48
+ 'info',
49
+ 'warning',
50
+ 'error',
51
+ 'critical'
52
+ )
53
+ `.execute(db);
54
+ await sql`
55
+ create type health.accounting_integrity_transition_type as enum (
56
+ 'opened',
57
+ 'changed',
58
+ 'reopened',
59
+ 'resolved',
60
+ 'reviewed'
61
+ )
62
+ `.execute(db);
63
+ await sql`
64
+ create type health.accounting_integrity_delivery_channel as enum (
65
+ 'sentry',
66
+ 'slack'
67
+ )
68
+ `.execute(db);
69
+ await sql`
70
+ create type health.accounting_integrity_delivery_status as enum (
71
+ 'suppressed',
72
+ 'pending',
73
+ 'processing',
74
+ 'delivered',
75
+ 'failed',
76
+ 'dead_letter'
77
+ )
78
+ `.execute(db);
79
+
80
+ await sql`
81
+ create table health.accounting_integrity_run (
82
+ id uuid primary key default gen_random_uuid(),
83
+ evaluation_id uuid not null,
84
+ code text not null,
85
+ definition_version integer not null,
86
+ git_revision text not null,
87
+ environment text not null,
88
+ data_region text not null,
89
+ status health.accounting_integrity_run_status not null,
90
+ started_at timestamptz not null,
91
+ completed_at timestamptz,
92
+ rows_scanned bigint not null default 0,
93
+ finding_row_count bigint not null default 0,
94
+ case_count bigint not null default 0,
95
+ opened_case_count bigint not null default 0,
96
+ changed_case_count bigint not null default 0,
97
+ reopened_case_count bigint not null default 0,
98
+ resolved_case_count bigint not null default 0,
99
+ unchanged_case_count bigint not null default 0,
100
+ error jsonb,
101
+ created_at timestamptz not null default now(),
102
+ updated_at timestamptz not null default now(),
103
+ constraint accounting_integrity_run_evaluation_region_code_key
104
+ unique (evaluation_id, data_region, code)
105
+ );
106
+ `.execute(db);
107
+
108
+ await sql`
109
+ create index accounting_integrity_run_metrics_idx
110
+ on health.accounting_integrity_run (
111
+ environment,
112
+ started_at desc
113
+ );
114
+ `.execute(db);
115
+
116
+ await sql`
117
+ create table health.accounting_integrity_case (
118
+ id uuid primary key default gen_random_uuid(),
119
+ data_region text not null,
120
+ code text not null,
121
+ tenant_id uuid not null references public.tenant(id) on delete cascade,
122
+ case_key text not null,
123
+ version bigint not null default 1,
124
+ status health.accounting_integrity_case_status not null,
125
+ review_status health.accounting_integrity_review_status
126
+ not null default 'unreviewed',
127
+ actionability health.accounting_integrity_actionability not null,
128
+ resolution_classification
129
+ health.accounting_integrity_resolution_classification not null,
130
+ severity health.accounting_integrity_severity not null,
131
+ title text not null,
132
+ root_cause text not null,
133
+ expected jsonb not null,
134
+ actual jsonb not null,
135
+ impact jsonb not null,
136
+ lock_assessment jsonb not null,
137
+ evidence jsonb not null,
138
+ evidence_complete boolean not null,
139
+ portal_urls jsonb not null,
140
+ historical_issue_refs jsonb not null,
141
+ verification jsonb not null,
142
+ repair jsonb not null,
143
+ content_hash text not null,
144
+ run_id uuid not null
145
+ references health.accounting_integrity_run(id) on delete restrict,
146
+ definition_version integer not null,
147
+ git_revision text not null,
148
+ first_seen_at timestamptz not null,
149
+ last_seen_at timestamptz not null,
150
+ last_changed_at timestamptz not null,
151
+ resolved_at timestamptz,
152
+ created_at timestamptz not null default now(),
153
+ updated_at timestamptz not null default now(),
154
+ constraint accounting_integrity_case_identity_key
155
+ unique (data_region, code, tenant_id, case_key),
156
+ constraint accounting_integrity_case_version_check check (version > 0)
157
+ );
158
+ `.execute(db);
159
+
160
+ await sql`
161
+ create index accounting_integrity_case_tenant_idx
162
+ on health.accounting_integrity_case (tenant_id)
163
+ `.execute(db);
164
+ await sql`
165
+ create index accounting_integrity_case_run_idx
166
+ on health.accounting_integrity_case (run_id)
167
+ `.execute(db);
168
+ await sql`
169
+ create index accounting_integrity_case_open_idx
170
+ on health.accounting_integrity_case (
171
+ data_region,
172
+ code,
173
+ severity,
174
+ tenant_id,
175
+ last_changed_at desc
176
+ )
177
+ where status = 'open';
178
+ `.execute(db);
179
+
180
+ await sql`
181
+ create table health.accounting_integrity_transition (
182
+ id uuid primary key default gen_random_uuid(),
183
+ run_id uuid not null
184
+ references health.accounting_integrity_run(id) on delete cascade,
185
+ case_id uuid not null
186
+ references health.accounting_integrity_case(id) on delete cascade,
187
+ case_version bigint not null,
188
+ type health.accounting_integrity_transition_type not null,
189
+ payload jsonb not null,
190
+ created_at timestamptz not null default now(),
191
+ constraint accounting_integrity_transition_case_version_type_key
192
+ unique (case_id, case_version, type)
193
+ );
194
+ `.execute(db);
195
+
196
+ await sql`
197
+ create index accounting_integrity_transition_run_idx
198
+ on health.accounting_integrity_transition (run_id)
199
+ `.execute(db);
200
+ await sql`
201
+ create table health.accounting_integrity_delivery (
202
+ id uuid primary key default gen_random_uuid(),
203
+ run_id uuid not null
204
+ references health.accounting_integrity_run(id) on delete cascade,
205
+ case_id uuid
206
+ references health.accounting_integrity_case(id) on delete cascade,
207
+ channel health.accounting_integrity_delivery_channel not null,
208
+ event_type text not null,
209
+ dedupe_key text not null unique,
210
+ payload jsonb not null,
211
+ status health.accounting_integrity_delivery_status
212
+ not null default 'pending',
213
+ attempts integer not null default 0,
214
+ claim_id uuid,
215
+ claimed_at timestamptz,
216
+ next_attempt_at timestamptz not null default now(),
217
+ delivered_at timestamptz,
218
+ result jsonb,
219
+ last_error jsonb,
220
+ created_at timestamptz not null default now(),
221
+ updated_at timestamptz not null default now()
222
+ );
223
+ `.execute(db);
224
+
225
+ await sql`
226
+ create index accounting_integrity_delivery_run_idx
227
+ on health.accounting_integrity_delivery (run_id)
228
+ `.execute(db);
229
+ await sql`
230
+ create index accounting_integrity_delivery_case_idx
231
+ on health.accounting_integrity_delivery (case_id)
232
+ `.execute(db);
233
+ await sql`
234
+ create index accounting_integrity_delivery_pending_idx
235
+ on health.accounting_integrity_delivery (next_attempt_at, created_at, id)
236
+ where status in ('pending', 'processing', 'failed');
237
+ `.execute(db);
238
+ }
239
+
240
+ export async function down(db: Kysely<unknown>): Promise<void> {
241
+ await sql`drop table if exists health.accounting_integrity_delivery;`.execute(
242
+ db
243
+ );
244
+ await sql`drop table if exists health.accounting_integrity_transition;`.execute(
245
+ db
246
+ );
247
+ await sql`drop table if exists health.accounting_integrity_case;`.execute(db);
248
+ await sql`drop table if exists health.accounting_integrity_run;`.execute(db);
249
+ await sql`drop type if exists health.accounting_integrity_delivery_status`.execute(
250
+ db
251
+ );
252
+ await sql`drop type if exists health.accounting_integrity_delivery_channel`.execute(
253
+ db
254
+ );
255
+ await sql`drop type if exists health.accounting_integrity_transition_type`.execute(
256
+ db
257
+ );
258
+ await sql`drop type if exists health.accounting_integrity_severity`.execute(
259
+ db
260
+ );
261
+ await sql`drop type if exists health.accounting_integrity_resolution_classification`.execute(
262
+ db
263
+ );
264
+ await sql`drop type if exists health.accounting_integrity_actionability`.execute(
265
+ db
266
+ );
267
+ await sql`drop type if exists health.accounting_integrity_review_status`.execute(
268
+ db
269
+ );
270
+ await sql`drop type if exists health.accounting_integrity_case_status`.execute(
271
+ db
272
+ );
273
+ await sql`drop type if exists health.accounting_integrity_run_status`.execute(
274
+ db
275
+ );
276
+ }
@@ -0,0 +1,26 @@
1
+ import { type Kysely, sql } from 'kysely';
2
+
3
+ export async function up(db: Kysely<unknown>): Promise<void> {
4
+ await sql`
5
+ alter table health.accounting_integrity_run
6
+ add column shard_key text not null default 'regional'
7
+ `.execute(db);
8
+
9
+ await sql`
10
+ alter table health.accounting_integrity_run
11
+ drop constraint accounting_integrity_run_evaluation_region_code_key,
12
+ add constraint accounting_integrity_run_evaluation_region_code_shard_key
13
+ unique (evaluation_id, data_region, code, shard_key)
14
+ `.execute(db);
15
+ }
16
+
17
+ export async function down(db: Kysely<unknown>): Promise<void> {
18
+ await sql`
19
+ alter table health.accounting_integrity_run
20
+ drop constraint
21
+ accounting_integrity_run_evaluation_region_code_shard_key,
22
+ drop column shard_key,
23
+ add constraint accounting_integrity_run_evaluation_region_code_key
24
+ unique (evaluation_id, data_region, code)
25
+ `.execute(db);
26
+ }
@@ -0,0 +1,52 @@
1
+ import { type Kysely, sql } from 'kysely';
2
+
3
+ export async function up(db: Kysely<unknown>): Promise<void> {
4
+ await sql`
5
+ create type health.accounting_integrity_urgency as enum (
6
+ 'immediate',
7
+ 'next_triage',
8
+ 'backlog',
9
+ 'none'
10
+ )
11
+ `.execute(db);
12
+ await sql`
13
+ create type health.accounting_integrity_confidence as enum (
14
+ 'proven',
15
+ 'probable',
16
+ 'unknown'
17
+ )
18
+ `.execute(db);
19
+ await sql`
20
+ alter table health.accounting_integrity_case
21
+ add column urgency health.accounting_integrity_urgency,
22
+ add column confidence health.accounting_integrity_confidence
23
+ `.execute(db);
24
+ await sql`
25
+ update health.accounting_integrity_case
26
+ set
27
+ urgency = case
28
+ when severity = 'info'
29
+ then 'none'::health.accounting_integrity_urgency
30
+ when nullif(impact -> 'modifiedAt' ->> 'latest', '')::timestamptz >=
31
+ now() - interval '28 days'
32
+ then 'next_triage'::health.accounting_integrity_urgency
33
+ else 'backlog'::health.accounting_integrity_urgency
34
+ end,
35
+ confidence = 'probable'::health.accounting_integrity_confidence
36
+ `.execute(db);
37
+ await sql`
38
+ alter table health.accounting_integrity_case
39
+ alter column urgency set not null,
40
+ alter column confidence set not null
41
+ `.execute(db);
42
+ }
43
+
44
+ export async function down(db: Kysely<unknown>): Promise<void> {
45
+ await sql`
46
+ alter table health.accounting_integrity_case
47
+ drop column confidence,
48
+ drop column urgency
49
+ `.execute(db);
50
+ await sql`drop type health.accounting_integrity_confidence`.execute(db);
51
+ await sql`drop type health.accounting_integrity_urgency`.execute(db);
52
+ }
@@ -0,0 +1,31 @@
1
+ import type { Kysely } from 'kysely';
2
+ import { sql } from 'kysely';
3
+
4
+ export async function up(db: Kysely<unknown>): Promise<void> {
5
+ await sql`
6
+ create index if not exists payment_line_recent_classification_idx
7
+ on public.payment_line (updated_at, type2)
8
+ include (payment_id, reservation_id)
9
+ where type2 is not null and type2 != 'deviation'
10
+ `.execute(db);
11
+
12
+ await sql`
13
+ create index if not exists transaction_line_recent_classification_idx
14
+ on accounting.transaction_line (
15
+ updated_at,
16
+ match_line_type_classification
17
+ )
18
+ where match_line_type_classification is not null
19
+ `.execute(db);
20
+ }
21
+
22
+ export async function down(db: Kysely<unknown>): Promise<void> {
23
+ await sql`
24
+ drop index if exists
25
+ accounting.transaction_line_recent_classification_idx
26
+ `.execute(db);
27
+
28
+ await sql`
29
+ drop index if exists public.payment_line_recent_classification_idx
30
+ `.execute(db);
31
+ }