@vrplatform/kysely 1.3.45-354 → 1.3.45-369

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.
@@ -0,0 +1,77 @@
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 type audit.actor_organization_type as enum (
7
+ 'vrplatform', 'partner', 'team', 'system'
8
+ )
9
+ `.execute(db);
10
+ await sql`
11
+ alter type audit.source_type add value if not exists 'embedded'
12
+ `.execute(db);
13
+ await sql`
14
+ alter type webhook.subscription_event_type
15
+ add value if not exists 'audit.event.changed'
16
+ `.execute(db);
17
+ await sql`
18
+ alter type webhook.event_type
19
+ add value if not exists 'audit.event.changed'
20
+ `.execute(db);
21
+ await sql`
22
+ alter type webhook.resource_type
23
+ add value if not exists 'auditEvent'
24
+ `.execute(db);
25
+ await sql`
26
+ alter table audit.action
27
+ add column actor_organization_type audit.actor_organization_type,
28
+ add column actor_organization_id uuid,
29
+ add column actor_organization_name text
30
+ `.execute(db);
31
+ await sql`
32
+ alter table audit.mutation
33
+ add column public_outcome jsonb
34
+ `.execute(db);
35
+ await sql`
36
+ alter table audit.public_event
37
+ add column actor_organization_type audit.actor_organization_type,
38
+ add column actor_organization_id uuid,
39
+ add column actor_organization_name text,
40
+ add column attempted_entity_changes jsonb not null default '[]'::jsonb,
41
+ add column blocked_by jsonb not null default '[]'::jsonb,
42
+ add column recovery jsonb not null default '[]'::jsonb
43
+ `.execute(db);
44
+ await sql`
45
+ create index if not exists public_event_tenant_occurred_idx
46
+ on audit.public_event (tenant_id, occurred_at, updated_at, id)
47
+ `.execute(db);
48
+ }
49
+
50
+ export async function down(db: Kysely<unknown>): Promise<void> {
51
+ await sql`
52
+ drop index if exists audit.public_event_tenant_occurred_idx
53
+ `.execute(db);
54
+ await sql`
55
+ alter table audit.public_event
56
+ drop column if exists recovery,
57
+ drop column if exists blocked_by,
58
+ drop column if exists attempted_entity_changes,
59
+ drop column if exists actor_organization_name,
60
+ drop column if exists actor_organization_id,
61
+ drop column if exists actor_organization_type
62
+ `.execute(db);
63
+ await sql`
64
+ alter table audit.action
65
+ drop column if exists actor_organization_name,
66
+ drop column if exists actor_organization_id,
67
+ drop column if exists actor_organization_type
68
+ `.execute(db);
69
+ await sql`
70
+ alter table audit.mutation
71
+ drop column if exists public_outcome
72
+ `.execute(db);
73
+ await sql`
74
+ drop type if exists audit.actor_organization_type
75
+ `.execute(db);
76
+ // PostgreSQL enum values cannot be removed safely without rebuilding source_type.
77
+ }
@@ -14,7 +14,8 @@ export type AuditEffectStatus = "claimed" | "completed" | "dead_letter" | "faile
14
14
  export type AuditJournalDeltaOperation = "delete" | "insert" | "update";
15
15
  export type AuditPublicEventAccountingStatus = "blocked" | "changed" | "failed" | "mixed" | "not_applicable" | "pending" | "unchanged";
16
16
  export type AuditPublicEventOperation = "archive" | "create" | "delete" | "execute" | "recalculate" | "restore" | "update";
17
- export type AuditSourceType = "api" | "automation" | "integration" | "portal" | "sync" | "system";
17
+ export type AuditActorOrganizationType = "partner" | "system" | "team" | "vrplatform";
18
+ export type AuditSourceType = "api" | "automation" | "embedded" | "integration" | "portal" | "sync" | "system";
18
19
  export type BillingListingFactSourceType = "baseline_backfill" | "daily_reconciliation" | "legacy_tracking_import" | "listing_delete" | "listing_insert" | "listing_update" | "ownership_delete" | "ownership_insert" | "ownership_update" | "tenant_delete" | "tenant_insert" | "tenant_update";
19
20
  export type CoreAsyncOperationResultStatus = "completed" | "failed" | "queued";
20
21
  export type CoreCsvOperationResultKind = "import" | "preview";
@@ -25,6 +26,7 @@ export type CoreFlowEventOperationAction = "abandon" | "replay";
25
26
  export type CoreFlowEventStatus = "canceled" | "dead" | "pending" | "processing" | "succeeded";
26
27
  export type CoreOperationResourceRole = "result" | "source" | "target";
27
28
  export type CoreOperationResourceType = "bank-rule" | "connection" | "contact" | "file" | "flow" | "listing" | "recurring-fee" | "recurring-transaction-template" | "reservation" | "statement" | "team" | "transaction" | "webhook";
29
+ export type CoreOperationPublicIdFormat = "action" | "legacy";
28
30
  export type CoreOperationSourceType = "audit-action" | "export-job" | "sync" | "webhook-delivery";
29
31
  export type CoreOperationStatus = "completed" | "failed" | "queued" | "running";
30
32
  export type CoreOperationType = "ach-verification" | "bank-rule-run" | "calendar-block" | "calendar-unblock" | "connection-archive" | "connection-connect" | "connection-extract" | "connection-sync" | "csv-import" | "csv-import-preview" | "export" | "flow-run" | "historical-gl-import" | "historical-statement-import" | "listing-journal-refresh" | "plaid-initial-sync" | "pms-cutover" | "pms-cutover-preview" | "provider-payment" | "provider-payment-recovery" | "recurring-transaction-run" | "reservation-journal-refresh" | "team-delete" | "team-demo-data" | "team-duplicate" | "team-initialize" | "transaction-journal-refresh" | "vri-statement-import" | "vri-team-migration" | "webhook-test";
@@ -65,9 +67,9 @@ export type PublicRecurringFeeConditionOperator = "<" | "<=" | "=" | ">" | ">=";
65
67
  export type Timestamp = ColumnType<Date | string, Date | string, Date | string>;
66
68
  export type WebhookApiVersion = "2026-07-01";
67
69
  export type WebhookDeliveryStatus = "canceled" | "delivering" | "failed" | "queued" | "retrying" | "succeeded";
68
- export type WebhookEventType = "connection.changed" | "listing.changed" | "reservation.changed" | "statement.status.changed" | "sync.status.changed" | "team.issues.changed" | "transaction.changed" | "webhook.test";
69
- export type WebhookResourceType = "connection" | "listing" | "reservation" | "statement" | "sync" | "team" | "transaction" | "webhook";
70
- export type WebhookSubscriptionEventType = "connection.changed" | "listing.changed" | "reservation.changed" | "statement.status.changed" | "sync.status.changed" | "team.issues.changed" | "transaction.changed";
70
+ export type WebhookEventType = "audit.event.changed" | "connection.changed" | "listing.changed" | "reservation.changed" | "statement.status.changed" | "sync.status.changed" | "team.issues.changed" | "transaction.changed" | "webhook.test";
71
+ export type WebhookResourceType = "auditEvent" | "connection" | "listing" | "reservation" | "statement" | "sync" | "team" | "transaction" | "webhook";
72
+ export type WebhookSubscriptionEventType = "audit.event.changed" | "connection.changed" | "listing.changed" | "reservation.changed" | "statement.status.changed" | "sync.status.changed" | "team.issues.changed" | "transaction.changed";
71
73
  export type WebhookSubscriptionScope = "managedTeams" | "self";
72
74
  export type WebhookSubscriptionStatus = "active" | "disabled" | "pending";
73
75
  export interface AccountingAccount {
@@ -530,6 +532,9 @@ export interface AuditAction {
530
532
  actorId: string | null;
531
533
  actorLabel: string | null;
532
534
  actorName: string | null;
535
+ actorOrganizationId: string | null;
536
+ actorOrganizationName: string | null;
537
+ actorOrganizationType: AuditActorOrganizationType | null;
533
538
  actorType: AuditActionActorType;
534
539
  apiVersion: string;
535
540
  createdAt: Generated<Timestamp>;
@@ -635,6 +640,7 @@ export interface AuditMutation {
635
640
  id: Generated<string>;
636
641
  op: string;
637
642
  publicChanges: Generated<Json>;
643
+ publicOutcome: Json | null;
638
644
  rootEntityId: string | null;
639
645
  rootEntityType: string | null;
640
646
  subjectId: string;
@@ -650,8 +656,13 @@ export interface AuditPublicEvent {
650
656
  actorId: string | null;
651
657
  actorLabel: string | null;
652
658
  actorName: string | null;
659
+ actorOrganizationId: string | null;
660
+ actorOrganizationName: string | null;
661
+ actorOrganizationType: AuditActorOrganizationType | null;
653
662
  actorType: AuditActionActorType;
654
663
  affectedAccountIds: Generated<string[]>;
664
+ attemptedEntityChanges: Generated<Json>;
665
+ blockedBy: Generated<Json>;
655
666
  changedEntityTypes: Generated<string[]>;
656
667
  changedPaths: Generated<string[]>;
657
668
  entityChanges: Generated<Json>;
@@ -666,6 +677,7 @@ export interface AuditPublicEvent {
666
677
  projectionFingerprint: string;
667
678
  projectionVersion: Generated<number>;
668
679
  requestId: string | null;
680
+ recovery: Generated<Json>;
669
681
  revision: Generated<number>;
670
682
  rootEntityId: string;
671
683
  rootEntityType: string;
@@ -928,6 +940,7 @@ export interface CoreOperation {
928
940
  finishedAt: Timestamp | null;
929
941
  id: Generated<string>;
930
942
  initiatedByUserId: string | null;
943
+ publicIdFormat: Generated<CoreOperationPublicIdFormat>;
931
944
  retainUntil: Timestamp | null;
932
945
  sourceVersion: Generated<Int8>;
933
946
  startedAt: Timestamp | null;
@@ -936,6 +949,12 @@ export interface CoreOperation {
936
949
  type: CoreOperationType;
937
950
  updatedAt: Generated<Timestamp>;
938
951
  }
952
+ export interface CoreOperationBackfill {
953
+ completedAt: Timestamp | null;
954
+ createdAt: Generated<Timestamp>;
955
+ name: string;
956
+ updatedAt: Generated<Timestamp>;
957
+ }
939
958
  export interface CoreOperationProjectionOutbox {
940
959
  attempts: Generated<number>;
941
960
  availableAt: Generated<Timestamp>;
@@ -2662,6 +2681,7 @@ export interface DB {
2662
2681
  "core.flowSetting": CoreFlowSetting;
2663
2682
  "core.issueMessageOverwrite": CoreIssueMessageOverwrite;
2664
2683
  "core.operation": CoreOperation;
2684
+ "core.operationBackfill": CoreOperationBackfill;
2665
2685
  "core.operationProjectionOutbox": CoreOperationProjectionOutbox;
2666
2686
  "core.operationResource": CoreOperationResource;
2667
2687
  "core.operationSource": CoreOperationSource;