@vrplatform/kysely 1.3.40 → 1.3.41

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 (40) hide show
  1. package/build/.data.tar +0 -0
  2. package/build/main/index.d.ts +1 -0
  3. package/build/main/index.js +1 -0
  4. package/build/main/index.js.map +1 -1
  5. package/build/main/isomorphic.d.ts +2 -1
  6. package/build/main/isomorphic.js.map +1 -1
  7. package/build/main/local/generate.js +12 -0
  8. package/build/main/local/generate.js.map +1 -1
  9. package/build/main/local/index.d.ts +3 -2
  10. package/build/main/local/index.js +56 -3
  11. package/build/main/local/index.js.map +1 -1
  12. package/build/main/query/listing/status.d.ts +2 -2
  13. package/build/main/query/listing/status.js +17 -1
  14. package/build/main/query/listing/status.js.map +1 -1
  15. package/build/main/transaction.d.ts +7 -0
  16. package/build/main/transaction.js +32 -0
  17. package/build/main/transaction.js.map +1 -0
  18. package/build/main/tsconfig.main.tsbuildinfo +1 -1
  19. package/build/main/v1.generated.d.ts +115 -1
  20. package/build/main/v1.generated.js.map +1 -1
  21. package/build/module/index.d.ts +1 -0
  22. package/build/module/index.js +1 -0
  23. package/build/module/index.js.map +1 -1
  24. package/build/module/isomorphic.d.ts +2 -1
  25. package/build/module/isomorphic.js.map +1 -1
  26. package/build/module/local/generate.js +12 -0
  27. package/build/module/local/generate.js.map +1 -1
  28. package/build/module/local/index.d.ts +3 -2
  29. package/build/module/local/index.js +23 -3
  30. package/build/module/local/index.js.map +1 -1
  31. package/build/module/query/listing/status.d.ts +2 -2
  32. package/build/module/query/listing/status.js +17 -1
  33. package/build/module/query/listing/status.js.map +1 -1
  34. package/build/module/transaction.d.ts +7 -0
  35. package/build/module/transaction.js +25 -0
  36. package/build/module/transaction.js.map +1 -0
  37. package/build/module/tsconfig.esm.tsbuildinfo +1 -1
  38. package/build/module/v1.generated.d.ts +115 -1
  39. package/build/module/v1.generated.js.map +1 -1
  40. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"v1.generated.js","sourceRoot":"src/","sources":["v1.generated.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file was generated by kysely-codegen.\n * Please do not edit it manually.\n */\n\nimport type { ColumnType } from \"kysely\";\n\nexport type AccountingJournalEntryInactiveReason = \"cancelledReservationLine\" | \"generalLedgerStartAt\" | \"inactiveAccount\" | \"listingInactive\" | \"nonPostingAccount\" | \"reservationGeneralLedgerStatusInactive\" | \"transactionInactive\" | \"unknownInactiveReason\";\n\nexport type AccountingTransactionAttachmentStatus = \"attached\" | \"deleting\" | \"ready\" | \"uploading\";\n\nexport type AuditActionActorType = \"automation\" | \"sync\" | \"system\" | \"user\";\n\nexport type AuditEffectAttemptStatus = \"completed\" | \"failed\" | \"running\" | \"skipped_locked\";\n\nexport type AuditEffectStatus = \"claimed\" | \"completed\" | \"dead_letter\" | \"failed\" | \"pending\" | \"running\";\n\nexport type AuditJournalDeltaOperation = \"delete\" | \"insert\" | \"update\";\n\nexport type Generated<T> = T extends ColumnType<infer S, infer I, infer U>\n ? ColumnType<S, I | undefined, U>\n : ColumnType<T, T | undefined, T>;\n\nexport type Int8 = ColumnType<string, bigint | number | string, bigint | number | string>;\n\nexport type Json = JsonValue;\n\nexport type JsonArray = JsonValue[];\n\nexport type JsonObject = {\n [x: string]: JsonValue | undefined;\n};\n\nexport type JsonPrimitive = boolean | number | string | null;\n\nexport type JsonValue = JsonArray | JsonObject | JsonPrimitive;\n\nexport type Numeric = ColumnType<string, number | string, number | string>;\n\nexport type PublicFlowType = \"pull\" | \"push\";\n\nexport type PublicRecurringFeeConditionOperator = \"<\" | \"<=\" | \"=\" | \">\" | \">=\";\n\nexport type Timestamp = ColumnType<Date | string, Date | string, Date | string>;\n\nexport interface AccountingAccount {\n bankingCategory: string | null;\n bankingCurrency: string | null;\n bankingLast4: string | null;\n bankingType: string | null;\n categoryId: string;\n /**\n * deprecated\n */\n classification: string | null;\n createdAt: Generated<Timestamp | null>;\n id: Generated<string>;\n offsetAccountId: string | null;\n status: Generated<string>;\n tenantId: string | null;\n title: string;\n type: string;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface AccountingAccountAssignment {\n accountId: string | null;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n tenantId: string;\n type: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingAccountAssignmentLineType {\n accountAssignmentType: string;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n lineType: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingAccountAssignmentType {\n name: string;\n}\n\nexport interface AccountingAccountCategory {\n classification: string | null;\n id: Generated<string>;\n index: number;\n name: string;\n}\n\nexport interface AccountingAccountClassification {\n name: string;\n}\n\nexport interface AccountingAccountReservationLineType {\n accountId: string | null;\n bookingChannel: string | null;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n lineType: string;\n revenueRecognition: string | null;\n status: Generated<string | null>;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingAccountReservationRevRec {\n name: string;\n}\n\nexport interface AccountingAccountType {\n name: string;\n}\n\nexport interface AccountingBankAccount {\n accountId: string | null;\n category: Generated<string | null>;\n connectionId: string | null;\n createdAt: Generated<Timestamp>;\n currency: string | null;\n holderName: string | null;\n id: Generated<string>;\n lastDigits: string | null;\n name: string | null;\n sourceId: string | null;\n /**\n * The starting bank record for reconciliation\n */\n startingBankRecordId: string | null;\n status: Generated<string>;\n tenantId: string;\n type: Generated<string | null>;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingBankAccountCategory {\n name: string;\n}\n\nexport interface AccountingBankAccountType {\n name: string;\n}\n\nexport interface AccountingBankRecord {\n accountId: string | null;\n bankAccountId: string | null;\n calculatedCentBalance: number | null;\n calculatedCentTotalCorrection: number | null;\n centBalance: number | null;\n centTotal: number | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp>;\n date: Timestamp;\n description: string;\n id: Generated<string>;\n isBalanceAdjustment: Generated<boolean | null>;\n reconcileStatus: Generated<string>;\n sourceId: string | null;\n status: Generated<string>;\n tenantId: string;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingBankRecordTransactionPayment {\n bankRecordId: string;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n tenantId: string | null;\n transactionId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingContact {\n addressData: Json | null;\n /**\n * When NULL, the type is \"individual\"\n */\n companyType: string | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp>;\n defaultAccountId: string | null;\n email: string | null;\n firstName: string | null;\n id: Generated<string>;\n is1099PostalDelivery: Generated<boolean>;\n name: string;\n phone: string | null;\n /**\n * Human-readable system ID (CNT-XXX-XXXX-XXX).\n */\n shortRef: string | null;\n sourceId: string | null;\n status: string | null;\n taxId: string | null;\n tenantId: string;\n /**\n * owner OR vendor\n */\n type: string;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingContactCompanyType {\n name: string;\n}\n\nexport interface AccountingContactType {\n name: string;\n}\n\nexport interface AccountingJournalEntry {\n accountId: string | null;\n attachedToOwnerStatementId: string | null;\n centTotal: Int8;\n contactId: string | null;\n createdAt: Generated<Timestamp | null>;\n currency: string;\n description: string | null;\n entitySortNum: Generated<number | null>;\n entityType: string | null;\n id: Generated<string>;\n inactiveReason: AccountingJournalEntryInactiveReason | null;\n lineId: string | null;\n lineUniqueRef: string | null;\n listingId: string | null;\n listingOwnershipPeriodId: string | null;\n party: string | null;\n recurringFeeId: string | null;\n recurringFeeListingSubscriptionId: string | null;\n reservationId: string | null;\n status: Generated<string>;\n tenantId: string | null;\n transactionId: string | null;\n transferOwnerStatementId: string | null;\n triggerId: string | null;\n triggerType: string | null;\n txnAt: Timestamp | null;\n txnCode: Generated<string | null>;\n txnNum: number | null;\n type: string | null;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface AccountingJournalEntryEntityType {\n name: string;\n}\n\nexport interface AccountingJournalEntryTriggerType {\n name: string;\n}\n\nexport interface AccountingJournalEntryType {\n name: string;\n}\n\nexport interface AccountingOwnerStatementProjection {\n listingId: string | null;\n listingOwnershipPeriodId: string | null;\n payload: Json;\n projectionKey: string;\n refreshedAt: Generated<Timestamp>;\n sourceRevision: Int8;\n tenantId: string;\n variant: string;\n}\n\nexport interface AccountingOwnerStatementProjectionRevision {\n revision: Generated<Int8>;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingPaidStatus {\n name: string;\n}\n\nexport interface AccountingParty {\n name: string;\n}\n\nexport interface AccountingRate {\n accountId: string | null;\n basisPoints: number;\n behavior: string | null;\n countryCode: string | null;\n createdAt: Generated<Timestamp>;\n currency: string | null;\n debitAccountId: string | null;\n description: string | null;\n id: Generated<string>;\n name: string | null;\n status: Generated<string | null>;\n tenantId: string;\n type: string | null;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingRateType {\n name: string;\n}\n\nexport interface AccountingTaxBehavior {\n name: string;\n}\n\nexport interface AccountingTransaction {\n accountId: string | null;\n centTotal: number;\n connectionId: string | null;\n contactId: string | null;\n createdAt: Generated<Timestamp>;\n currency: string;\n date: Timestamp;\n description: string;\n dueAt: Timestamp | null;\n id: Generated<string>;\n isOpeningBalance: Generated<boolean>;\n matchBankAccountLast4: string | null;\n matchLineTypeClassification: string | null;\n matchReservationConfirmationCode: string | null;\n matchReservationStripeGuestRef: string | null;\n matchStatus: Generated<string | null>;\n paidAt: Timestamp | null;\n paidStatus: Generated<string | null>;\n recurringFeeId: string | null;\n recurringPattern: Json | null;\n recurringTemplateId: string | null;\n /**\n * Human-readable system ID (EXP/DEP/TRF-XXX-XXXX-XXX depending on transaction.type).\n */\n shortRef: string | null;\n sourceId: string | null;\n status: Generated<string>;\n tenantId: string;\n type: string;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingTransactionAttachment {\n byteSize: number;\n contentType: string;\n createdAt: Generated<Timestamp>;\n expiresAt: Timestamp | null;\n extension: string | null;\n filename: string;\n id: Generated<string>;\n isOwnerAccessible: Generated<boolean>;\n r2Key: string;\n status: Generated<AccountingTransactionAttachmentStatus>;\n tenantId: string;\n transactionId: string | null;\n updatedAt: Generated<Timestamp>;\n uploadedAt: Timestamp | null;\n}\n\nexport interface AccountingTransactionLine {\n accountAssignmentType: string | null;\n accountId: string | null;\n appliedAmountTaxBehavior: string | null;\n appliedAmountTaxRateId: string | null;\n centTotal: number;\n contactId: string | null;\n createdAt: Generated<Timestamp>;\n description: string;\n id: Generated<string>;\n listingId: string | null;\n markupCentTotal: number | null;\n markupTaxBehavior: string | null;\n markupTaxRateId: string | null;\n matchLineTypeClassification: string | null;\n matchReservationConfirmationCode: string | null;\n matchReservationStripeGuestRef: string | null;\n matchStatus: Generated<string | null>;\n ownerStatementId: string | null;\n party: string | null;\n reservationId: string | null;\n tenantId: string;\n transactionId: string;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingTransactionType {\n name: string;\n}\n\nexport interface AuditAction {\n actionType: string;\n actorId: string | null;\n actorType: AuditActionActorType;\n apiVersion: string;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n message: string | null;\n parentActionId: string | null;\n payload: Json | null;\n requestId: string | null;\n rootEntityId: string | null;\n rootEntityType: string | null;\n source: string | null;\n tenantId: string;\n traceId: string | null;\n}\n\nexport interface AuditEffect {\n actionId: string;\n claimedAt: Timestamp | null;\n claimedBy: string | null;\n completedAt: Timestamp | null;\n createdAt: Generated<Timestamp>;\n effectType: string;\n entityId: string | null;\n entityType: string | null;\n id: Generated<string>;\n lastAttemptAt: Timestamp | null;\n lastError: string | null;\n maxRetries: Generated<number>;\n payload: Generated<Json>;\n priority: Generated<number>;\n retryCount: Generated<number>;\n rootEntityId: string | null;\n rootEntityType: string | null;\n status: AuditEffectStatus;\n tenantId: string;\n}\n\nexport interface AuditEffectAttempt {\n actionId: string;\n attemptNum: number;\n effectId: string;\n errorData: Json | null;\n errorMessage: string | null;\n finishedAt: Timestamp | null;\n id: Generated<string>;\n resultCategory: string | null;\n resultCode: string | null;\n retryable: boolean | null;\n startedAt: Generated<Timestamp>;\n status: AuditEffectAttemptStatus;\n tenantId: string;\n workerId: string | null;\n}\n\nexport interface AuditJournalDelta {\n accountIdAfter: string | null;\n accountIdBefore: string | null;\n actionId: string;\n apiVersion: string;\n attachedToOwnerStatementIdAfter: string | null;\n attachedToOwnerStatementIdBefore: string | null;\n centTotalAfter: Int8 | null;\n centTotalBefore: Int8 | null;\n changedAt: Generated<Timestamp>;\n changedFields: Generated<string[]>;\n diffJson: Json | null;\n effectId: string | null;\n id: Generated<string>;\n journalEntryId: string;\n listingOwnershipPeriodIdAfter: string | null;\n listingOwnershipPeriodIdBefore: string | null;\n mutationId: string | null;\n operation: AuditJournalDeltaOperation;\n partyAfter: string | null;\n partyBefore: string | null;\n rootEntityId: string | null;\n rootEntityType: string | null;\n statusAfter: string | null;\n statusBefore: string | null;\n tenantId: string;\n txnAtAfter: Timestamp | null;\n txnAtBefore: Timestamp | null;\n}\n\nexport interface AuditMutation {\n actionId: string;\n changeRecord: Json;\n createdAt: Generated<Timestamp>;\n effectId: string | null;\n id: Generated<string>;\n op: string;\n rootEntityId: string | null;\n rootEntityType: string | null;\n subjectId: string;\n subjectType: string;\n tenantId: string;\n}\n\nexport interface CoreActiveStatus {\n name: string;\n}\n\nexport interface CoreChange {\n automationId: string | null;\n changeData: Json | null;\n changeFields: Generated<Json | null>;\n changeType: string | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp>;\n dataSha256: string | null;\n entityId: string;\n entityType: string;\n entityUniqueRef: string | null;\n id: Generated<string>;\n isLatestVersion: Generated<boolean | null>;\n message: string | null;\n seq: Int8 | null;\n status: string | null;\n syncId: string | null;\n syncSubtaskId: string | null;\n syncType: string | null;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n version: Numeric;\n}\n\nexport interface CoreChangeEntityType {\n name: string;\n}\n\nexport interface CoreChangeLink {\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n leftChangeId: string;\n rightChangeId: string;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface CoreChangeSourceLink {\n changeId: string;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n sourceId: string;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface CoreChangeStatus {\n name: string;\n}\n\nexport interface CoreChangeSyncType {\n name: string;\n}\n\nexport interface CoreChangeType {\n name: string;\n}\n\nexport interface CoreFlow {\n appId: string;\n description: string | null;\n id: Generated<string>;\n isPublic: Generated<boolean>;\n leftType: string | null;\n mappingSchema: Json;\n rightType: string | null;\n runSchema: Generated<Json>;\n settingSchema: Json;\n title: string;\n type: Generated<PublicFlowType | null>;\n uniqueRef: string;\n useGlobalMapping: Generated<boolean>;\n}\n\nexport interface CoreFlowMapping {\n accountId: string | null;\n bookingChannelId: string | null;\n connectionId: string;\n contactId: string | null;\n createdAt: Generated<Timestamp>;\n flowId: string | null;\n id: Generated<string>;\n listingId: string | null;\n mappingKey: string;\n rateId: string | null;\n sourceId: string;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n value: Json | null;\n}\n\nexport interface CoreFlowSetting {\n accountId: string | null;\n bookingChannelId: string | null;\n connectionId: string;\n contactId: string | null;\n createdAt: Generated<Timestamp>;\n flowId: string;\n id: Generated<string>;\n listingId: string | null;\n rateId: string | null;\n settingKey: string;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n value: Json | null;\n}\n\nexport interface CoreIssueMessageOverwrite {\n createdAt: Generated<Timestamp | null>;\n id: Generated<string>;\n message: string;\n pattern: string;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface CoreSync {\n automationId: string | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp>;\n environment: string | null;\n id: Generated<string>;\n isCurrentOnAutomation: Generated<boolean | null>;\n isCurrentOnConnection: Generated<boolean>;\n message: string | null;\n params: Generated<Json>;\n status: string;\n syncedAt: Timestamp | null;\n tenantId: string;\n triggerRef: string | null;\n type: string;\n updatedAt: Generated<Timestamp>;\n userId: string | null;\n}\n\nexport interface CoreSyncStatus {\n name: string;\n}\n\nexport interface CoreSyncSubtask {\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n message: string | null;\n params: Generated<Json | null>;\n status: Generated<string>;\n syncId: string;\n tenantId: string;\n triggerRef: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface CoreSyncType {\n name: string;\n}\n\nexport interface HdbCatalogEventInvocationLogs {\n createdAt: Generated<Timestamp | null>;\n eventId: string | null;\n id: Generated<string>;\n request: Json | null;\n response: Json | null;\n status: number | null;\n triggerName: string | null;\n}\n\nexport interface HdbCatalogEventLog {\n archived: Generated<boolean>;\n createdAt: Generated<Timestamp | null>;\n delivered: Generated<boolean>;\n error: Generated<boolean>;\n id: Generated<string>;\n locked: Timestamp | null;\n nextRetryAt: Timestamp | null;\n payload: Json;\n schemaName: string;\n tableName: string;\n tries: Generated<number>;\n triggerName: string;\n}\n\nexport interface HdbCatalogHdbActionLog {\n actionName: string | null;\n createdAt: Generated<Timestamp>;\n errors: Json | null;\n id: Generated<string>;\n inputPayload: Json;\n requestHeaders: Json;\n responsePayload: Json | null;\n responseReceivedAt: Timestamp | null;\n sessionVariables: Json;\n status: string;\n}\n\nexport interface HdbCatalogHdbCronEventInvocationLogs {\n createdAt: Generated<Timestamp | null>;\n eventId: string | null;\n id: Generated<string>;\n request: Json | null;\n response: Json | null;\n status: number | null;\n}\n\nexport interface HdbCatalogHdbCronEvents {\n createdAt: Generated<Timestamp | null>;\n id: Generated<string>;\n nextRetryAt: Timestamp | null;\n scheduledTime: Timestamp;\n status: Generated<string>;\n tries: Generated<number>;\n triggerName: string;\n}\n\nexport interface HdbCatalogHdbEventLogCleanups {\n deletedEventInvocationLogs: number | null;\n deletedEventLogs: number | null;\n id: Generated<string>;\n scheduledAt: Timestamp;\n status: string;\n triggerName: string;\n}\n\nexport interface HdbCatalogHdbMetadata {\n id: number;\n metadata: Json;\n resourceVersion: Generated<number>;\n}\n\nexport interface HdbCatalogHdbScheduledEventInvocationLogs {\n createdAt: Generated<Timestamp | null>;\n eventId: string | null;\n id: Generated<string>;\n request: Json | null;\n response: Json | null;\n status: number | null;\n}\n\nexport interface HdbCatalogHdbScheduledEvents {\n comment: string | null;\n createdAt: Generated<Timestamp | null>;\n headerConf: Json | null;\n id: Generated<string>;\n nextRetryAt: Timestamp | null;\n payload: Json | null;\n retryConf: Json | null;\n scheduledTime: Timestamp;\n status: Generated<string>;\n tries: Generated<number>;\n webhookConf: Json;\n}\n\nexport interface HdbCatalogHdbSchemaNotifications {\n id: number;\n instanceId: string;\n notification: Json;\n resourceVersion: Generated<number>;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface HdbCatalogHdbSourceCatalogVersion {\n upgradedOn: Timestamp;\n version: string;\n}\n\nexport interface HdbCatalogHdbVersion {\n cliState: Generated<Json>;\n consoleState: Generated<Json>;\n eeClientId: string | null;\n eeClientSecret: string | null;\n hasuraUuid: Generated<string>;\n upgradedOn: Timestamp;\n version: string;\n}\n\nexport interface PublicAccountCollection {\n automationId: string | null;\n connectionId: string;\n createdAt: Generated<Timestamp | null>;\n id: Generated<string>;\n name: string;\n tenantId: string;\n type: Generated<string | null>;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface PublicAccountCollectionType {\n name: string;\n}\n\nexport interface PublicAddress {\n city: string | null;\n country: string | null;\n countryCode: string | null;\n createdAt: Generated<Timestamp>;\n full: string | null;\n id: Generated<string>;\n lastValidated: Timestamp | null;\n line: string | null;\n lineDetails: string | null;\n postalCode: string | null;\n state: string | null;\n stateCode: string | null;\n tenantId: string | null;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicApp {\n authentication: Generated<Json>;\n category: string | null;\n color: string | null;\n createdAt: Generated<Timestamp>;\n icon: string | null;\n iconRound: string | null;\n id: Generated<string>;\n info: Json | null;\n name: string;\n type: string;\n version: Generated<number>;\n}\n\nexport interface PublicAuditLog {\n actorUserId: string | null;\n automationId: string | null;\n connectionId: string | null;\n contactId: string | null;\n createdAt: Generated<Timestamp>;\n deltaJson: Json | null;\n id: Generated<string>;\n listingCollectionId: string | null;\n listingId: string | null;\n objectId: string | null;\n op: string;\n ownerId: string | null;\n ownerStatementId: string | null;\n ownerStatementLayoutId: string | null;\n tableName: string;\n taxStatementId: string | null;\n tenantId: string | null;\n userId: string | null;\n}\n\nexport interface PublicAutomation {\n connectionId: string | null;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n leftConnectionId: string | null;\n rightConnectionId: string | null;\n runSettings: Json | null;\n scheduleStatus: Generated<string | null>;\n status: Generated<string>;\n template: string | null;\n templateId: string | null;\n tenantId: string;\n title: string | null;\n triggerDevTaskOverwrite: string | null;\n updatedAt: Generated<Timestamp>;\n viewSettings: Json | null;\n}\n\nexport interface PublicAutomationTemplate {\n /**\n * determines whether this automation allows a team to configure multiple versions of this with the same leftConnection rightConnection combination\n */\n allowMultiple: boolean | null;\n appId: string | null;\n createdAt: Generated<Timestamp | null>;\n description: string;\n endpoint: string;\n id: Generated<string>;\n input: string;\n label: string | null;\n leftAppId: string | null;\n mappings: Json | null;\n name: string | null;\n params: Generated<Json | null>;\n preview: Json | null;\n rightAppId: string | null;\n settings: Json | null;\n stripePriceRef: string | null;\n title: string | null;\n triggerDevTask: string | null;\n triggers: Generated<Json | null>;\n type: string | null;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp | null>;\n version: string | null;\n visibility: string | null;\n}\n\nexport interface PublicBillingPaymentMethodType {\n name: string;\n}\n\nexport interface PublicBookingChannel {\n channelRef: string | null;\n createdAt: Generated<Timestamp>;\n icon: string | null;\n id: Generated<string>;\n uniqueRef: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicConnection {\n appId: string;\n backendVersion: number | null;\n createdAt: Generated<Timestamp>;\n credentials: Generated<Json | null>;\n disabled: Generated<boolean | null>;\n fetchNext: Generated<Timestamp | null>;\n fetchStatus: Generated<string>;\n icon: string | null;\n id: Generated<string>;\n lastFetch: Timestamp | null;\n metadata: Json | null;\n name: string;\n persistentState: Generated<Json | null>;\n status: Generated<string | null>;\n tenantId: string;\n type: string | null;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp | null>;\n version: number | null;\n}\n\nexport interface PublicCurrency {\n name: string;\n}\n\nexport interface PublicDuplicateEmails {\n count: Int8 | null;\n email: string | null;\n id: string | null;\n}\n\nexport interface PublicEmailTemplate {\n createdAt: Generated<Timestamp>;\n dataJson: Json;\n id: Generated<string>;\n tenantId: string;\n type: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicEmailTemplateType {\n name: string;\n}\n\nexport interface PublicFeature {\n createdAt: Generated<Timestamp>;\n description: string | null;\n id: Generated<string>;\n issueUrl: string | null;\n /**\n * user ids of user needed to approve this feature\n */\n requiredApprovals: Generated<Json | null>;\n status: Generated<string | null>;\n tenantId: string | null;\n title: string;\n updatedAt: Generated<Timestamp>;\n url: string | null;\n}\n\nexport interface PublicFeatureApproval {\n createdAt: Generated<Timestamp>;\n featureId: string;\n id: Generated<string>;\n status: Generated<string | null>;\n updatedAt: Generated<Timestamp>;\n userId: string;\n}\n\nexport interface PublicFeatureApprovalStatus {\n name: string;\n}\n\nexport interface PublicFeatureEnabledTeam {\n createdAt: Generated<Timestamp>;\n featureId: string;\n id: Generated<string>;\n status: Generated<string | null>;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicFeatureStatus {\n name: string;\n}\n\nexport interface PublicFileStorage {\n connectionId: string | null;\n contactId: string | null;\n createdAt: Generated<Timestamp>;\n endDate: Timestamp | null;\n extension: string | null;\n filename: string;\n fileUri: string | null;\n id: Generated<string>;\n metadata: Json | null;\n newOwnerId: string | null;\n ownerUserId: string | null;\n reservationId: string | null;\n rowDateField: string | null;\n startDate: Timestamp | null;\n status: string | null;\n tenantId: string;\n type: string;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicFileStorageSourceLink {\n createdAt: Generated<Timestamp>;\n fileStorageId: string;\n id: Generated<string>;\n sourceId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicFileStorageTag {\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n tenantId: string;\n title: string;\n uniqueRef: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicLatestDuplicateEmails {\n createdAt: Timestamp | null;\n email: string | null;\n id: string | null;\n name: string | null;\n status: string | null;\n}\n\nexport interface PublicListing {\n address: string | null;\n addressCity: string | null;\n addressCountry: string | null;\n addressData: Json | null;\n addressId: string | null;\n addressState: string | null;\n bedrooms: number | null;\n beds: number | null;\n calculatedStatus: Generated<string | null>;\n calculatedTitle: Generated<string | null>;\n calculatedTitleNew: Generated<string | null>;\n centExpenseReserve: number | null;\n /**\n * Starting balance for tax statements\n */\n centTaxStartingBalance: number | null;\n collectionId: string | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp | null>;\n customCode: string | null;\n defaultCurrency: string | null;\n id: Generated<string>;\n imageUri: string | null;\n metadata: Generated<Json | null>;\n name: string | null;\n ownerContactId: string | null;\n pmsAddressData: Json | null;\n pmsStatus: string | null;\n /**\n * Human-readable system ID (LST-XXX-XXXX-XXX).\n */\n shortRef: string | null;\n sourceId: string | null;\n status: string | null;\n tenantId: string;\n title: string | null;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface PublicListingCollection {\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n name: string;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicListingConnection {\n address: string | null;\n bedrooms: number | null;\n beds: number | null;\n connectionId: string;\n createdAt: Generated<Timestamp | null>;\n groupKey: string | null;\n id: Generated<string>;\n listingId: string | null;\n metadata: Json | null;\n name: string | null;\n nickname: string | null;\n sourceId: string | null;\n status: string | null;\n tenantId: string | null;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface PublicListingOwner {\n createdAt: Generated<Timestamp | null>;\n id: Generated<string>;\n listingId: string;\n newOwnerId: string | null;\n ownerId: string | null;\n role: Generated<string>;\n split: Numeric | null;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface PublicListingOwnerRole {\n name: string;\n}\n\nexport interface PublicListingOwnershipPeriod {\n businessModel: Generated<string | null>;\n createdAt: Generated<Timestamp>;\n endAt: Timestamp | null;\n id: Generated<string>;\n listingId: string;\n reserveCentTotal: Generated<Int8>;\n setListingInactive: Generated<boolean | null>;\n startAt: Generated<Timestamp | null>;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicListingOwnershipPeriodBusinessModel {\n name: string;\n}\n\nexport interface PublicListingOwnershipPeriodMember {\n contactId: string | null;\n createdAt: Generated<Timestamp | null>;\n id: Generated<string>;\n ownerId: string | null;\n periodId: string;\n split: number;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface PublicOwner {\n addressId: string | null;\n companyType: string | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp>;\n email: string | null;\n firstName: string | null;\n id: Generated<string>;\n is1099PostalDelivery: Generated<boolean>;\n /**\n * Lastname or company name\n */\n name: string;\n phone: string | null;\n sourceId: string | null;\n status: Generated<string | null>;\n taxId: string | null;\n tenantId: string;\n type: string;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicOwnerStatement {\n automationId: string | null;\n centBalanceEnd: Int8 | null;\n centBalanceStart: Int8 | null;\n centExpenses: Int8 | null;\n centNetRevenue: Int8 | null;\n centPayedOut: number | null;\n centRentalRevenue: number | null;\n centTotal: Int8 | null;\n centTransfer: Int8 | null;\n createdAt: Generated<Timestamp>;\n currency: string | null;\n endAt: Timestamp;\n id: Generated<string>;\n layoutId: string | null;\n listingId: string | null;\n listingOwnershipPeriodId: string | null;\n metadata: Json | null;\n ownerId: string | null;\n party: Generated<string | null>;\n previousOwnerStatementId: string | null;\n startAt: Timestamp;\n status: Generated<string>;\n templateId: string | null;\n templateJson: Json | null;\n tenantId: string;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicOwnerStatementLayout {\n automationId: string | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp>;\n dataJson: Json;\n id: Generated<string>;\n isDefault: Generated<boolean | null>;\n tenantId: string;\n title: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicOwnerStatementLayoutAccount {\n accountId: string;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n layoutId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicOwnerStatementLayoutListing {\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n layoutId: string;\n listingId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicOwnerStatementLine {\n centTotal: number;\n createdAt: Generated<Timestamp>;\n currency: string | null;\n customDescription: string | null;\n date: Timestamp | null;\n description: string | null;\n externalLink: string | null;\n groupId: string | null;\n id: Generated<string>;\n isOwnerPayout: Generated<boolean | null>;\n metadata: Json | null;\n ownerStatementId: string;\n reservationId: string | null;\n role: Generated<string | null>;\n sourceId: string | null;\n tenantId: string;\n uniqueRef: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicOwnerStatementOwner {\n createdAt: Generated<Timestamp | null>;\n id: Generated<string>;\n newOwnerId: string | null;\n ownerId: string | null;\n role: string;\n split: Numeric | null;\n statementId: string;\n updatedAt: Generated<Timestamp | null>;\n /**\n * The source id to the listing owner vendor\n */\n vendorSourceId: string | null;\n}\n\nexport interface PublicOwnerStatementStatus {\n name: string;\n}\n\nexport interface PublicOwnerStatementTemplate {\n balanceStartAt: Timestamp | null;\n billingAccountId: string | null;\n createdAt: Generated<Timestamp>;\n data: Json;\n id: Generated<string>;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n version: Generated<number | null>;\n}\n\nexport interface PublicOwnerType {\n name: string;\n}\n\nexport interface PublicOwnerUserAccess {\n contactId: string | null;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n ownerId: string | null;\n role: Generated<string>;\n updatedAt: Generated<Timestamp>;\n userId: string;\n}\n\nexport interface PublicOwnerUserAccessRole {\n name: string;\n}\n\nexport interface PublicPayment {\n bankAccountDigits: string | null;\n centTotal: Generated<Int8 | null>;\n connectionId: string | null;\n createdAt: Generated<Timestamp | null>;\n currency: string | null;\n description: string | null;\n etaAt: Timestamp | null;\n id: Generated<string>;\n isReconciled: Generated<boolean | null>;\n issues: Json | null;\n metadata: Generated<Json | null>;\n payedAt: Timestamp | null;\n paymentMethod: string | null;\n sourceId: string | null;\n status: string | null;\n tenantId: string | null;\n type: string | null;\n uniqueRef: string | null;\n uniqueRefAir: string | null;\n uniqueRefTemp: string | null;\n updatedAt: Generated<Timestamp | null>;\n userdata: Generated<Json | null>;\n}\n\nexport interface PublicPaymentLine {\n accountId: string | null;\n centTotal: Int8 | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp>;\n description: string | null;\n editedType: string | null;\n effectiveType: Generated<string | null>;\n generalLedgerPostingAt: Timestamp | null;\n id: Generated<string>;\n lineId: string | null;\n listingId: string | null;\n matchReservationConfirmationCode: string | null;\n matchReservationStripeGuestRef: string | null;\n matchStatus: Generated<string | null>;\n metadata: Json | null;\n originCentTotal: Int8 | null;\n originCurrency: string | null;\n originExchangeRate: Numeric | null;\n party: string | null;\n paymentId: string | null;\n recurringFeeId: string | null;\n reservationId: string | null;\n skipReconcile: Generated<boolean | null>;\n tenantId: string | null;\n type: string | null;\n type2: string | null;\n uniqueRef: string | null;\n uniqueRef2: string | null;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface PublicPaymentLineClassification {\n appId: string | null;\n createdAt: Generated<Timestamp | null>;\n id: Generated<string | null>;\n name: string;\n type: string | null;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface PublicPaymentStatus {\n name: string;\n}\n\nexport interface PublicPaymentType {\n name: string;\n}\n\nexport interface PublicRecurringFee {\n bookingChannelsFilter: string[] | null;\n createdAt: Generated<Timestamp>;\n creditAccountId: string | null;\n creditParty: Generated<string>;\n debitAccountId: string | null;\n debitParty: Generated<string>;\n defaultRate: number | null;\n formula: string | null;\n icon: string | null;\n id: Generated<string>;\n rateType: Generated<string | null>;\n revenueRecognition: string | null;\n status: Generated<string>;\n statusFilter: string | null;\n taxBehavior: string | null;\n taxRateId: string | null;\n tenantId: string;\n title: string;\n type: Generated<string>;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicRecurringFeeAccount {\n accountId: string;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n recurringFeeId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicRecurringFeeAccountCondition {\n accountId: string;\n centValue: Int8;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n operator: PublicRecurringFeeConditionOperator;\n recurringFeeId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicRecurringFeeListingSubscription {\n createdAt: Generated<Timestamp>;\n endAt: Timestamp | null;\n id: Generated<string>;\n listingId: string;\n rate: number | null;\n rateType: Generated<string | null>;\n recurringFeeId: string;\n startAt: Generated<Timestamp | null>;\n status: Generated<string>;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicRecurringFeeListingSubscriptionRateType {\n name: string;\n}\n\nexport interface PublicRecurringFeeType {\n name: string;\n}\n\nexport interface PublicReservation {\n bookedAt: Generated<Timestamp | null>;\n bookerName: string | null;\n bookingPlatform: string | null;\n calculatedDeduplicationRef: Generated<string | null>;\n cancelledAt: Timestamp | null;\n centAccommodation: number | null;\n centAdjustment: number | null;\n centCancellation: number | null;\n centCityTax: number | null;\n centCleaning: Int8 | null;\n centOta: number | null;\n centPaid: Int8 | null;\n centPaymentFee: number | null;\n centService: number | null;\n centTotal: Generated<Int8 | null>;\n channelId: string | null;\n checkIn: Timestamp | null;\n checkOut: Timestamp | null;\n confirmationCode: string | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp | null>;\n currency: string | null;\n editedCheckIn: Timestamp | null;\n editedCheckOut: Timestamp | null;\n effectiveCheckIn: Generated<Timestamp | null>;\n effectiveCheckOut: Generated<Timestamp | null>;\n effectiveNights: Generated<number | null>;\n generalLedgerPostingAt: Timestamp | null;\n generalLedgerStatus: Generated<string>;\n guestName: string | null;\n guests: number | null;\n id: Generated<string>;\n lineMap: Json | null;\n listingConnectionId: string | null;\n listingId: string | null;\n managerCentTotal: Int8 | null;\n matchPaymentCustomerRef: string | null;\n metadata: Json | null;\n nights: number | null;\n otaReservationId: string | null;\n ownersCentTotal: Int8 | null;\n paidStatus: string | null;\n paymentMethod: string | null;\n pmsReferenceCode: string | null;\n /**\n * Human-readable system ID (RES-XXX-XXXX-XXX).\n */\n shortRef: string | null;\n sourceId: string | null;\n status: Generated<string | null>;\n taxCentTotal: Int8 | null;\n tenantId: string | null;\n uniqueRef: string | null;\n uniqueRef2: string | null;\n updatedAt: Generated<Timestamp | null>;\n userdata: Generated<Json | null>;\n}\n\nexport interface PublicReservationStatus {\n name: string;\n}\n\nexport interface PublicReservationWithOccupancyStatus {\n bookedAt: Timestamp | null;\n bookerName: string | null;\n bookingPlatform: string | null;\n cancelledAt: Timestamp | null;\n centAccommodation: number | null;\n centAdjustment: number | null;\n centCancellation: number | null;\n centCityTax: number | null;\n centCleaning: Int8 | null;\n centOta: number | null;\n centPaid: Int8 | null;\n centPaymentFee: number | null;\n centService: number | null;\n centTotal: Int8 | null;\n channelId: string | null;\n checkIn: Timestamp | null;\n checkOut: Timestamp | null;\n confirmationCode: string | null;\n connectionId: string | null;\n createdAt: Timestamp | null;\n currency: string | null;\n guestName: string | null;\n guests: number | null;\n id: string | null;\n lineMap: Json | null;\n listingConnectionId: string | null;\n listingId: string | null;\n metadata: Json | null;\n nights: number | null;\n occupancyStatus: string | null;\n otaReservationId: string | null;\n paidStatus: string | null;\n paymentMethod: string | null;\n pmsReferenceCode: string | null;\n sourceId: string | null;\n status: string | null;\n tenantId: string | null;\n uniqueRef: string | null;\n uniqueRef2: string | null;\n updatedAt: Timestamp | null;\n userdata: Json | null;\n}\n\nexport interface PublicSetting {\n automationId: string | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp>;\n group: string | null;\n id: Generated<string>;\n key: string;\n leftConnectionId: string | null;\n leftId: Generated<string | null>;\n leftType: string | null;\n lineClassification: string | null;\n listingId: string | null;\n localAutomationId: string | null;\n parentSettingId: string | null;\n partner: string | null;\n rightConnectionId: string | null;\n rightId: Generated<string | null>;\n rightType: string | null;\n sourceId: string | null;\n status: Generated<string | null>;\n target: string;\n targetUuid: Generated<string | null>;\n tenantId: string | null;\n updatedAt: Generated<Timestamp>;\n value: string | null;\n}\n\nexport interface PublicSource {\n /**\n * deprecated\n */\n appId: string | null;\n code: string | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp>;\n dataHref: string | null;\n date: Timestamp | null;\n description: string | null;\n id: Generated<string>;\n indexedJson: Json | null;\n isArchived: Generated<boolean | null>;\n json: Json | null;\n lastWebhookAt: Timestamp | null;\n /**\n * deprecated\n */\n listingConnectionId: string | null;\n /**\n * deprecated\n */\n listingId: string | null;\n modifiedAt: Timestamp | null;\n parentId: string | null;\n remoteId: string | null;\n reservationId: string | null;\n status: Generated<string | null>;\n tenantId: string;\n transformJson: Json | null;\n transformType: string | null;\n type: string;\n updatedAt: Generated<Timestamp | null>;\n version: Generated<number | null>;\n}\n\nexport interface PublicTask {\n createdAt: Generated<Timestamp | null>;\n id: Generated<string>;\n message: string | null;\n status: string | null;\n}\n\nexport interface PublicTaxStatement {\n centRentalRevenue: number | null;\n createdAt: Generated<Timestamp>;\n endAt: Timestamp | null;\n error: string | null;\n id: Generated<string>;\n metadata: Json | null;\n ownerId: string | null;\n startAt: Timestamp | null;\n status: Generated<string>;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n url: string | null;\n userId: string | null;\n year: number;\n}\n\nexport interface PublicTaxStatementStatus {\n name: string;\n}\n\nexport interface PublicTenant {\n address: string | null;\n addressCity: string | null;\n addressCountry: string | null;\n addressLine1: string | null;\n addressPostcode: string | null;\n billingAddressData: Json | null;\n billingAddressId: string | null;\n billingCustomerId: string | null;\n billingPartnerId: string | null;\n billingPaymentMethodType: string | null;\n billingPlan: string | null;\n billingSubscriptionStatus: string | null;\n booksClosedAt: Timestamp | null;\n calculatedBillingPartnerId: Generated<string | null>;\n calculatedIsBillable: Generated<boolean | null>;\n calculatedStatus: Generated<string | null>;\n /**\n * Billing subscription is getting cancelled at date\n */\n cancelledAt: Timestamp | null;\n chartOfAccountTenantId: string | null;\n clerkId: string | null;\n colorPrimary: string | null;\n commissionPercentage: Numeric | null;\n companyName: string | null;\n companyTaxCode: string | null;\n createdAt: Generated<Timestamp>;\n defaultCurrency: string | null;\n defaultRevenueRecognition: string | null;\n email: string | null;\n featureFlags: Generated<Json | null>;\n id: Generated<string>;\n intercomId: string | null;\n isActive: Generated<boolean | null>;\n isGeneralLedger: Generated<boolean | null>;\n isOnboarding: Generated<boolean | null>;\n isTest: Generated<boolean | null>;\n logo: string | null;\n longTermStayNights: number | null;\n name: string;\n ownerPortalShowDraftStatements: boolean | null;\n partnerId: Generated<string | null>;\n /**\n * JSON column to hold team settings like \"owner_portal_show_reservation_totals\" or \"owner_portal_show_draft_statements\n */\n settingsData: Json | null;\n setup: Json | null;\n setupCompleted: Generated<boolean | null>;\n statementAddressData: Json | null;\n statementAddressId: string | null;\n statementStartAt: Timestamp | null;\n status: Generated<string | null>;\n stripeId: string | null;\n stripeSubscriptionItemId: string | null;\n supportEmail: string | null;\n supportPhone: string | null;\n svixEndpoints: boolean | null;\n trialUntil: Timestamp | null;\n type: Generated<string | null>;\n updatedAt: Generated<Timestamp | null>;\n website: string | null;\n}\n\nexport interface PublicTenantUser {\n createdAt: Generated<Timestamp | null>;\n id: Generated<string>;\n lastInvitedAt: Timestamp | null;\n notificationPreferences: Generated<Json | null>;\n role: Generated<string | null>;\n status: Generated<string | null>;\n tenantId: string;\n updatedAt: Generated<Timestamp | null>;\n userId: string;\n}\n\nexport interface PublicToken {\n createdAt: Generated<Timestamp>;\n expiresAt: Timestamp | null;\n id: Generated<string>;\n nanoId: Generated<string>;\n payload: Generated<Json>;\n tenantId: string | null;\n type: string | null;\n userId: string | null;\n}\n\nexport interface PublicUser {\n address: string | null;\n addressCity: string | null;\n addressCountry: string | null;\n addressId: string | null;\n addressLine1: string | null;\n addressPostcode: string | null;\n clerkId: string | null;\n companyName: string | null;\n companyType: string | null;\n createdAt: Generated<Timestamp | null>;\n email: string | null;\n firstName: string | null;\n id: Generated<string>;\n isAdmin: Generated<boolean>;\n lastName: string | null;\n lastSeen: Timestamp | null;\n name: string | null;\n notificationPreferences: Generated<Json | null>;\n partnerId: string | null;\n password: string | null;\n phone: string | null;\n secondaryEmails: Generated<Json | null>;\n status: Generated<string | null>;\n sub: string | null;\n taxId: string | null;\n trialExpiryAt: Timestamp | null;\n type: Generated<string | null>;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface PublicUserCompanyType {\n name: string;\n}\n\nexport interface PublicUserCompanyUser {\n companyUserId: string;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n updatedAt: Generated<Timestamp>;\n userId: string;\n}\n\nexport interface PublicView {\n group: string | null;\n icon: string | null;\n id: Generated<string>;\n isDefault: Generated<boolean | null>;\n retoolViewId: string | null;\n sortOrder: Generated<number | null>;\n stateData: Json | null;\n tenantId: string | null;\n title: string;\n type: string | null;\n}\n\nexport interface PublicViewNotificationEvents {\n createdAt: Timestamp | null;\n eventId: string | null;\n id: string | null;\n request: Json | null;\n response: Json | null;\n status: number | null;\n triggerName: string | null;\n}\n\nexport interface PublicViewNotificationEventsGroupedByDate {\n count: Int8 | null;\n dateTrunc: Timestamp | null;\n status: number | null;\n triggerName: string | null;\n}\n\nexport interface PublicViewWebhookEvents {\n createdAt: Timestamp | null;\n eventId: string | null;\n id: string | null;\n request: Json | null;\n response: Json | null;\n status: number | null;\n triggerName: string | null;\n}\n\nexport interface PublicViewWebhookEventsGroupedByDate {\n count: Int8 | null;\n dateTrunc: Timestamp | null;\n status: number | null;\n triggerName: string | null;\n}\n\nexport interface PublicWebhook {\n createdAt: Generated<Timestamp>;\n headers: Json | null;\n id: Generated<string>;\n tenantId: string | null;\n types: Generated<Json>;\n types2: string[] | null;\n url: string;\n}\n\nexport interface TrackingEvent {\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n name: string;\n packageName: string;\n props: Json;\n tenantId: string | null;\n timestamp: Generated<Timestamp | null>;\n trackedAt: Generated<Timestamp | null>;\n userId: string | null;\n}\n\nexport interface TrackingIntercomConversation {\n answer: string;\n conversationId: Int8;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n isRelevant: boolean;\n outcome: string;\n question: string;\n summary: string;\n tags: string;\n}\n\nexport interface TrackingIntercomConversationUser {\n conversationId: string;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n userId: string;\n}\n\nexport interface TrackingIntercomReport {\n action: string;\n category: string;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n summary: string;\n tags: string;\n}\n\nexport interface TrackingIntercomReportConversation {\n conversationId: string;\n id: Generated<string>;\n reportId: string;\n}\n\nexport interface TrackingMetricCache {\n connectionId: Generated<string>;\n date: Timestamp;\n name: Generated<string>;\n refreshedAt: Generated<Timestamp>;\n status: Generated<string>;\n tenantId: string;\n total: Numeric;\n type: string;\n}\n\nexport interface TrackingMonitorConnection {\n appId: string;\n connectionId: string;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n message: string | null;\n status: string | null;\n syncedAt: Timestamp | null;\n tenantId: string;\n triggerRef: string | null;\n updatedAt: Timestamp | null;\n version: number | null;\n}\n\nexport interface TrackingMonitorConnectionState {\n name: string;\n}\n\nexport interface DB {\n \"accounting.account\": AccountingAccount;\n \"accounting.accountAssignment\": AccountingAccountAssignment;\n \"accounting.accountAssignmentLineType\": AccountingAccountAssignmentLineType;\n \"accounting.accountAssignmentType\": AccountingAccountAssignmentType;\n \"accounting.accountCategory\": AccountingAccountCategory;\n \"accounting.accountClassification\": AccountingAccountClassification;\n \"accounting.accountReservationLineType\": AccountingAccountReservationLineType;\n \"accounting.accountReservationRevRec\": AccountingAccountReservationRevRec;\n \"accounting.accountType\": AccountingAccountType;\n \"accounting.bankAccount\": AccountingBankAccount;\n \"accounting.bankAccountCategory\": AccountingBankAccountCategory;\n \"accounting.bankAccountType\": AccountingBankAccountType;\n \"accounting.bankRecord\": AccountingBankRecord;\n \"accounting.bankRecordTransactionPayment\": AccountingBankRecordTransactionPayment;\n \"accounting.contact\": AccountingContact;\n \"accounting.contactCompanyType\": AccountingContactCompanyType;\n \"accounting.contactType\": AccountingContactType;\n \"accounting.journalEntry\": AccountingJournalEntry;\n \"accounting.journalEntryEntityType\": AccountingJournalEntryEntityType;\n \"accounting.journalEntryTriggerType\": AccountingJournalEntryTriggerType;\n \"accounting.journalEntryType\": AccountingJournalEntryType;\n \"accounting.ownerStatementProjection\": AccountingOwnerStatementProjection;\n \"accounting.ownerStatementProjectionRevision\": AccountingOwnerStatementProjectionRevision;\n \"accounting.paidStatus\": AccountingPaidStatus;\n \"accounting.party\": AccountingParty;\n \"accounting.rate\": AccountingRate;\n \"accounting.rateType\": AccountingRateType;\n \"accounting.taxBehavior\": AccountingTaxBehavior;\n \"accounting.transaction\": AccountingTransaction;\n \"accounting.transactionAttachment\": AccountingTransactionAttachment;\n \"accounting.transactionLine\": AccountingTransactionLine;\n \"accounting.transactionType\": AccountingTransactionType;\n \"audit.action\": AuditAction;\n \"audit.effect\": AuditEffect;\n \"audit.effectAttempt\": AuditEffectAttempt;\n \"audit.journalDelta\": AuditJournalDelta;\n \"audit.mutation\": AuditMutation;\n \"core.activeStatus\": CoreActiveStatus;\n \"core.change\": CoreChange;\n \"core.changeEntityType\": CoreChangeEntityType;\n \"core.changeLink\": CoreChangeLink;\n \"core.changeSourceLink\": CoreChangeSourceLink;\n \"core.changeStatus\": CoreChangeStatus;\n \"core.changeSyncType\": CoreChangeSyncType;\n \"core.changeType\": CoreChangeType;\n \"core.flow\": CoreFlow;\n \"core.flowMapping\": CoreFlowMapping;\n \"core.flowSetting\": CoreFlowSetting;\n \"core.issueMessageOverwrite\": CoreIssueMessageOverwrite;\n \"core.sync\": CoreSync;\n \"core.syncStatus\": CoreSyncStatus;\n \"core.syncSubtask\": CoreSyncSubtask;\n \"core.syncType\": CoreSyncType;\n \"hdbCatalog.eventInvocationLogs\": HdbCatalogEventInvocationLogs;\n \"hdbCatalog.eventLog\": HdbCatalogEventLog;\n \"hdbCatalog.hdbActionLog\": HdbCatalogHdbActionLog;\n \"hdbCatalog.hdbCronEventInvocationLogs\": HdbCatalogHdbCronEventInvocationLogs;\n \"hdbCatalog.hdbCronEvents\": HdbCatalogHdbCronEvents;\n \"hdbCatalog.hdbEventLogCleanups\": HdbCatalogHdbEventLogCleanups;\n \"hdbCatalog.hdbMetadata\": HdbCatalogHdbMetadata;\n \"hdbCatalog.hdbScheduledEventInvocationLogs\": HdbCatalogHdbScheduledEventInvocationLogs;\n \"hdbCatalog.hdbScheduledEvents\": HdbCatalogHdbScheduledEvents;\n \"hdbCatalog.hdbSchemaNotifications\": HdbCatalogHdbSchemaNotifications;\n \"hdbCatalog.hdbSourceCatalogVersion\": HdbCatalogHdbSourceCatalogVersion;\n \"hdbCatalog.hdbVersion\": HdbCatalogHdbVersion;\n \"public.accountCollection\": PublicAccountCollection;\n \"public.accountCollectionType\": PublicAccountCollectionType;\n \"public.address\": PublicAddress;\n \"public.app\": PublicApp;\n \"public.auditLog\": PublicAuditLog;\n \"public.automation\": PublicAutomation;\n \"public.automationTemplate\": PublicAutomationTemplate;\n \"public.billingPaymentMethodType\": PublicBillingPaymentMethodType;\n \"public.bookingChannel\": PublicBookingChannel;\n \"public.connection\": PublicConnection;\n \"public.currency\": PublicCurrency;\n \"public.duplicateEmails\": PublicDuplicateEmails;\n \"public.emailTemplate\": PublicEmailTemplate;\n \"public.emailTemplateType\": PublicEmailTemplateType;\n \"public.feature\": PublicFeature;\n \"public.featureApproval\": PublicFeatureApproval;\n \"public.featureApprovalStatus\": PublicFeatureApprovalStatus;\n \"public.featureEnabledTeam\": PublicFeatureEnabledTeam;\n \"public.featureStatus\": PublicFeatureStatus;\n \"public.fileStorage\": PublicFileStorage;\n \"public.fileStorageSourceLink\": PublicFileStorageSourceLink;\n \"public.fileStorageTag\": PublicFileStorageTag;\n \"public.latestDuplicateEmails\": PublicLatestDuplicateEmails;\n \"public.listing\": PublicListing;\n \"public.listingCollection\": PublicListingCollection;\n \"public.listingConnection\": PublicListingConnection;\n \"public.listingOwner\": PublicListingOwner;\n \"public.listingOwnerRole\": PublicListingOwnerRole;\n \"public.listingOwnershipPeriod\": PublicListingOwnershipPeriod;\n \"public.listingOwnershipPeriodBusinessModel\": PublicListingOwnershipPeriodBusinessModel;\n \"public.listingOwnershipPeriodMember\": PublicListingOwnershipPeriodMember;\n \"public.owner\": PublicOwner;\n \"public.ownerStatement\": PublicOwnerStatement;\n \"public.ownerStatementLayout\": PublicOwnerStatementLayout;\n \"public.ownerStatementLayoutAccount\": PublicOwnerStatementLayoutAccount;\n \"public.ownerStatementLayoutListing\": PublicOwnerStatementLayoutListing;\n \"public.ownerStatementLine\": PublicOwnerStatementLine;\n \"public.ownerStatementOwner\": PublicOwnerStatementOwner;\n \"public.ownerStatementStatus\": PublicOwnerStatementStatus;\n \"public.ownerStatementTemplate\": PublicOwnerStatementTemplate;\n \"public.ownerType\": PublicOwnerType;\n \"public.ownerUserAccess\": PublicOwnerUserAccess;\n \"public.ownerUserAccessRole\": PublicOwnerUserAccessRole;\n \"public.payment\": PublicPayment;\n \"public.paymentLine\": PublicPaymentLine;\n \"public.paymentLineClassification\": PublicPaymentLineClassification;\n \"public.paymentStatus\": PublicPaymentStatus;\n \"public.paymentType\": PublicPaymentType;\n \"public.recurringFee\": PublicRecurringFee;\n \"public.recurringFeeAccount\": PublicRecurringFeeAccount;\n \"public.recurringFeeAccountCondition\": PublicRecurringFeeAccountCondition;\n \"public.recurringFeeListingSubscription\": PublicRecurringFeeListingSubscription;\n \"public.recurringFeeListingSubscriptionRateType\": PublicRecurringFeeListingSubscriptionRateType;\n \"public.recurringFeeType\": PublicRecurringFeeType;\n \"public.reservation\": PublicReservation;\n \"public.reservationStatus\": PublicReservationStatus;\n \"public.reservationWithOccupancyStatus\": PublicReservationWithOccupancyStatus;\n \"public.setting\": PublicSetting;\n \"public.source\": PublicSource;\n \"public.task\": PublicTask;\n \"public.taxStatement\": PublicTaxStatement;\n \"public.taxStatementStatus\": PublicTaxStatementStatus;\n \"public.tenant\": PublicTenant;\n \"public.tenantUser\": PublicTenantUser;\n \"public.token\": PublicToken;\n \"public.user\": PublicUser;\n \"public.userCompanyType\": PublicUserCompanyType;\n \"public.userCompanyUser\": PublicUserCompanyUser;\n \"public.view\": PublicView;\n \"public.viewNotificationEvents\": PublicViewNotificationEvents;\n \"public.viewNotificationEventsGroupedByDate\": PublicViewNotificationEventsGroupedByDate;\n \"public.viewWebhookEvents\": PublicViewWebhookEvents;\n \"public.viewWebhookEventsGroupedByDate\": PublicViewWebhookEventsGroupedByDate;\n \"public.webhook\": PublicWebhook;\n \"tracking.event\": TrackingEvent;\n \"tracking.intercomConversation\": TrackingIntercomConversation;\n \"tracking.intercomConversationUser\": TrackingIntercomConversationUser;\n \"tracking.intercomReport\": TrackingIntercomReport;\n \"tracking.intercomReportConversation\": TrackingIntercomReportConversation;\n \"tracking.metricCache\": TrackingMetricCache;\n \"tracking.monitorConnection\": TrackingMonitorConnection;\n \"tracking.monitorConnectionState\": TrackingMonitorConnectionState;\n}\n"]}
