@payloadcms/db-postgres 3.0.0-alpha.40 → 3.0.0-alpha.42
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/connect.d.ts.map +1 -1
- package/dist/connect.js +4 -48
- package/dist/connect.js.map +1 -0
- package/dist/create.js +1 -1
- package/dist/create.js.map +1 -0
- package/dist/createGlobal.js +1 -1
- package/dist/createGlobal.js.map +1 -0
- package/dist/createGlobalVersion.js +1 -1
- package/dist/createGlobalVersion.js.map +1 -0
- package/dist/createMigration.js +1 -1
- package/dist/createMigration.js.map +1 -0
- package/dist/createVersion.js +1 -1
- package/dist/createVersion.js.map +1 -0
- package/dist/deleteMany.js +1 -1
- package/dist/deleteMany.js.map +1 -0
- package/dist/deleteOne.js +1 -1
- package/dist/deleteOne.js.map +1 -0
- package/dist/deleteVersions.js +1 -1
- package/dist/deleteVersions.js.map +1 -0
- package/dist/destroy.d.ts.map +1 -1
- package/dist/destroy.js +8 -3
- package/dist/destroy.js.map +1 -0
- package/dist/find/buildFindManyArgs.js +1 -1
- package/dist/find/buildFindManyArgs.js.map +1 -0
- package/dist/find/chainMethods.js +1 -1
- package/dist/find/chainMethods.js.map +1 -0
- package/dist/find/findMany.js +1 -1
- package/dist/find/findMany.js.map +1 -0
- package/dist/find/traverseFields.js +1 -1
- package/dist/find/traverseFields.js.map +1 -0
- package/dist/find.js +1 -1
- package/dist/find.js.map +1 -0
- package/dist/findGlobal.js +1 -1
- package/dist/findGlobal.js.map +1 -0
- package/dist/findGlobalVersions.js +1 -1
- package/dist/findGlobalVersions.js.map +1 -0
- package/dist/findOne.js +1 -1
- package/dist/findOne.js.map +1 -0
- package/dist/findVersions.js +1 -1
- package/dist/findVersions.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -0
- package/dist/init.js +1 -1
- package/dist/init.js.map +1 -0
- package/dist/migrate.js +1 -1
- package/dist/migrate.js.map +1 -0
- package/dist/migrateDown.js +1 -1
- package/dist/migrateDown.js.map +1 -0
- package/dist/migrateFresh.js +1 -1
- package/dist/migrateFresh.js.map +1 -0
- package/dist/migrateRefresh.js +1 -1
- package/dist/migrateRefresh.js.map +1 -0
- package/dist/migrateReset.js +1 -1
- package/dist/migrateReset.js.map +1 -0
- package/dist/migrateStatus.js +1 -1
- package/dist/migrateStatus.js.map +1 -0
- package/dist/queries/buildAndOrConditions.js +1 -1
- package/dist/queries/buildAndOrConditions.js.map +1 -0
- package/dist/queries/buildQuery.js +1 -1
- package/dist/queries/buildQuery.js.map +1 -0
- package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js +1 -1
- package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js.map +1 -0
- package/dist/queries/createJSONQuery/formatJSONPathSegment.js +1 -1
- package/dist/queries/createJSONQuery/formatJSONPathSegment.js.map +1 -0
- package/dist/queries/createJSONQuery/index.js +1 -1
- package/dist/queries/createJSONQuery/index.js.map +1 -0
- package/dist/queries/getTableColumnFromPath.js +1 -1
- package/dist/queries/getTableColumnFromPath.js.map +1 -0
- package/dist/queries/operatorMap.js +1 -1
- package/dist/queries/operatorMap.js.map +1 -0
- package/dist/queries/parseParams.js +1 -1
- package/dist/queries/parseParams.js.map +1 -0
- package/dist/queries/sanitizeQueryValue.js +1 -1
- package/dist/queries/sanitizeQueryValue.js.map +1 -0
- package/dist/queryDrafts.js +1 -1
- package/dist/queryDrafts.js.map +1 -0
- package/dist/schema/build.js +1 -1
- package/dist/schema/build.js.map +1 -0
- package/dist/schema/createIndex.js +1 -1
- package/dist/schema/createIndex.js.map +1 -0
- package/dist/schema/idToUUID.js +1 -1
- package/dist/schema/idToUUID.js.map +1 -0
- package/dist/schema/parentIDColumnMap.js +1 -1
- package/dist/schema/parentIDColumnMap.js.map +1 -0
- package/dist/schema/setColumnID.js +1 -1
- package/dist/schema/setColumnID.js.map +1 -0
- package/dist/schema/traverseFields.js +1 -1
- package/dist/schema/traverseFields.js.map +1 -0
- package/dist/schema/validateExistingBlockIsIdentical.js +1 -1
- package/dist/schema/validateExistingBlockIsIdentical.js.map +1 -0
- package/dist/transactions/beginTransaction.js +1 -1
- package/dist/transactions/beginTransaction.js.map +1 -0
- package/dist/transactions/commitTransaction.js +1 -1
- package/dist/transactions/commitTransaction.js.map +1 -0
- package/dist/transactions/rollbackTransaction.js +1 -1
- package/dist/transactions/rollbackTransaction.js.map +1 -0
- package/dist/transform/read/hasManyNumber.js +1 -1
- package/dist/transform/read/hasManyNumber.js.map +1 -0
- package/dist/transform/read/hasManyText.js +1 -1
- package/dist/transform/read/hasManyText.js.map +1 -0
- package/dist/transform/read/index.js +1 -1
- package/dist/transform/read/index.js.map +1 -0
- package/dist/transform/read/relationship.js +1 -1
- package/dist/transform/read/relationship.js.map +1 -0
- package/dist/transform/read/traverseFields.js +1 -1
- package/dist/transform/read/traverseFields.js.map +1 -0
- package/dist/transform/write/array.js +1 -1
- package/dist/transform/write/array.js.map +1 -0
- package/dist/transform/write/blocks.js +1 -1
- package/dist/transform/write/blocks.js.map +1 -0
- package/dist/transform/write/index.js +1 -1
- package/dist/transform/write/index.js.map +1 -0
- package/dist/transform/write/numbers.js +1 -1
- package/dist/transform/write/numbers.js.map +1 -0
- package/dist/transform/write/relationships.js +1 -1
- package/dist/transform/write/relationships.js.map +1 -0
- package/dist/transform/write/selects.js +1 -1
- package/dist/transform/write/selects.js.map +1 -0
- package/dist/transform/write/texts.js +1 -1
- package/dist/transform/write/texts.js.map +1 -0
- package/dist/transform/write/traverseFields.js +1 -1
- package/dist/transform/write/traverseFields.js.map +1 -0
- package/dist/transform/write/types.js +1 -1
- package/dist/transform/write/types.js.map +1 -0
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -0
- package/dist/update.js +1 -1
- package/dist/update.js.map +1 -0
- package/dist/updateGlobal.js +1 -1
- package/dist/updateGlobal.js.map +1 -0
- package/dist/updateGlobalVersion.js +1 -1
- package/dist/updateGlobalVersion.js.map +1 -0
- package/dist/updateVersion.js +1 -1
- package/dist/updateVersion.js.map +1 -0
- package/dist/upsertRow/deleteExistingArrayRows.js +1 -1
- package/dist/upsertRow/deleteExistingArrayRows.js.map +1 -0
- package/dist/upsertRow/deleteExistingRowsByPath.js +1 -1
- package/dist/upsertRow/deleteExistingRowsByPath.js.map +1 -0
- package/dist/upsertRow/index.js +1 -1
- package/dist/upsertRow/index.js.map +1 -0
- package/dist/upsertRow/insertArrays.js +1 -1
- package/dist/upsertRow/insertArrays.js.map +1 -0
- package/dist/upsertRow/types.js +1 -1
- package/dist/upsertRow/types.js.map +1 -0
- package/dist/utilities/appendPrefixToKeys.js +1 -1
- package/dist/utilities/appendPrefixToKeys.js.map +1 -0
- package/dist/utilities/createBlocksMap.js +1 -1
- package/dist/utilities/createBlocksMap.js.map +1 -0
- package/dist/utilities/createMigrationTable.js +1 -1
- package/dist/utilities/createMigrationTable.js.map +1 -0
- package/dist/utilities/createRelationshipMap.js +1 -1
- package/dist/utilities/createRelationshipMap.js.map +1 -0
- package/dist/utilities/hasLocalesTable.js +1 -1
- package/dist/utilities/hasLocalesTable.js.map +1 -0
- package/dist/utilities/isArrayOfRows.js +1 -1
- package/dist/utilities/isArrayOfRows.js.map +1 -0
- package/dist/utilities/migrationTableExists.js +1 -1
- package/dist/utilities/migrationTableExists.js.map +1 -0
- package/dist/utilities/parseError.js +1 -1
- package/dist/utilities/parseError.js.map +1 -0
- package/dist/utilities/pushDevSchema.d.ts +9 -0
- package/dist/utilities/pushDevSchema.d.ts.map +1 -0
- package/dist/utilities/pushDevSchema.js +56 -0
- package/dist/utilities/pushDevSchema.js.map +1 -0
- package/package.json +3 -3
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/queries/getTableColumnFromPath.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport type { SQL } from 'drizzle-orm'\nimport type { PgTableWithColumns } from 'drizzle-orm/pg-core'\nimport type { Field, FieldAffectingData, NumberField, TabAsField, TextField } from 'payload/types'\n\nimport { and, eq, like, sql } from 'drizzle-orm'\nimport { alias } from 'drizzle-orm/pg-core'\nimport { APIError } from 'payload/errors'\nimport { fieldAffectsData, tabHasName } from 'payload/types'\nimport { flattenTopLevelFields } from 'payload/utilities'\nimport toSnakeCase from 'to-snake-case'\nimport { v4 as uuid } from 'uuid'\n\nimport type { GenericColumn, GenericTable, PostgresAdapter } from '../types.js'\nimport type { BuildQueryJoinAliases, BuildQueryJoins } from './buildQuery.js'\n\ntype Constraint = {\n columnName: string\n table: GenericTable | PgTableWithColumns<any>\n value: unknown\n}\n\ntype TableColumn = {\n columnName?: string\n constraints: Constraint[]\n field: FieldAffectingData\n getNotNullColumnByValue?: (val: unknown) => string\n pathSegments?: string[]\n rawColumn?: SQL\n table: GenericTable | PgTableWithColumns<any>\n}\n\ntype Args = {\n adapter: PostgresAdapter\n aliasTable?: GenericTable | PgTableWithColumns<any>\n collectionPath: string\n columnPrefix?: string\n constraintPath?: string\n constraints?: Constraint[]\n fields: (Field | TabAsField)[]\n joinAliases: BuildQueryJoinAliases\n joins: BuildQueryJoins\n locale?: string\n pathSegments: string[]\n rootTableName?: string\n selectFields: Record<string, GenericColumn>\n tableName: string\n /**\n * If creating a new table name for arrays and blocks, this suffix should be appended to the table name\n */\n tableNameSuffix?: string\n /**\n * The raw value of the query before sanitization\n */\n value: unknown\n}\n/**\n * Transforms path to table and column name\n * Adds tables to `join`\n * @returns TableColumn\n */\nexport const getTableColumnFromPath = ({\n adapter,\n aliasTable,\n collectionPath,\n columnPrefix = '',\n constraintPath: incomingConstraintPath,\n constraints = [],\n fields,\n joinAliases,\n joins,\n locale: incomingLocale,\n pathSegments: incomingSegments,\n rootTableName: incomingRootTableName,\n selectFields,\n tableName,\n tableNameSuffix = '',\n value,\n}: Args): TableColumn => {\n const fieldPath = incomingSegments[0]\n let locale = incomingLocale\n const rootTableName = incomingRootTableName || tableName\n let constraintPath = incomingConstraintPath || ''\n\n const field = flattenTopLevelFields(fields as Field[]).find(\n (fieldToFind) => fieldAffectsData(fieldToFind) && fieldToFind.name === fieldPath,\n ) as Field | TabAsField\n let newTableName = tableName\n\n if (!field && fieldPath === 'id') {\n selectFields.id = adapter.tables[newTableName].id\n return {\n columnName: 'id',\n constraints,\n field: {\n name: 'id',\n type: adapter.idType === 'uuid' ? 'text' : 'number',\n } as TextField | NumberField,\n table: adapter.tables[newTableName],\n }\n }\n\n if (field) {\n const pathSegments = [...incomingSegments]\n\n // If next segment is a locale,\n // we need to take it out and use it as the locale from this point on\n if ('localized' in field && field.localized && adapter.payload.config.localization) {\n const matchedLocale = adapter.payload.config.localization.localeCodes.find(\n (locale) => locale === pathSegments[1],\n )\n\n if (matchedLocale) {\n locale = matchedLocale\n pathSegments.splice(1, 1)\n }\n }\n\n switch (field.type) {\n case 'tabs': {\n return getTableColumnFromPath({\n adapter,\n aliasTable,\n collectionPath,\n columnPrefix,\n constraintPath,\n constraints,\n fields: field.tabs.map((tab) => ({\n ...tab,\n type: 'tab',\n })),\n joinAliases,\n joins,\n locale,\n pathSegments: pathSegments.slice(1),\n rootTableName,\n selectFields,\n tableName: newTableName,\n tableNameSuffix,\n value,\n })\n }\n case 'tab': {\n if (tabHasName(field)) {\n return getTableColumnFromPath({\n adapter,\n aliasTable,\n collectionPath,\n columnPrefix: `${columnPrefix}${field.name}_`,\n constraintPath: `${constraintPath}${field.name}.`,\n constraints,\n fields: field.fields,\n joinAliases,\n joins,\n locale,\n pathSegments: pathSegments.slice(1),\n rootTableName,\n selectFields,\n tableName: newTableName,\n tableNameSuffix: `${tableNameSuffix}${toSnakeCase(field.name)}_`,\n value,\n })\n }\n return getTableColumnFromPath({\n adapter,\n aliasTable,\n collectionPath,\n columnPrefix,\n constraintPath,\n constraints,\n fields: field.fields,\n joinAliases,\n joins,\n locale,\n pathSegments: pathSegments.slice(1),\n rootTableName,\n selectFields,\n tableName: newTableName,\n tableNameSuffix,\n value,\n })\n }\n\n case 'group': {\n if (locale && field.localized && adapter.payload.config.localization) {\n newTableName = `${tableName}_locales`\n\n joins[tableName] = eq(\n adapter.tables[tableName].id,\n adapter.tables[newTableName]._parentID,\n )\n if (locale !== 'all') {\n constraints.push({\n columnName: '_locale',\n table: adapter.tables[newTableName],\n value: locale,\n })\n }\n }\n return getTableColumnFromPath({\n adapter,\n aliasTable,\n collectionPath,\n columnPrefix: `${columnPrefix}${field.name}_`,\n constraintPath: `${constraintPath}${field.name}.`,\n constraints,\n fields: field.fields,\n joinAliases,\n joins,\n locale,\n pathSegments: pathSegments.slice(1),\n rootTableName,\n selectFields,\n tableName: newTableName,\n tableNameSuffix: `${tableNameSuffix}${toSnakeCase(field.name)}_`,\n value,\n })\n }\n\n case 'array': {\n newTableName = `${tableName}_${tableNameSuffix}${toSnakeCase(field.name)}`\n constraintPath = `${constraintPath}${field.name}.%.`\n if (locale && field.localized && adapter.payload.config.localization) {\n joins[newTableName] = and(\n eq(adapter.tables[tableName].id, adapter.tables[newTableName]._parentID),\n eq(adapter.tables[newTableName]._locale, locale),\n )\n if (locale !== 'all') {\n constraints.push({\n columnName: '_locale',\n table: adapter.tables[newTableName],\n value: locale,\n })\n }\n } else {\n joins[newTableName] = eq(\n adapter.tables[tableName].id,\n adapter.tables[newTableName]._parentID,\n )\n }\n return getTableColumnFromPath({\n adapter,\n collectionPath,\n constraintPath,\n constraints,\n fields: field.fields,\n joinAliases,\n joins,\n locale,\n pathSegments: pathSegments.slice(1),\n rootTableName,\n selectFields,\n tableName: newTableName,\n value,\n })\n }\n\n case 'blocks': {\n let blockTableColumn: TableColumn\n let newTableName: string\n\n // handle blockType queries\n if (pathSegments[1] === 'blockType') {\n // find the block config using the value\n const blockTypes = Array.isArray(value) ? value : [value]\n blockTypes.forEach((blockType) => {\n const block = field.blocks.find((block) => block.slug === blockType)\n newTableName = `${tableName}_blocks_${toSnakeCase(block.slug)}`\n joins[newTableName] = eq(\n adapter.tables[tableName].id,\n adapter.tables[newTableName]._parentID,\n )\n constraints.push({\n columnName: '_path',\n table: adapter.tables[newTableName],\n value: pathSegments[0],\n })\n })\n return {\n constraints,\n field,\n getNotNullColumnByValue: () => 'id',\n table: adapter.tables[tableName],\n }\n }\n\n const hasBlockField = field.blocks.some((block) => {\n newTableName = `${tableName}_blocks_${toSnakeCase(block.slug)}`\n constraintPath = `${constraintPath}${field.name}.%.`\n let result\n const blockConstraints = []\n const blockSelectFields = {}\n try {\n result = getTableColumnFromPath({\n adapter,\n collectionPath,\n constraintPath,\n constraints: blockConstraints,\n fields: block.fields,\n joinAliases,\n joins,\n locale,\n pathSegments: pathSegments.slice(1),\n rootTableName,\n selectFields: blockSelectFields,\n tableName: newTableName,\n value,\n })\n } catch (error) {\n // this is fine, not every block will have the field\n }\n if (!result) {\n return\n }\n blockTableColumn = result\n constraints = constraints.concat(blockConstraints)\n selectFields = { ...selectFields, ...blockSelectFields }\n if (field.localized && adapter.payload.config.localization) {\n joins[newTableName] = and(\n eq(adapter.tables[tableName].id, adapter.tables[newTableName]._parentID),\n eq(adapter.tables[newTableName]._locale, locale),\n )\n if (locale) {\n constraints.push({\n columnName: '_locale',\n table: adapter.tables[newTableName],\n value: locale,\n })\n }\n } else {\n joins[newTableName] = eq(\n adapter.tables[tableName].id,\n adapter.tables[newTableName]._parentID,\n )\n }\n return true\n })\n if (hasBlockField) {\n return {\n columnName: blockTableColumn.columnName,\n constraints,\n field: blockTableColumn.field,\n pathSegments: pathSegments.slice(1),\n rawColumn: blockTableColumn.rawColumn,\n table: blockTableColumn.table,\n }\n }\n break\n }\n\n case 'relationship':\n case 'upload': {\n let relationshipFields\n const relationTableName = `${rootTableName}_rels`\n const newCollectionPath = pathSegments.slice(1).join('.')\n const aliasRelationshipTableName = uuid()\n const aliasRelationshipTable = alias(\n adapter.tables[relationTableName],\n aliasRelationshipTableName,\n )\n\n // Join in the relationships table\n joinAliases.push({\n condition: and(\n eq((aliasTable || adapter.tables[rootTableName]).id, aliasRelationshipTable.parent),\n like(aliasRelationshipTable.path, `${constraintPath}${field.name}`),\n ),\n table: aliasRelationshipTable,\n })\n\n selectFields[`${relationTableName}.path`] = aliasRelationshipTable.path\n\n let newAliasTable\n\n if (typeof field.relationTo === 'string') {\n newTableName = `${toSnakeCase(field.relationTo)}`\n // parent to relationship join table\n relationshipFields = adapter.payload.collections[field.relationTo].config.fields\n\n newAliasTable = alias(adapter.tables[newTableName], toSnakeCase(uuid()))\n\n joinAliases.push({\n condition: eq(newAliasTable.id, aliasRelationshipTable[`${field.relationTo}ID`]),\n table: newAliasTable,\n })\n\n if (newCollectionPath === '' || newCollectionPath === 'id') {\n return {\n columnName: `${field.relationTo}ID`,\n constraints,\n field,\n table: aliasRelationshipTable,\n }\n }\n } else if (newCollectionPath === 'value') {\n const tableColumnsNames = field.relationTo.map(\n (relationTo) => `\"${aliasRelationshipTableName}\".\"${toSnakeCase(relationTo)}_id\"`,\n )\n return {\n constraints,\n field,\n rawColumn: sql.raw(`COALESCE(${tableColumnsNames.join(', ')})`),\n table: aliasRelationshipTable,\n }\n } else if (newCollectionPath === 'relationTo') {\n const relationTo = Array.isArray(field.relationTo) ? field.relationTo : [field.relationTo]\n\n return {\n constraints,\n field,\n getNotNullColumnByValue: (val) => {\n const matchedRelation = relationTo.find((relation) => relation === val)\n if (matchedRelation) return `${matchedRelation}ID`\n return undefined\n },\n table: aliasRelationshipTable,\n }\n } else {\n throw new APIError('Not supported')\n }\n\n return getTableColumnFromPath({\n adapter,\n aliasTable: newAliasTable,\n collectionPath: newCollectionPath,\n constraints,\n fields: relationshipFields,\n joinAliases,\n joins,\n locale,\n pathSegments: pathSegments.slice(1),\n rootTableName: newTableName,\n selectFields,\n tableName: newTableName,\n value,\n })\n }\n\n default: {\n if (fieldAffectsData(field)) {\n if (field.localized && adapter.payload.config.localization) {\n // If localized, we go to localized table and set aliasTable to undefined\n // so it is not picked up below to be used as targetTable\n newTableName = `${tableName}_locales`\n\n const parentTable = aliasTable || adapter.tables[tableName]\n\n joins[newTableName] = eq(parentTable.id, adapter.tables[newTableName]._parentID)\n\n aliasTable = undefined\n\n if (locale !== 'all') {\n constraints.push({\n columnName: '_locale',\n table: adapter.tables[newTableName],\n value: locale,\n })\n }\n }\n\n const targetTable = aliasTable || adapter.tables[newTableName]\n\n selectFields[`${newTableName}.${columnPrefix}${field.name}`] =\n targetTable[`${columnPrefix}${field.name}`]\n\n return {\n columnName: `${columnPrefix}${field.name}`,\n constraints,\n field,\n pathSegments,\n table: targetTable,\n }\n }\n }\n }\n }\n\n throw new APIError(`Cannot find field for path at ${fieldPath}`)\n}\n"],"names":["and","eq","like","sql","alias","APIError","fieldAffectsData","tabHasName","flattenTopLevelFields","toSnakeCase","v4","uuid","getTableColumnFromPath","adapter","aliasTable","collectionPath","columnPrefix","constraintPath","incomingConstraintPath","constraints","fields","joinAliases","joins","locale","incomingLocale","pathSegments","incomingSegments","rootTableName","incomingRootTableName","selectFields","tableName","tableNameSuffix","value","fieldPath","field","find","fieldToFind","name","newTableName","id","tables","columnName","type","idType","table","localized","payload","config","localization","matchedLocale","localeCodes","splice","tabs","map","tab","slice","_parentID","push","_locale","blockTableColumn","blockTypes","Array","isArray","forEach","blockType","block","blocks","slug","getNotNullColumnByValue","hasBlockField","some","result","blockConstraints","blockSelectFields","error","concat","rawColumn","relationshipFields","relationTableName","newCollectionPath","join","aliasRelationshipTableName","aliasRelationshipTable","condition","parent","path","newAliasTable","relationTo","collections","tableColumnsNames","raw","val","matchedRelation","relation","undefined","parentTable","targetTable"],"mappings":"AAAA,oCAAoC,GAKpC,SAASA,GAAG,EAAEC,EAAE,EAAEC,IAAI,EAAEC,GAAG,QAAQ,cAAa;AAChD,SAASC,KAAK,QAAQ,sBAAqB;AAC3C,SAASC,QAAQ,QAAQ,iBAAgB;AACzC,SAASC,gBAAgB,EAAEC,UAAU,QAAQ,gBAAe;AAC5D,SAASC,qBAAqB,QAAQ,oBAAmB;AACzD,OAAOC,iBAAiB,gBAAe;AACvC,SAASC,MAAMC,IAAI,QAAQ,OAAM;AA6CjC;;;;CAIC,GACD,OAAO,MAAMC,yBAAyB,CAAC,EACrCC,OAAO,EACPC,UAAU,EACVC,cAAc,EACdC,eAAe,EAAE,EACj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AAS;oBACP,IAAI1B,iBAAiB4B,QAAQ;wBAC3B,IAAIA,MAAMW,SAAS,IAAIhC,QAAQiC,OAAO,CAACC,MAAM,CAACC,YAAY,EAAE;4BAC1D,yEAAyE;4BACzE,yDAAyD;4BACzDV,eAAe,CAAC,EAAER,UAAU,QAAQ,CAAC;4BAErC,MAAMiE,cAAcjF,cAAcD,QAAQ2B,MAAM,CAACV,UAAU;4BAE3DR,KAAK,CAACgB,aAAa,GAAGrC,GAAG8F,YAAYxD,EAAE,EAAE1B,QAAQ2B,MAAM,CAACF,aAAa,CAACkB,SAAS;4BAE/E1C,aAAagF;4BAEb,IAAIvE,WAAW,OAAO;gCACpBJ,YAAYsC,IAAI,CAAC;oCACfhB,YAAY;oCACZG,OAAO/B,QAAQ2B,MAAM,CAACF,aAAa;oCACnCN,OAAOT;gCACT;4BACF;wBACF;wBAEA,MAAMyE,cAAclF,cAAcD,QAAQ2B,MAAM,CAACF,aAAa;wBAE9DT,YAAY,CAAC,CAAC,EAAES,aAAa,CAAC,EAAEtB,aAAa,EAAEkB,MAAMG,IAAI,CAAC,CAAC,CAAC,GAC1D2D,WAAW,CAAC,CAAC,EAAEhF,aAAa,EAAEkB,MAAMG,IAAI,CAAC,CAAC,CAAC;wBAE7C,OAAO;4BACLI,YAAY,CAAC,EAAEzB,aAAa,EAAEkB,MAAMG,IAAI,CAAC,CAAC;4BAC1ClB;4BACAe;4BACAT;4BACAmB,OAAOoD;wBACT;oBACF;gBACF;QACF;IACF;IAEA,MAAM,IAAI3F,SAAS,CAAC,8BAA8B,EAAE4B,UAAU,CAAC;AACjE,EAAC"}
|
@@ -21,4 +21,4 @@ export const operatorMap = {
|
|
21
21
|
or
|
22
22
|
};
|
23
23
|
|
24
|
-
//# sourceMappingURL=
|
24
|
+
//# sourceMappingURL=operatorMap.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/queries/operatorMap.ts"],"sourcesContent":["import {\n and,\n eq,\n gt,\n gte,\n ilike,\n inArray,\n isNotNull,\n isNull,\n lt,\n lte,\n ne,\n notInArray,\n or,\n} from 'drizzle-orm'\n\nexport const operatorMap = {\n // intersects: intersects,\n and,\n contains: ilike,\n equals: eq,\n exists: isNotNull,\n greater_than: gt,\n greater_than_equal: gte,\n in: inArray,\n isNull, // handles exists: false\n less_than: lt,\n less_than_equal: lte,\n like: ilike,\n not_equals: ne,\n // TODO: geojson queries\n // near: near,\n // within: within,\n // all: all,\n not_in: notInArray,\n or,\n}\n"],"names":["and","eq","gt","gte","ilike","inArray","isNotNull","isNull","lt","lte","ne","notInArray","or","operatorMap","contains","equals","exists","greater_than","greater_than_equal","in","less_than","less_than_equal","like","not_equals","not_in"],"mappings":"AAAA,SACEA,GAAG,EACHC,EAAE,EACFC,EAAE,EACFC,GAAG,EACHC,KAAK,EACLC,OAAO,EACPC,SAAS,EACTC,MAAM,EACNC,EAAE,EACFC,GAAG,EACHC,EAAE,EACFC,UAAU,EACVC,EAAE,QACG,cAAa;AAEpB,OAAO,MAAMC,cAAc;IACzB,0BAA0B;IAC1Bb;IACAc,UAAUV;IACVW,QAAQd;IACRe,QAAQV;IACRW,cAAcf;IACdgB,oBAAoBf;IACpBgB,IAAId;IACJE;IACAa,WAAWZ;IACXa,iBAAiBZ;IACjBa,MAAMlB;IACNmB,YAAYb;IACZ,wBAAwB;IACxB,cAAc;IACd,kBAAkB;IAClB,YAAY;IACZc,QAAQb;IACRC;AACF,EAAC"}
|
@@ -179,4 +179,4 @@ export async function parseParams({ adapter, fields, joinAliases, joins, locale,
|
|
179
179
|
return result;
|
180
180
|
}
|
181
181
|
|
182
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9xdWVyaWVzL3BhcnNlUGFyYW1zLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8qIGVzbGludC1kaXNhYmxlIG5vLWF3YWl0LWluLWxvb3AgKi9cbmltcG9ydCB0eXBlIH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mVlZCB0byBsb29wIG9uIGtleXMgYWdhaW4gaGVyZSB0byBoYW5kbGUgZWFjaCBvcGVyYXRvciBpbmRlcGVuZGVudGx5XG4gICAgICAgICAgY29uc3QgcGF0aE9wZXJhdG9ycyA9IHdoZXJlW3JlbGF0aW9uT3JQYXRoXVxuICAgICAgICAgIGlmICh0eXBlb2YgcGF0aE9wZXJhdG9ycyA9PT0gJ29iamVjdCcpIHtcbiAgICAgICAgICAgIGZvciAoY29uc3Qgb3BlcmF0b3Igb2YgT2JqZWN0LmtleXMocGF0aE9wZXJhdG9ycykpIHtcbiAgICAgICAgICAgICAgaWYgKHZhbGlkT3BlcmF0b3JzLmluY2x1ZGVzKG9wZXJhdG9yIGFzIE9wZXJhdG9yKSkge1xuICAgICAgICAgICAgICAgIGNvbnN0IHZhbCA9IHdoZXJlW3JlbGF0aW9uT3JQYXRoXVtvcGVyYXRvcl1cbiAgICAgICAgICAgICAgICBjb25zdCB7XG4gICAgICAgICAgICAgICAgICBjb2x1bW5OYW1lLFxuICAgICAgICAgICAgICAgICAgY29uc3RyYWludHM6IHF1ZXJ5Q29uc3RyYWludHMsXG4gICAgICAgICAgICAgICAgICBmaWVsZCxcbiAgICAgICAgICAgICAgICAgIGdldE5vdE51bGxDb2x1bW5CeVZhbHVlLFxuICAgICAgICAgICAgICAgICAgcGF0aFNlZ21lbnRzLFxuICAgICAgICAgICAgICAgICAgcmF3Q29sdW1uLFxuICAgICAgICAgICAgICAgICAgdGFibGUsXG4gICAgICAgICAgICAgICAgfSA9IGdldFRhYmxlQ29sdW1uRnJvbVBhdGgoe1xuICAgICAgICAgICAgICAgICAgYWRhcHRlcixcbiAgICAgICAgICAgICAgICAgIGNvbGxlY3Rpb25QYXRoOiByZWxhdGlvbk9yUGF0aCxcbiAgICAgICAgICAgICAgICAgIGZpZWxkcyxcbiAgICAgICAgICAgICAgICAgIGpvaW5BbGlhc2VzLFxuICAgICAgICAgICAgICAgICAgam9pbnMsXG4gICAgICAgICAgICAgICAgICBsb2NhbGUsXG4gICAgICAgICAgICAgICAgICBwYXRoU2VnbWVudHM6IHJlbGF0aW9uT3JQYXRoLnJlcGxhY2UoL19fL2csICcuJykuc3BsaXQoJy4nKSxcbiAgICAgICAgICAgICAgICAgIHNlbGVjdEZpZWxkcyxcbiAgICAgICAgICAgICAgICAgIHRhYmxlTmFtZSxcbiAgICAgICAgICAgICAgICAgIHZhbHVlOiB2YWwsXG4gICAgICAgICAgICAgICAgfSlcblxuICAgICAgICAgICAgICAgIHF1ZXJ5Q29uc3RyYWludHMuZm9yRWFjaCgoeyBjb2x1bW5OYW1lOiBjb2wsIHRhYmxlOiBjb25zdHJhaW50VGFibGUsIHZhbHVlIH0pID0+IHtcbiAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgdmFsdWUgPT09ICdzdHJpbmcnICYmIHZhbHVlLmluZGV4T2YoJyUnKSA+IC0xKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0cmFpbnRzLnB1c2gob3BlcmF0b3JNYXAubGlrZShjb25zdHJhaW50VGFibGVbY29sXSwgdmFsdWUpKVxuICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3RyYWludHMucHVzaChvcGVyYXRvck1hcC5lcXVhbHMoY29uc3RyYWludFRhYmxlW2NvbF0sIHZhbHVlKSlcbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9KVxuXG4gICAgICAgICAgICAgICAgaWYgKFxuICAgICAgICAgICAgICAgICAgWydqc29uJywgJ3JpY2hUZXh0J10uaW5jbHVkZXMoZmllbGQudHlwZSkgJiZcbiAgICAgICAgICAgICAgICAgIEFycmF5LmlzQXJyYXkocGF0aFNlZ21lbnRzKSAmJlxuICAgICAgICAgICAgICAgICAgcGF0aFNlZ21lbnRzLmxlbmd0aCA+IDFcbiAgICAgICAgICAgICAgICApIHtcbiAgICAgICAgICAgICAgICAgIGNvbnN0IHNlZ21lbnRzID0gcGF0aFNlZ21lbnRzLnNsaWNlKDEpXG4gICAgICAgICAgICAgICAgICBzZWdtZW50cy51bnNoaWZ0KHRhYmxlW2NvbHVtbk5hbWVdLm5hbWUpXG5cbiAgICAgICAgICAgICAgICAgIGlmIChmaWVsZC50eXBlID09PSAncmljaFRleHQnKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGpzb25RdWVyeSA9IGNyZWF0ZUpTT05RdWVyeSh7XG4gICAgICAgICAgICAgICAgICAgICAgb3BlcmF0b3IsXG4gICAgICAgICAgICAgICAgICAgICAgcGF0aFNlZ21lbnRzOiBzZWdtZW50cyxcbiAgICAgICAgICAgICAgICAgICAgICB0cmVhdEFzQXJyYXk6IFsnY2hpbGRyZW4nXSxcbiAgICAgICAgICAgICAgICAgICAgICB0cmVhdFJvb3RBc0FycmF5OiB0cnVlLFxuICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiB2YWwsXG4gICAgICAgICAgICAgICAgICAgIH0pXG5cbiAgICAgICAgICAgICAgICAgICAgY29uc3RyYWludHMucHVzaChzcWwucmF3KGpzb25RdWVyeSkpXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrXG4gICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgIGNvbnN0IGpzb25RdWVyeSA9IGNvbnZlcnRQYXRoVG9KU09OVHJhdmVyc2FsKHBhdGhTZWdtZW50cylcbiAgICAgICAgICAgICAgICAgIGNvbnN0IG9wZXJhdG9yS2V5cyA9IHtcbiAgICAgICAgICAgICAgICAgICAgY29udGFpbnM6IHsgb3BlcmF0b3I6ICdpbGlrZScsIHdpbGRjYXJkOiAnJScgfSxcbiAgICAgICAgICAgICAgICAgICAgZXF1YWxzOiB7IG9wZXJhdG9yOiAnPScsIHdpbGRjYXJkOiAnJyB9LFxuICAgICAgICAgICAgICAgICAgICBleGlzdHM6IHsgb3BlcmF0b3I6IHZhbCA9PT0gdHJ1ZSA/ICdpcyBub3QgbnVsbCcgOiAnaXMgbnVsbCcgfSxcbiAgICAgICAgICAgICAgICAgICAgbGlrZTogeyBvcGVyYXRvcjogJ2xpa2UnLCB3aWxkY2FyZDogJyUnIH0sXG4gICAgICAgICAgICAgICAgICAgIG5vdF9lcXVhbHM6IHsgb3BlcmF0b3I6ICc8PicsIHdpbGRjYXJkOiAnJyB9LFxuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgbGV0IGZvcm1hdHRlZFZhbHVlID0gYCcke29wZXJhdG9yS2V5c1tvcGVyYXRvcl0ud2lsZGNhcmR9JHt2YWx9JHtvcGVyYXRvcktleXNbb3BlcmF0b3JdLndpbGRjYXJkfSdgXG5cbiAgICAgICAgICAgICAgICAgIGlmIChvcGVyYXRvciA9PT0gJ2V4aXN0cycpIHtcbiAgICAgICAgICAgICAgICAgICAgZm9ybWF0dGVkVmFsdWUgPSAnJ1xuICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICBjb25zdHJhaW50cy5wdXNoKFxuICAgICAgICAgICAgICAgICAgICBzcWwucmF3KFxuICAgICAgICAgICAgICAgICAgICAgIGAke3RhYmxlW2NvbHVtbk5hbWVdLm5hbWV9JHtqc29uUXVlcnl9ICR7b3BlcmF0b3JLZXlzW29wZXJhdG9yXS5vcGVyYXRvcn0gJHtmb3JtYXR0ZWRWYWx1ZX1gLFxuICAgICAgICAgICAgICAgICAgICApLFxuICAgICAgICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICAgICAgICBicmVha1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmIChnZXROb3ROdWxsQ29sdW1uQnlWYWx1ZSkge1xuICAgICAgICAgICAgICAgICAgY29uc3QgY29sdW1uTmFtZSA9IGdldE5vdE51bGxDb2x1bW5CeVZhbHVlKHZhbClcbiAgICAgICAgICAgICAgICAgIGlmIChjb2x1bW5OYW1lKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0cmFpbnRzLnB1c2goaXNOb3ROdWxsKHRhYmxlW2NvbHVtbk5hbWVdKSlcbiAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBRdWVyeUVycm9yKFt7IHBhdGg6IHJlbGF0aW9uT3JQYXRoIH1dKVxuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgYnJlYWtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAob3BlcmF0b3IgPT09ICdsaWtlJykge1xuICAgICAgICAgICAgICAgICAgY29uc3RyYWludHMucHVzaChcbiAgICAgICAgICAgICAgICAgICAgYW5kKC4uLnZhbC5zcGxpdCgnICcpLm1hcCgod29yZCkgPT4gaWxpa2UodGFibGVbY29sdW1uTmFtZV0sIGAlJHt3b3JkfSVgKSkpLFxuICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgICAgYnJlYWtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBjb25zdCBzYW5pdGl6ZWRRdWVyeVZhbHVlID0gc2FuaXRpemVRdWVyeVZhbHVlKHtcbiAgICAgICAgICAgICAgICAgIGFkYXB0ZXIsXG4gICAgICAgICAgICAgICAgICBmaWVsZCxcbiAgICAgICAgICAgICAgICAgIG9wZXJhdG9yLFxuICAgICAgICAgICAgICAgICAgcmVsYXRpb25PclBhdGgsXG4gICAgICAgICAgICAgICAgICB2YWwsXG4gICAgICAgICAgICAgICAgfSlcblxuICAgICAgICAgICAgICAgIGlmIChzYW5pdGl6ZWRRdWVyeVZhbHVlID09PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICBicmVha1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGNvbnN0IHsgb3BlcmF0b3I6IHF1ZXJ5T3BlcmF0b3IsIHZhbHVlOiBxdWVyeVZhbHVlIH0gPSBzYW5pdGl6ZWRRdWVyeVZhbHVlXG5cbiAgICAgICAgICAgICAgICBpZiAocXVlcnlPcGVyYXRvciA9PT0gJ25vdF9lcXVhbHMnICYmIHF1ZXJ5VmFsdWUgIT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgIGNvbnN0cmFpbnRzLnB1c2goXG4gICAgICAgICAgICAgICAgICAgIG9yKFxuICAgICAgICAgICAgICAgICAgICAgIGlzTnVsbChyYXdDb2x1bW4gfHwgdGFibGVbY29sdW1uTmFtZV0pLFxuICAgICAgICAgICAgICAgICAgICAgIC8qIGVzbGludC1kaXNhYmxlIEB0eXBlc2NyaXB0LWVzbGludC9uby1leHBsaWNpdC1hbnkgKi9cbiAgICAgICAgICAgICAgICAgICAgICBuZTxhbnk+KHJhd0NvbHVtbiB8fCB0YWJsZVtjb2x1bW5OYW1lXSwgcXVlcnlWYWx1ZSksXG4gICAgICAgICAgICAgICAgICAgICksXG4gICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgICBicmVha1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmIChcbiAgICAgICAgICAgICAgICAgIChmaWVsZC50eXBlID09PSAncmVsYXRpb25zaGlwJyB8fCBmaWVsZC50eXBlID09PSAndXBsb2FkJykgJiZcbiAgICAgICAgICAgICAgICAgIEFycmF5LmlzQXJyYXkocXVlcnlWYWx1ZSkgJiZcbiAgICAgICAgICAgICAgICAgIG9wZXJhdG9yID09PSAnbm90X2luJ1xuICAgICAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICAgICAgY29uc3RyYWludHMucHVzaChcbiAgICAgICAgICAgICAgICAgICAgc3FsYCR7bm90SW5BcnJheSh0YWJsZVtjb2x1bW5OYW1lXSwgcXVlcnlWYWx1ZSl9IE9SXG4gICAgICAgICAgICAgICAgICAgICR7dGFibGVbY29sdW1uTmFtZV19XG4gICAgICAgICAgICAgICAgICAgIElTXG4gICAgICAgICAgICAgICAgICAgIE5VTExgLFxuICAgICAgICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICAgICAgICBicmVha1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmIChvcGVyYXRvciA9PT0gJ2VxdWFscycgJiYgcXVlcnlWYWx1ZSA9PT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgY29uc3RyYWludHMucHVzaChpc051bGwocmF3Q29sdW1uIHx8IHRhYmxlW2NvbHVtbk5hbWVdKSlcbiAgICAgICAgICAgICAgICAgIGJyZWFrXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgaWYgKG9wZXJhdG9yID09PSAnbm90X2VxdWFscycgJiYgcXVlcnlWYWx1ZSA9PT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgY29uc3RyYWludHMucHVzaChpc05vdE51bGwocmF3Q29sdW1uIHx8IHRhYmxlW2NvbHVtbk5hbWVdKSlcbiAgICAgICAgICAgICAgICAgIGJyZWFrXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgY29uc3RyYWludHMucHVzaChcbiAgICAgICAgICAgICAgICAgIG9wZXJhdG9yTWFwW3F1ZXJ5T3BlcmF0b3JdKHJhd0NvbHVtbiB8fCB0YWJsZVtjb2x1bW5OYW1lXSwgcXVlcnlWYWx1ZSksXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuICB9XG4gIGlmIChjb25zdHJhaW50cy5sZW5ndGggPiAwKSB7XG4gICAgaWYgKHJlc3VsdCkge1xuICAgICAgcmVzdWx0ID0gYW5kKHJlc3VsdCwgLi4uY29uc3RyYWludHMpXG4gICAgfSBlbHNlIHtcbiAgICAgIHJlc3VsdCA9IGFuZCguLi5jb25zdHJhaW50cylcbiAgICB9XG4gIH1cbiAgaWYgKGNvbnN0cmFpbnRzLmxlbmd0aCA9PT0gMSAmJiAhcmVzdWx0KSB7XG4gICAgO1tyZXN1bHRdID0gY29uc3RyYWludHNcbiAgfVxuXG4gIHJldHVybiBy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sourcesContent":["/* eslint-disable no-await-in-loop */\nimport type { SQL } from 'drizzle-orm'\nimport type { Field, Operator, Where } from 'payload/types'\n\nimport { and, ilike, isNotNull, isNull, ne, notInArray, or, sql } from 'drizzle-orm'\nimport { QueryError } from 'payload/errors'\nimport { validOperators } from 'payload/types'\n\nimport type { GenericColumn, PostgresAdapter } from '../types.js'\nimport type { BuildQueryJoinAliases, BuildQueryJoins } from './buildQuery.js'\n\nimport { buildAndOrConditions } from './buildAndOrConditions.js'\nimport { createJSONQuery } from './createJSONQuery/index.js'\nimport { convertPathToJSONTraversal } from './createJSONQuery/convertPathToJSONTraversal.js'\nimport { getTableColumnFromPath } from './getTableColumnFromPath.js'\nimport { operatorMap } from './operatorMap.js'\nimport { sanitizeQueryValue } from './sanitizeQueryValue.js'\n\ntype Args = {\n adapter: PostgresAdapter\n fields: Field[]\n joinAliases: BuildQueryJoinAliases\n joins: BuildQueryJoins\n locale: string\n selectFields: Record<string, GenericColumn>\n tableName: string\n where: Where\n}\n\nexport async function parseParams({\n adapter,\n fields,\n joinAliases,\n joins,\n locale,\n selectFields,\n tableName,\n where,\n}: Args): Promise<SQL> {\n let result: SQL\n const constraints: SQL[] = []\n\n if (typeof where === 'object' && Object.keys(where).length > 0) {\n // We need to determine if the whereKey is an AND, OR, or a schema path\n for (const relationOrPath of Object.keys(where)) {\n if (relationOrPath) {\n const condition = where[relationOrPath]\n let conditionOperator: 'and' | 'or'\n if (relationOrPath.toLowerCase() === 'and') {\n conditionOperator = 'and'\n } else if (relationOrPath.toLowerCase() === 'or') {\n conditionOperator = 'or'\n }\n if (Array.isArray(condition)) {\n const builtConditions = await buildAndOrConditions({\n adapter,\n fields,\n joinAliases,\n joins,\n locale,\n selectFields,\n tableName,\n where: condition,\n })\n if (builtConditions.length > 0) {\n result = operatorMap[conditionOperator](...builtConditions)\n }\n } else {\n // It's a path - and there can be multiple comparisons on a single path.\n // For example - title like 'test' and title not equal to 'tester'\n // So we need to loop on keys again here to handle each operator independently\n const pathOperators = where[relationOrPath]\n if (typeof pathOperators === 'object') {\n for (const operator of Object.keys(pathOperators)) {\n if (validOperators.includes(operator as Operator)) {\n const val = where[relationOrPath][operator]\n const {\n columnName,\n constraints: queryConstraints,\n field,\n getNotNullColumnByValue,\n pathSegments,\n rawColumn,\n table,\n } = getTableColumnFromPath({\n adapter,\n collectionPath: relationOrPath,\n fields,\n joinAliases,\n joins,\n locale,\n pathSegments: relationOrPath.replace(/__/g, '.').split('.'),\n selectFields,\n tableName,\n value: val,\n })\n\n queryConstraints.forEach(({ columnName: col, table: constraintTable, value }) => {\n if (typeof value === 'string' && value.indexOf('%') > -1) {\n constraints.push(operatorMap.like(constraintTable[col], value))\n } else {\n constraints.push(operatorMap.equals(constraintTable[col], value))\n }\n })\n\n if (\n ['json', 'richText'].includes(field.type) &&\n Array.isArray(pathSegments) &&\n pathSegments.length > 1\n ) {\n const segments = pathSegments.slice(1)\n segments.unshift(table[columnName].name)\n\n if (field.type === 'richText') {\n const jsonQuery = createJSONQuery({\n operator,\n pathSegments: segments,\n treatAsArray: ['children'],\n treatRootAsArray: true,\n value: val,\n })\n\n constraints.push(sql.raw(jsonQuery))\n break\n }\n\n const jsonQuery = convertPathToJSONTraversal(pathSegments)\n const operatorKeys = {\n contains: { operator: 'ilike', wildcard: '%' },\n equals: { operator: '=', wildcard: '' },\n exists: { operator: val === true ? 'is not null' : 'is null' },\n like: { operator: 'like', wildcard: '%' },\n not_equals: { operator: '<>', wildcard: '' },\n }\n let formattedValue = `'${operatorKeys[operator].wildcard}${val}${operatorKeys[operator].wildcard}'`\n\n if (operator === 'exists') {\n formattedValue = ''\n }\n\n constraints.push(\n sql.raw(\n `${table[columnName].name}${jsonQuery} ${operatorKeys[operator].operator} ${formattedValue}`,\n ),\n )\n\n break\n }\n\n if (getNotNullColumnByValue) {\n const columnName = getNotNullColumnByValue(val)\n if (columnName) {\n constraints.push(isNotNull(table[columnName]))\n } else {\n throw new QueryError([{ path: relationOrPath }])\n }\n break\n }\n\n if (operator === 'like') {\n constraints.push(\n and(...val.split(' ').map((word) => ilike(table[columnName], `%${word}%`))),\n )\n break\n }\n\n const sanitizedQueryValue = sanitizeQueryValue({\n adapter,\n field,\n operator,\n relationOrPath,\n val,\n })\n\n if (sanitizedQueryValue === null) {\n break\n }\n\n const { operator: queryOperator, value: queryValue } = sanitizedQueryValue\n\n if (queryOperator === 'not_equals' && queryValue !== null) {\n constraints.push(\n or(\n isNull(rawColumn || table[columnName]),\n /* eslint-disable @typescript-eslint/no-explicit-any */\n ne<any>(rawColumn || table[columnName], queryValue),\n ),\n )\n break\n }\n\n if (\n (field.type === 'relationship' || field.type === 'upload') &&\n Array.isArray(queryValue) &&\n operator === 'not_in'\n ) {\n constraints.push(\n sql`${notInArray(table[columnName], queryValue)} OR\n ${table[columnName]}\n IS\n NULL`,\n )\n\n break\n }\n\n if (operator === 'equals' && queryValue === null) {\n constraints.push(isNull(rawColumn || table[columnName]))\n break\n }\n\n if (operator === 'not_equals' && queryValue === null) {\n constraints.push(isNotNull(rawColumn || table[columnName]))\n break\n }\n\n constraints.push(\n operatorMap[queryOperator](rawColumn || table[columnName], queryValue),\n )\n }\n }\n }\n }\n }\n }\n }\n if (constraints.length > 0) {\n if (result) {\n result = and(result, ...constraints)\n } else {\n result = and(...constraints)\n }\n }\n if (constraints.length === 1 && !result) {\n ;[result] = constraints\n }\n\n return result\n}\n"],"names":["and","ilike","isNotNull","isNull","ne","notInArray","or","sql","QueryError","validOperators","buildAndOrConditions","createJSONQuery","convertPathToJSONTraversal","getTableColumnFromPath","operatorMap","sanitizeQueryValue","parseParams","adapter","fields","joinAliases","joins","locale","selectFields","tableName","where","result","constraints","Object","keys","length","relationOrPath","condition","conditionOperator","toLowerCase","Array","isArray","builtConditions","pathOperators","operator","includes","val","columnName","queryConstraints","field","getNotNullColumnByValue","pathSegments","rawColumn","table","collectionPath","replace","split","value","forEach","col","constraintTable","indexOf","push","like","equals","type","segments","slice","unshift","name","jsonQuery","treatAsArray","treatRootAsArray","raw","operatorKeys","contains","wildcard","exists","not_equals","formattedValue","path","map","word","sanitizedQueryValue","queryOperator","queryValue"],"mappings":"AAAA,mCAAmC,GAInC,SAASA,GAAG,EAAEC,KAAK,EAAEC,SAAS,EAAEC,MAAM,EAAEC,EAAE,EAAEC,UAAU,EAAEC,EAAE,EAAEC,GAAG,QAAQ,cAAa;AACpF,SAASC,UAAU,QAAQ,iBAAgB;AAC3C,SAASC,cAAc,QAAQ,gBAAe;AAK9C,SAASC,oBAAoB,QAAQ,4BAA2B;AAChE,SAASC,eAAe,QAAQ,6BAA4B;AAC5D,SAASC,0BAA0B,QAAQ,kDAAiD;AAC5F,SAASC,sBAAsB,QAAQ,8BAA6B;AACpE,SAASC,WAAW,QAAQ,mBAAkB;AAC9C,SAASC,kBAAkB,QAAQ,0BAAyB;AAa5D,OAAO,eAAeC,YAAY,EAChCC,OAAO,EACPC,MAAM,EACNC,WAAW,EACXC,KAAK,EACLC,MAAM,EACNC,YAAY,EACZC,SAAS,EACTC,KAAK,EACA;IACL,IAAIC;IACJ,MAAMC,cAAqB,EAAE;IAE7B,IAAI,OAAOF,UAAU,YAAYG,OAAOC,IAAI,CAACJ,OAAOK,MAAM,GAAG,GAAG;QAC9D,uEAAuE;QACvE,KAAK,MAAMC,kBAAkBH,OAAOC,IAAI,CAACJ,OAAQ;YAC/C,IAAIM,gBAAgB;gBAClB,MAAMC,YAAYP,KAAK,CAACM,eAAe;gBACvC,IAAIE;gBACJ,IAAIF,eAAeG,WAAW,OAAO,OAAO;oBAC1CD,oBAAoB;gBACtB,OAAO,IAAIF,eAAeG,WAAW,OAAO,MAAM;oBAChDD,oBAAoB;gBACtB;gBACA,IAAIE,MAAMC,OAAO,CAACJ,YAAY;oBAC5B,MAAMK,kBAAkB,MAAM1B,qBAAqB;wBACjDO;wBACAC;wBACAC;wBACAC;wBACAC;wBACAC;wBACAC;wBACAC,OAAOO;oBACT;oBACA,IAAIK,gBAAgBP,MAAM,GAAG,GAAG;w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QACF;IACF;IACA,IAAIrD,YAAYG,MAAM,GAAG,GAAG;QAC1B,IAAIJ,QAAQ;YACVA,SAASzB,IAAIyB,WAAWC;QAC1B,OAAO;YACLD,SAASzB,OAAO0B;QAClB;IACF;IACA,IAAIA,YAAYG,MAAM,KAAK,KAAK,CAACJ,QAAQ;QACtC,CAACA,OAAO,GAAGC;IACd;IAEA,OAAOD;AACT"}
|
@@ -84,4 +84,4 @@ export const sanitizeQueryValue = ({ adapter, field, operator: operatorArg, rela
|
|
84
84
|
};
|
85
85
|
};
|
86
86
|
|
87
|
-
//# sourceMappingURL=
|
87
|
+
//# sourceMappingURL=sanitizeQueryValue.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/queries/sanitizeQueryValue.ts"],"sourcesContent":["import { APIError } from 'payload/errors'\nimport { type Field, type TabAsField, fieldAffectsData } from 'payload/types'\nimport { createArrayFromCommaDelineated } from 'payload/utilities'\n\nimport type { PostgresAdapter } from '../types.js'\n\ntype SanitizeQueryValueArgs = {\n adapter: PostgresAdapter\n field: Field | TabAsField\n operator: string\n relationOrPath: string\n val: any\n}\n\nexport const sanitizeQueryValue = ({\n adapter,\n field,\n operator: operatorArg,\n relationOrPath,\n val,\n}: SanitizeQueryValueArgs): { operator: string; value: unknown } => {\n let operator = operatorArg\n let formattedValue = val\n\n if (!fieldAffectsData(field)) return { operator, value: formattedValue }\n\n if (\n (field.type === 'relationship' || field.type === 'upload') &&\n !relationOrPath.endsWith('relationTo') &&\n Array.isArray(formattedValue)\n ) {\n const allPossibleIDTypes: (number | string)[] = []\n formattedValue.forEach((val) => {\n if (adapter.idType !== 'uuid' && typeof val === 'string') {\n allPossibleIDTypes.push(val, parseInt(val))\n } else if (typeof val === 'string') {\n allPossibleIDTypes.push(val)\n } else {\n allPossibleIDTypes.push(val, String(val))\n }\n })\n formattedValue = allPossibleIDTypes\n }\n\n // Cast incoming values as proper searchable types\n if (field.type === 'checkbox' && typeof val === 'string') {\n if (val.toLowerCase() === 'true') formattedValue = true\n if (val.toLowerCase() === 'false') formattedValue = false\n }\n\n if (['all', 'in', 'not_in'].includes(operator)) {\n if (typeof formattedValue === 'string') {\n formattedValue = createArrayFromCommaDelineated(formattedValue)\n\n if (field.type === 'number') {\n formattedValue = formattedValue.map((arrayVal) => parseFloat(arrayVal))\n }\n }\n\n if (!Array.isArray(formattedValue) || formattedValue.length === 0) {\n return null\n }\n }\n\n if (field.type === 'number' && typeof formattedValue === 'string') {\n formattedValue = Number(val)\n }\n\n if (field.type === 'date') {\n if (typeof val === 'string') {\n formattedValue = new Date(val)\n if (Number.isNaN(Date.parse(formattedValue))) {\n return { operator, value: undefined }\n }\n }\n\n if (typeof val === 'number') {\n formattedValue = new Date(val)\n }\n }\n\n if (['relationship', 'upload'].includes(field.type)) {\n if (val === 'null') {\n formattedValue = null\n }\n }\n\n if (operator === 'near' || operator === 'within' || operator === 'intersects') {\n throw new APIError(\n `Querying with '${operator}' is not supported with the postgres database adapter.`,\n )\n }\n\n if (operator === 'contains') {\n formattedValue = `%${formattedValue}%`\n }\n\n if (operator === 'exists') {\n formattedValue = formattedValue === 'true' || formattedValue === true\n if (formattedValue === false) {\n operator = 'isNull'\n }\n }\n\n return { operator, value: formattedValue }\n}\n"],"names":["APIError","fieldAffectsData","createArrayFromCommaDelineated","sanitizeQueryValue","adapter","field","operator","operatorArg","relationOrPath","val","formattedValue","value","type","endsWith","Array","isArray","allPossibleIDTypes","forEach","idType","push","parseInt","String","toLowerCase","includes","map","arrayVal","parseFloat","length","Number","Date","isNaN","parse","undefined"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,iBAAgB;AACzC,SAAsCC,gBAAgB,QAAQ,gBAAe;AAC7E,SAASC,8BAA8B,QAAQ,oBAAmB;AAYlE,OAAO,MAAMC,qBAAqB,CAAC,EACjCC,OAAO,EACPC,KAAK,EACLC,UAAUC,WAAW,EACrBC,cAAc,EACdC,GAAG,EACoB;IACvB,IAAIH,WAAWC;IACf,IAAIG,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B,IAAImB,KAAKpB;YAC1B,IAAImB,OAAOE,KAAK,CAACD,KAAKE,KAAK,CAACrB,kBAAkB;gBAC5C,OAAO;oBAAEJ;oBAAUK,OAAOqB;gBAAU;YACtC;QACF;QAEA,IAAI,OAAOvB,QAAQ,UAAU;YAC3BC,iBAAiB,IAAImB,KAAKpB;QAC5B;IACF;IAEA,IAAI;QAAC;QAAgB;KAAS,CAACc,QAAQ,CAAClB,MAAMO,IAAI,GAAG;QACnD,IAAIH,QAAQ,QAAQ;YAClBC,iBAAiB;QACnB;IACF;IAEA,IAAIJ,aAAa,UAAUA,aAAa,YAAYA,aAAa,cAAc;QAC7E,MAAM,IAAIN,SACR,CAAC,eAAe,EAAEM,SAAS,sDAAsD,CAAC;IAEtF;IAEA,IAAIA,aAAa,YAAY;QAC3BI,iBAAiB,CAAC,CAAC,EAAEA,eAAe,CAAC,CAAC;IACxC;IAEA,IAAIJ,aAAa,UAAU;QACzBI,iBAAiBA,mBAAmB,UAAUA,mBAAmB;QACjE,IAAIA,mBAAmB,OAAO;YAC5BJ,WAAW;QACb;IACF;IAEA,OAAO;QAAEA;QAAUK,OAAOD;IAAe;AAC3C,EAAC"}
|
package/dist/queryDrafts.js
CHANGED
@@ -38,4 +38,4 @@ export const queryDrafts = async function queryDrafts({ collection, limit, local
|
|
38
38
|
};
|
39
39
|
};
|
40
40
|
|
41
|
-
//# sourceMappingURL=
|
41
|
+
//# sourceMappingURL=queryDrafts.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/queryDrafts.ts"],"sourcesContent":["import type { PayloadRequest, SanitizedCollectionConfig } from 'payload/types'\n\nimport { type QueryDrafts, combineQueries } from 'payload/database'\nimport { buildVersionCollectionFields } from 'payload/versions'\nimport toSnakeCase from 'to-snake-case'\n\nimport { findMany } from './find/findMany.js'\n\nexport const queryDrafts: QueryDrafts = async function queryDrafts({\n collection,\n limit,\n locale,\n page = 1,\n pagination,\n req = {} as PayloadRequest,\n sort,\n where,\n}) {\n const collectionConfig: SanitizedCollectionConfig = this.payload.collections[collection].config\n const tableName = `_${toSnakeCase(collection)}_v`\n const fields = buildVersionCollectionFields(collectionConfig)\n\n const combinedWhere = combineQueries({ latest: { equals: true } }, where)\n\n const result = await findMany({\n adapter: this,\n fields,\n limit,\n locale,\n page,\n pagination,\n req,\n sort,\n tableName,\n where: combinedWhere,\n })\n\n return {\n ...result,\n docs: result.docs.map((doc) => {\n // eslint-disable-next-line no-param-reassign\n doc = {\n id: doc.parent,\n ...doc.version,\n createdAt: doc.createdAt,\n updatedAt: doc.updatedAt,\n }\n\n return doc\n }),\n }\n}\n"],"names":["combineQueries","buildVersionCollectionFields","toSnakeCase","findMany","queryDrafts","collection","limit","locale","page","pagination","req","sort","where","collectionConfig","payload","collections","config","tableName","fields","combinedWhere","latest","equals","result","adapter","docs","map","doc","id","parent","version","createdAt","updatedAt"],"mappings":"AAEA,SAA2BA,cAAc,QAAQ,mBAAkB;AACnE,SAASC,4BAA4B,QAAQ,mBAAkB;AAC/D,OAAOC,iBAAiB,gBAAe;AAEvC,SAASC,QAAQ,QAAQ,qBAAoB;AAE7C,OAAO,MAAMC,cAA2B,eAAeA,YAAY,EACjEC,UAAU,EACVC,KAAK,EACLC,MAAM,EACNC,OAAO,CAAC,EACRC,UAAU,EACVC,MAAM,CAAC,CAAmB,EAC1BC,IAAI,EACJC,KAAK,EACN;IACC,MAAMC,mBAA8C,IAAI,CAACC,OAAO,CAACC,WAAW,CAACV,WAAW,CAACW,MAAM;IAC/F,MAAMC,YAAY,CAAC,CAAC,EAAEf,YAAYG,YAAY,EAAE,CAAC;IACjD,MAAMa,SAASjB,6BAA6BY;IAE5C,MAAMM,gBAAgBnB,eAAe;QAAEoB,QAAQ;YAAEC,QAAQ;QAAK;IAAE,GAAGT;IAEnE,MAAMU,SAAS,MAAMnB,SAAS;QAC5BoB,SAAS,IAAI;QACbL;QACAZ;QACAC;QACAC;QACAC;QACAC;QACAC;QACAM;QACAL,OAAOO;IACT;IAEA,OAAO;QACL,GAAGG,MAAM;QACTE,MAAMF,OAAOE,IAAI,CAACC,GAAG,CAAC,CAACC;YACrB,6CAA6C;YAC7CA,MAAM;gBACJC,IAAID,IAAIE,MAAM;gBACd,GAAGF,IAAIG,OAAO;gBACdC,WAAWJ,IAAII,SAAS;gBACxBC,WAAWL,IAAIK,SAAS;YAC1B;YAEA,OAAOL;QACT;IACF;AACF,EAAC"}
|
package/dist/schema/build.js
CHANGED
@@ -273,4 +273,4 @@ export const buildTable = ({ adapter, baseColumns = {}, baseExtraConfig = {}, bu
|
|
273
273
|
};
|
274
274
|
};
|
275
275
|
|
276
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWEvYnVpbGQudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyogZXNsaW50LWRpc2FibGUgbm8tcGFyYW0tcmVhc3NpZ24gKi9cbmltcG9ydCB0eXBlIHsgUmVsYXRpb24gfSBmcm9tICdkcml6emxlLW9ybSdcbmltcG9ydCB0eXBlIHtcbiAgSW5kZXhCdWlsZGVyLFxuICBQZ0NvbHVtbkJ1aWxkZXIsXG4gIFBnVGFibGVXaXRoQ29sdW1ucyxcbiAgVW5pcXVlQ29uc3RyYWludEJ1aWxkZXIsXG59IGZyb20gJ2RyaXp6bGUtb3JtL3BnLWNvcmUnXG5pbXBvcnQgdHlwZSB7IEZpZWxkIH0gZnJvbSAncGF5bG9hZC90eXBlcydcblxuaW1wb3J0IHsgcmVsYXRpb25zIH0gZnJvbSAnZHJpenpsZS1vcm0nXG5pbXBvcnQgeyBpbmRleCwgaW50ZWdlciwgbnVtZXJpYywgc2VyaWFsLCB0aW1lc3RhbXAsIHVuaXF1ZSwgdmFyY2hhciB9IGZyb20gJ2RyaXp6bGUtb3JtL3BnLWNvcmUnXG5pbXBvcnQgeyBmaWVsZEFmZmVjdHNEYXRhIH0gZnJvbSAncGF5bG9hZC90eXBlc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AgICAgICBpZiAoaGFzTG9jYWxpemVkUmVsYXRpb25zaGlwRmllbGQpIHtcbiAgICAgICAgICAgIHJlc3VsdC5sb2NhbGVJZHggPSBpbmRleChgJHtyZWxhdGlvbnNoaXBzVGFibGVOYW1lfV9sb2NhbGVfaWR4YCkub24oY29scy5sb2NhbGUpXG4gICAgICAgICAgfVxuXG4gICAgICAgICAgcmV0dXJuIHJlc3VsdFxuICAgICAgICB9LFxuICAgICAgKVxuXG4gICAgICBhZGFwdGVyLnRhYmxlc1tyZWxhdGlvbnNoaXBzVGFibGVOYW1lXSA9IHJlbGF0aW9uc2hpcHNUYWJsZVxuXG4gICAgICBjb25zdCByZWxhdGlvbnNoaXBzVGFibGVSZWxhdGlvbnMgPSByZWxhdGlvbnMocmVsYXRpb25zaGlwc1RhYmxlLCAoeyBvbmUgfSkgPT4ge1xuICAgICAgICBjb25zdCByZXN1bHQ6IFJlY29yZDxzdHJpbmcsIFJlbGF0aW9uPHN0cmluZz4+ID0ge1xuICAgICAgICAgIHBhcmVudDogb25lKHRhYmxlLCB7XG4gICAgICAgICAgICBmaWVsZHM6IFtyZWxhdGlvbnNoaXBzVGFibGUucGFyZW50XSxcbiAgICAgICAgICAgIHJlZmVyZW5jZXM6IFt0YWJsZS5pZF0sXG4gICAgICAgICAgICByZWxhdGlvbk5hbWU6ICdfcmVscycsXG4gICAgICAgICAgfSksXG4gICAgICAgIH1cblxuICAgICAgICByZWxhdGlvbnNoaXBzLmZvckVhY2goKHJlbGF0aW9uVG8pID0+IHtcbiAgICAgICAgICBjb25zdCByZWxhdGVkVGFibGVOYW1lID0gdG9TbmFrZUNhc2UocmVsYXRpb25UbylcbiAgICAgICAgICBjb25zdCBpZENvbHVtbk5hbWUgPSBgJHtyZWxhdGlvblRvfUlEYFxuICAgICAgICAgIHJlc3VsdFtpZENvbHVtbk5hbWVdID0gb25lKGFkYXB0ZXIudGFibGVzW3JlbGF0ZWRUYWJsZU5hbWVdLCB7XG4gICAgICAgICAgICBma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RQUVBLElBQUlDLGNBQWN1RCxJQUFJLElBQUlyRCxvQkFBb0I7WUFDNUNvRSxPQUFPYyxLQUFLLEdBQUdMLEtBQUs3RSxvQkFBb0I7Z0JBQ3RDeUUsY0FBYztZQUNoQjtRQUNGO1FBRUEsT0FBT0w7SUFDVDtJQUVBbkcsUUFBUWQsU0FBUyxDQUFDLENBQUMsVUFBVSxFQUFFNEIsVUFBVSxDQUFDLENBQUMsR0FBRzZGO0lBRTlDLE9BQU87UUFBRXRGO1FBQW9CRDtRQUFrQlk7SUFBaUI7QUFDbEUsRUFBQyJ9
|
276
|
+
//# sourceMappingURL=build.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/schema/build.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport type { Relation } from 'drizzle-orm'\nimport type {\n IndexBuilder,\n PgColumnBuilder,\n PgTableWithColumns,\n UniqueConstraintBuilder,\n} from 'drizzle-orm/pg-core'\nimport type { Field } from 'payload/types'\n\nimport { relations } from 'drizzle-orm'\nimport { index, integer, numeric, serial, timestamp, unique, varchar } from 'drizzle-orm/pg-core'\nimport { fieldAffectsData } from 'payload/types'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { GenericColumns, GenericTable, IDType, PostgresAdapter } from '../types.js'\n\nimport { parentIDColumnMap } from './parentIDColumnMap.js'\nimport { setColumnID } from './setColumnID.js'\nimport { traverseFields } from './traverseFields.js'\n\ntype Args = {\n adapter: PostgresAdapter\n baseColumns?: Record<string, PgColumnBuilder>\n baseExtraConfig?: Record<string, (cols: GenericColumns) => IndexBuilder | UniqueConstraintBuilder>\n buildNumbers?: boolean\n buildRelationships?: boolean\n buildTexts?: boolean\n disableNotNull: boolean\n disableUnique: boolean\n fields: Field[]\n rootRelationsToBuild?: Map<string, string>\n rootRelationships?: Set<string>\n rootTableIDColType?: string\n rootTableName?: string\n tableName: string\n timestamps?: boolean\n}\n\ntype Result = {\n hasManyNumberField: 'index' | boolean\n hasManyTextField: 'index' | boolean\n relationsToBuild: Map<string, string>\n}\n\nexport const buildTable = ({\n adapter,\n baseColumns = {},\n baseExtraConfig = {},\n buildNumbers,\n buildRelationships,\n buildTexts,\n disableNotNull,\n disableUnique = false,\n fields,\n rootRelationsToBuild,\n rootRelationships,\n rootTableIDColType,\n rootTableName: incomingRootTableName,\n tableName,\n timestamps,\n}: Args): Result => {\n const rootTableName = incomingRootTableName || tableName\n const columns: Record<string, PgColumnBuilder> = baseColumns\n const indexes: Record<string, (cols: GenericColumns) => IndexBuilder> = {}\n\n let hasLocalizedField = false\n let hasLocalizedRelationshipField = false\n let hasManyTextField: 'index' | boolean = false\n let hasManyNumberField: 'index' | boolean = false\n let hasLocalizedManyTextField = false\n let hasLocalizedManyNumberField = false\n\n const localesColumns: Record<string, PgColumnBuilder> = {}\n const localesIndexes: Record<string, (cols: GenericColumns) => IndexBuilder> = {}\n let localesTable: GenericTable | PgTableWithColumns<any>\n let textsTable: GenericTable | PgTableWithColumns<any>\n let numbersTable: GenericTable | PgTableWithColumns<any>\n\n // Relationships to the base collection\n const relationships: Set<string> = rootRelationships || new Set()\n\n let relationshipsTable: GenericTable | PgTableWithColumns<any>\n\n // Drizzle relations\n const relationsToBuild: Map<string, string> = new Map()\n\n const idColType: IDType = setColumnID({ adapter, columns, fields })\n\n ;({\n hasLocalizedField,\n hasLocalizedManyNumberField,\n hasLocalizedManyTextField,\n hasLocalizedRelationshipField,\n hasManyNumberField,\n hasManyTextField,\n } = traverseFields({\n adapter,\n buildNumbers,\n buildRelationships,\n buildTexts,\n columns,\n disableNotNull,\n disableUnique,\n fields,\n indexes,\n localesColumns,\n localesIndexes,\n newTableName: tableName,\n parentTableName: tableName,\n relationsToBuild,\n relationships,\n rootRelationsToBuild: rootRelationsToBuild || relationsToBuild,\n rootTableIDColType: rootTableIDColType || idColType,\n rootTableName,\n }))\n\n if (timestamps) {\n columns.createdAt = timestamp('created_at', {\n mode: 'string',\n precision: 3,\n withTimezone: true,\n })\n .defaultNow()\n .notNull()\n columns.updatedAt = timestamp('updated_at', {\n mode: 'string',\n precision: 3,\n withTimezone: true,\n })\n .defaultNow()\n .notNull()\n }\n\n const table = adapter.pgSchema.table(tableName, columns, (cols) => {\n const extraConfig = Object.entries(baseExtraConfig).reduce((config, [key, func]) => {\n config[key] = func(cols)\n return config\n }, {})\n\n return Object.entries(indexes).reduce((acc, [colName, func]) => {\n acc[colName] = func(cols)\n return acc\n }, extraConfig)\n })\n\n adapter.tables[tableName] = table\n\n if (hasLocalizedField) {\n const localeTableName = `${tableName}_locales`\n localesColumns.id = serial('id').primaryKey()\n localesColumns._locale = adapter.enums.enum__locales('_locale').notNull()\n localesColumns._parentID = parentIDColumnMap[idColType]('_parent_id')\n .references(() => table.id, { onDelete: 'cascade' })\n .notNull()\n\n localesTable = adapter.pgSchema.table(localeTableName, localesColumns, (cols) => {\n return Object.entries(localesIndexes).reduce(\n (acc, [colName, func]) => {\n acc[colName] = func(cols)\n return acc\n },\n {\n _localeParent: unique(`${localeTableName}_locale_parent_id_unique`).on(\n cols._locale,\n cols._parentID,\n ),\n },\n )\n })\n\n adapter.tables[localeTableName] = localesTable\n\n const localesTableRelations = relations(localesTable, ({ one }) => ({\n _parentID: one(table, {\n fields: [localesTable._parentID],\n references: [table.id],\n }),\n }))\n\n adapter.relations[`relations_${localeTableName}`] = localesTableRelations\n }\n\n if (hasManyTextField && buildTexts) {\n const textsTableName = `${rootTableName}_texts`\n const columns: Record<string, PgColumnBuilder> = {\n id: serial('id').primaryKey(),\n order: integer('order').notNull(),\n parent: parentIDColumnMap[idColType]('parent_id')\n .references(() => table.id, { onDelete: 'cascade' })\n .notNull(),\n path: varchar('path').notNull(),\n text: varchar('text'),\n }\n\n if (hasLocalizedManyTextField) {\n columns.locale = adapter.enums.enum__locales('locale')\n }\n\n textsTable = adapter.pgSchema.table(textsTableName, columns, (cols) => {\n const indexes: Record<string, IndexBuilder> = {\n orderParentIdx: index(`${textsTableName}_order_parent_idx`).on(cols.order, cols.parent),\n }\n\n if (hasManyTextField === 'index') {\n indexes.text_idx = index(`${textsTableName}_text_idx`).on(cols.text)\n }\n\n if (hasLocalizedManyTextField) {\n indexes.localeParent = index(`${textsTableName}_locale_parent`).on(cols.locale, cols.parent)\n }\n\n return indexes\n })\n\n adapter.tables[textsTableName] = textsTable\n\n const textsTableRelations = relations(textsTable, ({ one }) => ({\n parent: one(table, {\n fields: [textsTable.parent],\n references: [table.id],\n }),\n }))\n\n adapter.relations[`relations_${textsTableName}`] = textsTableRelations\n }\n\n if (hasManyNumberField && buildNumbers) {\n const numbersTableName = `${rootTableName}_numbers`\n const columns: Record<string, PgColumnBuilder> = {\n id: serial('id').primaryKey(),\n number: numeric('number'),\n order: integer('order').notNull(),\n parent: parentIDColumnMap[idColType]('parent_id')\n .references(() => table.id, { onDelete: 'cascade' })\n .notNull(),\n path: varchar('path').notNull(),\n }\n\n if (hasLocalizedManyNumberField) {\n columns.locale = adapter.enums.enum__locales('locale')\n }\n\n numbersTable = adapter.pgSchema.table(numbersTableName, columns, (cols) => {\n const indexes: Record<string, IndexBuilder> = {\n orderParentIdx: index(`${numbersTableName}_order_parent_idx`).on(cols.order, cols.parent),\n }\n\n if (hasManyNumberField === 'index') {\n indexes.numberIdx = index(`${numbersTableName}_number_idx`).on(cols.number)\n }\n\n if (hasLocalizedManyNumberField) {\n indexes.localeParent = index(`${numbersTableName}_locale_parent`).on(\n cols.locale,\n cols.parent,\n )\n }\n\n return indexes\n })\n\n adapter.tables[numbersTableName] = numbersTable\n\n const numbersTableRelations = relations(numbersTable, ({ one }) => ({\n parent: one(table, {\n fields: [numbersTable.parent],\n references: [table.id],\n }),\n }))\n\n adapter.relations[`relations_${numbersTableName}`] = numbersTableRelations\n }\n\n if (buildRelationships) {\n if (relationships.size) {\n const relationshipColumns: Record<string, PgColumnBuilder> = {\n id: serial('id').primaryKey(),\n order: integer('order'),\n parent: parentIDColumnMap[idColType]('parent_id')\n .references(() => table.id, { onDelete: 'cascade' })\n .notNull(),\n path: varchar('path').notNull(),\n }\n\n if (hasLocalizedRelationshipField) {\n relationshipColumns.locale = adapter.enums.enum__locales('locale')\n }\n\n relationships.forEach((relationTo) => {\n const formattedRelationTo = toSnakeCase(relationTo)\n let colType = adapter.idType === 'uuid' ? 'uuid' : 'integer'\n const relatedCollectionCustomID = adapter.payload.collections[\n relationTo\n ].config.fields.find((field) => fieldAffectsData(field) && field.name === 'id')\n if (relatedCollectionCustomID?.type === 'number') colType = 'numeric'\n if (relatedCollectionCustomID?.type === 'text') colType = 'varchar'\n\n relationshipColumns[`${relationTo}ID`] = parentIDColumnMap[colType](\n `${formattedRelationTo}_id`,\n ).references(() => adapter.tables[formattedRelationTo].id, { onDelete: 'cascade' })\n })\n\n const relationshipsTableName = `${tableName}_rels`\n\n relationshipsTable = adapter.pgSchema.table(\n relationshipsTableName,\n relationshipColumns,\n (cols) => {\n const result: Record<string, unknown> = {\n order: index(`${relationshipsTableName}_order_idx`).on(cols.order),\n parentIdx: index(`${relationshipsTableName}_parent_idx`).on(cols.parent),\n pathIdx: index(`${relationshipsTableName}_path_idx`).on(cols.path),\n }\n\n if (hasLocalizedRelationshipField) {\n result.localeIdx = index(`${relationshipsTableName}_locale_idx`).on(cols.locale)\n }\n\n return result\n },\n )\n\n adapter.tables[relationshipsTableName] = relationshipsTable\n\n const relationshipsTableRelations = relations(relationshipsTable, ({ one }) => {\n const result: Record<string, Relation<string>> = {\n parent: one(table, {\n fields: [relationshipsTable.parent],\n references: [table.id],\n relationName: '_rels',\n }),\n }\n\n relationships.forEach((relationTo) => {\n const relatedTableName = toSnakeCase(relationTo)\n const idColumnName = `${relationTo}ID`\n result[idColumnName] = one(adapter.tables[relatedTableName], {\n fields: [relationshipsTable[idColumnName]],\n references: [adapter.tables[relatedTableName].id],\n })\n })\n\n return result\n })\n\n adapter.relations[`relations_${relationshipsTableName}`] = relationshipsTableRelations\n }\n }\n\n const tableRelations = relations(table, ({ many }) => {\n const result: Record<string, Relation<string>> = {}\n\n relationsToBuild.forEach((val, key) => {\n result[key] = many(adapter.tables[val])\n })\n\n if (hasLocalizedField) {\n result._locales = many(localesTable)\n }\n\n if (hasManyTextField) {\n result._texts = many(textsTable)\n }\n if (hasManyNumberField) {\n result._numbers = many(numbersTable)\n }\n\n if (relationships.size && relationshipsTable) {\n result._rels = many(relationshipsTable, {\n relationName: '_rels',\n })\n }\n\n return result\n })\n\n adapter.relations[`relations_${tableName}`] = tableRelations\n\n return { hasManyNumberField, hasManyTextField, relationsToBuild }\n}\n"],"names":["relations","index","integer","numeric","serial","timestamp","unique","varchar","fieldAffectsData","toSnakeCase","parentIDColumnMap","setColumnID","traverseFields","buildTable","adapter","baseColumns","baseExtraConfig","buildNumbers","buildRelationships","buildTexts","disableNotNull","disableUnique","fields","rootRelationsToBuild","rootRelationships","rootTableIDColType","rootTableName","incomingRootTableName","tableName","timestamps","columns","indexes","hasLocalizedField","hasLocalizedRelationshipField","hasManyTextField","hasManyNumberField","hasLocalizedManyTextField","hasLocalizedManyNumberField","localesColumns","localesIndexes","localesTable","textsTable","numbersTable","relationships","Set","relationshipsTable","relationsToBuild","Map","idColType","newTableName","parentTableName","createdAt","mode","precision","withTimezone","defaultNow","notNull","updatedAt","table","pgSchema","cols","extraConfig","Object","entries","reduce","config","key","func","acc","colName","tables","localeTableName","id","primaryKey","_locale","enums","enum__locales","_parentID","references","onDelete","_localeParent","on","localesTableRelations","one","textsTableName","order","parent","path","text","locale","orderParentIdx","text_idx","localeParent","textsTableRelations","numbersTableName","number","numberIdx","numbersTableRelations","size","relationshipColumns","forEach","relationTo","formattedRelationTo","colType","idType","relatedCollectionCustomID","payload","collections","find","field","name","type","relationshipsTableName","result","parentIdx","pathIdx","localeIdx","relationshipsTableRelations","relationName","relatedTableName","idColumnName","tableRelations","many","val","_locales","_texts","_numbers","_rels"],"mappings":"AAAA,oCAAoC,GAUpC,SAASA,SAAS,QAAQ,cAAa;AACvC,SAASC,KAAK,EAAEC,OAAO,EAAEC,OAAO,EAAEC,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KhF;QACzB;QAEA,IAAIC,cAAcuD,IAAI,IAAIrD,oBAAoB;YAC5CoE,OAAOc,KAAK,GAAGL,KAAK7E,oBAAoB;gBACtCyE,cAAc;YAChB;QACF;QAEA,OAAOL;IACT;IAEAnG,QAAQd,SAAS,CAAC,CAAC,UAAU,EAAE4B,UAAU,CAAC,CAAC,GAAG6F;IAE9C,OAAO;QAAEtF;QAAoBD;QAAkBY;IAAiB;AAClE,EAAC"}
|
@@ -15,4 +15,4 @@ export const createIndex = ({ name, columnName, tableName, unique })=>{
|
|
15
15
|
};
|
16
16
|
};
|
17
17
|
|
18
|
-
//# sourceMappingURL=
|
18
|
+
//# sourceMappingURL=createIndex.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/schema/createIndex.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport { index, uniqueIndex } from 'drizzle-orm/pg-core'\n\nimport type { GenericColumn } from '../types.js'\n\ntype CreateIndexArgs = {\n columnName: string\n name: string | string[]\n tableName: string\n unique?: boolean\n}\n\nexport const createIndex = ({ name, columnName, tableName, unique }: CreateIndexArgs) => {\n return (table: { [x: string]: GenericColumn }) => {\n let columns\n if (Array.isArray(name)) {\n columns = name\n .map((columnName) => table[columnName])\n // exclude fields were included in compound indexes but do not exist on the table\n .filter((col) => typeof col !== 'undefined')\n } else {\n columns = [table[name]]\n }\n if (unique)\n return uniqueIndex(`${tableName}_${columnName}_idx`).on(columns[0], ...columns.slice(1))\n return index(`${tableName}_${columnName}_idx`).on(columns[0], ...columns.slice(1))\n }\n}\n"],"names":["index","uniqueIndex","createIndex","name","columnName","tableName","unique","table","columns","Array","isArray","map","filter","col","on","slice"],"mappings":"AAAA,oCAAoC,GACpC,SAASA,KAAK,EAAEC,WAAW,QAAQ,sBAAqB;AAWxD,OAAO,MAAMC,cAAc,CAAC,EAAEC,IAAI,EAAEC,UAAU,EAAEC,SAAS,EAAEC,MAAM,EAAmB;IAClF,OAAO,CAACC;QACN,IAAIC;QACJ,IAAIC,MAAMC,OAAO,CAACP,OAAO;YACvBK,UAAUL,KACPQ,GAAG,CAAC,CAACP,aAAeG,KAAK,CAACH,WAAW,CACtC,iFAAiF;aAChFQ,MAAM,CAAC,CAACC,MAAQ,OAAOA,QAAQ;QACpC,OAAO;YACLL,UAAU;gBAACD,KAAK,CAACJ,KAAK;aAAC;QACzB;QACA,IAAIG,QACF,OAAOL,YAAY,CAAC,EAAEI,UAAU,CAAC,EAAED,WAAW,IAAI,CAAC,EAAEU,EAAE,CAACN,OAAO,CAAC,EAAE,KAAKA,QAAQO,KAAK,CAAC;QACvF,OAAOf,MAAM,CAAC,EAAEK,UAAU,CAAC,EAAED,WAAW,IAAI,CAAC,EAAEU,EAAE,CAACN,OAAO,CAAC,EAAE,KAAKA,QAAQO,KAAK,CAAC;IACjF;AACF,EAAC"}
|
package/dist/schema/idToUUID.js
CHANGED
@@ -8,4 +8,4 @@ export const idToUUID = (fields)=>fields.map((field)=>{
|
|
8
8
|
return field;
|
9
9
|
});
|
10
10
|
|
11
|
-
//# sourceMappingURL=
|
11
|
+
//# sourceMappingURL=idToUUID.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/schema/idToUUID.ts"],"sourcesContent":["import type { Field } from 'payload/types'\n\nexport const idToUUID = (fields: Field[]): Field[] =>\n fields.map((field) => {\n if ('name' in field && field.name === 'id') {\n return {\n ...field,\n name: '_uuid',\n }\n }\n\n return field\n })\n"],"names":["idToUUID","fields","map","field","name"],"mappings":"AAEA,OAAO,MAAMA,WAAW,CAACC,SACvBA,OAAOC,GAAG,CAAC,CAACC;QACV,IAAI,UAAUA,SAASA,MAAMC,IAAI,KAAK,MAAM;YAC1C,OAAO;gBACL,GAAGD,KAAK;gBACRC,MAAM;YACR;QACF;QAEA,OAAOD;IACT,GAAE"}
|
@@ -6,4 +6,4 @@ export const parentIDColumnMap = {
|
|
6
6
|
varchar
|
7
7
|
};
|
8
8
|
|
9
|
-
//# sourceMappingURL=
|
9
|
+
//# sourceMappingURL=parentIDColumnMap.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/schema/parentIDColumnMap.ts"],"sourcesContent":["import { integer, numeric, uuid, varchar } from 'drizzle-orm/pg-core'\n\nimport type { IDType } from '../types.js'\n\nexport const parentIDColumnMap: Record<\n IDType,\n typeof integer<string> | typeof numeric<string> | typeof uuid<string> | typeof varchar\n> = {\n integer,\n numeric,\n uuid,\n varchar,\n}\n"],"names":["integer","numeric","uuid","varchar","parentIDColumnMap"],"mappings":"AAAA,SAASA,OAAO,EAAEC,OAAO,EAAEC,IAAI,EAAEC,OAAO,QAAQ,sBAAqB;AAIrE,OAAO,MAAMC,oBAGT;IACFJ;IACAC;IACAC;IACAC;AACF,EAAC"}
|
@@ -21,4 +21,4 @@ export const setColumnID = ({ adapter, columns, fields })=>{
|
|
21
21
|
return 'integer';
|
22
22
|
};
|
23
23
|
|
24
|
-
//# sourceMappingURL=
|
24
|
+
//# sourceMappingURL=setColumnID.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/schema/setColumnID.ts"],"sourcesContent":["import type { PgColumnBuilder } from 'drizzle-orm/pg-core'\n\nimport { numeric, serial, uuid, varchar } from 'drizzle-orm/pg-core'\nimport { type Field, fieldAffectsData } from 'payload/types'\nimport { flattenTopLevelFields } from 'payload/utilities'\n\nimport type { IDType, PostgresAdapter } from '../types.js'\n\ntype Args = { adapter: PostgresAdapter; columns: Record<string, PgColumnBuilder>; fields: Field[] }\nexport const setColumnID = ({ adapter, columns, fields }: Args): IDType => {\n const idField = flattenTopLevelFields(fields).find(\n (field) => fieldAffectsData(field) && field.name === 'id',\n )\n if (idField) {\n if (idField.type === 'number') {\n columns.id = numeric('id').primaryKey()\n return 'numeric'\n }\n\n if (idField.type === 'text') {\n columns.id = varchar('id').primaryKey()\n return 'varchar'\n }\n }\n\n if (adapter.idType === 'uuid') {\n columns.id = uuid('id').defaultRandom().primaryKey()\n return 'uuid'\n }\n\n columns.id = serial('id').primaryKey()\n return 'integer'\n}\n"],"names":["numeric","serial","uuid","varchar","fieldAffectsData","flattenTopLevelFields","setColumnID","adapter","columns","fields","idField","find","field","name","type","id","primaryKey","idType","defaultRandom"],"mappings":"AAEA,SAASA,OAAO,EAAEC,MAAM,EAAEC,IAAI,EAAEC,OAAO,QAAQ,sBAAqB;AACpE,SAAqBC,gBAAgB,QAAQ,gBAAe;AAC5D,SAASC,qBAAqB,QAAQ,oBAAmB;AAKzD,OAAO,MAAMC,cAAc,CAAC,EAAEC,OAAO,EAAEC,OAAO,EAAEC,MAAM,EAAQ;IAC5D,MAAMC,UAAUL,sBAAsBI,QAAQE,IAAI,CAChD,CAACC,QAAUR,iBAAiBQ,UAAUA,MAAMC,IAAI,KAAK;IAEvD,IAAIH,SAAS;QACX,IAAIA,QAAQI,IAAI,KAAK,UAAU;YAC7BN,QAAQO,EAAE,GAAGf,QAAQ,MAAMgB,UAAU;YACrC,OAAO;QACT;QAEA,IAAIN,QAAQI,IAAI,KAAK,QAAQ;YAC3BN,QAAQO,EAAE,GAAGZ,QAAQ,MAAMa,UAAU;YACrC,OAAO;QACT;IACF;IAEA,IAAIT,QAAQU,MAAM,KAAK,QAAQ;QAC7BT,QAAQO,EAAE,GAAGb,KAAK,MAAMgB,aAAa,GAAGF,UAAU;QAClD,OAAO;IACT;IAEAR,QAAQO,EAAE,GAAGd,OAAO,MAAMe,UAAU;IACpC,OAAO;AACT,EAAC"}
|
@@ -490,4 +490,4 @@ export const traverseFields = ({ adapter, buildNumbers, buildRelationships, buil
|
|
490
490
|
};
|
491
491
|
};
|
492
492
|
|
493
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWEvdHJhdmVyc2VGaWVsZHMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyogZXNsaW50LWRpc2FibGUgbm8tcGFyYW0tcmVhc3N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kge1xuICAgICAgICAgICAgaGFzTWFueVRleHRGaWVsZCA9IHRydWVcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAoZmllbGQudW5pcXVlKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgSW52YWxpZENvbmZpZ3VyYXRpb24oXG4gICAgICAgICAgICAgICdVbmlxdWUgaXMgbm90IHN1cHBvcnRlZCBpbiBQb3N0Z3JlcyBmb3IgaGFzTWFueSB0ZXh0IGZpZWxkcy4nLFxuICAgICAgICAgICAgKVxuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICB0YXJnZXRUYWJsZVtmaWVsZE5hbWVdID0gdmFyY2hhcihjb2x1bW5OYW1lKVxuICAgICAgICB9XG4gICAgICAgIGJyZWFrXG4gICAgICB9XG4gICAgICBjYXNlICdlbWFpbCc6XG4gICAgICBjYXNlICdjb2RlJzpcbiAgICAgIGNhc2UgJ3RleHRhcmVhJzoge1xuICAgICAgICB0YXJnZXRUYWJsZVtmaWVsZE5hbWVdID0gdmFyY2hhcihjb2x1bW5OYW1lKVxuICAgICAgICBicmVha1xuICAgICAgfVxuXG4gICAgICBjYXNlICdudW1iZXInOiB7XG4gICAgICAgIGlmIChmaWVsZC5oYXNNYW55KSB7XG4gICAgICAgICAgaWYgKGZpZWxkLmxvY2FsaXplZCkge1xuICAgICAgICAgICAgaGFzTG9jYWxpemVkTWFueU51bWJlckZpZWxkID0gdHJ1ZVxuICAgICAgICAgIH1cblxuICAgICAgICAgIGlmIChmaWVsZC5pbmRleCkge1xuICAgICAgICAgICAgaGFzTWFueU51bWJlckZpZWxkID0gJ2luZGV4J1xuICAgICAgICAgIH0gZWxzZSBpZiAoIWhhc01hbnlOdW1iZXJGaWVsZCkge1xuICAgICAgICAgICAgaGFzTWFueU51bWJlckZpZWxkID0gdHJ1ZVxuICAgICAgICAgIH1cblxuICAgICAgICAgIGlmIChmaWVsZC51bmlxdWUpIHtcbiAgICAgICAgICAgIHRocm93IG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ID0ge1xuICAgICAgICAgICAgb3JkZXJJZHg6IChjb2xzKSA9PiBpbmRleChgJHtzZWxlY3RUYWJsZU5hbWV9X29yZGVyX2lkeGApLm9uKGNvbHMub3JkZXIpLFxuICAgICAgICAgICAgcGFyZW50SWR4OiAoY29scykgPT4gaW5kZXgoYCR7c2VsZWN0VGFibGVOYW1lfV9wYXJlbnRfaWR4YCkub24oY29scy5wYXJlbnQpLFxuICAgICAgICAgIH1cblxuICAgICAgICAgIGlmIChmaWVsZC5sb2NhbGl6ZWQpIHtcbiAgICAgICAgICAgIGJhc2VDb2x1bW5zLmxvY2FsZSA9IGFkYXB0ZXIuZW51bXMuZW51bV9fbG9jYWxlcygnbG9jYWxlJykubm90TnVsbCgpXG4gICAgICAgICAgICBiYXNlRXh0cmFDb25maWcubG9jYWxlSWR4ID0gKGNvbHMpID0+XG4gICAgICAgICAgICAgIGluZGV4KGAke3NlbGVjdFRhYmxlTmFtZX1fbG9jYWxlX2lkeGApLm9uKGNvbHMubG9jYWxlKVxuICAgICAgICAgIH1cblxuICAgICAgICAgIGlmIChmaWVsZC5pbmRleCkge1xuICAgICAgICAgICAgYmFzZUV4dHJhQ29uZmlnLnZhbHVlID0gKGNvbHMpID0+IGluZGV4KGAke3NlbGVjdFRhYmxlTmFtZX1fdmFsdWVfaWR4YCkub24oY29scy52YWx1ZSlcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBidWlsZFRhYmxlKHtcbiAgICAgICAgICAgIGFkYXB0ZXIsXG4gICAgICAgICAgICBiYXNlQ29sdW1ucyxcbiAgICAgICAgICAgIGJhc2VFeHRyYUNvbmZpZyxcbiAgICAgICAgICAgIGRpc2FibGVOb3ROdWxsLFxuICAgICAgICAgICAgZGlzYWJsZVVuaXF1ZSxcbiAgICAgICAgICAgIGZpZWxkczogW10sXG4gICAgICAgICAgICB0YWJsZU5hbWU6IHNlbGVjdFRhYmxlTmFtZSxcbiAgICAgICAgICB9KVxuXG4gICAgICAgICAgcmVsYXRpb25z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AgICAgIH0pXG5cbiAgICAgICAgaWYgKHN1Ykhhc01hbnlUZXh0RmllbGQpIHtcbiAgICAgICAgICBpZiAoIWhhc01hbnlUZXh0RmllbGQgfHwgc3ViSGFzTWFueVRleHRGaWVsZCA9PT0gJ2luZGV4JylcbiAgICAgICAgICAgIGhhc01hbnlUZXh0RmllbGQgPSBzdWJIYXNNYW55VGV4dEZpZWxkXG4gICAgICAgIH1cbiAgICAgICAgaWYgKHN1Ykhhc01hbnlOdW1iZXJGaWVsZCkge1xuICAgICAgICAgIGlmICghaGFzTWFueU51bWJlckZpZWxkIHx8IHN1Ykhhc01hbnlOdW1iZXJGaWVsZCA9PT0gJ2luZGV4JylcbiAgICAgICAgICAgIGhhc01hbnlOdW1iZXJGaWVsZCA9IHN1Ykhhc01hbnlOdW1iZXJGaWVsZFxuICAgICAgICB9XG5cbiAgICAgICAgcmVsYXRpb25zVG9CdWlsZC5zZXQoZmllbGROYW1lLCBhcnJheVRhYmxlTmFtZSlcblxuICAgICAgICBjb25zdCBhcnJheVRhYmxlUmVsYXRpb25zID0gcmVsYXRpb25zKGFkYXB0ZXIudGFibGVzW2FycmF5VGFibGVOYW1lXSwgKHsgbWFueSwgb25lIH0pID0+IHtcbiAgICAgICAgICBjb25zdCByZXN1bHQ6IFJlY29yZDxzdHJpbmcsIFJlbGF0aW9uPHN0cmluZz4+ID0ge1xuICAgICAgICAgICAgX3BhcmVudElEOiBvbmUoYWRhcHRlci50YWJsZXNbcGFyZW50VGFibGVOYW1lXSwge1xuICAgICAgICAgICAgICBmaWVsZHM6IFthZGFwdGVyLnRhYmxlc1thcnJheVRhYmxlTmFtZV0uX3BhcmVudElEXSxcbiAgICAgICAgICAgICAgcmVmZXJlbmNlczogW2FkYXB0ZXIudGFibGVzW3BhcmVudFRhYmxlTmFtZV0uaWRdLFxuICAgICAgICAgICAgfSksXG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKGhhc0xvY2FsZXNUYWJsZShmaWVsZC5maWVsZH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lSURDb2xUeXBlXSgnX3BhcmVudF9pZCcpXG4gICAgICAgICAgICAgICAgLnJlZmVyZW5jZXMoKCkgPT4gYWRhcHRlci50YWJsZXNbcm9vdFRhYmxlTmFtZV0uaWQsIHsgb25EZWxldGU6ICdjYXNjYWRlJyB9KVxuICAgICAgICAgICAgICAgIC5ub3ROdWxsKCksXG4gICAgICAgICAgICAgIF9wYXRoOiB0ZXh0KCdfcGF0aCcpLm5vdE51bGwoKSxcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgY29uc3QgYmFzZUV4dHJhQ29uZmlnOiBSZWNvcmQ8XG4gICAgICAgICAgICAgIHN0cmluZyxcbiAgICAgICAgICAgICAgKGNvbHM6IEdlbmVyaWNDb2x1bW5zKSA9PiBJbmRleEJ1aWxkZXIgfCBVbmlxdWVDb25zdHJhaW50QnVpbGRlclxuICAgICAgICAgICAgPiA9IHtcbiAgICAgICAgICAgICAgX29yZGVySWR4OiAoY29scykgPT4gaW5kZXgoYCR7YmxvY2tUYWJsZU5hbWV9X29yZGVyX2lkeGApLm9uKGNvbHMuX29yZGVyKSxcbiAgICAgICAgICAgICAgX3BhcmVudElESWR4OiAoY29scykgPT4gaW5kZXgoYCR7YmxvY2tUYWJsZU5hbWV9X3BhcmVudF9pZF9pZHhgKS5vbihjb2xzLl9wYXJlbnRJRCksXG4gICAgICAgICAgICAgIF9wYXRoSWR4OiAoY29scykgPT4gaW5kZXgoYCR7YmxvY2tUYWJsZU5hbWV9X3BhdGhfaWR4YCkub24oY29scy5fcGF0aCksXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChmaWVsZC5sb2NhbGl6ZWQgJiYgYWRhcHRlci5wYXlsb2FkLmNvbmZpZy5sb2NhbGl6YXRpb24pIHtcbiAgICAgICAgICAgICAgYmFzZUNvbHVtbnMuX2xvY2FsZSA9IGFkYXB0ZXIuZW51bXMuZW51bV9fbG9jYWxlcygnX2xvY2FsZScpLm5vdE51bGwoKVxuICAgICAgICAgICAgICBiYXNlRXh0cmFDb25maWcuX2xvY2FsZUlkeCA9IChjb2xzKSA9PlxuICAgICAgICAgICAgICAgIGluZGV4KGAke2Jsb2NrVGFibGVOYW1lfV9sb2NhbGVfaWR4YCkub24oY29scy5fbG9jYWxlKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBjb25zdCB7XG4gICAgICAgICAgICAgIGhhc01hbnlOdW1iZXJGaWVsZDogc3ViSGFzTWFueU51bWJlckZpZWxkLFxuICAgICAgICAgICAgICBoYXNNYW55VGV4dEZpZWxkOiBzdWJIYXNNYW55VGV4dEZpZWxkLFxuICAgICAgICAgICAgICByZWxhdGlvbnNUb0J1aWxkOiBzdWJSZWxhdGlvbnNUb0J1aWxkLFxuICAgICAgICAgICAgfSA9IGJ1aWxkVGFibGUoe1xuICAgICAgICAgICAgICBhZGFwdGVyLFxuICAgICAgICAgICAgICBiYXNlQ29sdW1ucyxcbiAgICAgICAgICAgICAgYmFzZUV4dHJhQ29uZmlnLFxuICAgICAgICAgICAgICBkaXNhYmxlTm90TnVsbDogZGlzYWJsZU5vdE51bGxGcm9tSGVyZSxcbiAgICAgICAgICAgICAgZGlzYWJsZVVuaXF1ZSxcbiAgICAgICAgICAgICAgZmllbGRzOiBkaXNhYmxlVW5pcXVlID8gaWRUb1VVSUQoYmxvY2suZmllbGRzKSA6IGJsb2NrLmZpZWxkcyxcbiAgICAgICAgICAgICAgcm9vdFJlbGF0aW9uc1RvQnVpbGQsXG4gICAgICAgICAgICAgIHJvb3RSZWxhdGlvbnNoaXBzOiByZWxhdGlvbnNoaXBzLFxuICAgICAgICAgICAgICByb290VGFibGVJRENvbFR5cGUsXG4gICAgICAgICAgICAgIHJvb3RUYWJsZU5hbWUsXG4gICAgICAgICAgICAgIHRhYmxlTmFtZTogYmxvY2tUYWJsZU5hbWUsXG4gICAgICAgICAgICB9KVxuXG4gICAgICAgICAgICBpZiAoc3ViSGFzTWFueVRleHRGaWVsZCkge1xuICAgICAgICAgICAgICBpZiAoIWhhc01hbnlUZXh0RmllbGQgfHwgc3ViSGFzTWFueVRleHRGaWVsZCA9PT0gJ2luZGV4JylcbiAgICAgICAgICAgICAgICBoYXNNYW55VGV4dEZpZWxkID0gc3ViSGFzTWFueVRleHRGaWVsZFxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAoc3ViSGFzTWFueU51bWJlckZpZWxkKSB7XG4gICAgICAgICAgICAgIGlmICghaGFzTWFueU51bWJlckZpZWxkIHx8IHN1Ykhhc01hbnlOdW1iZXJGaWVsZCA9PT0gJ2luZGV4JylcbiAgICAgICAgICAgICAgICBoYXNNYW55TnVtYmVyRmllbGQgPSBzdWJIYXNNYW55TnVtYmVyRmllbGRcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgY29uc3QgYmxvY2tUYWJsZVJlbGF0aW9ucyA9IHJlbGF0aW9ucyhcbiAgICAgICAgICAgICAgYWRhcHRlci50YWJsZXNbYmxvY2tUYWJsZU5hbWVdLFxuICAgICAgICAgICAgICAoeyBtYW55LCBvbmUgfSkgPT4ge1xuICAgICAgICAgICAgICAgIGNvbnN0IHJlc3VsdDogUmVjb3JkPHN0cmluZywgUmVsYXRpb248c3RyaW5nPj4gPSB7XG4gICAgICAgICAgICAgICAgICBfcGFyZW50SUQ6IG9uZShhZGFwdGVyLnRhYmxlc1tyb290VGFibGVOYW1lXSwge1xuICAgICAgICAgICAgICAgICAgICBmaWVsZHM6IFthZGFwdGVyLnRhYmxlc1tibG9ja1RhYmxlTmFtZV0uX3BhcmVudElEXSxcbiAgICAgICAgICAgICAgICAgICAgcmVmZXJlbmNlczogW2FkYXB0ZXIudGFibGVzW3Jvb3RUYWJsZU5hbWVdLmlkXSxcbiAgICAgICAgICAgICAgICAgIH0pLFxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmIChoYXNMb2NhbGVzVGFibGUoYmxvY2suZmllbGRzKSkge1xuICAgICAgICAgICAgICAgICAgcmVzdWx0Ll9sb2NhbGVzID0gbWFueShhZGFwdGVyLnRhYmxlc1tgJHtibG9ja1RhYmxlTmFtZX1fbG9jYWxlc2BdKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHN1YlJlbGF0aW9uc1RvQnVpbGQuZm9yRWFjaCgodmFsLCBrZXkpID0+IHtcbiAgICAgICAgICAgICAgICAgIHJlc3VsdFtrZXldID0gbWFueShhZGFwdGVyLnRhYmxlc1t2YWxdKVxuICAgICAgICAgICAgICAgIH0pXG5cbiAgICAgICAgICAgICAgICByZXR1cm4gcmVzdWx0XG4gICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICApXG5cbiAgICAgICAgICAgIGFkYXB0ZXIucmVsYXRpb25zW2ByZWxhdGlvbnNfJHtibG9ja1RhYmxlTmFtZX1gXSA9IGJsb2NrVGFibGVSZWxhdGlvbnNcbiAgICAgICAgICB9IGVsc2UgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSAncHJvZHVjdGlvbicpIHtcbiAgICAgICAgICAgIHZhbGlkYXRlRXhpc3RpbmdCbG9ja0lzSWRlbnRpY2FsKHtcbiAgICAgICAgICAgICAgYmxvY2ssXG4gICAgICAgICAgICAgIGxvY2FsaXplZDogZmllbGQubG9jYWxpemVkLFxuICAgICAgICAgICAgICByb290VGFibGVOYW1lLFxuICAgICAgICAgICAgICB0YWJsZTogYWRhcHRlci50YWJsZXNbYmxvY2tUYWJsZU5hbWVdLFxuICAgICAgICAgICAgfSlcbiAgICAgICAgICB9XG5cbiAgICAgICAgICByb290UmVsYXRpb25zVG9CdWlsZC5zZXQoYF9ibG9ja3NfJHtibG9jay5zbHVnfWAsIGJsb2NrVGFibGVOYW1lKVxuICAgICAgICB9KVxuXG4gICAgICAgIGJyZWFrXG4gICAgICB9XG5cbiAgICAgIGNhc2UgJ3RhYic6XG4gICAgICBjYXNlICdncm91cCc6IHtcbiAgICAgICAgaWYgKCEoJ25hbWUnIGluIGZpZWxkKSkge1xuICAgICAgICAgIGNvbnN0IHtcbiAgICAgICAgICAgIGhhc0xvY2FsaXplZEZpZWxkOiBncm91cEhhc0xvY2FsaXplZEZpZWxkLFxuICAgICAgICAgICAgaGFzTG9jYWxpemVkTWFueU51bWJlckZpZWxkOiBncm91cEhhc0xvY2FsaXplZE1hbnlOdW1iZXJGaWVsZCxcbiAgICAgICAgICAgIGhhc0xvY2FsaXplZE1hbnlUZXh0RmllbGQ6IGdyb3VwSGFzTG9jYWxpemVkTWFueVRleHRGaWVsZCxcbiAgICAgICAgICAgIGhhc0xvY2FsaXplZFJlbGF0aW9uc2hpcEZpZWxkOiBncm91cEhhc0xvY2FsaXplZFJlbGF0aW9uc2hpcEZpZWxkLFxuICAgICAgICAgICAgaGFzTWFueU51bWJlckZpZWxkOiBncm91cEhhc01hbnlOdW1iZXJGaWVsZCxcbiAgICAgICAgICAgIGhhc01hbnlUZXh0RmllbGQ6IGdyb3VwSGFzTWFueVRleHRGaWVsZCxcbiAgICAgICAgICB9ID0gdHJhdmVyc2VGaWVsZHMoe1xuICAgICAgICAgICAgYWRhcHRlcixcbiAgICAgICAgICAgIGJ1aWxkTnVtYmVycyxcbiAgICAgICAgICAgIGJ1aWxkUmVsYXRpb25zaGlwcyxcbiAgICAgICAgICAgIGJ1aWxkVGV4dHMsXG4gICAgICAgICAgICBjb2x1bW5QcmVmaXgsXG4gICAgICAgICAgICBjb2x1bW5zLFxuICAgICAgICAgICAgZGlzYWJsZU5vdE51bGwsXG4gICAgICAgICAgICBkaXNhYmxlVW5pcXVlLFxuICAgICAgICAgICAgZmllbGRQcmVmaXgsXG4gICAgICAgICAgICBmaWVsZHM6IGZpZWxkLmZpZWxkcyxcbiAgICAgICAgICAgIGZvcmNlTG9jYWxpemVkLFxuICAgICAgICAgICAgaW5kZXhlcyxcbiAgICAgICAgICAgIGxvY2FsZXNDb2x1bW5zLFxuICAgICAgICAgICAgbG9jYWxlc0luZGV4ZXMsXG4gICAgICAgICAgICBuZXdUYWJsZU5hbWUsXG4gICA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ZXJGaWVsZDogcm93SGFzTG9jYWxpemVkTWFueU51bWJlckZpZWxkLFxuICAgICAgICAgIGhhc0xvY2FsaXplZE1hbnlUZXh0RmllbGQ6IHJvd0hhc0xvY2FsaXplZE1hbnlUZXh0RmllbGQsXG4gICAgICAgICAgaGFzTG9jYWxpemVkUmVsYXRpb25zaGlwRmllbGQ6IHJvd0hhc0xvY2FsaXplZFJlbGF0aW9uc2hpcEZpZWxkLFxuICAgICAgICAgIGhhc01hbnlOdW1iZXJGaWVsZDogcm93SGFzTWFueU51bWJlckZpZWxkLFxuICAgICAgICAgIGhhc01hbnlUZXh0RmllbGQ6IHJvd0hhc01hbnlUZXh0RmllbGQsXG4gICAgICAgIH0gPSB0cmF2ZXJzZUZpZWxkcyh7XG4gICAgICAgICAgYWRhcHRlcixcbiAgICAgICAgICBidWlsZE51bWJlcnMsXG4gICAgICAgICAgYnVpbGRSZWxhdGlvbnNoaXBzLFxuICAgICAgICAgIGJ1aWxkVGV4dHMsXG4gICAgICAgICAgY29sdW1uUHJlZml4LFxuICAgICAgICAgIGNvbHVtbnMsXG4gICAgICAgICAgZGlzYWJsZU5vdE51bGw6IGRpc2FibGVOb3ROdWxsRnJvbUhlcmUsXG4gICAgICAgICAgZGlzYWJsZVVuaXF1ZSxcbiAgICAgICAgICBmaWVsZFByZWZpeCxcbiAgICAgICAgICBmaWVsZHM6IGZpZWxkLmZpZWxkcyxcbiAgICAgICAgICBmb3JjZUxvY2FsaXplZCxcbiAgICAgICAgICBpbmRleGVzLFxuICAgICAgICAgIGxvY2FsZXNDb2x1bW5zLFxuICAgICAgICAgIGxvY2FsZXNJbmRleGVzLFxuICAgICAgICAgIG5ld1RhYmxlTmFtZTogcGFyZW50VGFibGVOYW1lLFxuICAgICAgICAgIHBhcmVudFRhYmxlTmFtZSxcbiAgICAgICAgICByZWxhdGlvbnNUb0J1aWxkLFxuICAgICAgICAgIHJlbGF0aW9uc2hpcHMsXG4gICAgICAgICAgcm9vdFJlbGF0aW9uc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