@vrplatform/kysely 1.3.17 → 1.3.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/.data.tar +0 -0
- package/build/main/index.d.ts +1 -0
- package/build/main/index.js +1 -0
- package/build/main/index.js.map +1 -1
- package/build/main/query/index.d.ts +1 -0
- package/build/main/query/index.js +18 -0
- package/build/main/query/index.js.map +1 -0
- package/build/main/query/listing/index.d.ts +1 -0
- package/build/main/query/listing/index.js +18 -0
- package/build/main/query/listing/index.js.map +1 -0
- package/build/main/query/listing/is-active-or-at-least-one-ownership-period-active.d.ts +6 -0
- package/build/main/query/listing/is-active-or-at-least-one-ownership-period-active.js +24 -0
- package/build/main/query/listing/is-active-or-at-least-one-ownership-period-active.js.map +1 -0
- package/build/main/tsconfig.main.tsbuildinfo +1 -1
- package/build/module/index.d.ts +1 -0
- package/build/module/index.js +1 -0
- package/build/module/index.js.map +1 -1
- package/build/module/query/index.d.ts +1 -0
- package/build/module/query/index.js +2 -0
- package/build/module/query/index.js.map +1 -0
- package/build/module/query/listing/index.d.ts +1 -0
- package/build/module/query/listing/index.js +2 -0
- package/build/module/query/listing/index.js.map +1 -0
- package/build/module/query/listing/is-active-or-at-least-one-ownership-period-active.d.ts +6 -0
- package/build/module/query/listing/is-active-or-at-least-one-ownership-period-active.js +21 -0
- package/build/module/query/listing/is-active-or-at-least-one-ownership-period-active.js.map +1 -0
- package/build/module/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +9 -6
- package/build/main/local.d.ts +0 -3
- package/build/main/local.js +0 -158
- package/build/main/local.js.map +0 -1
- package/build/main/test.d.ts +0 -4
- package/build/main/test.js +0 -19
- package/build/main/test.js.map +0 -1
- package/build/main/v0.generated.d.ts +0 -1996
- package/build/main/v0.generated.js +0 -7
- package/build/main/v0.generated.js.map +0 -1
- package/build/module/local.d.ts +0 -3
- package/build/module/local.js +0 -119
- package/build/module/local.js.map +0 -1
- package/build/module/test.d.ts +0 -4
- package/build/module/test.js +0 -16
- package/build/module/test.js.map +0 -1
- package/build/module/v0.generated.d.ts +0 -1996
- package/build/module/v0.generated.js +0 -6
- package/build/module/v0.generated.js.map +0 -1
- package/src/camel-case/index.ts +0 -68
- package/src/error.ts +0 -6
- package/src/index.ts +0 -144
- package/src/isomorphic.ts +0 -33
- package/src/local/digest.ts +0 -44
- package/src/local/generate.ts +0 -137
- package/src/local/index.ts +0 -48
- package/src/pganalyze-comment-plugin/comment-transformer.ts +0 -117
- package/src/pganalyze-comment-plugin/index.ts +0 -27
- package/src/plugins.ts +0 -30
- package/src/test/index.ts +0 -64
- package/src/v1.generated.ts +0 -1917
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"v0.generated.js","sourceRoot":"src/","sources":["v0.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 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 StoreEffectStatus = \"claimed\" | \"completed\" | \"dead_letter\" | \"failed\" | \"pending\" | \"running\";\n\nexport type Timestamp = ColumnType<Date, 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 | null;\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 | null>;\n tenantId: string | null;\n title: string | null;\n type: string | null;\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 pmsStatus: string | null;\n sourceId: string | null;\n status: Generated<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 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 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 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 matchers: Json | 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 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 AccountingTransactionLine {\n accountAssignmentType: string | null;\n accountId: 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 matchers: Generated<Json | 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 CoreAction {\n appId: string | null;\n automationId: string | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp | null>;\n id: Generated<string>;\n inputJson: Json | null;\n isCurrent: boolean | null;\n jobId: string | null;\n jobIndex: number | null;\n jobPageId: string | null;\n jobPlanId: string | null;\n objectId: string | null;\n opId: string | null;\n outputJson: Json | null;\n refs: Json | null;\n schemaId: string | null;\n sourceId: string | null;\n status: string | null;\n tenantId: string | null;\n title: string | null;\n type: string | null;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp | null>;\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 CoreIssue {\n actionId: string | null;\n automationId: string | null;\n code: string | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp | null>;\n extractId: string | null;\n extractPageId: string | null;\n id: Generated<string>;\n jobId: string | null;\n jobPageId: string | null;\n jobPlanId: string | null;\n kind: string | null;\n message: string | null;\n metadata: Generated<Json | null>;\n refId: Generated<string | null>;\n refType: string | null;\n refValue: string | null;\n status: string | null;\n subType: string | null;\n tenantId: string | null;\n type: string | null;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface CoreIssueKind {\n name: string;\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 CoreIssueStatus {\n name: string;\n}\n\nexport interface CoreIssueType {\n name: string;\n}\n\nexport interface CoreJob {\n automationId: string | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp | null>;\n id: Generated<string>;\n kind: string | null;\n metadata: Generated<Json | null>;\n params: Json | null;\n planId: string | null;\n rangeEnd: Timestamp | null;\n rangeStart: Timestamp | null;\n schemaId: string | null;\n status: Generated<string>;\n tenantId: string | null;\n title: string | null;\n type: string | null;\n updatedAt: Generated<Timestamp | null>;\n workflowId: string | null;\n}\n\nexport interface CoreJobPage {\n createdAt: Generated<Timestamp | null>;\n cursor: string | null;\n id: Generated<string>;\n jobId: string | null;\n params: Json | null;\n status: Generated<string>;\n tenantId: string | null;\n title: string | null;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface CoreJobPlan {\n automationId: string | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp>;\n hypervisorRef: string | null;\n id: Generated<string>;\n isCurrentOnConnection: Generated<boolean | null>;\n params: Json | null;\n rangeEnd: Timestamp | null;\n rangeStart: Timestamp | null;\n status: Generated<string>;\n tenantId: string;\n title: string | null;\n triggeredByUserId: string | null;\n type: string | null;\n updatedAt: Generated<Timestamp>;\n workflowId: string | null;\n}\n\nexport interface CoreSchema {\n appId: string | null;\n createdAt: Generated<Timestamp | null>;\n hasExternalLinks: boolean | null;\n id: Generated<string>;\n indexSchema: Json | null;\n jsonSchema: Json | null;\n kind: string | null;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface CoreSchemaKind {\n name: string;\n}\n\nexport interface CoreSourceAction {\n actionId: string;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n opId: string | null;\n sourceId: string;\n tenantId: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface CoreSourceOp {\n actionId: string | null;\n createdAt: Generated<Timestamp | null>;\n fields: Generated<Json>;\n id: Generated<string>;\n jobId: string | null;\n jobPageId: string | null;\n jobPlanId: string | null;\n json: Json | null;\n kind: string;\n sourceId: string;\n tenantId: string;\n updatedAt: Generated<Timestamp | null>;\n version: Generated<number | 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 PublicAction {\n automationId: string | null;\n automationTaskId: string | null;\n connectionId: string | null;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n inputFileId: string | null;\n jobTaskId: string | null;\n outputFileId: string | null;\n processTaskId: string | null;\n status: string | null;\n taskId: string | null;\n tenantId: string | null;\n type: string | null;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicActionStatus {\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 config: Generated<Json>;\n createdAt: Generated<Timestamp>;\n defaultMachineSize: string | null;\n endpoint: string | null;\n flows: Generated<Json>;\n flyApp: string | null;\n icon: string | null;\n iconRound: string | null;\n id: Generated<string>;\n info: Json | null;\n name: string;\n pluginData: Json | null;\n type: string;\n uid: Generated<string | null>;\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 PublicAutomationStatus {\n name: string;\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 PublicConnectionStatusTemporary {\n name: string;\n}\n\nexport interface PublicCsvLine {\n connectionId: string;\n createdAt: Generated<Timestamp | null>;\n csv: string;\n date: Timestamp;\n fileId: string | null;\n fileUniqueRef: string | null;\n headers: string | null;\n id: Generated<string>;\n index: number | null;\n json: Json | null;\n tenantId: string;\n type: string;\n uniqueRef: string;\n updatedAt: Generated<Timestamp | 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: Generated<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 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 PublicListingPmsStatus {\n name: string;\n}\n\nexport interface PublicListingStatus {\n name: string;\n}\n\nexport interface PublicMetric {\n connectionId: string;\n createdAt: Generated<Timestamp>;\n date: Timestamp;\n id: Generated<string>;\n listingConnectionId: string | null;\n metadata: Generated<Json>;\n tenantId: string;\n type: string;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp>;\n value: number | 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 pmsStatus: 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 PublicOwnerPmsStatus {\n name: string;\n}\n\nexport interface PublicOwnerStatement {\n automationId: string | null;\n centAccountingBalanceEnd: number | null;\n centAccountingBalanceStart: number | null;\n centBalanceEnd: Int8 | null;\n centBalanceStart: Int8 | null;\n centPayedOut: number | null;\n centRentalRevenue: number | null;\n centTotal: 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 PublicOwnerStatementIssue {\n id: Generated<string>;\n level: Generated<string>;\n lineId: string | null;\n message: string;\n statementId: string | null;\n tenantId: string;\n type: string;\n uniqueRef: string;\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 PublicOwnerStatus {\n name: string;\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 id: Generated<string>;\n lineId: string | null;\n listingId: 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 PublicPgpodmanStatus {\n containerId: string;\n runCmd: string | null;\n started: Timestamp | null;\n status: string | null;\n}\n\nexport interface PublicPgStatStatements {\n calls: Int8 | null;\n dbid: number | null;\n jitDeformCount: Int8 | null;\n jitDeformTime: number | null;\n jitEmissionCount: Int8 | null;\n jitEmissionTime: number | null;\n jitFunctions: Int8 | null;\n jitGenerationTime: number | null;\n jitInliningCount: Int8 | null;\n jitInliningTime: number | null;\n jitOptimizationCount: Int8 | null;\n jitOptimizationTime: number | null;\n localBlkReadTime: number | null;\n localBlksDirtied: Int8 | null;\n localBlksHit: Int8 | null;\n localBlksRead: Int8 | null;\n localBlksWritten: Int8 | null;\n localBlkWriteTime: number | null;\n maxExecTime: number | null;\n maxPlanTime: number | null;\n meanExecTime: number | null;\n meanPlanTime: number | null;\n minExecTime: number | null;\n minmaxStatsSince: Timestamp | null;\n minPlanTime: number | null;\n plans: Int8 | null;\n query: string | null;\n queryid: Int8 | null;\n rows: Int8 | null;\n sharedBlkReadTime: number | null;\n sharedBlksDirtied: Int8 | null;\n sharedBlksHit: Int8 | null;\n sharedBlksRead: Int8 | null;\n sharedBlksWritten: Int8 | null;\n sharedBlkWriteTime: number | null;\n statsSince: Timestamp | null;\n stddevExecTime: number | null;\n stddevPlanTime: number | null;\n tempBlkReadTime: number | null;\n tempBlksRead: Int8 | null;\n tempBlksWritten: Int8 | null;\n tempBlkWriteTime: number | null;\n toplevel: boolean | null;\n totalExecTime: number | null;\n totalPlanTime: number | null;\n userid: number | null;\n walBytes: Numeric | null;\n walFpi: Int8 | null;\n walRecords: Int8 | null;\n}\n\nexport interface PublicPgStatStatementsInfo {\n dealloc: Int8 | null;\n statsReset: Timestamp | null;\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 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 generalLedgerPostingAt: Timestamp | null;\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 metadata: Json | null;\n nights: number | null;\n otaReservationId: string | null;\n paidStatus: string | null;\n paymentMethod: string | null;\n pmsReferenceCode: string | null;\n sourceId: string | null;\n status: Generated<string | 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 PublicScheduledEvent {\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n message: string | null;\n objectId: string;\n op: string;\n scheduledAt: Timestamp | null;\n status: Generated<string | null>;\n tableName: string;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface PublicScheduledEventStatus {\n name: string;\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 /**\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 schemaId: 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 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 partnerId: Generated<string | 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 StoreDispatchedAction {\n actionType: string;\n apiEndpoint: string | null;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n message: string | null;\n payload: Json | null;\n requestR2Link: string | null;\n sequence: Generated<number>;\n tenantId: string;\n userId: string | null;\n}\n\nexport interface StoreEffectQueue {\n claimedAt: Timestamp | null;\n claimedBy: string | null;\n completedAt: Timestamp | null;\n createdAt: Generated<Timestamp>;\n dispatchedActionId: string;\n effectType: string;\n id: Generated<string>;\n lastAttemptAt: Timestamp | null;\n lastError: string | null;\n maxRetries: Generated<number>;\n payload: Json;\n priority: Generated<number>;\n retryCount: Generated<number>;\n sequence: Generated<number>;\n status: Generated<StoreEffectStatus>;\n tenantId: string;\n}\n\nexport interface StoreMutationLog {\n changeRecord: Json;\n createdAt: Generated<Timestamp>;\n dispatchedActionId: string;\n effectId: string | null;\n id: Generated<string>;\n mutatedEntityId: string;\n mutatedEntityType: string;\n mutationOp: string;\n tenantId: 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 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.paidStatus\": AccountingPaidStatus;\n \"accounting.party\": AccountingParty;\n \"accounting.rate\": AccountingRate;\n \"accounting.rateType\": AccountingRateType;\n \"accounting.taxBehavior\": AccountingTaxBehavior;\n \"accounting.transaction\": AccountingTransaction;\n \"accounting.transactionLine\": AccountingTransactionLine;\n \"accounting.transactionType\": AccountingTransactionType;\n \"core.action\": CoreAction;\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.issue\": CoreIssue;\n \"core.issueKind\": CoreIssueKind;\n \"core.issueMessageOverwrite\": CoreIssueMessageOverwrite;\n \"core.issueStatus\": CoreIssueStatus;\n \"core.issueType\": CoreIssueType;\n \"core.job\": CoreJob;\n \"core.jobPage\": CoreJobPage;\n \"core.jobPlan\": CoreJobPlan;\n \"core.schema\": CoreSchema;\n \"core.schemaKind\": CoreSchemaKind;\n \"core.sourceAction\": CoreSourceAction;\n \"core.sourceOp\": CoreSourceOp;\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.action\": PublicAction;\n \"public.actionStatus\": PublicActionStatus;\n \"public.address\": PublicAddress;\n \"public.app\": PublicApp;\n \"public.auditLog\": PublicAuditLog;\n \"public.automation\": PublicAutomation;\n \"public.automationStatus\": PublicAutomationStatus;\n \"public.automationTemplate\": PublicAutomationTemplate;\n \"public.billingPaymentMethodType\": PublicBillingPaymentMethodType;\n \"public.bookingChannel\": PublicBookingChannel;\n \"public.connection\": PublicConnection;\n \"public.connectionStatusTemporary\": PublicConnectionStatusTemporary;\n \"public.csvLine\": PublicCsvLine;\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.listingPmsStatus\": PublicListingPmsStatus;\n \"public.listingStatus\": PublicListingStatus;\n \"public.metric\": PublicMetric;\n \"public.owner\": PublicOwner;\n \"public.ownerPmsStatus\": PublicOwnerPmsStatus;\n \"public.ownerStatement\": PublicOwnerStatement;\n \"public.ownerStatementIssue\": PublicOwnerStatementIssue;\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.ownerStatus\": PublicOwnerStatus;\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.pgpodmanStatus\": PublicPgpodmanStatus;\n \"public.pgStatStatements\": PublicPgStatStatements;\n \"public.pgStatStatementsInfo\": PublicPgStatStatementsInfo;\n \"public.recurringFee\": PublicRecurringFee;\n \"public.recurringFeeAccount\": PublicRecurringFeeAccount;\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.scheduledEvent\": PublicScheduledEvent;\n \"public.scheduledEventStatus\": PublicScheduledEventStatus;\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 \"store.dispatchedAction\": StoreDispatchedAction;\n \"store.effectQueue\": StoreEffectQueue;\n \"store.mutationLog\": StoreMutationLog;\n \"tracking.event\": TrackingEvent;\n \"tracking.intercomConversation\": TrackingIntercomConversation;\n \"tracking.intercomConversationUser\": TrackingIntercomConversationUser;\n \"tracking.intercomReport\": TrackingIntercomReport;\n \"tracking.intercomReportConversation\": TrackingIntercomReportConversation;\n \"tracking.monitorConnection\": TrackingMonitorConnection;\n \"tracking.monitorConnectionState\": TrackingMonitorConnectionState;\n}\n"]}
|
package/src/camel-case/index.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type AliasNode,
|
|
3
|
-
CamelCasePlugin,
|
|
4
|
-
type IdentifierNode,
|
|
5
|
-
type RawNode,
|
|
6
|
-
type SelectQueryNode,
|
|
7
|
-
} from 'kysely';
|
|
8
|
-
import { KyselyError } from '../error';
|
|
9
|
-
|
|
10
|
-
export class CustomCasePlugin extends CamelCasePlugin {
|
|
11
|
-
// _excludedColumns: Record<string, boolean> = {};
|
|
12
|
-
constructor() {
|
|
13
|
-
super({
|
|
14
|
-
maintainNestedObjectKeys: true,
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
transformResult(args) {
|
|
19
|
-
return super.transformResult(args);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
transformQuery(args) {
|
|
23
|
-
this.verifyAlias(args.node);
|
|
24
|
-
return super.transformQuery(args);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
verifyAlias(node: SelectQueryNode) {
|
|
28
|
-
if (!node?.selections) return;
|
|
29
|
-
|
|
30
|
-
for (const x of node.selections ?? []) {
|
|
31
|
-
const selection = x.selection as AliasNode;
|
|
32
|
-
if (!selection.alias) continue;
|
|
33
|
-
const alias = selection.alias as IdentifierNode;
|
|
34
|
-
|
|
35
|
-
// alias can be a raw node (jsonArrayFrom)
|
|
36
|
-
if (selection.node.kind === 'RawNode') {
|
|
37
|
-
const rawNode = selection.node as RawNode;
|
|
38
|
-
for (const x of rawNode.parameters ?? []) {
|
|
39
|
-
if (x.kind === 'SelectQueryNode') {
|
|
40
|
-
const selectQueryNode = x as SelectQueryNode;
|
|
41
|
-
this.verifyAlias(selectQueryNode);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (!alias.name.includes('_')) continue;
|
|
47
|
-
|
|
48
|
-
throw new KyselyError(`Alias ${alias.name} contains underscore`);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
protected mapRow(row) {
|
|
53
|
-
if (typeof row !== 'object' || !row) return row;
|
|
54
|
-
|
|
55
|
-
const newRow: Record<string, any> = {};
|
|
56
|
-
// we camel case on first layer, and nested ONLY if in an array (jsonArrayFrom), NOT if it's an object (jsonb)
|
|
57
|
-
for (const key of Object.keys(row)) {
|
|
58
|
-
let value = row[key];
|
|
59
|
-
const newKey = super.camelCase(key);
|
|
60
|
-
// array CAN be non object, so we need to check the first element
|
|
61
|
-
if (Array.isArray(value)) {
|
|
62
|
-
value = value.map((it) => this.mapRow(it));
|
|
63
|
-
}
|
|
64
|
-
newRow[newKey] = value;
|
|
65
|
-
}
|
|
66
|
-
return newRow;
|
|
67
|
-
}
|
|
68
|
-
}
|
package/src/error.ts
DELETED
package/src/index.ts
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import type { Kysely as K, LogConfig } from 'kysely';
|
|
2
|
-
import { PostgresJSDialect } from 'kysely-postgres-js';
|
|
3
|
-
import postgres, { type Sql } from 'postgres';
|
|
4
|
-
import { getKysely } from './plugins';
|
|
5
|
-
|
|
6
|
-
export type { LogEvent } from 'kysely';
|
|
7
|
-
export * from './error';
|
|
8
|
-
export * from './isomorphic';
|
|
9
|
-
|
|
10
|
-
import type { DB } from './v1.generated';
|
|
11
|
-
|
|
12
|
-
type KyselyOpts = {
|
|
13
|
-
repositoryName?: string;
|
|
14
|
-
log?: true | LogConfig;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
type PgOpt = {
|
|
18
|
-
forceDisableSSL?: boolean;
|
|
19
|
-
retries?: false | number;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export type Kysely = K<DB>;
|
|
23
|
-
export type Postgres = Sql;
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated This method is deprecated in favor of the useAsyncKysely method.
|
|
26
|
-
*/
|
|
27
|
-
export function useKysely(postgres: Sql, options?: KyselyOpts) {
|
|
28
|
-
console.debug('Creating Kysely instance');
|
|
29
|
-
const kysely = getKysely(
|
|
30
|
-
new PostgresJSDialect({
|
|
31
|
-
postgres,
|
|
32
|
-
}),
|
|
33
|
-
{
|
|
34
|
-
repositoryName: options?.repositoryName,
|
|
35
|
-
log: options?.log,
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
kysely.destroy = async () => {
|
|
39
|
-
console.debug('Closing Kysely connection');
|
|
40
|
-
await Promise.race([
|
|
41
|
-
postgres.end({ timeout: 5000 }).catch(() => undefined),
|
|
42
|
-
new Promise((res) => setTimeout(res, 6000)),
|
|
43
|
-
]);
|
|
44
|
-
const index = _connections.indexOf(postgres);
|
|
45
|
-
if (index !== -1) _connections.splice(index, 1);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
return kysely;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
let _connections: postgres.Sql[] = [];
|
|
52
|
-
export async function useAsyncPostgres(connectionString: string, opt?: PgOpt) {
|
|
53
|
-
const delayMs = 2500;
|
|
54
|
-
const retries = opt?.retries === false ? 0 : opt?.retries || 3;
|
|
55
|
-
const ssl = opt?.forceDisableSSL !== true;
|
|
56
|
-
const url = new URL(connectionString);
|
|
57
|
-
|
|
58
|
-
console.debug(
|
|
59
|
-
`Creating Postgres connection with ${retries} retries and ssl=${ssl} and port=${url.port}`
|
|
60
|
-
);
|
|
61
|
-
if (_connections.length > 0)
|
|
62
|
-
console.warn(`We already have ${_connections.length} Postgres connections`);
|
|
63
|
-
|
|
64
|
-
for (let attempt = 1; attempt <= retries; attempt++) {
|
|
65
|
-
try {
|
|
66
|
-
const sql = postgres(connectionString, {
|
|
67
|
-
ssl: ssl ? 'require' : false,
|
|
68
|
-
// connect_timeout: 10
|
|
69
|
-
// idle_timeout: 10
|
|
70
|
-
// enable prepare statements, pgbouncer on crunchy allows for prepared statements
|
|
71
|
-
prepare: true,
|
|
72
|
-
connect_timeout: 10,
|
|
73
|
-
idle_timeout: 60,
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
await sql`select 1`;
|
|
77
|
-
try {
|
|
78
|
-
// connect 30s, idle 60s, max lifetime 45min, statement 60s, lock 10s, log_min_duration 20s, log_lock_waits off
|
|
79
|
-
await sql`set statement_timeout to '30s';`;
|
|
80
|
-
await sql`set lock_timeout to '10s';`;
|
|
81
|
-
} catch (e) {
|
|
82
|
-
console.warn('Failed to set statement timeout, continuing', e);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
_connections.push(sql);
|
|
86
|
-
return sql;
|
|
87
|
-
} catch (err) {
|
|
88
|
-
if (attempt === retries) throw err;
|
|
89
|
-
console.warn(
|
|
90
|
-
`Postgres connection failed (attempt ${attempt}), retrying...`
|
|
91
|
-
);
|
|
92
|
-
console.error('error', err);
|
|
93
|
-
await new Promise((res) => setTimeout(res, delayMs));
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
throw new Error('Unable to connect to Postgres');
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export async function useAsyncKysely(
|
|
100
|
-
connectionString: string,
|
|
101
|
-
opt?: PgOpt & KyselyOpts
|
|
102
|
-
) {
|
|
103
|
-
const sql = await useAsyncPostgres(connectionString, opt);
|
|
104
|
-
return useKysely(sql, opt);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* @deprecated This method is deprecated in favor of the useAsyncKysely method.
|
|
109
|
-
*/
|
|
110
|
-
export function usePostgres(
|
|
111
|
-
connectionString?: string,
|
|
112
|
-
opt?: Pick<PgOpt, 'forceDisableSSL'>
|
|
113
|
-
) {
|
|
114
|
-
if (!connectionString) throw new Error('No connection string');
|
|
115
|
-
const ssl = opt?.forceDisableSSL !== true;
|
|
116
|
-
const url = new URL(connectionString);
|
|
117
|
-
console.debug(
|
|
118
|
-
`Creating sync Postgres connection with ssl=${ssl} and port=${url.port}`
|
|
119
|
-
);
|
|
120
|
-
const pg = postgres(connectionString, {
|
|
121
|
-
ssl: ssl ? 'require' : false,
|
|
122
|
-
});
|
|
123
|
-
_connections.push(pg);
|
|
124
|
-
return pg;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export async function forceCloseAllPostgres(timeoutMs = 5000) {
|
|
128
|
-
await Promise.race([
|
|
129
|
-
Promise.all(
|
|
130
|
-
_connections.map((pg) =>
|
|
131
|
-
pg.end({ timeout: timeoutMs }).catch(() => undefined)
|
|
132
|
-
)
|
|
133
|
-
),
|
|
134
|
-
new Promise((res) => setTimeout(res, timeoutMs + 1000)),
|
|
135
|
-
]);
|
|
136
|
-
_connections = [];
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export class DatabaseError extends Error {
|
|
140
|
-
constructor(message: string, cause: any) {
|
|
141
|
-
super(message);
|
|
142
|
-
this.cause = cause;
|
|
143
|
-
}
|
|
144
|
-
}
|
package/src/isomorphic.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { Kysely as K, Transaction as T } from 'kysely';
|
|
2
|
-
|
|
3
|
-
export type {
|
|
4
|
-
ColumnType,
|
|
5
|
-
Expression,
|
|
6
|
-
ExpressionBuilder,
|
|
7
|
-
ExpressionOrFactory,
|
|
8
|
-
Generated,
|
|
9
|
-
Insertable,
|
|
10
|
-
JSONColumnType,
|
|
11
|
-
Nullable,
|
|
12
|
-
OperandExpression,
|
|
13
|
-
Selectable,
|
|
14
|
-
SelectQueryBuilder,
|
|
15
|
-
SqlBool,
|
|
16
|
-
Updateable,
|
|
17
|
-
} from 'kysely';
|
|
18
|
-
export { jsonArrayFrom } from 'kysely/helpers/postgres';
|
|
19
|
-
export * from './v1.generated';
|
|
20
|
-
|
|
21
|
-
import type { DB } from './v1.generated';
|
|
22
|
-
|
|
23
|
-
export type Transaction = T<DB>;
|
|
24
|
-
export { sql } from 'kysely';
|
|
25
|
-
|
|
26
|
-
export type Kysely = K<DB>;
|
|
27
|
-
|
|
28
|
-
export class DatabaseError extends Error {
|
|
29
|
-
constructor(message: string, cause: any) {
|
|
30
|
-
super(message);
|
|
31
|
-
this.cause = cause;
|
|
32
|
-
}
|
|
33
|
-
}
|
package/src/local/digest.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { type Kysely, sql } from '../isomorphic';
|
|
2
|
-
|
|
3
|
-
export async function ensureDigestFunction(kysely: Kysely) {
|
|
4
|
-
try {
|
|
5
|
-
await sql`select digest('', 'sha256')`.execute(kysely);
|
|
6
|
-
} catch {
|
|
7
|
-
await sql`
|
|
8
|
-
create or replace function digest(input text, algo text)
|
|
9
|
-
returns bytea
|
|
10
|
-
language sql
|
|
11
|
-
immutable
|
|
12
|
-
strict
|
|
13
|
-
as $$
|
|
14
|
-
select '\\x0000000000000000000000000000000000000000000000000000000000000000'::bytea;
|
|
15
|
-
$$;
|
|
16
|
-
`.execute(kysely);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export async function ensureGenRandomBytesFunction(kysely: Kysely) {
|
|
21
|
-
try {
|
|
22
|
-
await sql`select gen_random_bytes(1)`.execute(kysely);
|
|
23
|
-
} catch {
|
|
24
|
-
await sql`
|
|
25
|
-
create or replace function gen_random_bytes(p_len integer)
|
|
26
|
-
returns bytea
|
|
27
|
-
language sql
|
|
28
|
-
stable
|
|
29
|
-
strict
|
|
30
|
-
as $$
|
|
31
|
-
select substring(
|
|
32
|
-
decode(
|
|
33
|
-
repeat(
|
|
34
|
-
md5(random()::text || now()::text),
|
|
35
|
-
((p_len + 15) / 16)
|
|
36
|
-
),
|
|
37
|
-
'hex'
|
|
38
|
-
)
|
|
39
|
-
from 1 for p_len
|
|
40
|
-
);
|
|
41
|
-
$$;
|
|
42
|
-
`.execute(kysely);
|
|
43
|
-
}
|
|
44
|
-
}
|
package/src/local/generate.ts
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { promises as fs } from 'node:fs';
|
|
2
|
-
import { exists } from 'node:fs/promises';
|
|
3
|
-
import * as path from 'node:path';
|
|
4
|
-
import { join } from 'node:path';
|
|
5
|
-
import { PGlite } from '@electric-sql/pglite';
|
|
6
|
-
import { FileMigrationProvider, type Kysely, Migrator } from 'kysely';
|
|
7
|
-
import codegen from 'kysely-codegen';
|
|
8
|
-
import { KyselyPGlite } from 'kysely-pglite';
|
|
9
|
-
import { getKysely } from '../plugins';
|
|
10
|
-
import type { DB } from '../v1.generated';
|
|
11
|
-
|
|
12
|
-
async function migrate(root: string, client: PGlite) {
|
|
13
|
-
console.log('migrating pglite ....');
|
|
14
|
-
const glob = new Bun.Glob('initial/*.sql');
|
|
15
|
-
for await (const migration of glob.scan(root)) {
|
|
16
|
-
const raw = await Bun.file(join(root, migration)).text();
|
|
17
|
-
// `pg_dump` (v17+) prepends `\restrict`/`\unrestrict` psql meta commands
|
|
18
|
-
// which PostgreSQL-compatible parsers (like PGlite) cannot execute.
|
|
19
|
-
const sanitized = raw.replace(/^\s*\\(?:un)?restrict.*$/gim, '');
|
|
20
|
-
await client.exec(sanitized);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
async function migrateKysely(root: string, kysely: Kysely<DB>) {
|
|
25
|
-
console.log('init migrating kysely ....');
|
|
26
|
-
const migrator = new Migrator({
|
|
27
|
-
db: kysely,
|
|
28
|
-
migrationTableSchema: 'core',
|
|
29
|
-
migrationTableName: 'kysely_migration',
|
|
30
|
-
migrationLockTableName: 'kysely_migration_lock',
|
|
31
|
-
provider: new FileMigrationProvider({
|
|
32
|
-
fs,
|
|
33
|
-
path,
|
|
34
|
-
// This needs to be an absolute path.
|
|
35
|
-
migrationFolder: path.join(root, 'migrations'),
|
|
36
|
-
}),
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
console.log('migrating kysely ....');
|
|
40
|
-
const { error, results } = await migrator.migrateToLatest().catch(() => {
|
|
41
|
-
console.error('failed to migrate');
|
|
42
|
-
process.exit(1);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
for (const it of results ?? []) {
|
|
46
|
-
if (it.status === 'Success') {
|
|
47
|
-
console.log(`migration "${it.migrationName}" was executed successfully`);
|
|
48
|
-
} else if (it.status === 'Error') {
|
|
49
|
-
console.error(`failed to execute migration "${it.migrationName}"`);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (error) {
|
|
54
|
-
console.error('failed to migrate');
|
|
55
|
-
console.error(error);
|
|
56
|
-
process.exit(1);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
async function generateDump(root: string, dumpPath: string) {
|
|
61
|
-
const dataExists = await exists(dumpPath).catch(() => false);
|
|
62
|
-
if (!dataExists) {
|
|
63
|
-
console.log('Creating initial dump');
|
|
64
|
-
const main = new PGlite();
|
|
65
|
-
await migrate(root, main).catch(async (err) => {
|
|
66
|
-
console.error('failed to migrate initial dump');
|
|
67
|
-
await Bun.write(
|
|
68
|
-
'../logs/migrate-initial-dump.json',
|
|
69
|
-
JSON.stringify(err as any, null, 2)
|
|
70
|
-
);
|
|
71
|
-
process.exit(1);
|
|
72
|
-
});
|
|
73
|
-
const { dialect } = new KyselyPGlite(main);
|
|
74
|
-
const kysely = getKysely(dialect, {
|
|
75
|
-
repositoryName: 'localTesting',
|
|
76
|
-
log: undefined,
|
|
77
|
-
});
|
|
78
|
-
await migrateKysely(root, kysely).catch(() => {
|
|
79
|
-
console.error('failed to migrate kysely');
|
|
80
|
-
process.exit(1);
|
|
81
|
-
});
|
|
82
|
-
await codegen
|
|
83
|
-
.generate({
|
|
84
|
-
db: kysely,
|
|
85
|
-
outFile: path.join(root, 'src/v1.generated.ts'),
|
|
86
|
-
defaultSchemas: ['xxx'],
|
|
87
|
-
camelCase: true,
|
|
88
|
-
dialect: codegen.getDialect('postgres'),
|
|
89
|
-
})
|
|
90
|
-
.catch(() => {
|
|
91
|
-
console.error('failed to generate kysely');
|
|
92
|
-
process.exit(1);
|
|
93
|
-
});
|
|
94
|
-
const content = await main.dumpDataDir('none').catch(() => {
|
|
95
|
-
console.error('failed to dump data');
|
|
96
|
-
process.exit(1);
|
|
97
|
-
});
|
|
98
|
-
await Bun.write(dumpPath, content).catch(() => {
|
|
99
|
-
console.error('failed to write dump');
|
|
100
|
-
process.exit(1);
|
|
101
|
-
});
|
|
102
|
-
return content;
|
|
103
|
-
}
|
|
104
|
-
return Bun.file(dumpPath);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export async function createLocalKysely(root: string, dumpPath: string) {
|
|
108
|
-
let isDestroyed = false;
|
|
109
|
-
//const now = performance.now();
|
|
110
|
-
|
|
111
|
-
const dump = await generateDump(root, dumpPath);
|
|
112
|
-
|
|
113
|
-
const pglite = new PGlite({ loadDataDir: dump });
|
|
114
|
-
// warm up
|
|
115
|
-
await pglite.sql`SELECT 1`;
|
|
116
|
-
const { dialect } = new KyselyPGlite(pglite);
|
|
117
|
-
const kysely = getKysely(dialect, {
|
|
118
|
-
repositoryName: 'localTesting',
|
|
119
|
-
log: undefined,
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
const originalDestroy = kysely.destroy.bind(kysely);
|
|
123
|
-
kysely.destroy = async () => {
|
|
124
|
-
if (isDestroyed) return;
|
|
125
|
-
isDestroyed = true;
|
|
126
|
-
// const destroyTime = performance.now();
|
|
127
|
-
await originalDestroy().catch(() => undefined);
|
|
128
|
-
await pglite.close().catch(() => undefined);
|
|
129
|
-
//console.log(
|
|
130
|
-
// `Database destroyed: ${Math.round(performance.now() - destroyTime)}ms`
|
|
131
|
-
//);
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
// console.log(`Database initialized: ${Math.round(performance.now() - now)}ms`);
|
|
135
|
-
|
|
136
|
-
return kysely;
|
|
137
|
-
}
|
package/src/local/index.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
|
-
import { PGlite } from '@electric-sql/pglite';
|
|
3
|
-
import type { LogConfig } from 'kysely';
|
|
4
|
-
import { PGliteDialect } from 'kysely-pglite-dialect';
|
|
5
|
-
import { getKysely } from '../plugins';
|
|
6
|
-
import { ensureDigestFunction, ensureGenRandomBytesFunction } from './digest';
|
|
7
|
-
|
|
8
|
-
export const root = join(__dirname, '../..');
|
|
9
|
-
export const dumpPath = join(root, '.data.tar');
|
|
10
|
-
|
|
11
|
-
export type UseLocalKyselyOptions = {
|
|
12
|
-
repositoryName?: string;
|
|
13
|
-
log?: true | LogConfig;
|
|
14
|
-
};
|
|
15
|
-
export async function useLocalKysely(args: UseLocalKyselyOptions = {}) {
|
|
16
|
-
let isDestroyed = false;
|
|
17
|
-
// const now = performance.now();
|
|
18
|
-
|
|
19
|
-
const dump = Bun.file(dumpPath);
|
|
20
|
-
|
|
21
|
-
const pglite = new PGlite({
|
|
22
|
-
loadDataDir: dump,
|
|
23
|
-
});
|
|
24
|
-
// warm up
|
|
25
|
-
const dialect = new PGliteDialect(pglite);
|
|
26
|
-
const kysely = getKysely(dialect, {
|
|
27
|
-
repositoryName: args?.repositoryName ?? 'localTesting',
|
|
28
|
-
log: args?.log,
|
|
29
|
-
});
|
|
30
|
-
await ensureDigestFunction(kysely);
|
|
31
|
-
await ensureGenRandomBytesFunction(kysely);
|
|
32
|
-
|
|
33
|
-
const originalDestroy = kysely.destroy.bind(kysely);
|
|
34
|
-
kysely.destroy = async () => {
|
|
35
|
-
if (isDestroyed) return;
|
|
36
|
-
isDestroyed = true;
|
|
37
|
-
//const destroyTime = performance.now();
|
|
38
|
-
await originalDestroy().catch(() => undefined);
|
|
39
|
-
await pglite.close().catch(() => undefined);
|
|
40
|
-
//console.log(
|
|
41
|
-
// `Database destroyed: ${Math.round(performance.now() - destroyTime)}ms`
|
|
42
|
-
//);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
// console.log(`Database initialized: ${Math.round(performance.now() - now)}ms`);
|
|
46
|
-
|
|
47
|
-
return kysely;
|
|
48
|
-
}
|