1
+ {"version":3,"file":"v1.generated.js","sourceRoot":"src/","sources":["v1.generated.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file was generated by kysely-codegen.\n * Please do not edit it manually.\n */\n\nimport type { ColumnType } from \"kysely\";\n\nexport type AccountingJournalEntryInactiveReason = \"cancelledReservationLine\" | \"generalLedgerStartAt\" | \"inactiveAccount\" | \"listingInactive\" | \"nonPostingAccount\" | \"reservationGeneralLedgerStatusInactive\" | \"transactionInactive\" | \"unknownInactiveReason\";\n\nexport type AccountingJournalEntryLedger = \"historical\" | \"operating\" | \"trust\";\n\nexport type AccountingTransactionAttachmentStatus = \"attached\" | \"deleting\" | \"ready\" | \"uploading\";\n\nexport type AuditActionActorType = \"automation\" | \"sync\" | \"system\" | \"user\";\n\nexport type AuditEffectAttemptStatus = \"completed\" | \"failed\" | \"running\" | \"skipped_locked\";\n\nexport type AuditEffectStatus = \"claimed\" | \"completed\" | \"dead_letter\" | \"failed\" | \"pending\" | \"running\";\n\nexport type AuditJournalDeltaOperation = \"delete\" | \"insert\" | \"update\";\n\nexport type Generated<T> = T extends ColumnType<infer S, infer I, infer U>\n ? ColumnType<S, I | undefined, U>\n : ColumnType<T, T | undefined, T>;\n\nexport type Int8 = ColumnType<string, bigint | number | string, bigint | number | string>;\n\nexport type Json = JsonValue;\n\nexport type JsonArray = JsonValue[];\n\nexport type JsonObject = {\n [x: string]: JsonValue | undefined;\n};\n\nexport type JsonPrimitive = boolean | number | string | null;\n\nexport type JsonValue = JsonArray | JsonObject | JsonPrimitive;\n\nexport type Numeric = ColumnType<string, number | string, number | string>;\n\nexport type PublicFlowType = \"pull\" | \"push\";\n\nexport type PublicRecurringFeeConditionOperator = \"<\" | \"<=\" | \"=\" | \">\" | \">=\";\n\nexport type Timestamp = ColumnType<Date | string, Date | string, Date | string>;\n\nexport interface AccountingAccount {\n bankingCategory: string | null;\n bankingCurrency: string | null;\n bankingLast4: string | null;\n bankingType: string | null;\n categoryId: string;\n /**\n * deprecated\n */\n classification: string | null;\n createdAt: Generated<Timestamp | null>;\n id: Generated<string>;\n offsetAccountId: string | null;\n status: Generated<string>;\n tenantId: string | null;\n title: string;\n type: string;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface AccountingAccountAssignment {\n accountId: string | null;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n tenantId: string;\n type: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingAccountAssignmentLineType {\n accountAssignmentType: string;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n lineType: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingAccountAssignmentType {\n name: string;\n}\n\nexport interface AccountingAccountCategory {\n classification: string | null;\n id: Generated<string>;\n index: number;\n name: string;\n}\n\nexport interface AccountingAccountClassification {\n name: string;\n}\n\nexport interface AccountingAccountReservationLineType {\n accountId: string | null;\n bookingChannel: string | null;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n lineType: string;\n revenueRecognition: string | null;\n status: Generated<string | null>;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingAccountReservationRevRec {\n name: string;\n}\n\nexport interface AccountingAccountType {\n name: string;\n}\n\nexport interface AccountingBankAccount {\n accountId: string | null;\n category: Generated<string | null>;\n connectionId: string | null;\n createdAt: Generated<Timestamp>;\n currency: string | null;\n holderName: string | null;\n id: Generated<string>;\n lastDigits: string | null;\n name: string | null;\n sourceId: string | null;\n startDate: Timestamp | null;\n /**\n * The starting bank record for reconciliation\n */\n startingBankRecordId: string | null;\n status: Generated<string>;\n tenantId: string;\n type: Generated<string | null>;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingBankAccountCategory {\n name: string;\n}\n\nexport interface AccountingBankAccountType {\n name: string;\n}\n\nexport interface AccountingBankRecord {\n accountId: string | null;\n bankAccountId: string | null;\n calculatedCentBalance: number | null;\n calculatedCentTotalCorrection: number | null;\n centBalance: number | null;\n centTotal: number | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp>;\n date: Timestamp;\n description: string;\n id: Generated<string>;\n isBalanceAdjustment: Generated<boolean | null>;\n reconcileStatus: Generated<string>;\n sourceId: string | null;\n status: Generated<string>;\n tenantId: string;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingBankRecordTransactionPayment {\n bankRecordId: string;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n tenantId: string | null;\n transactionId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingBankRule {\n createdAt: Generated<Timestamp>;\n descriptionOverride: string | null;\n id: Generated<string>;\n matchMode: Generated<string>;\n mode: Generated<string>;\n name: string;\n priority: Generated<number>;\n status: Generated<string>;\n tenantId: string;\n transactionType: string;\n updatedAt: Generated<Timestamp>;\n usePriorMonthEnd: Generated<boolean>;\n vendorContactId: string | null;\n version: Generated<number>;\n}\n\nexport interface AccountingBankRuleAccount {\n accountId: string;\n bankRuleId: string;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingBankRuleApplication {\n bankRecordId: string;\n bankRuleId: string;\n createdAt: Generated<Timestamp>;\n createdTransactionId: string | null;\n errorMessage: string | null;\n id: Generated<string>;\n ruleVersion: number;\n status: string;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingBankRuleApplicationStatus {\n name: string;\n}\n\nexport interface AccountingBankRuleCondition {\n bankRuleId: string;\n centValue: number | null;\n conditionType: string;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n operator: string;\n sortOrder: number;\n tenantId: string;\n textValue: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingBankRuleLine {\n accountAssignmentType: string | null;\n accountId: string | null;\n bankRuleId: string;\n contactId: string | null;\n createdAt: Generated<Timestamp>;\n descriptionOverride: string | null;\n fixedCentAmount: number | null;\n id: Generated<string>;\n listingId: string | null;\n markupCentTotal: number | null;\n markupTaxBehavior: string | null;\n markupTaxRateId: string | null;\n party: string | null;\n percentageBps: number | null;\n sortOrder: number;\n splitMode: string;\n taxBehavior: string | null;\n taxRateId: string | null;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingBankRuleLineSplitMode {\n name: string;\n}\n\nexport interface AccountingBankRuleMatchOperator {\n name: string;\n}\n\nexport interface AccountingBankRuleMode {\n name: string;\n}\n\nexport interface AccountingContact {\n addressData: Json | null;\n /**\n * When NULL, the type is \"individual\"\n */\n companyType: string | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp>;\n defaultAccountId: string | null;\n email: string | null;\n firstName: string | null;\n id: Generated<string>;\n is1099PostalDelivery: Generated<boolean>;\n name: string;\n phone: string | null;\n /**\n * Human-readable system ID (CNT-XXX-XXXX-XXX).\n */\n shortRef: string | null;\n sourceId: string | null;\n status: string | null;\n taxId: string | null;\n tenantId: string;\n /**\n * owner OR vendor\n */\n type: string;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingContactCompanyType {\n name: string;\n}\n\nexport interface AccountingContactType {\n name: string;\n}\n\nexport interface AccountingJournalEntry {\n accountId: string | null;\n attachedToOwnerStatementId: string | null;\n centTotal: Int8;\n contactId: string | null;\n createdAt: Generated<Timestamp | null>;\n currency: string;\n description: string | null;\n entitySortNum: Generated<number | null>;\n entityType: string | null;\n id: Generated<string>;\n inactiveReason: AccountingJournalEntryInactiveReason | null;\n ledger: Generated<AccountingJournalEntryLedger>;\n lineId: string | null;\n lineUniqueRef: string | null;\n listingId: string | null;\n listingOwnershipPeriodId: string | null;\n party: string | null;\n recurringFeeId: string | null;\n recurringFeeListingSubscriptionId: string | null;\n reservationId: string | null;\n status: Generated<string>;\n tenantId: string | null;\n transactionId: string | null;\n transferOwnerStatementId: string | null;\n triggerId: string | null;\n triggerType: string | null;\n txnAt: Timestamp | null;\n txnCode: Generated<string | null>;\n txnNum: number | null;\n type: string | null;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface AccountingJournalEntryEntityType {\n name: string;\n}\n\nexport interface AccountingJournalEntryTriggerType {\n name: string;\n}\n\nexport interface AccountingJournalEntryType {\n name: string;\n}\n\nexport interface AccountingOwnerStatementProjection {\n listingId: string | null;\n listingOwnershipPeriodId: string | null;\n payload: Json;\n projectionKey: string;\n refreshedAt: Generated<Timestamp>;\n sourceRevision: Int8;\n tenantId: string;\n variant: string;\n}\n\nexport interface AccountingOwnerStatementProjectionRevision {\n revision: Generated<Int8>;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingPaidStatus {\n name: string;\n}\n\nexport interface AccountingParty {\n name: string;\n}\n\nexport interface AccountingRate {\n accountId: string | null;\n basisPoints: number;\n behavior: string | null;\n countryCode: string | null;\n createdAt: Generated<Timestamp>;\n currency: string | null;\n debitAccountId: string | null;\n description: string | null;\n id: Generated<string>;\n name: string | null;\n status: Generated<string | null>;\n tenantId: string;\n type: string | null;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingRateType {\n name: string;\n}\n\nexport interface AccountingTaxBehavior {\n name: string;\n}\n\nexport interface AccountingTransaction {\n accountId: string | null;\n centTotal: number;\n connectionId: string | null;\n contactId: string | null;\n createdAt: Generated<Timestamp>;\n currency: string;\n date: Timestamp;\n description: string;\n dueAt: Timestamp | null;\n id: Generated<string>;\n isOpeningBalance: Generated<boolean>;\n matchBankAccountLast4: string | null;\n matchLineTypeClassification: string | null;\n matchReservationConfirmationCode: string | null;\n matchReservationStripeGuestRef: string | null;\n matchStatus: Generated<string | null>;\n paidAt: Timestamp | null;\n paidStatus: Generated<string | null>;\n recurringFeeId: string | null;\n recurringPattern: Json | null;\n recurringTemplateId: string | null;\n /**\n * Human-readable system ID (EXP/DEP/PAY/TRF-XXX-XXXX-XXX depending on transaction.type).\n */\n shortRef: string | null;\n sourceId: string | null;\n status: Generated<string>;\n tenantId: string;\n type: string;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingTransactionAttachment {\n byteSize: number;\n contentType: string;\n createdAt: Generated<Timestamp>;\n expiresAt: Timestamp | null;\n extension: string | null;\n filename: string;\n id: Generated<string>;\n isOwnerAccessible: Generated<boolean>;\n r2Key: string;\n status: Generated<AccountingTransactionAttachmentStatus>;\n tenantId: string;\n transactionId: string | null;\n updatedAt: Generated<Timestamp>;\n uploadedAt: Timestamp | null;\n}\n\nexport interface AccountingTransactionLine {\n accountAssignmentType: string | null;\n accountId: string | null;\n appliedAmountTaxBehavior: string | null;\n appliedAmountTaxRateId: string | null;\n centTotal: number;\n contactId: string | null;\n createdAt: Generated<Timestamp>;\n description: string;\n id: Generated<string>;\n listingId: string | null;\n markupCentTotal: number | null;\n markupTaxBehavior: string | null;\n markupTaxRateId: string | null;\n matchLineTypeClassification: string | null;\n matchReservationConfirmationCode: string | null;\n matchReservationStripeGuestRef: string | null;\n matchStatus: Generated<string | null>;\n ownerStatementId: string | null;\n party: string | null;\n reservationId: string | null;\n tenantId: string;\n transactionId: string;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface AccountingTransactionType {\n name: string;\n}\n\nexport interface AuditAction {\n actionType: string;\n actorId: string | null;\n actorType: AuditActionActorType;\n apiVersion: string;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n message: string | null;\n parentActionId: string | null;\n payload: Json | null;\n requestId: string | null;\n rootEntityId: string | null;\n rootEntityType: string | null;\n source: string | null;\n tenantId: string;\n traceId: string | null;\n}\n\nexport interface AuditEffect {\n actionId: string;\n claimedAt: Timestamp | null;\n claimedBy: string | null;\n completedAt: Timestamp | null;\n createdAt: Generated<Timestamp>;\n effectType: string;\n entityId: string | null;\n entityType: string | null;\n id: Generated<string>;\n lastAttemptAt: Timestamp | null;\n lastError: string | null;\n maxRetries: Generated<number>;\n payload: Generated<Json>;\n priority: Generated<number>;\n retryCount: Generated<number>;\n rootEntityId: string | null;\n rootEntityType: string | null;\n status: AuditEffectStatus;\n tenantId: string;\n}\n\nexport interface AuditEffectAttempt {\n actionId: string;\n attemptNum: number;\n effectId: string;\n errorData: Json | null;\n errorMessage: string | null;\n finishedAt: Timestamp | null;\n id: Generated<string>;\n resultCategory: string | null;\n resultCode: string | null;\n retryable: boolean | null;\n startedAt: Generated<Timestamp>;\n status: AuditEffectAttemptStatus;\n tenantId: string;\n workerId: string | null;\n}\n\nexport interface AuditJournalDelta {\n accountIdAfter: string | null;\n accountIdBefore: string | null;\n actionId: string;\n apiVersion: string;\n attachedToOwnerStatementIdAfter: string | null;\n attachedToOwnerStatementIdBefore: string | null;\n centTotalAfter: Int8 | null;\n centTotalBefore: Int8 | null;\n changedAt: Generated<Timestamp>;\n changedFields: Generated<string[]>;\n diffJson: Json | null;\n effectId: string | null;\n id: Generated<string>;\n journalEntryId: string;\n listingOwnershipPeriodIdAfter: string | null;\n listingOwnershipPeriodIdBefore: string | null;\n mutationId: string | null;\n operation: AuditJournalDeltaOperation;\n partyAfter: string | null;\n partyBefore: string | null;\n rootEntityId: string | null;\n rootEntityType: string | null;\n statusAfter: string | null;\n statusBefore: string | null;\n tenantId: string;\n txnAtAfter: Timestamp | null;\n txnAtBefore: Timestamp | null;\n}\n\nexport interface AuditMutation {\n actionId: string;\n changeRecord: Json;\n createdAt: Generated<Timestamp>;\n effectId: string | null;\n id: Generated<string>;\n op: string;\n rootEntityId: string | null;\n rootEntityType: string | null;\n subjectId: string;\n subjectType: string;\n tenantId: string;\n}\n\nexport interface CoreActiveStatus {\n name: string;\n}\n\nexport interface CoreChange {\n automationId: string | null;\n changeData: Json | null;\n changeFields: Generated<Json | null>;\n changeType: string | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp>;\n dataSha256: string | null;\n entityId: string;\n entityType: string;\n entityUniqueRef: string | null;\n id: Generated<string>;\n isLatestVersion: Generated<boolean | null>;\n message: string | null;\n seq: Int8 | null;\n status: string | null;\n syncId: string | null;\n syncSubtaskId: string | null;\n syncType: string | null;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n version: Numeric;\n}\n\nexport interface CoreChangeEntityType {\n name: string;\n}\n\nexport interface CoreChangeLink {\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n leftChangeId: string;\n rightChangeId: string;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface CoreChangeSourceLink {\n changeId: string;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n sourceId: string;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface CoreChangeStatus {\n name: string;\n}\n\nexport interface CoreChangeSyncType {\n name: string;\n}\n\nexport interface CoreChangeType {\n name: string;\n}\n\nexport interface CoreFlow {\n appId: string;\n description: string | null;\n id: Generated<string>;\n isPublic: Generated<boolean>;\n leftType: string | null;\n mappingSchema: Json;\n rightType: string | null;\n runSchema: Generated<Json>;\n settingSchema: Json;\n title: string;\n type: Generated<PublicFlowType | null>;\n uniqueRef: string;\n useGlobalMapping: Generated<boolean>;\n}\n\nexport interface CoreFlowMapping {\n accountId: string | null;\n bookingChannelId: string | null;\n connectionId: string;\n contactId: string | null;\n createdAt: Generated<Timestamp>;\n flowId: string | null;\n id: Generated<string>;\n listingId: string | null;\n mappingKey: string;\n rateId: string | null;\n sourceId: string;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n value: Json | null;\n}\n\nexport interface CoreFlowSetting {\n accountId: string | null;\n bookingChannelId: string | null;\n connectionId: string;\n contactId: string | null;\n createdAt: Generated<Timestamp>;\n flowId: string;\n id: Generated<string>;\n listingId: string | null;\n rateId: string | null;\n settingKey: string;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n value: Json | null;\n}\n\nexport interface CoreIssueMessageOverwrite {\n createdAt: Generated<Timestamp | null>;\n id: Generated<string>;\n message: string;\n pattern: string;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface CoreSync {\n automationId: string | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp>;\n environment: string | null;\n id: Generated<string>;\n isCurrentOnAutomation: Generated<boolean | null>;\n isCurrentOnConnection: Generated<boolean>;\n message: string | null;\n params: Generated<Json>;\n status: string;\n syncedAt: Timestamp | null;\n tenantId: string;\n triggerRef: string | null;\n type: string;\n updatedAt: Generated<Timestamp>;\n userId: string | null;\n}\n\nexport interface CoreSyncStatus {\n name: string;\n}\n\nexport interface CoreSyncSubtask {\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n message: string | null;\n params: Generated<Json | null>;\n status: Generated<string>;\n syncId: string;\n tenantId: string;\n triggerRef: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface CoreSyncType {\n name: string;\n}\n\nexport interface HdbCatalogEventInvocationLogs {\n createdAt: Generated<Timestamp | null>;\n eventId: string | null;\n id: Generated<string>;\n request: Json | null;\n response: Json | null;\n status: number | null;\n triggerName: string | null;\n}\n\nexport interface HdbCatalogEventLog {\n archived: Generated<boolean>;\n createdAt: Generated<Timestamp | null>;\n delivered: Generated<boolean>;\n error: Generated<boolean>;\n id: Generated<string>;\n locked: Timestamp | null;\n nextRetryAt: Timestamp | null;\n payload: Json;\n schemaName: string;\n tableName: string;\n tries: Generated<number>;\n triggerName: string;\n}\n\nexport interface HdbCatalogHdbActionLog {\n actionName: string | null;\n createdAt: Generated<Timestamp>;\n errors: Json | null;\n id: Generated<string>;\n inputPayload: Json;\n requestHeaders: Json;\n responsePayload: Json | null;\n responseReceivedAt: Timestamp | null;\n sessionVariables: Json;\n status: string;\n}\n\nexport interface HdbCatalogHdbCronEventInvocationLogs {\n createdAt: Generated<Timestamp | null>;\n eventId: string | null;\n id: Generated<string>;\n request: Json | null;\n response: Json | null;\n status: number | null;\n}\n\nexport interface HdbCatalogHdbCronEvents {\n createdAt: Generated<Timestamp | null>;\n id: Generated<string>;\n nextRetryAt: Timestamp | null;\n scheduledTime: Timestamp;\n status: Generated<string>;\n tries: Generated<number>;\n triggerName: string;\n}\n\nexport interface HdbCatalogHdbEventLogCleanups {\n deletedEventInvocationLogs: number | null;\n deletedEventLogs: number | null;\n id: Generated<string>;\n scheduledAt: Timestamp;\n status: string;\n triggerName: string;\n}\n\nexport interface HdbCatalogHdbMetadata {\n id: number;\n metadata: Json;\n resourceVersion: Generated<number>;\n}\n\nexport interface HdbCatalogHdbScheduledEventInvocationLogs {\n createdAt: Generated<Timestamp | null>;\n eventId: string | null;\n id: Generated<string>;\n request: Json | null;\n response: Json | null;\n status: number | null;\n}\n\nexport interface HdbCatalogHdbScheduledEvents {\n comment: string | null;\n createdAt: Generated<Timestamp | null>;\n headerConf: Json | null;\n id: Generated<string>;\n nextRetryAt: Timestamp | null;\n payload: Json | null;\n retryConf: Json | null;\n scheduledTime: Timestamp;\n status: Generated<string>;\n tries: Generated<number>;\n webhookConf: Json;\n}\n\nexport interface HdbCatalogHdbSchemaNotifications {\n id: number;\n instanceId: string;\n notification: Json;\n resourceVersion: Generated<number>;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface HdbCatalogHdbSourceCatalogVersion {\n upgradedOn: Timestamp;\n version: string;\n}\n\nexport interface HdbCatalogHdbVersion {\n cliState: Generated<Json>;\n consoleState: Generated<Json>;\n eeClientId: string | null;\n eeClientSecret: string | null;\n hasuraUuid: Generated<string>;\n upgradedOn: Timestamp;\n version: string;\n}\n\nexport interface PublicAccountCollection {\n automationId: string | null;\n connectionId: string;\n createdAt: Generated<Timestamp | null>;\n id: Generated<string>;\n name: string;\n tenantId: string;\n type: Generated<string | null>;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface PublicAccountCollectionType {\n name: string;\n}\n\nexport interface PublicAddress {\n city: string | null;\n country: string | null;\n countryCode: string | null;\n createdAt: Generated<Timestamp>;\n full: string | null;\n id: Generated<string>;\n lastValidated: Timestamp | null;\n line: string | null;\n lineDetails: string | null;\n postalCode: string | null;\n state: string | null;\n stateCode: string | null;\n tenantId: string | null;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicApp {\n authentication: Generated<Json>;\n category: string | null;\n color: string | null;\n createdAt: Generated<Timestamp>;\n icon: string | null;\n iconRound: string | null;\n id: Generated<string>;\n info: Json | null;\n name: string;\n type: string;\n version: Generated<number>;\n}\n\nexport interface PublicAuditLog {\n actorUserId: string | null;\n automationId: string | null;\n connectionId: string | null;\n contactId: string | null;\n createdAt: Generated<Timestamp>;\n deltaJson: Json | null;\n id: Generated<string>;\n listingCollectionId: string | null;\n listingId: string | null;\n objectId: string | null;\n op: string;\n ownerId: string | null;\n ownerStatementId: string | null;\n ownerStatementLayoutId: string | null;\n tableName: string;\n taxStatementId: string | null;\n tenantId: string | null;\n userId: string | null;\n}\n\nexport interface PublicAutomation {\n connectionId: string | null;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n leftConnectionId: string | null;\n rightConnectionId: string | null;\n runSettings: Json | null;\n scheduleStatus: Generated<string | null>;\n status: Generated<string>;\n template: string | null;\n templateId: string | null;\n tenantId: string;\n title: string | null;\n triggerDevTaskOverwrite: string | null;\n updatedAt: Generated<Timestamp>;\n viewSettings: Json | null;\n}\n\nexport interface PublicAutomationTemplate {\n /**\n * determines whether this automation allows a team to configure multiple versions of this with the same leftConnection rightConnection combination\n */\n allowMultiple: boolean | null;\n appId: string | null;\n createdAt: Generated<Timestamp | null>;\n description: string;\n endpoint: string;\n id: Generated<string>;\n input: string;\n label: string | null;\n leftAppId: string | null;\n mappings: Json | null;\n name: string | null;\n params: Generated<Json | null>;\n preview: Json | null;\n rightAppId: string | null;\n settings: Json | null;\n stripePriceRef: string | null;\n title: string | null;\n triggerDevTask: string | null;\n triggers: Generated<Json | null>;\n type: string | null;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp | null>;\n version: string | null;\n visibility: string | null;\n}\n\nexport interface PublicBillingPaymentMethodType {\n name: string;\n}\n\nexport interface PublicBookingChannel {\n channelRef: string | null;\n color: string | null;\n createdAt: Generated<Timestamp>;\n icon: string | null;\n iconProvider: string | null;\n id: Generated<string>;\n lastGenerateRun: Timestamp | null;\n selectedBookingChannelIconCandidateId: string | null;\n uniqueRef: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicBookingChannelIconCandidate {\n bookingChannelId: string;\n cloudflareImageId: string | null;\n color: string | null;\n comment: string | null;\n createdAt: Generated<Timestamp>;\n externalIcon: string | null;\n id: Generated<string>;\n provider: Generated<string>;\n source: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicConnection {\n appId: string;\n backendVersion: number | null;\n createdAt: Generated<Timestamp>;\n credentials: Generated<Json | null>;\n disabled: Generated<boolean | null>;\n fetchNext: Generated<Timestamp | null>;\n fetchStatus: Generated<string>;\n icon: string | null;\n id: Generated<string>;\n lastFetch: Timestamp | null;\n metadata: Json | null;\n name: string;\n persistentState: Generated<Json | null>;\n status: Generated<string | null>;\n tenantId: string;\n type: string | null;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp | null>;\n version: number | null;\n}\n\nexport interface PublicCurrency {\n name: string;\n}\n\nexport interface PublicDuplicateEmails {\n count: Int8 | null;\n email: string | null;\n id: string | null;\n}\n\nexport interface PublicEmailTemplate {\n createdAt: Generated<Timestamp>;\n dataJson: Json;\n id: Generated<string>;\n tenantId: string;\n type: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicEmailTemplateType {\n name: string;\n}\n\nexport interface PublicFeature {\n createdAt: Generated<Timestamp>;\n description: string | null;\n id: Generated<string>;\n issueUrl: string | null;\n /**\n * user ids of user needed to approve this feature\n */\n requiredApprovals: Generated<Json | null>;\n status: Generated<string | null>;\n tenantId: string | null;\n title: string;\n updatedAt: Generated<Timestamp>;\n url: string | null;\n}\n\nexport interface PublicFeatureApproval {\n createdAt: Generated<Timestamp>;\n featureId: string;\n id: Generated<string>;\n status: Generated<string | null>;\n updatedAt: Generated<Timestamp>;\n userId: string;\n}\n\nexport interface PublicFeatureApprovalStatus {\n name: string;\n}\n\nexport interface PublicFeatureEnabledTeam {\n createdAt: Generated<Timestamp>;\n featureId: string;\n id: Generated<string>;\n status: Generated<string | null>;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicFeatureStatus {\n name: string;\n}\n\nexport interface PublicFileStorage {\n connectionId: string | null;\n contactId: string | null;\n createdAt: Generated<Timestamp>;\n endDate: Timestamp | null;\n extension: string | null;\n filename: string;\n fileUri: string | null;\n id: Generated<string>;\n metadata: Json | null;\n newOwnerId: string | null;\n ownerUserId: string | null;\n reservationId: string | null;\n rowDateField: string | null;\n startDate: Timestamp | null;\n status: string | null;\n tenantId: string;\n type: string;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicFileStorageSourceLink {\n createdAt: Generated<Timestamp>;\n fileStorageId: string;\n id: Generated<string>;\n sourceId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicFileStorageTag {\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n tenantId: string;\n title: string;\n uniqueRef: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicLatestDuplicateEmails {\n createdAt: Timestamp | null;\n email: string | null;\n id: string | null;\n name: string | null;\n status: string | null;\n}\n\nexport interface PublicListing {\n address: string | null;\n addressCity: string | null;\n addressCountry: string | null;\n addressData: Json | null;\n addressId: string | null;\n addressState: string | null;\n bedrooms: number | null;\n beds: number | null;\n calculatedStatus: Generated<string | null>;\n calculatedTitle: Generated<string | null>;\n calculatedTitleNew: Generated<string | null>;\n centExpenseReserve: number | null;\n /**\n * Starting balance for tax statements\n */\n centTaxStartingBalance: number | null;\n collectionId: string | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp | null>;\n customCode: string | null;\n defaultCurrency: string | null;\n id: Generated<string>;\n imageUri: string | null;\n metadata: Generated<Json | null>;\n name: string | null;\n ownerContactId: string | null;\n pmsAddressData: Json | null;\n pmsStatus: string | null;\n /**\n * Human-readable system ID (LST-XXX-XXXX-XXX).\n */\n shortRef: string | null;\n sourceId: string | null;\n status: string | null;\n tenantId: string;\n title: string | null;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface PublicListingCollection {\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n name: string;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicListingConnection {\n address: string | null;\n bedrooms: number | null;\n beds: number | null;\n connectionId: string;\n createdAt: Generated<Timestamp | null>;\n groupKey: string | null;\n id: Generated<string>;\n listingId: string | null;\n metadata: Json | null;\n name: string | null;\n nickname: string | null;\n sourceId: string | null;\n status: string | null;\n tenantId: string | null;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface PublicListingOwner {\n createdAt: Generated<Timestamp | null>;\n id: Generated<string>;\n listingId: string;\n newOwnerId: string | null;\n ownerId: string | null;\n role: Generated<string>;\n split: Numeric | null;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface PublicListingOwnerRole {\n name: string;\n}\n\nexport interface PublicListingOwnershipPeriod {\n businessModel: Generated<string | null>;\n createdAt: Generated<Timestamp>;\n endAt: Timestamp | null;\n id: Generated<string>;\n listingId: string;\n reserveCentTotal: Generated<Int8>;\n setListingInactive: Generated<boolean | null>;\n startAt: Generated<Timestamp | null>;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicListingOwnershipPeriodBusinessModel {\n name: string;\n}\n\nexport interface PublicListingOwnershipPeriodMember {\n contactId: string | null;\n createdAt: Generated<Timestamp | null>;\n id: Generated<string>;\n ownerId: string | null;\n periodId: string;\n split: number;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface PublicOwner {\n addressId: string | null;\n companyType: string | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp>;\n email: string | null;\n firstName: string | null;\n id: Generated<string>;\n is1099PostalDelivery: Generated<boolean>;\n /**\n * Lastname or company name\n */\n name: string;\n phone: string | null;\n sourceId: string | null;\n status: Generated<string | null>;\n taxId: string | null;\n tenantId: string;\n type: string;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicOwnerStatement {\n automationId: string | null;\n centBalanceEnd: Int8 | null;\n centBalanceStart: Int8 | null;\n centExpenses: Int8 | null;\n centNetRevenue: Int8 | null;\n centPayedOut: number | null;\n centRentalRevenue: number | null;\n centTotal: Int8 | null;\n centTransfer: Int8 | null;\n createdAt: Generated<Timestamp>;\n currency: string | null;\n endAt: Timestamp;\n id: Generated<string>;\n layoutId: string | null;\n listingId: string | null;\n listingOwnershipPeriodId: string | null;\n metadata: Json | null;\n ownerId: string | null;\n party: Generated<string | null>;\n previousOwnerStatementId: string | null;\n sourceId: string | null;\n startAt: Timestamp;\n status: Generated<string>;\n templateId: string | null;\n templateJson: Json | null;\n tenantId: string;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicOwnerStatementLayout {\n automationId: string | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp>;\n dataJson: Json;\n id: Generated<string>;\n isDefault: Generated<boolean | null>;\n tenantId: string;\n title: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicOwnerStatementLayoutAccount {\n accountId: string;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n layoutId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicOwnerStatementLayoutListing {\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n layoutId: string;\n listingId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicOwnerStatementLine {\n centTotal: number;\n createdAt: Generated<Timestamp>;\n currency: string | null;\n customDescription: string | null;\n date: Timestamp | null;\n description: string | null;\n externalLink: string | null;\n groupId: string | null;\n id: Generated<string>;\n isOwnerPayout: Generated<boolean | null>;\n metadata: Json | null;\n ownerStatementId: string;\n reservationId: string | null;\n role: Generated<string | null>;\n sourceId: string | null;\n tenantId: string;\n uniqueRef: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicOwnerStatementOwner {\n createdAt: Generated<Timestamp | null>;\n id: Generated<string>;\n newOwnerId: string | null;\n ownerId: string | null;\n role: string;\n split: Numeric | null;\n statementId: string;\n updatedAt: Generated<Timestamp | null>;\n /**\n * The source id to the listing owner vendor\n */\n vendorSourceId: string | null;\n}\n\nexport interface PublicOwnerStatementStatus {\n name: string;\n}\n\nexport interface PublicOwnerStatementTemplate {\n balanceStartAt: Timestamp | null;\n billingAccountId: string | null;\n createdAt: Generated<Timestamp>;\n data: Json;\n id: Generated<string>;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n version: Generated<number | null>;\n}\n\nexport interface PublicOwnerType {\n name: string;\n}\n\nexport interface PublicOwnerUserAccess {\n contactId: string | null;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n ownerId: string | null;\n role: Generated<string>;\n updatedAt: Generated<Timestamp>;\n userId: string;\n}\n\nexport interface PublicOwnerUserAccessRole {\n name: string;\n}\n\nexport interface PublicPayment {\n bankAccountDigits: string | null;\n centTotal: Generated<Int8 | null>;\n connectionId: string | null;\n createdAt: Generated<Timestamp | null>;\n currency: string | null;\n description: string | null;\n etaAt: Timestamp | null;\n id: Generated<string>;\n isReconciled: Generated<boolean | null>;\n issues: Json | null;\n metadata: Generated<Json | null>;\n payedAt: Timestamp | null;\n paymentMethod: string | null;\n sourceId: string | null;\n status: string | null;\n tenantId: string | null;\n type: string | null;\n uniqueRef: string | null;\n uniqueRefAir: string | null;\n uniqueRefTemp: string | null;\n updatedAt: Generated<Timestamp | null>;\n userdata: Generated<Json | null>;\n}\n\nexport interface PublicPaymentLine {\n accountId: string | null;\n centTotal: Int8 | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp>;\n description: string | null;\n editedType: string | null;\n effectiveType: Generated<string | null>;\n generalLedgerPostingAt: Timestamp | null;\n id: Generated<string>;\n lineId: string | null;\n listingId: string | null;\n matchReservationConfirmationCode: string | null;\n matchReservationStripeGuestRef: string | null;\n matchStatus: Generated<string | null>;\n metadata: Json | null;\n originCentTotal: Int8 | null;\n originCurrency: string | null;\n originExchangeRate: Numeric | null;\n party: string | null;\n paymentId: string | null;\n recurringFeeId: string | null;\n reservationId: string | null;\n skipReconcile: Generated<boolean | null>;\n tenantId: string | null;\n type: string | null;\n type2: string | null;\n uniqueRef: string | null;\n uniqueRef2: string | null;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface PublicPaymentLineClassification {\n appId: string | null;\n createdAt: Generated<Timestamp | null>;\n id: Generated<string | null>;\n name: string;\n type: string | null;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface PublicPaymentStatus {\n name: string;\n}\n\nexport interface PublicPaymentType {\n name: string;\n}\n\nexport interface PublicRecurringFee {\n bookingChannelsFilter: string[] | null;\n createdAt: Generated<Timestamp>;\n creditAccountId: string | null;\n creditParty: Generated<string>;\n debitAccountId: string | null;\n debitParty: Generated<string>;\n defaultRate: number | null;\n formula: string | null;\n icon: string | null;\n id: Generated<string>;\n rateType: Generated<string | null>;\n revenueRecognition: string | null;\n status: Generated<string>;\n statusFilter: string | null;\n taxBehavior: string | null;\n taxRateId: string | null;\n tenantId: string;\n title: string;\n type: Generated<string>;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicRecurringFeeAccount {\n accountId: string;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n recurringFeeId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicRecurringFeeAccountCondition {\n accountId: string;\n centValue: Int8;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n operator: PublicRecurringFeeConditionOperator;\n recurringFeeId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicRecurringFeeListingSubscription {\n createdAt: Generated<Timestamp>;\n endAt: Timestamp | null;\n id: Generated<string>;\n listingId: string;\n rate: number | null;\n rateType: Generated<string | null>;\n recurringFeeId: string;\n startAt: Generated<Timestamp | null>;\n status: Generated<string>;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicRecurringFeeListingSubscriptionRateType {\n name: string;\n}\n\nexport interface PublicRecurringFeeType {\n name: string;\n}\n\nexport interface PublicReservation {\n bookedAt: Generated<Timestamp | null>;\n bookerName: string | null;\n bookingPlatform: string | null;\n calculatedDeduplicationRef: Generated<string | null>;\n cancelledAt: Timestamp | null;\n centAccommodation: number | null;\n centAdjustment: number | null;\n centCancellation: number | null;\n centCityTax: number | null;\n centCleaning: Int8 | null;\n centOta: number | null;\n centPaid: Int8 | null;\n centPaymentFee: number | null;\n centService: number | null;\n centTotal: Generated<Int8 | null>;\n channelId: string | null;\n checkIn: Timestamp | null;\n checkOut: Timestamp | null;\n confirmationCode: string | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp | null>;\n currency: string | null;\n editedCheckIn: Timestamp | null;\n editedCheckOut: Timestamp | null;\n effectiveCheckIn: Generated<Timestamp | null>;\n effectiveCheckOut: Generated<Timestamp | null>;\n effectiveNights: Generated<number | null>;\n generalLedgerPostingAt: Timestamp | null;\n generalLedgerStatus: Generated<string>;\n guestName: string | null;\n guests: number | null;\n id: Generated<string>;\n lineMap: Json | null;\n listingConnectionId: string | null;\n listingId: string | null;\n managerCentTotal: Int8 | null;\n matchPaymentCustomerRef: string | null;\n metadata: Json | null;\n nights: number | null;\n otaReservationId: string | null;\n ownersCentTotal: Int8 | null;\n paidStatus: string | null;\n paymentMethod: string | null;\n pmsReferenceCode: string | null;\n /**\n * Human-readable system ID (RES-XXX-XXXX-XXX).\n */\n shortRef: string | null;\n sourceId: string | null;\n status: Generated<string | null>;\n taxCentTotal: Int8 | null;\n tenantId: string | null;\n uniqueRef: string | null;\n uniqueRef2: string | null;\n updatedAt: Generated<Timestamp | null>;\n userdata: Generated<Json | null>;\n}\n\nexport interface PublicReservationStatus {\n name: string;\n}\n\nexport interface PublicReservationWithOccupancyStatus {\n bookedAt: Timestamp | null;\n bookerName: string | null;\n bookingPlatform: string | null;\n cancelledAt: Timestamp | null;\n centAccommodation: number | null;\n centAdjustment: number | null;\n centCancellation: number | null;\n centCityTax: number | null;\n centCleaning: Int8 | null;\n centOta: number | null;\n centPaid: Int8 | null;\n centPaymentFee: number | null;\n centService: number | null;\n centTotal: Int8 | null;\n channelId: string | null;\n checkIn: Timestamp | null;\n checkOut: Timestamp | null;\n confirmationCode: string | null;\n connectionId: string | null;\n createdAt: Timestamp | null;\n currency: string | null;\n guestName: string | null;\n guests: number | null;\n id: string | null;\n lineMap: Json | null;\n listingConnectionId: string | null;\n listingId: string | null;\n metadata: Json | null;\n nights: number | null;\n occupancyStatus: string | null;\n otaReservationId: string | null;\n paidStatus: string | null;\n paymentMethod: string | null;\n pmsReferenceCode: string | null;\n sourceId: string | null;\n status: string | null;\n tenantId: string | null;\n uniqueRef: string | null;\n uniqueRef2: string | null;\n updatedAt: Timestamp | null;\n userdata: Json | null;\n}\n\nexport interface PublicSetting {\n automationId: string | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp>;\n group: string | null;\n id: Generated<string>;\n key: string;\n leftConnectionId: string | null;\n leftId: Generated<string | null>;\n leftType: string | null;\n lineClassification: string | null;\n listingId: string | null;\n localAutomationId: string | null;\n parentSettingId: string | null;\n partner: string | null;\n rightConnectionId: string | null;\n rightId: Generated<string | null>;\n rightType: string | null;\n sourceId: string | null;\n status: Generated<string | null>;\n target: string;\n targetUuid: Generated<string | null>;\n tenantId: string | null;\n updatedAt: Generated<Timestamp>;\n value: string | null;\n}\n\nexport interface PublicSource {\n /**\n * deprecated\n */\n appId: string | null;\n code: string | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp>;\n dataHref: string | null;\n date: Timestamp | null;\n description: string | null;\n id: Generated<string>;\n indexedJson: Json | null;\n isArchived: Generated<boolean | null>;\n json: Json | null;\n lastWebhookAt: Timestamp | null;\n /**\n * deprecated\n */\n listingConnectionId: string | null;\n /**\n * deprecated\n */\n listingId: string | null;\n modifiedAt: Timestamp | null;\n parentId: string | null;\n remoteId: string | null;\n reservationId: string | null;\n status: Generated<string | null>;\n tenantId: string;\n transformJson: Json | null;\n transformType: string | null;\n type: string;\n updatedAt: Generated<Timestamp | null>;\n version: Generated<number | null>;\n}\n\nexport interface PublicTask {\n createdAt: Generated<Timestamp | null>;\n id: Generated<string>;\n message: string | null;\n status: string | null;\n}\n\nexport interface PublicTaxStatement {\n centRentalRevenue: number | null;\n createdAt: Generated<Timestamp>;\n endAt: Timestamp | null;\n error: string | null;\n id: Generated<string>;\n metadata: Json | null;\n ownerId: string | null;\n startAt: Timestamp | null;\n status: Generated<string>;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n url: string | null;\n userId: string | null;\n year: number;\n}\n\nexport interface PublicTaxStatementStatus {\n name: string;\n}\n\nexport interface PublicTenant {\n address: string | null;\n addressCity: string | null;\n addressCountry: string | null;\n addressLine1: string | null;\n addressPostcode: string | null;\n billingAddressData: Json | null;\n billingAddressId: string | null;\n billingCustomerId: string | null;\n billingPartnerId: string | null;\n billingPaymentMethodType: string | null;\n billingPlan: string | null;\n billingSubscriptionStatus: string | null;\n booksClosedAt: Timestamp | null;\n calculatedBillingPartnerId: Generated<string | null>;\n calculatedIsBillable: Generated<boolean | null>;\n calculatedStatus: Generated<string | null>;\n /**\n * Billing subscription is getting cancelled at date\n */\n cancelledAt: Timestamp | null;\n chartOfAccountTenantId: string | null;\n clerkId: string | null;\n colorPrimary: string | null;\n commissionPercentage: Numeric | null;\n companyName: string | null;\n companyTaxCode: string | null;\n createdAt: Generated<Timestamp>;\n defaultCurrency: string | null;\n defaultRevenueRecognition: string | null;\n email: string | null;\n featureFlags: Generated<Json | null>;\n historicalStatementsImportedAt: Timestamp | null;\n id: Generated<string>;\n intercomId: string | null;\n isActive: Generated<boolean | null>;\n isGeneralLedger: Generated<boolean | null>;\n isOnboarding: Generated<boolean | null>;\n isTest: Generated<boolean | null>;\n logo: string | null;\n longTermStayNights: number | null;\n migratedFromTenantId: string | null;\n name: string;\n ownerPortalShowDraftStatements: boolean | null;\n partnerId: Generated<string | null>;\n /**\n * JSON column to hold team settings like \"owner_portal_show_reservation_totals\" or \"owner_portal_show_draft_statements\n */\n settingsData: Json | null;\n setup: Json | null;\n setupCompleted: Generated<boolean | null>;\n statementAddressData: Json | null;\n statementAddressId: string | null;\n statementStartAt: Timestamp | null;\n status: Generated<string | null>;\n stripeId: string | null;\n stripeSubscriptionItemId: string | null;\n supportEmail: string | null;\n supportPhone: string | null;\n svixEndpoints: boolean | null;\n trialUntil: Timestamp | null;\n type: Generated<string | null>;\n updatedAt: Generated<Timestamp | null>;\n website: string | null;\n}\n\nexport interface PublicTenantUser {\n createdAt: Generated<Timestamp | null>;\n id: Generated<string>;\n lastInvitedAt: Timestamp | null;\n notificationPreferences: Generated<Json | null>;\n role: Generated<string | null>;\n status: Generated<string | null>;\n tenantId: string;\n updatedAt: Generated<Timestamp | null>;\n userId: string;\n}\n\nexport interface PublicToken {\n createdAt: Generated<Timestamp>;\n expiresAt: Timestamp | null;\n id: Generated<string>;\n nanoId: Generated<string>;\n payload: Generated<Json>;\n tenantId: string | null;\n type: string | null;\n userId: string | null;\n}\n\nexport interface PublicUser {\n address: string | null;\n addressCity: string | null;\n addressCountry: string | null;\n addressId: string | null;\n addressLine1: string | null;\n addressPostcode: string | null;\n clerkId: string | null;\n companyName: string | null;\n companyType: string | null;\n createdAt: Generated<Timestamp | null>;\n email: string | null;\n firstName: string | null;\n id: Generated<string>;\n isAdmin: Generated<boolean>;\n lastName: string | null;\n lastSeen: Timestamp | null;\n name: string | null;\n notificationPreferences: Generated<Json | null>;\n partnerId: string | null;\n password: string | null;\n phone: string | null;\n secondaryEmails: Generated<Json | null>;\n status: Generated<string | null>;\n sub: string | null;\n taxId: string | null;\n trialExpiryAt: Timestamp | null;\n type: Generated<string | null>;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface PublicUserCompanyType {\n name: string;\n}\n\nexport interface PublicUserCompanyUser {\n companyUserId: string;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n updatedAt: Generated<Timestamp>;\n userId: string;\n}\n\nexport interface PublicView {\n group: string | null;\n icon: string | null;\n id: Generated<string>;\n isDefault: Generated<boolean | null>;\n retoolViewId: string | null;\n sortOrder: Generated<number | null>;\n stateData: Json | null;\n tenantId: string | null;\n title: string;\n type: string | null;\n}\n\nexport interface PublicViewNotificationEvents {\n createdAt: Timestamp | null;\n eventId: string | null;\n id: string | null;\n request: Json | null;\n response: Json | null;\n status: number | null;\n triggerName: string | null;\n}\n\nexport interface PublicViewNotificationEventsGroupedByDate {\n count: Int8 | null;\n dateTrunc: Timestamp | null;\n status: number | null;\n triggerName: string | null;\n}\n\nexport interface PublicViewWebhookEvents {\n createdAt: Timestamp | null;\n eventId: string | null;\n id: string | null;\n request: Json | null;\n response: Json | null;\n status: number | null;\n triggerName: string | null;\n}\n\nexport interface PublicViewWebhookEventsGroupedByDate {\n count: Int8 | null;\n dateTrunc: Timestamp | null;\n status: number | null;\n triggerName: string | null;\n}\n\nexport interface PublicWebhook {\n createdAt: Generated<Timestamp>;\n headers: Json | null;\n id: Generated<string>;\n tenantId: string | null;\n types: Generated<Json>;\n types2: string[] | null;\n url: string;\n}\n\nexport interface TrackingEvent {\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n name: string;\n packageName: string;\n props: Json;\n tenantId: string | null;\n timestamp: Generated<Timestamp | null>;\n trackedAt: Generated<Timestamp | null>;\n userId: string | null;\n}\n\nexport interface TrackingIntercomConversation {\n answer: string;\n conversationId: Int8;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n isRelevant: boolean;\n outcome: string;\n question: string;\n summary: string;\n tags: string;\n}\n\nexport interface TrackingIntercomConversationUser {\n conversationId: string;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n userId: string;\n}\n\nexport interface TrackingIntercomReport {\n action: string;\n category: string;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n summary: string;\n tags: string;\n}\n\nexport interface TrackingIntercomReportConversation {\n conversationId: string;\n id: Generated<string>;\n reportId: string;\n}\n\nexport interface TrackingMetricCache {\n connectionId: Generated<string>;\n date: Timestamp;\n name: Generated<string>;\n refreshedAt: Generated<Timestamp>;\n status: Generated<string>;\n tenantId: string;\n total: Numeric;\n type: string;\n}\n\nexport interface TrackingMonitorConnection {\n appId: string;\n connectionId: string;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n message: string | null;\n status: string | null;\n syncedAt: Timestamp | null;\n tenantId: string;\n triggerRef: string | null;\n updatedAt: Timestamp | null;\n version: number | null;\n}\n\nexport interface TrackingMonitorConnectionState {\n name: string;\n}\n\nexport interface DB {\n \"accounting.account\": AccountingAccount;\n \"accounting.accountAssignment\": AccountingAccountAssignment;\n \"accounting.accountAssignmentLineType\": AccountingAccountAssignmentLineType;\n \"accounting.accountAssignmentType\": AccountingAccountAssignmentType;\n \"accounting.accountCategory\": AccountingAccountCategory;\n \"accounting.accountClassification\": AccountingAccountClassification;\n \"accounting.accountReservationLineType\": AccountingAccountReservationLineType;\n \"accounting.accountReservationRevRec\": AccountingAccountReservationRevRec;\n \"accounting.accountType\": AccountingAccountType;\n \"accounting.bankAccount\": AccountingBankAccount;\n \"accounting.bankAccountCategory\": AccountingBankAccountCategory;\n \"accounting.bankAccountType\": AccountingBankAccountType;\n \"accounting.bankRecord\": AccountingBankRecord;\n \"accounting.bankRecordTransactionPayment\": AccountingBankRecordTransactionPayment;\n \"accounting.bankRule\": AccountingBankRule;\n \"accounting.bankRuleAccount\": AccountingBankRuleAccount;\n \"accounting.bankRuleApplication\": AccountingBankRuleApplication;\n \"accounting.bankRuleApplicationStatus\": AccountingBankRuleApplicationStatus;\n \"accounting.bankRuleCondition\": AccountingBankRuleCondition;\n \"accounting.bankRuleLine\": AccountingBankRuleLine;\n \"accounting.bankRuleLineSplitMode\": AccountingBankRuleLineSplitMode;\n \"accounting.bankRuleMatchOperator\": AccountingBankRuleMatchOperator;\n \"accounting.bankRuleMode\": AccountingBankRuleMode;\n \"accounting.contact\": AccountingContact;\n \"accounting.contactCompanyType\": AccountingContactCompanyType;\n \"accounting.contactType\": AccountingContactType;\n \"accounting.journalEntry\": AccountingJournalEntry;\n \"accounting.journalEntryEntityType\": AccountingJournalEntryEntityType;\n \"accounting.journalEntryTriggerType\": AccountingJournalEntryTriggerType;\n \"accounting.journalEntryType\": AccountingJournalEntryType;\n \"accounting.ownerStatementProjection\": AccountingOwnerStatementProjection;\n \"accounting.ownerStatementProjectionRevision\": AccountingOwnerStatementProjectionRevision;\n \"accounting.paidStatus\": AccountingPaidStatus;\n \"accounting.party\": AccountingParty;\n \"accounting.rate\": AccountingRate;\n \"accounting.rateType\": AccountingRateType;\n \"accounting.taxBehavior\": AccountingTaxBehavior;\n \"accounting.transaction\": AccountingTransaction;\n \"accounting.transactionAttachment\": AccountingTransactionAttachment;\n \"accounting.transactionLine\": AccountingTransactionLine;\n \"accounting.transactionType\": AccountingTransactionType;\n \"audit.action\": AuditAction;\n \"audit.effect\": AuditEffect;\n \"audit.effectAttempt\": AuditEffectAttempt;\n \"audit.journalDelta\": AuditJournalDelta;\n \"audit.mutation\": AuditMutation;\n \"core.activeStatus\": CoreActiveStatus;\n \"core.change\": CoreChange;\n \"core.changeEntityType\": CoreChangeEntityType;\n \"core.changeLink\": CoreChangeLink;\n \"core.changeSourceLink\": CoreChangeSourceLink;\n \"core.changeStatus\": CoreChangeStatus;\n \"core.changeSyncType\": CoreChangeSyncType;\n \"core.changeType\": CoreChangeType;\n \"core.flow\": CoreFlow;\n \"core.flowMapping\": CoreFlowMapping;\n \"core.flowSetting\": CoreFlowSetting;\n \"core.issueMessageOverwrite\": CoreIssueMessageOverwrite;\n \"core.sync\": CoreSync;\n \"core.syncStatus\": CoreSyncStatus;\n \"core.syncSubtask\": CoreSyncSubtask;\n \"core.syncType\": CoreSyncType;\n \"hdbCatalog.eventInvocationLogs\": HdbCatalogEventInvocationLogs;\n \"hdbCatalog.eventLog\": HdbCatalogEventLog;\n \"hdbCatalog.hdbActionLog\": HdbCatalogHdbActionLog;\n \"hdbCatalog.hdbCronEventInvocationLogs\": HdbCatalogHdbCronEventInvocationLogs;\n \"hdbCatalog.hdbCronEvents\": HdbCatalogHdbCronEvents;\n \"hdbCatalog.hdbEventLogCleanups\": HdbCatalogHdbEventLogCleanups;\n \"hdbCatalog.hdbMetadata\": HdbCatalogHdbMetadata;\n \"hdbCatalog.hdbScheduledEventInvocationLogs\": HdbCatalogHdbScheduledEventInvocationLogs;\n \"hdbCatalog.hdbScheduledEvents\": HdbCatalogHdbScheduledEvents;\n \"hdbCatalog.hdbSchemaNotifications\": HdbCatalogHdbSchemaNotifications;\n \"hdbCatalog.hdbSourceCatalogVersion\": HdbCatalogHdbSourceCatalogVersion;\n \"hdbCatalog.hdbVersion\": HdbCatalogHdbVersion;\n \"public.accountCollection\": PublicAccountCollection;\n \"public.accountCollectionType\": PublicAccountCollectionType;\n \"public.address\": PublicAddress;\n \"public.app\": PublicApp;\n \"public.auditLog\": PublicAuditLog;\n \"public.automation\": PublicAutomation;\n \"public.automationTemplate\": PublicAutomationTemplate;\n \"public.billingPaymentMethodType\": PublicBillingPaymentMethodType;\n \"public.bookingChannel\": PublicBookingChannel;\n \"public.bookingChannelIconCandidate\": PublicBookingChannelIconCandidate;\n \"public.connection\": PublicConnection;\n \"public.currency\": PublicCurrency;\n \"public.duplicateEmails\": PublicDuplicateEmails;\n \"public.emailTemplate\": PublicEmailTemplate;\n \"public.emailTemplateType\": PublicEmailTemplateType;\n \"public.feature\": PublicFeature;\n \"public.featureApproval\": PublicFeatureApproval;\n \"public.featureApprovalStatus\": PublicFeatureApprovalStatus;\n \"public.featureEnabledTeam\": PublicFeatureEnabledTeam;\n \"public.featureStatus\": PublicFeatureStatus;\n \"public.fileStorage\": PublicFileStorage;\n \"public.fileStorageSourceLink\": PublicFileStorageSourceLink;\n \"public.fileStorageTag\": PublicFileStorageTag;\n \"public.latestDuplicateEmails\": PublicLatestDuplicateEmails;\n \"public.listing\": PublicListing;\n \"public.listingCollection\": PublicListingCollection;\n \"public.listingConnection\": PublicListingConnection;\n \"public.listingOwner\": PublicListingOwner;\n \"public.listingOwnerRole\": PublicListingOwnerRole;\n \"public.listingOwnershipPeriod\": PublicListingOwnershipPeriod;\n \"public.listingOwnershipPeriodBusinessModel\": PublicListingOwnershipPeriodBusinessModel;\n \"public.listingOwnershipPeriodMember\": PublicListingOwnershipPeriodMember;\n \"public.owner\": PublicOwner;\n \"public.ownerStatement\": PublicOwnerStatement;\n \"public.ownerStatementLayout\": PublicOwnerStatementLayout;\n \"public.ownerStatementLayoutAccount\": PublicOwnerStatementLayoutAccount;\n \"public.ownerStatementLayoutListing\": PublicOwnerStatementLayoutListing;\n \"public.ownerStatementLine\": PublicOwnerStatementLine;\n \"public.ownerStatementOwner\": PublicOwnerStatementOwner;\n \"public.ownerStatementStatus\": PublicOwnerStatementStatus;\n \"public.ownerStatementTemplate\": PublicOwnerStatementTemplate;\n \"public.ownerType\": PublicOwnerType;\n \"public.ownerUserAccess\": PublicOwnerUserAccess;\n \"public.ownerUserAccessRole\": PublicOwnerUserAccessRole;\n \"public.payment\": PublicPayment;\n \"public.paymentLine\": PublicPaymentLine;\n \"public.paymentLineClassification\": PublicPaymentLineClassification;\n \"public.paymentStatus\": PublicPaymentStatus;\n \"public.paymentType\": PublicPaymentType;\n \"public.recurringFee\": PublicRecurringFee;\n \"public.recurringFeeAccount\": PublicRecurringFeeAccount;\n \"public.recurringFeeAccountCondition\": PublicRecurringFeeAccountCondition;\n \"public.recurringFeeListingSubscription\": PublicRecurringFeeListingSubscription;\n \"public.recurringFeeListingSubscriptionRateType\": PublicRecurringFeeListingSubscriptionRateType;\n \"public.recurringFeeType\": PublicRecurringFeeType;\n \"public.reservation\": PublicReservation;\n \"public.reservationStatus\": PublicReservationStatus;\n \"public.reservationWithOccupancyStatus\": PublicReservationWithOccupancyStatus;\n \"public.setting\": PublicSetting;\n \"public.source\": PublicSource;\n \"public.task\": PublicTask;\n \"public.taxStatement\": PublicTaxStatement;\n \"public.taxStatementStatus\": PublicTaxStatementStatus;\n \"public.tenant\": PublicTenant;\n \"public.tenantUser\": PublicTenantUser;\n \"public.token\": PublicToken;\n \"public.user\": PublicUser;\n \"public.userCompanyType\": PublicUserCompanyType;\n \"public.userCompanyUser\": PublicUserCompanyUser;\n \"public.view\": PublicView;\n \"public.viewNotificationEvents\": PublicViewNotificationEvents;\n \"public.viewNotificationEventsGroupedByDate\": PublicViewNotificationEventsGroupedByDate;\n \"public.viewWebhookEvents\": PublicViewWebhookEvents;\n \"public.viewWebhookEventsGroupedByDate\": PublicViewWebhookEventsGroupedByDate;\n \"public.webhook\": PublicWebhook;\n \"tracking.event\": TrackingEvent;\n \"tracking.intercomConversation\": TrackingIntercomConversation;\n \"tracking.intercomConversationUser\": TrackingIntercomConversationUser;\n \"tracking.intercomReport\": TrackingIntercomReport;\n \"tracking.intercomReportConversation\": TrackingIntercomReportConversation;\n \"tracking.metricCache\": TrackingMetricCache;\n \"tracking.monitorConnection\": TrackingMonitorConnection;\n \"tracking.monitorConnectionState\": TrackingMonitorConnectionState;\n}\n"]}
@@ -4,6 +4,7 @@ export type { Insertable, LogEvent } from 'kysely';
4
4
  export * from './error';
