diff --git a/integration/zero-schema.gen.ts b/integration/zero-schema.gen.ts index 4e5a1fb..198099e 100644 --- a/integration/zero-schema.gen.ts +++ b/integration/zero-schema.gen.ts @@ -1,4 +1,4 @@ -// @generated drizzle-zero signature:sha256:c5684711c30762960bcd19feccf03c65c2d25ff7b6b2e597c73a857158b679a5 +// @generated drizzle-zero signature:sha256:55e38a0c3d6e7b0bac7fc9bdd4c332e213082d236f15a40e6823f03a0d398ee3 // This file was automatically generated by drizzle-zero. // You should NOT make any changes in this file as it will be overwritten. @@ -12,15 +12,15 @@ export type OrderTableCurrencyMetadataCustomType = ZeroCustomType< 'orderTable', 'currencyMetadata' >; -export type ProductMediaTypeCustomType = ZeroCustomType< +export type ProductMediaMimeDescriptorCustomType = ZeroCustomType< typeof zeroSchema, 'productMedia', - 'type' + 'mimeDescriptor' >; -export type ProductMediaMimeDescriptorCustomType = ZeroCustomType< +export type ProductMediaTypeCustomType = ZeroCustomType< typeof zeroSchema, 'productMedia', - 'mimeDescriptor' + 'type' >; export type ProjectWorkflowStateCustomType = ZeroCustomType< typeof zeroSchema, @@ -32,66 +32,45 @@ export type ProjectAuditDetailsCustomType = ZeroCustomType< 'projectAudit', 'details' >; -export type UserCustomTypeJsonCustomType = ZeroCustomType< - typeof zeroSchema, - 'user', - 'customTypeJson' ->; export type UserCustomInterfaceJsonCustomType = ZeroCustomType< typeof zeroSchema, 'user', 'customInterfaceJson' >; -export type UserTestInterfaceCustomType = ZeroCustomType< +export type UserCustomTypeJsonCustomType = ZeroCustomType< typeof zeroSchema, 'user', - 'testInterface' + 'customTypeJson' >; -export type UserTestTypeCustomType = ZeroCustomType< +export type UserNotificationPreferencesCustomType = ZeroCustomType< typeof zeroSchema, 'user', - 'testType' + 'notificationPreferences' >; export type UserTestExportedTypeCustomType = ZeroCustomType< typeof zeroSchema, 'user', 'testExportedType' >; -export type UserNotificationPreferencesCustomType = ZeroCustomType< +export type UserTestInterfaceCustomType = ZeroCustomType< typeof zeroSchema, 'user', - 'notificationPreferences' + 'testInterface' +>; +export type UserTestTypeCustomType = ZeroCustomType< + typeof zeroSchema, + 'user', + 'testType' >; const allTypesTable = { name: 'allTypes', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - updatedAt: { + bigSerialField: { type: 'number', optional: true, customType: null as unknown as number, - }, - id: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - smallintField: { - type: 'number', - optional: false, - customType: null as unknown as number, - serverName: 'smallint', - }, - integerField: { - type: 'number', - optional: false, - customType: null as unknown as number, - serverName: 'integer', + serverName: 'bigserial', }, bigintField: { type: 'number', @@ -105,29 +84,34 @@ const allTypesTable = { customType: null as unknown as number, serverName: 'bigint_number', }, - smallSerialField: { - type: 'number', - optional: true, - customType: null as unknown as number, - serverName: 'smallserial', + booleanField: { + type: 'boolean', + optional: false, + customType: null as unknown as boolean, + serverName: 'boolean', }, - serialField: { - type: 'number', - optional: true, - customType: null as unknown as number, - serverName: 'serial', + charField: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'char', }, - bigSerialField: { + cidrField: { + type: 'string', + optional: false, + customType: null as unknown as ReadonlyJSONValue, + serverName: 'cidr', + }, + createdAt: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'bigserial', }, - numericField: { + dateField: { type: 'number', optional: false, customType: null as unknown as number, - serverName: 'numeric', + serverName: 'date', }, decimalField: { type: 'number', @@ -135,41 +119,22 @@ const allTypesTable = { customType: null as unknown as number, serverName: 'decimal', }, - realField: { - type: 'number', - optional: false, - customType: null as unknown as number, - serverName: 'real', - }, doublePrecisionField: { type: 'number', optional: false, customType: null as unknown as number, serverName: 'double_precision', }, - textField: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'text', - }, - charField: { - type: 'string', + enumArray: { + type: 'json', optional: false, - customType: null as unknown as string, - serverName: 'char', + customType: null as unknown as ('active' | 'inactive' | 'pending')[], + serverName: 'enum_array', }, - uuidField: { + id: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'uuid', - }, - cidrField: { - type: 'string', - optional: false, - customType: null as unknown as ReadonlyJSONValue, - serverName: 'cidr', }, inetField: { type: 'string', @@ -177,71 +142,17 @@ const allTypesTable = { customType: null as unknown as ReadonlyJSONValue, serverName: 'inet', }, - macaddrField: { - type: 'string', - optional: false, - customType: null as unknown as ReadonlyJSONValue, - serverName: 'macaddr', - }, - macaddr8Field: { - type: 'string', - optional: false, - customType: null as unknown as ReadonlyJSONValue, - serverName: 'macaddr8', - }, - varcharField: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'varchar', - }, - booleanField: { - type: 'boolean', - optional: false, - customType: null as unknown as boolean, - serverName: 'boolean', - }, - timeField: { - type: 'number', - optional: false, - customType: null as unknown as number, - serverName: 'time', - }, - timeTzField: { - type: 'number', - optional: false, - customType: null as unknown as number, - serverName: 'time_tz', - }, - timestampField: { - type: 'number', - optional: false, - customType: null as unknown as number, - serverName: 'timestamp', - }, - timestampTzField: { - type: 'number', - optional: false, - customType: null as unknown as number, - serverName: 'timestamp_tz', - }, - timestampModeString: { - type: 'number', - optional: false, - customType: null as unknown as number, - serverName: 'timestamp_mode_string', - }, - timestampModeDate: { - type: 'number', + intArray: { + type: 'json', optional: false, - customType: null as unknown as number, - serverName: 'timestamp_mode_date', + customType: null as unknown as number[], + serverName: 'int_array', }, - dateField: { + integerField: { type: 'number', optional: false, customType: null as unknown as number, - serverName: 'date', + serverName: 'integer', }, jsonField: { type: 'json', @@ -249,34 +160,29 @@ const allTypesTable = { customType: null as unknown as ReadonlyJSONValue, serverName: 'json', }, - jsonbField: { + jsonbArray: { type: 'json', optional: false, - customType: null as unknown as ReadonlyJSONValue, - serverName: 'jsonb', + customType: null as unknown as {key: string}[], + serverName: 'jsonb_array', }, - typedJsonField: { + jsonbField: { type: 'json', optional: false, - customType: null as unknown as {theme: string; fontSize: number}, - serverName: 'typed_json', + customType: null as unknown as ReadonlyJSONValue, + serverName: 'jsonb', }, - status: { + macaddr8Field: { type: 'string', optional: false, - customType: null as unknown as 'active' | 'inactive' | 'pending', - }, - textArray: { - type: 'json', - optional: false, - customType: null as unknown as string[], - serverName: 'text_array', + customType: null as unknown as ReadonlyJSONValue, + serverName: 'macaddr8', }, - intArray: { - type: 'json', + macaddrField: { + type: 'string', optional: false, - customType: null as unknown as number[], - serverName: 'int_array', + customType: null as unknown as ReadonlyJSONValue, + serverName: 'macaddr', }, numericArray: { type: 'json', @@ -284,35 +190,11 @@ const allTypesTable = { customType: null as unknown as number[], serverName: 'numeric_array', }, - uuidArray: { - type: 'json', - optional: false, - customType: null as unknown as string[], - serverName: 'uuid_array', - }, - jsonbArray: { - type: 'json', - optional: false, - customType: null as unknown as {key: string}[], - serverName: 'jsonb_array', - }, - enumArray: { - type: 'json', - optional: false, - customType: null as unknown as ('active' | 'inactive' | 'pending')[], - serverName: 'enum_array', - }, - optionalSmallint: { - type: 'number', - optional: true, - customType: null as unknown as number, - serverName: 'optional_smallint', - }, - optionalInteger: { + numericField: { type: 'number', - optional: true, + optional: false, customType: null as unknown as number, - serverName: 'optional_integer', + serverName: 'numeric', }, optionalBigint: { type: 'number', @@ -320,23 +202,53 @@ const allTypesTable = { customType: null as unknown as number, serverName: 'optional_bigint', }, - optionalNumeric: { - type: 'number', + optionalBoolean: { + type: 'boolean', optional: true, - customType: null as unknown as number, - serverName: 'optional_numeric', + customType: null as unknown as boolean, + serverName: 'optional_boolean', }, - optionalReal: { + optionalDoublePrecision: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'optional_real', + serverName: 'optional_double_precision', }, - optionalDoublePrecision: { + optionalEnum: { + type: 'string', + optional: true, + customType: null as unknown as 'active' | 'inactive' | 'pending', + serverName: 'optional_enum', + }, + optionalInteger: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'optional_double_precision', + serverName: 'optional_integer', + }, + optionalJson: { + type: 'json', + optional: true, + customType: null as unknown as ReadonlyJSONValue, + serverName: 'optional_json', + }, + optionalNumeric: { + type: 'number', + optional: true, + customType: null as unknown as number, + serverName: 'optional_numeric', + }, + optionalReal: { + type: 'number', + optional: true, + customType: null as unknown as number, + serverName: 'optional_real', + }, + optionalSmallint: { + type: 'number', + optional: true, + customType: null as unknown as number, + serverName: 'optional_smallint', }, optionalText: { type: 'string', @@ -344,29 +256,17 @@ const allTypesTable = { customType: null as unknown as string, serverName: 'optional_text', }, - optionalBoolean: { - type: 'boolean', - optional: true, - customType: null as unknown as boolean, - serverName: 'optional_boolean', - }, optionalTimestamp: { type: 'number', optional: true, customType: null as unknown as number, serverName: 'optional_timestamp', }, - optionalJson: { - type: 'json', - optional: true, - customType: null as unknown as ReadonlyJSONValue, - serverName: 'optional_json', - }, - optionalEnum: { + optionalUuid: { type: 'string', optional: true, - customType: null as unknown as 'active' | 'inactive' | 'pending', - serverName: 'optional_enum', + customType: null as unknown as string, + serverName: 'optional_uuid', }, optionalVarchar: { type: 'string', @@ -374,11 +274,111 @@ const allTypesTable = { customType: null as unknown as string, serverName: 'optional_varchar', }, - optionalUuid: { + realField: { + type: 'number', + optional: false, + customType: null as unknown as number, + serverName: 'real', + }, + serialField: { + type: 'number', + optional: true, + customType: null as unknown as number, + serverName: 'serial', + }, + smallSerialField: { + type: 'number', + optional: true, + customType: null as unknown as number, + serverName: 'smallserial', + }, + smallintField: { + type: 'number', + optional: false, + customType: null as unknown as number, + serverName: 'smallint', + }, + status: { + type: 'string', + optional: false, + customType: null as unknown as 'active' | 'inactive' | 'pending', + }, + textArray: { + type: 'json', + optional: false, + customType: null as unknown as string[], + serverName: 'text_array', + }, + textField: { type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'text', + }, + timeField: { + type: 'number', + optional: false, + customType: null as unknown as number, + serverName: 'time', + }, + timeTzField: { + type: 'number', + optional: false, + customType: null as unknown as number, + serverName: 'time_tz', + }, + timestampField: { + type: 'number', + optional: false, + customType: null as unknown as number, + serverName: 'timestamp', + }, + timestampModeDate: { + type: 'number', + optional: false, + customType: null as unknown as number, + serverName: 'timestamp_mode_date', + }, + timestampModeString: { + type: 'number', + optional: false, + customType: null as unknown as number, + serverName: 'timestamp_mode_string', + }, + timestampTzField: { + type: 'number', + optional: false, + customType: null as unknown as number, + serverName: 'timestamp_tz', + }, + typedJsonField: { + type: 'json', + optional: false, + customType: null as unknown as {fontSize: number; theme: string}, + serverName: 'typed_json', + }, + updatedAt: { + type: 'number', optional: true, + customType: null as unknown as number, + }, + uuidArray: { + type: 'json', + optional: false, + customType: null as unknown as string[], + serverName: 'uuid_array', + }, + uuidField: { + type: 'string', + optional: false, customType: null as unknown as string, - serverName: 'optional_uuid', + serverName: 'uuid', + }, + varcharField: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'varchar', }, }, primaryKey: ['id'], @@ -392,10 +392,29 @@ const analyticsDashboardTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + defaultQuery: { + type: 'json', + optional: false, + customType: null as unknown as { + dimensions: ('day' | 'hour' | 'month' | 'week')[]; + filters?: + | undefined + | { + field: string; + operator: + 'eq' | 'gt' | 'gte' | 'in' | 'lt' | 'lte' | 'neq' | 'nin'; + value: (number | string)[] | boolean | number | string; + }[]; + limit: number; + metrics: string[]; + timezone: string; + }, + serverName: 'default_query', + }, + description: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, }, id: { type: 'string', @@ -413,29 +432,10 @@ const analyticsDashboardTable = { optional: false, customType: null as unknown as string, }, - description: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, - }, - defaultQuery: { - type: 'json', - optional: false, - customType: null as unknown as { - dimensions: ('hour' | 'day' | 'week' | 'month')[]; - metrics: string[]; - limit: number; - timezone: string; - filters?: - | { - field: string; - operator: - 'in' | 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'nin'; - value: string | number | boolean | (string | number)[]; - }[] - | undefined; - }, - serverName: 'default_query', + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -449,38 +449,38 @@ const analyticsWidgetTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { + dashboardId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'dashboard_id', }, - dashboardId: { + id: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'dashboard_id', + }, + position: { + type: 'number', + optional: true, + customType: null as unknown as number, }, title: { type: 'string', optional: false, customType: null as unknown as string, }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, widgetType: { type: 'string', optional: false, customType: null as unknown as string, serverName: 'widget_type', }, - position: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, }, primaryKey: ['id'], serverName: 'analytics_widget', @@ -493,27 +493,16 @@ const analyticsWidgetQueryTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - widgetId: { + dataSource: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'widget_id', + serverName: 'data_source', }, - dataSource: { + id: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'data_source', }, query: { type: 'string', @@ -526,34 +515,41 @@ const analyticsWidgetQueryTable = { customType: null as unknown as number, serverName: 'refresh_interval_seconds', }, - }, - primaryKey: ['id'], - serverName: 'analytics_widget_query', -} as const; -const benefitEnrollmentTable = { - name: 'benefitEnrollment', - columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, updatedAt: { type: 'number', optional: true, customType: null as unknown as number, }, - id: { + widgetId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'widget_id', }, - benefitPlanId: { - type: 'string', - optional: false, - customType: null as unknown as string, + }, + primaryKey: ['id'], + serverName: 'analytics_widget_query', +} as const; +const benefitEnrollmentTable = { + name: 'benefitEnrollment', + columns: { + benefitPlanId: { + type: 'string', + optional: false, + customType: null as unknown as string, serverName: 'benefit_plan_id', }, + coverageLevel: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'coverage_level', + }, + createdAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, employeeId: { type: 'string', optional: false, @@ -566,11 +562,15 @@ const benefitEnrollmentTable = { customType: null as unknown as number, serverName: 'enrolled_at', }, - coverageLevel: { + id: { type: 'string', - optional: true, + optional: false, customType: null as unknown as string, - serverName: 'coverage_level', + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -579,15 +579,21 @@ const benefitEnrollmentTable = { const benefitPlanTable = { name: 'benefitPlan', columns: { + administratorId: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'administrator_id', + }, createdAt: { type: 'number', optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + description: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, }, id: { type: 'string', @@ -604,16 +610,10 @@ const benefitPlanTable = { optional: true, customType: null as unknown as string, }, - description: { - type: 'string', - optional: true, - customType: null as unknown as string, - }, - administratorId: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, - serverName: 'administrator_id', + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -622,32 +622,44 @@ const benefitPlanTable = { const billingInvoiceTable = { name: 'billingInvoice', columns: { + accountId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'account_id', + }, + contactId: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'contact_id', + }, createdAt: { type: 'number', optional: true, customType: null as unknown as number, }, - updatedAt: { + currency: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + dueDate: { type: 'number', optional: true, customType: null as unknown as number, + serverName: 'due_date', }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - accountId: { - type: 'string', + invoiceDate: { + type: 'number', optional: false, - customType: null as unknown as string, - serverName: 'account_id', - }, - contactId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'contact_id', + customType: null as unknown as number, + serverName: 'invoice_date', }, issuedById: { type: 'string', @@ -660,28 +672,16 @@ const billingInvoiceTable = { optional: false, customType: null as unknown as string, }, - invoiceDate: { + totalAmount: { type: 'number', optional: false, customType: null as unknown as number, - serverName: 'invoice_date', + serverName: 'total_amount', }, - dueDate: { + updatedAt: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'due_date', - }, - totalAmount: { - type: 'number', - optional: false, - customType: null as unknown as number, - serverName: 'total_amount', - }, - currency: { - type: 'string', - optional: false, - customType: null as unknown as string, }, }, primaryKey: ['id'], @@ -695,10 +695,10 @@ const billingInvoiceLineTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, + description: { + type: 'string', + optional: false, + customType: null as unknown as string, }, id: { type: 'string', @@ -717,11 +717,6 @@ const billingInvoiceLineTable = { customType: null as unknown as string, serverName: 'order_item_id', }, - description: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, quantity: { type: 'number', optional: false, @@ -733,6 +728,11 @@ const billingInvoiceLineTable = { customType: null as unknown as number, serverName: 'unit_price', }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], serverName: 'billing_invoice_line', @@ -745,12 +745,7 @@ const budgetTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { + currency: { type: 'string', optional: false, customType: null as unknown as string, @@ -767,16 +762,21 @@ const budgetTable = { customType: null as unknown as number, serverName: 'fiscal_year', }, + id: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, totalAmount: { type: 'number', optional: false, customType: null as unknown as number, serverName: 'total_amount', }, - currency: { - type: 'string', - optional: false, - customType: null as unknown as string, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -784,20 +784,16 @@ const budgetTable = { const budgetLineTable = { name: 'budgetLine', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { + accountId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'account_id', + }, + amount: { + type: 'number', + optional: false, + customType: null as unknown as number, }, budgetId: { type: 'string', @@ -805,15 +801,19 @@ const budgetLineTable = { customType: null as unknown as string, serverName: 'budget_id', }, - accountId: { + createdAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, + id: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'account_id', }, - amount: { + updatedAt: { type: 'number', - optional: false, + optional: true, customType: null as unknown as number, }, }, @@ -828,304 +828,294 @@ const crmAccountTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - ownerId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'owner_id', - }, - name: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - industry: { - type: 'string', - optional: true, - customType: null as unknown as string, - }, - status: { - type: 'string', - optional: true, - customType: null as unknown as string, - }, domicileCountry: { type: 'string', optional: true, customType: null as unknown as - | 'US' - | 'MX' - | 'CA' + | 'AD' + | 'AE' | 'AF' - | 'AX' + | 'AG' + | 'AI' | 'AL' - | 'DZ' - | 'AS' - | 'AD' + | 'AM' | 'AO' - | 'AI' | 'AQ' - | 'AG' | 'AR' - | 'AM' - | 'AW' - | 'AU' + | 'AS' | 'AT' + | 'AU' + | 'AW' + | 'AX' | 'AZ' - | 'BS' - | 'BH' - | 'BD' + | 'BA' | 'BB' - | 'BY' + | 'BD' | 'BE' - | 'BZ' + | 'BF' + | 'BG' + | 'BH' + | 'BI' | 'BJ' + | 'BL' | 'BM' - | 'BT' + | 'BN' | 'BO' | 'BQ' - | 'BA' - | 'BW' - | 'BV' | 'BR' - | 'IO' - | 'BN' - | 'BG' - | 'BF' - | 'BI' - | 'CV' - | 'KH' - | 'CM' - | 'KY' - | 'CF' - | 'TD' - | 'CL' - | 'CN' - | 'CX' + | 'BS' + | 'BT' + | 'BV' + | 'BW' + | 'BY' + | 'BZ' + | 'CA' | 'CC' - | 'CO' - | 'KM' - | 'CG' | 'CD' + | 'CF' + | 'CG' + | 'CH' + | 'CI' | 'CK' + | 'CL' + | 'CM' + | 'CN' + | 'CO' | 'CR' - | 'CI' - | 'HR' | 'CU' + | 'CV' | 'CW' + | 'CX' | 'CY' | 'CZ' - | 'DK' + | 'DE' | 'DJ' + | 'DK' | 'DM' | 'DO' + | 'DZ' | 'EC' + | 'EE' | 'EG' - | 'SV' - | 'GQ' + | 'EH' | 'ER' - | 'EE' - | 'SZ' + | 'ES' | 'ET' + | 'FI' + | 'FJ' | 'FK' + | 'FM' | 'FO' - | 'FJ' - | 'FI' | 'FR' - | 'GF' - | 'PF' - | 'TF' | 'GA' - | 'GM' + | 'GB' + | 'GD' | 'GE' - | 'DE' + | 'GF' + | 'GG' | 'GH' | 'GI' - | 'GR' | 'GL' - | 'GD' + | 'GM' + | 'GN' | 'GP' - | 'GU' + | 'GQ' + | 'GR' + | 'GS' | 'GT' - | 'GG' - | 'GN' + | 'GU' | 'GW' | 'GY' - | 'HT' + | 'HK' | 'HM' - | 'VA' | 'HN' - | 'HK' + | 'HR' + | 'HT' | 'HU' - | 'IS' - | 'IN' | 'ID' - | 'IR' - | 'IQ' | 'IE' - | 'IM' | 'IL' + | 'IM' + | 'IN' + | 'IO' + | 'IQ' + | 'IR' + | 'IS' | 'IT' - | 'JM' - | 'JP' | 'JE' + | 'JM' | 'JO' - | 'KZ' + | 'JP' | 'KE' + | 'KG' + | 'KH' | 'KI' + | 'KM' + | 'KN' | 'KP' | 'KR' | 'KW' - | 'KG' + | 'KY' + | 'KZ' | 'LA' - | 'LV' | 'LB' - | 'LS' - | 'LR' - | 'LY' + | 'LC' | 'LI' + | 'LK' + | 'LR' + | 'LS' | 'LT' | 'LU' - | 'MO' + | 'LV' + | 'LY' + | 'MA' + | 'MC' + | 'MD' + | 'ME' + | 'MF' | 'MG' - | 'MW' - | 'MY' - | 'MV' - | 'ML' - | 'MT' | 'MH' + | 'MK' + | 'ML' + | 'MM' + | 'MN' + | 'MO' + | 'MP' | 'MQ' | 'MR' - | 'MU' - | 'YT' - | 'FM' - | 'MD' - | 'MC' - | 'MN' - | 'ME' | 'MS' - | 'MA' + | 'MT' + | 'MU' + | 'MV' + | 'MW' + | 'MX' + | 'MY' | 'MZ' - | 'MM' | 'NA' - | 'NR' - | 'NP' - | 'NL' | 'NC' - | 'NZ' - | 'NI' | 'NE' - | 'NG' - | 'NU' | 'NF' - | 'MK' - | 'MP' + | 'NG' + | 'NI' + | 'NL' | 'NO' + | 'NP' + | 'NR' + | 'NU' + | 'NZ' | 'OM' - | 'PK' - | 'PW' - | 'PS' | 'PA' - | 'PG' - | 'PY' | 'PE' + | 'PF' + | 'PG' | 'PH' - | 'PN' + | 'PK' | 'PL' - | 'PT' + | 'PM' + | 'PN' | 'PR' + | 'PS' + | 'PT' + | 'PW' + | 'PY' | 'QA' | 'RE' | 'RO' + | 'RS' | 'RU' | 'RW' - | 'BL' - | 'SH' - | 'KN' - | 'LC' - | 'MF' - | 'PM' - | 'VC' - | 'WS' - | 'SM' - | 'ST' | 'SA' - | 'SN' - | 'RS' + | 'SB' | 'SC' - | 'SL' + | 'SD' + | 'SE' | 'SG' - | 'SX' - | 'SK' + | 'SH' | 'SI' - | 'SB' + | 'SJ' + | 'SK' + | 'SL' + | 'SM' + | 'SN' | 'SO' - | 'ZA' - | 'GS' - | 'SS' - | 'ES' - | 'LK' - | 'SD' | 'SR' - | 'SJ' - | 'SE' - | 'CH' + | 'SS' + | 'ST' + | 'SV' + | 'SX' | 'SY' - | 'TW' - | 'TJ' - | 'TZ' - | 'TH' - | 'TL' + | 'SZ' + | 'TC' + | 'TD' + | 'TF' | 'TG' + | 'TH' + | 'TJ' | 'TK' - | 'TO' - | 'TT' + | 'TL' + | 'TM' | 'TN' + | 'TO' | 'TR' - | 'TM' - | 'TC' + | 'TT' | 'TV' - | 'UG' + | 'TW' + | 'TZ' | 'UA' - | 'AE' - | 'GB' + | 'UG' + | 'US' | 'UY' | 'UZ' - | 'VU' + | 'VA' + | 'VC' | 'VE' - | 'VN' | 'VG' | 'VI' + | 'VN' + | 'VU' | 'WF' - | 'EH' + | 'WS' + | 'XK' | 'YE' + | 'YT' + | 'ZA' | 'ZM' | 'ZW' - | 'XK' | null, serverName: 'domicile_country', }, - reportingCurrency: { + id: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + industry: { type: 'string', optional: true, - customType: null as unknown as - | 'AED' - | 'AFN' - | 'ALL' - | 'AMD' - | 'ANG' - | 'AOA' - | 'ARS' + customType: null as unknown as string, + }, + name: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + ownerId: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'owner_id', + }, + reportingCurrency: { + type: 'string', + optional: true, + customType: null as unknown as + | 'AED' + | 'AFN' + | 'ALL' + | 'AMD' + | 'ANG' + | 'AOA' + | 'ARS' | 'AUD' | 'AWG' | 'AZN' @@ -1291,6 +1281,16 @@ const crmAccountTable = { | null, serverName: 'reporting_currency', }, + status: { + type: 'string', + optional: true, + customType: null as unknown as string, + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], serverName: 'crm_account', @@ -1298,12 +1298,19 @@ const crmAccountTable = { const crmActivityTable = { name: 'crmActivity', columns: { - createdAt: { - type: 'number', + accountId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'account_id', + }, + contactId: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, + serverName: 'contact_id', }, - updatedAt: { + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -1313,17 +1320,10 @@ const crmActivityTable = { optional: false, customType: null as unknown as string, }, - accountId: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'account_id', - }, - contactId: { + notes: { type: 'string', optional: true, customType: null as unknown as string, - serverName: 'contact_id', }, opportunityId: { type: 'string', @@ -1331,22 +1331,22 @@ const crmActivityTable = { customType: null as unknown as string, serverName: 'opportunity_id', }, - typeId: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'type_id', - }, performedById: { type: 'string', optional: true, customType: null as unknown as string, serverName: 'performed_by_id', }, - notes: { + typeId: { type: 'string', - optional: true, + optional: false, customType: null as unknown as string, + serverName: 'type_id', + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -1360,10 +1360,10 @@ const crmActivityTypeTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + description: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, }, id: { type: 'string', @@ -1375,10 +1375,10 @@ const crmActivityTypeTable = { optional: false, customType: null as unknown as string, }, - description: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -1387,363 +1387,363 @@ const crmActivityTypeTable = { const crmContactTable = { name: 'crmContact', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, accountId: { type: 'string', optional: false, customType: null as unknown as string, serverName: 'account_id', }, - firstName: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'first_name', - }, - lastName: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'last_name', - }, - email: { - type: 'string', - optional: true, - customType: null as unknown as string, - }, - phone: { - type: 'string', - optional: true, - customType: null as unknown as string, - }, countryIso: { type: 'string', optional: true, customType: null as unknown as - | 'US' - | 'MX' - | 'CA' + | 'AD' + | 'AE' | 'AF' - | 'AX' + | 'AG' + | 'AI' | 'AL' - | 'DZ' - | 'AS' - | 'AD' + | 'AM' | 'AO' - | 'AI' | 'AQ' - | 'AG' | 'AR' - | 'AM' - | 'AW' - | 'AU' + | 'AS' | 'AT' + | 'AU' + | 'AW' + | 'AX' | 'AZ' - | 'BS' - | 'BH' - | 'BD' + | 'BA' | 'BB' - | 'BY' + | 'BD' | 'BE' - | 'BZ' + | 'BF' + | 'BG' + | 'BH' + | 'BI' | 'BJ' + | 'BL' | 'BM' - | 'BT' + | 'BN' | 'BO' | 'BQ' - | 'BA' - | 'BW' - | 'BV' | 'BR' - | 'IO' - | 'BN' - | 'BG' - | 'BF' - | 'BI' - | 'CV' - | 'KH' - | 'CM' - | 'KY' + | 'BS' + | 'BT' + | 'BV' + | 'BW' + | 'BY' + | 'BZ' + | 'CA' + | 'CC' + | 'CD' | 'CF' - | 'TD' + | 'CG' + | 'CH' + | 'CI' + | 'CK' | 'CL' + | 'CM' | 'CN' - | 'CX' - | 'CC' | 'CO' - | 'KM' - | 'CG' - | 'CD' - | 'CK' | 'CR' - | 'CI' - | 'HR' | 'CU' + | 'CV' | 'CW' + | 'CX' | 'CY' | 'CZ' - | 'DK' + | 'DE' | 'DJ' + | 'DK' | 'DM' | 'DO' + | 'DZ' | 'EC' + | 'EE' | 'EG' - | 'SV' - | 'GQ' + | 'EH' | 'ER' - | 'EE' - | 'SZ' + | 'ES' | 'ET' + | 'FI' + | 'FJ' | 'FK' + | 'FM' | 'FO' - | 'FJ' - | 'FI' | 'FR' - | 'GF' - | 'PF' - | 'TF' | 'GA' - | 'GM' + | 'GB' + | 'GD' | 'GE' - | 'DE' + | 'GF' + | 'GG' | 'GH' | 'GI' - | 'GR' | 'GL' - | 'GD' + | 'GM' + | 'GN' | 'GP' - | 'GU' + | 'GQ' + | 'GR' + | 'GS' | 'GT' - | 'GG' - | 'GN' + | 'GU' | 'GW' | 'GY' - | 'HT' + | 'HK' | 'HM' - | 'VA' | 'HN' - | 'HK' + | 'HR' + | 'HT' | 'HU' - | 'IS' - | 'IN' | 'ID' - | 'IR' - | 'IQ' | 'IE' - | 'IM' | 'IL' + | 'IM' + | 'IN' + | 'IO' + | 'IQ' + | 'IR' + | 'IS' | 'IT' - | 'JM' - | 'JP' | 'JE' + | 'JM' | 'JO' - | 'KZ' + | 'JP' | 'KE' + | 'KG' + | 'KH' | 'KI' - | 'KP' + | 'KM' + | 'KN' + | 'KP' | 'KR' | 'KW' - | 'KG' + | 'KY' + | 'KZ' | 'LA' - | 'LV' | 'LB' - | 'LS' - | 'LR' - | 'LY' + | 'LC' | 'LI' + | 'LK' + | 'LR' + | 'LS' | 'LT' | 'LU' - | 'MO' + | 'LV' + | 'LY' + | 'MA' + | 'MC' + | 'MD' + | 'ME' + | 'MF' | 'MG' - | 'MW' - | 'MY' - | 'MV' - | 'ML' - | 'MT' | 'MH' + | 'MK' + | 'ML' + | 'MM' + | 'MN' + | 'MO' + | 'MP' | 'MQ' | 'MR' - | 'MU' - | 'YT' - | 'FM' - | 'MD' - | 'MC' - | 'MN' - | 'ME' | 'MS' - | 'MA' + | 'MT' + | 'MU' + | 'MV' + | 'MW' + | 'MX' + | 'MY' | 'MZ' - | 'MM' | 'NA' - | 'NR' - | 'NP' - | 'NL' | 'NC' - | 'NZ' - | 'NI' | 'NE' - | 'NG' - | 'NU' | 'NF' - | 'MK' - | 'MP' + | 'NG' + | 'NI' + | 'NL' | 'NO' + | 'NP' + | 'NR' + | 'NU' + | 'NZ' | 'OM' - | 'PK' - | 'PW' - | 'PS' | 'PA' - | 'PG' - | 'PY' | 'PE' + | 'PF' + | 'PG' | 'PH' - | 'PN' + | 'PK' | 'PL' - | 'PT' + | 'PM' + | 'PN' | 'PR' + | 'PS' + | 'PT' + | 'PW' + | 'PY' | 'QA' | 'RE' | 'RO' + | 'RS' | 'RU' | 'RW' - | 'BL' - | 'SH' - | 'KN' - | 'LC' - | 'MF' - | 'PM' - | 'VC' - | 'WS' - | 'SM' - | 'ST' | 'SA' - | 'SN' - | 'RS' + | 'SB' | 'SC' - | 'SL' + | 'SD' + | 'SE' | 'SG' - | 'SX' - | 'SK' + | 'SH' | 'SI' - | 'SB' + | 'SJ' + | 'SK' + | 'SL' + | 'SM' + | 'SN' | 'SO' - | 'ZA' - | 'GS' - | 'SS' - | 'ES' - | 'LK' - | 'SD' | 'SR' - | 'SJ' - | 'SE' - | 'CH' + | 'SS' + | 'ST' + | 'SV' + | 'SX' | 'SY' - | 'TW' - | 'TJ' - | 'TZ' - | 'TH' - | 'TL' + | 'SZ' + | 'TC' + | 'TD' + | 'TF' | 'TG' + | 'TH' + | 'TJ' | 'TK' - | 'TO' - | 'TT' + | 'TL' + | 'TM' | 'TN' + | 'TO' | 'TR' - | 'TM' - | 'TC' + | 'TT' | 'TV' - | 'UG' + | 'TW' + | 'TZ' | 'UA' - | 'AE' - | 'GB' + | 'UG' + | 'US' | 'UY' | 'UZ' - | 'VU' + | 'VA' + | 'VC' | 'VE' - | 'VN' | 'VG' | 'VI' + | 'VN' + | 'VU' | 'WF' - | 'EH' + | 'WS' + | 'XK' | 'YE' + | 'YT' + | 'ZA' | 'ZM' | 'ZW' - | 'XK' | null, serverName: 'country_iso', }, + createdAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, + email: { + type: 'string', + optional: true, + customType: null as unknown as string, + }, + firstName: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'first_name', + }, + id: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + lastName: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'last_name', + }, + phone: { + type: 'string', + optional: true, + customType: null as unknown as string, + }, stateCode: { type: 'string', optional: true, customType: null as unknown as - | 'CA' + | 'AK' | 'AL' | 'AR' | 'AZ' - | 'KY' + | 'CA' | 'CO' - | 'GA' + | 'CT' + | 'DC' | 'DE' - | 'VA' - | 'IN' + | 'FL' + | 'GA' + | 'HI' + | 'IA' | 'ID' | 'IL' + | 'IN' + | 'KS' + | 'KY' | 'LA' - | 'MO' - | 'MT' + | 'MA' | 'MD' - | 'MN' | 'ME' + | 'MI' + | 'MN' + | 'MO' | 'MS' - | 'MA' + | 'MT' | 'NC' + | 'ND' | 'NE' - | 'PA' - | 'SC' - | 'SD' - | 'TN' - | 'AK' - | 'CT' - | 'DC' - | 'FL' - | 'HI' - | 'IA' - | 'KS' - | 'MI' - | 'NV' | 'NH' | 'NJ' | 'NM' + | 'NV' | 'NY' - | 'ND' | 'OH' | 'OK' | 'OR' + | 'PA' | 'RI' + | 'SC' + | 'SD' + | 'TN' | 'TX' | 'UT' + | 'VA' | 'VT' | 'WA' - | 'WV' | 'WI' + | 'WV' | 'WY' | null, serverName: 'state_code', }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], serverName: 'crm_contact', @@ -1751,26 +1751,22 @@ const crmContactTable = { const crmNoteTable = { name: 'crmNote', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { + accountId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'account_id', }, - accountId: { + authorId: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'author_id', + }, + body: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'account_id', }, contactId: { type: 'string', @@ -1778,17 +1774,21 @@ const crmNoteTable = { customType: null as unknown as string, serverName: 'contact_id', }, - authorId: { - type: 'string', + createdAt: { + type: 'number', optional: true, - customType: null as unknown as string, - serverName: 'author_id', + customType: null as unknown as number, }, - body: { + id: { type: 'string', optional: false, customType: null as unknown as string, }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], serverName: 'crm_note', @@ -1796,12 +1796,24 @@ const crmNoteTable = { const crmOpportunityTable = { name: 'crmOpportunity', columns: { - createdAt: { + accountId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'account_id', + }, + amount: { type: 'number', optional: true, customType: null as unknown as number, }, - updatedAt: { + closeDate: { + type: 'number', + optional: true, + customType: null as unknown as number, + serverName: 'close_date', + }, + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -1811,11 +1823,10 @@ const crmOpportunityTable = { optional: false, customType: null as unknown as string, }, - accountId: { + name: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'account_id', }, stageId: { type: 'string', @@ -1823,21 +1834,10 @@ const crmOpportunityTable = { customType: null as unknown as string, serverName: 'stage_id', }, - name: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - amount: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - closeDate: { + updatedAt: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'close_date', }, }, primaryKey: ['id'], @@ -1846,12 +1846,19 @@ const crmOpportunityTable = { const crmOpportunityStageHistoryTable = { name: 'crmOpportunityStageHistory', columns: { - createdAt: { + changedAt: { type: 'number', optional: true, customType: null as unknown as number, + serverName: 'changed_at', }, - updatedAt: { + changedById: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'changed_by_id', + }, + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -1873,17 +1880,10 @@ const crmOpportunityStageHistoryTable = { customType: null as unknown as string, serverName: 'stage_id', }, - changedById: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'changed_by_id', - }, - changedAt: { + updatedAt: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'changed_at', }, }, primaryKey: ['id'], @@ -1897,11 +1897,6 @@ const crmPipelineStageTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, id: { type: 'string', optional: false, @@ -1912,12 +1907,17 @@ const crmPipelineStageTable = { optional: false, customType: null as unknown as string, }, + probability: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, sequence: { type: 'number', optional: false, customType: null as unknown as number, }, - probability: { + updatedAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -1934,31 +1934,31 @@ const departmentTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + description: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - name: { + managerId: { type: 'string', - optional: false, + optional: true, customType: null as unknown as string, + serverName: 'manager_id', }, - description: { + name: { type: 'string', - optional: true, + optional: false, customType: null as unknown as string, }, - managerId: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, - serverName: 'manager_id', + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -1971,15 +1971,11 @@ const documentFileTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { + fileName: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'file_name', }, folderId: { type: 'string', @@ -1987,17 +1983,10 @@ const documentFileTable = { customType: null as unknown as string, serverName: 'folder_id', }, - uploadedById: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'uploaded_by_id', - }, - fileName: { + id: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'file_name', }, mimeType: { type: 'string', @@ -2011,6 +2000,17 @@ const documentFileTable = { customType: null as unknown as number, serverName: 'size_bytes', }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, + uploadedById: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'uploaded_by_id', + }, version: { type: 'number', optional: true, @@ -2023,26 +2023,38 @@ const documentFileTable = { const documentFileVersionTable = { name: 'documentFileVersion', columns: { + changeLog: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'change_log', + }, createdAt: { type: 'number', optional: true, customType: null as unknown as number, }, - updatedAt: { + fileId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'file_id', + }, + fileSizeBytes: { type: 'number', optional: true, customType: null as unknown as number, + serverName: 'file_size_bytes', }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - fileId: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'file_id', + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, uploadedById: { type: 'string', @@ -2055,18 +2067,6 @@ const documentFileVersionTable = { optional: false, customType: null as unknown as number, }, - changeLog: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'change_log', - }, - fileSizeBytes: { - type: 'number', - optional: true, - customType: null as unknown as number, - serverName: 'file_size_bytes', - }, }, primaryKey: ['id'], serverName: 'document_file_version', @@ -2079,11 +2079,6 @@ const documentFolderTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, id: { type: 'string', optional: false, @@ -2095,16 +2090,21 @@ const documentFolderTable = { customType: null as unknown as string, serverName: 'library_id', }, + name: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, parentId: { type: 'string', optional: true, customType: null as unknown as string, serverName: 'parent_id', }, - name: { - type: 'string', - optional: false, - customType: null as unknown as string, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -2118,31 +2118,31 @@ const documentLibraryTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + description: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - projectId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'project_id', - }, name: { type: 'string', optional: false, customType: null as unknown as string, }, - description: { + projectId: { type: 'string', optional: true, customType: null as unknown as string, + serverName: 'project_id', + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, visibility: { type: 'string', @@ -2161,27 +2161,21 @@ const documentSharingTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { + fileId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'file_id', }, - fileId: { + id: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'file_id', }, - sharedWithUserId: { + permission: { type: 'string', - optional: true, + optional: false, customType: null as unknown as string, - serverName: 'shared_with_user_id', }, sharedWithTeamId: { type: 'string', @@ -2189,10 +2183,16 @@ const documentSharingTable = { customType: null as unknown as string, serverName: 'shared_with_team_id', }, - permission: { + sharedWithUserId: { type: 'string', - optional: false, + optional: true, customType: null as unknown as string, + serverName: 'shared_with_user_id', + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -2206,15 +2206,11 @@ const employeeDocumentTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { + documentType: { type: 'string', - optional: false, + optional: true, customType: null as unknown as string, + serverName: 'document_type', }, employeeId: { type: 'string', @@ -2228,11 +2224,15 @@ const employeeDocumentTable = { customType: null as unknown as string, serverName: 'file_name', }, - documentType: { + id: { type: 'string', - optional: true, + optional: false, customType: null as unknown as string, - serverName: 'document_type', + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, uploadedById: { type: 'string', @@ -2252,27 +2252,28 @@ const employeeProfileTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + departmentId: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, + serverName: 'department_id', }, - id: { + employmentType: { type: 'string', - optional: false, + optional: true, customType: null as unknown as string, + serverName: 'employment_type', }, - userId: { + id: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'user_id', }, - departmentId: { - type: 'string', + startDate: { + type: 'number', optional: true, - customType: null as unknown as string, - serverName: 'department_id', + customType: null as unknown as number, + serverName: 'start_date', }, teamId: { type: 'string', @@ -2285,17 +2286,16 @@ const employeeProfileTable = { optional: true, customType: null as unknown as string, }, - startDate: { + updatedAt: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'start_date', }, - employmentType: { + userId: { type: 'string', - optional: true, + optional: false, customType: null as unknown as string, - serverName: 'employment_type', + serverName: 'user_id', }, }, primaryKey: ['id'], @@ -2304,33 +2304,29 @@ const employeeProfileTable = { const employmentHistoryTable = { name: 'employmentHistory', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, + company: { + type: 'string', + optional: false, + customType: null as unknown as string, }, - updatedAt: { + createdAt: { type: 'number', optional: true, customType: null as unknown as number, }, - id: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, employeeId: { type: 'string', optional: false, customType: null as unknown as string, serverName: 'employee_id', }, - company: { - type: 'string', - optional: false, - customType: null as unknown as string, + endDate: { + type: 'number', + optional: true, + customType: null as unknown as number, + serverName: 'end_date', }, - title: { + id: { type: 'string', optional: false, customType: null as unknown as string, @@ -2341,11 +2337,15 @@ const employmentHistoryTable = { customType: null as unknown as number, serverName: 'start_date', }, - endDate: { + title: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + updatedAt: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'end_date', }, }, primaryKey: ['id'], @@ -2354,33 +2354,22 @@ const employmentHistoryTable = { const expenseItemTable = { name: 'expenseItem', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - updatedAt: { + amount: { type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { - type: 'string', optional: false, - customType: null as unknown as string, + customType: null as unknown as number, }, - reportId: { + category: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'report_id', }, - amount: { + createdAt: { type: 'number', - optional: false, + optional: true, customType: null as unknown as number, }, - category: { + id: { type: 'string', optional: false, customType: null as unknown as string, @@ -2401,6 +2390,17 @@ const expenseItemTable = { optional: true, customType: null as unknown as string, }, + reportId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'report_id', + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], serverName: 'expense_item', @@ -2413,10 +2413,11 @@ const expenseReportTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + departmentId: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, + serverName: 'department_id', }, id: { type: 'string', @@ -2429,12 +2430,6 @@ const expenseReportTable = { customType: null as unknown as string, serverName: 'owner_id', }, - departmentId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'department_id', - }, status: { type: 'string', optional: false, @@ -2446,6 +2441,11 @@ const expenseReportTable = { customType: null as unknown as number, serverName: 'submitted_at', }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], serverName: 'expense_report', @@ -2475,20 +2475,20 @@ const filtersTable = { const friendshipTable = { name: 'friendship', columns: { - requestingId: { - type: 'string', + accepted: { + type: 'boolean', optional: false, - customType: null as unknown as string, + customType: null as unknown as boolean, }, acceptingId: { type: 'string', optional: false, customType: null as unknown as string, }, - accepted: { - type: 'boolean', + requestingId: { + type: 'string', optional: false, - customType: null as unknown as boolean, + customType: null as unknown as string, }, }, primaryKey: ['requestingId', 'acceptingId'], @@ -2496,12 +2496,19 @@ const friendshipTable = { const integrationCredentialTable = { name: 'integrationCredential', columns: { - createdAt: { - type: 'number', + clientId: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, + serverName: 'client_id', }, - updatedAt: { + clientSecret: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'client_secret', + }, + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -2511,33 +2518,26 @@ const integrationCredentialTable = { optional: false, customType: null as unknown as string, }, - webhookId: { - type: 'string', + metadata: { + type: 'json', optional: true, - customType: null as unknown as string, - serverName: 'webhook_id', + customType: null as unknown as ReadonlyJSONValue, }, provider: { type: 'string', optional: false, customType: null as unknown as string, }, - clientId: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, - serverName: 'client_id', + customType: null as unknown as number, }, - clientSecret: { + webhookId: { type: 'string', optional: true, customType: null as unknown as string, - serverName: 'client_secret', - }, - metadata: { - type: 'json', - optional: true, - customType: null as unknown as ReadonlyJSONValue, + serverName: 'webhook_id', }, }, primaryKey: ['id'], @@ -2551,43 +2551,43 @@ const integrationEventTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { + deliveredAt: { type: 'number', optional: true, customType: null as unknown as number, + serverName: 'delivered_at', }, - id: { + eventType: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'event_type', }, - webhookId: { + id: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'webhook_id', }, payload: { type: 'json', optional: true, customType: null as unknown as ReadonlyJSONValue, }, - eventType: { + status: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'event_type', }, - deliveredAt: { + updatedAt: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'delivered_at', }, - status: { + webhookId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'webhook_id', }, }, primaryKey: ['id'], @@ -2596,12 +2596,13 @@ const integrationEventTable = { const integrationWebhookTable = { name: 'integrationWebhook', columns: { - createdAt: { - type: 'number', + accountId: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, + serverName: 'account_id', }, - updatedAt: { + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -2611,38 +2612,37 @@ const integrationWebhookTable = { optional: false, customType: null as unknown as string, }, - projectId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'project_id', - }, - accountId: { - type: 'string', + isActive: { + type: 'boolean', optional: true, - customType: null as unknown as string, - serverName: 'account_id', + customType: null as unknown as boolean, + serverName: 'is_active', }, name: { type: 'string', optional: false, customType: null as unknown as string, }, - url: { + projectId: { type: 'string', - optional: false, + optional: true, customType: null as unknown as string, + serverName: 'project_id', }, secret: { type: 'string', optional: true, customType: null as unknown as string, }, - isActive: { - type: 'boolean', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as boolean, - serverName: 'is_active', + customType: null as unknown as number, + }, + url: { + type: 'string', + optional: false, + customType: null as unknown as string, }, }, primaryKey: ['id'], @@ -2656,21 +2656,15 @@ const inventoryItemTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - variantId: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'variant_id', + metadata: { + type: 'json', + optional: true, + customType: null as unknown as ReadonlyJSONValue, }, serialNumber: { type: 'string', @@ -2678,10 +2672,16 @@ const inventoryItemTable = { customType: null as unknown as string, serverName: 'serial_number', }, - metadata: { - type: 'json', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as ReadonlyJSONValue, + customType: null as unknown as number, + }, + variantId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'variant_id', }, }, primaryKey: ['id'], @@ -2695,11 +2695,6 @@ const inventoryLevelTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, id: { type: 'string', optional: false, @@ -2711,12 +2706,6 @@ const inventoryLevelTable = { customType: null as unknown as string, serverName: 'location_id', }, - variantId: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'variant_id', - }, quantity: { type: 'number', optional: false, @@ -2727,336 +2716,342 @@ const inventoryLevelTable = { optional: true, customType: null as unknown as number, }, - }, - primaryKey: ['id'], - serverName: 'inventory_level', -} as const; -const inventoryLocationTable = { - name: 'inventoryLocation', - columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, updatedAt: { type: 'number', optional: true, customType: null as unknown as number, }, - id: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - name: { + variantId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'variant_id', }, + }, + primaryKey: ['id'], + serverName: 'inventory_level', +} as const; +const inventoryLocationTable = { + name: 'inventoryLocation', + columns: { address: { type: 'string', optional: true, customType: null as unknown as string, }, - region: { - type: 'string', - optional: true, - customType: null as unknown as string, - }, countryIso: { type: 'string', optional: true, customType: null as unknown as - | 'US' - | 'MX' - | 'CA' + | 'AD' + | 'AE' | 'AF' - | 'AX' + | 'AG' + | 'AI' | 'AL' - | 'DZ' - | 'AS' - | 'AD' + | 'AM' | 'AO' - | 'AI' | 'AQ' - | 'AG' | 'AR' - | 'AM' - | 'AW' - | 'AU' + | 'AS' | 'AT' + | 'AU' + | 'AW' + | 'AX' | 'AZ' - | 'BS' - | 'BH' - | 'BD' + | 'BA' | 'BB' - | 'BY' + | 'BD' | 'BE' - | 'BZ' + | 'BF' + | 'BG' + | 'BH' + | 'BI' | 'BJ' + | 'BL' | 'BM' - | 'BT' + | 'BN' | 'BO' | 'BQ' - | 'BA' - | 'BW' - | 'BV' | 'BR' - | 'IO' - | 'BN' - | 'BG' - | 'BF' - | 'BI' - | 'CV' - | 'KH' - | 'CM' - | 'KY' + | 'BS' + | 'BT' + | 'BV' + | 'BW' + | 'BY' + | 'BZ' + | 'CA' + | 'CC' + | 'CD' | 'CF' - | 'TD' + | 'CG' + | 'CH' + | 'CI' + | 'CK' | 'CL' + | 'CM' | 'CN' - | 'CX' - | 'CC' | 'CO' - | 'KM' - | 'CG' - | 'CD' - | 'CK' | 'CR' - | 'CI' - | 'HR' | 'CU' + | 'CV' | 'CW' + | 'CX' | 'CY' | 'CZ' - | 'DK' + | 'DE' | 'DJ' + | 'DK' | 'DM' | 'DO' + | 'DZ' | 'EC' + | 'EE' | 'EG' - | 'SV' - | 'GQ' + | 'EH' | 'ER' - | 'EE' - | 'SZ' + | 'ES' | 'ET' + | 'FI' + | 'FJ' | 'FK' + | 'FM' | 'FO' - | 'FJ' - | 'FI' | 'FR' - | 'GF' - | 'PF' - | 'TF' | 'GA' - | 'GM' + | 'GB' + | 'GD' | 'GE' - | 'DE' + | 'GF' + | 'GG' | 'GH' | 'GI' - | 'GR' | 'GL' - | 'GD' + | 'GM' + | 'GN' | 'GP' - | 'GU' + | 'GQ' + | 'GR' + | 'GS' | 'GT' - | 'GG' - | 'GN' + | 'GU' | 'GW' | 'GY' - | 'HT' + | 'HK' | 'HM' - | 'VA' | 'HN' - | 'HK' + | 'HR' + | 'HT' | 'HU' - | 'IS' - | 'IN' | 'ID' - | 'IR' - | 'IQ' | 'IE' - | 'IM' | 'IL' + | 'IM' + | 'IN' + | 'IO' + | 'IQ' + | 'IR' + | 'IS' | 'IT' - | 'JM' - | 'JP' | 'JE' + | 'JM' | 'JO' - | 'KZ' + | 'JP' | 'KE' + | 'KG' + | 'KH' | 'KI' + | 'KM' + | 'KN' | 'KP' | 'KR' | 'KW' - | 'KG' + | 'KY' + | 'KZ' | 'LA' - | 'LV' | 'LB' - | 'LS' - | 'LR' - | 'LY' + | 'LC' | 'LI' + | 'LK' + | 'LR' + | 'LS' | 'LT' | 'LU' - | 'MO' + | 'LV' + | 'LY' + | 'MA' + | 'MC' + | 'MD' + | 'ME' + | 'MF' | 'MG' - | 'MW' - | 'MY' - | 'MV' - | 'ML' - | 'MT' | 'MH' + | 'MK' + | 'ML' + | 'MM' + | 'MN' + | 'MO' + | 'MP' | 'MQ' | 'MR' - | 'MU' - | 'YT' - | 'FM' - | 'MD' - | 'MC' - | 'MN' - | 'ME' | 'MS' - | 'MA' + | 'MT' + | 'MU' + | 'MV' + | 'MW' + | 'MX' + | 'MY' | 'MZ' - | 'MM' | 'NA' - | 'NR' - | 'NP' - | 'NL' | 'NC' - | 'NZ' - | 'NI' | 'NE' - | 'NG' - | 'NU' | 'NF' - | 'MK' - | 'MP' + | 'NG' + | 'NI' + | 'NL' | 'NO' + | 'NP' + | 'NR' + | 'NU' + | 'NZ' | 'OM' - | 'PK' - | 'PW' - | 'PS' | 'PA' - | 'PG' - | 'PY' | 'PE' + | 'PF' + | 'PG' | 'PH' - | 'PN' + | 'PK' | 'PL' - | 'PT' + | 'PM' + | 'PN' | 'PR' + | 'PS' + | 'PT' + | 'PW' + | 'PY' | 'QA' | 'RE' | 'RO' + | 'RS' | 'RU' | 'RW' - | 'BL' - | 'SH' - | 'KN' - | 'LC' - | 'MF' - | 'PM' - | 'VC' - | 'WS' - | 'SM' - | 'ST' | 'SA' - | 'SN' - | 'RS' + | 'SB' | 'SC' - | 'SL' + | 'SD' + | 'SE' | 'SG' - | 'SX' - | 'SK' + | 'SH' | 'SI' - | 'SB' + | 'SJ' + | 'SK' + | 'SL' + | 'SM' + | 'SN' | 'SO' - | 'ZA' - | 'GS' - | 'SS' - | 'ES' - | 'LK' - | 'SD' | 'SR' - | 'SJ' - | 'SE' - | 'CH' + | 'SS' + | 'ST' + | 'SV' + | 'SX' | 'SY' - | 'TW' - | 'TJ' - | 'TZ' - | 'TH' - | 'TL' + | 'SZ' + | 'TC' + | 'TD' + | 'TF' | 'TG' + | 'TH' + | 'TJ' | 'TK' - | 'TO' - | 'TT' + | 'TL' + | 'TM' | 'TN' + | 'TO' | 'TR' - | 'TM' - | 'TC' + | 'TT' | 'TV' - | 'UG' + | 'TW' + | 'TZ' | 'UA' - | 'AE' - | 'GB' + | 'UG' + | 'US' | 'UY' | 'UZ' - | 'VU' + | 'VA' + | 'VC' | 'VE' - | 'VN' | 'VG' | 'VI' + | 'VN' + | 'VU' | 'WF' - | 'EH' + | 'WS' + | 'XK' | 'YE' + | 'YT' + | 'ZA' | 'ZM' | 'ZW' - | 'XK' | null, serverName: 'country_iso', }, - }, - primaryKey: ['id'], - serverName: 'inventory_location', -} as const; -const ledgerAccountTable = { - name: 'ledgerAccount', - columns: { createdAt: { type: 'number', optional: true, customType: null as unknown as number, }, + id: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + name: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + region: { + type: 'string', + optional: true, + customType: null as unknown as string, + }, updatedAt: { type: 'number', optional: true, customType: null as unknown as number, }, - id: { + }, + primaryKey: ['id'], + serverName: 'inventory_location', +} as const; +const ledgerAccountTable = { + name: 'ledgerAccount', + columns: { + accountType: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'account_type', }, - name: { + code: { type: 'string', optional: false, customType: null as unknown as string, }, - code: { + createdAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, + id: { type: 'string', optional: false, customType: null as unknown as string, }, - accountType: { + name: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'account_type', }, parentAccountId: { type: 'string', @@ -3064,6 +3059,11 @@ const ledgerAccountTable = { customType: null as unknown as string, serverName: 'parent_account_id', }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], serverName: 'ledger_account', @@ -3071,12 +3071,23 @@ const ledgerAccountTable = { const ledgerEntryTable = { name: 'ledgerEntry', columns: { + accountId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'account_id', + }, createdAt: { type: 'number', optional: true, customType: null as unknown as number, }, - updatedAt: { + credit: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, + debit: { type: 'number', optional: true, customType: null as unknown as number, @@ -3086,33 +3097,22 @@ const ledgerEntryTable = { optional: false, customType: null as unknown as string, }, - transactionId: { + memo: { type: 'string', - optional: false, + optional: true, customType: null as unknown as string, - serverName: 'transaction_id', }, - accountId: { + transactionId: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'account_id', - }, - debit: { - type: 'number', - optional: true, - customType: null as unknown as number, + serverName: 'transaction_id', }, - credit: { + updatedAt: { type: 'number', optional: true, customType: null as unknown as number, }, - memo: { - type: 'string', - optional: true, - customType: null as unknown as string, - }, }, primaryKey: ['id'], serverName: 'ledger_entry', @@ -3125,10 +3125,16 @@ const ledgerTransactionTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + createdById: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, + serverName: 'created_by_id', + }, + description: { + type: 'string', + optional: true, + customType: null as unknown as string, }, id: { type: 'string', @@ -3146,16 +3152,10 @@ const ledgerTransactionTable = { customType: null as unknown as number, serverName: 'transaction_date', }, - createdById: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'created_by_id', - }, - description: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -3169,10 +3169,10 @@ const marketingAudienceTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + definition: { + type: 'json', optional: true, - customType: null as unknown as number, + customType: null as unknown as ReadonlyJSONValue, }, id: { type: 'string', @@ -3190,10 +3190,10 @@ const marketingAudienceTable = { customType: null as unknown as string, serverName: 'segment_type', }, - definition: { - type: 'json', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as ReadonlyJSONValue, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -3202,36 +3202,38 @@ const marketingAudienceTable = { const marketingCampaignTable = { name: 'marketingCampaign', columns: { + budgetAmount: { + type: 'number', + optional: true, + customType: null as unknown as number, + serverName: 'budget_amount', + }, createdAt: { type: 'number', optional: true, customType: null as unknown as number, }, - updatedAt: { + endDate: { type: 'number', optional: true, customType: null as unknown as number, + serverName: 'end_date', }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - ownerId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'owner_id', - }, name: { type: 'string', optional: false, customType: null as unknown as string, }, - status: { + ownerId: { type: 'string', - optional: false, + optional: true, customType: null as unknown as string, + serverName: 'owner_id', }, startDate: { type: 'number', @@ -3239,17 +3241,15 @@ const marketingCampaignTable = { customType: null as unknown as number, serverName: 'start_date', }, - endDate: { - type: 'number', - optional: true, - customType: null as unknown as number, - serverName: 'end_date', + status: { + type: 'string', + optional: false, + customType: null as unknown as string, }, - budgetAmount: { + updatedAt: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'budget_amount', }, }, primaryKey: ['id'], @@ -3258,20 +3258,11 @@ const marketingCampaignTable = { const marketingCampaignAudienceTable = { name: 'marketingCampaignAudience', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { + audienceId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'audience_id', }, campaignId: { type: 'string', @@ -3279,11 +3270,20 @@ const marketingCampaignAudienceTable = { customType: null as unknown as string, serverName: 'campaign_id', }, - audienceId: { + createdAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, + id: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'audience_id', + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -3292,21 +3292,11 @@ const marketingCampaignAudienceTable = { const marketingCampaignChannelTable = { name: 'marketingCampaignChannel', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - updatedAt: { + allocation: { type: 'number', optional: true, customType: null as unknown as number, }, - id: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, campaignId: { type: 'string', optional: false, @@ -3319,7 +3309,17 @@ const marketingCampaignChannelTable = { customType: null as unknown as string, serverName: 'channel_id', }, - allocation: { + createdAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, + id: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + updatedAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -3331,12 +3331,19 @@ const marketingCampaignChannelTable = { const marketingChannelTable = { name: 'marketingChannel', columns: { - createdAt: { - type: 'number', + channelType: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, + serverName: 'channel_type', }, - updatedAt: { + costModel: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'cost_model', + }, + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -3351,17 +3358,10 @@ const marketingChannelTable = { optional: false, customType: null as unknown as string, }, - channelType: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'channel_type', - }, - costModel: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, - serverName: 'cost_model', + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -3375,11 +3375,6 @@ const mediumTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, id: { type: 'string', optional: false, @@ -3390,18 +3385,23 @@ const mediumTable = { optional: false, customType: null as unknown as string, }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], } as const; const messageTable = { name: 'message', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, + body: { + type: 'string', + optional: false, + customType: null as unknown as string, }, - updatedAt: { + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -3411,21 +3411,11 @@ const messageTable = { optional: false, customType: null as unknown as string, }, - senderId: { - type: 'string', - optional: true, - customType: null as unknown as string, - }, mediumId: { type: 'string', optional: true, customType: null as unknown as string, }, - body: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, metadata: { type: 'json', optional: false, @@ -3437,6 +3427,16 @@ const messageTable = { customType: null as unknown as string, serverName: 'omitted_column', }, + senderId: { + type: 'string', + optional: true, + customType: null as unknown as string, + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], } as const; @@ -3465,11 +3465,6 @@ const orderItemTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, id: { type: 'string', optional: false, @@ -3481,12 +3476,6 @@ const orderItemTable = { customType: null as unknown as string, serverName: 'order_id', }, - variantId: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'variant_id', - }, quantity: { type: 'number', optional: false, @@ -3498,6 +3487,17 @@ const orderItemTable = { customType: null as unknown as number, serverName: 'unit_price', }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, + variantId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'variant_id', + }, }, primaryKey: ['id'], serverName: 'order_item', @@ -3505,12 +3505,12 @@ const orderItemTable = { const orderPaymentTable = { name: 'orderPayment', columns: { - createdAt: { + amount: { type: 'number', - optional: true, + optional: false, customType: null as unknown as number, }, - updatedAt: { + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -3532,16 +3532,16 @@ const orderPaymentTable = { customType: null as unknown as string, serverName: 'payment_id', }, - amount: { - type: 'number', - optional: false, - customType: null as unknown as number, - }, status: { type: 'string', optional: false, customType: null as unknown as string, }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], serverName: 'order_payment', @@ -3549,742 +3549,742 @@ const orderPaymentTable = { const orderTable = { name: 'orderTable', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - customerId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'customer_id', - }, - opportunityId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'opportunity_id', - }, - status: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - total: { - type: 'number', - optional: false, - customType: null as unknown as number, - }, - currency: { + billingCountryIso: { type: 'string', optional: false, customType: null as unknown as - | 'AED' - | 'AFN' - | 'ALL' - | 'AMD' - | 'ANG' - | 'AOA' - | 'ARS' - | 'AUD' - | 'AWG' - | 'AZN' - | 'BAM' - | 'BBD' - | 'BDT' - | 'BGN' - | 'BHD' - | 'BIF' - | 'BMD' - | 'BND' - | 'BOB' - | 'BOV' - | 'BRL' - | 'BSD' - | 'BTN' - | 'BWP' - | 'BYN' - | 'BZD' - | 'CAD' - | 'CDF' - | 'CHE' - | 'CHF' - | 'CHW' - | 'CLF' - | 'CLP' - | 'CNY' - | 'COP' - | 'COU' - | 'CRC' - | 'CUC' - | 'CUP' - | 'CVE' - | 'CZK' - | 'DJF' - | 'DKK' - | 'DOP' - | 'DZD' - | 'EGP' - | 'ERN' - | 'ETB' - | 'EUR' - | 'FJD' - | 'FKP' - | 'GBP' - | 'GEL' - | 'GHS' - | 'GIP' - | 'GMD' - | 'GNF' - | 'GTQ' - | 'GYD' - | 'HKD' - | 'HNL' - | 'HTG' - | 'HUF' - | 'IDR' - | 'ILS' - | 'INR' - | 'IQD' - | 'IRR' - | 'ISK' - | 'JMD' - | 'JOD' - | 'JPY' - | 'KES' - | 'KGS' - | 'KHR' - | 'KMF' - | 'KPW' - | 'KRW' - | 'KWD' - | 'KYD' - | 'KZT' - | 'LAK' - | 'LBP' - | 'LKR' - | 'LRD' - | 'LSL' - | 'LYD' - | 'MAD' - | 'MDL' - | 'MGA' - | 'MKD' - | 'MMK' - | 'MNT' - | 'MOP' - | 'MRU' - | 'MUR' - | 'MVR' - | 'MWK' - | 'MXN' - | 'MXV' - | 'MYR' - | 'MZN' - | 'NAD' - | 'NGN' - | 'NIO' - | 'NOK' - | 'NPR' - | 'NZD' - | 'OMR' - | 'PAB' - | 'PEN' - | 'PGK' - | 'PHP' - | 'PKR' - | 'PLN' - | 'PYG' - | 'QAR' - | 'RON' - | 'RSD' - | 'RUB' - | 'RWF' - | 'SAR' - | 'SBD' - | 'SCR' - | 'SDG' - | 'SEK' - | 'SGD' - | 'SHP' - | 'SLE' - | 'SOS' - | 'SRD' - | 'SSP' - | 'STN' - | 'SVC' - | 'SYP' - | 'SZL' - | 'THB' - | 'TJS' - | 'TMT' - | 'TND' - | 'TOP' - | 'TRY' - | 'TTD' - | 'TWD' - | 'TZS' - | 'UAH' - | 'UGX' - | 'USD' - | 'USN' - | 'UYI' - | 'UYU' - | 'UYW' - | 'UZS' - | 'VED' - | 'VES' - | 'VND' - | 'VUV' - | 'WST' - | 'XAF' - | 'XCD' - | 'XDR' - | 'XOF' - | 'XPF' - | 'XSU' - | 'XUA' - | 'YER' - | 'ZAR' - | 'ZMW' - | 'ZWG', - }, - currencyMetadata: { - type: 'json', - optional: false, - customType: null as unknown as OrderTableCurrencyMetadataCustomType, - serverName: 'currency_metadata', - }, - billingCountryIso: { - type: 'string', - optional: false, - customType: null as unknown as - | 'US' - | 'MX' - | 'CA' + | 'AD' + | 'AE' | 'AF' - | 'AX' + | 'AG' + | 'AI' | 'AL' - | 'DZ' - | 'AS' - | 'AD' + | 'AM' | 'AO' - | 'AI' | 'AQ' - | 'AG' | 'AR' - | 'AM' - | 'AW' - | 'AU' + | 'AS' | 'AT' + | 'AU' + | 'AW' + | 'AX' | 'AZ' - | 'BS' - | 'BH' - | 'BD' + | 'BA' | 'BB' - | 'BY' + | 'BD' | 'BE' - | 'BZ' + | 'BF' + | 'BG' + | 'BH' + | 'BI' | 'BJ' + | 'BL' | 'BM' - | 'BT' + | 'BN' | 'BO' | 'BQ' - | 'BA' - | 'BW' - | 'BV' | 'BR' - | 'IO' - | 'BN' - | 'BG' - | 'BF' - | 'BI' - | 'CV' - | 'KH' - | 'CM' - | 'KY' + | 'BS' + | 'BT' + | 'BV' + | 'BW' + | 'BY' + | 'BZ' + | 'CA' + | 'CC' + | 'CD' | 'CF' - | 'TD' + | 'CG' + | 'CH' + | 'CI' + | 'CK' | 'CL' + | 'CM' | 'CN' - | 'CX' - | 'CC' | 'CO' - | 'KM' - | 'CG' - | 'CD' - | 'CK' | 'CR' - | 'CI' - | 'HR' | 'CU' + | 'CV' | 'CW' + | 'CX' | 'CY' | 'CZ' - | 'DK' + | 'DE' | 'DJ' + | 'DK' | 'DM' | 'DO' + | 'DZ' | 'EC' + | 'EE' | 'EG' - | 'SV' - | 'GQ' + | 'EH' | 'ER' - | 'EE' - | 'SZ' + | 'ES' | 'ET' + | 'FI' + | 'FJ' | 'FK' + | 'FM' | 'FO' - | 'FJ' - | 'FI' | 'FR' - | 'GF' - | 'PF' - | 'TF' | 'GA' - | 'GM' + | 'GB' + | 'GD' | 'GE' - | 'DE' + | 'GF' + | 'GG' | 'GH' | 'GI' - | 'GR' | 'GL' - | 'GD' + | 'GM' + | 'GN' | 'GP' - | 'GU' + | 'GQ' + | 'GR' + | 'GS' | 'GT' - | 'GG' - | 'GN' + | 'GU' | 'GW' | 'GY' - | 'HT' + | 'HK' | 'HM' - | 'VA' | 'HN' - | 'HK' + | 'HR' + | 'HT' | 'HU' - | 'IS' - | 'IN' | 'ID' - | 'IR' - | 'IQ' | 'IE' - | 'IM' | 'IL' + | 'IM' + | 'IN' + | 'IO' + | 'IQ' + | 'IR' + | 'IS' | 'IT' - | 'JM' - | 'JP' | 'JE' + | 'JM' | 'JO' - | 'KZ' + | 'JP' | 'KE' + | 'KG' + | 'KH' | 'KI' + | 'KM' + | 'KN' | 'KP' | 'KR' | 'KW' - | 'KG' + | 'KY' + | 'KZ' | 'LA' - | 'LV' | 'LB' - | 'LS' - | 'LR' - | 'LY' + | 'LC' | 'LI' + | 'LK' + | 'LR' + | 'LS' | 'LT' | 'LU' - | 'MO' + | 'LV' + | 'LY' + | 'MA' + | 'MC' + | 'MD' + | 'ME' + | 'MF' | 'MG' - | 'MW' - | 'MY' - | 'MV' - | 'ML' - | 'MT' | 'MH' + | 'MK' + | 'ML' + | 'MM' + | 'MN' + | 'MO' + | 'MP' | 'MQ' | 'MR' - | 'MU' - | 'YT' - | 'FM' - | 'MD' - | 'MC' - | 'MN' - | 'ME' | 'MS' - | 'MA' + | 'MT' + | 'MU' + | 'MV' + | 'MW' + | 'MX' + | 'MY' | 'MZ' - | 'MM' | 'NA' - | 'NR' - | 'NP' - | 'NL' | 'NC' - | 'NZ' - | 'NI' | 'NE' - | 'NG' - | 'NU' | 'NF' - | 'MK' - | 'MP' + | 'NG' + | 'NI' + | 'NL' | 'NO' + | 'NP' + | 'NR' + | 'NU' + | 'NZ' | 'OM' - | 'PK' - | 'PW' - | 'PS' | 'PA' - | 'PG' - | 'PY' | 'PE' + | 'PF' + | 'PG' | 'PH' - | 'PN' + | 'PK' | 'PL' - | 'PT' + | 'PM' + | 'PN' | 'PR' + | 'PS' + | 'PT' + | 'PW' + | 'PY' | 'QA' | 'RE' | 'RO' + | 'RS' | 'RU' | 'RW' - | 'BL' - | 'SH' - | 'KN' - | 'LC' - | 'MF' - | 'PM' - | 'VC' - | 'WS' - | 'SM' - | 'ST' | 'SA' - | 'SN' - | 'RS' + | 'SB' | 'SC' - | 'SL' + | 'SD' + | 'SE' | 'SG' - | 'SX' - | 'SK' + | 'SH' | 'SI' - | 'SB' + | 'SJ' + | 'SK' + | 'SL' + | 'SM' + | 'SN' | 'SO' - | 'ZA' - | 'GS' - | 'SS' - | 'ES' - | 'LK' - | 'SD' | 'SR' - | 'SJ' - | 'SE' - | 'CH' + | 'SS' + | 'ST' + | 'SV' + | 'SX' | 'SY' - | 'TW' - | 'TJ' - | 'TZ' - | 'TH' - | 'TL' + | 'SZ' + | 'TC' + | 'TD' + | 'TF' | 'TG' + | 'TH' + | 'TJ' | 'TK' - | 'TO' - | 'TT' + | 'TL' + | 'TM' | 'TN' + | 'TO' | 'TR' - | 'TM' - | 'TC' + | 'TT' | 'TV' - | 'UG' + | 'TW' + | 'TZ' | 'UA' - | 'AE' - | 'GB' + | 'UG' + | 'US' | 'UY' | 'UZ' - | 'VU' + | 'VA' + | 'VC' | 'VE' - | 'VN' | 'VG' | 'VI' + | 'VN' + | 'VU' | 'WF' - | 'EH' + | 'WS' + | 'XK' | 'YE' + | 'YT' + | 'ZA' | 'ZM' - | 'ZW' - | 'XK', + | 'ZW', serverName: 'billing_country_iso', }, + cdcCheckpoint: { + type: 'json', + optional: true, + customType: null as unknown as null | { + hydratedAtIso: string; + lastLsn: string; + snapshotCompleted: boolean; + }, + serverName: 'cdc_checkpoint', + }, + createdAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, + currency: { + type: 'string', + optional: false, + customType: null as unknown as + | 'AED' + | 'AFN' + | 'ALL' + | 'AMD' + | 'ANG' + | 'AOA' + | 'ARS' + | 'AUD' + | 'AWG' + | 'AZN' + | 'BAM' + | 'BBD' + | 'BDT' + | 'BGN' + | 'BHD' + | 'BIF' + | 'BMD' + | 'BND' + | 'BOB' + | 'BOV' + | 'BRL' + | 'BSD' + | 'BTN' + | 'BWP' + | 'BYN' + | 'BZD' + | 'CAD' + | 'CDF' + | 'CHE' + | 'CHF' + | 'CHW' + | 'CLF' + | 'CLP' + | 'CNY' + | 'COP' + | 'COU' + | 'CRC' + | 'CUC' + | 'CUP' + | 'CVE' + | 'CZK' + | 'DJF' + | 'DKK' + | 'DOP' + | 'DZD' + | 'EGP' + | 'ERN' + | 'ETB' + | 'EUR' + | 'FJD' + | 'FKP' + | 'GBP' + | 'GEL' + | 'GHS' + | 'GIP' + | 'GMD' + | 'GNF' + | 'GTQ' + | 'GYD' + | 'HKD' + | 'HNL' + | 'HTG' + | 'HUF' + | 'IDR' + | 'ILS' + | 'INR' + | 'IQD' + | 'IRR' + | 'ISK' + | 'JMD' + | 'JOD' + | 'JPY' + | 'KES' + | 'KGS' + | 'KHR' + | 'KMF' + | 'KPW' + | 'KRW' + | 'KWD' + | 'KYD' + | 'KZT' + | 'LAK' + | 'LBP' + | 'LKR' + | 'LRD' + | 'LSL' + | 'LYD' + | 'MAD' + | 'MDL' + | 'MGA' + | 'MKD' + | 'MMK' + | 'MNT' + | 'MOP' + | 'MRU' + | 'MUR' + | 'MVR' + | 'MWK' + | 'MXN' + | 'MXV' + | 'MYR' + | 'MZN' + | 'NAD' + | 'NGN' + | 'NIO' + | 'NOK' + | 'NPR' + | 'NZD' + | 'OMR' + | 'PAB' + | 'PEN' + | 'PGK' + | 'PHP' + | 'PKR' + | 'PLN' + | 'PYG' + | 'QAR' + | 'RON' + | 'RSD' + | 'RUB' + | 'RWF' + | 'SAR' + | 'SBD' + | 'SCR' + | 'SDG' + | 'SEK' + | 'SGD' + | 'SHP' + | 'SLE' + | 'SOS' + | 'SRD' + | 'SSP' + | 'STN' + | 'SVC' + | 'SYP' + | 'SZL' + | 'THB' + | 'TJS' + | 'TMT' + | 'TND' + | 'TOP' + | 'TRY' + | 'TTD' + | 'TWD' + | 'TZS' + | 'UAH' + | 'UGX' + | 'USD' + | 'USN' + | 'UYI' + | 'UYU' + | 'UYW' + | 'UZS' + | 'VED' + | 'VES' + | 'VND' + | 'VUV' + | 'WST' + | 'XAF' + | 'XCD' + | 'XDR' + | 'XOF' + | 'XPF' + | 'XSU' + | 'XUA' + | 'YER' + | 'ZAR' + | 'ZMW' + | 'ZWG', + }, + currencyMetadata: { + type: 'json', + optional: false, + customType: null as unknown as OrderTableCurrencyMetadataCustomType, + serverName: 'currency_metadata', + }, + customerId: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'customer_id', + }, + id: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + opportunityId: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'opportunity_id', + }, shippingCountryIso: { type: 'string', optional: false, customType: null as unknown as - | 'US' - | 'MX' - | 'CA' + | 'AD' + | 'AE' | 'AF' - | 'AX' + | 'AG' + | 'AI' | 'AL' - | 'DZ' - | 'AS' - | 'AD' + | 'AM' | 'AO' - | 'AI' | 'AQ' - | 'AG' | 'AR' - | 'AM' - | 'AW' - | 'AU' + | 'AS' | 'AT' + | 'AU' + | 'AW' + | 'AX' | 'AZ' - | 'BS' - | 'BH' - | 'BD' + | 'BA' | 'BB' - | 'BY' + | 'BD' | 'BE' - | 'BZ' + | 'BF' + | 'BG' + | 'BH' + | 'BI' | 'BJ' + | 'BL' | 'BM' - | 'BT' + | 'BN' | 'BO' | 'BQ' - | 'BA' - | 'BW' - | 'BV' | 'BR' - | 'IO' - | 'BN' - | 'BG' - | 'BF' - | 'BI' - | 'CV' - | 'KH' - | 'CM' - | 'KY' + | 'BS' + | 'BT' + | 'BV' + | 'BW' + | 'BY' + | 'BZ' + | 'CA' + | 'CC' + | 'CD' | 'CF' - | 'TD' + | 'CG' + | 'CH' + | 'CI' + | 'CK' | 'CL' + | 'CM' | 'CN' - | 'CX' - | 'CC' | 'CO' - | 'KM' - | 'CG' - | 'CD' - | 'CK' | 'CR' - | 'CI' - | 'HR' | 'CU' + | 'CV' | 'CW' + | 'CX' | 'CY' | 'CZ' - | 'DK' + | 'DE' | 'DJ' + | 'DK' | 'DM' | 'DO' + | 'DZ' | 'EC' + | 'EE' | 'EG' - | 'SV' - | 'GQ' + | 'EH' | 'ER' - | 'EE' - | 'SZ' + | 'ES' | 'ET' + | 'FI' + | 'FJ' | 'FK' + | 'FM' | 'FO' - | 'FJ' - | 'FI' | 'FR' - | 'GF' - | 'PF' - | 'TF' | 'GA' - | 'GM' + | 'GB' + | 'GD' | 'GE' - | 'DE' + | 'GF' + | 'GG' | 'GH' | 'GI' - | 'GR' | 'GL' - | 'GD' + | 'GM' + | 'GN' | 'GP' - | 'GU' + | 'GQ' + | 'GR' + | 'GS' | 'GT' - | 'GG' - | 'GN' + | 'GU' | 'GW' | 'GY' - | 'HT' + | 'HK' | 'HM' - | 'VA' | 'HN' - | 'HK' + | 'HR' + | 'HT' | 'HU' - | 'IS' - | 'IN' | 'ID' - | 'IR' - | 'IQ' | 'IE' - | 'IM' | 'IL' + | 'IM' + | 'IN' + | 'IO' + | 'IQ' + | 'IR' + | 'IS' | 'IT' - | 'JM' - | 'JP' | 'JE' + | 'JM' | 'JO' - | 'KZ' + | 'JP' | 'KE' + | 'KG' + | 'KH' | 'KI' + | 'KM' + | 'KN' | 'KP' | 'KR' | 'KW' - | 'KG' + | 'KY' + | 'KZ' | 'LA' - | 'LV' | 'LB' - | 'LS' - | 'LR' - | 'LY' + | 'LC' | 'LI' + | 'LK' + | 'LR' + | 'LS' | 'LT' | 'LU' - | 'MO' + | 'LV' + | 'LY' + | 'MA' + | 'MC' + | 'MD' + | 'ME' + | 'MF' | 'MG' - | 'MW' - | 'MY' - | 'MV' - | 'ML' - | 'MT' | 'MH' + | 'MK' + | 'ML' + | 'MM' + | 'MN' + | 'MO' + | 'MP' | 'MQ' | 'MR' - | 'MU' - | 'YT' - | 'FM' - | 'MD' - | 'MC' - | 'MN' - | 'ME' | 'MS' - | 'MA' + | 'MT' + | 'MU' + | 'MV' + | 'MW' + | 'MX' + | 'MY' | 'MZ' - | 'MM' | 'NA' - | 'NR' - | 'NP' - | 'NL' | 'NC' - | 'NZ' - | 'NI' | 'NE' - | 'NG' - | 'NU' | 'NF' - | 'MK' - | 'MP' + | 'NG' + | 'NI' + | 'NL' | 'NO' + | 'NP' + | 'NR' + | 'NU' + | 'NZ' | 'OM' - | 'PK' - | 'PW' - | 'PS' | 'PA' - | 'PG' - | 'PY' | 'PE' + | 'PF' + | 'PG' | 'PH' - | 'PN' + | 'PK' | 'PL' - | 'PT' + | 'PM' + | 'PN' | 'PR' + | 'PS' + | 'PT' + | 'PW' + | 'PY' | 'QA' | 'RE' | 'RO' + | 'RS' | 'RU' | 'RW' - | 'BL' - | 'SH' - | 'KN' - | 'LC' - | 'MF' - | 'PM' - | 'VC' - | 'WS' - | 'SM' - | 'ST' | 'SA' - | 'SN' - | 'RS' + | 'SB' | 'SC' - | 'SL' + | 'SD' + | 'SE' | 'SG' - | 'SX' - | 'SK' + | 'SH' | 'SI' - | 'SB' + | 'SJ' + | 'SK' + | 'SL' + | 'SM' + | 'SN' | 'SO' - | 'ZA' - | 'GS' - | 'SS' - | 'ES' - | 'LK' - | 'SD' | 'SR' - | 'SJ' - | 'SE' - | 'CH' + | 'SS' + | 'ST' + | 'SV' + | 'SX' | 'SY' - | 'TW' - | 'TJ' - | 'TZ' - | 'TH' - | 'TL' + | 'SZ' + | 'TC' + | 'TD' + | 'TF' | 'TG' + | 'TH' + | 'TJ' | 'TK' - | 'TO' - | 'TT' + | 'TL' + | 'TM' | 'TN' + | 'TO' | 'TR' - | 'TM' - | 'TC' + | 'TT' | 'TV' - | 'UG' + | 'TW' + | 'TZ' | 'UA' - | 'AE' - | 'GB' + | 'UG' + | 'US' | 'UY' | 'UZ' - | 'VU' + | 'VA' + | 'VC' | 'VE' - | 'VN' | 'VG' | 'VI' + | 'VN' + | 'VU' | 'WF' - | 'EH' + | 'WS' + | 'XK' | 'YE' + | 'YT' + | 'ZA' | 'ZM' - | 'ZW' - | 'XK', + | 'ZW', serverName: 'shipping_country_iso', }, - cdcCheckpoint: { - type: 'json', + status: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + total: { + type: 'number', + optional: false, + customType: null as unknown as number, + }, + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as { - lastLsn: string; - snapshotCompleted: boolean; - hydratedAtIso: string; - } | null, - serverName: 'cdc_checkpoint', + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -4293,37 +4293,16 @@ const orderTable = { const paymentTable = { name: 'payment', columns: { - createdAt: { + amount: { type: 'number', - optional: true, + optional: false, customType: null as unknown as number, }, - updatedAt: { + createdAt: { type: 'number', optional: true, customType: null as unknown as number, }, - id: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - externalRef: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'external_ref', - }, - status: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - amount: { - type: 'number', - optional: false, - customType: null as unknown as number, - }, currency: { type: 'string', optional: false, @@ -4498,6 +4477,17 @@ const paymentTable = { | 'ZMW' | 'ZWG', }, + externalRef: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'external_ref', + }, + id: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, receivedAt: { type: 'number', optional: true, @@ -4510,47 +4500,57 @@ const paymentTable = { customType: null as unknown as string, serverName: 'received_by_id', }, + status: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], } as const; const productTable = { name: 'product', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, + categoryId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'category_id', }, - updatedAt: { + createdAt: { type: 'number', optional: true, customType: null as unknown as number, }, - id: { + description: { type: 'string', - optional: false, + optional: true, customType: null as unknown as string, }, - categoryId: { + id: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'category_id', }, name: { type: 'string', optional: false, customType: null as unknown as string, }, - description: { + status: { type: 'string', optional: true, customType: null as unknown as string, }, - status: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -4563,10 +4563,10 @@ const productCategoryTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + description: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, }, id: { type: 'string', @@ -4578,17 +4578,17 @@ const productCategoryTable = { optional: false, customType: null as unknown as string, }, - description: { - type: 'string', - optional: true, - customType: null as unknown as string, - }, parentId: { type: 'string', optional: true, customType: null as unknown as string, serverName: 'parent_id', }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], serverName: 'product_category', @@ -4601,74 +4601,79 @@ const productMediaTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - productId: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'product_id', - }, - url: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - type: { - type: 'string', + mimeDescriptor: { + type: 'json', optional: false, - customType: null as unknown as ProductMediaTypeCustomType, + customType: null as unknown as ProductMediaMimeDescriptorCustomType, + serverName: 'mime_descriptor', }, mimeKey: { type: 'string', optional: false, customType: null as unknown as - | 'undefined' - | 'object' - | 'null' - | 'unknown' - | 'iso' - | 'json' - | '3gp' | '3ds' + | '3dsm' | '3dsx' + | '3gp' | '3mf' | 'abnf' | 'ace' + | 'ada' | 'aff' | 'ai' | 'aidl' + | 'algol68' | 'ani' | 'apk' + | 'applebplist' + | 'appledouble' + | 'appleplist' + | 'applesingle' + | 'ar' | 'arc' + | 'arj' + | 'arrow' | 'asc' - | 'au' + | 'asd' | 'asf' | 'asm' | 'asp' + | 'au' + | 'autohotkey' + | 'autoit' | 'avi' | 'avif' | 'avro' | 'awk' | 'ax' + | 'batch' + | 'bazel' + | 'bcad' | 'bib' | 'bmp' | 'bpg' | 'bpl' + | 'brainfuck' | 'brf' + | 'bzip' + | 'bzip3' | 'c' | 'cab' + | 'cad' | 'cat' + | 'cdf' | 'chm' + | 'clojure' | 'cmake' + | 'cobol' + | 'coff' + | 'coffeescript' + | 'com' | 'cpl' | 'cpp' | 'crt' @@ -4677,30 +4682,51 @@ const productMediaTable = { | 'csproj' | 'css' | 'csv' + | 'ctl' | 'dart' | 'deb' | 'dex' + | 'dey' + | 'dicom' | 'diff' + | 'directory' + | 'django' | 'dll' | 'dm' | 'dmg' + | 'dmigd' + | 'dmscript' | 'doc' + | 'dockerfile' | 'docx' + | 'dosmbr' | 'dotx' + | 'dsstore' | 'dwg' | 'dxf' | 'dylib' + | 'ebml' | 'elf' + | 'elixir' | 'emf' | 'eml' + | 'empty' | 'epub' | 'erb' + | 'erlang' + | 'ese' | 'exe' + | 'exp' | 'flac' + | 'flutter' | 'flv' + | 'fortran' | 'fpx' + | 'gemfile' | 'gemspec' | 'gif' + | 'gitattributes' + | 'gitmodules' | 'gleam' | 'go' | 'gpx' @@ -4710,61 +4736,89 @@ const productMediaTable = { | 'h' | 'h5' | 'handlebars' + | 'haskell' | 'hcl' | 'heif' | 'hfs' | 'hlp' | 'hpp' | 'hta' + | 'htaccess' | 'html' + | 'hve' | 'hwp' | 'icc' | 'icns' | 'ico' | 'ics' + | 'ignorefile' | 'img' | 'ini' + | 'internetshortcut' + | 'iosapp' | 'ipynb' + | 'iso' | 'jar' | 'java' + | 'javabytecode' + | 'javascript' | 'jinja' | 'jng' | 'jnlp' | 'jp2' | 'jpeg' + | 'json' + | 'jsonc' | 'jsonl' | 'jsx' + | 'julia' | 'jxl' | 'ko' + | 'kotlin' | 'ks' + | 'latex' + | 'latexaux' + | 'less' | 'lha' + | 'license' | 'lisp' + | 'litcs' | 'lnk' | 'lock' | 'lrz' | 'lua' | 'lz' | 'lz4' + | 'lzx' | 'm3u' | 'm4' + | 'macho' | 'maff' + | 'makefile' | 'markdown' | 'matlab' | 'mht' + | 'midi' | 'mkv' | 'mp2' | 'mp3' | 'mp4' - | 'tsv' + | 'mpegts' + | 'mscompress' | 'msi' | 'msix' | 'mst' | 'mui' | 'mum' | 'mun' + | 'nim' | 'npy' | 'npz' + | 'null' | 'nupkg' + | 'object' + | 'objectivec' + | 'ocaml' | 'ocx' | 'odex' | 'odin' @@ -4772,67 +4826,119 @@ const productMediaTable = { | 'ods' | 'odt' | 'ogg' + | 'ole' | 'one' | 'onnx' + | 'ooxml' | 'otf' + | 'outlook' + | 'palmos' | 'parquet' + | 'pascal' + | 'pbm' | 'pcap' | 'pdb' | 'pdf' + | 'pebin' | 'pem' - | 'pub' + | 'perl' | 'pgp' | 'php' | 'pickle' | 'png' | 'po' + | 'postscript' + | 'powershell' | 'ppt' | 'pptx' + | 'printfox' + | 'prolog' + | 'proteindb' | 'proto' | 'protobuf' | 'psd' + | 'pub' + | 'python' + | 'pythonbytecode' + | 'pythonpar' + | 'pytorch' | 'qoi' + | 'qt' + | 'r' + | 'randomascii' + | 'randombytes' + | 'randomtxt' | 'rar' | 'rdf' + | 'rdp' + | 'riff' | 'rlib' | 'rll' | 'rpm' | 'rst' | 'rtf' + | 'ruby' + | 'rust' + | 'rzip' | 'scala' + | 'scheme' | 'scr' + | 'scriptwsf' | 'scss' + | 'sevenzip' | 'sgml' | 'sh3d' + | 'shell' | 'smali' | 'snap' | 'so' + | 'solidity' | 'sql' | 'sqlite' + | 'squashfs' | 'srt' + | 'stlbinary' + | 'stltext' | 'sum' + | 'svd' | 'svg' | 'swf' | 'swift' + | 'symlink' + | 'symlinktext' | 'sys' | 'tar' | 'tcl' | 'textproto' | 'tga' + | 'thumbsdb' | 'tiff' | 'tmdx' | 'toml' | 'torrent' + | 'troff' + | 'tsv' | 'tsx' | 'ttf' | 'twig' | 'txt' + | 'txtascii' + | 'txtutf16' + | 'txtutf8' + | 'typescript' + | 'udf' + | 'undefined' + | 'unixcompress' + | 'unknown' | 'vba' | 'vbe' | 'vcard' + | 'vcs' | 'vcxproj' | 'verilog' | 'vhd' + | 'vhdl' + | 'visio' | 'vtt' | 'vue' | 'wad' @@ -4840,7 +4946,9 @@ const productMediaTable = { | 'wav' | 'webm' | 'webp' + | 'webtemplate' | 'wim' + | 'winregistry' | 'wma' | 'wmf' | 'wmv' @@ -4859,175 +4967,41 @@ const productMediaTable = { | 'yara' | 'zig' | 'zip' - | 'zst' - | '3dsm' - | 'ada' - | 'algol68' - | 'applebplist' - | 'appledouble' - | 'appleplist' - | 'applesingle' - | 'ar' - | 'arj' - | 'arrow' - | 'asd' - | 'autohotkey' - | 'autoit' - | 'batch' - | 'bazel' - | 'bcad' - | 'brainfuck' - | 'bzip' - | 'bzip3' - | 'cad' - | 'cdf' - | 'clojure' - | 'cobol' - | 'coff' - | 'coffeescript' - | 'com' - | 'ctl' - | 'dey' - | 'dicom' - | 'directory' - | 'django' - | 'dmigd' - | 'dmscript' - | 'dockerfile' - | 'dosmbr' - | 'dsstore' - | 'ebml' - | 'elixir' - | 'empty' - | 'erlang' - | 'ese' - | 'exp' - | 'flutter' - | 'fortran' - | 'gemfile' - | 'gitattributes' - | 'gitmodules' - | 'haskell' - | 'htaccess' - | 'hve' - | 'ignorefile' - | 'internetshortcut' - | 'iosapp' - | 'javabytecode' - | 'javascript' - | 'jsonc' - | 'julia' - | 'kotlin' - | 'latex' - | 'latexaux' - | 'less' - | 'license' - | 'litcs' - | 'lzx' - | 'macho' - | 'makefile' - | 'midi' - | 'mpegts' - | 'mscompress' - | 'nim' - | 'objectivec' - | 'ocaml' - | 'ole' - | 'ooxml' - | 'outlook' - | 'palmos' - | 'pascal' - | 'pbm' - | 'pebin' - | 'perl' - | 'postscript' - | 'powershell' - | 'printfox' - | 'prolog' - | 'proteindb' - | 'pytorch' - | 'python' - | 'pythonbytecode' - | 'pythonpar' - | 'qt' - | 'r' - | 'randomascii' - | 'randombytes' - | 'randomtxt' - | 'rdp' - | 'riff' - | 'ruby' - | 'rust' - | 'rzip' - | 'scheme' - | 'scriptwsf' - | 'sevenzip' - | 'shell' - | 'solidity' - | 'squashfs' - | 'stlbinary' - | 'stltext' - | 'svd' - | 'symlink' - | 'symlinktext' - | 'thumbsdb' - | 'troff' - | 'txtascii' - | 'txtutf16' - | 'txtutf8' - | 'typescript' - | 'udf' - | 'unixcompress' - | 'vcs' - | 'vhdl' - | 'visio' - | 'webtemplate' - | 'winregistry' - | 'zlibstream', + | 'zlibstream' + | 'zst', serverName: 'mime_key', }, - mimeDescriptor: { - type: 'json', + productId: { + type: 'string', optional: false, - customType: null as unknown as ProductMediaMimeDescriptorCustomType, - serverName: 'mime_descriptor', + customType: null as unknown as string, + serverName: 'product_id', }, - }, - primaryKey: ['id'], - serverName: 'product_media', -} as const; -const productVariantTable = { - name: 'productVariant', - columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, + type: { + type: 'string', + optional: false, + customType: null as unknown as ProductMediaTypeCustomType, }, updatedAt: { type: 'number', optional: true, customType: null as unknown as number, }, - id: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - productId: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'product_id', - }, - sku: { + url: { type: 'string', optional: false, customType: null as unknown as string, }, - price: { + }, + primaryKey: ['id'], + serverName: 'product_media', +} as const; +const productVariantTable = { + name: 'productVariant', + columns: { + createdAt: { type: 'number', - optional: false, + optional: true, customType: null as unknown as number, }, currency: { @@ -5204,11 +5178,37 @@ const productVariantTable = { | 'ZMW' | 'ZWG', }, - isActive: { - type: 'boolean', + id: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + isActive: { + type: 'boolean', + optional: true, + customType: null as unknown as boolean, + serverName: 'is_active', + }, + price: { + type: 'number', + optional: false, + customType: null as unknown as number, + }, + productId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'product_id', + }, + sku: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as boolean, - serverName: 'is_active', + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -5222,37 +5222,37 @@ const projectTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + description: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - ownerId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'owner_id', - }, name: { type: 'string', optional: false, customType: null as unknown as string, }, - description: { + ownerId: { type: 'string', optional: true, customType: null as unknown as string, + serverName: 'owner_id', }, status: { type: 'string', optional: true, customType: null as unknown as string, }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, workflowState: { type: 'json', optional: false, @@ -5265,12 +5265,13 @@ const projectTable = { const projectAssignmentTable = { name: 'projectAssignment', columns: { - createdAt: { + assignedAt: { type: 'number', optional: true, customType: null as unknown as number, + serverName: 'assigned_at', }, - updatedAt: { + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -5280,28 +5281,27 @@ const projectAssignmentTable = { optional: false, customType: null as unknown as string, }, - taskId: { + role: { type: 'string', - optional: false, + optional: true, customType: null as unknown as string, - serverName: 'task_id', }, - userId: { + taskId: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'user_id', + serverName: 'task_id', }, - assignedAt: { + updatedAt: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'assigned_at', }, - role: { + userId: { type: 'string', - optional: true, + optional: false, customType: null as unknown as string, + serverName: 'user_id', }, }, primaryKey: ['id'], @@ -5315,10 +5315,17 @@ const projectAttachmentTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + fileName: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'file_name', + }, + fileType: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, + serverName: 'file_type', }, id: { type: 'string', @@ -5331,17 +5338,10 @@ const projectAttachmentTable = { customType: null as unknown as string, serverName: 'task_id', }, - fileName: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'file_name', - }, - fileType: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, - serverName: 'file_type', + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -5350,15 +5350,26 @@ const projectAttachmentTable = { const projectAuditTable = { name: 'projectAudit', columns: { + action: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + actorId: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'actor_id', + }, createdAt: { type: 'number', optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + details: { + type: 'json', optional: true, - customType: null as unknown as number, + customType: null as unknown as ProjectAuditDetailsCustomType, }, id: { type: 'string', @@ -5371,21 +5382,10 @@ const projectAuditTable = { customType: null as unknown as string, serverName: 'project_id', }, - actorId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'actor_id', - }, - action: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - details: { - type: 'json', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as ProjectAuditDetailsCustomType, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -5394,12 +5394,18 @@ const projectAuditTable = { const projectCommentTable = { name: 'projectComment', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, + authorId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'author_id', }, - updatedAt: { + body: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -5415,16 +5421,10 @@ const projectCommentTable = { customType: null as unknown as string, serverName: 'task_id', }, - authorId: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'author_id', - }, - body: { - type: 'string', - optional: false, - customType: null as unknown as string, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -5433,12 +5433,13 @@ const projectCommentTable = { const projectNoteTable = { name: 'projectNote', columns: { - createdAt: { - type: 'number', + authorId: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, + serverName: 'author_id', }, - updatedAt: { + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -5448,22 +5449,21 @@ const projectNoteTable = { optional: false, customType: null as unknown as string, }, - projectId: { + note: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'project_id', - }, - authorId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'author_id', }, - note: { + projectId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'project_id', + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -5477,32 +5477,32 @@ const projectPhaseTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - projectId: { + name: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'project_id', }, - name: { + projectId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'project_id', }, sequence: { type: 'number', optional: false, customType: null as unknown as number, }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], serverName: 'project_phase', @@ -5510,12 +5510,12 @@ const projectPhaseTable = { const projectTagTable = { name: 'projectTag', columns: { - createdAt: { - type: 'number', + color: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, }, - updatedAt: { + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -5530,10 +5530,10 @@ const projectTagTable = { optional: false, customType: null as unknown as string, }, - color: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -5547,43 +5547,43 @@ const projectTaskTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - projectId: { + phaseId: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'project_id', + serverName: 'phase_id', }, - phaseId: { + priority: { type: 'string', - optional: false, + optional: true, customType: null as unknown as string, - serverName: 'phase_id', }, - title: { + projectId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'project_id', }, status: { type: 'string', optional: false, customType: null as unknown as string, }, - priority: { + title: { type: 'string', - optional: true, + optional: false, customType: null as unknown as string, }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], serverName: 'project_task', @@ -5596,61 +5596,44 @@ const projectTaskTagTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - taskId: { + tagId: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'task_id', + serverName: 'tag_id', }, - tagId: { + taskId: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'tag_id', - }, - }, - primaryKey: ['id'], - serverName: 'project_task_tag', -} as const; -const shipmentTable = { - name: 'shipment', - columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, + serverName: 'task_id', }, updatedAt: { type: 'number', optional: true, customType: null as unknown as number, }, - id: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - orderId: { + }, + primaryKey: ['id'], + serverName: 'project_task_tag', +} as const; +const shipmentTable = { + name: 'shipment', + columns: { + carrier: { type: 'string', - optional: false, + optional: true, customType: null as unknown as string, - serverName: 'order_id', }, - shippedAt: { + createdAt: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'shipped_at', }, deliveredAt: { type: 'number', @@ -5658,330 +5641,347 @@ const shipmentTable = { customType: null as unknown as number, serverName: 'delivered_at', }, - carrier: { - type: 'string', - optional: true, - customType: null as unknown as string, - }, - trackingNumber: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'tracking_number', - }, destinationCountry: { type: 'string', optional: false, customType: null as unknown as - | 'US' - | 'MX' - | 'CA' + | 'AD' + | 'AE' | 'AF' - | 'AX' + | 'AG' + | 'AI' | 'AL' - | 'DZ' - | 'AS' - | 'AD' + | 'AM' | 'AO' - | 'AI' | 'AQ' - | 'AG' | 'AR' - | 'AM' - | 'AW' - | 'AU' + | 'AS' | 'AT' + | 'AU' + | 'AW' + | 'AX' | 'AZ' - | 'BS' - | 'BH' - | 'BD' + | 'BA' | 'BB' - | 'BY' + | 'BD' | 'BE' - | 'BZ' + | 'BF' + | 'BG' + | 'BH' + | 'BI' | 'BJ' + | 'BL' | 'BM' - | 'BT' + | 'BN' | 'BO' | 'BQ' - | 'BA' - | 'BW' - | 'BV' | 'BR' - | 'IO' - | 'BN' - | 'BG' - | 'BF' - | 'BI' - | 'CV' - | 'KH' - | 'CM' - | 'KY' + | 'BS' + | 'BT' + | 'BV' + | 'BW' + | 'BY' + | 'BZ' + | 'CA' + | 'CC' + | 'CD' | 'CF' - | 'TD' + | 'CG' + | 'CH' + | 'CI' + | 'CK' | 'CL' + | 'CM' | 'CN' - | 'CX' - | 'CC' | 'CO' - | 'KM' - | 'CG' - | 'CD' - | 'CK' | 'CR' - | 'CI' - | 'HR' | 'CU' + | 'CV' | 'CW' + | 'CX' | 'CY' | 'CZ' - | 'DK' + | 'DE' | 'DJ' + | 'DK' | 'DM' | 'DO' + | 'DZ' | 'EC' + | 'EE' | 'EG' - | 'SV' - | 'GQ' + | 'EH' | 'ER' - | 'EE' - | 'SZ' + | 'ES' | 'ET' + | 'FI' + | 'FJ' | 'FK' + | 'FM' | 'FO' - | 'FJ' - | 'FI' | 'FR' - | 'GF' - | 'PF' - | 'TF' | 'GA' - | 'GM' + | 'GB' + | 'GD' | 'GE' - | 'DE' + | 'GF' + | 'GG' | 'GH' | 'GI' - | 'GR' | 'GL' - | 'GD' + | 'GM' + | 'GN' | 'GP' - | 'GU' + | 'GQ' + | 'GR' + | 'GS' | 'GT' - | 'GG' - | 'GN' + | 'GU' | 'GW' | 'GY' - | 'HT' + | 'HK' | 'HM' - | 'VA' | 'HN' - | 'HK' + | 'HR' + | 'HT' | 'HU' - | 'IS' - | 'IN' | 'ID' - | 'IR' - | 'IQ' | 'IE' - | 'IM' | 'IL' + | 'IM' + | 'IN' + | 'IO' + | 'IQ' + | 'IR' + | 'IS' | 'IT' - | 'JM' - | 'JP' | 'JE' + | 'JM' | 'JO' - | 'KZ' + | 'JP' | 'KE' + | 'KG' + | 'KH' | 'KI' + | 'KM' + | 'KN' | 'KP' | 'KR' | 'KW' - | 'KG' + | 'KY' + | 'KZ' | 'LA' - | 'LV' | 'LB' - | 'LS' - | 'LR' - | 'LY' + | 'LC' | 'LI' + | 'LK' + | 'LR' + | 'LS' | 'LT' | 'LU' - | 'MO' + | 'LV' + | 'LY' + | 'MA' + | 'MC' + | 'MD' + | 'ME' + | 'MF' | 'MG' - | 'MW' - | 'MY' - | 'MV' - | 'ML' - | 'MT' | 'MH' + | 'MK' + | 'ML' + | 'MM' + | 'MN' + | 'MO' + | 'MP' | 'MQ' | 'MR' - | 'MU' - | 'YT' - | 'FM' - | 'MD' - | 'MC' - | 'MN' - | 'ME' | 'MS' - | 'MA' + | 'MT' + | 'MU' + | 'MV' + | 'MW' + | 'MX' + | 'MY' | 'MZ' - | 'MM' | 'NA' - | 'NR' - | 'NP' - | 'NL' | 'NC' - | 'NZ' - | 'NI' | 'NE' - | 'NG' - | 'NU' | 'NF' - | 'MK' - | 'MP' + | 'NG' + | 'NI' + | 'NL' | 'NO' + | 'NP' + | 'NR' + | 'NU' + | 'NZ' | 'OM' - | 'PK' - | 'PW' - | 'PS' | 'PA' - | 'PG' - | 'PY' | 'PE' + | 'PF' + | 'PG' | 'PH' - | 'PN' + | 'PK' | 'PL' - | 'PT' + | 'PM' + | 'PN' | 'PR' + | 'PS' + | 'PT' + | 'PW' + | 'PY' | 'QA' | 'RE' | 'RO' + | 'RS' | 'RU' | 'RW' - | 'BL' - | 'SH' - | 'KN' - | 'LC' - | 'MF' - | 'PM' - | 'VC' - | 'WS' - | 'SM' - | 'ST' | 'SA' - | 'SN' - | 'RS' + | 'SB' | 'SC' - | 'SL' + | 'SD' + | 'SE' | 'SG' - | 'SX' - | 'SK' + | 'SH' | 'SI' - | 'SB' + | 'SJ' + | 'SK' + | 'SL' + | 'SM' + | 'SN' | 'SO' - | 'ZA' - | 'GS' - | 'SS' - | 'ES' - | 'LK' - | 'SD' | 'SR' - | 'SJ' - | 'SE' - | 'CH' + | 'SS' + | 'ST' + | 'SV' + | 'SX' | 'SY' - | 'TW' - | 'TJ' - | 'TZ' - | 'TH' - | 'TL' + | 'SZ' + | 'TC' + | 'TD' + | 'TF' | 'TG' + | 'TH' + | 'TJ' | 'TK' - | 'TO' - | 'TT' + | 'TL' + | 'TM' | 'TN' + | 'TO' | 'TR' - | 'TM' - | 'TC' + | 'TT' | 'TV' - | 'UG' + | 'TW' + | 'TZ' | 'UA' - | 'AE' - | 'GB' + | 'UG' + | 'US' | 'UY' | 'UZ' - | 'VU' + | 'VA' + | 'VC' | 'VE' - | 'VN' | 'VG' | 'VI' + | 'VN' + | 'VU' | 'WF' - | 'EH' + | 'WS' + | 'XK' | 'YE' + | 'YT' + | 'ZA' | 'ZM' - | 'ZW' - | 'XK', + | 'ZW', serverName: 'destination_country', }, destinationState: { type: 'string', optional: true, customType: null as unknown as - | 'CA' + | 'AK' | 'AL' | 'AR' | 'AZ' - | 'KY' + | 'CA' | 'CO' - | 'GA' + | 'CT' + | 'DC' | 'DE' - | 'VA' - | 'IN' + | 'FL' + | 'GA' + | 'HI' + | 'IA' | 'ID' | 'IL' + | 'IN' + | 'KS' + | 'KY' | 'LA' - | 'MO' - | 'MT' + | 'MA' | 'MD' - | 'MN' | 'ME' + | 'MI' + | 'MN' + | 'MO' | 'MS' - | 'MA' + | 'MT' | 'NC' + | 'ND' | 'NE' - | 'PA' - | 'SC' - | 'SD' - | 'TN' - | 'AK' - | 'CT' - | 'DC' - | 'FL' - | 'HI' - | 'IA' - | 'KS' - | 'MI' - | 'NV' | 'NH' | 'NJ' | 'NM' + | 'NV' | 'NY' - | 'ND' | 'OH' | 'OK' | 'OR' + | 'PA' | 'RI' + | 'SC' + | 'SD' + | 'TN' | 'TX' | 'UT' + | 'VA' | 'VT' | 'WA' - | 'WV' | 'WI' + | 'WV' | 'WY' | null, serverName: 'destination_state', }, + id: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + orderId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'order_id', + }, + shippedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + serverName: 'shipped_at', + }, + trackingNumber: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'tracking_number', + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], } as const; @@ -5993,22 +5993,11 @@ const shipmentItemTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - shipmentId: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'shipment_id', - }, orderItemId: { type: 'string', optional: false, @@ -6020,6 +6009,17 @@ const shipmentItemTable = { optional: false, customType: null as unknown as number, }, + shipmentId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'shipment_id', + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], serverName: 'shipment_item', @@ -6027,52 +6027,52 @@ const shipmentItemTable = { const supportTicketTable = { name: 'supportTicket', columns: { + assignedTeamId: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'assigned_team_id', + }, createdAt: { type: 'number', optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + customerId: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, + serverName: 'customer_id', }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - customerId: { + priority: { type: 'string', optional: true, customType: null as unknown as string, - serverName: 'customer_id', }, - assignedTeamId: { + source: { type: 'string', optional: true, customType: null as unknown as string, - serverName: 'assigned_team_id', - }, - subject: { - type: 'string', - optional: false, - customType: null as unknown as string, }, status: { type: 'string', optional: false, customType: null as unknown as string, }, - priority: { + subject: { type: 'string', - optional: true, + optional: false, customType: null as unknown as string, }, - source: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -6081,12 +6081,25 @@ const supportTicketTable = { const supportTicketAssignmentTable = { name: 'supportTicketAssignment', columns: { - createdAt: { + assignedAt: { type: 'number', optional: true, customType: null as unknown as number, + serverName: 'assigned_at', }, - updatedAt: { + assigneeId: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'assignee_id', + }, + assignmentType: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'assignment_type', + }, + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -6102,23 +6115,10 @@ const supportTicketAssignmentTable = { customType: null as unknown as string, serverName: 'ticket_id', }, - assigneeId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'assignee_id', - }, - assignedAt: { + updatedAt: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'assigned_at', - }, - assignmentType: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'assignment_type', }, }, primaryKey: ['id'], @@ -6127,15 +6127,26 @@ const supportTicketAssignmentTable = { const supportTicketAuditTable = { name: 'supportTicketAudit', columns: { + action: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + actorId: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'actor_id', + }, createdAt: { type: 'number', optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + details: { + type: 'json', optional: true, - customType: null as unknown as number, + customType: null as unknown as ReadonlyJSONValue, }, id: { type: 'string', @@ -6148,21 +6159,10 @@ const supportTicketAuditTable = { customType: null as unknown as string, serverName: 'ticket_id', }, - actorId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'actor_id', - }, - action: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - details: { - type: 'json', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as ReadonlyJSONValue, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -6171,12 +6171,18 @@ const supportTicketAuditTable = { const supportTicketMessageTable = { name: 'supportTicketMessage', columns: { - createdAt: { - type: 'number', + authorId: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, + serverName: 'author_id', }, - updatedAt: { + body: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -6192,16 +6198,10 @@ const supportTicketMessageTable = { customType: null as unknown as string, serverName: 'ticket_id', }, - authorId: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, - serverName: 'author_id', - }, - body: { - type: 'string', - optional: false, - customType: null as unknown as string, + customType: null as unknown as number, }, visibility: { type: 'string', @@ -6220,10 +6220,10 @@ const supportTicketTagTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + description: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, }, id: { type: 'string', @@ -6235,10 +6235,10 @@ const supportTicketTagTable = { optional: false, customType: null as unknown as string, }, - description: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -6252,27 +6252,27 @@ const supportTicketTagLinkTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - ticketId: { + tagId: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'ticket_id', + serverName: 'tag_id', }, - tagId: { + ticketId: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'tag_id', + serverName: 'ticket_id', + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -6286,21 +6286,16 @@ const teamTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { + departmentId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'department_id', }, - departmentId: { + id: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'department_id', }, leadId: { type: 'string', @@ -6313,6 +6308,11 @@ const teamTable = { optional: false, customType: null as unknown as string, }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], } as const; @@ -6358,12 +6358,6 @@ const testCompositePkBothDefaultsTable = { const testCompositePkOneDefaultTable = { name: 'testCompositePkOneDefault', columns: { - tenantId: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'tenant_id', - }, id: { type: 'number', optional: false, @@ -6374,6 +6368,12 @@ const testCompositePkOneDefaultTable = { optional: false, customType: null as unknown as string, }, + tenantId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'tenant_id', + }, }, primaryKey: ['tenantId', 'id'], serverName: 'test_composite_pk_one_default', @@ -6488,9 +6488,15 @@ const timeEntryTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { + entryDate: { type: 'number', - optional: true, + optional: false, + customType: null as unknown as number, + serverName: 'entry_date', + }, + hours: { + type: 'number', + optional: false, customType: null as unknown as number, }, id: { @@ -6498,11 +6504,10 @@ const timeEntryTable = { optional: false, customType: null as unknown as string, }, - timesheetId: { + notes: { type: 'string', - optional: false, + optional: true, customType: null as unknown as string, - serverName: 'timesheet_id', }, taskId: { type: 'string', @@ -6510,21 +6515,16 @@ const timeEntryTable = { customType: null as unknown as string, serverName: 'task_id', }, - hours: { - type: 'number', - optional: false, - customType: null as unknown as number, - }, - notes: { + timesheetId: { type: 'string', - optional: true, + optional: false, customType: null as unknown as string, + serverName: 'timesheet_id', }, - entryDate: { + updatedAt: { type: 'number', - optional: false, + optional: true, customType: null as unknown as number, - serverName: 'entry_date', }, }, primaryKey: ['id'], @@ -6538,33 +6538,33 @@ const timesheetTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { + employeeId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'employee_id', }, - employeeId: { + id: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'employee_id', }, - periodStart: { + periodEnd: { type: 'number', optional: false, customType: null as unknown as number, - serverName: 'period_start', + serverName: 'period_end', }, - periodEnd: { + periodStart: { type: 'number', optional: false, customType: null as unknown as number, - serverName: 'period_end', + serverName: 'period_start', + }, + status: { + type: 'string', + optional: false, + customType: null as unknown as string, }, submittedById: { type: 'string', @@ -6572,10 +6572,10 @@ const timesheetTable = { customType: null as unknown as string, serverName: 'submitted_by_id', }, - status: { - type: 'string', - optional: false, - customType: null as unknown as string, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -6583,384 +6583,303 @@ const timesheetTable = { const userTable = { name: 'user', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - name: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - partner: { - type: 'boolean', - optional: false, - customType: null as unknown as boolean, - }, - email: { - type: 'string', - optional: false, - customType: null as unknown as `${string}@${string}`, - }, - customTypeJson: { - type: 'json', - optional: false, - customType: null as unknown as UserCustomTypeJsonCustomType, - serverName: 'custom_type_json', - }, - customInterfaceJson: { - type: 'json', - optional: false, - customType: null as unknown as UserCustomInterfaceJsonCustomType, - serverName: 'custom_interface_json', - }, - testInterface: { - type: 'json', - optional: false, - customType: null as unknown as UserTestInterfaceCustomType, - serverName: 'test_interface', - }, - testType: { - type: 'json', - optional: false, - customType: null as unknown as UserTestTypeCustomType, - serverName: 'test_type', - }, - testExportedType: { - type: 'json', - optional: false, - customType: null as unknown as UserTestExportedTypeCustomType, - serverName: 'test_exported_type', - }, - notificationPreferences: { - type: 'json', - optional: false, - customType: null as unknown as UserNotificationPreferencesCustomType, - serverName: 'notification_preferences', - }, countryIso: { type: 'string', optional: false, customType: null as unknown as - | 'US' - | 'MX' - | 'CA' + | 'AD' + | 'AE' | 'AF' - | 'AX' + | 'AG' + | 'AI' | 'AL' - | 'DZ' - | 'AS' - | 'AD' + | 'AM' | 'AO' - | 'AI' | 'AQ' - | 'AG' | 'AR' - | 'AM' - | 'AW' - | 'AU' + | 'AS' | 'AT' + | 'AU' + | 'AW' + | 'AX' | 'AZ' - | 'BS' - | 'BH' - | 'BD' + | 'BA' | 'BB' - | 'BY' + | 'BD' | 'BE' - | 'BZ' - | 'BJ' - | 'BM' - | 'BT' - | 'BO' - | 'BQ' - | 'BA' - | 'BW' - | 'BV' - | 'BR' - | 'IO' - | 'BN' - | 'BG' | 'BF' + | 'BG' + | 'BH' | 'BI' - | 'CV' - | 'KH' - | 'CM' - | 'KY' + | 'BJ' + | 'BL' + | 'BM' + | 'BN' + | 'BO' + | 'BQ' + | 'BR' + | 'BS' + | 'BT' + | 'BV' + | 'BW' + | 'BY' + | 'BZ' + | 'CA' + | 'CC' + | 'CD' | 'CF' - | 'TD' + | 'CG' + | 'CH' + | 'CI' + | 'CK' | 'CL' + | 'CM' | 'CN' - | 'CX' - | 'CC' | 'CO' - | 'KM' - | 'CG' - | 'CD' - | 'CK' | 'CR' - | 'CI' - | 'HR' | 'CU' + | 'CV' | 'CW' + | 'CX' | 'CY' | 'CZ' - | 'DK' + | 'DE' | 'DJ' + | 'DK' | 'DM' | 'DO' + | 'DZ' | 'EC' + | 'EE' | 'EG' - | 'SV' - | 'GQ' + | 'EH' | 'ER' - | 'EE' - | 'SZ' + | 'ES' | 'ET' + | 'FI' + | 'FJ' | 'FK' + | 'FM' | 'FO' - | 'FJ' - | 'FI' | 'FR' - | 'GF' - | 'PF' - | 'TF' | 'GA' - | 'GM' + | 'GB' + | 'GD' | 'GE' - | 'DE' + | 'GF' + | 'GG' | 'GH' | 'GI' - | 'GR' | 'GL' - | 'GD' + | 'GM' + | 'GN' | 'GP' - | 'GU' + | 'GQ' + | 'GR' + | 'GS' | 'GT' - | 'GG' - | 'GN' + | 'GU' | 'GW' | 'GY' - | 'HT' + | 'HK' | 'HM' - | 'VA' | 'HN' - | 'HK' + | 'HR' + | 'HT' | 'HU' - | 'IS' - | 'IN' | 'ID' - | 'IR' - | 'IQ' | 'IE' - | 'IM' | 'IL' + | 'IM' + | 'IN' + | 'IO' + | 'IQ' + | 'IR' + | 'IS' | 'IT' - | 'JM' - | 'JP' | 'JE' + | 'JM' | 'JO' - | 'KZ' + | 'JP' | 'KE' + | 'KG' + | 'KH' | 'KI' + | 'KM' + | 'KN' | 'KP' | 'KR' | 'KW' - | 'KG' + | 'KY' + | 'KZ' | 'LA' - | 'LV' | 'LB' - | 'LS' - | 'LR' - | 'LY' + | 'LC' | 'LI' + | 'LK' + | 'LR' + | 'LS' | 'LT' | 'LU' - | 'MO' + | 'LV' + | 'LY' + | 'MA' + | 'MC' + | 'MD' + | 'ME' + | 'MF' | 'MG' - | 'MW' - | 'MY' - | 'MV' - | 'ML' - | 'MT' | 'MH' + | 'MK' + | 'ML' + | 'MM' + | 'MN' + | 'MO' + | 'MP' | 'MQ' | 'MR' - | 'MU' - | 'YT' - | 'FM' - | 'MD' - | 'MC' - | 'MN' - | 'ME' | 'MS' - | 'MA' + | 'MT' + | 'MU' + | 'MV' + | 'MW' + | 'MX' + | 'MY' | 'MZ' - | 'MM' | 'NA' - | 'NR' - | 'NP' - | 'NL' | 'NC' - | 'NZ' - | 'NI' | 'NE' - | 'NG' - | 'NU' | 'NF' - | 'MK' - | 'MP' + | 'NG' + | 'NI' + | 'NL' | 'NO' + | 'NP' + | 'NR' + | 'NU' + | 'NZ' | 'OM' - | 'PK' - | 'PW' - | 'PS' | 'PA' - | 'PG' - | 'PY' | 'PE' + | 'PF' + | 'PG' | 'PH' - | 'PN' + | 'PK' | 'PL' - | 'PT' + | 'PM' + | 'PN' | 'PR' + | 'PS' + | 'PT' + | 'PW' + | 'PY' | 'QA' | 'RE' | 'RO' + | 'RS' | 'RU' | 'RW' - | 'BL' - | 'SH' - | 'KN' - | 'LC' - | 'MF' - | 'PM' - | 'VC' - | 'WS' - | 'SM' - | 'ST' | 'SA' - | 'SN' - | 'RS' + | 'SB' | 'SC' - | 'SL' + | 'SD' + | 'SE' | 'SG' - | 'SX' - | 'SK' + | 'SH' | 'SI' - | 'SB' + | 'SJ' + | 'SK' + | 'SL' + | 'SM' + | 'SN' | 'SO' - | 'ZA' - | 'GS' - | 'SS' - | 'ES' - | 'LK' - | 'SD' | 'SR' - | 'SJ' - | 'SE' - | 'CH' + | 'SS' + | 'ST' + | 'SV' + | 'SX' | 'SY' - | 'TW' - | 'TJ' - | 'TZ' - | 'TH' - | 'TL' + | 'SZ' + | 'TC' + | 'TD' + | 'TF' | 'TG' + | 'TH' + | 'TJ' | 'TK' - | 'TO' - | 'TT' + | 'TL' + | 'TM' | 'TN' + | 'TO' | 'TR' - | 'TM' - | 'TC' + | 'TT' | 'TV' - | 'UG' + | 'TW' + | 'TZ' | 'UA' - | 'AE' - | 'GB' + | 'UG' + | 'US' | 'UY' | 'UZ' - | 'VU' + | 'VA' + | 'VC' | 'VE' - | 'VN' | 'VG' | 'VI' + | 'VN' + | 'VU' | 'WF' - | 'EH' + | 'WS' + | 'XK' | 'YE' + | 'YT' + | 'ZA' | 'ZM' - | 'ZW' - | 'XK', + | 'ZW', serverName: 'country_iso', }, - regionCode: { + createdAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, + customInterfaceJson: { + type: 'json', + optional: false, + customType: null as unknown as UserCustomInterfaceJsonCustomType, + serverName: 'custom_interface_json', + }, + customTypeJson: { + type: 'json', + optional: false, + customType: null as unknown as UserCustomTypeJsonCustomType, + serverName: 'custom_type_json', + }, + email: { type: 'string', - optional: true, - customType: null as unknown as - | 'CA' - | 'AL' - | 'AR' - | 'AZ' - | 'KY' - | 'CO' - | 'GA' - | 'DE' - | 'VA' - | 'IN' - | 'ID' - | 'IL' - | 'LA' - | 'MO' - | 'MT' - | 'MD' - | 'MN' - | 'ME' - | 'MS' - | 'MA' - | 'NC' - | 'NE' - | 'PA' - | 'SC' - | 'SD' - | 'TN' - | 'AK' - | 'CT' - | 'DC' - | 'FL' - | 'HI' - | 'IA' - | 'KS' - | 'MI' - | 'NV' - | 'NH' - | 'NJ' - | 'NM' - | 'NY' - | 'ND' - | 'OH' - | 'OK' - | 'OR' - | 'RI' - | 'TX' - | 'UT' - | 'VT' - | 'WA' - | 'WV' - | 'WI' - | 'WY' - | null, - serverName: 'region_code', + optional: false, + customType: null as unknown as `${string}@${string}`, + }, + id: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + name: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + notificationPreferences: { + type: 'json', + optional: false, + customType: null as unknown as UserNotificationPreferencesCustomType, + serverName: 'notification_preferences', + }, + partner: { + type: 'boolean', + optional: false, + customType: null as unknown as boolean, }, preferredCurrency: { type: 'string', @@ -7137,304 +7056,137 @@ const userTable = { | 'ZWG', serverName: 'preferred_currency', }, - status: { + regionCode: { type: 'string', optional: true, - customType: null as unknown as 'ASSIGNED' | 'COMPLETED', - }, - }, - primaryKey: ['id'], -} as const; -const analyticsDashboardRelationships = { - owner: [ - { - sourceField: ['ownerId'], - destField: ['id'], - destSchema: 'user', - cardinality: 'one', - }, - ], - widgets: [ - { - sourceField: ['id'], - destField: ['dashboardId'], - destSchema: 'analyticsWidget', - cardinality: 'many', - }, - ], -} as const; -const analyticsWidgetRelationships = { - dashboard: [ - { - sourceField: ['dashboardId'], - destField: ['id'], - destSchema: 'analyticsDashboard', - cardinality: 'one', - }, - ], - queries: [ - { - sourceField: ['id'], - destField: ['widgetId'], - destSchema: 'analyticsWidgetQuery', - cardinality: 'many', - }, - ], -} as const; -const analyticsWidgetQueryRelationships = { - widget: [ - { - sourceField: ['widgetId'], - destField: ['id'], - destSchema: 'analyticsWidget', - cardinality: 'one', - }, - ], -} as const; -const productCategoryRelationships = { - parent: [ - { - sourceField: ['parentId'], - destField: ['id'], - destSchema: 'productCategory', - cardinality: 'one', - }, - ], - children: [ - { - sourceField: ['id'], - destField: ['parentId'], - destSchema: 'productCategory', - cardinality: 'many', - }, - ], - products: [ - { - sourceField: ['id'], - destField: ['categoryId'], - destSchema: 'product', - cardinality: 'many', - }, - ], -} as const; -const productRelationships = { - category: [ - { - sourceField: ['categoryId'], - destField: ['id'], - destSchema: 'productCategory', - cardinality: 'one', - }, - ], - variants: [ - { - sourceField: ['id'], - destField: ['productId'], - destSchema: 'productVariant', - cardinality: 'many', - }, - ], - media: [ - { - sourceField: ['id'], - destField: ['productId'], - destSchema: 'productMedia', - cardinality: 'many', - }, - ], -} as const; -const productVariantRelationships = { - product: [ - { - sourceField: ['productId'], - destField: ['id'], - destSchema: 'product', - cardinality: 'one', - }, - ], - inventoryItems: [ - { - sourceField: ['id'], - destField: ['variantId'], - destSchema: 'inventoryItem', - cardinality: 'many', - }, - ], - inventoryLevels: [ - { - sourceField: ['id'], - destField: ['variantId'], - destSchema: 'inventoryLevel', - cardinality: 'many', - }, - ], - orderItems: [ - { - sourceField: ['id'], - destField: ['variantId'], - destSchema: 'orderItem', - cardinality: 'many', + customType: null as unknown as + | 'AK' + | 'AL' + | 'AR' + | 'AZ' + | 'CA' + | 'CO' + | 'CT' + | 'DC' + | 'DE' + | 'FL' + | 'GA' + | 'HI' + | 'IA' + | 'ID' + | 'IL' + | 'IN' + | 'KS' + | 'KY' + | 'LA' + | 'MA' + | 'MD' + | 'ME' + | 'MI' + | 'MN' + | 'MO' + | 'MS' + | 'MT' + | 'NC' + | 'ND' + | 'NE' + | 'NH' + | 'NJ' + | 'NM' + | 'NV' + | 'NY' + | 'OH' + | 'OK' + | 'OR' + | 'PA' + | 'RI' + | 'SC' + | 'SD' + | 'TN' + | 'TX' + | 'UT' + | 'VA' + | 'VT' + | 'WA' + | 'WI' + | 'WV' + | 'WY' + | null, + serverName: 'region_code', }, - ], -} as const; -const productMediaRelationships = { - product: [ - { - sourceField: ['productId'], - destField: ['id'], - destSchema: 'product', - cardinality: 'one', + status: { + type: 'string', + optional: true, + customType: null as unknown as 'ASSIGNED' | 'COMPLETED', }, - ], -} as const; -const inventoryLocationRelationships = { - levels: [ - { - sourceField: ['id'], - destField: ['locationId'], - destSchema: 'inventoryLevel', - cardinality: 'many', + testExportedType: { + type: 'json', + optional: false, + customType: null as unknown as UserTestExportedTypeCustomType, + serverName: 'test_exported_type', }, - ], -} as const; -const inventoryItemRelationships = { - variant: [ - { - sourceField: ['variantId'], - destField: ['id'], - destSchema: 'productVariant', - cardinality: 'one', + testInterface: { + type: 'json', + optional: false, + customType: null as unknown as UserTestInterfaceCustomType, + serverName: 'test_interface', }, - ], -} as const; -const inventoryLevelRelationships = { - location: [ - { - sourceField: ['locationId'], - destField: ['id'], - destSchema: 'inventoryLocation', - cardinality: 'one', + testType: { + type: 'json', + optional: false, + customType: null as unknown as UserTestTypeCustomType, + serverName: 'test_type', }, - ], - variant: [ - { - sourceField: ['variantId'], - destField: ['id'], - destSchema: 'productVariant', - cardinality: 'one', + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, - ], + }, + primaryKey: ['id'], } as const; -const orderTableRelationships = { - customer: [ +const analyticsDashboardRelationships = { + owner: [ { - sourceField: ['customerId'], + sourceField: ['ownerId'], destField: ['id'], destSchema: 'user', cardinality: 'one', }, ], - opportunity: [ - { - sourceField: ['opportunityId'], - destField: ['id'], - destSchema: 'crmOpportunity', - cardinality: 'one', - }, - ], - items: [ - { - sourceField: ['id'], - destField: ['orderId'], - destSchema: 'orderItem', - cardinality: 'many', - }, - ], - payments: [ - { - sourceField: ['id'], - destField: ['orderId'], - destSchema: 'orderPayment', - cardinality: 'many', - }, - ], - shipments: [ + widgets: [ { sourceField: ['id'], - destField: ['orderId'], - destSchema: 'shipment', + destField: ['dashboardId'], + destSchema: 'analyticsWidget', cardinality: 'many', }, ], } as const; -const orderItemRelationships = { - order: [ - { - sourceField: ['orderId'], - destField: ['id'], - destSchema: 'orderTable', - cardinality: 'one', - }, - ], - variant: [ - { - sourceField: ['variantId'], - destField: ['id'], - destSchema: 'productVariant', - cardinality: 'one', - }, - ], -} as const; -const orderPaymentRelationships = { - order: [ - { - sourceField: ['orderId'], - destField: ['id'], - destSchema: 'orderTable', - cardinality: 'one', - }, - ], - payment: [ - { - sourceField: ['paymentId'], - destField: ['id'], - destSchema: 'payment', - cardinality: 'one', - }, - ], -} as const; -const shipmentRelationships = { - order: [ +const analyticsWidgetRelationships = { + dashboard: [ { - sourceField: ['orderId'], + sourceField: ['dashboardId'], destField: ['id'], - destSchema: 'orderTable', + destSchema: 'analyticsDashboard', cardinality: 'one', }, ], - items: [ + queries: [ { sourceField: ['id'], - destField: ['shipmentId'], - destSchema: 'shipmentItem', + destField: ['widgetId'], + destSchema: 'analyticsWidgetQuery', cardinality: 'many', }, ], } as const; -const shipmentItemRelationships = { - shipment: [ - { - sourceField: ['shipmentId'], - destField: ['id'], - destSchema: 'shipment', - cardinality: 'one', - }, - ], - orderItem: [ +const analyticsWidgetQueryRelationships = { + widget: [ { - sourceField: ['orderItemId'], + sourceField: ['widgetId'], destField: ['id'], - destSchema: 'orderItem', + destSchema: 'analyticsWidget', cardinality: 'one', }, ], @@ -7546,30 +7298,30 @@ const budgetRelationships = { ], } as const; const budgetLineRelationships = { - budget: [ + account: [ { - sourceField: ['budgetId'], + sourceField: ['accountId'], destField: ['id'], - destSchema: 'budget', + destSchema: 'ledgerAccount', cardinality: 'one', }, ], - account: [ + budget: [ { - sourceField: ['accountId'], + sourceField: ['budgetId'], destField: ['id'], - destSchema: 'ledgerAccount', + destSchema: 'budget', cardinality: 'one', }, ], } as const; const crmAccountRelationships = { - owner: [ + activities: [ { - sourceField: ['ownerId'], - destField: ['id'], - destSchema: 'user', - cardinality: 'one', + sourceField: ['id'], + destField: ['accountId'], + destSchema: 'crmActivity', + cardinality: 'many', }, ], contacts: [ @@ -7580,28 +7332,28 @@ const crmAccountRelationships = { cardinality: 'many', }, ], - opportunities: [ + notes: [ { sourceField: ['id'], destField: ['accountId'], - destSchema: 'crmOpportunity', + destSchema: 'crmNote', cardinality: 'many', }, ], - activities: [ + opportunities: [ { sourceField: ['id'], destField: ['accountId'], - destSchema: 'crmActivity', + destSchema: 'crmOpportunity', cardinality: 'many', }, ], - notes: [ + owner: [ { - sourceField: ['id'], - destField: ['accountId'], - destSchema: 'crmNote', - cardinality: 'many', + sourceField: ['ownerId'], + destField: ['id'], + destSchema: 'user', + cardinality: 'one', }, ], } as const; @@ -7630,19 +7382,19 @@ const crmActivityRelationships = { cardinality: 'one', }, ], - type: [ + performer: [ { - sourceField: ['typeId'], + sourceField: ['performedById'], destField: ['id'], - destSchema: 'crmActivityType', + destSchema: 'user', cardinality: 'one', }, ], - performer: [ + type: [ { - sourceField: ['performedById'], + sourceField: ['typeId'], destField: ['id'], - destSchema: 'user', + destSchema: 'crmActivityType', cardinality: 'one', }, ], @@ -7692,19 +7444,19 @@ const crmNoteRelationships = { cardinality: 'one', }, ], - contact: [ + author: [ { - sourceField: ['contactId'], + sourceField: ['authorId'], destField: ['id'], - destSchema: 'crmContact', + destSchema: 'user', cardinality: 'one', }, ], - author: [ + contact: [ { - sourceField: ['authorId'], + sourceField: ['contactId'], destField: ['id'], - destSchema: 'user', + destSchema: 'crmContact', cardinality: 'one', }, ], @@ -7718,14 +7470,6 @@ const crmOpportunityRelationships = { cardinality: 'one', }, ], - stage: [ - { - sourceField: ['stageId'], - destField: ['id'], - destSchema: 'crmPipelineStage', - cardinality: 'one', - }, - ], activities: [ { sourceField: ['id'], @@ -7742,8 +7486,24 @@ const crmOpportunityRelationships = { cardinality: 'many', }, ], + stage: [ + { + sourceField: ['stageId'], + destField: ['id'], + destSchema: 'crmPipelineStage', + cardinality: 'one', + }, + ], } as const; const crmOpportunityStageHistoryRelationships = { + changedBy: [ + { + sourceField: ['changedById'], + destField: ['id'], + destSchema: 'user', + cardinality: 'one', + }, + ], opportunity: [ { sourceField: ['opportunityId'], @@ -7760,34 +7520,34 @@ const crmOpportunityStageHistoryRelationships = { cardinality: 'one', }, ], - changedBy: [ - { - sourceField: ['changedById'], - destField: ['id'], - destSchema: 'user', - cardinality: 'one', - }, - ], } as const; const crmPipelineStageRelationships = { - opportunities: [ + historyEntries: [ { sourceField: ['id'], destField: ['stageId'], - destSchema: 'crmOpportunity', + destSchema: 'crmOpportunityStageHistory', cardinality: 'many', }, ], - historyEntries: [ + opportunities: [ { sourceField: ['id'], destField: ['stageId'], - destSchema: 'crmOpportunityStageHistory', + destSchema: 'crmOpportunity', cardinality: 'many', }, ], } as const; const departmentRelationships = { + employees: [ + { + sourceField: ['id'], + destField: ['departmentId'], + destSchema: 'employeeProfile', + cardinality: 'many', + }, + ], manager: [ { sourceField: ['managerId'], @@ -7804,14 +7564,6 @@ const departmentRelationships = { cardinality: 'many', }, ], - employees: [ - { - sourceField: ['id'], - destField: ['departmentId'], - destSchema: 'employeeProfile', - cardinality: 'many', - }, - ], } as const; const documentFileRelationships = { folder: [ @@ -7822,6 +7574,14 @@ const documentFileRelationships = { cardinality: 'one', }, ], + sharings: [ + { + sourceField: ['id'], + destField: ['fileId'], + destSchema: 'documentSharing', + cardinality: 'many', + }, + ], uploader: [ { sourceField: ['uploadedById'], @@ -7838,14 +7598,6 @@ const documentFileRelationships = { cardinality: 'many', }, ], - sharings: [ - { - sourceField: ['id'], - destField: ['fileId'], - destSchema: 'documentSharing', - cardinality: 'many', - }, - ], } as const; const documentFileVersionRelationships = { file: [ @@ -7866,6 +7618,22 @@ const documentFileVersionRelationships = { ], } as const; const documentFolderRelationships = { + children: [ + { + sourceField: ['id'], + destField: ['parentId'], + destSchema: 'documentFolder', + cardinality: 'many', + }, + ], + files: [ + { + sourceField: ['id'], + destField: ['folderId'], + destSchema: 'documentFile', + cardinality: 'many', + }, + ], library: [ { sourceField: ['libraryId'], @@ -7882,24 +7650,16 @@ const documentFolderRelationships = { cardinality: 'one', }, ], - children: [ +} as const; +const documentLibraryRelationships = { + folders: [ { sourceField: ['id'], - destField: ['parentId'], + destField: ['libraryId'], destSchema: 'documentFolder', cardinality: 'many', }, ], - files: [ - { - sourceField: ['id'], - destField: ['folderId'], - destSchema: 'documentFile', - cardinality: 'many', - }, - ], -} as const; -const documentLibraryRelationships = { project: [ { sourceField: ['projectId'], @@ -7908,14 +7668,6 @@ const documentLibraryRelationships = { cardinality: 'one', }, ], - folders: [ - { - sourceField: ['id'], - destField: ['libraryId'], - destSchema: 'documentFolder', - cardinality: 'many', - }, - ], } as const; const documentSharingRelationships = { file: [ @@ -7926,19 +7678,19 @@ const documentSharingRelationships = { cardinality: 'one', }, ], - user: [ + team: [ { - sourceField: ['sharedWithUserId'], + sourceField: ['sharedWithTeamId'], destField: ['id'], - destSchema: 'user', + destSchema: 'team', cardinality: 'one', }, ], - team: [ + user: [ { - sourceField: ['sharedWithTeamId'], + sourceField: ['sharedWithUserId'], destField: ['id'], - destSchema: 'team', + destSchema: 'user', cardinality: 'one', }, ], @@ -7962,12 +7714,12 @@ const employeeDocumentRelationships = { ], } as const; const employeeProfileRelationships = { - user: [ + benefitEnrollments: [ { - sourceField: ['userId'], - destField: ['id'], - destSchema: 'user', - cardinality: 'one', + sourceField: ['id'], + destField: ['employeeId'], + destSchema: 'benefitEnrollment', + cardinality: 'many', }, ], department: [ @@ -7978,12 +7730,12 @@ const employeeProfileRelationships = { cardinality: 'one', }, ], - team: [ + documents: [ { - sourceField: ['teamId'], - destField: ['id'], - destSchema: 'team', - cardinality: 'one', + sourceField: ['id'], + destField: ['employeeId'], + destSchema: 'employeeDocument', + cardinality: 'many', }, ], employmentHistory: [ @@ -7994,12 +7746,12 @@ const employeeProfileRelationships = { cardinality: 'many', }, ], - documents: [ + team: [ { - sourceField: ['id'], - destField: ['employeeId'], - destSchema: 'employeeDocument', - cardinality: 'many', + sourceField: ['teamId'], + destField: ['id'], + destSchema: 'team', + cardinality: 'one', }, ], timesheets: [ @@ -8010,12 +7762,12 @@ const employeeProfileRelationships = { cardinality: 'many', }, ], - benefitEnrollments: [ + user: [ { - sourceField: ['id'], - destField: ['employeeId'], - destSchema: 'benefitEnrollment', - cardinality: 'many', + sourceField: ['userId'], + destField: ['id'], + destSchema: 'user', + cardinality: 'one', }, ], } as const; @@ -8040,14 +7792,6 @@ const expenseItemRelationships = { ], } as const; const expenseReportRelationships = { - owner: [ - { - sourceField: ['ownerId'], - destField: ['id'], - destSchema: 'user', - cardinality: 'one', - }, - ], department: [ { sourceField: ['departmentId'], @@ -8064,16 +7808,16 @@ const expenseReportRelationships = { cardinality: 'many', }, ], -} as const; -const filtersRelationships = { - parent: [ + owner: [ { - sourceField: ['parentId'], + sourceField: ['ownerId'], destField: ['id'], - destSchema: 'filters', + destSchema: 'user', cardinality: 'one', }, ], +} as const; +const filtersRelationships = { children: [ { sourceField: ['id'], @@ -8082,6 +7826,14 @@ const filtersRelationships = { cardinality: 'many', }, ], + parent: [ + { + sourceField: ['parentId'], + destField: ['id'], + destSchema: 'filters', + cardinality: 'one', + }, + ], } as const; const integrationCredentialRelationships = { webhook: [ @@ -8104,14 +7856,6 @@ const integrationEventRelationships = { ], } as const; const integrationWebhookRelationships = { - project: [ - { - sourceField: ['projectId'], - destField: ['id'], - destSchema: 'project', - cardinality: 'one', - }, - ], account: [ { sourceField: ['accountId'], @@ -8128,50 +7872,88 @@ const integrationWebhookRelationships = { cardinality: 'many', }, ], + project: [ + { + sourceField: ['projectId'], + destField: ['id'], + destSchema: 'project', + cardinality: 'one', + }, + ], } as const; -const ledgerAccountRelationships = { - parent: [ +const inventoryItemRelationships = { + variant: [ { - sourceField: ['parentAccountId'], + sourceField: ['variantId'], destField: ['id'], - destSchema: 'ledgerAccount', + destSchema: 'productVariant', cardinality: 'one', }, ], - children: [ +} as const; +const inventoryLevelRelationships = { + location: [ + { + sourceField: ['locationId'], + destField: ['id'], + destSchema: 'inventoryLocation', + cardinality: 'one', + }, + ], + variant: [ + { + sourceField: ['variantId'], + destField: ['id'], + destSchema: 'productVariant', + cardinality: 'one', + }, + ], +} as const; +const inventoryLocationRelationships = { + levels: [ { sourceField: ['id'], - destField: ['parentAccountId'], - destSchema: 'ledgerAccount', + destField: ['locationId'], + destSchema: 'inventoryLevel', cardinality: 'many', }, ], - entries: [ +} as const; +const ledgerAccountRelationships = { + budgetLines: [ { sourceField: ['id'], destField: ['accountId'], - destSchema: 'ledgerEntry', + destSchema: 'budgetLine', cardinality: 'many', }, ], - budgetLines: [ + children: [ + { + sourceField: ['id'], + destField: ['parentAccountId'], + destSchema: 'ledgerAccount', + cardinality: 'many', + }, + ], + entries: [ { sourceField: ['id'], destField: ['accountId'], - destSchema: 'budgetLine', + destSchema: 'ledgerEntry', cardinality: 'many', }, ], -} as const; -const ledgerEntryRelationships = { - transaction: [ + parent: [ { - sourceField: ['transactionId'], + sourceField: ['parentAccountId'], destField: ['id'], - destSchema: 'ledgerTransaction', + destSchema: 'ledgerAccount', cardinality: 'one', }, ], +} as const; +const ledgerEntryRelationships = { account: [ { sourceField: ['accountId'], @@ -8180,6 +7962,14 @@ const ledgerEntryRelationships = { cardinality: 'one', }, ], + transaction: [ + { + sourceField: ['transactionId'], + destField: ['id'], + destSchema: 'ledgerTransaction', + cardinality: 'one', + }, + ], } as const; const ledgerTransactionRelationships = { creator: [ @@ -8210,12 +8000,12 @@ const marketingAudienceRelationships = { ], } as const; const marketingCampaignRelationships = { - owner: [ + audiences: [ { - sourceField: ['ownerId'], - destField: ['id'], - destSchema: 'user', - cardinality: 'one', + sourceField: ['id'], + destField: ['campaignId'], + destSchema: 'marketingCampaignAudience', + cardinality: 'many', }, ], channels: [ @@ -8226,29 +8016,29 @@ const marketingCampaignRelationships = { cardinality: 'many', }, ], - audiences: [ + owner: [ { - sourceField: ['id'], - destField: ['campaignId'], - destSchema: 'marketingCampaignAudience', - cardinality: 'many', + sourceField: ['ownerId'], + destField: ['id'], + destSchema: 'user', + cardinality: 'one', }, ], } as const; const marketingCampaignAudienceRelationships = { - campaign: [ + audience: [ { - sourceField: ['campaignId'], + sourceField: ['audienceId'], destField: ['id'], - destSchema: 'marketingCampaign', + destSchema: 'marketingAudience', cardinality: 'one', }, ], - audience: [ + campaign: [ { - sourceField: ['audienceId'], + sourceField: ['campaignId'], destField: ['id'], - destSchema: 'marketingAudience', + destSchema: 'marketingCampaign', cardinality: 'one', }, ], @@ -8323,28 +8113,186 @@ const messageRelationships = { }, ], } as const; -const projectRelationships = { - owner: [ +const orderItemRelationships = { + order: [ { - sourceField: ['ownerId'], + sourceField: ['orderId'], + destField: ['id'], + destSchema: 'orderTable', + cardinality: 'one', + }, + ], + variant: [ + { + sourceField: ['variantId'], + destField: ['id'], + destSchema: 'productVariant', + cardinality: 'one', + }, + ], +} as const; +const orderPaymentRelationships = { + order: [ + { + sourceField: ['orderId'], + destField: ['id'], + destSchema: 'orderTable', + cardinality: 'one', + }, + ], + payment: [ + { + sourceField: ['paymentId'], + destField: ['id'], + destSchema: 'payment', + cardinality: 'one', + }, + ], +} as const; +const orderTableRelationships = { + customer: [ + { + sourceField: ['customerId'], destField: ['id'], destSchema: 'user', cardinality: 'one', }, ], - phases: [ + items: [ { sourceField: ['id'], - destField: ['projectId'], - destSchema: 'projectPhase', + destField: ['orderId'], + destSchema: 'orderItem', cardinality: 'many', }, ], - tasks: [ + opportunity: [ + { + sourceField: ['opportunityId'], + destField: ['id'], + destSchema: 'crmOpportunity', + cardinality: 'one', + }, + ], + payments: [ + { + sourceField: ['id'], + destField: ['orderId'], + destSchema: 'orderPayment', + cardinality: 'many', + }, + ], + shipments: [ + { + sourceField: ['id'], + destField: ['orderId'], + destSchema: 'shipment', + cardinality: 'many', + }, + ], +} as const; +const productRelationships = { + category: [ + { + sourceField: ['categoryId'], + destField: ['id'], + destSchema: 'productCategory', + cardinality: 'one', + }, + ], + media: [ + { + sourceField: ['id'], + destField: ['productId'], + destSchema: 'productMedia', + cardinality: 'many', + }, + ], + variants: [ + { + sourceField: ['id'], + destField: ['productId'], + destSchema: 'productVariant', + cardinality: 'many', + }, + ], +} as const; +const productCategoryRelationships = { + children: [ + { + sourceField: ['id'], + destField: ['parentId'], + destSchema: 'productCategory', + cardinality: 'many', + }, + ], + parent: [ + { + sourceField: ['parentId'], + destField: ['id'], + destSchema: 'productCategory', + cardinality: 'one', + }, + ], + products: [ + { + sourceField: ['id'], + destField: ['categoryId'], + destSchema: 'product', + cardinality: 'many', + }, + ], +} as const; +const productMediaRelationships = { + product: [ + { + sourceField: ['productId'], + destField: ['id'], + destSchema: 'product', + cardinality: 'one', + }, + ], +} as const; +const productVariantRelationships = { + inventoryItems: [ + { + sourceField: ['id'], + destField: ['variantId'], + destSchema: 'inventoryItem', + cardinality: 'many', + }, + ], + inventoryLevels: [ + { + sourceField: ['id'], + destField: ['variantId'], + destSchema: 'inventoryLevel', + cardinality: 'many', + }, + ], + orderItems: [ + { + sourceField: ['id'], + destField: ['variantId'], + destSchema: 'orderItem', + cardinality: 'many', + }, + ], + product: [ + { + sourceField: ['productId'], + destField: ['id'], + destSchema: 'product', + cardinality: 'one', + }, + ], +} as const; +const projectRelationships = { + audits: [ { sourceField: ['id'], destField: ['projectId'], - destSchema: 'projectTask', + destSchema: 'projectAudit', cardinality: 'many', }, ], @@ -8356,11 +8304,27 @@ const projectRelationships = { cardinality: 'many', }, ], - audits: [ + owner: [ + { + sourceField: ['ownerId'], + destField: ['id'], + destSchema: 'user', + cardinality: 'one', + }, + ], + phases: [ { sourceField: ['id'], destField: ['projectId'], - destSchema: 'projectAudit', + destSchema: 'projectPhase', + cardinality: 'many', + }, + ], + tasks: [ + { + sourceField: ['id'], + destField: ['projectId'], + destSchema: 'projectTask', cardinality: 'many', }, ], @@ -8386,14 +8350,22 @@ const projectAssignmentRelationships = { const projectAttachmentRelationships = { task: [ { - sourceField: ['taskId'], + sourceField: ['taskId'], + destField: ['id'], + destSchema: 'projectTask', + cardinality: 'one', + }, + ], +} as const; +const projectAuditRelationships = { + actor: [ + { + sourceField: ['actorId'], destField: ['id'], - destSchema: 'projectTask', + destSchema: 'user', cardinality: 'one', }, ], -} as const; -const projectAuditRelationships = { project: [ { sourceField: ['projectId'], @@ -8402,16 +8374,16 @@ const projectAuditRelationships = { cardinality: 'one', }, ], - actor: [ +} as const; +const projectCommentRelationships = { + author: [ { - sourceField: ['actorId'], + sourceField: ['authorId'], destField: ['id'], destSchema: 'user', cardinality: 'one', }, ], -} as const; -const projectCommentRelationships = { task: [ { sourceField: ['taskId'], @@ -8420,6 +8392,8 @@ const projectCommentRelationships = { cardinality: 'one', }, ], +} as const; +const projectNoteRelationships = { author: [ { sourceField: ['authorId'], @@ -8428,8 +8402,6 @@ const projectCommentRelationships = { cardinality: 'one', }, ], -} as const; -const projectNoteRelationships = { project: [ { sourceField: ['projectId'], @@ -8438,14 +8410,6 @@ const projectNoteRelationships = { cardinality: 'one', }, ], - author: [ - { - sourceField: ['authorId'], - destField: ['id'], - destSchema: 'user', - cardinality: 'one', - }, - ], } as const; const projectPhaseRelationships = { project: [ @@ -8476,22 +8440,6 @@ const projectTagRelationships = { ], } as const; const projectTaskRelationships = { - project: [ - { - sourceField: ['projectId'], - destField: ['id'], - destSchema: 'project', - cardinality: 'one', - }, - ], - phase: [ - { - sourceField: ['phaseId'], - destField: ['id'], - destSchema: 'projectPhase', - cardinality: 'one', - }, - ], assignments: [ { sourceField: ['id'], @@ -8500,22 +8448,38 @@ const projectTaskRelationships = { cardinality: 'many', }, ], - comments: [ + attachments: [ { sourceField: ['id'], destField: ['taskId'], - destSchema: 'projectComment', + destSchema: 'projectAttachment', cardinality: 'many', }, ], - attachments: [ + comments: [ { sourceField: ['id'], destField: ['taskId'], - destSchema: 'projectAttachment', + destSchema: 'projectComment', cardinality: 'many', }, ], + phase: [ + { + sourceField: ['phaseId'], + destField: ['id'], + destSchema: 'projectPhase', + cardinality: 'one', + }, + ], + project: [ + { + sourceField: ['projectId'], + destField: ['id'], + destSchema: 'project', + cardinality: 'one', + }, + ], tags: [ { sourceField: ['id'], @@ -8526,6 +8490,14 @@ const projectTaskRelationships = { ], } as const; const projectTaskTagRelationships = { + tag: [ + { + sourceField: ['tagId'], + destField: ['id'], + destSchema: 'projectTag', + cardinality: 'one', + }, + ], task: [ { sourceField: ['taskId'], @@ -8534,24 +8506,44 @@ const projectTaskTagRelationships = { cardinality: 'one', }, ], - tag: [ +} as const; +const shipmentRelationships = { + items: [ { - sourceField: ['tagId'], + sourceField: ['id'], + destField: ['shipmentId'], + destSchema: 'shipmentItem', + cardinality: 'many', + }, + ], + order: [ + { + sourceField: ['orderId'], destField: ['id'], - destSchema: 'projectTag', + destSchema: 'orderTable', cardinality: 'one', }, ], } as const; -const supportTicketRelationships = { - customer: [ +const shipmentItemRelationships = { + orderItem: [ { - sourceField: ['customerId'], + sourceField: ['orderItemId'], destField: ['id'], - destSchema: 'user', + destSchema: 'orderItem', + cardinality: 'one', + }, + ], + shipment: [ + { + sourceField: ['shipmentId'], + destField: ['id'], + destSchema: 'shipment', cardinality: 'one', }, ], +} as const; +const supportTicketRelationships = { assignedTeam: [ { sourceField: ['assignedTeamId'], @@ -8560,48 +8552,48 @@ const supportTicketRelationships = { cardinality: 'one', }, ], - messages: [ + assignments: [ { sourceField: ['id'], destField: ['ticketId'], - destSchema: 'supportTicketMessage', + destSchema: 'supportTicketAssignment', cardinality: 'many', }, ], - tags: [ + audits: [ { sourceField: ['id'], destField: ['ticketId'], - destSchema: 'supportTicketTagLink', + destSchema: 'supportTicketAudit', cardinality: 'many', }, ], - assignments: [ + customer: [ + { + sourceField: ['customerId'], + destField: ['id'], + destSchema: 'user', + cardinality: 'one', + }, + ], + messages: [ { sourceField: ['id'], destField: ['ticketId'], - destSchema: 'supportTicketAssignment', + destSchema: 'supportTicketMessage', cardinality: 'many', }, ], - audits: [ + tags: [ { sourceField: ['id'], destField: ['ticketId'], - destSchema: 'supportTicketAudit', + destSchema: 'supportTicketTagLink', cardinality: 'many', }, ], } as const; const supportTicketAssignmentRelationships = { - ticket: [ - { - sourceField: ['ticketId'], - destField: ['id'], - destSchema: 'supportTicket', - cardinality: 'one', - }, - ], assignee: [ { sourceField: ['assigneeId'], @@ -8610,8 +8602,6 @@ const supportTicketAssignmentRelationships = { cardinality: 'one', }, ], -} as const; -const supportTicketAuditRelationships = { ticket: [ { sourceField: ['ticketId'], @@ -8620,6 +8610,8 @@ const supportTicketAuditRelationships = { cardinality: 'one', }, ], +} as const; +const supportTicketAuditRelationships = { actor: [ { sourceField: ['actorId'], @@ -8628,8 +8620,6 @@ const supportTicketAuditRelationships = { cardinality: 'one', }, ], -} as const; -const supportTicketMessageRelationships = { ticket: [ { sourceField: ['ticketId'], @@ -8638,6 +8628,8 @@ const supportTicketMessageRelationships = { cardinality: 'one', }, ], +} as const; +const supportTicketMessageRelationships = { author: [ { sourceField: ['authorId'], @@ -8646,6 +8638,14 @@ const supportTicketMessageRelationships = { cardinality: 'one', }, ], + ticket: [ + { + sourceField: ['ticketId'], + destField: ['id'], + destSchema: 'supportTicket', + cardinality: 'one', + }, + ], } as const; const supportTicketTagRelationships = { ticketLinks: [ @@ -8658,19 +8658,19 @@ const supportTicketTagRelationships = { ], } as const; const supportTicketTagLinkRelationships = { - ticket: [ + tag: [ { - sourceField: ['ticketId'], + sourceField: ['tagId'], destField: ['id'], - destSchema: 'supportTicket', + destSchema: 'supportTicketTag', cardinality: 'one', }, ], - tag: [ + ticket: [ { - sourceField: ['tagId'], + sourceField: ['ticketId'], destField: ['id'], - destSchema: 'supportTicketTag', + destSchema: 'supportTicket', cardinality: 'one', }, ], @@ -8684,14 +8684,6 @@ const teamRelationships = { cardinality: 'one', }, ], - lead: [ - { - sourceField: ['leadId'], - destField: ['id'], - destSchema: 'user', - cardinality: 'one', - }, - ], employees: [ { sourceField: ['id'], @@ -8700,16 +8692,16 @@ const teamRelationships = { cardinality: 'many', }, ], -} as const; -const timeEntryRelationships = { - timesheet: [ + lead: [ { - sourceField: ['timesheetId'], + sourceField: ['leadId'], destField: ['id'], - destSchema: 'timesheet', + destSchema: 'user', cardinality: 'one', }, ], +} as const; +const timeEntryRelationships = { task: [ { sourceField: ['taskId'], @@ -8718,6 +8710,14 @@ const timeEntryRelationships = { cardinality: 'one', }, ], + timesheet: [ + { + sourceField: ['timesheetId'], + destField: ['id'], + destSchema: 'timesheet', + cardinality: 'one', + }, + ], } as const; const timesheetRelationships = { employee: [ @@ -8728,6 +8728,14 @@ const timesheetRelationships = { cardinality: 'one', }, ], + entries: [ + { + sourceField: ['id'], + destField: ['timesheetId'], + destSchema: 'timeEntry', + cardinality: 'many', + }, + ], submittedBy: [ { sourceField: ['submittedById'], @@ -8736,21 +8744,19 @@ const timesheetRelationships = { cardinality: 'one', }, ], - entries: [ +} as const; +const userRelationships = { + friends: [ { sourceField: ['id'], - destField: ['timesheetId'], - destSchema: 'timeEntry', + destField: ['requestingId'], + destSchema: 'friendship', cardinality: 'many', }, - ], -} as const; -const userRelationships = { - messages: [ { - sourceField: ['id'], - destField: ['senderId'], - destSchema: 'message', + sourceField: ['acceptingId'], + destField: ['id'], + destSchema: 'user', cardinality: 'many', }, ], @@ -8768,17 +8774,11 @@ const userRelationships = { cardinality: 'many', }, ], - friends: [ + messages: [ { sourceField: ['id'], - destField: ['requestingId'], - destSchema: 'friendship', - cardinality: 'many', - }, - { - sourceField: ['acceptingId'], - destField: ['id'], - destSchema: 'user', + destField: ['senderId'], + destSchema: 'message', cardinality: 'many', }, ], @@ -8881,18 +8881,6 @@ export const schema = { analyticsDashboard: analyticsDashboardRelationships, analyticsWidget: analyticsWidgetRelationships, analyticsWidgetQuery: analyticsWidgetQueryRelationships, - productCategory: productCategoryRelationships, - product: productRelationships, - productVariant: productVariantRelationships, - productMedia: productMediaRelationships, - inventoryLocation: inventoryLocationRelationships, - inventoryItem: inventoryItemRelationships, - inventoryLevel: inventoryLevelRelationships, - orderTable: orderTableRelationships, - orderItem: orderItemRelationships, - orderPayment: orderPaymentRelationships, - shipment: shipmentRelationships, - shipmentItem: shipmentItemRelationships, benefitEnrollment: benefitEnrollmentRelationships, benefitPlan: benefitPlanRelationships, billingInvoice: billingInvoiceRelationships, @@ -8922,6 +8910,9 @@ export const schema = { integrationCredential: integrationCredentialRelationships, integrationEvent: integrationEventRelationships, integrationWebhook: integrationWebhookRelationships, + inventoryItem: inventoryItemRelationships, + inventoryLevel: inventoryLevelRelationships, + inventoryLocation: inventoryLocationRelationships, ledgerAccount: ledgerAccountRelationships, ledgerEntry: ledgerEntryRelationships, ledgerTransaction: ledgerTransactionRelationships, @@ -8932,6 +8923,13 @@ export const schema = { marketingChannel: marketingChannelRelationships, medium: mediumRelationships, message: messageRelationships, + orderItem: orderItemRelationships, + orderPayment: orderPaymentRelationships, + orderTable: orderTableRelationships, + product: productRelationships, + productCategory: productCategoryRelationships, + productMedia: productMediaRelationships, + productVariant: productVariantRelationships, project: projectRelationships, projectAssignment: projectAssignmentRelationships, projectAttachment: projectAttachmentRelationships, @@ -8942,6 +8940,8 @@ export const schema = { projectTag: projectTagRelationships, projectTask: projectTaskRelationships, projectTaskTag: projectTaskTagRelationships, + shipment: shipmentRelationships, + shipmentItem: shipmentItemRelationships, supportTicket: supportTicketRelationships, supportTicketAssignment: supportTicketAssignmentRelationships, supportTicketAudit: supportTicketAuditRelationships, diff --git a/no-config-integration/zero-schema.gen.ts b/no-config-integration/zero-schema.gen.ts index dd3a76c..fd21143 100644 --- a/no-config-integration/zero-schema.gen.ts +++ b/no-config-integration/zero-schema.gen.ts @@ -1,4 +1,4 @@ -// @generated drizzle-zero signature:sha256:7cb3299cfe02100418e4fbf40722f18586fc7814522eb44b3487f729eff5c661 +// @generated drizzle-zero signature:sha256:fff89c1b94f704635c592e84fb2f8a3ba41070d965d6de521599ba8e8bcf5823 // This file was automatically generated by drizzle-zero. // You should NOT make any changes in this file as it will be overwritten. @@ -27,15 +27,15 @@ export type OrderTableCurrencyMetadataCustomType = CustomType< 'orderTable', 'currencyMetadata' >; -export type ProductMediaTypeCustomType = CustomType< +export type ProductMediaMimeDescriptorCustomType = CustomType< typeof drizzleSchema, 'productMedia', - 'type' + 'mimeDescriptor' >; -export type ProductMediaMimeDescriptorCustomType = CustomType< +export type ProductMediaTypeCustomType = CustomType< typeof drizzleSchema, 'productMedia', - 'mimeDescriptor' + 'type' >; export type ProjectWorkflowStateCustomType = CustomType< typeof drizzleSchema, @@ -52,35 +52,35 @@ export type TelemetryRollupWindowedStatsCustomType = CustomType< 'telemetryRollup', 'windowedStats' >; -export type UserCustomTypeJsonCustomType = CustomType< - typeof drizzleSchema, - 'user', - 'customTypeJson' ->; export type UserCustomInterfaceJsonCustomType = CustomType< typeof drizzleSchema, 'user', 'customInterfaceJson' >; -export type UserTestInterfaceCustomType = CustomType< +export type UserCustomTypeJsonCustomType = CustomType< typeof drizzleSchema, 'user', - 'testInterface' + 'customTypeJson' >; -export type UserTestTypeCustomType = CustomType< +export type UserNotificationPreferencesCustomType = CustomType< typeof drizzleSchema, 'user', - 'testType' + 'notificationPreferences' >; export type UserTestExportedTypeCustomType = CustomType< typeof drizzleSchema, 'user', 'testExportedType' >; -export type UserNotificationPreferencesCustomType = CustomType< +export type UserTestInterfaceCustomType = CustomType< typeof drizzleSchema, 'user', - 'notificationPreferences' + 'testInterface' +>; +export type UserTestTypeCustomType = CustomType< + typeof drizzleSchema, + 'user', + 'testType' >; export type WebhookSubscriptionConfigCustomType = CustomType< typeof drizzleSchema, @@ -91,32 +91,11 @@ export type WebhookSubscriptionConfigCustomType = CustomType< const allTypesTable = { name: 'allTypes', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - updatedAt: { + bigSerialField: { type: 'number', optional: true, customType: null as unknown as number, - }, - id: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - smallintField: { - type: 'number', - optional: false, - customType: null as unknown as number, - serverName: 'smallint', - }, - integerField: { - type: 'number', - optional: false, - customType: null as unknown as number, - serverName: 'integer', + serverName: 'bigserial', }, bigintField: { type: 'number', @@ -130,29 +109,34 @@ const allTypesTable = { customType: null as unknown as number, serverName: 'bigint_number', }, - smallSerialField: { - type: 'number', - optional: true, - customType: null as unknown as number, - serverName: 'smallserial', + booleanField: { + type: 'boolean', + optional: false, + customType: null as unknown as boolean, + serverName: 'boolean', }, - serialField: { - type: 'number', - optional: true, - customType: null as unknown as number, - serverName: 'serial', + charField: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'char', }, - bigSerialField: { + cidrField: { + type: 'string', + optional: false, + customType: null as unknown as ReadonlyJSONValue, + serverName: 'cidr', + }, + createdAt: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'bigserial', }, - numericField: { + dateField: { type: 'number', optional: false, customType: null as unknown as number, - serverName: 'numeric', + serverName: 'date', }, decimalField: { type: 'number', @@ -160,41 +144,22 @@ const allTypesTable = { customType: null as unknown as number, serverName: 'decimal', }, - realField: { - type: 'number', - optional: false, - customType: null as unknown as number, - serverName: 'real', - }, doublePrecisionField: { type: 'number', optional: false, customType: null as unknown as number, serverName: 'double_precision', }, - textField: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'text', - }, - charField: { - type: 'string', + enumArray: { + type: 'json', optional: false, - customType: null as unknown as string, - serverName: 'char', + customType: null as unknown as ('active' | 'inactive' | 'pending')[], + serverName: 'enum_array', }, - uuidField: { + id: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'uuid', - }, - cidrField: { - type: 'string', - optional: false, - customType: null as unknown as ReadonlyJSONValue, - serverName: 'cidr', }, inetField: { type: 'string', @@ -202,71 +167,17 @@ const allTypesTable = { customType: null as unknown as ReadonlyJSONValue, serverName: 'inet', }, - macaddrField: { - type: 'string', - optional: false, - customType: null as unknown as ReadonlyJSONValue, - serverName: 'macaddr', - }, - macaddr8Field: { - type: 'string', - optional: false, - customType: null as unknown as ReadonlyJSONValue, - serverName: 'macaddr8', - }, - varcharField: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'varchar', - }, - booleanField: { - type: 'boolean', - optional: false, - customType: null as unknown as boolean, - serverName: 'boolean', - }, - timeField: { - type: 'number', - optional: false, - customType: null as unknown as number, - serverName: 'time', - }, - timeTzField: { - type: 'number', - optional: false, - customType: null as unknown as number, - serverName: 'time_tz', - }, - timestampField: { - type: 'number', - optional: false, - customType: null as unknown as number, - serverName: 'timestamp', - }, - timestampTzField: { - type: 'number', - optional: false, - customType: null as unknown as number, - serverName: 'timestamp_tz', - }, - timestampModeString: { - type: 'number', - optional: false, - customType: null as unknown as number, - serverName: 'timestamp_mode_string', - }, - timestampModeDate: { - type: 'number', + intArray: { + type: 'json', optional: false, - customType: null as unknown as number, - serverName: 'timestamp_mode_date', + customType: null as unknown as number[], + serverName: 'int_array', }, - dateField: { + integerField: { type: 'number', optional: false, customType: null as unknown as number, - serverName: 'date', + serverName: 'integer', }, jsonField: { type: 'json', @@ -274,34 +185,29 @@ const allTypesTable = { customType: null as unknown as ReadonlyJSONValue, serverName: 'json', }, - jsonbField: { + jsonbArray: { type: 'json', optional: false, - customType: null as unknown as ReadonlyJSONValue, - serverName: 'jsonb', + customType: null as unknown as {key: string}[], + serverName: 'jsonb_array', }, - typedJsonField: { + jsonbField: { type: 'json', optional: false, - customType: null as unknown as {theme: string; fontSize: number}, - serverName: 'typed_json', + customType: null as unknown as ReadonlyJSONValue, + serverName: 'jsonb', }, - status: { + macaddr8Field: { type: 'string', optional: false, - customType: null as unknown as 'active' | 'inactive' | 'pending', - }, - textArray: { - type: 'json', - optional: false, - customType: null as unknown as string[], - serverName: 'text_array', + customType: null as unknown as ReadonlyJSONValue, + serverName: 'macaddr8', }, - intArray: { - type: 'json', + macaddrField: { + type: 'string', optional: false, - customType: null as unknown as number[], - serverName: 'int_array', + customType: null as unknown as ReadonlyJSONValue, + serverName: 'macaddr', }, numericArray: { type: 'json', @@ -309,35 +215,11 @@ const allTypesTable = { customType: null as unknown as number[], serverName: 'numeric_array', }, - uuidArray: { - type: 'json', - optional: false, - customType: null as unknown as string[], - serverName: 'uuid_array', - }, - jsonbArray: { - type: 'json', - optional: false, - customType: null as unknown as {key: string}[], - serverName: 'jsonb_array', - }, - enumArray: { - type: 'json', - optional: false, - customType: null as unknown as ('active' | 'inactive' | 'pending')[], - serverName: 'enum_array', - }, - optionalSmallint: { - type: 'number', - optional: true, - customType: null as unknown as number, - serverName: 'optional_smallint', - }, - optionalInteger: { + numericField: { type: 'number', - optional: true, + optional: false, customType: null as unknown as number, - serverName: 'optional_integer', + serverName: 'numeric', }, optionalBigint: { type: 'number', @@ -345,23 +227,53 @@ const allTypesTable = { customType: null as unknown as number, serverName: 'optional_bigint', }, - optionalNumeric: { - type: 'number', + optionalBoolean: { + type: 'boolean', optional: true, - customType: null as unknown as number, - serverName: 'optional_numeric', + customType: null as unknown as boolean, + serverName: 'optional_boolean', }, - optionalReal: { + optionalDoublePrecision: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'optional_real', + serverName: 'optional_double_precision', }, - optionalDoublePrecision: { + optionalEnum: { + type: 'string', + optional: true, + customType: null as unknown as 'active' | 'inactive' | 'pending', + serverName: 'optional_enum', + }, + optionalInteger: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'optional_double_precision', + serverName: 'optional_integer', + }, + optionalJson: { + type: 'json', + optional: true, + customType: null as unknown as ReadonlyJSONValue, + serverName: 'optional_json', + }, + optionalNumeric: { + type: 'number', + optional: true, + customType: null as unknown as number, + serverName: 'optional_numeric', + }, + optionalReal: { + type: 'number', + optional: true, + customType: null as unknown as number, + serverName: 'optional_real', + }, + optionalSmallint: { + type: 'number', + optional: true, + customType: null as unknown as number, + serverName: 'optional_smallint', }, optionalText: { type: 'string', @@ -369,29 +281,17 @@ const allTypesTable = { customType: null as unknown as string, serverName: 'optional_text', }, - optionalBoolean: { - type: 'boolean', - optional: true, - customType: null as unknown as boolean, - serverName: 'optional_boolean', - }, optionalTimestamp: { type: 'number', optional: true, customType: null as unknown as number, serverName: 'optional_timestamp', }, - optionalJson: { - type: 'json', - optional: true, - customType: null as unknown as ReadonlyJSONValue, - serverName: 'optional_json', - }, - optionalEnum: { + optionalUuid: { type: 'string', optional: true, - customType: null as unknown as 'active' | 'inactive' | 'pending', - serverName: 'optional_enum', + customType: null as unknown as string, + serverName: 'optional_uuid', }, optionalVarchar: { type: 'string', @@ -399,11 +299,111 @@ const allTypesTable = { customType: null as unknown as string, serverName: 'optional_varchar', }, - optionalUuid: { + realField: { + type: 'number', + optional: false, + customType: null as unknown as number, + serverName: 'real', + }, + serialField: { + type: 'number', + optional: true, + customType: null as unknown as number, + serverName: 'serial', + }, + smallSerialField: { + type: 'number', + optional: true, + customType: null as unknown as number, + serverName: 'smallserial', + }, + smallintField: { + type: 'number', + optional: false, + customType: null as unknown as number, + serverName: 'smallint', + }, + status: { + type: 'string', + optional: false, + customType: null as unknown as 'active' | 'inactive' | 'pending', + }, + textArray: { + type: 'json', + optional: false, + customType: null as unknown as string[], + serverName: 'text_array', + }, + textField: { type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'text', + }, + timeField: { + type: 'number', + optional: false, + customType: null as unknown as number, + serverName: 'time', + }, + timeTzField: { + type: 'number', + optional: false, + customType: null as unknown as number, + serverName: 'time_tz', + }, + timestampField: { + type: 'number', + optional: false, + customType: null as unknown as number, + serverName: 'timestamp', + }, + timestampModeDate: { + type: 'number', + optional: false, + customType: null as unknown as number, + serverName: 'timestamp_mode_date', + }, + timestampModeString: { + type: 'number', + optional: false, + customType: null as unknown as number, + serverName: 'timestamp_mode_string', + }, + timestampTzField: { + type: 'number', + optional: false, + customType: null as unknown as number, + serverName: 'timestamp_tz', + }, + typedJsonField: { + type: 'json', + optional: false, + customType: null as unknown as {fontSize: number; theme: string}, + serverName: 'typed_json', + }, + updatedAt: { + type: 'number', optional: true, + customType: null as unknown as number, + }, + uuidArray: { + type: 'json', + optional: false, + customType: null as unknown as string[], + serverName: 'uuid_array', + }, + uuidField: { + type: 'string', + optional: false, customType: null as unknown as string, - serverName: 'optional_uuid', + serverName: 'uuid', + }, + varcharField: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'varchar', }, }, primaryKey: ['id'], @@ -417,10 +417,29 @@ const analyticsDashboardTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + defaultQuery: { + type: 'json', + optional: false, + customType: null as unknown as { + dimensions: ('day' | 'hour' | 'month' | 'week')[]; + filters?: + | undefined + | { + field: string; + operator: + 'eq' | 'gt' | 'gte' | 'in' | 'lt' | 'lte' | 'neq' | 'nin'; + value: (number | string)[] | boolean | number | string; + }[]; + limit: number; + metrics: string[]; + timezone: string; + }, + serverName: 'default_query', + }, + description: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, }, id: { type: 'string', @@ -438,29 +457,10 @@ const analyticsDashboardTable = { optional: false, customType: null as unknown as string, }, - description: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, - }, - defaultQuery: { - type: 'json', - optional: false, - customType: null as unknown as { - dimensions: ('hour' | 'day' | 'week' | 'month')[]; - metrics: string[]; - limit: number; - timezone: string; - filters?: - | { - field: string; - operator: - 'in' | 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'nin'; - value: string | number | boolean | (string | number)[]; - }[] - | undefined; - }, - serverName: 'default_query', + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -474,38 +474,38 @@ const analyticsWidgetTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { + dashboardId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'dashboard_id', }, - dashboardId: { + id: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'dashboard_id', + }, + position: { + type: 'number', + optional: true, + customType: null as unknown as number, }, title: { type: 'string', optional: false, customType: null as unknown as string, }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, widgetType: { type: 'string', optional: false, customType: null as unknown as string, serverName: 'widget_type', }, - position: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, }, primaryKey: ['id'], serverName: 'analytics_widget', @@ -518,27 +518,16 @@ const analyticsWidgetQueryTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - widgetId: { + dataSource: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'widget_id', + serverName: 'data_source', }, - dataSource: { + id: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'data_source', }, query: { type: 'string', @@ -551,34 +540,41 @@ const analyticsWidgetQueryTable = { customType: null as unknown as number, serverName: 'refresh_interval_seconds', }, - }, - primaryKey: ['id'], - serverName: 'analytics_widget_query', -} as const; -const benefitEnrollmentTable = { - name: 'benefitEnrollment', - columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, updatedAt: { type: 'number', optional: true, customType: null as unknown as number, }, - id: { + widgetId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'widget_id', }, - benefitPlanId: { - type: 'string', - optional: false, - customType: null as unknown as string, + }, + primaryKey: ['id'], + serverName: 'analytics_widget_query', +} as const; +const benefitEnrollmentTable = { + name: 'benefitEnrollment', + columns: { + benefitPlanId: { + type: 'string', + optional: false, + customType: null as unknown as string, serverName: 'benefit_plan_id', }, + coverageLevel: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'coverage_level', + }, + createdAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, employeeId: { type: 'string', optional: false, @@ -591,11 +587,15 @@ const benefitEnrollmentTable = { customType: null as unknown as number, serverName: 'enrolled_at', }, - coverageLevel: { + id: { type: 'string', - optional: true, + optional: false, customType: null as unknown as string, - serverName: 'coverage_level', + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -604,15 +604,21 @@ const benefitEnrollmentTable = { const benefitPlanTable = { name: 'benefitPlan', columns: { + administratorId: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'administrator_id', + }, createdAt: { type: 'number', optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + description: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, }, id: { type: 'string', @@ -629,16 +635,10 @@ const benefitPlanTable = { optional: true, customType: null as unknown as string, }, - description: { - type: 'string', - optional: true, - customType: null as unknown as string, - }, - administratorId: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, - serverName: 'administrator_id', + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -647,32 +647,44 @@ const benefitPlanTable = { const billingInvoiceTable = { name: 'billingInvoice', columns: { + accountId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'account_id', + }, + contactId: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'contact_id', + }, createdAt: { type: 'number', optional: true, customType: null as unknown as number, }, - updatedAt: { + currency: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + dueDate: { type: 'number', optional: true, customType: null as unknown as number, + serverName: 'due_date', }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - accountId: { - type: 'string', + invoiceDate: { + type: 'number', optional: false, - customType: null as unknown as string, - serverName: 'account_id', - }, - contactId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'contact_id', + customType: null as unknown as number, + serverName: 'invoice_date', }, issuedById: { type: 'string', @@ -685,28 +697,16 @@ const billingInvoiceTable = { optional: false, customType: null as unknown as string, }, - invoiceDate: { + totalAmount: { type: 'number', optional: false, customType: null as unknown as number, - serverName: 'invoice_date', + serverName: 'total_amount', }, - dueDate: { + updatedAt: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'due_date', - }, - totalAmount: { - type: 'number', - optional: false, - customType: null as unknown as number, - serverName: 'total_amount', - }, - currency: { - type: 'string', - optional: false, - customType: null as unknown as string, }, }, primaryKey: ['id'], @@ -720,10 +720,10 @@ const billingInvoiceLineTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, + description: { + type: 'string', + optional: false, + customType: null as unknown as string, }, id: { type: 'string', @@ -742,11 +742,6 @@ const billingInvoiceLineTable = { customType: null as unknown as string, serverName: 'order_item_id', }, - description: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, quantity: { type: 'number', optional: false, @@ -758,6 +753,11 @@ const billingInvoiceLineTable = { customType: null as unknown as number, serverName: 'unit_price', }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], serverName: 'billing_invoice_line', @@ -770,12 +770,7 @@ const budgetTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { + currency: { type: 'string', optional: false, customType: null as unknown as string, @@ -792,16 +787,21 @@ const budgetTable = { customType: null as unknown as number, serverName: 'fiscal_year', }, + id: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, totalAmount: { type: 'number', optional: false, customType: null as unknown as number, serverName: 'total_amount', }, - currency: { - type: 'string', - optional: false, - customType: null as unknown as string, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -809,20 +809,16 @@ const budgetTable = { const budgetLineTable = { name: 'budgetLine', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { + accountId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'account_id', + }, + amount: { + type: 'number', + optional: false, + customType: null as unknown as number, }, budgetId: { type: 'string', @@ -830,15 +826,19 @@ const budgetLineTable = { customType: null as unknown as string, serverName: 'budget_id', }, - accountId: { + createdAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, + id: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'account_id', }, - amount: { + updatedAt: { type: 'number', - optional: false, + optional: true, customType: null as unknown as number, }, }, @@ -853,304 +853,294 @@ const crmAccountTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - ownerId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'owner_id', - }, - name: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - industry: { - type: 'string', - optional: true, - customType: null as unknown as string, - }, - status: { - type: 'string', - optional: true, - customType: null as unknown as string, - }, domicileCountry: { type: 'string', optional: true, customType: null as unknown as - | 'US' - | 'MX' - | 'CA' + | 'AD' + | 'AE' | 'AF' - | 'AX' + | 'AG' + | 'AI' | 'AL' - | 'DZ' - | 'AS' - | 'AD' + | 'AM' | 'AO' - | 'AI' | 'AQ' - | 'AG' | 'AR' - | 'AM' - | 'AW' - | 'AU' + | 'AS' | 'AT' + | 'AU' + | 'AW' + | 'AX' | 'AZ' - | 'BS' - | 'BH' - | 'BD' + | 'BA' | 'BB' - | 'BY' + | 'BD' | 'BE' - | 'BZ' + | 'BF' + | 'BG' + | 'BH' + | 'BI' | 'BJ' + | 'BL' | 'BM' - | 'BT' + | 'BN' | 'BO' | 'BQ' - | 'BA' - | 'BW' - | 'BV' | 'BR' - | 'IO' - | 'BN' - | 'BG' - | 'BF' - | 'BI' - | 'CV' - | 'KH' - | 'CM' - | 'KY' - | 'CF' - | 'TD' - | 'CL' - | 'CN' - | 'CX' + | 'BS' + | 'BT' + | 'BV' + | 'BW' + | 'BY' + | 'BZ' + | 'CA' | 'CC' - | 'CO' - | 'KM' - | 'CG' | 'CD' + | 'CF' + | 'CG' + | 'CH' + | 'CI' | 'CK' + | 'CL' + | 'CM' + | 'CN' + | 'CO' | 'CR' - | 'CI' - | 'HR' | 'CU' + | 'CV' | 'CW' + | 'CX' | 'CY' | 'CZ' - | 'DK' + | 'DE' | 'DJ' + | 'DK' | 'DM' | 'DO' + | 'DZ' | 'EC' + | 'EE' | 'EG' - | 'SV' - | 'GQ' + | 'EH' | 'ER' - | 'EE' - | 'SZ' + | 'ES' | 'ET' + | 'FI' + | 'FJ' | 'FK' + | 'FM' | 'FO' - | 'FJ' - | 'FI' | 'FR' - | 'GF' - | 'PF' - | 'TF' | 'GA' - | 'GM' + | 'GB' + | 'GD' | 'GE' - | 'DE' + | 'GF' + | 'GG' | 'GH' | 'GI' - | 'GR' | 'GL' - | 'GD' + | 'GM' + | 'GN' | 'GP' - | 'GU' + | 'GQ' + | 'GR' + | 'GS' | 'GT' - | 'GG' - | 'GN' + | 'GU' | 'GW' | 'GY' - | 'HT' + | 'HK' | 'HM' - | 'VA' | 'HN' - | 'HK' + | 'HR' + | 'HT' | 'HU' - | 'IS' - | 'IN' | 'ID' - | 'IR' - | 'IQ' | 'IE' - | 'IM' | 'IL' + | 'IM' + | 'IN' + | 'IO' + | 'IQ' + | 'IR' + | 'IS' | 'IT' - | 'JM' - | 'JP' | 'JE' + | 'JM' | 'JO' - | 'KZ' + | 'JP' | 'KE' + | 'KG' + | 'KH' | 'KI' + | 'KM' + | 'KN' | 'KP' | 'KR' | 'KW' - | 'KG' + | 'KY' + | 'KZ' | 'LA' - | 'LV' | 'LB' - | 'LS' - | 'LR' - | 'LY' + | 'LC' | 'LI' + | 'LK' + | 'LR' + | 'LS' | 'LT' | 'LU' - | 'MO' + | 'LV' + | 'LY' + | 'MA' + | 'MC' + | 'MD' + | 'ME' + | 'MF' | 'MG' - | 'MW' - | 'MY' - | 'MV' - | 'ML' - | 'MT' | 'MH' + | 'MK' + | 'ML' + | 'MM' + | 'MN' + | 'MO' + | 'MP' | 'MQ' | 'MR' - | 'MU' - | 'YT' - | 'FM' - | 'MD' - | 'MC' - | 'MN' - | 'ME' | 'MS' - | 'MA' + | 'MT' + | 'MU' + | 'MV' + | 'MW' + | 'MX' + | 'MY' | 'MZ' - | 'MM' | 'NA' - | 'NR' - | 'NP' - | 'NL' | 'NC' - | 'NZ' - | 'NI' | 'NE' - | 'NG' - | 'NU' | 'NF' - | 'MK' - | 'MP' + | 'NG' + | 'NI' + | 'NL' | 'NO' + | 'NP' + | 'NR' + | 'NU' + | 'NZ' | 'OM' - | 'PK' - | 'PW' - | 'PS' | 'PA' - | 'PG' - | 'PY' | 'PE' + | 'PF' + | 'PG' | 'PH' - | 'PN' + | 'PK' | 'PL' - | 'PT' + | 'PM' + | 'PN' | 'PR' + | 'PS' + | 'PT' + | 'PW' + | 'PY' | 'QA' | 'RE' | 'RO' + | 'RS' | 'RU' | 'RW' - | 'BL' - | 'SH' - | 'KN' - | 'LC' - | 'MF' - | 'PM' - | 'VC' - | 'WS' - | 'SM' - | 'ST' | 'SA' - | 'SN' - | 'RS' + | 'SB' | 'SC' - | 'SL' + | 'SD' + | 'SE' | 'SG' - | 'SX' - | 'SK' + | 'SH' | 'SI' - | 'SB' + | 'SJ' + | 'SK' + | 'SL' + | 'SM' + | 'SN' | 'SO' - | 'ZA' - | 'GS' - | 'SS' - | 'ES' - | 'LK' - | 'SD' | 'SR' - | 'SJ' - | 'SE' - | 'CH' + | 'SS' + | 'ST' + | 'SV' + | 'SX' | 'SY' - | 'TW' - | 'TJ' - | 'TZ' - | 'TH' - | 'TL' + | 'SZ' + | 'TC' + | 'TD' + | 'TF' | 'TG' + | 'TH' + | 'TJ' | 'TK' - | 'TO' - | 'TT' + | 'TL' + | 'TM' | 'TN' + | 'TO' | 'TR' - | 'TM' - | 'TC' + | 'TT' | 'TV' - | 'UG' + | 'TW' + | 'TZ' | 'UA' - | 'AE' - | 'GB' + | 'UG' + | 'US' | 'UY' | 'UZ' - | 'VU' + | 'VA' + | 'VC' | 'VE' - | 'VN' | 'VG' | 'VI' + | 'VN' + | 'VU' | 'WF' - | 'EH' + | 'WS' + | 'XK' | 'YE' + | 'YT' + | 'ZA' | 'ZM' | 'ZW' - | 'XK' | null, serverName: 'domicile_country', }, - reportingCurrency: { + id: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + industry: { type: 'string', optional: true, - customType: null as unknown as - | 'AED' - | 'AFN' - | 'ALL' - | 'AMD' - | 'ANG' - | 'AOA' - | 'ARS' + customType: null as unknown as string, + }, + name: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + ownerId: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'owner_id', + }, + reportingCurrency: { + type: 'string', + optional: true, + customType: null as unknown as + | 'AED' + | 'AFN' + | 'ALL' + | 'AMD' + | 'ANG' + | 'AOA' + | 'ARS' | 'AUD' | 'AWG' | 'AZN' @@ -1316,6 +1306,16 @@ const crmAccountTable = { | null, serverName: 'reporting_currency', }, + status: { + type: 'string', + optional: true, + customType: null as unknown as string, + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], serverName: 'crm_account', @@ -1323,12 +1323,19 @@ const crmAccountTable = { const crmActivityTable = { name: 'crmActivity', columns: { - createdAt: { - type: 'number', + accountId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'account_id', + }, + contactId: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, + serverName: 'contact_id', }, - updatedAt: { + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -1338,17 +1345,10 @@ const crmActivityTable = { optional: false, customType: null as unknown as string, }, - accountId: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'account_id', - }, - contactId: { + notes: { type: 'string', optional: true, customType: null as unknown as string, - serverName: 'contact_id', }, opportunityId: { type: 'string', @@ -1356,22 +1356,22 @@ const crmActivityTable = { customType: null as unknown as string, serverName: 'opportunity_id', }, - typeId: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'type_id', - }, performedById: { type: 'string', optional: true, customType: null as unknown as string, serverName: 'performed_by_id', }, - notes: { + typeId: { type: 'string', - optional: true, + optional: false, customType: null as unknown as string, + serverName: 'type_id', + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -1385,10 +1385,10 @@ const crmActivityTypeTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + description: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, }, id: { type: 'string', @@ -1400,10 +1400,10 @@ const crmActivityTypeTable = { optional: false, customType: null as unknown as string, }, - description: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -1412,363 +1412,363 @@ const crmActivityTypeTable = { const crmContactTable = { name: 'crmContact', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, accountId: { type: 'string', optional: false, customType: null as unknown as string, serverName: 'account_id', }, - firstName: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'first_name', - }, - lastName: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'last_name', - }, - email: { - type: 'string', - optional: true, - customType: null as unknown as string, - }, - phone: { - type: 'string', - optional: true, - customType: null as unknown as string, - }, countryIso: { type: 'string', optional: true, customType: null as unknown as - | 'US' - | 'MX' - | 'CA' + | 'AD' + | 'AE' | 'AF' - | 'AX' + | 'AG' + | 'AI' | 'AL' - | 'DZ' - | 'AS' - | 'AD' + | 'AM' | 'AO' - | 'AI' | 'AQ' - | 'AG' | 'AR' - | 'AM' - | 'AW' - | 'AU' + | 'AS' | 'AT' + | 'AU' + | 'AW' + | 'AX' | 'AZ' - | 'BS' - | 'BH' - | 'BD' + | 'BA' | 'BB' - | 'BY' + | 'BD' | 'BE' - | 'BZ' + | 'BF' + | 'BG' + | 'BH' + | 'BI' | 'BJ' + | 'BL' | 'BM' - | 'BT' + | 'BN' | 'BO' | 'BQ' - | 'BA' - | 'BW' - | 'BV' | 'BR' - | 'IO' - | 'BN' - | 'BG' - | 'BF' - | 'BI' - | 'CV' - | 'KH' - | 'CM' - | 'KY' + | 'BS' + | 'BT' + | 'BV' + | 'BW' + | 'BY' + | 'BZ' + | 'CA' + | 'CC' + | 'CD' | 'CF' - | 'TD' + | 'CG' + | 'CH' + | 'CI' + | 'CK' | 'CL' + | 'CM' | 'CN' - | 'CX' - | 'CC' | 'CO' - | 'KM' - | 'CG' - | 'CD' - | 'CK' | 'CR' - | 'CI' - | 'HR' | 'CU' + | 'CV' | 'CW' + | 'CX' | 'CY' | 'CZ' - | 'DK' + | 'DE' | 'DJ' + | 'DK' | 'DM' | 'DO' + | 'DZ' | 'EC' + | 'EE' | 'EG' - | 'SV' - | 'GQ' + | 'EH' | 'ER' - | 'EE' - | 'SZ' + | 'ES' | 'ET' + | 'FI' + | 'FJ' | 'FK' + | 'FM' | 'FO' - | 'FJ' - | 'FI' | 'FR' - | 'GF' - | 'PF' - | 'TF' | 'GA' - | 'GM' + | 'GB' + | 'GD' | 'GE' - | 'DE' + | 'GF' + | 'GG' | 'GH' | 'GI' - | 'GR' | 'GL' - | 'GD' + | 'GM' + | 'GN' | 'GP' - | 'GU' + | 'GQ' + | 'GR' + | 'GS' | 'GT' - | 'GG' - | 'GN' + | 'GU' | 'GW' | 'GY' - | 'HT' + | 'HK' | 'HM' - | 'VA' | 'HN' - | 'HK' + | 'HR' + | 'HT' | 'HU' - | 'IS' - | 'IN' | 'ID' - | 'IR' - | 'IQ' | 'IE' - | 'IM' | 'IL' + | 'IM' + | 'IN' + | 'IO' + | 'IQ' + | 'IR' + | 'IS' | 'IT' - | 'JM' - | 'JP' | 'JE' + | 'JM' | 'JO' - | 'KZ' + | 'JP' | 'KE' + | 'KG' + | 'KH' | 'KI' - | 'KP' + | 'KM' + | 'KN' + | 'KP' | 'KR' | 'KW' - | 'KG' + | 'KY' + | 'KZ' | 'LA' - | 'LV' | 'LB' - | 'LS' - | 'LR' - | 'LY' + | 'LC' | 'LI' + | 'LK' + | 'LR' + | 'LS' | 'LT' | 'LU' - | 'MO' + | 'LV' + | 'LY' + | 'MA' + | 'MC' + | 'MD' + | 'ME' + | 'MF' | 'MG' - | 'MW' - | 'MY' - | 'MV' - | 'ML' - | 'MT' | 'MH' + | 'MK' + | 'ML' + | 'MM' + | 'MN' + | 'MO' + | 'MP' | 'MQ' | 'MR' - | 'MU' - | 'YT' - | 'FM' - | 'MD' - | 'MC' - | 'MN' - | 'ME' | 'MS' - | 'MA' + | 'MT' + | 'MU' + | 'MV' + | 'MW' + | 'MX' + | 'MY' | 'MZ' - | 'MM' | 'NA' - | 'NR' - | 'NP' - | 'NL' | 'NC' - | 'NZ' - | 'NI' | 'NE' - | 'NG' - | 'NU' | 'NF' - | 'MK' - | 'MP' + | 'NG' + | 'NI' + | 'NL' | 'NO' + | 'NP' + | 'NR' + | 'NU' + | 'NZ' | 'OM' - | 'PK' - | 'PW' - | 'PS' | 'PA' - | 'PG' - | 'PY' | 'PE' + | 'PF' + | 'PG' | 'PH' - | 'PN' + | 'PK' | 'PL' - | 'PT' + | 'PM' + | 'PN' | 'PR' + | 'PS' + | 'PT' + | 'PW' + | 'PY' | 'QA' | 'RE' | 'RO' + | 'RS' | 'RU' | 'RW' - | 'BL' - | 'SH' - | 'KN' - | 'LC' - | 'MF' - | 'PM' - | 'VC' - | 'WS' - | 'SM' - | 'ST' | 'SA' - | 'SN' - | 'RS' + | 'SB' | 'SC' - | 'SL' + | 'SD' + | 'SE' | 'SG' - | 'SX' - | 'SK' + | 'SH' | 'SI' - | 'SB' + | 'SJ' + | 'SK' + | 'SL' + | 'SM' + | 'SN' | 'SO' - | 'ZA' - | 'GS' - | 'SS' - | 'ES' - | 'LK' - | 'SD' | 'SR' - | 'SJ' - | 'SE' - | 'CH' + | 'SS' + | 'ST' + | 'SV' + | 'SX' | 'SY' - | 'TW' - | 'TJ' - | 'TZ' - | 'TH' - | 'TL' + | 'SZ' + | 'TC' + | 'TD' + | 'TF' | 'TG' + | 'TH' + | 'TJ' | 'TK' - | 'TO' - | 'TT' + | 'TL' + | 'TM' | 'TN' + | 'TO' | 'TR' - | 'TM' - | 'TC' + | 'TT' | 'TV' - | 'UG' + | 'TW' + | 'TZ' | 'UA' - | 'AE' - | 'GB' + | 'UG' + | 'US' | 'UY' | 'UZ' - | 'VU' + | 'VA' + | 'VC' | 'VE' - | 'VN' | 'VG' | 'VI' + | 'VN' + | 'VU' | 'WF' - | 'EH' + | 'WS' + | 'XK' | 'YE' + | 'YT' + | 'ZA' | 'ZM' | 'ZW' - | 'XK' | null, serverName: 'country_iso', }, + createdAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, + email: { + type: 'string', + optional: true, + customType: null as unknown as string, + }, + firstName: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'first_name', + }, + id: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + lastName: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'last_name', + }, + phone: { + type: 'string', + optional: true, + customType: null as unknown as string, + }, stateCode: { type: 'string', optional: true, customType: null as unknown as - | 'CA' + | 'AK' | 'AL' | 'AR' | 'AZ' - | 'KY' + | 'CA' | 'CO' - | 'GA' + | 'CT' + | 'DC' | 'DE' - | 'VA' - | 'IN' + | 'FL' + | 'GA' + | 'HI' + | 'IA' | 'ID' | 'IL' + | 'IN' + | 'KS' + | 'KY' | 'LA' - | 'MO' - | 'MT' + | 'MA' | 'MD' - | 'MN' | 'ME' + | 'MI' + | 'MN' + | 'MO' | 'MS' - | 'MA' + | 'MT' | 'NC' + | 'ND' | 'NE' - | 'PA' - | 'SC' - | 'SD' - | 'TN' - | 'AK' - | 'CT' - | 'DC' - | 'FL' - | 'HI' - | 'IA' - | 'KS' - | 'MI' - | 'NV' | 'NH' | 'NJ' | 'NM' + | 'NV' | 'NY' - | 'ND' | 'OH' | 'OK' | 'OR' + | 'PA' | 'RI' + | 'SC' + | 'SD' + | 'TN' | 'TX' | 'UT' + | 'VA' | 'VT' | 'WA' - | 'WV' | 'WI' + | 'WV' | 'WY' | null, serverName: 'state_code', }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], serverName: 'crm_contact', @@ -1776,26 +1776,22 @@ const crmContactTable = { const crmNoteTable = { name: 'crmNote', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { + accountId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'account_id', }, - accountId: { + authorId: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'author_id', + }, + body: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'account_id', }, contactId: { type: 'string', @@ -1803,17 +1799,21 @@ const crmNoteTable = { customType: null as unknown as string, serverName: 'contact_id', }, - authorId: { - type: 'string', + createdAt: { + type: 'number', optional: true, - customType: null as unknown as string, - serverName: 'author_id', + customType: null as unknown as number, }, - body: { + id: { type: 'string', optional: false, customType: null as unknown as string, }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], serverName: 'crm_note', @@ -1821,12 +1821,24 @@ const crmNoteTable = { const crmOpportunityTable = { name: 'crmOpportunity', columns: { - createdAt: { + accountId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'account_id', + }, + amount: { type: 'number', optional: true, customType: null as unknown as number, }, - updatedAt: { + closeDate: { + type: 'number', + optional: true, + customType: null as unknown as number, + serverName: 'close_date', + }, + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -1836,11 +1848,10 @@ const crmOpportunityTable = { optional: false, customType: null as unknown as string, }, - accountId: { + name: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'account_id', }, stageId: { type: 'string', @@ -1848,21 +1859,10 @@ const crmOpportunityTable = { customType: null as unknown as string, serverName: 'stage_id', }, - name: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - amount: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - closeDate: { + updatedAt: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'close_date', }, }, primaryKey: ['id'], @@ -1871,12 +1871,19 @@ const crmOpportunityTable = { const crmOpportunityStageHistoryTable = { name: 'crmOpportunityStageHistory', columns: { - createdAt: { + changedAt: { type: 'number', optional: true, customType: null as unknown as number, + serverName: 'changed_at', }, - updatedAt: { + changedById: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'changed_by_id', + }, + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -1898,17 +1905,10 @@ const crmOpportunityStageHistoryTable = { customType: null as unknown as string, serverName: 'stage_id', }, - changedById: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'changed_by_id', - }, - changedAt: { + updatedAt: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'changed_at', }, }, primaryKey: ['id'], @@ -1922,11 +1922,6 @@ const crmPipelineStageTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, id: { type: 'string', optional: false, @@ -1937,12 +1932,17 @@ const crmPipelineStageTable = { optional: false, customType: null as unknown as string, }, + probability: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, sequence: { type: 'number', optional: false, customType: null as unknown as number, }, - probability: { + updatedAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -1959,31 +1959,31 @@ const departmentTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + description: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - name: { + managerId: { type: 'string', - optional: false, + optional: true, customType: null as unknown as string, + serverName: 'manager_id', }, - description: { + name: { type: 'string', - optional: true, + optional: false, customType: null as unknown as string, }, - managerId: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, - serverName: 'manager_id', + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -1996,15 +1996,11 @@ const documentFileTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { + fileName: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'file_name', }, folderId: { type: 'string', @@ -2012,17 +2008,10 @@ const documentFileTable = { customType: null as unknown as string, serverName: 'folder_id', }, - uploadedById: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'uploaded_by_id', - }, - fileName: { + id: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'file_name', }, mimeType: { type: 'string', @@ -2036,6 +2025,17 @@ const documentFileTable = { customType: null as unknown as number, serverName: 'size_bytes', }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, + uploadedById: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'uploaded_by_id', + }, version: { type: 'number', optional: true, @@ -2048,26 +2048,38 @@ const documentFileTable = { const documentFileVersionTable = { name: 'documentFileVersion', columns: { + changeLog: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'change_log', + }, createdAt: { type: 'number', optional: true, customType: null as unknown as number, }, - updatedAt: { + fileId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'file_id', + }, + fileSizeBytes: { type: 'number', optional: true, customType: null as unknown as number, + serverName: 'file_size_bytes', }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - fileId: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'file_id', + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, uploadedById: { type: 'string', @@ -2080,18 +2092,6 @@ const documentFileVersionTable = { optional: false, customType: null as unknown as number, }, - changeLog: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'change_log', - }, - fileSizeBytes: { - type: 'number', - optional: true, - customType: null as unknown as number, - serverName: 'file_size_bytes', - }, }, primaryKey: ['id'], serverName: 'document_file_version', @@ -2104,11 +2104,6 @@ const documentFolderTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, id: { type: 'string', optional: false, @@ -2120,16 +2115,21 @@ const documentFolderTable = { customType: null as unknown as string, serverName: 'library_id', }, + name: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, parentId: { type: 'string', optional: true, customType: null as unknown as string, serverName: 'parent_id', }, - name: { - type: 'string', - optional: false, - customType: null as unknown as string, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -2143,31 +2143,31 @@ const documentLibraryTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + description: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - projectId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'project_id', - }, name: { type: 'string', optional: false, customType: null as unknown as string, }, - description: { + projectId: { type: 'string', optional: true, customType: null as unknown as string, + serverName: 'project_id', + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, visibility: { type: 'string', @@ -2186,27 +2186,21 @@ const documentSharingTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { + fileId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'file_id', }, - fileId: { + id: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'file_id', }, - sharedWithUserId: { + permission: { type: 'string', - optional: true, + optional: false, customType: null as unknown as string, - serverName: 'shared_with_user_id', }, sharedWithTeamId: { type: 'string', @@ -2214,10 +2208,16 @@ const documentSharingTable = { customType: null as unknown as string, serverName: 'shared_with_team_id', }, - permission: { + sharedWithUserId: { type: 'string', - optional: false, + optional: true, customType: null as unknown as string, + serverName: 'shared_with_user_id', + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -2231,15 +2231,11 @@ const employeeDocumentTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { + documentType: { type: 'string', - optional: false, + optional: true, customType: null as unknown as string, + serverName: 'document_type', }, employeeId: { type: 'string', @@ -2253,11 +2249,15 @@ const employeeDocumentTable = { customType: null as unknown as string, serverName: 'file_name', }, - documentType: { + id: { type: 'string', - optional: true, + optional: false, customType: null as unknown as string, - serverName: 'document_type', + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, uploadedById: { type: 'string', @@ -2277,27 +2277,28 @@ const employeeProfileTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + departmentId: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, + serverName: 'department_id', }, - id: { + employmentType: { type: 'string', - optional: false, + optional: true, customType: null as unknown as string, + serverName: 'employment_type', }, - userId: { + id: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'user_id', }, - departmentId: { - type: 'string', + startDate: { + type: 'number', optional: true, - customType: null as unknown as string, - serverName: 'department_id', + customType: null as unknown as number, + serverName: 'start_date', }, teamId: { type: 'string', @@ -2310,17 +2311,16 @@ const employeeProfileTable = { optional: true, customType: null as unknown as string, }, - startDate: { + updatedAt: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'start_date', }, - employmentType: { + userId: { type: 'string', - optional: true, + optional: false, customType: null as unknown as string, - serverName: 'employment_type', + serverName: 'user_id', }, }, primaryKey: ['id'], @@ -2329,33 +2329,29 @@ const employeeProfileTable = { const employmentHistoryTable = { name: 'employmentHistory', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, + company: { + type: 'string', + optional: false, + customType: null as unknown as string, }, - updatedAt: { + createdAt: { type: 'number', optional: true, customType: null as unknown as number, }, - id: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, employeeId: { type: 'string', optional: false, customType: null as unknown as string, serverName: 'employee_id', }, - company: { - type: 'string', - optional: false, - customType: null as unknown as string, + endDate: { + type: 'number', + optional: true, + customType: null as unknown as number, + serverName: 'end_date', }, - title: { + id: { type: 'string', optional: false, customType: null as unknown as string, @@ -2366,11 +2362,15 @@ const employmentHistoryTable = { customType: null as unknown as number, serverName: 'start_date', }, - endDate: { + title: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + updatedAt: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'end_date', }, }, primaryKey: ['id'], @@ -2379,33 +2379,22 @@ const employmentHistoryTable = { const expenseItemTable = { name: 'expenseItem', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - updatedAt: { + amount: { type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { - type: 'string', optional: false, - customType: null as unknown as string, + customType: null as unknown as number, }, - reportId: { + category: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'report_id', }, - amount: { + createdAt: { type: 'number', - optional: false, + optional: true, customType: null as unknown as number, }, - category: { + id: { type: 'string', optional: false, customType: null as unknown as string, @@ -2426,6 +2415,17 @@ const expenseItemTable = { optional: true, customType: null as unknown as string, }, + reportId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'report_id', + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], serverName: 'expense_item', @@ -2438,10 +2438,11 @@ const expenseReportTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + departmentId: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, + serverName: 'department_id', }, id: { type: 'string', @@ -2454,12 +2455,6 @@ const expenseReportTable = { customType: null as unknown as string, serverName: 'owner_id', }, - departmentId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'department_id', - }, status: { type: 'string', optional: false, @@ -2471,6 +2466,11 @@ const expenseReportTable = { customType: null as unknown as number, serverName: 'submitted_at', }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], serverName: 'expense_report', @@ -2483,10 +2483,10 @@ const featureFlagTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, + definition: { + type: 'json', + optional: false, + customType: null as unknown as FeatureFlagDefinitionCustomType, }, id: { type: 'string', @@ -2498,32 +2498,32 @@ const featureFlagTable = { optional: false, customType: null as unknown as string, }, + metadata: { + type: 'json', + optional: false, + customType: null as unknown as FeatureFlagMetadataCustomType, + }, ownerId: { type: 'string', optional: true, customType: null as unknown as string, serverName: 'owner_id', }, - definition: { - type: 'json', - optional: false, - customType: null as unknown as FeatureFlagDefinitionCustomType, - }, - metadata: { - type: 'json', + releaseTrack: { + type: 'string', optional: false, - customType: null as unknown as FeatureFlagMetadataCustomType, + customType: null as unknown as 'alpha' | 'beta' | 'ga' | 'sunset', + serverName: 'release_track', }, snapshot: { type: 'json', optional: false, customType: null as unknown as FeatureFlagSnapshotCustomType, }, - releaseTrack: { - type: 'string', - optional: false, - customType: null as unknown as 'alpha' | 'beta' | 'ga' | 'sunset', - serverName: 'release_track', + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -2554,20 +2554,20 @@ const filtersTable = { const friendshipTable = { name: 'friendship', columns: { - requestingId: { - type: 'string', + accepted: { + type: 'boolean', optional: false, - customType: null as unknown as string, + customType: null as unknown as boolean, }, acceptingId: { type: 'string', optional: false, customType: null as unknown as string, }, - accepted: { - type: 'boolean', + requestingId: { + type: 'string', optional: false, - customType: null as unknown as boolean, + customType: null as unknown as string, }, }, primaryKey: ['requestingId', 'acceptingId'], @@ -2575,12 +2575,19 @@ const friendshipTable = { const integrationCredentialTable = { name: 'integrationCredential', columns: { - createdAt: { - type: 'number', + clientId: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, + serverName: 'client_id', }, - updatedAt: { + clientSecret: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'client_secret', + }, + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -2590,33 +2597,26 @@ const integrationCredentialTable = { optional: false, customType: null as unknown as string, }, - webhookId: { - type: 'string', + metadata: { + type: 'json', optional: true, - customType: null as unknown as string, - serverName: 'webhook_id', + customType: null as unknown as ReadonlyJSONValue, }, provider: { type: 'string', optional: false, customType: null as unknown as string, }, - clientId: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, - serverName: 'client_id', + customType: null as unknown as number, }, - clientSecret: { + webhookId: { type: 'string', optional: true, customType: null as unknown as string, - serverName: 'client_secret', - }, - metadata: { - type: 'json', - optional: true, - customType: null as unknown as ReadonlyJSONValue, + serverName: 'webhook_id', }, }, primaryKey: ['id'], @@ -2630,43 +2630,43 @@ const integrationEventTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { + deliveredAt: { type: 'number', optional: true, customType: null as unknown as number, + serverName: 'delivered_at', }, - id: { + eventType: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'event_type', }, - webhookId: { + id: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'webhook_id', }, payload: { type: 'json', optional: true, customType: null as unknown as ReadonlyJSONValue, }, - eventType: { + status: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'event_type', }, - deliveredAt: { + updatedAt: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'delivered_at', }, - status: { + webhookId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'webhook_id', }, }, primaryKey: ['id'], @@ -2675,12 +2675,13 @@ const integrationEventTable = { const integrationWebhookTable = { name: 'integrationWebhook', columns: { - createdAt: { - type: 'number', + accountId: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, + serverName: 'account_id', }, - updatedAt: { + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -2690,40 +2691,39 @@ const integrationWebhookTable = { optional: false, customType: null as unknown as string, }, - projectId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'project_id', - }, - accountId: { - type: 'string', + isActive: { + type: 'boolean', optional: true, - customType: null as unknown as string, - serverName: 'account_id', + customType: null as unknown as boolean, + serverName: 'is_active', }, name: { type: 'string', optional: false, customType: null as unknown as string, }, - url: { + projectId: { type: 'string', - optional: false, + optional: true, customType: null as unknown as string, + serverName: 'project_id', }, secret: { type: 'string', optional: true, customType: null as unknown as string, }, - isActive: { - type: 'boolean', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as boolean, - serverName: 'is_active', + customType: null as unknown as number, }, - }, + url: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + }, primaryKey: ['id'], serverName: 'integration_webhook', } as const; @@ -2735,21 +2735,15 @@ const inventoryItemTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - variantId: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'variant_id', + metadata: { + type: 'json', + optional: true, + customType: null as unknown as ReadonlyJSONValue, }, serialNumber: { type: 'string', @@ -2757,10 +2751,16 @@ const inventoryItemTable = { customType: null as unknown as string, serverName: 'serial_number', }, - metadata: { - type: 'json', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as ReadonlyJSONValue, + customType: null as unknown as number, + }, + variantId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'variant_id', }, }, primaryKey: ['id'], @@ -2774,11 +2774,6 @@ const inventoryLevelTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, id: { type: 'string', optional: false, @@ -2790,12 +2785,6 @@ const inventoryLevelTable = { customType: null as unknown as string, serverName: 'location_id', }, - variantId: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'variant_id', - }, quantity: { type: 'number', optional: false, @@ -2806,336 +2795,342 @@ const inventoryLevelTable = { optional: true, customType: null as unknown as number, }, - }, - primaryKey: ['id'], - serverName: 'inventory_level', -} as const; -const inventoryLocationTable = { - name: 'inventoryLocation', - columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, updatedAt: { type: 'number', optional: true, customType: null as unknown as number, }, - id: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - name: { + variantId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'variant_id', }, + }, + primaryKey: ['id'], + serverName: 'inventory_level', +} as const; +const inventoryLocationTable = { + name: 'inventoryLocation', + columns: { address: { type: 'string', optional: true, customType: null as unknown as string, }, - region: { - type: 'string', - optional: true, - customType: null as unknown as string, - }, countryIso: { type: 'string', optional: true, customType: null as unknown as - | 'US' - | 'MX' - | 'CA' + | 'AD' + | 'AE' | 'AF' - | 'AX' + | 'AG' + | 'AI' | 'AL' - | 'DZ' - | 'AS' - | 'AD' + | 'AM' | 'AO' - | 'AI' | 'AQ' - | 'AG' | 'AR' - | 'AM' - | 'AW' - | 'AU' + | 'AS' | 'AT' + | 'AU' + | 'AW' + | 'AX' | 'AZ' - | 'BS' - | 'BH' - | 'BD' + | 'BA' | 'BB' - | 'BY' + | 'BD' | 'BE' - | 'BZ' + | 'BF' + | 'BG' + | 'BH' + | 'BI' | 'BJ' + | 'BL' | 'BM' - | 'BT' + | 'BN' | 'BO' | 'BQ' - | 'BA' - | 'BW' - | 'BV' | 'BR' - | 'IO' - | 'BN' - | 'BG' - | 'BF' - | 'BI' - | 'CV' - | 'KH' - | 'CM' - | 'KY' + | 'BS' + | 'BT' + | 'BV' + | 'BW' + | 'BY' + | 'BZ' + | 'CA' + | 'CC' + | 'CD' | 'CF' - | 'TD' + | 'CG' + | 'CH' + | 'CI' + | 'CK' | 'CL' + | 'CM' | 'CN' - | 'CX' - | 'CC' | 'CO' - | 'KM' - | 'CG' - | 'CD' - | 'CK' | 'CR' - | 'CI' - | 'HR' | 'CU' + | 'CV' | 'CW' + | 'CX' | 'CY' | 'CZ' - | 'DK' + | 'DE' | 'DJ' + | 'DK' | 'DM' | 'DO' + | 'DZ' | 'EC' + | 'EE' | 'EG' - | 'SV' - | 'GQ' + | 'EH' | 'ER' - | 'EE' - | 'SZ' + | 'ES' | 'ET' + | 'FI' + | 'FJ' | 'FK' + | 'FM' | 'FO' - | 'FJ' - | 'FI' | 'FR' - | 'GF' - | 'PF' - | 'TF' | 'GA' - | 'GM' + | 'GB' + | 'GD' | 'GE' - | 'DE' + | 'GF' + | 'GG' | 'GH' | 'GI' - | 'GR' | 'GL' - | 'GD' + | 'GM' + | 'GN' | 'GP' - | 'GU' + | 'GQ' + | 'GR' + | 'GS' | 'GT' - | 'GG' - | 'GN' + | 'GU' | 'GW' | 'GY' - | 'HT' + | 'HK' | 'HM' - | 'VA' | 'HN' - | 'HK' + | 'HR' + | 'HT' | 'HU' - | 'IS' - | 'IN' | 'ID' - | 'IR' - | 'IQ' | 'IE' - | 'IM' | 'IL' + | 'IM' + | 'IN' + | 'IO' + | 'IQ' + | 'IR' + | 'IS' | 'IT' - | 'JM' - | 'JP' | 'JE' + | 'JM' | 'JO' - | 'KZ' + | 'JP' | 'KE' + | 'KG' + | 'KH' | 'KI' + | 'KM' + | 'KN' | 'KP' | 'KR' | 'KW' - | 'KG' + | 'KY' + | 'KZ' | 'LA' - | 'LV' | 'LB' - | 'LS' - | 'LR' - | 'LY' + | 'LC' | 'LI' + | 'LK' + | 'LR' + | 'LS' | 'LT' | 'LU' - | 'MO' + | 'LV' + | 'LY' + | 'MA' + | 'MC' + | 'MD' + | 'ME' + | 'MF' | 'MG' - | 'MW' - | 'MY' - | 'MV' - | 'ML' - | 'MT' | 'MH' + | 'MK' + | 'ML' + | 'MM' + | 'MN' + | 'MO' + | 'MP' | 'MQ' | 'MR' - | 'MU' - | 'YT' - | 'FM' - | 'MD' - | 'MC' - | 'MN' - | 'ME' | 'MS' - | 'MA' + | 'MT' + | 'MU' + | 'MV' + | 'MW' + | 'MX' + | 'MY' | 'MZ' - | 'MM' | 'NA' - | 'NR' - | 'NP' - | 'NL' | 'NC' - | 'NZ' - | 'NI' | 'NE' - | 'NG' - | 'NU' | 'NF' - | 'MK' - | 'MP' + | 'NG' + | 'NI' + | 'NL' | 'NO' + | 'NP' + | 'NR' + | 'NU' + | 'NZ' | 'OM' - | 'PK' - | 'PW' - | 'PS' | 'PA' - | 'PG' - | 'PY' | 'PE' + | 'PF' + | 'PG' | 'PH' - | 'PN' + | 'PK' | 'PL' - | 'PT' + | 'PM' + | 'PN' | 'PR' + | 'PS' + | 'PT' + | 'PW' + | 'PY' | 'QA' | 'RE' | 'RO' + | 'RS' | 'RU' | 'RW' - | 'BL' - | 'SH' - | 'KN' - | 'LC' - | 'MF' - | 'PM' - | 'VC' - | 'WS' - | 'SM' - | 'ST' | 'SA' - | 'SN' - | 'RS' + | 'SB' | 'SC' - | 'SL' + | 'SD' + | 'SE' | 'SG' - | 'SX' - | 'SK' + | 'SH' | 'SI' - | 'SB' + | 'SJ' + | 'SK' + | 'SL' + | 'SM' + | 'SN' | 'SO' - | 'ZA' - | 'GS' - | 'SS' - | 'ES' - | 'LK' - | 'SD' | 'SR' - | 'SJ' - | 'SE' - | 'CH' + | 'SS' + | 'ST' + | 'SV' + | 'SX' | 'SY' - | 'TW' - | 'TJ' - | 'TZ' - | 'TH' - | 'TL' + | 'SZ' + | 'TC' + | 'TD' + | 'TF' | 'TG' + | 'TH' + | 'TJ' | 'TK' - | 'TO' - | 'TT' + | 'TL' + | 'TM' | 'TN' + | 'TO' | 'TR' - | 'TM' - | 'TC' + | 'TT' | 'TV' - | 'UG' + | 'TW' + | 'TZ' | 'UA' - | 'AE' - | 'GB' + | 'UG' + | 'US' | 'UY' | 'UZ' - | 'VU' + | 'VA' + | 'VC' | 'VE' - | 'VN' | 'VG' | 'VI' + | 'VN' + | 'VU' | 'WF' - | 'EH' + | 'WS' + | 'XK' | 'YE' + | 'YT' + | 'ZA' | 'ZM' | 'ZW' - | 'XK' | null, serverName: 'country_iso', }, - }, - primaryKey: ['id'], - serverName: 'inventory_location', -} as const; -const ledgerAccountTable = { - name: 'ledgerAccount', - columns: { createdAt: { type: 'number', optional: true, customType: null as unknown as number, }, + id: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + name: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + region: { + type: 'string', + optional: true, + customType: null as unknown as string, + }, updatedAt: { type: 'number', optional: true, customType: null as unknown as number, }, - id: { + }, + primaryKey: ['id'], + serverName: 'inventory_location', +} as const; +const ledgerAccountTable = { + name: 'ledgerAccount', + columns: { + accountType: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'account_type', }, - name: { + code: { type: 'string', optional: false, customType: null as unknown as string, }, - code: { + createdAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, + id: { type: 'string', optional: false, customType: null as unknown as string, }, - accountType: { + name: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'account_type', }, parentAccountId: { type: 'string', @@ -3143,6 +3138,11 @@ const ledgerAccountTable = { customType: null as unknown as string, serverName: 'parent_account_id', }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], serverName: 'ledger_account', @@ -3150,12 +3150,23 @@ const ledgerAccountTable = { const ledgerEntryTable = { name: 'ledgerEntry', columns: { + accountId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'account_id', + }, createdAt: { type: 'number', optional: true, customType: null as unknown as number, }, - updatedAt: { + credit: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, + debit: { type: 'number', optional: true, customType: null as unknown as number, @@ -3165,33 +3176,22 @@ const ledgerEntryTable = { optional: false, customType: null as unknown as string, }, - transactionId: { + memo: { type: 'string', - optional: false, + optional: true, customType: null as unknown as string, - serverName: 'transaction_id', }, - accountId: { + transactionId: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'account_id', - }, - debit: { - type: 'number', - optional: true, - customType: null as unknown as number, + serverName: 'transaction_id', }, - credit: { + updatedAt: { type: 'number', optional: true, customType: null as unknown as number, }, - memo: { - type: 'string', - optional: true, - customType: null as unknown as string, - }, }, primaryKey: ['id'], serverName: 'ledger_entry', @@ -3204,10 +3204,16 @@ const ledgerTransactionTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + createdById: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, + serverName: 'created_by_id', + }, + description: { + type: 'string', + optional: true, + customType: null as unknown as string, }, id: { type: 'string', @@ -3225,16 +3231,10 @@ const ledgerTransactionTable = { customType: null as unknown as number, serverName: 'transaction_date', }, - createdById: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'created_by_id', - }, - description: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -3248,10 +3248,10 @@ const marketingAudienceTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + definition: { + type: 'json', optional: true, - customType: null as unknown as number, + customType: null as unknown as ReadonlyJSONValue, }, id: { type: 'string', @@ -3269,10 +3269,10 @@ const marketingAudienceTable = { customType: null as unknown as string, serverName: 'segment_type', }, - definition: { - type: 'json', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as ReadonlyJSONValue, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -3281,36 +3281,38 @@ const marketingAudienceTable = { const marketingCampaignTable = { name: 'marketingCampaign', columns: { + budgetAmount: { + type: 'number', + optional: true, + customType: null as unknown as number, + serverName: 'budget_amount', + }, createdAt: { type: 'number', optional: true, customType: null as unknown as number, }, - updatedAt: { + endDate: { type: 'number', optional: true, customType: null as unknown as number, + serverName: 'end_date', }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - ownerId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'owner_id', - }, name: { type: 'string', optional: false, customType: null as unknown as string, }, - status: { + ownerId: { type: 'string', - optional: false, + optional: true, customType: null as unknown as string, + serverName: 'owner_id', }, startDate: { type: 'number', @@ -3318,17 +3320,15 @@ const marketingCampaignTable = { customType: null as unknown as number, serverName: 'start_date', }, - endDate: { + status: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + updatedAt: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'end_date', - }, - budgetAmount: { - type: 'number', - optional: true, - customType: null as unknown as number, - serverName: 'budget_amount', }, }, primaryKey: ['id'], @@ -3337,20 +3337,11 @@ const marketingCampaignTable = { const marketingCampaignAudienceTable = { name: 'marketingCampaignAudience', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { + audienceId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'audience_id', }, campaignId: { type: 'string', @@ -3358,11 +3349,20 @@ const marketingCampaignAudienceTable = { customType: null as unknown as string, serverName: 'campaign_id', }, - audienceId: { + createdAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, + id: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'audience_id', + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -3371,21 +3371,11 @@ const marketingCampaignAudienceTable = { const marketingCampaignChannelTable = { name: 'marketingCampaignChannel', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - updatedAt: { + allocation: { type: 'number', optional: true, customType: null as unknown as number, }, - id: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, campaignId: { type: 'string', optional: false, @@ -3398,7 +3388,17 @@ const marketingCampaignChannelTable = { customType: null as unknown as string, serverName: 'channel_id', }, - allocation: { + createdAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, + id: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + updatedAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -3410,12 +3410,19 @@ const marketingCampaignChannelTable = { const marketingChannelTable = { name: 'marketingChannel', columns: { - createdAt: { - type: 'number', + channelType: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, + serverName: 'channel_type', }, - updatedAt: { + costModel: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'cost_model', + }, + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -3430,17 +3437,10 @@ const marketingChannelTable = { optional: false, customType: null as unknown as string, }, - channelType: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'channel_type', - }, - costModel: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, - serverName: 'cost_model', + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -3454,11 +3454,6 @@ const mediumTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, id: { type: 'string', optional: false, @@ -3469,18 +3464,23 @@ const mediumTable = { optional: false, customType: null as unknown as string, }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], } as const; const messageTable = { name: 'message', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, + body: { + type: 'string', + optional: false, + customType: null as unknown as string, }, - updatedAt: { + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -3490,21 +3490,11 @@ const messageTable = { optional: false, customType: null as unknown as string, }, - senderId: { - type: 'string', - optional: true, - customType: null as unknown as string, - }, mediumId: { type: 'string', optional: true, customType: null as unknown as string, }, - body: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, metadata: { type: 'json', optional: false, @@ -3516,6 +3506,16 @@ const messageTable = { customType: null as unknown as string, serverName: 'omitted_column', }, + senderId: { + type: 'string', + optional: true, + customType: null as unknown as string, + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], } as const; @@ -3544,11 +3544,6 @@ const orderItemTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, id: { type: 'string', optional: false, @@ -3560,12 +3555,6 @@ const orderItemTable = { customType: null as unknown as string, serverName: 'order_id', }, - variantId: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'variant_id', - }, quantity: { type: 'number', optional: false, @@ -3577,6 +3566,17 @@ const orderItemTable = { customType: null as unknown as number, serverName: 'unit_price', }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, + variantId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'variant_id', + }, }, primaryKey: ['id'], serverName: 'order_item', @@ -3584,12 +3584,12 @@ const orderItemTable = { const orderPaymentTable = { name: 'orderPayment', columns: { - createdAt: { + amount: { type: 'number', - optional: true, + optional: false, customType: null as unknown as number, }, - updatedAt: { + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -3611,16 +3611,16 @@ const orderPaymentTable = { customType: null as unknown as string, serverName: 'payment_id', }, - amount: { - type: 'number', - optional: false, - customType: null as unknown as number, - }, status: { type: 'string', optional: false, customType: null as unknown as string, }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], serverName: 'order_payment', @@ -3628,742 +3628,742 @@ const orderPaymentTable = { const orderTable = { name: 'orderTable', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - customerId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'customer_id', - }, - opportunityId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'opportunity_id', - }, - status: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - total: { - type: 'number', - optional: false, - customType: null as unknown as number, - }, - currency: { + billingCountryIso: { type: 'string', optional: false, customType: null as unknown as - | 'AED' - | 'AFN' - | 'ALL' - | 'AMD' - | 'ANG' - | 'AOA' - | 'ARS' - | 'AUD' - | 'AWG' - | 'AZN' - | 'BAM' - | 'BBD' - | 'BDT' - | 'BGN' - | 'BHD' - | 'BIF' - | 'BMD' - | 'BND' - | 'BOB' - | 'BOV' - | 'BRL' - | 'BSD' - | 'BTN' - | 'BWP' - | 'BYN' - | 'BZD' - | 'CAD' - | 'CDF' - | 'CHE' - | 'CHF' - | 'CHW' - | 'CLF' - | 'CLP' - | 'CNY' - | 'COP' - | 'COU' - | 'CRC' - | 'CUC' - | 'CUP' - | 'CVE' - | 'CZK' - | 'DJF' - | 'DKK' - | 'DOP' - | 'DZD' - | 'EGP' - | 'ERN' - | 'ETB' - | 'EUR' - | 'FJD' - | 'FKP' - | 'GBP' - | 'GEL' - | 'GHS' - | 'GIP' - | 'GMD' - | 'GNF' - | 'GTQ' - | 'GYD' - | 'HKD' - | 'HNL' - | 'HTG' - | 'HUF' - | 'IDR' - | 'ILS' - | 'INR' - | 'IQD' - | 'IRR' - | 'ISK' - | 'JMD' - | 'JOD' - | 'JPY' - | 'KES' - | 'KGS' - | 'KHR' - | 'KMF' - | 'KPW' - | 'KRW' - | 'KWD' - | 'KYD' - | 'KZT' - | 'LAK' - | 'LBP' - | 'LKR' - | 'LRD' - | 'LSL' - | 'LYD' - | 'MAD' - | 'MDL' - | 'MGA' - | 'MKD' - | 'MMK' - | 'MNT' - | 'MOP' - | 'MRU' - | 'MUR' - | 'MVR' - | 'MWK' - | 'MXN' - | 'MXV' - | 'MYR' - | 'MZN' - | 'NAD' - | 'NGN' - | 'NIO' - | 'NOK' - | 'NPR' - | 'NZD' - | 'OMR' - | 'PAB' - | 'PEN' - | 'PGK' - | 'PHP' - | 'PKR' - | 'PLN' - | 'PYG' - | 'QAR' - | 'RON' - | 'RSD' - | 'RUB' - | 'RWF' - | 'SAR' - | 'SBD' - | 'SCR' - | 'SDG' - | 'SEK' - | 'SGD' - | 'SHP' - | 'SLE' - | 'SOS' - | 'SRD' - | 'SSP' - | 'STN' - | 'SVC' - | 'SYP' - | 'SZL' - | 'THB' - | 'TJS' - | 'TMT' - | 'TND' - | 'TOP' - | 'TRY' - | 'TTD' - | 'TWD' - | 'TZS' - | 'UAH' - | 'UGX' - | 'USD' - | 'USN' - | 'UYI' - | 'UYU' - | 'UYW' - | 'UZS' - | 'VED' - | 'VES' - | 'VND' - | 'VUV' - | 'WST' - | 'XAF' - | 'XCD' - | 'XDR' - | 'XOF' - | 'XPF' - | 'XSU' - | 'XUA' - | 'YER' - | 'ZAR' - | 'ZMW' - | 'ZWG', - }, - currencyMetadata: { - type: 'json', - optional: false, - customType: null as unknown as OrderTableCurrencyMetadataCustomType, - serverName: 'currency_metadata', - }, - billingCountryIso: { - type: 'string', - optional: false, - customType: null as unknown as - | 'US' - | 'MX' - | 'CA' + | 'AD' + | 'AE' | 'AF' - | 'AX' + | 'AG' + | 'AI' | 'AL' - | 'DZ' - | 'AS' - | 'AD' + | 'AM' | 'AO' - | 'AI' | 'AQ' - | 'AG' | 'AR' - | 'AM' - | 'AW' - | 'AU' + | 'AS' | 'AT' + | 'AU' + | 'AW' + | 'AX' | 'AZ' - | 'BS' - | 'BH' - | 'BD' + | 'BA' | 'BB' - | 'BY' + | 'BD' | 'BE' - | 'BZ' + | 'BF' + | 'BG' + | 'BH' + | 'BI' | 'BJ' + | 'BL' | 'BM' - | 'BT' + | 'BN' | 'BO' | 'BQ' - | 'BA' - | 'BW' - | 'BV' | 'BR' - | 'IO' - | 'BN' - | 'BG' - | 'BF' - | 'BI' - | 'CV' - | 'KH' - | 'CM' - | 'KY' + | 'BS' + | 'BT' + | 'BV' + | 'BW' + | 'BY' + | 'BZ' + | 'CA' + | 'CC' + | 'CD' | 'CF' - | 'TD' + | 'CG' + | 'CH' + | 'CI' + | 'CK' | 'CL' + | 'CM' | 'CN' - | 'CX' - | 'CC' | 'CO' - | 'KM' - | 'CG' - | 'CD' - | 'CK' | 'CR' - | 'CI' - | 'HR' | 'CU' + | 'CV' | 'CW' + | 'CX' | 'CY' | 'CZ' - | 'DK' + | 'DE' | 'DJ' + | 'DK' | 'DM' | 'DO' + | 'DZ' | 'EC' + | 'EE' | 'EG' - | 'SV' - | 'GQ' + | 'EH' | 'ER' - | 'EE' - | 'SZ' + | 'ES' | 'ET' + | 'FI' + | 'FJ' | 'FK' + | 'FM' | 'FO' - | 'FJ' - | 'FI' | 'FR' - | 'GF' - | 'PF' - | 'TF' | 'GA' - | 'GM' + | 'GB' + | 'GD' | 'GE' - | 'DE' + | 'GF' + | 'GG' | 'GH' | 'GI' - | 'GR' | 'GL' - | 'GD' + | 'GM' + | 'GN' | 'GP' - | 'GU' + | 'GQ' + | 'GR' + | 'GS' | 'GT' - | 'GG' - | 'GN' + | 'GU' | 'GW' | 'GY' - | 'HT' + | 'HK' | 'HM' - | 'VA' | 'HN' - | 'HK' + | 'HR' + | 'HT' | 'HU' - | 'IS' - | 'IN' | 'ID' - | 'IR' - | 'IQ' | 'IE' - | 'IM' | 'IL' + | 'IM' + | 'IN' + | 'IO' + | 'IQ' + | 'IR' + | 'IS' | 'IT' - | 'JM' - | 'JP' | 'JE' + | 'JM' | 'JO' - | 'KZ' + | 'JP' | 'KE' + | 'KG' + | 'KH' | 'KI' - | 'KP' + | 'KM' + | 'KN' + | 'KP' | 'KR' | 'KW' - | 'KG' + | 'KY' + | 'KZ' | 'LA' - | 'LV' | 'LB' - | 'LS' - | 'LR' - | 'LY' + | 'LC' | 'LI' + | 'LK' + | 'LR' + | 'LS' | 'LT' | 'LU' - | 'MO' + | 'LV' + | 'LY' + | 'MA' + | 'MC' + | 'MD' + | 'ME' + | 'MF' | 'MG' - | 'MW' - | 'MY' - | 'MV' - | 'ML' - | 'MT' | 'MH' + | 'MK' + | 'ML' + | 'MM' + | 'MN' + | 'MO' + | 'MP' | 'MQ' | 'MR' - | 'MU' - | 'YT' - | 'FM' - | 'MD' - | 'MC' - | 'MN' - | 'ME' | 'MS' - | 'MA' + | 'MT' + | 'MU' + | 'MV' + | 'MW' + | 'MX' + | 'MY' | 'MZ' - | 'MM' | 'NA' - | 'NR' - | 'NP' - | 'NL' | 'NC' - | 'NZ' - | 'NI' | 'NE' - | 'NG' - | 'NU' | 'NF' - | 'MK' - | 'MP' + | 'NG' + | 'NI' + | 'NL' | 'NO' + | 'NP' + | 'NR' + | 'NU' + | 'NZ' | 'OM' - | 'PK' - | 'PW' - | 'PS' | 'PA' - | 'PG' - | 'PY' | 'PE' + | 'PF' + | 'PG' | 'PH' - | 'PN' + | 'PK' | 'PL' - | 'PT' + | 'PM' + | 'PN' | 'PR' + | 'PS' + | 'PT' + | 'PW' + | 'PY' | 'QA' | 'RE' | 'RO' + | 'RS' | 'RU' | 'RW' - | 'BL' - | 'SH' - | 'KN' - | 'LC' - | 'MF' - | 'PM' - | 'VC' - | 'WS' - | 'SM' - | 'ST' | 'SA' - | 'SN' - | 'RS' + | 'SB' | 'SC' - | 'SL' + | 'SD' + | 'SE' | 'SG' - | 'SX' - | 'SK' + | 'SH' | 'SI' - | 'SB' + | 'SJ' + | 'SK' + | 'SL' + | 'SM' + | 'SN' | 'SO' - | 'ZA' - | 'GS' - | 'SS' - | 'ES' - | 'LK' - | 'SD' | 'SR' - | 'SJ' - | 'SE' - | 'CH' + | 'SS' + | 'ST' + | 'SV' + | 'SX' | 'SY' - | 'TW' - | 'TJ' - | 'TZ' - | 'TH' - | 'TL' + | 'SZ' + | 'TC' + | 'TD' + | 'TF' | 'TG' + | 'TH' + | 'TJ' | 'TK' - | 'TO' - | 'TT' + | 'TL' + | 'TM' | 'TN' + | 'TO' | 'TR' - | 'TM' - | 'TC' + | 'TT' | 'TV' - | 'UG' + | 'TW' + | 'TZ' | 'UA' - | 'AE' - | 'GB' + | 'UG' + | 'US' | 'UY' | 'UZ' - | 'VU' + | 'VA' + | 'VC' | 'VE' - | 'VN' | 'VG' | 'VI' + | 'VN' + | 'VU' | 'WF' - | 'EH' + | 'WS' + | 'XK' | 'YE' + | 'YT' + | 'ZA' | 'ZM' - | 'ZW' - | 'XK', + | 'ZW', serverName: 'billing_country_iso', }, + cdcCheckpoint: { + type: 'json', + optional: true, + customType: null as unknown as null | { + hydratedAtIso: string; + lastLsn: string; + snapshotCompleted: boolean; + }, + serverName: 'cdc_checkpoint', + }, + createdAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, + currency: { + type: 'string', + optional: false, + customType: null as unknown as + | 'AED' + | 'AFN' + | 'ALL' + | 'AMD' + | 'ANG' + | 'AOA' + | 'ARS' + | 'AUD' + | 'AWG' + | 'AZN' + | 'BAM' + | 'BBD' + | 'BDT' + | 'BGN' + | 'BHD' + | 'BIF' + | 'BMD' + | 'BND' + | 'BOB' + | 'BOV' + | 'BRL' + | 'BSD' + | 'BTN' + | 'BWP' + | 'BYN' + | 'BZD' + | 'CAD' + | 'CDF' + | 'CHE' + | 'CHF' + | 'CHW' + | 'CLF' + | 'CLP' + | 'CNY' + | 'COP' + | 'COU' + | 'CRC' + | 'CUC' + | 'CUP' + | 'CVE' + | 'CZK' + | 'DJF' + | 'DKK' + | 'DOP' + | 'DZD' + | 'EGP' + | 'ERN' + | 'ETB' + | 'EUR' + | 'FJD' + | 'FKP' + | 'GBP' + | 'GEL' + | 'GHS' + | 'GIP' + | 'GMD' + | 'GNF' + | 'GTQ' + | 'GYD' + | 'HKD' + | 'HNL' + | 'HTG' + | 'HUF' + | 'IDR' + | 'ILS' + | 'INR' + | 'IQD' + | 'IRR' + | 'ISK' + | 'JMD' + | 'JOD' + | 'JPY' + | 'KES' + | 'KGS' + | 'KHR' + | 'KMF' + | 'KPW' + | 'KRW' + | 'KWD' + | 'KYD' + | 'KZT' + | 'LAK' + | 'LBP' + | 'LKR' + | 'LRD' + | 'LSL' + | 'LYD' + | 'MAD' + | 'MDL' + | 'MGA' + | 'MKD' + | 'MMK' + | 'MNT' + | 'MOP' + | 'MRU' + | 'MUR' + | 'MVR' + | 'MWK' + | 'MXN' + | 'MXV' + | 'MYR' + | 'MZN' + | 'NAD' + | 'NGN' + | 'NIO' + | 'NOK' + | 'NPR' + | 'NZD' + | 'OMR' + | 'PAB' + | 'PEN' + | 'PGK' + | 'PHP' + | 'PKR' + | 'PLN' + | 'PYG' + | 'QAR' + | 'RON' + | 'RSD' + | 'RUB' + | 'RWF' + | 'SAR' + | 'SBD' + | 'SCR' + | 'SDG' + | 'SEK' + | 'SGD' + | 'SHP' + | 'SLE' + | 'SOS' + | 'SRD' + | 'SSP' + | 'STN' + | 'SVC' + | 'SYP' + | 'SZL' + | 'THB' + | 'TJS' + | 'TMT' + | 'TND' + | 'TOP' + | 'TRY' + | 'TTD' + | 'TWD' + | 'TZS' + | 'UAH' + | 'UGX' + | 'USD' + | 'USN' + | 'UYI' + | 'UYU' + | 'UYW' + | 'UZS' + | 'VED' + | 'VES' + | 'VND' + | 'VUV' + | 'WST' + | 'XAF' + | 'XCD' + | 'XDR' + | 'XOF' + | 'XPF' + | 'XSU' + | 'XUA' + | 'YER' + | 'ZAR' + | 'ZMW' + | 'ZWG', + }, + currencyMetadata: { + type: 'json', + optional: false, + customType: null as unknown as OrderTableCurrencyMetadataCustomType, + serverName: 'currency_metadata', + }, + customerId: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'customer_id', + }, + id: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + opportunityId: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'opportunity_id', + }, shippingCountryIso: { type: 'string', optional: false, customType: null as unknown as - | 'US' - | 'MX' - | 'CA' + | 'AD' + | 'AE' | 'AF' - | 'AX' + | 'AG' + | 'AI' | 'AL' - | 'DZ' - | 'AS' - | 'AD' + | 'AM' | 'AO' - | 'AI' | 'AQ' - | 'AG' | 'AR' - | 'AM' - | 'AW' - | 'AU' + | 'AS' | 'AT' + | 'AU' + | 'AW' + | 'AX' | 'AZ' - | 'BS' - | 'BH' - | 'BD' + | 'BA' | 'BB' - | 'BY' + | 'BD' | 'BE' - | 'BZ' + | 'BF' + | 'BG' + | 'BH' + | 'BI' | 'BJ' + | 'BL' | 'BM' - | 'BT' + | 'BN' | 'BO' | 'BQ' - | 'BA' - | 'BW' - | 'BV' | 'BR' - | 'IO' - | 'BN' - | 'BG' - | 'BF' - | 'BI' - | 'CV' - | 'KH' - | 'CM' - | 'KY' + | 'BS' + | 'BT' + | 'BV' + | 'BW' + | 'BY' + | 'BZ' + | 'CA' + | 'CC' + | 'CD' | 'CF' - | 'TD' + | 'CG' + | 'CH' + | 'CI' + | 'CK' | 'CL' + | 'CM' | 'CN' - | 'CX' - | 'CC' | 'CO' - | 'KM' - | 'CG' - | 'CD' - | 'CK' | 'CR' - | 'CI' - | 'HR' | 'CU' + | 'CV' | 'CW' + | 'CX' | 'CY' | 'CZ' - | 'DK' + | 'DE' | 'DJ' + | 'DK' | 'DM' | 'DO' + | 'DZ' | 'EC' + | 'EE' | 'EG' - | 'SV' - | 'GQ' + | 'EH' | 'ER' - | 'EE' - | 'SZ' + | 'ES' | 'ET' + | 'FI' + | 'FJ' | 'FK' + | 'FM' | 'FO' - | 'FJ' - | 'FI' | 'FR' - | 'GF' - | 'PF' - | 'TF' | 'GA' - | 'GM' + | 'GB' + | 'GD' | 'GE' - | 'DE' + | 'GF' + | 'GG' | 'GH' | 'GI' - | 'GR' | 'GL' - | 'GD' + | 'GM' + | 'GN' | 'GP' - | 'GU' + | 'GQ' + | 'GR' + | 'GS' | 'GT' - | 'GG' - | 'GN' + | 'GU' | 'GW' | 'GY' - | 'HT' + | 'HK' | 'HM' - | 'VA' | 'HN' - | 'HK' + | 'HR' + | 'HT' | 'HU' - | 'IS' - | 'IN' | 'ID' - | 'IR' - | 'IQ' | 'IE' - | 'IM' | 'IL' + | 'IM' + | 'IN' + | 'IO' + | 'IQ' + | 'IR' + | 'IS' | 'IT' - | 'JM' - | 'JP' | 'JE' + | 'JM' | 'JO' - | 'KZ' + | 'JP' | 'KE' + | 'KG' + | 'KH' | 'KI' + | 'KM' + | 'KN' | 'KP' | 'KR' | 'KW' - | 'KG' + | 'KY' + | 'KZ' | 'LA' - | 'LV' | 'LB' - | 'LS' - | 'LR' - | 'LY' + | 'LC' | 'LI' + | 'LK' + | 'LR' + | 'LS' | 'LT' | 'LU' - | 'MO' + | 'LV' + | 'LY' + | 'MA' + | 'MC' + | 'MD' + | 'ME' + | 'MF' | 'MG' - | 'MW' - | 'MY' - | 'MV' - | 'ML' - | 'MT' | 'MH' + | 'MK' + | 'ML' + | 'MM' + | 'MN' + | 'MO' + | 'MP' | 'MQ' | 'MR' - | 'MU' - | 'YT' - | 'FM' - | 'MD' - | 'MC' - | 'MN' - | 'ME' | 'MS' - | 'MA' + | 'MT' + | 'MU' + | 'MV' + | 'MW' + | 'MX' + | 'MY' | 'MZ' - | 'MM' | 'NA' - | 'NR' - | 'NP' - | 'NL' | 'NC' - | 'NZ' - | 'NI' | 'NE' - | 'NG' - | 'NU' | 'NF' - | 'MK' - | 'MP' + | 'NG' + | 'NI' + | 'NL' | 'NO' + | 'NP' + | 'NR' + | 'NU' + | 'NZ' | 'OM' - | 'PK' - | 'PW' - | 'PS' | 'PA' - | 'PG' - | 'PY' | 'PE' + | 'PF' + | 'PG' | 'PH' - | 'PN' + | 'PK' | 'PL' - | 'PT' + | 'PM' + | 'PN' | 'PR' + | 'PS' + | 'PT' + | 'PW' + | 'PY' | 'QA' | 'RE' | 'RO' + | 'RS' | 'RU' | 'RW' - | 'BL' - | 'SH' - | 'KN' - | 'LC' - | 'MF' - | 'PM' - | 'VC' - | 'WS' - | 'SM' - | 'ST' | 'SA' - | 'SN' - | 'RS' + | 'SB' | 'SC' - | 'SL' + | 'SD' + | 'SE' | 'SG' - | 'SX' - | 'SK' + | 'SH' | 'SI' - | 'SB' + | 'SJ' + | 'SK' + | 'SL' + | 'SM' + | 'SN' | 'SO' - | 'ZA' - | 'GS' - | 'SS' - | 'ES' - | 'LK' - | 'SD' | 'SR' - | 'SJ' - | 'SE' - | 'CH' + | 'SS' + | 'ST' + | 'SV' + | 'SX' | 'SY' - | 'TW' - | 'TJ' - | 'TZ' - | 'TH' - | 'TL' + | 'SZ' + | 'TC' + | 'TD' + | 'TF' | 'TG' + | 'TH' + | 'TJ' | 'TK' - | 'TO' - | 'TT' + | 'TL' + | 'TM' | 'TN' + | 'TO' | 'TR' - | 'TM' - | 'TC' + | 'TT' | 'TV' - | 'UG' + | 'TW' + | 'TZ' | 'UA' - | 'AE' - | 'GB' + | 'UG' + | 'US' | 'UY' | 'UZ' - | 'VU' + | 'VA' + | 'VC' | 'VE' - | 'VN' | 'VG' | 'VI' + | 'VN' + | 'VU' | 'WF' - | 'EH' + | 'WS' + | 'XK' | 'YE' + | 'YT' + | 'ZA' | 'ZM' - | 'ZW' - | 'XK', + | 'ZW', serverName: 'shipping_country_iso', }, - cdcCheckpoint: { - type: 'json', + status: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + total: { + type: 'number', + optional: false, + customType: null as unknown as number, + }, + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as { - lastLsn: string; - snapshotCompleted: boolean; - hydratedAtIso: string; - } | null, - serverName: 'cdc_checkpoint', + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -4372,37 +4372,16 @@ const orderTable = { const paymentTable = { name: 'payment', columns: { - createdAt: { + amount: { type: 'number', - optional: true, + optional: false, customType: null as unknown as number, }, - updatedAt: { + createdAt: { type: 'number', optional: true, customType: null as unknown as number, }, - id: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - externalRef: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'external_ref', - }, - status: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - amount: { - type: 'number', - optional: false, - customType: null as unknown as number, - }, currency: { type: 'string', optional: false, @@ -4577,6 +4556,17 @@ const paymentTable = { | 'ZMW' | 'ZWG', }, + externalRef: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'external_ref', + }, + id: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, receivedAt: { type: 'number', optional: true, @@ -4589,47 +4579,57 @@ const paymentTable = { customType: null as unknown as string, serverName: 'received_by_id', }, + status: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], } as const; const productTable = { name: 'product', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, + categoryId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'category_id', }, - updatedAt: { + createdAt: { type: 'number', optional: true, customType: null as unknown as number, }, - id: { + description: { type: 'string', - optional: false, + optional: true, customType: null as unknown as string, }, - categoryId: { + id: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'category_id', }, name: { type: 'string', optional: false, customType: null as unknown as string, }, - description: { + status: { type: 'string', optional: true, customType: null as unknown as string, }, - status: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -4642,10 +4642,10 @@ const productCategoryTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + description: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, }, id: { type: 'string', @@ -4657,17 +4657,17 @@ const productCategoryTable = { optional: false, customType: null as unknown as string, }, - description: { - type: 'string', - optional: true, - customType: null as unknown as string, - }, parentId: { type: 'string', optional: true, customType: null as unknown as string, serverName: 'parent_id', }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], serverName: 'product_category', @@ -4680,74 +4680,79 @@ const productMediaTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - productId: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'product_id', - }, - url: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - type: { - type: 'string', + mimeDescriptor: { + type: 'json', optional: false, - customType: null as unknown as ProductMediaTypeCustomType, + customType: null as unknown as ProductMediaMimeDescriptorCustomType, + serverName: 'mime_descriptor', }, mimeKey: { type: 'string', optional: false, customType: null as unknown as - | 'undefined' - | 'object' - | 'json' - | 'null' - | 'unknown' - | 'iso' - | '3gp' | '3ds' + | '3dsm' | '3dsx' + | '3gp' | '3mf' | 'abnf' | 'ace' + | 'ada' | 'aff' | 'ai' | 'aidl' + | 'algol68' | 'ani' | 'apk' + | 'applebplist' + | 'appledouble' + | 'appleplist' + | 'applesingle' + | 'ar' | 'arc' + | 'arj' + | 'arrow' | 'asc' - | 'au' + | 'asd' | 'asf' | 'asm' | 'asp' + | 'au' + | 'autohotkey' + | 'autoit' | 'avi' | 'avif' | 'avro' | 'awk' | 'ax' + | 'batch' + | 'bazel' + | 'bcad' | 'bib' | 'bmp' | 'bpg' | 'bpl' + | 'brainfuck' | 'brf' + | 'bzip' + | 'bzip3' | 'c' | 'cab' + | 'cad' | 'cat' + | 'cdf' | 'chm' + | 'clojure' | 'cmake' + | 'cobol' + | 'coff' + | 'coffeescript' + | 'com' | 'cpl' | 'cpp' | 'crt' @@ -4756,30 +4761,51 @@ const productMediaTable = { | 'csproj' | 'css' | 'csv' + | 'ctl' | 'dart' | 'deb' | 'dex' + | 'dey' + | 'dicom' | 'diff' + | 'directory' + | 'django' | 'dll' | 'dm' | 'dmg' + | 'dmigd' + | 'dmscript' | 'doc' + | 'dockerfile' | 'docx' + | 'dosmbr' | 'dotx' + | 'dsstore' | 'dwg' | 'dxf' | 'dylib' + | 'ebml' | 'elf' + | 'elixir' | 'emf' | 'eml' + | 'empty' | 'epub' | 'erb' + | 'erlang' + | 'ese' | 'exe' + | 'exp' | 'flac' + | 'flutter' | 'flv' + | 'fortran' | 'fpx' + | 'gemfile' | 'gemspec' | 'gif' + | 'gitattributes' + | 'gitmodules' | 'gleam' | 'go' | 'gpx' @@ -4789,324 +4815,272 @@ const productMediaTable = { | 'h' | 'h5' | 'handlebars' + | 'haskell' | 'hcl' | 'heif' | 'hfs' | 'hlp' | 'hpp' | 'hta' + | 'htaccess' | 'html' + | 'hve' | 'hwp' | 'icc' | 'icns' | 'ico' | 'ics' + | 'ignorefile' | 'img' | 'ini' + | 'internetshortcut' + | 'iosapp' | 'ipynb' + | 'iso' | 'jar' | 'java' + | 'javabytecode' + | 'javascript' | 'jinja' | 'jng' | 'jnlp' | 'jp2' | 'jpeg' + | 'json' + | 'jsonc' | 'jsonl' | 'jsx' + | 'julia' | 'jxl' | 'ko' + | 'kotlin' | 'ks' + | 'latex' + | 'latexaux' + | 'less' | 'lha' + | 'license' | 'lisp' + | 'litcs' | 'lnk' | 'lock' | 'lrz' | 'lua' | 'lz' | 'lz4' + | 'lzx' | 'm3u' | 'm4' + | 'macho' | 'maff' + | 'makefile' | 'markdown' | 'matlab' | 'mht' + | 'midi' | 'mkv' | 'mp2' | 'mp3' | 'mp4' - | 'tsv' + | 'mpegts' + | 'mscompress' | 'msi' | 'msix' | 'mst' - | 'mui' - | 'mum' - | 'mun' - | 'npy' - | 'npz' - | 'nupkg' - | 'ocx' - | 'odex' - | 'odin' - | 'odp' - | 'ods' - | 'odt' - | 'ogg' - | 'one' - | 'onnx' - | 'otf' - | 'parquet' - | 'pcap' - | 'pdb' - | 'pdf' - | 'pem' - | 'pub' - | 'pgp' - | 'php' - | 'pickle' - | 'png' - | 'po' - | 'ppt' - | 'pptx' - | 'proto' - | 'protobuf' - | 'psd' - | 'qoi' - | 'rar' - | 'rdf' - | 'rlib' - | 'rll' - | 'rpm' - | 'rst' - | 'rtf' - | 'scala' - | 'scr' - | 'scss' - | 'sgml' - | 'sh3d' - | 'smali' - | 'snap' - | 'so' - | 'sql' - | 'sqlite' - | 'srt' - | 'sum' - | 'svg' - | 'swf' - | 'swift' - | 'sys' - | 'tar' - | 'tcl' - | 'textproto' - | 'tga' - | 'tiff' - | 'tmdx' - | 'toml' - | 'torrent' - | 'tsx' - | 'ttf' - | 'twig' - | 'txt' - | 'vba' - | 'vbe' - | 'vcard' - | 'vcxproj' - | 'verilog' - | 'vhd' - | 'vtt' - | 'vue' - | 'wad' - | 'wasm' - | 'wav' - | 'webm' - | 'webp' - | 'wim' - | 'wma' - | 'wmf' - | 'wmv' - | 'woff' - | 'woff2' - | 'xar' - | 'xcf' - | 'xls' - | 'xlsb' - | 'xlsx' - | 'xml' - | 'xpi' - | 'xsd' - | 'xz' - | 'yaml' - | 'yara' - | 'zig' - | 'zip' - | 'zst' - | '3dsm' - | 'ada' - | 'algol68' - | 'applebplist' - | 'appledouble' - | 'appleplist' - | 'applesingle' - | 'ar' - | 'arj' - | 'arrow' - | 'asd' - | 'autohotkey' - | 'autoit' - | 'batch' - | 'bazel' - | 'bcad' - | 'brainfuck' - | 'bzip' - | 'bzip3' - | 'cad' - | 'cdf' - | 'clojure' - | 'cobol' - | 'coff' - | 'coffeescript' - | 'com' - | 'ctl' - | 'dey' - | 'dicom' - | 'directory' - | 'django' - | 'dmigd' - | 'dmscript' - | 'dockerfile' - | 'dosmbr' - | 'dsstore' - | 'ebml' - | 'elixir' - | 'empty' - | 'erlang' - | 'ese' - | 'exp' - | 'flutter' - | 'fortran' - | 'gemfile' - | 'gitattributes' - | 'gitmodules' - | 'haskell' - | 'htaccess' - | 'hve' - | 'ignorefile' - | 'internetshortcut' - | 'iosapp' - | 'javabytecode' - | 'javascript' - | 'jsonc' - | 'julia' - | 'kotlin' - | 'latex' - | 'latexaux' - | 'less' - | 'license' - | 'litcs' - | 'lzx' - | 'macho' - | 'makefile' - | 'midi' - | 'mpegts' - | 'mscompress' + | 'mui' + | 'mum' + | 'mun' | 'nim' + | 'npy' + | 'npz' + | 'null' + | 'nupkg' + | 'object' | 'objectivec' | 'ocaml' + | 'ocx' + | 'odex' + | 'odin' + | 'odp' + | 'ods' + | 'odt' + | 'ogg' | 'ole' + | 'one' + | 'onnx' | 'ooxml' + | 'otf' | 'outlook' | 'palmos' + | 'parquet' | 'pascal' | 'pbm' + | 'pcap' + | 'pdb' + | 'pdf' | 'pebin' + | 'pem' | 'perl' + | 'pgp' + | 'php' + | 'pickle' + | 'png' + | 'po' | 'postscript' | 'powershell' + | 'ppt' + | 'pptx' | 'printfox' | 'prolog' | 'proteindb' - | 'pytorch' + | 'proto' + | 'protobuf' + | 'psd' + | 'pub' | 'python' | 'pythonbytecode' | 'pythonpar' + | 'pytorch' + | 'qoi' | 'qt' | 'r' | 'randomascii' | 'randombytes' | 'randomtxt' + | 'rar' + | 'rdf' | 'rdp' | 'riff' + | 'rlib' + | 'rll' + | 'rpm' + | 'rst' + | 'rtf' | 'ruby' | 'rust' | 'rzip' + | 'scala' | 'scheme' + | 'scr' | 'scriptwsf' + | 'scss' | 'sevenzip' + | 'sgml' + | 'sh3d' | 'shell' + | 'smali' + | 'snap' + | 'so' | 'solidity' + | 'sql' + | 'sqlite' | 'squashfs' + | 'srt' | 'stlbinary' | 'stltext' + | 'sum' | 'svd' + | 'svg' + | 'swf' + | 'swift' | 'symlink' | 'symlinktext' + | 'sys' + | 'tar' + | 'tcl' + | 'textproto' + | 'tga' | 'thumbsdb' + | 'tiff' + | 'tmdx' + | 'toml' + | 'torrent' | 'troff' + | 'tsv' + | 'tsx' + | 'ttf' + | 'twig' + | 'txt' | 'txtascii' | 'txtutf16' | 'txtutf8' | 'typescript' | 'udf' + | 'undefined' | 'unixcompress' + | 'unknown' + | 'vba' + | 'vbe' + | 'vcard' | 'vcs' + | 'vcxproj' + | 'verilog' + | 'vhd' | 'vhdl' | 'visio' + | 'vtt' + | 'vue' + | 'wad' + | 'wasm' + | 'wav' + | 'webm' + | 'webp' | 'webtemplate' + | 'wim' | 'winregistry' - | 'zlibstream', + | 'wma' + | 'wmf' + | 'wmv' + | 'woff' + | 'woff2' + | 'xar' + | 'xcf' + | 'xls' + | 'xlsb' + | 'xlsx' + | 'xml' + | 'xpi' + | 'xsd' + | 'xz' + | 'yaml' + | 'yara' + | 'zig' + | 'zip' + | 'zlibstream' + | 'zst', serverName: 'mime_key', }, - mimeDescriptor: { - type: 'json', + productId: { + type: 'string', optional: false, - customType: null as unknown as ProductMediaMimeDescriptorCustomType, - serverName: 'mime_descriptor', + customType: null as unknown as string, + serverName: 'product_id', }, - }, - primaryKey: ['id'], - serverName: 'product_media', -} as const; -const productVariantTable = { - name: 'productVariant', - columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, + type: { + type: 'string', + optional: false, + customType: null as unknown as ProductMediaTypeCustomType, }, updatedAt: { type: 'number', optional: true, customType: null as unknown as number, }, - id: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - productId: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'product_id', - }, - sku: { + url: { type: 'string', optional: false, customType: null as unknown as string, }, - price: { + }, + primaryKey: ['id'], + serverName: 'product_media', +} as const; +const productVariantTable = { + name: 'productVariant', + columns: { + createdAt: { type: 'number', - optional: false, + optional: true, customType: null as unknown as number, }, currency: { @@ -5283,12 +5257,38 @@ const productVariantTable = { | 'ZMW' | 'ZWG', }, + id: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, isActive: { type: 'boolean', optional: true, customType: null as unknown as boolean, serverName: 'is_active', }, + price: { + type: 'number', + optional: false, + customType: null as unknown as number, + }, + productId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'product_id', + }, + sku: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], serverName: 'product_variant', @@ -5301,37 +5301,37 @@ const projectTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + description: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - ownerId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'owner_id', - }, name: { type: 'string', optional: false, customType: null as unknown as string, }, - description: { + ownerId: { type: 'string', optional: true, customType: null as unknown as string, + serverName: 'owner_id', }, status: { type: 'string', optional: true, customType: null as unknown as string, }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, workflowState: { type: 'json', optional: false, @@ -5344,12 +5344,13 @@ const projectTable = { const projectAssignmentTable = { name: 'projectAssignment', columns: { - createdAt: { + assignedAt: { type: 'number', optional: true, customType: null as unknown as number, + serverName: 'assigned_at', }, - updatedAt: { + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -5359,28 +5360,27 @@ const projectAssignmentTable = { optional: false, customType: null as unknown as string, }, - taskId: { + role: { type: 'string', - optional: false, + optional: true, customType: null as unknown as string, - serverName: 'task_id', }, - userId: { + taskId: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'user_id', + serverName: 'task_id', }, - assignedAt: { + updatedAt: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'assigned_at', }, - role: { + userId: { type: 'string', - optional: true, + optional: false, customType: null as unknown as string, + serverName: 'user_id', }, }, primaryKey: ['id'], @@ -5394,10 +5394,17 @@ const projectAttachmentTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + fileName: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'file_name', + }, + fileType: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, + serverName: 'file_type', }, id: { type: 'string', @@ -5410,17 +5417,10 @@ const projectAttachmentTable = { customType: null as unknown as string, serverName: 'task_id', }, - fileName: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'file_name', - }, - fileType: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, - serverName: 'file_type', + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -5429,15 +5429,26 @@ const projectAttachmentTable = { const projectAuditTable = { name: 'projectAudit', columns: { + action: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + actorId: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'actor_id', + }, createdAt: { type: 'number', optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + details: { + type: 'json', optional: true, - customType: null as unknown as number, + customType: null as unknown as ProjectAuditDetailsCustomType, }, id: { type: 'string', @@ -5450,21 +5461,10 @@ const projectAuditTable = { customType: null as unknown as string, serverName: 'project_id', }, - actorId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'actor_id', - }, - action: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - details: { - type: 'json', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as ProjectAuditDetailsCustomType, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -5473,12 +5473,18 @@ const projectAuditTable = { const projectCommentTable = { name: 'projectComment', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, + authorId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'author_id', }, - updatedAt: { + body: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -5494,16 +5500,10 @@ const projectCommentTable = { customType: null as unknown as string, serverName: 'task_id', }, - authorId: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'author_id', - }, - body: { - type: 'string', - optional: false, - customType: null as unknown as string, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -5512,12 +5512,13 @@ const projectCommentTable = { const projectNoteTable = { name: 'projectNote', columns: { - createdAt: { - type: 'number', + authorId: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, + serverName: 'author_id', }, - updatedAt: { + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -5527,22 +5528,21 @@ const projectNoteTable = { optional: false, customType: null as unknown as string, }, - projectId: { + note: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'project_id', - }, - authorId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'author_id', }, - note: { + projectId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'project_id', + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -5556,32 +5556,32 @@ const projectPhaseTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - projectId: { + name: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'project_id', }, - name: { + projectId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'project_id', }, sequence: { type: 'number', optional: false, customType: null as unknown as number, }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], serverName: 'project_phase', @@ -5589,12 +5589,12 @@ const projectPhaseTable = { const projectTagTable = { name: 'projectTag', columns: { - createdAt: { - type: 'number', + color: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, }, - updatedAt: { + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -5609,10 +5609,10 @@ const projectTagTable = { optional: false, customType: null as unknown as string, }, - color: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -5626,43 +5626,43 @@ const projectTaskTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - projectId: { + phaseId: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'project_id', + serverName: 'phase_id', }, - phaseId: { + priority: { type: 'string', - optional: false, + optional: true, customType: null as unknown as string, - serverName: 'phase_id', }, - title: { + projectId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'project_id', }, status: { type: 'string', optional: false, customType: null as unknown as string, }, - priority: { + title: { type: 'string', - optional: true, + optional: false, customType: null as unknown as string, }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], serverName: 'project_task', @@ -5675,27 +5675,27 @@ const projectTaskTagTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - taskId: { + tagId: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'task_id', + serverName: 'tag_id', }, - tagId: { + taskId: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'tag_id', + serverName: 'task_id', + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -5704,32 +5704,15 @@ const projectTaskTagTable = { const shipmentTable = { name: 'shipment', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - orderId: { + carrier: { type: 'string', - optional: false, + optional: true, customType: null as unknown as string, - serverName: 'order_id', }, - shippedAt: { + createdAt: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'shipped_at', }, deliveredAt: { type: 'number', @@ -5737,330 +5720,347 @@ const shipmentTable = { customType: null as unknown as number, serverName: 'delivered_at', }, - carrier: { - type: 'string', - optional: true, - customType: null as unknown as string, - }, - trackingNumber: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'tracking_number', - }, destinationCountry: { type: 'string', optional: false, customType: null as unknown as - | 'US' - | 'MX' - | 'CA' + | 'AD' + | 'AE' | 'AF' - | 'AX' + | 'AG' + | 'AI' | 'AL' - | 'DZ' - | 'AS' - | 'AD' + | 'AM' | 'AO' - | 'AI' | 'AQ' - | 'AG' | 'AR' - | 'AM' - | 'AW' - | 'AU' + | 'AS' | 'AT' + | 'AU' + | 'AW' + | 'AX' | 'AZ' - | 'BS' - | 'BH' - | 'BD' + | 'BA' | 'BB' - | 'BY' + | 'BD' | 'BE' - | 'BZ' + | 'BF' + | 'BG' + | 'BH' + | 'BI' | 'BJ' + | 'BL' | 'BM' - | 'BT' + | 'BN' | 'BO' | 'BQ' - | 'BA' - | 'BW' - | 'BV' | 'BR' - | 'IO' - | 'BN' - | 'BG' - | 'BF' - | 'BI' - | 'CV' - | 'KH' - | 'CM' - | 'KY' - | 'CF' - | 'TD' - | 'CL' - | 'CN' - | 'CX' + | 'BS' + | 'BT' + | 'BV' + | 'BW' + | 'BY' + | 'BZ' + | 'CA' | 'CC' - | 'CO' - | 'KM' - | 'CG' | 'CD' + | 'CF' + | 'CG' + | 'CH' + | 'CI' | 'CK' + | 'CL' + | 'CM' + | 'CN' + | 'CO' | 'CR' - | 'CI' - | 'HR' | 'CU' + | 'CV' | 'CW' + | 'CX' | 'CY' | 'CZ' - | 'DK' + | 'DE' | 'DJ' + | 'DK' | 'DM' | 'DO' + | 'DZ' | 'EC' + | 'EE' | 'EG' - | 'SV' - | 'GQ' + | 'EH' | 'ER' - | 'EE' - | 'SZ' + | 'ES' | 'ET' + | 'FI' + | 'FJ' | 'FK' + | 'FM' | 'FO' - | 'FJ' - | 'FI' | 'FR' - | 'GF' - | 'PF' - | 'TF' | 'GA' - | 'GM' + | 'GB' + | 'GD' | 'GE' - | 'DE' + | 'GF' + | 'GG' | 'GH' | 'GI' - | 'GR' | 'GL' - | 'GD' + | 'GM' + | 'GN' | 'GP' - | 'GU' + | 'GQ' + | 'GR' + | 'GS' | 'GT' - | 'GG' - | 'GN' + | 'GU' | 'GW' | 'GY' - | 'HT' + | 'HK' | 'HM' - | 'VA' | 'HN' - | 'HK' + | 'HR' + | 'HT' | 'HU' - | 'IS' - | 'IN' | 'ID' - | 'IR' - | 'IQ' | 'IE' - | 'IM' | 'IL' + | 'IM' + | 'IN' + | 'IO' + | 'IQ' + | 'IR' + | 'IS' | 'IT' - | 'JM' - | 'JP' | 'JE' + | 'JM' | 'JO' - | 'KZ' + | 'JP' | 'KE' + | 'KG' + | 'KH' | 'KI' + | 'KM' + | 'KN' | 'KP' | 'KR' | 'KW' - | 'KG' + | 'KY' + | 'KZ' | 'LA' - | 'LV' | 'LB' - | 'LS' - | 'LR' - | 'LY' + | 'LC' | 'LI' + | 'LK' + | 'LR' + | 'LS' | 'LT' | 'LU' - | 'MO' + | 'LV' + | 'LY' + | 'MA' + | 'MC' + | 'MD' + | 'ME' + | 'MF' | 'MG' - | 'MW' - | 'MY' - | 'MV' - | 'ML' - | 'MT' | 'MH' + | 'MK' + | 'ML' + | 'MM' + | 'MN' + | 'MO' + | 'MP' | 'MQ' | 'MR' - | 'MU' - | 'YT' - | 'FM' - | 'MD' - | 'MC' - | 'MN' - | 'ME' | 'MS' - | 'MA' + | 'MT' + | 'MU' + | 'MV' + | 'MW' + | 'MX' + | 'MY' | 'MZ' - | 'MM' | 'NA' - | 'NR' - | 'NP' - | 'NL' | 'NC' - | 'NZ' - | 'NI' | 'NE' - | 'NG' - | 'NU' | 'NF' - | 'MK' - | 'MP' + | 'NG' + | 'NI' + | 'NL' | 'NO' + | 'NP' + | 'NR' + | 'NU' + | 'NZ' | 'OM' - | 'PK' - | 'PW' - | 'PS' | 'PA' - | 'PG' - | 'PY' | 'PE' + | 'PF' + | 'PG' | 'PH' - | 'PN' + | 'PK' | 'PL' - | 'PT' + | 'PM' + | 'PN' | 'PR' + | 'PS' + | 'PT' + | 'PW' + | 'PY' | 'QA' | 'RE' | 'RO' + | 'RS' | 'RU' | 'RW' - | 'BL' - | 'SH' - | 'KN' - | 'LC' - | 'MF' - | 'PM' - | 'VC' - | 'WS' - | 'SM' - | 'ST' | 'SA' - | 'SN' - | 'RS' + | 'SB' | 'SC' - | 'SL' + | 'SD' + | 'SE' | 'SG' - | 'SX' - | 'SK' + | 'SH' | 'SI' - | 'SB' + | 'SJ' + | 'SK' + | 'SL' + | 'SM' + | 'SN' | 'SO' - | 'ZA' - | 'GS' - | 'SS' - | 'ES' - | 'LK' - | 'SD' | 'SR' - | 'SJ' - | 'SE' - | 'CH' + | 'SS' + | 'ST' + | 'SV' + | 'SX' | 'SY' - | 'TW' - | 'TJ' - | 'TZ' - | 'TH' - | 'TL' + | 'SZ' + | 'TC' + | 'TD' + | 'TF' | 'TG' + | 'TH' + | 'TJ' | 'TK' - | 'TO' - | 'TT' + | 'TL' + | 'TM' | 'TN' + | 'TO' | 'TR' - | 'TM' - | 'TC' + | 'TT' | 'TV' - | 'UG' + | 'TW' + | 'TZ' | 'UA' - | 'AE' - | 'GB' + | 'UG' + | 'US' | 'UY' | 'UZ' - | 'VU' + | 'VA' + | 'VC' | 'VE' - | 'VN' | 'VG' | 'VI' + | 'VN' + | 'VU' | 'WF' - | 'EH' + | 'WS' + | 'XK' | 'YE' + | 'YT' + | 'ZA' | 'ZM' - | 'ZW' - | 'XK', + | 'ZW', serverName: 'destination_country', }, destinationState: { type: 'string', optional: true, customType: null as unknown as - | 'CA' + | 'AK' | 'AL' | 'AR' | 'AZ' - | 'KY' + | 'CA' | 'CO' - | 'GA' - | 'DE' - | 'VA' - | 'IN' - | 'ID' - | 'IL' - | 'LA' - | 'MO' - | 'MT' - | 'MD' - | 'MN' - | 'ME' - | 'MS' - | 'MA' - | 'NC' - | 'NE' - | 'PA' - | 'SC' - | 'SD' - | 'TN' - | 'AK' | 'CT' | 'DC' + | 'DE' | 'FL' + | 'GA' | 'HI' | 'IA' + | 'ID' + | 'IL' + | 'IN' | 'KS' + | 'KY' + | 'LA' + | 'MA' + | 'MD' + | 'ME' | 'MI' - | 'NV' + | 'MN' + | 'MO' + | 'MS' + | 'MT' + | 'NC' + | 'ND' + | 'NE' | 'NH' | 'NJ' | 'NM' + | 'NV' | 'NY' - | 'ND' | 'OH' | 'OK' | 'OR' + | 'PA' | 'RI' + | 'SC' + | 'SD' + | 'TN' | 'TX' | 'UT' + | 'VA' | 'VT' | 'WA' - | 'WV' | 'WI' + | 'WV' | 'WY' | null, serverName: 'destination_state', }, + id: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + orderId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'order_id', + }, + shippedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + serverName: 'shipped_at', + }, + trackingNumber: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'tracking_number', + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], } as const; @@ -6072,22 +6072,11 @@ const shipmentItemTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - shipmentId: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'shipment_id', - }, orderItemId: { type: 'string', optional: false, @@ -6099,6 +6088,17 @@ const shipmentItemTable = { optional: false, customType: null as unknown as number, }, + shipmentId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'shipment_id', + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], serverName: 'shipment_item', @@ -6106,52 +6106,52 @@ const shipmentItemTable = { const supportTicketTable = { name: 'supportTicket', columns: { + assignedTeamId: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'assigned_team_id', + }, createdAt: { type: 'number', optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + customerId: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, + serverName: 'customer_id', }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - customerId: { + priority: { type: 'string', optional: true, customType: null as unknown as string, - serverName: 'customer_id', }, - assignedTeamId: { + source: { type: 'string', optional: true, customType: null as unknown as string, - serverName: 'assigned_team_id', - }, - subject: { - type: 'string', - optional: false, - customType: null as unknown as string, }, status: { type: 'string', optional: false, customType: null as unknown as string, }, - priority: { + subject: { type: 'string', - optional: true, + optional: false, customType: null as unknown as string, }, - source: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -6160,12 +6160,25 @@ const supportTicketTable = { const supportTicketAssignmentTable = { name: 'supportTicketAssignment', columns: { - createdAt: { + assignedAt: { type: 'number', optional: true, customType: null as unknown as number, + serverName: 'assigned_at', }, - updatedAt: { + assigneeId: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'assignee_id', + }, + assignmentType: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'assignment_type', + }, + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -6181,23 +6194,10 @@ const supportTicketAssignmentTable = { customType: null as unknown as string, serverName: 'ticket_id', }, - assigneeId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'assignee_id', - }, - assignedAt: { + updatedAt: { type: 'number', optional: true, customType: null as unknown as number, - serverName: 'assigned_at', - }, - assignmentType: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'assignment_type', }, }, primaryKey: ['id'], @@ -6206,15 +6206,26 @@ const supportTicketAssignmentTable = { const supportTicketAuditTable = { name: 'supportTicketAudit', columns: { + action: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + actorId: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'actor_id', + }, createdAt: { type: 'number', optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + details: { + type: 'json', optional: true, - customType: null as unknown as number, + customType: null as unknown as ReadonlyJSONValue, }, id: { type: 'string', @@ -6227,21 +6238,10 @@ const supportTicketAuditTable = { customType: null as unknown as string, serverName: 'ticket_id', }, - actorId: { - type: 'string', - optional: true, - customType: null as unknown as string, - serverName: 'actor_id', - }, - action: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - details: { - type: 'json', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as ReadonlyJSONValue, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -6250,12 +6250,18 @@ const supportTicketAuditTable = { const supportTicketMessageTable = { name: 'supportTicketMessage', columns: { - createdAt: { - type: 'number', + authorId: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, + serverName: 'author_id', }, - updatedAt: { + body: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + createdAt: { type: 'number', optional: true, customType: null as unknown as number, @@ -6271,16 +6277,10 @@ const supportTicketMessageTable = { customType: null as unknown as string, serverName: 'ticket_id', }, - authorId: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, - serverName: 'author_id', - }, - body: { - type: 'string', - optional: false, - customType: null as unknown as string, + customType: null as unknown as number, }, visibility: { type: 'string', @@ -6299,10 +6299,10 @@ const supportTicketTagTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', + description: { + type: 'string', optional: true, - customType: null as unknown as number, + customType: null as unknown as string, }, id: { type: 'string', @@ -6314,10 +6314,10 @@ const supportTicketTagTable = { optional: false, customType: null as unknown as string, }, - description: { - type: 'string', + updatedAt: { + type: 'number', optional: true, - customType: null as unknown as string, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -6331,27 +6331,27 @@ const supportTicketTagLinkTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - ticketId: { + tagId: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'ticket_id', + serverName: 'tag_id', }, - tagId: { + ticketId: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'tag_id', + serverName: 'ticket_id', + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -6365,21 +6365,16 @@ const teamTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { + departmentId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'department_id', }, - departmentId: { + id: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'department_id', }, leadId: { type: 'string', @@ -6392,6 +6387,11 @@ const teamTable = { optional: false, customType: null as unknown as string, }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, + }, }, primaryKey: ['id'], } as const; @@ -6403,26 +6403,26 @@ const telemetryRollupTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, id: { type: 'string', optional: false, customType: null as unknown as string, }, - projectId: { + metric: { type: 'string', - optional: true, + optional: false, customType: null as unknown as string, - serverName: 'project_id', }, - metric: { + projectId: { type: 'string', - optional: false, + optional: true, customType: null as unknown as string, + serverName: 'project_id', + }, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, windowedStats: { type: 'json', @@ -6476,12 +6476,6 @@ const testCompositePkBothDefaultsTable = { const testCompositePkOneDefaultTable = { name: 'testCompositePkOneDefault', columns: { - tenantId: { - type: 'string', - optional: false, - customType: null as unknown as string, - serverName: 'tenant_id', - }, id: { type: 'number', optional: false, @@ -6492,6 +6486,12 @@ const testCompositePkOneDefaultTable = { optional: false, customType: null as unknown as string, }, + tenantId: { + type: 'string', + optional: false, + customType: null as unknown as string, + serverName: 'tenant_id', + }, }, primaryKey: ['tenantId', 'id'], serverName: 'test_composite_pk_one_default', @@ -6606,9 +6606,15 @@ const timeEntryTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { + entryDate: { type: 'number', - optional: true, + optional: false, + customType: null as unknown as number, + serverName: 'entry_date', + }, + hours: { + type: 'number', + optional: false, customType: null as unknown as number, }, id: { @@ -6616,11 +6622,10 @@ const timeEntryTable = { optional: false, customType: null as unknown as string, }, - timesheetId: { + notes: { type: 'string', - optional: false, + optional: true, customType: null as unknown as string, - serverName: 'timesheet_id', }, taskId: { type: 'string', @@ -6628,21 +6633,16 @@ const timeEntryTable = { customType: null as unknown as string, serverName: 'task_id', }, - hours: { - type: 'number', - optional: false, - customType: null as unknown as number, - }, - notes: { + timesheetId: { type: 'string', - optional: true, + optional: false, customType: null as unknown as string, + serverName: 'timesheet_id', }, - entryDate: { + updatedAt: { type: 'number', - optional: false, + optional: true, customType: null as unknown as number, - serverName: 'entry_date', }, }, primaryKey: ['id'], @@ -6656,33 +6656,33 @@ const timesheetTable = { optional: true, customType: null as unknown as number, }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { + employeeId: { type: 'string', optional: false, customType: null as unknown as string, + serverName: 'employee_id', }, - employeeId: { + id: { type: 'string', optional: false, customType: null as unknown as string, - serverName: 'employee_id', }, - periodStart: { + periodEnd: { type: 'number', optional: false, customType: null as unknown as number, - serverName: 'period_start', + serverName: 'period_end', }, - periodEnd: { + periodStart: { type: 'number', optional: false, customType: null as unknown as number, - serverName: 'period_end', + serverName: 'period_start', + }, + status: { + type: 'string', + optional: false, + customType: null as unknown as string, }, submittedById: { type: 'string', @@ -6690,10 +6690,10 @@ const timesheetTable = { customType: null as unknown as string, serverName: 'submitted_by_id', }, - status: { - type: 'string', - optional: false, - customType: null as unknown as string, + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, }, primaryKey: ['id'], @@ -6701,384 +6701,303 @@ const timesheetTable = { const userTable = { name: 'user', columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - name: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - partner: { - type: 'boolean', - optional: false, - customType: null as unknown as boolean, - }, - email: { - type: 'string', - optional: false, - customType: null as unknown as `${string}@${string}`, - }, - customTypeJson: { - type: 'json', - optional: false, - customType: null as unknown as UserCustomTypeJsonCustomType, - serverName: 'custom_type_json', - }, - customInterfaceJson: { - type: 'json', - optional: false, - customType: null as unknown as UserCustomInterfaceJsonCustomType, - serverName: 'custom_interface_json', - }, - testInterface: { - type: 'json', - optional: false, - customType: null as unknown as UserTestInterfaceCustomType, - serverName: 'test_interface', - }, - testType: { - type: 'json', - optional: false, - customType: null as unknown as UserTestTypeCustomType, - serverName: 'test_type', - }, - testExportedType: { - type: 'json', - optional: false, - customType: null as unknown as UserTestExportedTypeCustomType, - serverName: 'test_exported_type', - }, - notificationPreferences: { - type: 'json', - optional: false, - customType: null as unknown as UserNotificationPreferencesCustomType, - serverName: 'notification_preferences', - }, countryIso: { type: 'string', optional: false, customType: null as unknown as - | 'US' - | 'MX' - | 'CA' + | 'AD' + | 'AE' | 'AF' - | 'AX' + | 'AG' + | 'AI' | 'AL' - | 'DZ' - | 'AS' - | 'AD' + | 'AM' | 'AO' - | 'AI' | 'AQ' - | 'AG' | 'AR' - | 'AM' - | 'AW' - | 'AU' + | 'AS' | 'AT' + | 'AU' + | 'AW' + | 'AX' | 'AZ' - | 'BS' - | 'BH' - | 'BD' + | 'BA' | 'BB' - | 'BY' + | 'BD' | 'BE' - | 'BZ' + | 'BF' + | 'BG' + | 'BH' + | 'BI' | 'BJ' + | 'BL' | 'BM' - | 'BT' + | 'BN' | 'BO' | 'BQ' - | 'BA' - | 'BW' - | 'BV' | 'BR' - | 'IO' - | 'BN' - | 'BG' - | 'BF' - | 'BI' - | 'CV' - | 'KH' - | 'CM' - | 'KY' + | 'BS' + | 'BT' + | 'BV' + | 'BW' + | 'BY' + | 'BZ' + | 'CA' + | 'CC' + | 'CD' | 'CF' - | 'TD' + | 'CG' + | 'CH' + | 'CI' + | 'CK' | 'CL' + | 'CM' | 'CN' - | 'CX' - | 'CC' | 'CO' - | 'KM' - | 'CG' - | 'CD' - | 'CK' | 'CR' - | 'CI' - | 'HR' | 'CU' + | 'CV' | 'CW' + | 'CX' | 'CY' | 'CZ' - | 'DK' + | 'DE' | 'DJ' + | 'DK' | 'DM' | 'DO' + | 'DZ' | 'EC' + | 'EE' | 'EG' - | 'SV' - | 'GQ' + | 'EH' | 'ER' - | 'EE' - | 'SZ' + | 'ES' | 'ET' + | 'FI' + | 'FJ' | 'FK' + | 'FM' | 'FO' - | 'FJ' - | 'FI' | 'FR' - | 'GF' - | 'PF' - | 'TF' | 'GA' - | 'GM' + | 'GB' + | 'GD' | 'GE' - | 'DE' + | 'GF' + | 'GG' | 'GH' | 'GI' - | 'GR' | 'GL' - | 'GD' + | 'GM' + | 'GN' | 'GP' - | 'GU' + | 'GQ' + | 'GR' + | 'GS' | 'GT' - | 'GG' - | 'GN' + | 'GU' | 'GW' | 'GY' - | 'HT' + | 'HK' | 'HM' - | 'VA' | 'HN' - | 'HK' + | 'HR' + | 'HT' | 'HU' - | 'IS' - | 'IN' | 'ID' - | 'IR' - | 'IQ' | 'IE' - | 'IM' | 'IL' + | 'IM' + | 'IN' + | 'IO' + | 'IQ' + | 'IR' + | 'IS' | 'IT' - | 'JM' - | 'JP' | 'JE' + | 'JM' | 'JO' - | 'KZ' + | 'JP' | 'KE' + | 'KG' + | 'KH' | 'KI' + | 'KM' + | 'KN' | 'KP' | 'KR' | 'KW' - | 'KG' + | 'KY' + | 'KZ' | 'LA' - | 'LV' | 'LB' - | 'LS' - | 'LR' - | 'LY' + | 'LC' | 'LI' + | 'LK' + | 'LR' + | 'LS' | 'LT' | 'LU' - | 'MO' + | 'LV' + | 'LY' + | 'MA' + | 'MC' + | 'MD' + | 'ME' + | 'MF' | 'MG' - | 'MW' - | 'MY' - | 'MV' - | 'ML' - | 'MT' | 'MH' + | 'MK' + | 'ML' + | 'MM' + | 'MN' + | 'MO' + | 'MP' | 'MQ' | 'MR' - | 'MU' - | 'YT' - | 'FM' - | 'MD' - | 'MC' - | 'MN' - | 'ME' | 'MS' - | 'MA' + | 'MT' + | 'MU' + | 'MV' + | 'MW' + | 'MX' + | 'MY' | 'MZ' - | 'MM' | 'NA' - | 'NR' - | 'NP' - | 'NL' | 'NC' - | 'NZ' - | 'NI' | 'NE' - | 'NG' - | 'NU' | 'NF' - | 'MK' - | 'MP' + | 'NG' + | 'NI' + | 'NL' | 'NO' + | 'NP' + | 'NR' + | 'NU' + | 'NZ' | 'OM' - | 'PK' - | 'PW' - | 'PS' | 'PA' - | 'PG' - | 'PY' | 'PE' + | 'PF' + | 'PG' | 'PH' - | 'PN' + | 'PK' | 'PL' - | 'PT' + | 'PM' + | 'PN' | 'PR' + | 'PS' + | 'PT' + | 'PW' + | 'PY' | 'QA' | 'RE' | 'RO' + | 'RS' | 'RU' | 'RW' - | 'BL' - | 'SH' - | 'KN' - | 'LC' - | 'MF' - | 'PM' - | 'VC' - | 'WS' - | 'SM' - | 'ST' | 'SA' - | 'SN' - | 'RS' + | 'SB' | 'SC' - | 'SL' + | 'SD' + | 'SE' | 'SG' - | 'SX' - | 'SK' + | 'SH' | 'SI' - | 'SB' + | 'SJ' + | 'SK' + | 'SL' + | 'SM' + | 'SN' | 'SO' - | 'ZA' - | 'GS' - | 'SS' - | 'ES' - | 'LK' - | 'SD' | 'SR' - | 'SJ' - | 'SE' - | 'CH' + | 'SS' + | 'ST' + | 'SV' + | 'SX' | 'SY' - | 'TW' - | 'TJ' - | 'TZ' - | 'TH' - | 'TL' + | 'SZ' + | 'TC' + | 'TD' + | 'TF' | 'TG' + | 'TH' + | 'TJ' | 'TK' - | 'TO' - | 'TT' + | 'TL' + | 'TM' | 'TN' + | 'TO' | 'TR' - | 'TM' - | 'TC' + | 'TT' | 'TV' - | 'UG' + | 'TW' + | 'TZ' | 'UA' - | 'AE' - | 'GB' + | 'UG' + | 'US' | 'UY' | 'UZ' - | 'VU' + | 'VA' + | 'VC' | 'VE' - | 'VN' | 'VG' | 'VI' + | 'VN' + | 'VU' | 'WF' - | 'EH' + | 'WS' + | 'XK' | 'YE' + | 'YT' + | 'ZA' | 'ZM' - | 'ZW' - | 'XK', + | 'ZW', serverName: 'country_iso', }, - regionCode: { - type: 'string', + createdAt: { + type: 'number', optional: true, - customType: null as unknown as - | 'CA' - | 'AL' - | 'AR' - | 'AZ' - | 'KY' - | 'CO' - | 'GA' - | 'DE' - | 'VA' - | 'IN' - | 'ID' - | 'IL' - | 'LA' - | 'MO' - | 'MT' - | 'MD' - | 'MN' - | 'ME' - | 'MS' - | 'MA' - | 'NC' - | 'NE' - | 'PA' - | 'SC' - | 'SD' - | 'TN' - | 'AK' - | 'CT' - | 'DC' - | 'FL' - | 'HI' - | 'IA' - | 'KS' - | 'MI' - | 'NV' - | 'NH' - | 'NJ' - | 'NM' - | 'NY' - | 'ND' - | 'OH' - | 'OK' - | 'OR' - | 'RI' - | 'TX' - | 'UT' - | 'VT' - | 'WA' - | 'WV' - | 'WI' - | 'WY' - | null, - serverName: 'region_code', + customType: null as unknown as number, + }, + customInterfaceJson: { + type: 'json', + optional: false, + customType: null as unknown as UserCustomInterfaceJsonCustomType, + serverName: 'custom_interface_json', + }, + customTypeJson: { + type: 'json', + optional: false, + customType: null as unknown as UserCustomTypeJsonCustomType, + serverName: 'custom_type_json', + }, + email: { + type: 'string', + optional: false, + customType: null as unknown as `${string}@${string}`, + }, + id: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + name: { + type: 'string', + optional: false, + customType: null as unknown as string, + }, + notificationPreferences: { + type: 'json', + optional: false, + customType: null as unknown as UserNotificationPreferencesCustomType, + serverName: 'notification_preferences', + }, + partner: { + type: 'boolean', + optional: false, + customType: null as unknown as boolean, }, preferredCurrency: { type: 'string', @@ -7255,337 +7174,170 @@ const userTable = { | 'ZWG', serverName: 'preferred_currency', }, - status: { - type: 'string', - optional: true, - customType: null as unknown as 'ASSIGNED' | 'COMPLETED', - }, - }, - primaryKey: ['id'], -} as const; -const webhookSubscriptionTable = { - name: 'webhookSubscription', - columns: { - createdAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - updatedAt: { - type: 'number', - optional: true, - customType: null as unknown as number, - }, - id: { - type: 'string', - optional: false, - customType: null as unknown as string, - }, - projectId: { + regionCode: { type: 'string', optional: true, - customType: null as unknown as string, - serverName: 'project_id', - }, - config: { - type: 'json', - optional: false, - customType: null as unknown as WebhookSubscriptionConfigCustomType, - }, - }, - primaryKey: ['id'], - serverName: 'webhook_subscription', -} as const; -const analyticsDashboardRelationships = { - owner: [ - { - sourceField: ['ownerId'], - destField: ['id'], - destSchema: 'user', - cardinality: 'one', - }, - ], - widgets: [ - { - sourceField: ['id'], - destField: ['dashboardId'], - destSchema: 'analyticsWidget', - cardinality: 'many', - }, - ], -} as const; -const analyticsWidgetRelationships = { - dashboard: [ - { - sourceField: ['dashboardId'], - destField: ['id'], - destSchema: 'analyticsDashboard', - cardinality: 'one', - }, - ], - queries: [ - { - sourceField: ['id'], - destField: ['widgetId'], - destSchema: 'analyticsWidgetQuery', - cardinality: 'many', - }, - ], -} as const; -const analyticsWidgetQueryRelationships = { - widget: [ - { - sourceField: ['widgetId'], - destField: ['id'], - destSchema: 'analyticsWidget', - cardinality: 'one', - }, - ], -} as const; -const productCategoryRelationships = { - parent: [ - { - sourceField: ['parentId'], - destField: ['id'], - destSchema: 'productCategory', - cardinality: 'one', - }, - ], - children: [ - { - sourceField: ['id'], - destField: ['parentId'], - destSchema: 'productCategory', - cardinality: 'many', - }, - ], - products: [ - { - sourceField: ['id'], - destField: ['categoryId'], - destSchema: 'product', - cardinality: 'many', - }, - ], -} as const; -const productRelationships = { - category: [ - { - sourceField: ['categoryId'], - destField: ['id'], - destSchema: 'productCategory', - cardinality: 'one', - }, - ], - variants: [ - { - sourceField: ['id'], - destField: ['productId'], - destSchema: 'productVariant', - cardinality: 'many', - }, - ], - media: [ - { - sourceField: ['id'], - destField: ['productId'], - destSchema: 'productMedia', - cardinality: 'many', - }, - ], -} as const; -const productVariantRelationships = { - product: [ - { - sourceField: ['productId'], - destField: ['id'], - destSchema: 'product', - cardinality: 'one', - }, - ], - inventoryItems: [ - { - sourceField: ['id'], - destField: ['variantId'], - destSchema: 'inventoryItem', - cardinality: 'many', - }, - ], - inventoryLevels: [ - { - sourceField: ['id'], - destField: ['variantId'], - destSchema: 'inventoryLevel', - cardinality: 'many', - }, - ], - orderItems: [ - { - sourceField: ['id'], - destField: ['variantId'], - destSchema: 'orderItem', - cardinality: 'many', - }, - ], -} as const; -const productMediaRelationships = { - product: [ - { - sourceField: ['productId'], - destField: ['id'], - destSchema: 'product', - cardinality: 'one', - }, - ], -} as const; -const inventoryLocationRelationships = { - levels: [ - { - sourceField: ['id'], - destField: ['locationId'], - destSchema: 'inventoryLevel', - cardinality: 'many', + customType: null as unknown as + | 'AK' + | 'AL' + | 'AR' + | 'AZ' + | 'CA' + | 'CO' + | 'CT' + | 'DC' + | 'DE' + | 'FL' + | 'GA' + | 'HI' + | 'IA' + | 'ID' + | 'IL' + | 'IN' + | 'KS' + | 'KY' + | 'LA' + | 'MA' + | 'MD' + | 'ME' + | 'MI' + | 'MN' + | 'MO' + | 'MS' + | 'MT' + | 'NC' + | 'ND' + | 'NE' + | 'NH' + | 'NJ' + | 'NM' + | 'NV' + | 'NY' + | 'OH' + | 'OK' + | 'OR' + | 'PA' + | 'RI' + | 'SC' + | 'SD' + | 'TN' + | 'TX' + | 'UT' + | 'VA' + | 'VT' + | 'WA' + | 'WI' + | 'WV' + | 'WY' + | null, + serverName: 'region_code', }, - ], -} as const; -const inventoryItemRelationships = { - variant: [ - { - sourceField: ['variantId'], - destField: ['id'], - destSchema: 'productVariant', - cardinality: 'one', + status: { + type: 'string', + optional: true, + customType: null as unknown as 'ASSIGNED' | 'COMPLETED', }, - ], -} as const; -const inventoryLevelRelationships = { - location: [ - { - sourceField: ['locationId'], - destField: ['id'], - destSchema: 'inventoryLocation', - cardinality: 'one', + testExportedType: { + type: 'json', + optional: false, + customType: null as unknown as UserTestExportedTypeCustomType, + serverName: 'test_exported_type', }, - ], - variant: [ - { - sourceField: ['variantId'], - destField: ['id'], - destSchema: 'productVariant', - cardinality: 'one', + testInterface: { + type: 'json', + optional: false, + customType: null as unknown as UserTestInterfaceCustomType, + serverName: 'test_interface', }, - ], -} as const; -const orderTableRelationships = { - customer: [ - { - sourceField: ['customerId'], - destField: ['id'], - destSchema: 'user', - cardinality: 'one', + testType: { + type: 'json', + optional: false, + customType: null as unknown as UserTestTypeCustomType, + serverName: 'test_type', }, - ], - opportunity: [ - { - sourceField: ['opportunityId'], - destField: ['id'], - destSchema: 'crmOpportunity', - cardinality: 'one', + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, - ], - items: [ - { - sourceField: ['id'], - destField: ['orderId'], - destSchema: 'orderItem', - cardinality: 'many', + }, + primaryKey: ['id'], +} as const; +const webhookSubscriptionTable = { + name: 'webhookSubscription', + columns: { + config: { + type: 'json', + optional: false, + customType: null as unknown as WebhookSubscriptionConfigCustomType, }, - ], - payments: [ - { - sourceField: ['id'], - destField: ['orderId'], - destSchema: 'orderPayment', - cardinality: 'many', + createdAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, - ], - shipments: [ - { - sourceField: ['id'], - destField: ['orderId'], - destSchema: 'shipment', - cardinality: 'many', + id: { + type: 'string', + optional: false, + customType: null as unknown as string, }, - ], -} as const; -const orderItemRelationships = { - order: [ - { - sourceField: ['orderId'], - destField: ['id'], - destSchema: 'orderTable', - cardinality: 'one', + projectId: { + type: 'string', + optional: true, + customType: null as unknown as string, + serverName: 'project_id', }, - ], - variant: [ - { - sourceField: ['variantId'], - destField: ['id'], - destSchema: 'productVariant', - cardinality: 'one', + updatedAt: { + type: 'number', + optional: true, + customType: null as unknown as number, }, - ], + }, + primaryKey: ['id'], + serverName: 'webhook_subscription', } as const; -const orderPaymentRelationships = { - order: [ +const analyticsDashboardRelationships = { + owner: [ { - sourceField: ['orderId'], + sourceField: ['ownerId'], destField: ['id'], - destSchema: 'orderTable', + destSchema: 'user', cardinality: 'one', }, ], - payment: [ + widgets: [ { - sourceField: ['paymentId'], - destField: ['id'], - destSchema: 'payment', - cardinality: 'one', + sourceField: ['id'], + destField: ['dashboardId'], + destSchema: 'analyticsWidget', + cardinality: 'many', }, ], } as const; -const shipmentRelationships = { - order: [ +const analyticsWidgetRelationships = { + dashboard: [ { - sourceField: ['orderId'], + sourceField: ['dashboardId'], destField: ['id'], - destSchema: 'orderTable', + destSchema: 'analyticsDashboard', cardinality: 'one', }, ], - items: [ + queries: [ { sourceField: ['id'], - destField: ['shipmentId'], - destSchema: 'shipmentItem', + destField: ['widgetId'], + destSchema: 'analyticsWidgetQuery', cardinality: 'many', }, ], } as const; -const shipmentItemRelationships = { - shipment: [ - { - sourceField: ['shipmentId'], - destField: ['id'], - destSchema: 'shipment', - cardinality: 'one', - }, - ], - orderItem: [ +const analyticsWidgetQueryRelationships = { + widget: [ { - sourceField: ['orderItemId'], + sourceField: ['widgetId'], destField: ['id'], - destSchema: 'orderItem', + destSchema: 'analyticsWidget', cardinality: 'one', }, ], @@ -7697,30 +7449,30 @@ const budgetRelationships = { ], } as const; const budgetLineRelationships = { - budget: [ + account: [ { - sourceField: ['budgetId'], + sourceField: ['accountId'], destField: ['id'], - destSchema: 'budget', + destSchema: 'ledgerAccount', cardinality: 'one', }, ], - account: [ + budget: [ { - sourceField: ['accountId'], + sourceField: ['budgetId'], destField: ['id'], - destSchema: 'ledgerAccount', + destSchema: 'budget', cardinality: 'one', }, ], } as const; const crmAccountRelationships = { - owner: [ + activities: [ { - sourceField: ['ownerId'], - destField: ['id'], - destSchema: 'user', - cardinality: 'one', + sourceField: ['id'], + destField: ['accountId'], + destSchema: 'crmActivity', + cardinality: 'many', }, ], contacts: [ @@ -7731,28 +7483,28 @@ const crmAccountRelationships = { cardinality: 'many', }, ], - opportunities: [ + notes: [ { sourceField: ['id'], destField: ['accountId'], - destSchema: 'crmOpportunity', + destSchema: 'crmNote', cardinality: 'many', }, ], - activities: [ + opportunities: [ { sourceField: ['id'], destField: ['accountId'], - destSchema: 'crmActivity', + destSchema: 'crmOpportunity', cardinality: 'many', }, ], - notes: [ + owner: [ { - sourceField: ['id'], - destField: ['accountId'], - destSchema: 'crmNote', - cardinality: 'many', + sourceField: ['ownerId'], + destField: ['id'], + destSchema: 'user', + cardinality: 'one', }, ], } as const; @@ -7781,19 +7533,19 @@ const crmActivityRelationships = { cardinality: 'one', }, ], - type: [ + performer: [ { - sourceField: ['typeId'], + sourceField: ['performedById'], destField: ['id'], - destSchema: 'crmActivityType', + destSchema: 'user', cardinality: 'one', }, ], - performer: [ + type: [ { - sourceField: ['performedById'], + sourceField: ['typeId'], destField: ['id'], - destSchema: 'user', + destSchema: 'crmActivityType', cardinality: 'one', }, ], @@ -7843,14 +7595,6 @@ const crmNoteRelationships = { cardinality: 'one', }, ], - contact: [ - { - sourceField: ['contactId'], - destField: ['id'], - destSchema: 'crmContact', - cardinality: 'one', - }, - ], author: [ { sourceField: ['authorId'], @@ -7859,21 +7603,21 @@ const crmNoteRelationships = { cardinality: 'one', }, ], -} as const; -const crmOpportunityRelationships = { - account: [ + contact: [ { - sourceField: ['accountId'], + sourceField: ['contactId'], destField: ['id'], - destSchema: 'crmAccount', + destSchema: 'crmContact', cardinality: 'one', }, ], - stage: [ +} as const; +const crmOpportunityRelationships = { + account: [ { - sourceField: ['stageId'], + sourceField: ['accountId'], destField: ['id'], - destSchema: 'crmPipelineStage', + destSchema: 'crmAccount', cardinality: 'one', }, ], @@ -7893,8 +7637,24 @@ const crmOpportunityRelationships = { cardinality: 'many', }, ], + stage: [ + { + sourceField: ['stageId'], + destField: ['id'], + destSchema: 'crmPipelineStage', + cardinality: 'one', + }, + ], } as const; const crmOpportunityStageHistoryRelationships = { + changedBy: [ + { + sourceField: ['changedById'], + destField: ['id'], + destSchema: 'user', + cardinality: 'one', + }, + ], opportunity: [ { sourceField: ['opportunityId'], @@ -7911,34 +7671,34 @@ const crmOpportunityStageHistoryRelationships = { cardinality: 'one', }, ], - changedBy: [ - { - sourceField: ['changedById'], - destField: ['id'], - destSchema: 'user', - cardinality: 'one', - }, - ], } as const; const crmPipelineStageRelationships = { - opportunities: [ + historyEntries: [ { sourceField: ['id'], destField: ['stageId'], - destSchema: 'crmOpportunity', + destSchema: 'crmOpportunityStageHistory', cardinality: 'many', }, ], - historyEntries: [ + opportunities: [ { sourceField: ['id'], destField: ['stageId'], - destSchema: 'crmOpportunityStageHistory', + destSchema: 'crmOpportunity', cardinality: 'many', }, ], } as const; const departmentRelationships = { + employees: [ + { + sourceField: ['id'], + destField: ['departmentId'], + destSchema: 'employeeProfile', + cardinality: 'many', + }, + ], manager: [ { sourceField: ['managerId'], @@ -7955,14 +7715,6 @@ const departmentRelationships = { cardinality: 'many', }, ], - employees: [ - { - sourceField: ['id'], - destField: ['departmentId'], - destSchema: 'employeeProfile', - cardinality: 'many', - }, - ], } as const; const documentFileRelationships = { folder: [ @@ -7973,6 +7725,14 @@ const documentFileRelationships = { cardinality: 'one', }, ], + sharings: [ + { + sourceField: ['id'], + destField: ['fileId'], + destSchema: 'documentSharing', + cardinality: 'many', + }, + ], uploader: [ { sourceField: ['uploadedById'], @@ -7989,14 +7749,6 @@ const documentFileRelationships = { cardinality: 'many', }, ], - sharings: [ - { - sourceField: ['id'], - destField: ['fileId'], - destSchema: 'documentSharing', - cardinality: 'many', - }, - ], } as const; const documentFileVersionRelationships = { file: [ @@ -8017,6 +7769,22 @@ const documentFileVersionRelationships = { ], } as const; const documentFolderRelationships = { + children: [ + { + sourceField: ['id'], + destField: ['parentId'], + destSchema: 'documentFolder', + cardinality: 'many', + }, + ], + files: [ + { + sourceField: ['id'], + destField: ['folderId'], + destSchema: 'documentFile', + cardinality: 'many', + }, + ], library: [ { sourceField: ['libraryId'], @@ -8033,24 +7801,16 @@ const documentFolderRelationships = { cardinality: 'one', }, ], - children: [ +} as const; +const documentLibraryRelationships = { + folders: [ { sourceField: ['id'], - destField: ['parentId'], + destField: ['libraryId'], destSchema: 'documentFolder', cardinality: 'many', }, ], - files: [ - { - sourceField: ['id'], - destField: ['folderId'], - destSchema: 'documentFile', - cardinality: 'many', - }, - ], -} as const; -const documentLibraryRelationships = { project: [ { sourceField: ['projectId'], @@ -8059,14 +7819,6 @@ const documentLibraryRelationships = { cardinality: 'one', }, ], - folders: [ - { - sourceField: ['id'], - destField: ['libraryId'], - destSchema: 'documentFolder', - cardinality: 'many', - }, - ], } as const; const documentSharingRelationships = { file: [ @@ -8077,19 +7829,19 @@ const documentSharingRelationships = { cardinality: 'one', }, ], - user: [ + team: [ { - sourceField: ['sharedWithUserId'], + sourceField: ['sharedWithTeamId'], destField: ['id'], - destSchema: 'user', + destSchema: 'team', cardinality: 'one', }, ], - team: [ + user: [ { - sourceField: ['sharedWithTeamId'], + sourceField: ['sharedWithUserId'], destField: ['id'], - destSchema: 'team', + destSchema: 'user', cardinality: 'one', }, ], @@ -8113,12 +7865,12 @@ const employeeDocumentRelationships = { ], } as const; const employeeProfileRelationships = { - user: [ + benefitEnrollments: [ { - sourceField: ['userId'], - destField: ['id'], - destSchema: 'user', - cardinality: 'one', + sourceField: ['id'], + destField: ['employeeId'], + destSchema: 'benefitEnrollment', + cardinality: 'many', }, ], department: [ @@ -8129,12 +7881,12 @@ const employeeProfileRelationships = { cardinality: 'one', }, ], - team: [ + documents: [ { - sourceField: ['teamId'], - destField: ['id'], - destSchema: 'team', - cardinality: 'one', + sourceField: ['id'], + destField: ['employeeId'], + destSchema: 'employeeDocument', + cardinality: 'many', }, ], employmentHistory: [ @@ -8145,12 +7897,12 @@ const employeeProfileRelationships = { cardinality: 'many', }, ], - documents: [ + team: [ { - sourceField: ['id'], - destField: ['employeeId'], - destSchema: 'employeeDocument', - cardinality: 'many', + sourceField: ['teamId'], + destField: ['id'], + destSchema: 'team', + cardinality: 'one', }, ], timesheets: [ @@ -8161,12 +7913,12 @@ const employeeProfileRelationships = { cardinality: 'many', }, ], - benefitEnrollments: [ + user: [ { - sourceField: ['id'], - destField: ['employeeId'], - destSchema: 'benefitEnrollment', - cardinality: 'many', + sourceField: ['userId'], + destField: ['id'], + destSchema: 'user', + cardinality: 'one', }, ], } as const; @@ -8191,14 +7943,6 @@ const expenseItemRelationships = { ], } as const; const expenseReportRelationships = { - owner: [ - { - sourceField: ['ownerId'], - destField: ['id'], - destSchema: 'user', - cardinality: 'one', - }, - ], department: [ { sourceField: ['departmentId'], @@ -8215,8 +7959,6 @@ const expenseReportRelationships = { cardinality: 'many', }, ], -} as const; -const featureFlagRelationships = { owner: [ { sourceField: ['ownerId'], @@ -8226,15 +7968,17 @@ const featureFlagRelationships = { }, ], } as const; -const filtersRelationships = { - parent: [ +const featureFlagRelationships = { + owner: [ { - sourceField: ['parentId'], + sourceField: ['ownerId'], destField: ['id'], - destSchema: 'filters', + destSchema: 'user', cardinality: 'one', }, ], +} as const; +const filtersRelationships = { children: [ { sourceField: ['id'], @@ -8243,6 +7987,14 @@ const filtersRelationships = { cardinality: 'many', }, ], + parent: [ + { + sourceField: ['parentId'], + destField: ['id'], + destSchema: 'filters', + cardinality: 'one', + }, + ], } as const; const integrationCredentialRelationships = { webhook: [ @@ -8265,14 +8017,6 @@ const integrationEventRelationships = { ], } as const; const integrationWebhookRelationships = { - project: [ - { - sourceField: ['projectId'], - destField: ['id'], - destSchema: 'project', - cardinality: 'one', - }, - ], account: [ { sourceField: ['accountId'], @@ -8289,50 +8033,88 @@ const integrationWebhookRelationships = { cardinality: 'many', }, ], + project: [ + { + sourceField: ['projectId'], + destField: ['id'], + destSchema: 'project', + cardinality: 'one', + }, + ], } as const; -const ledgerAccountRelationships = { - parent: [ +const inventoryItemRelationships = { + variant: [ { - sourceField: ['parentAccountId'], + sourceField: ['variantId'], destField: ['id'], - destSchema: 'ledgerAccount', + destSchema: 'productVariant', cardinality: 'one', }, ], - children: [ +} as const; +const inventoryLevelRelationships = { + location: [ + { + sourceField: ['locationId'], + destField: ['id'], + destSchema: 'inventoryLocation', + cardinality: 'one', + }, + ], + variant: [ + { + sourceField: ['variantId'], + destField: ['id'], + destSchema: 'productVariant', + cardinality: 'one', + }, + ], +} as const; +const inventoryLocationRelationships = { + levels: [ { sourceField: ['id'], - destField: ['parentAccountId'], - destSchema: 'ledgerAccount', + destField: ['locationId'], + destSchema: 'inventoryLevel', cardinality: 'many', }, ], - entries: [ +} as const; +const ledgerAccountRelationships = { + budgetLines: [ { sourceField: ['id'], destField: ['accountId'], - destSchema: 'ledgerEntry', + destSchema: 'budgetLine', cardinality: 'many', }, ], - budgetLines: [ + children: [ + { + sourceField: ['id'], + destField: ['parentAccountId'], + destSchema: 'ledgerAccount', + cardinality: 'many', + }, + ], + entries: [ { sourceField: ['id'], destField: ['accountId'], - destSchema: 'budgetLine', + destSchema: 'ledgerEntry', cardinality: 'many', }, ], -} as const; -const ledgerEntryRelationships = { - transaction: [ + parent: [ { - sourceField: ['transactionId'], + sourceField: ['parentAccountId'], destField: ['id'], - destSchema: 'ledgerTransaction', + destSchema: 'ledgerAccount', cardinality: 'one', }, ], +} as const; +const ledgerEntryRelationships = { account: [ { sourceField: ['accountId'], @@ -8341,6 +8123,14 @@ const ledgerEntryRelationships = { cardinality: 'one', }, ], + transaction: [ + { + sourceField: ['transactionId'], + destField: ['id'], + destSchema: 'ledgerTransaction', + cardinality: 'one', + }, + ], } as const; const ledgerTransactionRelationships = { creator: [ @@ -8371,12 +8161,12 @@ const marketingAudienceRelationships = { ], } as const; const marketingCampaignRelationships = { - owner: [ + audiences: [ { - sourceField: ['ownerId'], - destField: ['id'], - destSchema: 'user', - cardinality: 'one', + sourceField: ['id'], + destField: ['campaignId'], + destSchema: 'marketingCampaignAudience', + cardinality: 'many', }, ], channels: [ @@ -8387,29 +8177,29 @@ const marketingCampaignRelationships = { cardinality: 'many', }, ], - audiences: [ + owner: [ { - sourceField: ['id'], - destField: ['campaignId'], - destSchema: 'marketingCampaignAudience', - cardinality: 'many', + sourceField: ['ownerId'], + destField: ['id'], + destSchema: 'user', + cardinality: 'one', }, ], } as const; const marketingCampaignAudienceRelationships = { - campaign: [ + audience: [ { - sourceField: ['campaignId'], + sourceField: ['audienceId'], destField: ['id'], - destSchema: 'marketingCampaign', + destSchema: 'marketingAudience', cardinality: 'one', }, ], - audience: [ + campaign: [ { - sourceField: ['audienceId'], + sourceField: ['campaignId'], destField: ['id'], - destSchema: 'marketingAudience', + destSchema: 'marketingCampaign', cardinality: 'one', }, ], @@ -8484,28 +8274,186 @@ const messageRelationships = { }, ], } as const; -const projectRelationships = { - owner: [ +const orderItemRelationships = { + order: [ { - sourceField: ['ownerId'], + sourceField: ['orderId'], + destField: ['id'], + destSchema: 'orderTable', + cardinality: 'one', + }, + ], + variant: [ + { + sourceField: ['variantId'], + destField: ['id'], + destSchema: 'productVariant', + cardinality: 'one', + }, + ], +} as const; +const orderPaymentRelationships = { + order: [ + { + sourceField: ['orderId'], + destField: ['id'], + destSchema: 'orderTable', + cardinality: 'one', + }, + ], + payment: [ + { + sourceField: ['paymentId'], + destField: ['id'], + destSchema: 'payment', + cardinality: 'one', + }, + ], +} as const; +const orderTableRelationships = { + customer: [ + { + sourceField: ['customerId'], destField: ['id'], destSchema: 'user', cardinality: 'one', }, ], - phases: [ + items: [ { sourceField: ['id'], - destField: ['projectId'], - destSchema: 'projectPhase', + destField: ['orderId'], + destSchema: 'orderItem', cardinality: 'many', }, ], - tasks: [ + opportunity: [ + { + sourceField: ['opportunityId'], + destField: ['id'], + destSchema: 'crmOpportunity', + cardinality: 'one', + }, + ], + payments: [ + { + sourceField: ['id'], + destField: ['orderId'], + destSchema: 'orderPayment', + cardinality: 'many', + }, + ], + shipments: [ + { + sourceField: ['id'], + destField: ['orderId'], + destSchema: 'shipment', + cardinality: 'many', + }, + ], +} as const; +const productRelationships = { + category: [ + { + sourceField: ['categoryId'], + destField: ['id'], + destSchema: 'productCategory', + cardinality: 'one', + }, + ], + media: [ + { + sourceField: ['id'], + destField: ['productId'], + destSchema: 'productMedia', + cardinality: 'many', + }, + ], + variants: [ + { + sourceField: ['id'], + destField: ['productId'], + destSchema: 'productVariant', + cardinality: 'many', + }, + ], +} as const; +const productCategoryRelationships = { + children: [ + { + sourceField: ['id'], + destField: ['parentId'], + destSchema: 'productCategory', + cardinality: 'many', + }, + ], + parent: [ + { + sourceField: ['parentId'], + destField: ['id'], + destSchema: 'productCategory', + cardinality: 'one', + }, + ], + products: [ + { + sourceField: ['id'], + destField: ['categoryId'], + destSchema: 'product', + cardinality: 'many', + }, + ], +} as const; +const productMediaRelationships = { + product: [ + { + sourceField: ['productId'], + destField: ['id'], + destSchema: 'product', + cardinality: 'one', + }, + ], +} as const; +const productVariantRelationships = { + inventoryItems: [ + { + sourceField: ['id'], + destField: ['variantId'], + destSchema: 'inventoryItem', + cardinality: 'many', + }, + ], + inventoryLevels: [ + { + sourceField: ['id'], + destField: ['variantId'], + destSchema: 'inventoryLevel', + cardinality: 'many', + }, + ], + orderItems: [ + { + sourceField: ['id'], + destField: ['variantId'], + destSchema: 'orderItem', + cardinality: 'many', + }, + ], + product: [ + { + sourceField: ['productId'], + destField: ['id'], + destSchema: 'product', + cardinality: 'one', + }, + ], +} as const; +const projectRelationships = { + audits: [ { sourceField: ['id'], destField: ['projectId'], - destSchema: 'projectTask', + destSchema: 'projectAudit', cardinality: 'many', }, ], @@ -8517,11 +8465,27 @@ const projectRelationships = { cardinality: 'many', }, ], - audits: [ + owner: [ + { + sourceField: ['ownerId'], + destField: ['id'], + destSchema: 'user', + cardinality: 'one', + }, + ], + phases: [ { sourceField: ['id'], destField: ['projectId'], - destSchema: 'projectAudit', + destSchema: 'projectPhase', + cardinality: 'many', + }, + ], + tasks: [ + { + sourceField: ['id'], + destField: ['projectId'], + destSchema: 'projectTask', cardinality: 'many', }, ], @@ -8549,12 +8513,20 @@ const projectAttachmentRelationships = { { sourceField: ['taskId'], destField: ['id'], - destSchema: 'projectTask', + destSchema: 'projectTask', + cardinality: 'one', + }, + ], +} as const; +const projectAuditRelationships = { + actor: [ + { + sourceField: ['actorId'], + destField: ['id'], + destSchema: 'user', cardinality: 'one', }, ], -} as const; -const projectAuditRelationships = { project: [ { sourceField: ['projectId'], @@ -8563,16 +8535,16 @@ const projectAuditRelationships = { cardinality: 'one', }, ], - actor: [ +} as const; +const projectCommentRelationships = { + author: [ { - sourceField: ['actorId'], + sourceField: ['authorId'], destField: ['id'], destSchema: 'user', cardinality: 'one', }, ], -} as const; -const projectCommentRelationships = { task: [ { sourceField: ['taskId'], @@ -8581,6 +8553,8 @@ const projectCommentRelationships = { cardinality: 'one', }, ], +} as const; +const projectNoteRelationships = { author: [ { sourceField: ['authorId'], @@ -8589,8 +8563,6 @@ const projectCommentRelationships = { cardinality: 'one', }, ], -} as const; -const projectNoteRelationships = { project: [ { sourceField: ['projectId'], @@ -8599,14 +8571,6 @@ const projectNoteRelationships = { cardinality: 'one', }, ], - author: [ - { - sourceField: ['authorId'], - destField: ['id'], - destSchema: 'user', - cardinality: 'one', - }, - ], } as const; const projectPhaseRelationships = { project: [ @@ -8637,22 +8601,6 @@ const projectTagRelationships = { ], } as const; const projectTaskRelationships = { - project: [ - { - sourceField: ['projectId'], - destField: ['id'], - destSchema: 'project', - cardinality: 'one', - }, - ], - phase: [ - { - sourceField: ['phaseId'], - destField: ['id'], - destSchema: 'projectPhase', - cardinality: 'one', - }, - ], assignments: [ { sourceField: ['id'], @@ -8661,22 +8609,38 @@ const projectTaskRelationships = { cardinality: 'many', }, ], - comments: [ + attachments: [ { sourceField: ['id'], destField: ['taskId'], - destSchema: 'projectComment', + destSchema: 'projectAttachment', cardinality: 'many', }, ], - attachments: [ + comments: [ { sourceField: ['id'], destField: ['taskId'], - destSchema: 'projectAttachment', + destSchema: 'projectComment', cardinality: 'many', }, ], + phase: [ + { + sourceField: ['phaseId'], + destField: ['id'], + destSchema: 'projectPhase', + cardinality: 'one', + }, + ], + project: [ + { + sourceField: ['projectId'], + destField: ['id'], + destSchema: 'project', + cardinality: 'one', + }, + ], tags: [ { sourceField: ['id'], @@ -8687,6 +8651,14 @@ const projectTaskRelationships = { ], } as const; const projectTaskTagRelationships = { + tag: [ + { + sourceField: ['tagId'], + destField: ['id'], + destSchema: 'projectTag', + cardinality: 'one', + }, + ], task: [ { sourceField: ['taskId'], @@ -8695,24 +8667,44 @@ const projectTaskTagRelationships = { cardinality: 'one', }, ], - tag: [ +} as const; +const shipmentRelationships = { + items: [ { - sourceField: ['tagId'], + sourceField: ['id'], + destField: ['shipmentId'], + destSchema: 'shipmentItem', + cardinality: 'many', + }, + ], + order: [ + { + sourceField: ['orderId'], destField: ['id'], - destSchema: 'projectTag', + destSchema: 'orderTable', cardinality: 'one', }, ], } as const; -const supportTicketRelationships = { - customer: [ +const shipmentItemRelationships = { + orderItem: [ { - sourceField: ['customerId'], + sourceField: ['orderItemId'], destField: ['id'], - destSchema: 'user', + destSchema: 'orderItem', cardinality: 'one', }, ], + shipment: [ + { + sourceField: ['shipmentId'], + destField: ['id'], + destSchema: 'shipment', + cardinality: 'one', + }, + ], +} as const; +const supportTicketRelationships = { assignedTeam: [ { sourceField: ['assignedTeamId'], @@ -8721,48 +8713,48 @@ const supportTicketRelationships = { cardinality: 'one', }, ], - messages: [ + assignments: [ { sourceField: ['id'], destField: ['ticketId'], - destSchema: 'supportTicketMessage', + destSchema: 'supportTicketAssignment', cardinality: 'many', }, ], - tags: [ + audits: [ { sourceField: ['id'], destField: ['ticketId'], - destSchema: 'supportTicketTagLink', + destSchema: 'supportTicketAudit', cardinality: 'many', }, ], - assignments: [ + customer: [ + { + sourceField: ['customerId'], + destField: ['id'], + destSchema: 'user', + cardinality: 'one', + }, + ], + messages: [ { sourceField: ['id'], destField: ['ticketId'], - destSchema: 'supportTicketAssignment', + destSchema: 'supportTicketMessage', cardinality: 'many', }, ], - audits: [ + tags: [ { sourceField: ['id'], destField: ['ticketId'], - destSchema: 'supportTicketAudit', + destSchema: 'supportTicketTagLink', cardinality: 'many', }, ], } as const; const supportTicketAssignmentRelationships = { - ticket: [ - { - sourceField: ['ticketId'], - destField: ['id'], - destSchema: 'supportTicket', - cardinality: 'one', - }, - ], assignee: [ { sourceField: ['assigneeId'], @@ -8771,8 +8763,6 @@ const supportTicketAssignmentRelationships = { cardinality: 'one', }, ], -} as const; -const supportTicketAuditRelationships = { ticket: [ { sourceField: ['ticketId'], @@ -8781,6 +8771,8 @@ const supportTicketAuditRelationships = { cardinality: 'one', }, ], +} as const; +const supportTicketAuditRelationships = { actor: [ { sourceField: ['actorId'], @@ -8789,8 +8781,6 @@ const supportTicketAuditRelationships = { cardinality: 'one', }, ], -} as const; -const supportTicketMessageRelationships = { ticket: [ { sourceField: ['ticketId'], @@ -8799,6 +8789,8 @@ const supportTicketMessageRelationships = { cardinality: 'one', }, ], +} as const; +const supportTicketMessageRelationships = { author: [ { sourceField: ['authorId'], @@ -8807,6 +8799,14 @@ const supportTicketMessageRelationships = { cardinality: 'one', }, ], + ticket: [ + { + sourceField: ['ticketId'], + destField: ['id'], + destSchema: 'supportTicket', + cardinality: 'one', + }, + ], } as const; const supportTicketTagRelationships = { ticketLinks: [ @@ -8819,19 +8819,19 @@ const supportTicketTagRelationships = { ], } as const; const supportTicketTagLinkRelationships = { - ticket: [ + tag: [ { - sourceField: ['ticketId'], + sourceField: ['tagId'], destField: ['id'], - destSchema: 'supportTicket', + destSchema: 'supportTicketTag', cardinality: 'one', }, ], - tag: [ + ticket: [ { - sourceField: ['tagId'], + sourceField: ['ticketId'], destField: ['id'], - destSchema: 'supportTicketTag', + destSchema: 'supportTicket', cardinality: 'one', }, ], @@ -8845,14 +8845,6 @@ const teamRelationships = { cardinality: 'one', }, ], - lead: [ - { - sourceField: ['leadId'], - destField: ['id'], - destSchema: 'user', - cardinality: 'one', - }, - ], employees: [ { sourceField: ['id'], @@ -8861,6 +8853,14 @@ const teamRelationships = { cardinality: 'many', }, ], + lead: [ + { + sourceField: ['leadId'], + destField: ['id'], + destSchema: 'user', + cardinality: 'one', + }, + ], } as const; const telemetryRollupRelationships = { project: [ @@ -8873,19 +8873,19 @@ const telemetryRollupRelationships = { ], } as const; const timeEntryRelationships = { - timesheet: [ + task: [ { - sourceField: ['timesheetId'], + sourceField: ['taskId'], destField: ['id'], - destSchema: 'timesheet', + destSchema: 'projectTask', cardinality: 'one', }, ], - task: [ + timesheet: [ { - sourceField: ['taskId'], + sourceField: ['timesheetId'], destField: ['id'], - destSchema: 'projectTask', + destSchema: 'timesheet', cardinality: 'one', }, ], @@ -8899,6 +8899,14 @@ const timesheetRelationships = { cardinality: 'one', }, ], + entries: [ + { + sourceField: ['id'], + destField: ['timesheetId'], + destSchema: 'timeEntry', + cardinality: 'many', + }, + ], submittedBy: [ { sourceField: ['submittedById'], @@ -8907,21 +8915,19 @@ const timesheetRelationships = { cardinality: 'one', }, ], - entries: [ +} as const; +const userRelationships = { + friends: [ { sourceField: ['id'], - destField: ['timesheetId'], - destSchema: 'timeEntry', + destField: ['requestingId'], + destSchema: 'friendship', cardinality: 'many', }, - ], -} as const; -const userRelationships = { - messages: [ { - sourceField: ['id'], - destField: ['senderId'], - destSchema: 'message', + sourceField: ['acceptingId'], + destField: ['id'], + destSchema: 'user', cardinality: 'many', }, ], @@ -8939,17 +8945,11 @@ const userRelationships = { cardinality: 'many', }, ], - friends: [ + messages: [ { sourceField: ['id'], - destField: ['requestingId'], - destSchema: 'friendship', - cardinality: 'many', - }, - { - sourceField: ['acceptingId'], - destField: ['id'], - destSchema: 'user', + destField: ['senderId'], + destSchema: 'message', cardinality: 'many', }, ], @@ -9065,18 +9065,6 @@ export const schema = { analyticsDashboard: analyticsDashboardRelationships, analyticsWidget: analyticsWidgetRelationships, analyticsWidgetQuery: analyticsWidgetQueryRelationships, - productCategory: productCategoryRelationships, - product: productRelationships, - productVariant: productVariantRelationships, - productMedia: productMediaRelationships, - inventoryLocation: inventoryLocationRelationships, - inventoryItem: inventoryItemRelationships, - inventoryLevel: inventoryLevelRelationships, - orderTable: orderTableRelationships, - orderItem: orderItemRelationships, - orderPayment: orderPaymentRelationships, - shipment: shipmentRelationships, - shipmentItem: shipmentItemRelationships, benefitEnrollment: benefitEnrollmentRelationships, benefitPlan: benefitPlanRelationships, billingInvoice: billingInvoiceRelationships, @@ -9107,6 +9095,9 @@ export const schema = { integrationCredential: integrationCredentialRelationships, integrationEvent: integrationEventRelationships, integrationWebhook: integrationWebhookRelationships, + inventoryItem: inventoryItemRelationships, + inventoryLevel: inventoryLevelRelationships, + inventoryLocation: inventoryLocationRelationships, ledgerAccount: ledgerAccountRelationships, ledgerEntry: ledgerEntryRelationships, ledgerTransaction: ledgerTransactionRelationships, @@ -9117,6 +9108,13 @@ export const schema = { marketingChannel: marketingChannelRelationships, medium: mediumRelationships, message: messageRelationships, + orderItem: orderItemRelationships, + orderPayment: orderPaymentRelationships, + orderTable: orderTableRelationships, + product: productRelationships, + productCategory: productCategoryRelationships, + productMedia: productMediaRelationships, + productVariant: productVariantRelationships, project: projectRelationships, projectAssignment: projectAssignmentRelationships, projectAttachment: projectAttachmentRelationships, @@ -9127,6 +9125,8 @@ export const schema = { projectTag: projectTagRelationships, projectTask: projectTaskRelationships, projectTaskTag: projectTaskTagRelationships, + shipment: shipmentRelationships, + shipmentItem: shipmentItemRelationships, supportTicket: supportTicketRelationships, supportTicketAssignment: supportTicketAssignmentRelationships, supportTicketAudit: supportTicketAuditRelationships, diff --git a/src/canonicalize.ts b/src/canonicalize.ts new file mode 100644 index 0000000..3a3fe0c --- /dev/null +++ b/src/canonicalize.ts @@ -0,0 +1,71 @@ +/** + * Orders the parts of a Zero schema that carry no meaning so that generating + * from an unchanged Drizzle schema always produces the same output. + * + * Nothing downstream reads these key orders: `normalizeClientSchema` sorts + * tables and columns before hashing the client schema, and every other + * consumer looks entries up by name. Without this pass the orders are simply + * whatever order the schema happened to be written in, so moving a table + * between two exports or a column between two lines rewrote the generated + * file for no reason. + * + * Ordering that *does* carry meaning is left alone: a table's `primaryKey`, + * the hops of a relationship, and the parallel `sourceField`/`destField` + * arrays inside a hop, which pair up by position. + */ + +/** Code-unit order, so the result never depends on the host locale. */ +export const compareKeys = (a: string, b: string): number => + a < b ? -1 : a > b ? 1 : 0; + +const isRecord = (value: unknown): value is Record => + typeof value === 'object' && value !== null && !Array.isArray(value); + +const sortKeys = (value: Record): Record => + Object.fromEntries( + Object.entries(value).sort(([a], [b]) => compareKeys(a, b)), + ); + +const canonicalizeTable = (table: unknown): unknown => { + if (!isRecord(table) || !isRecord(table.columns)) { + return table; + } + + return {...table, columns: sortKeys(table.columns)}; +}; + +/** + * Sorts a schema's tables, columns, relationship owners and relationship + * names. Idempotent, so it is safe to apply again on the way into codegen. + */ +export function canonicalizeZeroSchema(schema: TSchema): TSchema { + if (!isRecord(schema)) { + return schema; + } + + const canonical: Record = {...schema}; + + if (isRecord(schema.tables)) { + canonical.tables = sortKeys( + Object.fromEntries( + Object.entries(schema.tables).map(([name, table]) => [ + name, + canonicalizeTable(table), + ]), + ), + ); + } + + if (isRecord(schema.relationships)) { + canonical.relationships = sortKeys( + Object.fromEntries( + Object.entries(schema.relationships).map(([name, relationships]) => [ + name, + isRecord(relationships) ? sortKeys(relationships) : relationships, + ]), + ), + ); + } + + return canonical as TSchema; +} diff --git a/src/cli/config.ts b/src/cli/config.ts index 23b9903..82477c9 100755 --- a/src/cli/config.ts +++ b/src/cli/config.ts @@ -77,13 +77,16 @@ export function getZeroSchemaDefsFromConfig({ configPath: string; exportName: string; }) { - const fileName = configPath.slice(configPath.lastIndexOf('/') + 1); + // Look the file up by absolute path. A bare file name makes ts-morph fall + // back to a "path ends with" search, which silently picks the first match by + // directory depth when a project holds more than one config of that name. + const fullConfigPath = path.resolve(process.cwd(), configPath); - const sourceFile = tsProject.getSourceFile(fileName); + const sourceFile = tsProject.getSourceFile(fullConfigPath); if (!sourceFile) { throw new Error( - `❌ drizzle-zero: Failed to find type definitions for ${fileName}`, + `❌ drizzle-zero: Failed to find type definitions for ${fullConfigPath}`, ); } diff --git a/src/cli/format.ts b/src/cli/format.ts new file mode 100644 index 0000000..6921004 --- /dev/null +++ b/src/cli/format.ts @@ -0,0 +1,51 @@ +import {pathToFileURL} from 'node:url'; + +class PrettierNotFoundError extends Error { + constructor() { + super( + '⚠️ drizzle-zero: prettier could not be found. Install it locally with\n npm i -D prettier', + ); + this.name = 'PrettierNotFoundError'; + } +} + +export async function loadPrettier() { + try { + return await import('prettier'); + } catch (_) {} + + try { + const path = require.resolve('prettier', {paths: [process.cwd()]}); + return await import(pathToFileURL(path).href); + } catch { + throw new PrettierNotFoundError(); + } +} + +export async function formatSchema( + schema: string, + filePath: string, +): Promise { + let prettier: Awaited>; + + try { + prettier = await loadPrettier(); + } catch (error) { + if (!(error instanceof PrettierNotFoundError)) { + throw error; + } + + console.warn('⚠️ drizzle-zero: prettier not found, skipping formatting'); + return schema; + } + + // Anything past this point is prettier failing on input it was given, not + // prettier being absent. Reporting it as "not found" would hide a broken + // prettier config behind output that silently differs from every other run. + const prettierOptions = await prettier.resolveConfig(filePath); + + return prettier.format(schema, { + ...prettierOptions, + parser: 'typescript', + }); +} diff --git a/src/cli/index.ts b/src/cli/index.ts index de30975..e2cd1f6 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -1,10 +1,10 @@ import {Command} from 'commander'; import * as fs from 'node:fs/promises'; import * as path from 'node:path'; -import {pathToFileURL} from 'node:url'; import {Project} from 'ts-morph'; import {getConfigFromFile, getDefaultConfigFilePath} from './config'; import {getDefaultConfig} from './drizzle-kit'; +import {formatSchema} from './format'; import {getGeneratedSchema} from './shared'; import {checkSignature, signContent} from './signature'; import {discoverAllTsConfigs} from './tsconfig'; @@ -18,39 +18,6 @@ const defaultOutputFile = './zero-schema.gen.ts'; const defaultTsConfigFile = './tsconfig.json'; const defaultDrizzleKitConfigPath = './drizzle.config.ts'; -export async function loadPrettier() { - try { - return await import('prettier'); - } catch (_) {} - - try { - const path = require.resolve('prettier', {paths: [process.cwd()]}); - return await import(pathToFileURL(path).href); - } catch { - throw new Error( - '⚠️ drizzle-zero: prettier could not be found. Install it locally with\n npm i -D prettier', - ); - } -} - -export async function formatSchema( - schema: string, - filePath: string, -): Promise { - try { - const prettier = await loadPrettier(); - const prettierOptions = await prettier.resolveConfig(filePath); - - return prettier.format(schema, { - ...prettierOptions, - parser: 'typescript', - }); - } catch { - console.warn('⚠️ drizzle-zero: prettier not found, skipping formatting'); - return schema; - } -} - export interface GeneratorOptions { config?: string; tsConfigPath?: string; diff --git a/src/cli/shared.ts b/src/cli/shared.ts index d6dd0da..66d79ca 100755 --- a/src/cli/shared.ts +++ b/src/cli/shared.ts @@ -1,4 +1,5 @@ import camelCase from 'camelcase'; +import {createHash} from 'node:crypto'; import pluralize from 'pluralize'; import { type CodeBlockWriter, @@ -6,13 +7,83 @@ import { type SourceFile, VariableDeclarationKind, } from 'ts-morph'; +import {canonicalizeZeroSchema} from '../canonicalize'; import type {getConfigFromFile} from './config'; import type {getDefaultConfig} from './drizzle-kit'; import {COLUMN_SEPARATOR, resolveCustomTypes} from './type-resolution'; +/** + * Distinguishes a table's row type from its table const in the identifier + * allocator, which keys everything by a single string. + */ +const ROW_TYPE_PREFIX = 'row\u0000'; + +/** + * Identifiers the generated file always declares or imports. A schema key that + * wants one of these is treated as a collision so the generated code never + * shadows them. + */ +const RESERVED_IDENTIFIERS: ReadonlySet = new Set([ + 'CustomType', + 'ReadonlyJSONValue', + 'Row', + 'Schema', + 'ZeroCustomType', + 'builder', + 'createBuilder', + 'drizzleSchema', + 'schema', + 'zeroSchema', + 'zql', +]); + +const stableDisambiguator = (key: string) => + createHash('sha256').update(key).digest('hex').slice(0, 8); + +/** + * Assigns a generated identifier to every key in one pass. + * + * A key whose preferred name is unique and unreserved keeps that name. When + * several keys want the same name -- `user` and `users` both want the row type + * `User`, say -- every one of them takes a suffix derived from its own key, so + * no key's identifier depends on where it sits relative to the others. That + * keeps a reordered schema byte-identical, and confines the effect of adding a + * colliding key to the keys it actually collides with. + */ +function allocateIdentifiers( + requests: Iterable, +): Map { + const keysByPreferredName = new Map(); + + for (const [key, preferredName] of requests) { + const existing = keysByPreferredName.get(preferredName); + + if (existing) { + existing.push(key); + } else { + keysByPreferredName.set(preferredName, [key]); + } + } + + const allocated = new Map(); + + for (const [preferredName, keys] of keysByPreferredName) { + if (keys.length === 1 && !RESERVED_IDENTIFIERS.has(preferredName)) { + allocated.set(keys[0]!, preferredName); + continue; + } + + for (const key of keys) { + allocated.set(key, `${preferredName}_${stableDisambiguator(key)}`); + } + } + + return allocated; +} + export function getGeneratedSchema({ tsProject, - result, + result: rawResult, outputFilePath, jsExtensionOverride = 'auto', skipTypes = false, @@ -35,6 +106,13 @@ export function getGeneratedSchema({ enableLegacyQueries?: boolean; debug?: boolean; }) { + // Applied again here, not just in `drizzleZeroConfig`, so a hand-written or + // otherwise externally produced schema still generates a canonical file. + const result = { + ...rawResult, + zeroSchema: canonicalizeZeroSchema(rawResult.zeroSchema), + } as typeof rawResult; + // Auto-detect if .js extensions are needed based on tsconfig // unless explicitly overridden by the user let needsJsExtension = jsExtensionOverride === 'force'; @@ -208,15 +286,14 @@ export function getGeneratedSchema({ const isRecord = (value: unknown): value is Record => typeof value === 'object' && value !== null && !Array.isArray(value); - const usedIdentifiers = new Set([schemaObjectName]); - const tableConstNames = new Map(); - const relationshipConstNames = new Map(); - const fallbackCustomTypeAliasNames = new Map(); let readonlyJSONValueImported = false; + // `locale: false` throughout: camelcase otherwise case-maps with the host + // locale, which turns `I` into a dotless `ı` under `tr`. Generated + // identifiers must not depend on where the generator runs. const sanitizeIdentifier = (value: string, fallback: string) => { const baseCandidate = - camelCase(value, {pascalCase: false}) || value || fallback; + camelCase(value, {pascalCase: false, locale: false}) || value || fallback; const cleaned = baseCandidate.replace(/[^A-Za-z0-9_$]/g, '') || fallback; const startsValid = /^[A-Za-z_$]/.test(cleaned) ? cleaned : `_${cleaned}`; return startsValid.length > 0 ? startsValid : fallback; @@ -227,39 +304,73 @@ export function getGeneratedSchema({ ? identifier : `${identifier}${suffix}`; - const getUniqueIdentifier = (identifier: string) => { - let candidate = identifier; - let counter = 2; - while (usedIdentifiers.has(candidate)) { - candidate = `${identifier}${counter}`; - counter += 1; - } - usedIdentifiers.add(candidate); - return candidate; - }; - - const createConstName = (name: string, suffix: string, fallback: string) => - getUniqueIdentifier( - ensureSuffix(sanitizeIdentifier(name, fallback), suffix), - ); - - const createCustomTypeAliasName = (tableName: string, columnName: string) => - getUniqueIdentifier( - camelCase(`${tableName} ${columnName} custom type`, {pascalCase: true}), - ); - - for (const request of customTypeRequests) { - const key = `${request.tableName}${COLUMN_SEPARATOR}${request.columnName}`; + const constNameFor = (name: string, suffix: string, fallback: string) => + ensureSuffix(sanitizeIdentifier(name, fallback), suffix); - if (resolvedCustomTypes.has(key)) { - continue; - } + const customTypeAliasNameFor = (tableName: string, columnName: string) => + camelCase(`${tableName} ${columnName} custom type`, { + pascalCase: true, + locale: false, + }); - fallbackCustomTypeAliasNames.set( - key, - createCustomTypeAliasName(request.tableName, request.columnName), - ); - } + const tableNames = isRecord(result.zeroSchema?.tables) + ? Object.keys(result.zeroSchema.tables) + : []; + const relationshipNames = isRecord(result.zeroSchema?.relationships) + ? Object.keys(result.zeroSchema.relationships) + : []; + + const tableConstNames = allocateIdentifiers( + tableNames.map( + tableName => + [tableName, constNameFor(tableName, 'Table', 'table')] as const, + ), + ); + const relationshipConstNames = allocateIdentifiers( + relationshipNames.map( + relationshipName => + [ + relationshipName, + constNameFor(relationshipName, 'Relationships', 'relationships'), + ] as const, + ), + ); + + const fallbackCustomTypeRequests = customTypeRequests.filter( + request => + !resolvedCustomTypes.has( + `${request.tableName}${COLUMN_SEPARATOR}${request.columnName}`, + ), + ); + + // Row types and custom type aliases share the type namespace, so they are + // allocated together to keep either from silently shadowing the other. + const typeAliasNames = allocateIdentifiers([ + ...fallbackCustomTypeRequests.map( + request => + [ + `${request.tableName}${COLUMN_SEPARATOR}${request.columnName}`, + customTypeAliasNameFor(request.tableName, request.columnName), + ] as const, + ), + ...tableNames.map( + tableName => + [ + `${ROW_TYPE_PREFIX}${tableName}`, + camelCase(pluralize.singular(tableName), { + pascalCase: true, + locale: false, + }), + ] as const, + ), + ]); + + const fallbackCustomTypeAliasNames = new Map( + fallbackCustomTypeRequests.map(request => { + const key = `${request.tableName}${COLUMN_SEPARATOR}${request.columnName}`; + return [key, typeAliasNames.get(key)!] as const; + }), + ); const writeSchemaReferenceCollection = ( writer: CodeBlockWriter, @@ -304,6 +415,18 @@ export function getGeneratedSchema({ ) => { const indentStr = ' '.repeat(indent); + // A column definition always sits at tables//columns/, so a + // `customType` key anywhere else belongs to user data and must be written + // verbatim rather than replaced with a resolved type. + const columnPath = + keys.length === 4 && + keys[0] === 'tables' && + keys[2] === 'columns' && + typeof keys[1] === 'string' && + typeof keys[3] === 'string' + ? ([keys[1], keys[3]] as const) + : null; + if ( !value || typeof value === 'string' || @@ -357,23 +480,16 @@ export function getGeneratedSchema({ relationshipConstNames, indent + 2, ); - } else if (key === 'customType' && propValue === null) { - const tableIndex = 1; - const columnIndex = 3; - const tableName = keys[tableIndex]; - const columnName = keys[columnIndex]; - const resolvedType = - typeof tableName === 'string' && typeof columnName === 'string' - ? resolvedCustomTypes.get( - `${tableName}${COLUMN_SEPARATOR}${columnName}`, - ) - : undefined; + } else if ( + columnPath !== null && + key === 'customType' && + propValue === null + ) { + const [tableName, columnName] = columnPath; + const customTypeKey = `${tableName}${COLUMN_SEPARATOR}${columnName}`; + const resolvedType = resolvedCustomTypes.get(customTypeKey); const fallbackAlias = - typeof tableName === 'string' && typeof columnName === 'string' - ? fallbackCustomTypeAliasNames.get( - `${tableName}${COLUMN_SEPARATOR}${columnName}`, - ) - : undefined; + fallbackCustomTypeAliasNames.get(customTypeKey); if (resolvedType) { writer.write(`null as unknown as ${resolvedType}`); @@ -385,12 +501,20 @@ export function getGeneratedSchema({ writer.write(`null as unknown as ${fallbackAlias}`); } else { writer.write( - `null as unknown as ${customTypeHelper}<${zeroSchemaSpecifier}, "${keys[tableIndex]}", "${keys[columnIndex]}">`, + `null as unknown as ${customTypeHelper}<${zeroSchemaSpecifier}, ${JSON.stringify(tableName)}, ${JSON.stringify(columnName)}>`, ); } - } else if (key === 'enableLegacyMutators') { + } else if ( + mode === 'schema' && + keys.length === 0 && + key === 'enableLegacyMutators' + ) { writer.write(enableLegacyMutators ? 'true' : 'false'); - } else if (key === 'enableLegacyQueries') { + } else if ( + mode === 'schema' && + keys.length === 0 && + key === 'enableLegacyQueries' + ) { writer.write(enableLegacyQueries ? 'true' : 'false'); } else { writeValue(writer, propValue, { @@ -445,8 +569,7 @@ export function getGeneratedSchema({ for (const [tableName, tableDef] of Object.entries( result.zeroSchema.tables as Record, )) { - const constName = createConstName(tableName, 'Table', 'table'); - tableConstNames.set(tableName, constName); + const constName = tableConstNames.get(tableName)!; if (tableConstCount > 0) { zeroSchemaGenerated.addStatements(writer => writer.blankLine()); @@ -476,12 +599,7 @@ export function getGeneratedSchema({ for (const [relationshipName, relationshipDef] of Object.entries( result.zeroSchema.relationships as Record, )) { - const constName = createConstName( - relationshipName, - 'Relationships', - 'relationships', - ); - relationshipConstNames.set(relationshipName, constName); + const constName = relationshipConstNames.get(relationshipName)!; if (relationshipConstCount === 0) { if (tableConstCount > 0) { @@ -558,10 +676,7 @@ export function getGeneratedSchema({ } for (const tableName of allTableNames) { - // make the type name singular and camelCase - const typeName = camelCase(pluralize.singular(tableName), { - pascalCase: true, - }); + const typeName = typeAliasNames.get(`${ROW_TYPE_PREFIX}${tableName}`)!; const tableTypeAlias = zeroSchemaGenerated.addTypeAlias({ name: typeName, diff --git a/src/cli/type-resolution.ts b/src/cli/type-resolution.ts index 8ca902d..fe18609 100644 --- a/src/cli/type-resolution.ts +++ b/src/cli/type-resolution.ts @@ -89,7 +89,7 @@ export function resolveCustomTypes({ const text = type.getText(alias, typeFormatFlags); if (isSafeResolvedType(text)) { - resolved.set(key, text); + resolved.set(key, canonicalizeTypeText(text)); } } @@ -190,3 +190,130 @@ export const isSafeResolvedType = (typeText: string | undefined): boolean => { return true; }; + +/** + * Reorders the parts of a printed type that TypeScript orders by internal + * type id. + * + * TypeScript interns literal types globally and keeps union and intersection + * members sorted by the id each type was assigned when the checker first + * created it. The printed order therefore encodes the order the whole program + * was checked in, not anything about the type: moving an entry in an + * unrelated lookup table shifts a member in every union that mentions it, and + * the ids differ between TypeScript versions. + * + * Sorting the members ourselves makes the printed form depend only on the set + * of members. Anything this does not recognise is left exactly as printed. + */ +export function canonicalizeTypeText(typeText: string): string { + try { + const file = ts.createSourceFile( + '__drizzle_zero_canonical_type.ts', + `type __T = ${typeText};`, + ts.ScriptTarget.Latest, + true, + ts.ScriptKind.TS, + ); + + const parseDiagnostics = ( + file as unknown as {parseDiagnostics?: readonly unknown[]} + ).parseDiagnostics; + + if (parseDiagnostics && parseDiagnostics.length > 0) { + return typeText; + } + + const [statement] = file.statements; + + if (!statement || !ts.isTypeAliasDeclaration(statement)) { + return typeText; + } + + return printCanonicalType(statement.type, file); + } catch { + return typeText; + } +} + +const compareTypeText = (a: string, b: string): number => + a < b ? -1 : a > b ? 1 : 0; + +const printCanonicalType = (node: ts.TypeNode, file: ts.SourceFile): string => { + // Unions and intersections are both commutative, and both are what + // TypeScript orders by type id. + if (ts.isUnionTypeNode(node)) { + return node.types + .map(member => printCanonicalType(member, file)) + .sort(compareTypeText) + .join(' | '); + } + + if (ts.isIntersectionTypeNode(node)) { + return node.types + .map(member => printCanonicalType(member, file)) + .sort(compareTypeText) + .join(' & '); + } + + if (ts.isParenthesizedTypeNode(node)) { + return `(${printCanonicalType(node.type, file)})`; + } + + if (ts.isArrayTypeNode(node)) { + return `${printCanonicalType(node.elementType, file)}[]`; + } + + // Tuple elements are positional, so only their own types are rewritten. + if (ts.isTupleTypeNode(node)) { + return `[${node.elements + .map(element => printCanonicalType(element, file)) + .join(', ')}]`; + } + + if (ts.isOptionalTypeNode(node)) { + return `${printCanonicalType(node.type, file)}?`; + } + + if (ts.isRestTypeNode(node)) { + return `...${printCanonicalType(node.type, file)}`; + } + + if (ts.isNamedTupleMember(node)) { + const optional = node.questionToken ? '?' : ''; + return `${node.dotDotDotToken ? '...' : ''}${node.name.text}${optional}: ${printCanonicalType(node.type, file)}`; + } + + if (ts.isTypeLiteralNode(node)) { + const members = node.members + .map(member => printCanonicalMember(member, file)) + .sort(compareTypeText); + + return members.length === 0 ? '{}' : `{${members.join('; ')}}`; + } + + return node.getText(file); +}; + +const printCanonicalMember = ( + member: ts.TypeElement, + file: ts.SourceFile, +): string => { + if ( + (ts.isPropertySignature(member) || + ts.isIndexSignatureDeclaration(member)) && + member.type + ) { + const modifiers = ts.isPropertySignature(member) + ? member.modifiers?.map(modifier => `${modifier.getText(file)} `).join('') + : undefined; + const name = ts.isPropertySignature(member) + ? member.name.getText(file) + : `[${member.parameters.map(parameter => parameter.getText(file)).join(', ')}]`; + const optional = + ts.isPropertySignature(member) && member.questionToken ? '?' : ''; + + return `${modifiers ?? ''}${name}${optional}: ${printCanonicalType(member.type, file)}`; + } + + return member.getText(file); +}; diff --git a/src/relations.ts b/src/relations.ts index 3f667d0..52f5332 100644 --- a/src/relations.ts +++ b/src/relations.ts @@ -1,4 +1,5 @@ import {createSchema} from '@rocicorp/zero'; +import {canonicalizeZeroSchema} from './canonicalize'; import {Table, getTableName, getTableUniqueName, is} from 'drizzle-orm'; import {Relations as LegacyRelations} from 'drizzle-orm/_relations'; import {getColumnTable} from 'drizzle-orm/column'; @@ -418,6 +419,7 @@ const drizzleZeroConfig = < } const tables: any[] = []; + const warnedServerDefaults = new Set(); const tableColumnNamesForSourceTable = new Map>(); const includedTableKeys = new Set(); const discoveredRelations = new Map< @@ -479,6 +481,7 @@ const drizzleZeroConfig = < config?.debug, config?.casing, config?.suppressDefaultsWarning, + warnedServerDefaults, ); tables.push(tableSchema); @@ -620,13 +623,15 @@ const drizzleZeroConfig = < } } - const finalSchema = createSchema({ - tables, - relationships: Object.entries(relationships).map(([name, value]) => ({ - name, - relationships: value, - })), - } as any) as unknown as DrizzleToZeroSchema; + const finalSchema = canonicalizeZeroSchema( + createSchema({ + tables, + relationships: Object.entries(relationships).map(([name, value]) => ({ + name, + relationships: value, + })), + } as any), + ) as unknown as DrizzleToZeroSchema; debugLog( config?.debug, @@ -652,22 +657,38 @@ const getDrizzleKeyFromTable = ({ table?: Table; fallbackTableName?: string; }) => { + // A table can be exported under more than one key. Take the smallest + // matching key rather than the first one, so the key a relation points at + // does not depend on the order the schema happens to export its tables in. + const smallestMatch = ( + predicate: (candidate: Table) => boolean, + ): string | undefined => { + let match: string | undefined; + + for (const [name, tableOrRelations] of typedEntries(schema)) { + if (!is(tableOrRelations, Table) || !predicate(tableOrRelations)) { + continue; + } + + if (match === undefined || String(name) < match) { + match = String(name); + } + } + + return match; + }; + if (table) { - const directMatch = typedEntries(schema).find( - ([_name, tableOrRelations]) => - is(tableOrRelations, Table) && tableOrRelations === table, - )?.[0]; + const directMatch = smallestMatch(candidate => candidate === table); if (directMatch) { return directMatch; } const uniqueName = getTableUniqueName(table); - const uniqueMatch = typedEntries(schema).find( - ([_name, tableOrRelations]) => - is(tableOrRelations, Table) && - getTableUniqueName(tableOrRelations) === uniqueName, - )?.[0]; + const uniqueMatch = smallestMatch( + candidate => getTableUniqueName(candidate) === uniqueName, + ); if (uniqueMatch) { return uniqueMatch; @@ -675,11 +696,9 @@ const getDrizzleKeyFromTable = ({ } if (fallbackTableName) { - const fallbackMatch = typedEntries(schema).find( - ([_name, tableOrRelations]) => - is(tableOrRelations, Table) && - getTableName(tableOrRelations) === fallbackTableName, - )?.[0]; + const fallbackMatch = smallestMatch( + candidate => getTableName(candidate) === fallbackTableName, + ); if (fallbackMatch) { return fallbackMatch; diff --git a/src/tables.ts b/src/tables.ts index 0d1c3aa..fcee988 100644 --- a/src/tables.ts +++ b/src/tables.ts @@ -28,7 +28,6 @@ import type { } from './types'; import {debugLog, typedEntries} from './util'; -const warnedServerDefaults = new Set(); const supportedZeroTypes = ['string', 'number', 'boolean', 'json'] as const; export type {ColumnBuilder, ReadonlyJSONValue, TableBuilderWithColumns}; @@ -185,17 +184,17 @@ const createZeroTableBuilder = < * Whether to hide warnings for columns with default values. */ suppressDefaultsWarning?: boolean, + /** + * Collects the columns already warned about, so one schema build reports + * each column at most once. A fresh set is used when none is supplied. + */ + warnedServerDefaults: Set = new Set(), ): ZeroTableBuilder => { const actualTableName = getTableName(table); const tableColumns = getTableColumns(table); const tableConfig = getTableConfigForDatabase(table); - const columnNameToStableKey = new Map( - typedEntries(tableColumns).map(([key, column]) => [ - column.name, - String(key), - ]), - ); + const columnNameToStableKey = getColumnNameToKeyMap(table); const primaryKeys = new Set(); for (const [key, column] of typedEntries(tableColumns)) { @@ -357,6 +356,28 @@ const createZeroTableBuilder = < >; }; +/** + * Maps each database column name back to the schema key that declares it. + * + * Drizzle discards the schema key when it builds relations, so it has to be + * recovered from the column name. A name is normally declared by exactly one + * key; when a schema declares it more than once the smallest key wins, so the + * answer does not depend on the order the columns were written in. + */ +const getColumnNameToKeyMap = (table: Table): ReadonlyMap => { + const columnNameToKey = new Map(); + + for (const [key, column] of typedEntries(getTableColumns(table))) { + const existing = columnNameToKey.get(column.name); + + if (existing === undefined || String(key) < existing) { + columnNameToKey.set(column.name, String(key)); + } + } + + return columnNameToKey; +}; + /** * Get the key of a column in the schema from the column name. * @param columnName - The name of the column to get the key for @@ -369,12 +390,16 @@ const getDrizzleColumnKeyFromColumnName = ({ }: { columnName: string; table: Table; -}) => { - const tableColumns = getTableColumns(table); +}): string => { + const key = getColumnNameToKeyMap(table).get(columnName); + + if (key === undefined) { + throw new Error( + `drizzle-zero: Column ${getTableName(table)}.${columnName} is not declared on the table it belongs to. This usually means a relation references a column from a different table.`, + ); + } - return typedEntries(tableColumns).find( - ([_name, column]) => column.name === columnName, - )?.[0]!; + return key; }; export { diff --git a/tests/canonicalize.test.ts b/tests/canonicalize.test.ts new file mode 100644 index 0000000..4e491c1 --- /dev/null +++ b/tests/canonicalize.test.ts @@ -0,0 +1,195 @@ +import {defineRelations} from 'drizzle-orm'; +import {integer, pgTable, primaryKey, serial, text} from 'drizzle-orm/pg-core'; +import {describe, expect, test} from 'vitest'; +import {canonicalizeZeroSchema} from '../src/canonicalize'; +import {drizzleZeroConfig} from '../src/relations'; + +describe('canonicalizeZeroSchema', () => { + test('sorts tables, columns, relationship owners and relation names', () => { + const canonical = canonicalizeZeroSchema({ + tables: { + zebra: {name: 'zebra', primaryKey: ['id'], columns: {b: {}, a: {}}}, + apple: {name: 'apple', primaryKey: ['id'], columns: {d: {}, c: {}}}, + }, + relationships: { + zebra: {second: [], first: []}, + apple: {fourth: [], third: []}, + }, + }); + + expect(Object.keys(canonical.tables)).toEqual(['apple', 'zebra']); + expect(Object.keys(canonical.tables.apple.columns)).toEqual(['c', 'd']); + expect(Object.keys(canonical.tables.zebra.columns)).toEqual(['a', 'b']); + expect(Object.keys(canonical.relationships)).toEqual(['apple', 'zebra']); + expect(Object.keys(canonical.relationships.apple)).toEqual([ + 'fourth', + 'third', + ]); + }); + + test('leaves meaningful ordering alone', () => { + const canonical = canonicalizeZeroSchema({ + tables: { + t: {name: 't', primaryKey: ['b', 'a'], columns: {b: {}, a: {}}}, + }, + relationships: { + t: { + // Hops are ordered, and sourceField/destField pair up by position. + rel: [ + {sourceField: ['z', 'a'], destField: ['q', 'b'], destSchema: 'u'}, + {sourceField: ['m'], destField: ['n'], destSchema: 'v'}, + ], + }, + }, + }); + + expect(canonical.tables.t.primaryKey).toEqual(['b', 'a']); + expect(canonical.relationships.t.rel).toEqual([ + {sourceField: ['z', 'a'], destField: ['q', 'b'], destSchema: 'u'}, + {sourceField: ['m'], destField: ['n'], destSchema: 'v'}, + ]); + }); + + test('is idempotent', () => { + const schema = { + tables: {b: {columns: {y: {}, x: {}}}, a: {columns: {}}}, + relationships: {b: {two: [], one: []}}, + }; + + const once = canonicalizeZeroSchema(schema); + + expect(JSON.stringify(canonicalizeZeroSchema(once))).toBe( + JSON.stringify(once), + ); + }); + + test('passes through values that are not schemas', () => { + expect(canonicalizeZeroSchema(null)).toBeNull(); + expect(canonicalizeZeroSchema('nope')).toBe('nope'); + expect(canonicalizeZeroSchema({tables: 7})).toEqual({tables: 7}); + }); +}); + +describe('schema generation is order-independent', () => { + const users = pgTable('users', { + id: serial('id').primaryKey(), + name: text('name'), + }); + + const buildPosts = (reverseColumns: boolean) => + reverseColumns + ? pgTable('posts', { + id: serial('id').primaryKey(), + editorId: integer('editor_id'), + authorId: integer('author_id'), + }) + : pgTable('posts', { + id: serial('id').primaryKey(), + authorId: integer('author_id'), + editorId: integer('editor_id'), + }); + + const buildRelations = ( + posts: ReturnType, + reverse: boolean, + ) => + defineRelations({users, posts}, r => + reverse + ? { + posts: { + editor: r.one.users({ + from: r.posts.editorId, + to: r.users.id, + optional: true, + }), + author: r.one.users({ + from: r.posts.authorId, + to: r.users.id, + optional: false, + }), + }, + } + : { + posts: { + author: r.one.users({ + from: r.posts.authorId, + to: r.users.id, + optional: false, + }), + editor: r.one.users({ + from: r.posts.editorId, + to: r.users.id, + optional: true, + }), + }, + }, + ); + + const config = {tables: {users: true, posts: true}} as const; + + const baselinePosts = buildPosts(false); + const baseline = JSON.stringify( + drizzleZeroConfig( + {users, posts: baselinePosts, r: buildRelations(baselinePosts, false)}, + config, + ), + ); + + test('reordering table exports changes nothing', () => { + expect( + JSON.stringify( + drizzleZeroConfig( + { + posts: baselinePosts, + users, + r: buildRelations(baselinePosts, false), + }, + config, + ), + ), + ).toBe(baseline); + }); + + test('reordering relation declarations changes nothing', () => { + expect( + JSON.stringify( + drizzleZeroConfig( + {users, posts: baselinePosts, r: buildRelations(baselinePosts, true)}, + config, + ), + ), + ).toBe(baseline); + }); + + test('reordering column declarations changes nothing', () => { + const reversed = buildPosts(true); + + expect( + JSON.stringify( + drizzleZeroConfig( + {users, posts: reversed, r: buildRelations(reversed, false)}, + config, + ), + ), + ).toBe(baseline); + }); + + test('a composite primary key keeps its declared column order', () => { + const membership = pgTable( + 'membership', + { + teamId: integer('team_id').notNull(), + userId: integer('user_id').notNull(), + }, + t => [primaryKey({columns: [t.userId, t.teamId]})], + ); + + const schema = drizzleZeroConfig({membership}, { + tables: {membership: true}, + } as never) as never as { + tables: {membership: {primaryKey: readonly string[]}}; + }; + + expect(schema.tables.membership.primaryKey).toEqual(['userId', 'teamId']); + }); +}); diff --git a/tests/cli.test.ts b/tests/cli.test.ts index e2d2e9f..b28ee4b 100644 --- a/tests/cli.test.ts +++ b/tests/cli.test.ts @@ -226,6 +226,26 @@ describe('getGeneratedSchema', () => { ).toThrow(/❌ drizzle-zero: Failed to find type definitions for/); }); + it('resolves the config file by path, not by file name', () => { + // A same-named file one directory shallower, which is what ts-morph's + // file-name search returns first when matching on the bare file name. + const otherConfigPath = path.resolve(__dirname, './one-to-one.zero.ts'); + + tsProject.createSourceFile( + otherConfigPath, + 'export const schema = {tables: {}, relationships: {}} as const;', + {overwrite: true}, + ); + + const [, declaration] = getZeroSchemaDefsFromConfig({ + tsProject, + configPath: schemaPath, + exportName: 'schema', + }); + + expect(declaration.getSourceFile().getFilePath()).toBe(schemaPath); + }); + it('should handle schema with empty entries correctly', () => { const zeroSchemaTypeDecl = getZeroSchemaDefsFromConfig({ tsProject, @@ -1122,6 +1142,107 @@ describe('getGeneratedSchema', () => { ); }); + it('gives colliding generated names distinct, key-derived identifiers', () => { + const zeroSchemaTypeDecl = getZeroSchemaDefsFromConfig({ + tsProject, + configPath: schemaPath, + exportName: 'schema', + }); + + const table = (name: string) => ({ + name, + primaryKey: ['id'] as [string], + columns: { + id: {type: 'number' as const, optional: false, customType: null}, + }, + }); + + const generatedSchema = getGeneratedSchema({ + tsProject, + result: { + type: 'config', + zeroSchema: { + tables: { + // `user` and `users` both singularize to `User`. + user: table('user'), + users: table('users'), + // `row` collides with the imported `Row`, `schema` with the + // generated `Schema` type alias. + row: table('row'), + schema: table('schema'), + }, + relationships: {}, + }, + exportName: 'schema', + zeroSchemaTypeDeclarations: zeroSchemaTypeDecl, + }, + outputFilePath, + skipBuilder: true, + }); + + const declaredTypeNames = [ + ...generatedSchema.matchAll(/^export type (\w+)\b/gm), + ].map(match => match[1]); + + expect(declaredTypeNames).toEqual([...new Set(declaredTypeNames)]); + expect(declaredTypeNames).toContain('Schema'); + expect(declaredTypeNames).not.toContain('User'); + expect(declaredTypeNames).not.toContain('Row'); + }); + + it('names table consts independently of declaration order', () => { + const zeroSchemaTypeDecl = getZeroSchemaDefsFromConfig({ + tsProject, + configPath: schemaPath, + exportName: 'schema', + }); + + const table = (name: string) => ({ + name, + primaryKey: ['id'] as [string], + columns: { + id: {type: 'number' as const, optional: false, customType: null}, + }, + }); + + // Both sanitize to `userProfileTable`. + const snake = table('user_profile'); + const camel = table('userProfile'); + + const constNameFor = ( + tables: Record, + marker: string, + ) => { + const generated = getGeneratedSchema({ + tsProject, + result: { + type: 'config', + zeroSchema: {tables, relationships: {}}, + exportName: 'schema', + zeroSchemaTypeDeclarations: zeroSchemaTypeDecl, + }, + outputFilePath, + skipTypes: true, + skipBuilder: true, + }); + + return generated.match( + new RegExp(`const (\\w+) = \\{[^}]*?"name": "${marker}"`, 's'), + )?.[1]; + }; + + expect( + constNameFor({user_profile: snake, userProfile: camel}, 'user_profile'), + ).toBe( + constNameFor({userProfile: camel, user_profile: snake}, 'user_profile'), + ); + expect( + constNameFor({user_profile: snake, userProfile: camel}, 'userProfile'), + ).toBe( + constNameFor({userProfile: camel, user_profile: snake}, 'userProfile'), + ); + }); + it('should handle table names with various casing correctly', () => { const zeroSchemaTypeDecl = getZeroSchemaDefsFromConfig({ tsProject, @@ -1407,6 +1528,97 @@ describe('getGeneratedSchema', () => { expect(generatedSchema).not.toContain('"enableLegacyMutators": false'); }); + it('does not rewrite columns whose names collide with schema-level keys', () => { + const zeroSchemaTypeDecl = getZeroSchemaDefsFromConfig({ + tsProject, + configPath: schemaPath, + exportName: 'schema', + }); + + const generatedSchema = getGeneratedSchema({ + tsProject, + result: { + type: 'config', + zeroSchema: { + tables: { + users: { + name: 'users', + primaryKey: ['id'], + columns: { + id: {type: 'number', optional: false, customType: null}, + enableLegacyMutators: { + type: 'boolean', + optional: false, + customType: null, + }, + enableLegacyQueries: { + type: 'boolean', + optional: false, + customType: null, + }, + }, + }, + }, + relationships: {}, + enableLegacyMutators: true, + }, + exportName: 'schema', + zeroSchemaTypeDeclarations: zeroSchemaTypeDecl, + }, + outputFilePath, + enableLegacyMutators: true, + }); + + // The schema-level flag is still rewritten... + expect(generatedSchema).toContain('"enableLegacyMutators": true'); + // ...but the identically named columns keep their definitions. + expect(generatedSchema).toContain('"enableLegacyMutators": {'); + expect(generatedSchema).toContain('"enableLegacyQueries": {'); + }); + + it('only substitutes customType for real column definitions', () => { + const zeroSchemaTypeDecl = getZeroSchemaDefsFromConfig({ + tsProject, + configPath: schemaPath, + exportName: 'schema', + }); + + const generatedSchema = getGeneratedSchema({ + tsProject, + result: { + type: 'config', + zeroSchema: { + tables: { + users: { + name: 'users', + primaryKey: ['id'], + columns: { + id: {type: 'number', optional: false, customType: null}, + }, + }, + }, + relationships: { + users: { + // A relationship payload that happens to carry a `customType` + // key at the same depth a column definition would. + posts: [{sourceField: ['id'], customType: null}], + }, + }, + }, + exportName: 'schema', + zeroSchemaTypeDeclarations: zeroSchemaTypeDecl, + }, + outputFilePath, + }); + + const relationshipConst = generatedSchema.slice( + generatedSchema.indexOf('const usersRelationships'), + ); + + expect(relationshipConst).toContain('"customType": null'); + expect(relationshipConst).not.toContain('null as unknown as'); + }); + it('should set enableLegacyQueries to true', () => { const zeroSchemaTypeDecl = getZeroSchemaDefsFromConfig({ tsProject, diff --git a/tests/format.test.ts b/tests/format.test.ts new file mode 100644 index 0000000..662b927 --- /dev/null +++ b/tests/format.test.ts @@ -0,0 +1,43 @@ +import * as fs from 'node:fs/promises'; +import * as os from 'node:os'; +import * as path from 'node:path'; +import {afterAll, beforeAll, describe, expect, test} from 'vitest'; +import {formatSchema} from '../src/cli/format'; + +describe('formatSchema', () => { + test('formats the schema with prettier', async () => { + const formatted = await formatSchema( + 'export const schema={a:1}', + 'zero-schema.gen.ts', + ); + + expect(formatted).toBe('export const schema = {a: 1};\n'); + }); + + describe('with an unreadable prettier config', () => { + let directory: string; + + beforeAll(async () => { + directory = await fs.mkdtemp( + path.join(os.tmpdir(), 'drizzle-zero-prettier-'), + ); + await fs.writeFile(path.join(directory, '.prettierrc'), '{not json'); + }); + + afterAll(async () => { + await fs.rm(directory, {recursive: true, force: true}); + }); + + test('reports the failure instead of skipping formatting', async () => { + // This used to be caught alongside "prettier is not installed" and + // reported as such, writing an unformatted schema whose signature + // differed from every correctly formatted run. + await expect( + formatSchema( + 'export const schema = {a: 1};', + path.join(directory, 'zero-schema.gen.ts'), + ), + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/tables.test.ts b/tests/tables.test.ts index 1ca57c7..0d8f30d 100644 --- a/tests/tables.test.ts +++ b/tests/tables.test.ts @@ -46,6 +46,7 @@ import { } from 'drizzle-orm/pg-core'; import {describe, expect, test, vi} from 'vitest'; import {createZeroTableBuilder, type ColumnsConfig} from '../src'; +import {getDrizzleColumnKeyFromColumnName} from '../src/tables'; import {assertEqual, expectTableSchemaDeepEqual} from './utils'; describe('tables', () => { @@ -2299,4 +2300,54 @@ describe('tables', () => { `[Error: drizzle-zero: Unsupported table type: test. Only Postgres tables are supported.]`, ); }); + + test('pg - column key lookup does not depend on declaration order', () => { + // Two schema keys declaring the same database column name is ambiguous; + // whichever order they are written in must resolve the same way. + const forwards = pgTable('t', { + id: text('id').primaryKey(), + alpha: text('dupe'), + beta: text('dupe'), + }); + const backwards = pgTable('t', { + id: text('id').primaryKey(), + beta: text('dupe'), + alpha: text('dupe'), + }); + + expect( + getDrizzleColumnKeyFromColumnName({columnName: 'dupe', table: forwards}), + ).toBe( + getDrizzleColumnKeyFromColumnName({columnName: 'dupe', table: backwards}), + ); + }); + + test('pg - column key lookup reports an unknown column', () => { + const users = pgTable('users', {id: text('id').primaryKey()}); + + expect(() => + getDrizzleColumnKeyFromColumnName({columnName: 'nope', table: users}), + ).toThrowError(/users\.nope is not declared/); + }); + + test('pg - default-value warnings are reported on every build', () => { + const users = pgTable('users', { + id: text('id').primaryKey(), + createdAt: timestamp('created_at').defaultNow().notNull(), + }); + + const warn = vi.spyOn(console, 'warn').mockImplementation(() => {}); + + try { + createZeroTableBuilder('users', users); + const afterFirstBuild = warn.mock.calls.length; + + createZeroTableBuilder('users', users); + + expect(afterFirstBuild).toBeGreaterThan(0); + expect(warn.mock.calls.length).toBe(afterFirstBuild * 2); + } finally { + warn.mockRestore(); + } + }); }); diff --git a/tests/type-resolution.test.ts b/tests/type-resolution.test.ts index 0e6be99..e0cce78 100644 --- a/tests/type-resolution.test.ts +++ b/tests/type-resolution.test.ts @@ -2,6 +2,7 @@ import * as path from 'node:path'; import {Project} from 'ts-morph'; import {describe, expect, test} from 'vitest'; import { + canonicalizeTypeText, isSafeResolvedType, resolveCustomTypes, } from '../src/cli/type-resolution'; @@ -600,3 +601,59 @@ describe('isSafeResolvedType', () => { expect(isSafeResolvedType(typeText)).toBe(false); }); }); + +describe('canonicalizeTypeText', () => { + test('orders union members by their printed form', () => { + // TypeScript prints union members in whatever order the checker created + // them in, which reflects the whole program rather than the type. + expect(canonicalizeTypeText(`"WY" | "AL" | "AK"`)).toBe( + `"AK" | "AL" | "WY"`, + ); + }); + + test('converges on the same text for the same set of members', () => { + expect(canonicalizeTypeText(`"AK" | "WY" | "AL"`)).toBe( + canonicalizeTypeText(`"WY" | "AL" | "AK"`), + ); + }); + + test('orders nested unions, intersections and object members', () => { + expect(canonicalizeTypeText(`{ b: string; a: "z" | "y" } | null`)).toBe( + `null | {a: "y" | "z"; b: string}`, + ); + expect(canonicalizeTypeText(`("b" | "a")[]`)).toBe(`("a" | "b")[]`); + expect(canonicalizeTypeText(`{ [k: string]: "b" | "a" }`)).toBe( + `{[k: string]: "a" | "b"}`, + ); + expect(canonicalizeTypeText(`{ b: 1 } & { a: 2 }`)).toBe(`{a: 2} & {b: 1}`); + }); + + test('keeps tuple elements in place', () => { + expect(canonicalizeTypeText(`[string, number, "b" | "a"]`)).toBe( + `[string, number, "a" | "b"]`, + ); + }); + + test('preserves optional and readonly members', () => { + expect(canonicalizeTypeText(`{ b?: string; a: number }`)).toBe( + `{a: number; b?: string}`, + ); + expect(canonicalizeTypeText(`{ readonly b: string; a: number }`)).toBe( + `{a: number; readonly b: string}`, + ); + }); + + test('is idempotent', () => { + const once = canonicalizeTypeText(`{ b: "2" | "1" } | "z" | "a"`); + + expect(canonicalizeTypeText(once)).toBe(once); + }); + + test('leaves text it cannot parse alone', () => { + expect(canonicalizeTypeText('this is not a type <<<')).toBe( + 'this is not a type <<<', + ); + expect(canonicalizeTypeText('ReadonlyJSONValue')).toBe('ReadonlyJSONValue'); + expect(canonicalizeTypeText('string')).toBe('string'); + }); +}); diff --git a/tests/utils.ts b/tests/utils.ts index cc9f128..55e31ee 100644 --- a/tests/utils.ts +++ b/tests/utils.ts @@ -1,5 +1,6 @@ import type {Schema, TableSchema, relationships} from '@rocicorp/zero'; import {expect} from 'vitest'; +import {canonicalizeZeroSchema} from '../src/canonicalize'; export type ZeroSchema = Schema; @@ -92,7 +93,12 @@ export function expectRelationsSchemaDeepEqual( export function expectSchemaDeepEqual(actual: ZeroSchema) { return { - toEqual(expected: ZeroSchema) { + // Fixtures are written in whatever order reads best, so the expected + // schema is canonicalized before comparing. `actual` is left alone, so a + // schema that came out in the wrong order still fails. + toEqual(rawExpected: ZeroSchema) { + const expected = canonicalizeZeroSchema(rawExpected); + expect({ __testKey: 'tables', keys: Object.keys(actual.tables),