5
5
  export * from './isomorphic';
6
6
  export * from './query';
7
+ export * from './transaction';
7
8
  import type { DB } from './v1.generated';
8
9
  type KyselyOpts = {
9
10
  repositoryName?: string;
@@ -6,6 +6,7 @@ import { getKysely } from './plugins';
6
6
  export * from './error';
7
7
  export * from './isomorphic';
8
8
  export * from './query';
9
+ export * from './transaction';
9
10
  import { parseDuration } from '@vrplatform/utils';
10
11
  const retryableMessages = ['CONNECTION_CLOSED'];
11
12
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"src/","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,QAAsB,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,cAAc,SAAS,C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AAO,CAAC,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IAAA,CACpB;CACF","sourcesContent":["import { backOff } from 'exponential-backoff';\nimport type { Kysely as K, LogConfig } from 'kysely';\nimport { PostgresJSDialect } from 'kysely-postgres-js';\nimport postgres, { type Sql } from 'postgres';\nimport { KyselyError } from './error';\nimport { getKysely } from './plugins';\n\nexport type { Insertable, LogEvent } from 'kysely';\nexport * from './error';\nexport * from './isomorphic';\nexport * from './query';\n\nimport { parseDuration } from '@vrplatform/utils';\nimport type { DB } from './v1.generated';\n\ntype KyselyOpts = {\n repositoryName?: string;\n log?: true | LogConfig;\n};\n\ntype PgOpt = {\n forceDisableSSL?: boolean;\n retries?: false | number;\n};\n\nconst retryableMessages = ['CONNECTION_CLOSED'];\n\nexport type Kysely = K<DB>;\nexport type Postgres = Sql;\n/**\n * @deprecated This method is deprecated in favor of the useAsyncKysely method.\n */\nexport function useKysely(postgres: Sql, options?: KyselyOpts) {\n console.debug('Creating Kysely instance');\n const kysely = getKysely(\n new PostgresJSDialect({\n postgres,\n onReserveConnection: async (connection) => {\n const executeQuery = connection.executeQuery.bind(connection);\n connection.executeQuery = (arg) =>\n backOff(async () => await executeQuery(arg), {\n numOfAttempts: 3,\n startingDelay: parseDuration('1s'),\n maxDelay: parseDuration('5s'),\n retry: (error) => {\n const message =\n error instanceof Error ? error.message : String(error);\n if (retryableMessages.some((m) => message?.includes(m))) {\n return true;\n }\n return false;\n },\n });\n },\n }),\n {\n repositoryName: options?.repositoryName,\n log: options?.log,\n }\n );\n kysely.destroy = async () => {\n console.debug('Closing Kysely connection');\n await Promise.race([\n postgres.end({ timeout: 5000 }).catch(() => undefined),\n new Promise((res) => setTimeout(res, 6000)),\n ]);\n const index = _connections.indexOf(postgres);\n if (index !== -1) _connections.splice(index, 1);\n };\n\n return kysely;\n}\n\nlet _connections: postgres.Sql[] = [];\nexport async function useAsyncPostgres(connectionString: string, opt?: PgOpt) {\n const delayMs = 2500;\n const retries = opt?.retries === false ? 0 : opt?.retries || 3;\n const ssl = opt?.forceDisableSSL !== true;\n const url = new URL(connectionString);\n\n console.debug(\n `Creating Postgres connection with ${retries} retries and ssl=${ssl} and port=${url.port}`\n );\n if (_connections.length > 0)\n console.warn(`We already have ${_connections.length} Postgres connections`);\n\n for (let attempt = 1; attempt <= retries; attempt++) {\n try {\n const sql = postgres(connectionString, {\n ssl: ssl ? 'require' : false,\n // connect_timeout: 10\n // idle_timeout: 10\n // enable prepare statements, pgbouncer on crunchy allows for prepared statements\n prepare: true,\n connect_timeout: 10,\n idle_timeout: 60,\n });\n\n await sql`select 1`;\n try {\n // connect 30s, idle 60s, max lifetime 45min, statement 60s, lock 10s, log_min_duration 20s, log_lock_waits off\n await sql`set statement_timeout to '30s';`;\n await sql`set lock_timeout to '10s';`;\n } catch (e) {\n console.warn('Failed to set statement timeout, continuing', e);\n }\n\n _connections.push(sql);\n return sql;\n } catch (err) {\n if (attempt === retries) throw err;\n console.warn(\n `Postgres connection failed (attempt ${attempt}), retrying...`\n );\n console.error('error', err);\n await new Promise((res) => setTimeout(res, delayMs));\n }\n }\n throw new KyselyError('Unable to connect to Postgres');\n}\n\nexport async function useAsyncKysely(\n connectionString: string,\n opt?: PgOpt & KyselyOpts\n) {\n const sql = await useAsyncPostgres(connectionString, opt);\n return useKysely(sql, opt);\n}\n\n/**\n * @deprecated This method is deprecated in favor of the useAsyncKysely method.\n */\nexport function usePostgres(\n connectionString?: string,\n opt?: Pick<PgOpt, 'forceDisableSSL'>\n) {\n if (!connectionString) throw new KyselyError('No connection string');\n const ssl = opt?.forceDisableSSL !== true;\n const url = new URL(connectionString);\n console.debug(\n `Creating sync Postgres connection with ssl=${ssl} and port=${url.port}`\n );\n const pg = postgres(connectionString, {\n ssl: ssl ? 'require' : false,\n });\n _connections.push(pg);\n return pg;\n}\n\nexport async function forceCloseAllPostgres(timeoutMs = 5000) {\n await Promise.race([\n Promise.all(\n _connections.map((pg) =>\n pg.end({ timeout: timeoutMs }).catch(() => undefined)\n )\n ),\n new Promise((res) => setTimeout(res, timeoutMs + 1000)),\n ]);\n _connections = [];\n}\n\nexport class DatabaseError extends Error {\n constructor(message: string, cause: any) {\n super(message);\n this.cause = cause;\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"src/","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,QAAsB,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAalD,MAAM,iBAAiB,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAIhD;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,QAAa,EAAE,OAAoB,EAAE;IAC7D,OAAO,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,SAAS,CACtB,IAAI,iBAAiB,CAAC;QACpB,QAAQ;QACR,mBAAmB,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,CAAC;YACzC,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC9D,UAAU,CAAC,YAAY,GAAG,CAAC,GAAG,EAAE,EAAE,CAChC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,MAAM,YAAY,CAAC,GAAG,CAAC,EAAE;gBAC3C,aAAa,EAAE,CAAC;gBAChB,aAAa,EAAE,aAAa,CAAC,IAAI,CAAC;gBAClC,QAAQ,EAAE,aAAa,CAAC,IAAI,CAAC;gBA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;IAC5D,MAAM,OAAO,CAAC,IAAI,CAAC;QACjB,OAAO,CAAC,GAAG,CACT,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CACtB,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CACtD,CACF;QACD,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,CAAC,CAAC;KACxD,CAAC,CAAC;IACH,YAAY,GAAG,EAAE,CAAC;AAAA,CACnB;AAED,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAe,EAAE,KAAU,EAAE;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IAAA,CACpB;CACF","sourcesContent":["import { backOff } from 'exponential-backoff';\nimport type { Kysely as K, LogConfig } from 'kysely';\nimport { PostgresJSDialect } from 'kysely-postgres-js';\nimport postgres, { type Sql } from 'postgres';\nimport { KyselyError } from './error';\nimport { getKysely } from './plugins';\n\nexport type { Insertable, LogEvent } from 'kysely';\nexport * from './error';\nexport * from './isomorphic';\nexport * from './query';\nexport * from './transaction';\n\nimport { parseDuration } from '@vrplatform/utils';\nimport type { DB } from './v1.generated';\n\ntype KyselyOpts = {\n repositoryName?: string;\n log?: true | LogConfig;\n};\n\ntype PgOpt = {\n forceDisableSSL?: boolean;\n retries?: false | number;\n};\n\nconst retryableMessages = ['CONNECTION_CLOSED'];\n\nexport type Kysely = K<DB>;\nexport type Postgres = Sql;\n/**\n * @deprecated This method is deprecated in favor of the useAsyncKysely method.\n */\nexport function useKysely(postgres: Sql, options?: KyselyOpts) {\n console.debug('Creating Kysely instance');\n const kysely = getKysely(\n new PostgresJSDialect({\n postgres,\n onReserveConnection: async (connection) => {\n const executeQuery = connection.executeQuery.bind(connection);\n connection.executeQuery = (arg) =>\n backOff(async () => await executeQuery(arg), {\n numOfAttempts: 3,\n startingDelay: parseDuration('1s'),\n maxDelay: parseDuration('5s'),\n retry: (error) => {\n const message =\n error instanceof Error ? error.message : String(error);\n if (retryableMessages.some((m) => message?.includes(m))) {\n return true;\n }\n return false;\n },\n });\n },\n }),\n {\n repositoryName: options?.repositoryName,\n log: options?.log,\n }\n );\n kysely.destroy = async () => {\n console.debug('Closing Kysely connection');\n await Promise.race([\n postgres.end({ timeout: 5000 }).catch(() => undefined),\n new Promise((res) => setTimeout(res, 6000)),\n ]);\n const index = _connections.indexOf(postgres);\n if (index !== -1) _connections.splice(index, 1);\n };\n\n return kysely;\n}\n\nlet _connections: postgres.Sql[] = [];\nexport async function useAsyncPostgres(connectionString: string, opt?: PgOpt) {\n const delayMs = 2500;\n const retries = opt?.retries === false ? 0 : opt?.retries || 3;\n const ssl = opt?.forceDisableSSL !== true;\n const url = new URL(connectionString);\n\n console.debug(\n `Creating Postgres connection with ${retries} retries and ssl=${ssl} and port=${url.port}`\n );\n if (_connections.length > 0)\n console.warn(`We already have ${_connections.length} Postgres connections`);\n\n for (let attempt = 1; attempt <= retries; attempt++) {\n try {\n const sql = postgres(connectionString, {\n ssl: ssl ? 'require' : false,\n // connect_timeout: 10\n // idle_timeout: 10\n // enable prepare statements, pgbouncer on crunchy allows for prepared statements\n prepare: true,\n connect_timeout: 10,\n idle_timeout: 60,\n });\n\n await sql`select 1`;\n try {\n // connect 30s, idle 60s, max lifetime 45min, statement 60s, lock 10s, log_min_duration 20s, log_lock_waits off\n await sql`set statement_timeout to '30s';`;\n await sql`set lock_timeout to '10s';`;\n } catch (e) {\n console.warn('Failed to set statement timeout, continuing', e);\n }\n\n _connections.push(sql);\n return sql;\n } catch (err) {\n if (attempt === retries) throw err;\n console.warn(\n `Postgres connection failed (attempt ${attempt}), retrying...`\n );\n console.error('error', err);\n await new Promise((res) => setTimeout(res, delayMs));\n }\n }\n throw new KyselyError('Unable to connect to Postgres');\n}\n\nexport async function useAsyncKysely(\n connectionString: string,\n opt?: PgOpt & KyselyOpts\n) {\n const sql = await useAsyncPostgres(connectionString, opt);\n return useKysely(sql, opt);\n}\n\n/**\n * @deprecated This method is deprecated in favor of the useAsyncKysely method.\n */\nexport function usePostgres(\n connectionString?: string,\n opt?: Pick<PgOpt, 'forceDisableSSL'>\n) {\n if (!connectionString) throw new KyselyError('No connection string');\n const ssl = opt?.forceDisableSSL !== true;\n const url = new URL(connectionString);\n console.debug(\n `Creating sync Postgres connection with ssl=${ssl} and port=${url.port}`\n );\n const pg = postgres(connectionString, {\n ssl: ssl ? 'require' : false,\n });\n _connections.push(pg);\n return pg;\n}\n\nexport async function forceCloseAllPostgres(timeoutMs = 5000) {\n await Promise.race([\n Promise.all(\n _connections.map((pg) =>\n pg.end({ timeout: timeoutMs }).catch(() => undefined)\n )\n ),\n new Promise((res) => setTimeout(res, timeoutMs + 1000)),\n ]);\n _connections = [];\n}\n\nexport class DatabaseError extends Error {\n constructor(message: string, cause: any) {\n super(message);\n this.cause = cause;\n }\n}\n"]}
@@ -1,9 +1,10 @@
1
- import type { Kysely as K, Transaction as T } from 'kysely';
1
+ import type { ControlledTransaction as CT, Kysely as K, Transaction as T } from 'kysely';
2
2
  export type { ColumnType, Expression, ExpressionBuilder, ExpressionOrFactory, Generated, Insertable, JSONColumnType, KyselyPlugin, Nullable, OperandExpression, PluginTransformQueryArgs, PluginTransformResultArgs, QueryResult, RootOperationNode, Selectable, SelectQueryBuilder, SqlBool, UnknownRow, Updateable, } from 'kysely';
3
3
  export { jsonArrayFrom } from 'kysely/helpers/postgres';
4
4
  export * from './v1.generated';
5
5
  import type { DB } from './v1.generated';
6
6
  export type Transaction = T<DB>;
7
+ export type ControlledTransaction<S extends string[] = string[]> = CT<DB, S>;
7
8
  export { sql } from 'kysely';
8
9
  export type Kysely = K<DB>;
9
10
  export declare class DatabaseError extends Error {
@@ -1 +1 @@
1
- {"version":3,"file":"isomorphic.js","sourceRoot":"src/","sources":["isomorphic.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,cAAc,gBAAgB,CAAC;AAK/B,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAI7B,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAe,EAAE,KAAU,EAAE;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IAAA,CACpB;CACF","sourcesContent":["import type { Kysely as K, Transaction as T } from 'kysely';\n\nexport type {\n ColumnType,\n Expression,\n ExpressionBuilder,\n ExpressionOrFactory,\n Generated,\n Insertable,\n JSONColumnType,\n KyselyPlugin,\n Nullable,\n OperandExpression,\n PluginTransformQueryArgs,\n PluginTransformResultArgs,\n QueryResult,\n RootOperationNode,\n Selectable,\n SelectQueryBuilder,\n SqlBool,\n UnknownRow,\n Updateable,\n} from 'kysely';\nexport { jsonArrayFrom } from 'kysely/helpers/postgres';\nexport * from './v1.generated';\n\nimport type { DB } from './v1.generated';\n\nexport type Transaction = T<DB>;\nexport { sql } from 'kysely';\n\nexport type Kysely = K<DB>;\n\nexport class DatabaseError extends Error {\n constructor(message: string, cause: any) {\n super(message);\n this.cause = cause;\n }\n}\n"]}
1
+ {"version":3,"file":"isomorphic.js","sourceRoot":"src/","sources":["isomorphic.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,cAAc,gBAAgB,CAAC;AAM/B,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAI7B,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAe,EAAE,KAAU,EAAE;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IAAA,CACpB;CACF","sourcesContent":["import type {\n ControlledTransaction as CT,\n Kysely as K,\n Transaction as T,\n} from 'kysely';\n\nexport type {\n ColumnType,\n Expression,\n ExpressionBuilder,\n ExpressionOrFactory,\n Generated,\n Insertable,\n JSONColumnType,\n KyselyPlugin,\n Nullable,\n OperandExpression,\n PluginTransformQueryArgs,\n PluginTransformResultArgs,\n QueryResult,\n RootOperationNode,\n Selectable,\n SelectQueryBuilder,\n SqlBool,\n UnknownRow,\n Updateable,\n} from 'kysely';\nexport { jsonArrayFrom } from 'kysely/helpers/postgres';\nexport * from './v1.generated';\n\nimport type { DB } from './v1.generated';\n\nexport type Transaction = T<DB>;\nexport type ControlledTransaction<S extends string[] = string[]> = CT<DB, S>;\nexport { sql } from 'kysely';\n\nexport type Kysely = K<DB>;\n\nexport class DatabaseError extends Error {\n constructor(message: string, cause: any) {\n super(message);\n this.cause = cause;\n }\n}\n"]}
@@ -7,6 +7,14 @@ import { FileMigrationProvider, Migrator } from 'kysely';
7
7
  import codegen from 'kysely-codegen';
8
8
  import { PGliteDialect } from 'kysely-pglite-dialect';
9
9
  import { getKysely } from '../plugins';
10
+ async function normalizeGeneratedTypes(root) {
11
+ const outFile = path.join(root, 'src/v1.generated.ts');
12
+ const current = await Bun.file(outFile).text();
13
+ const next = current.replace('export type Timestamp = ColumnType<Date, Date | string, Date | string>;', 'export type Timestamp = ColumnType<Date | string, Date | string, Date | string>;');
14
+ if (next !== current) {
15
+ await Bun.write(outFile, next);
16
+ }
17
+ }
10
18
  async function migrate(root, client) {
11
19
  console.log('migrating pglite ....');
12
20
  const glob = new Bun.Glob('initial/*.sql');
@@ -76,12 +84,16 @@ async function generateDump(root, dumpPath) {
76
84
  outFile: path.join(root, 'src/v1.generated.ts'),
77
85
  defaultSchemas: ['xxx'],
78
86
  camelCase: true,
87
+ typeMapping: {
88
+ date: 'string',
89
+ },
79
90
  dialect: codegen.getDialect('postgres'),
80
91
  })
81
92
  .catch(() => {
82
93
  console.error('failed to generate kysely');
83
94
  process.exit(1);
84
95
  });
96
+ await normalizeGeneratedTypes(root);
85
97
  const content = await main.dumpDataDir('none').catch(() => {
86
98
  console.error('failed to dump data');
87
99
  process.exit(1);
@@ -1 +1 @@
1
- {"version":3,"file":"generate.js","sourceRoot":"src/","sources":["local/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAe,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACtE,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,KAAK,UAAU,OAAO,CAAC,IAAY,EAAE,MAAc,EAAE;IACnD,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IACrC,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC3C,IAAI,KAAK,EAAE,MAAM,SAAS,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACzD,yEAAyE;QACzE,oEAAoE;QACpE,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,6BAA6B,EAAE,EAAE,CAAC,CAAC;QACjE,MAAM,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;AAAA,CACF;AAED,KAAK,UAAU,aAAa,CAAC,IAAY,EAAE,MAAkB,EAAE;IAC7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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,CAAC;QAC3B,IAAI,WAAW;YAAE,OAAO;QACxB,WAAW,GAAG,IAAI,CAAC;QACnB,yCAAyC;QACzC,MAAM,eAAe,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC/C,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC5C,cAAc;QACd,0EAA0E;QAC1E,IAAI;IAHwC,CAI7C,CAAC;IAEF,iFAAiF;IAEjF,OAAO,MAAM,CAAC;AAAA,CACf","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 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 dialect: codegen.getDialect('postgres'),\n })\n .catch(() => {\n console.error('failed to generate kysely');\n process.exit(1);\n });\n const content = await main.dumpDataDir('none').catch(() => {\n console.error('failed to dump data');\n process.exit(1);\n });\n await Bun.write(dumpPath, content).catch(() => {\n console.error('failed to write dump');\n process.exit(1);\n });\n return content;\n }\n return Bun.file(dumpPath);\n}\n\nexport async function 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().catch(() => undefined);\n await pglite.close().catch(() => undefined);\n //console.log(\n // `Database destroyed: ${Math.round(performance.now() - destroyTime)}ms`\n //);\n };\n\n // console.log(`Database initialized: ${Math.round(performance.now() - now)}ms`);\n\n return kysely;\n}\n"]}
1
+ {"version":3,"file":"generate.js","sourceRoot":"src/","sources":["local/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAe,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACtE,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,KAAK,UAAU,uBAAuB,CAAC,IAAY,EAAE;IACnD,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,CAAC,OAAO,CAC1B,yEAAyE,EACzE,kFAAkF,CACnF,CAAC;IAEF,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,MAAM,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;AAAA,CACF;AAED,KAAK,UAAU,OAAO,CAAC,IAAY,EAAE,MA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} 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().catch(() => undefined);\n await pglite.close().catch(() => undefined);\n //console.log(\n // `Database destroyed: ${Math.round(performance.now() - destroyTime)}ms`\n //);\n };\n\n // console.log(`Database initialized: ${Math.round(performance.now() - now)}ms`);\n\n return kysely;\n}\n"]}
@@ -1,8 +1,9 @@
1
- import type { LogConfig } from 'kysely';
1
+ import { type LogConfig } from 'kysely';
2
+ import type { DB } from '../v1.generated';
2
3
  export declare const root: string;
3
4
  export declare const dumpPath: string;
4
5
  export type UseLocalKyselyOptions = {
5
6
  repositoryName?: string;
6
7
  log?: true | LogConfig;
7
8
  };
8
- export declare function useLocalKysely(args?: UseLocalKyselyOptions): Promise<import("kysely").Kysely<import("..").DB>>;
9
+ export declare function useLocalKysely(args?: UseLocalKyselyOptions): Promise<import("kysely").Kysely<DB>>;
@@ -1,10 +1,29 @@
1
- import { join } from 'node:path';
1
+ import { promises as fs } from 'node:fs';
2
+ import * as path from 'node:path';
2
3
  import { PGlite } from '@electric-sql/pglite';
4
+ import { FileMigrationProvider, Migrator } from 'kysely';
3
5
  import { PGliteDialect } from 'kysely-pglite-dialect';
4
6
  import { getKysely } from '../plugins';
5
7
  import { ensureDigestFunction, ensureGenRandomBytesFunction } from './digest';
6
- export const root = join(__dirname, '../..');
7
- export const dumpPath = join(root, '.data.tar');
8
+ export const root = path.join(__dirname, '../..');
9
+ export const dumpPath = path.join(root, '.data.tar');
10
+ async function migrateToLatest(kysely) {
11
+ const migrator = new Migrator({
12
+ db: kysely,
13
+ migrationTableSchema: 'core',
14
+ migrationTableName: 'kysely_migration',
15
+ migrationLockTableName: 'kysely_migration_lock',
16
+ provider: new FileMigrationProvider({
17
+ fs,
18
+ path,
19
+ migrationFolder: path.join(root, 'migrations'),
20
+ }),
21
+ });
22
+ const { error } = await migrator.migrateToLatest();
23
+ if (error) {
24
+ throw error;
25
+ }
26
+ }
8
27
  export async function useLocalKysely(args = {}) {
9
28
  let isDestroyed = false;
10
29
  // const now = performance.now();
@@ -19,6 +38,7 @@ export async function useLocalKysely(args = {}) {
19
38
  });
20
39
  await ensureDigestFunction(kysely);
21
40
  await ensureGenRandomBytesFunction(kysely);
41
+ await migrateToLatest(kysely);
22
42
  const originalDestroy = kysely.destroy.bind(kysely);
23
43
  kysely.destroy = async () => {
24
44
  if (isDestroyed)
@@ -1 +1 @@
1
- {"version":3,"file":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AC;QACnB,wCAAwC;QACxC,MAAM,eAAe,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC/C,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC5C,cAAc;QACd,0EAA0E;QAC1E,IAAI;IAHwC,CAI7C,CAAC;IAEF,iFAAiF;IAEjF,OAAO,MAAM,CAAC;AAAA,CACf","sourcesContent":["import { join } from 'node:path';\nimport { PGlite } from '@electric-sql/pglite';\nimport type { LogConfig } from 'kysely';\nimport { PGliteDialect } from 'kysely-pglite-dialect';\nimport { getKysely } from '../plugins';\nimport { ensureDigestFunction, ensureGenRandomBytesFunction } from './digest';\n\nexport const root = join(__dirname, '../..');\nexport const dumpPath = join(root, '.data.tar');\n\nexport type UseLocalKyselyOptions = {\n repositoryName?: string;\n log?: true | LogConfig;\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\n const originalDestroy = kysely.destroy.bind(kysely);\n kysely.destroy = async () => {\n if (isDestroyed) return;\n isDestroyed = true;\n //const destroyTime = performance.now();\n await originalDestroy().catch(() => undefined);\n await pglite.close().catch(() => undefined);\n //console.log(\n // `Database destroyed: ${Math.round(performance.now() - destroyTime)}ms`\n //);\n };\n\n // console.log(`Database initialized: ${Math.round(performance.now() - now)}ms`);\n\n return kysely;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"src/","sources":["local/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACz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,CAAC;QACxB,WAAW,EAAE,IAAI;KAClB,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,EAAE;QAChC,cAAc,EAAE,IAAI,EAAE,cAAc,IAAI,cAAc;QACtD,GAAG,EAAE,IAAI,EAAE,GAAG;KACf,CAAC,CAAC;IACH,MAAM,oBAAoB,CAAC,MAAM,CAAC,CAAC;IACnC,MAAM,4BAA4B,CAAC,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,CAAC;QAC3B,IAAI,WAAW;YAAE,OAAO;QACxB,WAAW,GAAG,IAAI,CAAC;QACnB,wCAAwC;QACxC,MAAM,eAAe,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC/C,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC5C,cAAc;QACd,0EAA0E;QAC1E,IAAI;IAHwC,CAI7C,CAAC;IAEF,iFAAiF;IAEjF,OAAO,MAAM,CAAC;AAAA,CACf","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().catch(() => undefined);\n await pglite.close().catch(() => undefined);\n //console.log(\n // `Database destroyed: ${Math.round(performance.now() - destroyTime)}ms`\n //);\n };\n\n // console.log(`Database initialized: ${Math.round(performance.now() - now)}ms`);\n\n return kysely;\n}\n"]}
@@ -8,7 +8,7 @@ export declare function whereListingIsActive(eb: ExpressionBuilder<DB & {
8
8
  l: PublicListing;
9
9
  }, 'l'>, today?: string): import("kysely").ExpressionWrapper<DB & {
10
10
  l: PublicListing;
11
- }, "l", 0 | 1 | boolean>;
11
+ }, "l", import("kysely").SqlBool>;
12
12
  export declare function selectListingIsInactive(eb: ExpressionBuilder<DB & {
13
13
  l: PublicListing;
14
14
  }, 'l'>, today?: string): import("kysely").ExpressionWrapper<DB & {
@@ -18,7 +18,7 @@ export declare function selectListingIsActive(eb: ExpressionBuilder<DB & {
18
18
  l: PublicListing;
19
19
  }, 'l'>, today?: string): import("kysely").ExpressionWrapper<DB & {
20
20
  l: PublicListing;
21
- }, "l", 0 | 1 | boolean>;
21
+ }, "l", import("kysely").SqlBool>;
22
22
  export declare function selectListingStatus(eb: ExpressionBuilder<DB & {
23
23
  l: PublicListing;
24
24
  }, 'l'>, today?: string): import("kysely").ExpressionWrapper<DB & {
@@ -1,4 +1,17 @@
1
1
  import { day } from '@vrplatform/utils';
2
+ function hasActiveTenant(eb) {
3
+ return eb.exists(eb
4
+ .selectFrom('public.tenant as tenant')
5
+ .leftJoin('public.tenant as billingPartner', 'billingPartner.id', 'tenant.calculatedBillingPartnerId')
6
+ .select('tenant.id')
7
+ .whereRef('tenant.id', '=', 'l.tenantId')
8
+ .where('tenant.calculatedStatus', '=', 'active')
9
+ .where((eb2) => eb2.or([
10
+ eb2('tenant.calculatedBillingPartnerId', 'is', null),
11
+ eb2('billingPartner.calculatedStatus', '=', 'active'),
12
+ ]))
13
+ .limit(1));
14
+ }
2
15
  function hasInactiveOwnership(eb, today) {
3
16
  const onDate = day(today).toDate();
4
17
  return eb.exists(eb
@@ -23,7 +36,10 @@ export function whereListingIsInactive(eb, today = day().yyyymmdd()) {
23
36
  return hasInactiveOwnership(eb, today);
24
37
  }
25
38
  export function whereListingIsActive(eb, today = day().yyyymmdd()) {
26
- return eb.not(whereListingIsInactive(eb, today));
39
+ return eb.and([
40
+ hasActiveTenant(eb),
41
+ eb.not(whereListingIsInactive(eb, today)),
42
+ ]);
27
43
  }
28
44
  export function selectListingIsInactive(eb, today = day().yyyymmdd()) {
29
45
  return whereListingIsInactive(eb, today);