@payloadcms/db-postgres 3.0.0-alpha.41 → 3.0.0-alpha.42

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. package/dist/connect.js +1 -1
  2. package/dist/connect.js.map +1 -0
  3. package/dist/create.js +1 -1
  4. package/dist/create.js.map +1 -0
  5. package/dist/createGlobal.js +1 -1
  6. package/dist/createGlobal.js.map +1 -0
  7. package/dist/createGlobalVersion.js +1 -1
  8. package/dist/createGlobalVersion.js.map +1 -0
  9. package/dist/createMigration.js +1 -1
  10. package/dist/createMigration.js.map +1 -0
  11. package/dist/createVersion.js +1 -1
  12. package/dist/createVersion.js.map +1 -0
  13. package/dist/deleteMany.js +1 -1
  14. package/dist/deleteMany.js.map +1 -0
  15. package/dist/deleteOne.js +1 -1
  16. package/dist/deleteOne.js.map +1 -0
  17. package/dist/deleteVersions.js +1 -1
  18. package/dist/deleteVersions.js.map +1 -0
  19. package/dist/destroy.js +1 -1
  20. package/dist/destroy.js.map +1 -0
  21. package/dist/find/buildFindManyArgs.js +1 -1
  22. package/dist/find/buildFindManyArgs.js.map +1 -0
  23. package/dist/find/chainMethods.js +1 -1
  24. package/dist/find/chainMethods.js.map +1 -0
  25. package/dist/find/findMany.js +1 -1
  26. package/dist/find/findMany.js.map +1 -0
  27. package/dist/find/traverseFields.js +1 -1
  28. package/dist/find/traverseFields.js.map +1 -0
  29. package/dist/find.js +1 -1
  30. package/dist/find.js.map +1 -0
  31. package/dist/findGlobal.js +1 -1
  32. package/dist/findGlobal.js.map +1 -0
  33. package/dist/findGlobalVersions.js +1 -1
  34. package/dist/findGlobalVersions.js.map +1 -0
  35. package/dist/findOne.js +1 -1
  36. package/dist/findOne.js.map +1 -0
  37. package/dist/findVersions.js +1 -1
  38. package/dist/findVersions.js.map +1 -0
  39. package/dist/index.js +1 -1
  40. package/dist/index.js.map +1 -0
  41. package/dist/init.js +1 -1
  42. package/dist/init.js.map +1 -0
  43. package/dist/migrate.js +1 -1
  44. package/dist/migrate.js.map +1 -0
  45. package/dist/migrateDown.js +1 -1
  46. package/dist/migrateDown.js.map +1 -0
  47. package/dist/migrateFresh.js +1 -1
  48. package/dist/migrateFresh.js.map +1 -0
  49. package/dist/migrateRefresh.js +1 -1
  50. package/dist/migrateRefresh.js.map +1 -0
  51. package/dist/migrateReset.js +1 -1
  52. package/dist/migrateReset.js.map +1 -0
  53. package/dist/migrateStatus.js +1 -1
  54. package/dist/migrateStatus.js.map +1 -0
  55. package/dist/queries/buildAndOrConditions.js +1 -1
  56. package/dist/queries/buildAndOrConditions.js.map +1 -0
  57. package/dist/queries/buildQuery.js +1 -1
  58. package/dist/queries/buildQuery.js.map +1 -0
  59. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js +1 -1
  60. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js.map +1 -0
  61. package/dist/queries/createJSONQuery/formatJSONPathSegment.js +1 -1
  62. package/dist/queries/createJSONQuery/formatJSONPathSegment.js.map +1 -0
  63. package/dist/queries/createJSONQuery/index.js +1 -1
  64. package/dist/queries/createJSONQuery/index.js.map +1 -0
  65. package/dist/queries/getTableColumnFromPath.js +1 -1
  66. package/dist/queries/getTableColumnFromPath.js.map +1 -0
  67. package/dist/queries/operatorMap.js +1 -1
  68. package/dist/queries/operatorMap.js.map +1 -0
  69. package/dist/queries/parseParams.js +1 -1
  70. package/dist/queries/parseParams.js.map +1 -0
  71. package/dist/queries/sanitizeQueryValue.js +1 -1
  72. package/dist/queries/sanitizeQueryValue.js.map +1 -0
  73. package/dist/queryDrafts.js +1 -1
  74. package/dist/queryDrafts.js.map +1 -0
  75. package/dist/schema/build.js +1 -1
  76. package/dist/schema/build.js.map +1 -0
  77. package/dist/schema/createIndex.js +1 -1
  78. package/dist/schema/createIndex.js.map +1 -0
  79. package/dist/schema/idToUUID.js +1 -1
  80. package/dist/schema/idToUUID.js.map +1 -0
  81. package/dist/schema/parentIDColumnMap.js +1 -1
  82. package/dist/schema/parentIDColumnMap.js.map +1 -0
  83. package/dist/schema/setColumnID.js +1 -1
  84. package/dist/schema/setColumnID.js.map +1 -0
  85. package/dist/schema/traverseFields.js +1 -1
  86. package/dist/schema/traverseFields.js.map +1 -0
  87. package/dist/schema/validateExistingBlockIsIdentical.js +1 -1
  88. package/dist/schema/validateExistingBlockIsIdentical.js.map +1 -0
  89. package/dist/transactions/beginTransaction.js +1 -1
  90. package/dist/transactions/beginTransaction.js.map +1 -0
  91. package/dist/transactions/commitTransaction.js +1 -1
  92. package/dist/transactions/commitTransaction.js.map +1 -0
  93. package/dist/transactions/rollbackTransaction.js +1 -1
  94. package/dist/transactions/rollbackTransaction.js.map +1 -0
  95. package/dist/transform/read/hasManyNumber.js +1 -1
  96. package/dist/transform/read/hasManyNumber.js.map +1 -0
  97. package/dist/transform/read/hasManyText.js +1 -1
  98. package/dist/transform/read/hasManyText.js.map +1 -0
  99. package/dist/transform/read/index.js +1 -1
  100. package/dist/transform/read/index.js.map +1 -0
  101. package/dist/transform/read/relationship.js +1 -1
  102. package/dist/transform/read/relationship.js.map +1 -0
  103. package/dist/transform/read/traverseFields.js +1 -1
  104. package/dist/transform/read/traverseFields.js.map +1 -0
  105. package/dist/transform/write/array.js +1 -1
  106. package/dist/transform/write/array.js.map +1 -0
  107. package/dist/transform/write/blocks.js +1 -1
  108. package/dist/transform/write/blocks.js.map +1 -0
  109. package/dist/transform/write/index.js +1 -1
  110. package/dist/transform/write/index.js.map +1 -0
  111. package/dist/transform/write/numbers.js +1 -1
  112. package/dist/transform/write/numbers.js.map +1 -0
  113. package/dist/transform/write/relationships.js +1 -1
  114. package/dist/transform/write/relationships.js.map +1 -0
  115. package/dist/transform/write/selects.js +1 -1
  116. package/dist/transform/write/selects.js.map +1 -0
  117. package/dist/transform/write/texts.js +1 -1
  118. package/dist/transform/write/texts.js.map +1 -0
  119. package/dist/transform/write/traverseFields.js +1 -1
  120. package/dist/transform/write/traverseFields.js.map +1 -0
  121. package/dist/transform/write/types.js +1 -1
  122. package/dist/transform/write/types.js.map +1 -0
  123. package/dist/types.js +1 -1
  124. package/dist/types.js.map +1 -0
  125. package/dist/update.js +1 -1
  126. package/dist/update.js.map +1 -0
  127. package/dist/updateGlobal.js +1 -1
  128. package/dist/updateGlobal.js.map +1 -0
  129. package/dist/updateGlobalVersion.js +1 -1
  130. package/dist/updateGlobalVersion.js.map +1 -0
  131. package/dist/updateVersion.js +1 -1
  132. package/dist/updateVersion.js.map +1 -0
  133. package/dist/upsertRow/deleteExistingArrayRows.js +1 -1
  134. package/dist/upsertRow/deleteExistingArrayRows.js.map +1 -0
  135. package/dist/upsertRow/deleteExistingRowsByPath.js +1 -1
  136. package/dist/upsertRow/deleteExistingRowsByPath.js.map +1 -0
  137. package/dist/upsertRow/index.js +1 -1
  138. package/dist/upsertRow/index.js.map +1 -0
  139. package/dist/upsertRow/insertArrays.js +1 -1
  140. package/dist/upsertRow/insertArrays.js.map +1 -0
  141. package/dist/upsertRow/types.js +1 -1
  142. package/dist/upsertRow/types.js.map +1 -0
  143. package/dist/utilities/appendPrefixToKeys.js +1 -1
  144. package/dist/utilities/appendPrefixToKeys.js.map +1 -0
  145. package/dist/utilities/createBlocksMap.js +1 -1
  146. package/dist/utilities/createBlocksMap.js.map +1 -0
  147. package/dist/utilities/createMigrationTable.js +1 -1
  148. package/dist/utilities/createMigrationTable.js.map +1 -0
  149. package/dist/utilities/createRelationshipMap.js +1 -1
  150. package/dist/utilities/createRelationshipMap.js.map +1 -0
  151. package/dist/utilities/hasLocalesTable.js +1 -1
  152. package/dist/utilities/hasLocalesTable.js.map +1 -0
  153. package/dist/utilities/isArrayOfRows.js +1 -1
  154. package/dist/utilities/isArrayOfRows.js.map +1 -0
  155. package/dist/utilities/migrationTableExists.js +1 -1
  156. package/dist/utilities/migrationTableExists.js.map +1 -0
  157. package/dist/utilities/parseError.js +1 -1
  158. package/dist/utilities/parseError.js.map +1 -0
  159. package/dist/utilities/pushDevSchema.js +1 -1
  160. package/dist/utilities/pushDevSchema.js.map +1 -0
  161. package/package.json +3 -3
@@ -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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9xdWVyaWVzL3BhcnNlUGFyYW1zLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8qIGVzbGludC1kaXNhYmxlIG5vLWF3YWl0LWluLWxvb3AgKi9cbmltcG9ydCB0eXBlIHsgU1FMIH0gZnJvbSAnZHJpenpsZS1vcm0nXG5pbXBvcnQgdHlwZSB7IEZpZWxkLCBPcGVyYXRvciwgV2hlcmUgfSBmcm9tICdwYXlsb2FkL3R5cGVzJ1xuXG5pbXBvcnQgeyBhbmQsIGlsaWtlLCBpc05vdE51bGwsIGlzTnVsbCwgbmUsIG5vdEluQXJyYXksIG9yLCBzcWwgfSBmcm9tICdkcml6emxlLW9ybSdcbmltcG9ydCB7IFF1ZXJ5RXJyb3IgfSBmcm9tICdwYXlsb2FkL2Vycm9ycydcbmltcG9ydCB7IHZhbGlkT3BlcmF0b3JzIH0gZnJvbSAncGF5bG9hZC90eXBlcydcblxuaW1wb3J0IHR5cGUgeyBHZW5lcmljQ29sdW1uLCBQb3N0Z3Jlc0FkYXB0ZXIgfSBmcm9tICcuLi90eXBlcy5qcydcbmltcG9ydCB0eXBlIHsgQnVpbGRRdWVyeUpvaW5BbGlhc2VzLCBCdWlsZFF1ZXJ5Sm9pbnMgfSBmcm9tICcuL2J1aWxkUXVlcnkuanMnXG5cbmltcG9ydCB7IGJ1aWxkQW5kT3JDb25kaXRpb25zIH0gZnJvbSAnLi9idWlsZEFuZE9yQ29uZGl0aW9ucy5qcydcbmltcG9ydCB7IGNyZWF0ZUpTT05RdWVyeSB9IGZyb20gJy4vY3JlYXRlSlNPTlF1ZXJ5L2luZGV4LmpzJ1xuaW1wb3J0IHsgY29udmVydFBhdGhUb0pTT05UcmF2ZXJzYWwgfSBmcm9tICcuL2NyZ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XMgYW4gQU5ELCBPUiwgb3IgYSBzY2hlbWEgcGF0aFxuICAgIGZvciAoY29uc3QgcmVsYXRpb25PclBhdGggb2YgT2JqZWN0LmtleXMod2hlcmUpKSB7XG4gICAgICBpZiAocmVsYXRpb25PclBhdGgpIHtcbiAgICAgICAgY29uc3QgY29uZGl0aW9uID0gd2hlcmVbcmVsYXRpb25PclBhdGhdXG4gICAgICAgIGxldCBjb25kaXRpb25PcGVyYXRvcjogJ2FuZCcgfCAnb3InXG4gICAgICAgIGlmIChyZWxhdGlvbk9yUGF0aC50b0xvd2VyQ2FzZSgpID09PSAnYW5kJykge1xuICAgICAgICAgIGNvbmRpdGlvbk9wZXJhdG9yID0gJ2FuZCdcbiAgICAgICAgfSBlbHNlIGlmIChyZWxhdGlvbk9yUGF0aC50b0xvd2VyQ2FzZSgpID09PSAnb3InKSB7XG4gICAgICAgICAgY29uZGl0aW9uT3BlcmF0b3IgPSAnb3InXG4gICAgICAgIH1cbiAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoY29uZGl0aW9uKSkge1xuICAgICAgICAgIGNvbnN0IGJ1aWx0Q29uZGl0aW9ucyA9IGF3YWl0IGJ1aWxkQW5kT3JDb25kaXRpb25zKHtcbiAgICAgICAgICAgIGFkYXB0ZXIsXG4gICAgICAgICAgICBmaWVsZHMsXG4gICAgICAgICAgICBqb2luQWxpYXNlcyxcbiAgICAgICAgICAgIGpvaW5zLFxuICAgICAgICAgICAgbG9jYWxlLFxuICAgICAgICAgICAgc2VsZWN0RmllbGRzLFxuICAgICAgICAgICAgdGFibGVOYW1lLFxuICAgICAgICAgICAgd2hlcmU6IGNvbmRpdGlvbixcbiAgICAgICAgICB9KVxuICAgICAgICAgIGlmIChidWlsdENvbmRpdGlvbnMubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgcmVzdWx0ID0gb3BlcmF0b3JNYXBbY29uZGl0aW9uT3BlcmF0b3JdKC4uLmJ1aWx0Q29uZGl0aW9ucylcbiAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgLy8gSXQncyBhIHBhdGggLSBhbmQgdGhlcmUgY2FuIGJlIG11bHRpcGxlIGNvbXBhcmlzb25zIG9uIGEgc2luZ2xlIHBhdGguXG4gICAgICAgICAgLy8gRm9yIGV4YW1wbGUgLSB0aXRsZSBsaWtlICd0ZXN0JyBhbmQgdGl0bGUgbm90IGVxdWFsIHRvICd0ZXN0ZXInXG4gICAgICAgICAgLy8gU28gd2UgbmVlZCB0byBsb29wIG9uIGtleXMgYWdhaW4gaGVyZSB0byBoYW5kbGUgZWFjaCBvcGVyYXRvciBpbmRlcGVuZGVudGx5XG4gICAgICAgICAgY29uc3QgcGF0aE9wZXJhdG9ycyA9IHdoZXJlW3JlbGF0aW9uT3JQYXRoXVxuICAgICAgICAgIGlmICh0eXBlb2YgcGF0aE9wZXJhdG9ycyA9PT0gJ29iamVjdCcpIHtcbiAgICAgICAgICAgIGZvciAoY29uc3Qgb3BlcmF0b3Igb2YgT2JqZWN0LmtleXMocGF0aE9wZXJhdG9ycykpIHtcbiAgICAgICAgICAgICAgaWYgKHZhbGlkT3BlcmF0b3JzLmluY2x1ZGVzKG9wZXJhdG9yIGFzIE9wZXJhdG9yKSkge1xuICAgICAgICAgICAgICAgIGNvbnN0IHZhbCA9IHdoZXJlW3JlbGF0aW9uT3JQYXRoXVtvcGVyYXRvcl1cbiAgICAgICAgICAgICAgICBjb25zdCB7XG4gICAgICAgICAgICAgICAgICBjb2x1bW5OYW1lLFxuICAgICAgICAgICAgICAgICAgY29uc3RyYWludHM6IHF1ZXJ5Q29uc3RyYWludHMsXG4gICAgICAgICAgICAgICAgICBmaWVsZCxcbiAgICAgICAgICAgICAgICAgIGdldE5vdE51bGxDb2x1bW5CeVZhbHVlLFxuICAgICAgICAgICAgICAgICAgcGF0aFNlZ21lbnRzLFxuICAgICAgICAgICAgICAgICAgcmF3Q29sdW1uLFxuICAgICAgICAgICAgICAgICAgdGFibGUsXG4gICAgICAgICAgICAgICAgfSA9IGdldFRhYmxlQ29sdW1uRnJvbVBhdGgoe1xuICAgICAgICAgICAgICAgICAgYWRhcHRlcixcbiAgICAgICAgICAgICAgICAgIGNvbGxlY3Rpb25QYXRoOiByZWxhdGlvbk9yUGF0aCxcbiAgICAgICAgICAgICAgICAgIGZpZWxkcyxcbiAgICAgICAgICAgICAgICAgIGpvaW5BbGlhc2VzLFxuICAgICAgICAgICAgICAgICAgam9pbnMsXG4gICAgICAgICAgICAgICAgICBsb2NhbGUsXG4gICAgICAgICAgICAgICAgICBwYXRoU2VnbWVudHM6IHJlbGF0aW9uT3JQYXRoLnJlcGxhY2UoL19fL2csICcuJykuc3BsaXQoJy4nKSxcbiAgICAgICAgICAgICAgICAgIHNlbGVjdEZpZWxkcyxcbiAgICAgICAgICAgICAgICAgIHRhYmxlTmFtZSxcbiAgICAgICAgICAgICAgICAgIHZhbHVlOiB2YWwsXG4gICAgICAgICAgICAgICAgfSlcblxuICAgICAgICAgICAgICAgIHF1ZXJ5Q29uc3RyYWludHMuZm9yRWFjaCgoeyBjb2x1bW5OYW1lOiBjb2wsIHRhYmxlOiBjb25zdHJhaW50VGFibGUsIHZhbHVlIH0pID0+IHtcbiAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgdmFsdWUgPT09ICdzdHJpbmcnICYmIHZhbHVlLmluZGV4T2YoJyUnKSA+IC0xKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0cmFpbnRzLnB1c2gob3BlcmF0b3JNYXAubGlrZShjb25zdHJhaW50VGFibGVbY29sXSwgdmFsdWUpKVxuICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3RyYWludHMucHVzaChvcGVyYXRvck1hcC5lcXVhbHMoY29uc3RyYWludFRhYmxlW2NvbF0sIHZhbHVlKSlcbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9KVxuXG4gICAgICAgICAgICAgICAgaWYgKFxuICAgICAgICAgICAgICAgICAgWydqc29uJywgJ3JpY2hUZXh0J10uaW5jbHVkZXMoZmllbGQudHlwZSkgJiZcbiAgICAgICAgICAgICAgICAgIEFycmF5LmlzQXJyYXkocGF0aFNlZ21lbnRzKSAmJlxuICAgICAgICAgICAgICAgICAgcGF0aFNlZ21lbnRzLmxlbmd0aCA+IDFcbiAgICAgICAgICAgICAgICApIHtcbiAgICAgICAgICAgICAgICAgIGNvbnN0IHNlZ21lbnRzID0gcGF0aFNlZ21lbnRzLnNsaWNlKDEpXG4gICAgICAgICAgICAgICAgICBzZWdtZW50cy51bnNoaWZ0KHRhYmxlW2NvbHVtbk5hbWVdLm5hbWUpXG5cbiAgICAgICAgICAgICAgICAgIGlmIChmaWVsZC50eXBlID09PSAncmljaFRleHQnKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGpzb25RdWVyeSA9IGNyZWF0ZUpTT05RdWVyeSh7XG4gICAgICAgICAgICAgICAgICAgICAgb3BlcmF0b3IsXG4gICAgICAgICAgICAgICAgICAgICAgcGF0aFNlZ21lbnRzOiBzZWdtZW50cyxcbiAgICAgICAgICAgICAgICAgICAgICB0cmVhdEFzQXJyYXk6IFsnY2hpbGRyZW4nXSxcbiAgICAgICAgICAgICAgICAgICAgICB0cmVhdFJvb3RBc0FycmF5OiB0cnVlLFxuICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiB2YWwsXG4gICAgICAgICAgICAgICAgICAgIH0pXG5cbiAgICAgICAgICAgICAgICAgICAgY29uc3RyYWludHMucHVzaChzcWwucmF3KGpzb25RdWVyeSkpXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrXG4gICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgIGNvbnN0IGpzb25RdWVyeSA9IGNvbnZlcnRQYXRoVG9KU09OVHJhdmVyc2FsKHBhdGhTZWdtZW50cylcbiAgICAgICAgICAgICAgICAgIGNvbnN0IG9wZXJhdG9yS2V5cyA9IHtcbiAgICAgICAgICAgICAgICAgICAgY29udGFpbnM6IHsgb3BlcmF0b3I6ICdpbGlrZScsIHdpbGRjYXJkOiAnJScgfSxcbiAgICAgICAgICAgICAgICAgICAgZXF1YWxzOiB7IG9wZXJhdG9yOiAnPScsIHdpbGRjYXJkOiAnJyB9LFxuICAgICAgICAgICAgICAgICAgICBleGlzdHM6IHsgb3BlcmF0b3I6IHZhbCA9PT0gdHJ1ZSA/ICdpcyBub3QgbnVsbCcgOiAnaXMgbnVsbCcgfSxcbiAgICAgICAgICAgICAgICAgICAgbGlrZTogeyBvcGVyYXRvcjogJ2xpa2UnLCB3aWxkY2FyZDogJyUnIH0sXG4gICAgICAgICAgICAgICAgICAgIG5vdF9lcXVhbHM6IHsgb3BlcmF0b3I6ICc8PicsIHdpbGRjYXJkOiAnJyB9LFxuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgbGV0IGZvcm1hdHRlZFZhbHVlID0gYCcke29wZXJhdG9yS2V5c1tvcGVyYXRvcl0ud2lsZGNhcmR9JHt2YWx9JHtvcGVyYXRvcktleXNbb3BlcmF0b3JdLndpbGRjYXJkfSdgXG5cbiAgICAgICAgICAgICAgICAgIGlmIChvcGVyYXRvciA9PT0gJ2V4aXN0cycpIHtcbiAgICAgICAgICAgICAgICAgICAgZm9ybWF0dGVkVmFsdWUgPSAnJ1xuICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICBjb25zdHJhaW50cy5wdXNoKFxuICAgICAgICAgICAgICAgICAgICBzcWwucmF3KFxuICAgICAgICAgICAgICAgICAgICAgIGAke3RhYmxlW2NvbHVtbk5hbWVdLm5hbWV9JHtqc29uUXVlcnl9ICR7b3BlcmF0b3JLZXlzW29wZXJhdG9yXS5vcGVyYXRvcn0gJHtmb3JtYXR0ZWRWYWx1ZX1gLFxuICAgICAgICAgICAgICAgICAgICApLFxuICAgICAgICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICAgICAgICBicmVha1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmIChnZXROb3ROdWxsQ29sdW1uQnlWYWx1ZSkge1xuICAgICAgICAgICAgICAgICAgY29uc3QgY29sdW1uTmFtZSA9IGdldE5vdE51bGxDb2x1bW5CeVZhbHVlKHZhbClcbiAgICAgICAgICAgICAgICAgIGlmIChjb2x1bW5OYW1lKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0cmFpbnRzLnB1c2goaXNOb3ROdWxsKHRhYmxlW2NvbHVtbk5hbWVdKSlcbiAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBRdWVyeUVycm9yKFt7IHBhdGg6IHJlbGF0aW9uT3JQYXRoIH1dKVxuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgYnJlYWtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAob3BlcmF0b3IgPT09ICdsaWtlJykge1xuICAgICAgICAgICAgICAgICAgY29uc3RyYWludHMucHVzaChcbiAgICAgICAgICAgICAgICAgICAgYW5kKC4uLnZhbC5zcGxpdCgnICcpLm1hcCgod29yZCkgPT4gaWxpa2UodGFibGVbY29sdW1uTmFtZV0sIGAlJHt3b3JkfSVgKSkpLFxuICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgICAgYnJlYWtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBjb25zdCBzYW5pdGl6ZWRRdWVyeVZhbHVlID0gc2FuaXRpemVRdWVyeVZhbHVlKHtcbiAgICAgICAgICAgICAgICAgIGFkYXB0ZXIsXG4gICAgICAgICAgICAgICAgICBmaWVsZCxcbiAgICAgICAgICAgICAgICAgIG9wZXJhdG9yLFxuICAgICAgICAgICAgICAgICAgcmVsYXRpb25PclBhdGgsXG4gICAgICAgICAgICAgICAgICB2YWwsXG4gICAgICAgICAgICAgICAgfSlcblxuICAgICAgICAgICAgICAgIGlmIChzYW5pdGl6ZWRRdWVyeVZhbHVlID09PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICBicmVha1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGNvbnN0IHsgb3BlcmF0b3I6IHF1ZXJ5T3BlcmF0b3IsIHZhbHVlOiBxdWVyeVZhbHVlIH0gPSBzYW5pdGl6ZWRRdWVyeVZhbHVlXG5cbiAgICAgICAgICAgICAgICBpZiAocXVlcnlPcGVyYXRvciA9PT0gJ25vdF9lcXVhbHMnICYmIHF1ZXJ5VmFsdWUgIT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgIGNvbnN0cmFpbnRzLnB1c2goXG4gICAgICAgICAgICAgICAgICAgIG9yKFxuICAgICAgICAgICAgICAgICAgICAgIGlzTnVsbChyYXdDb2x1bW4gfHwgdGFibGVbY29sdW1uTmFtZV0pLFxuICAgICAgICAgICAgICAgICAgICAgIC8qIGVzbGludC1kaXNhYmxlIEB0eXBlc2NyaXB0LWVzbGludC9uby1leHBsaWNpdC1hbnkgKi9cbiAgICAgICAgICAgICAgICAgICAgICBuZTxhbnk+KHJhd0NvbHVtbiB8fCB0YWJsZVtjb2x1bW5OYW1lXSwgcXVlcnlWYWx1ZSksXG4gICAgICAgICAgICAgICAgICAgICksXG4gICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgICBicmVha1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmIChcbiAgICAgICAgICAgICAgICAgIChmaWVsZC50eXBlID09PSAncmVsYXRpb25zaGlwJyB8fCBmaWVsZC50eXBlID09PSAndXBsb2FkJykgJiZcbiAgICAgICAgICAgICAgICAgIEFycmF5LmlzQXJyYXkocXVlcnlWYWx1ZSkgJiZcbiAgICAgICAgICAgICAgICAgIG9wZXJhdG9yID09PSAnbm90X2luJ1xuICAgICAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICAgICAgY29uc3RyYWludHMucHVzaChcbiAgICAgICAgICAgICAgICAgICAgc3FsYCR7bm90SW5BcnJheSh0YWJsZVtjb2x1bW5OYW1lXSwgcXVlcnlWYWx1ZSl9IE9SXG4gICAgICAgICAgICAgICAgICAgICR7dGFibGVbY29sdW1uTmFtZV19XG4gICAgICAgICAgICAgICAgICAgIElTXG4gICAgICAgICAgICAgICAgICAgIE5VTExgLFxuICAgICAgICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICAgICAgICBicmVha1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmIChvcGVyYXRvciA9PT0gJ2VxdWFscycgJiYgcXVlcnlWYWx1ZSA9PT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgY29uc3RyYWludHMucHVzaChpc051bGwocmF3Q29sdW1uIHx8IHRhYmxlW2NvbHVtbk5hbWVdKSlcbiAgICAgICAgICAgICAgICAgIGJyZWFrXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgaWYgKG9wZXJhdG9yID09PSAnbm90X2VxdWFscycgJiYgcXVlcnlWYWx1ZSA9PT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgY29uc3RyYWludHMucHVzaChpc05vdE51bGwocmF3Q29sdW1uIHx8IHRhYmxlW2NvbHVtbk5hbWVdKSlcbiAgICAgICAgICAgICAgICAgIGJyZWFrXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgY29uc3RyYWludHMucHVzaChcbiAgICAgICAgICAgICAgICAgIG9wZXJhdG9yTWFwW3F1ZXJ5T3BlcmF0b3JdKHJhd0NvbHVtbiB8fCB0YWJsZVtjb2x1bW5OYW1lXSwgcXVlcnlWYWx1ZSksXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuICB9XG4gIGlmIChjb25zdHJhaW50cy5sZW5ndGggPiAwKSB7XG4gICAgaWYgKHJlc3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UIsT0FBTztZQUNMRCxTQUFTekIsT0FBTzBCO1FBQ2xCO0lBQ0Y7SUFDQSxJQUFJQSxZQUFZRyxNQUFNLEtBQUssS0FBSyxDQUFDSixRQUFRO1FBQ3RDLENBQUNBLE9BQU8sR0FBR0M7SUFDZDtJQUVBLE9BQU9EO0FBQ1QifQ==
182
+ //# sourceMappingURL=parseParams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/queries/parseParams.ts"],"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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,OAAO2C,aAAaC,KAAK,CAACN,WAAW;oCACtD;gCACF;gCAEA,IAAIH,aAAa,gBAAgByC,eAAe,MAAM;oCACpDrD,YAAY8B,IAAI,CAACtD,UAAU4C,aAAaC,KAAK,CAACN,WAAW;oCACzD;gCACF;gCAEAf,YAAY8B,IAAI,CACd1C,WAAW,CAACgE,cAAc,CAAChC,aAAaC,KAAK,CAACN,WAAW,EAAEsC;4BAE/D;wBACF;oBACF;gBACF;YACF;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=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9xdWVyaWVzL3Nhbml0aXplUXVlcnlWYWx1ZS50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBBUElFcnJvciB9IGZyb20gJ3BheWxvYWQvZXJyb3JzJ1xuaW1wb3J0IHsgdHlwZSBGaWVsZCwgdHlwZSBUYWJBc0ZpZWxkLCBmaWVsZEFmZmVjdHNEYXRhIH0gZnJvbSAncGF5bG9hZC90eXBlcydcbmltcG9ydCB7IGNyZWF0ZUFycmF5RnJvbUNvbW1hRGVsaW5lYXRlZCB9IGZyb20gJ3BheWxvYWQvdXRpbGl0aWVzJ1xuXG5pbXBvcnQgdHlwZSB7IFBvc3RncmVzQWRhcHRlciB9IGZyb20gJy4uL3R5cGVzLmpzJ1xuXG50eXBlIFNhbml0aXplUXVlcnlWYWx1ZUFyZ3MgPSB7XG4gIGFkYX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QUlOLFNBQ1IsQ0FBQyxlQUFlLEVBQUVNLFNBQVMsc0RBQXNELENBQUM7SUFFdEY7SUFFQSxJQUFJQSxhQUFhLFlBQVk7UUFDM0JJLGlCQUFpQixDQUFDLENBQUMsRUFBRUEsZUFBZSxDQUFDLENBQUM7SUFDeEM7SUFFQSxJQUFJSixhQUFhLFVBQVU7UUFDekJJLGlCQUFpQkEsbUJBQW1CLFVBQVVBLG1CQUFtQjtRQUNqRSxJQUFJQSxtQkFBbUIsT0FBTztZQUM1QkosV0FBVztRQUNiO0lBQ0Y7SUFFQSxPQUFPO1FBQUVBO1FBQVVLLE9BQU9EO0lBQWU7QUFDM0MsRUFBQyJ9
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,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AI,OAAOH,QAAQ,UAAU;YAC3BC,iBAAiB,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"}
@@ -38,4 +38,4 @@ export const queryDrafts = async function queryDrafts({ collection, limit, local
38
38
  };
39
39
  };
40
40
 
41
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9xdWVyeURyYWZ0cy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgdHlwZSB7IFBheWxvYWRSZXF1ZXN0LCBTYW5pdGl6ZWRDb2xsZWN0aW9uQ29uZmlnIH0gZnJvbSAncGF5bG9hZC90eXBlcydcblxuaW1wb3J0IHsgdHlwZSBRdWVyeURyYWZ0cywgY29tYmluZVF1ZXJpZXMgfSBmcm9tICdwYXlsb2FkL2RhdGFiYXNlJ1xuaW1wb3J0IHsgYnV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ionConfig } 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"}
@@ -273,4 +273,4 @@ export const buildTable = ({ adapter, baseColumns = {}, baseExtraConfig = {}, bu
273
273
  };
274
274
  };
275
275
 
276
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWEvYnVpbGQudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyogZXNsaW50LWRpc2FibGUgbm8tcGFyYW0tcmVhc3NpZ24gKi9cbmltcG9ydCB0eXBlIHsgUmVsYXRpb24gfSBmcm9tICdkcml6emxlLW9ybSdcbmltcG9ydCB0eXBlIHtcbiAgSW5kZXhCdWlsZGVyLFxuICBQZ0NvbHVtbkJ1aWxkZXIsXG4gIFBnVGFibGVXaXRoQ29sdW1ucyxcbiAgVW5pcXVlQ29uc3RyYWludEJ1aWxkZXIsXG59IGZyb20gJ2RyaXp6bGUtb3JtL3BnLWNvcmUnXG5pbXBvcnQgdHlwZSB7IEZpZWxkIH0gZnJvbSAncGF5bG9hZC90eXBlcydcblxuaW1wb3J0IHsgcmVsYXRpb25zIH0gZnJvbSAnZHJpenpsZS1vcm0nXG5pbXBvcnQgeyBpbmRleCwgaW50ZWdlciw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1fcGFyZW50X2lkeGApLm9uKGNvbHMucGFyZW50KSxcbiAgICAgICAgICAgIHBhdGhJZHg6IGluZGV4KGAke3JlbGF0aW9uc2hpcHNUYWJsZU5hbWV9X3BhdGhfaWR4YCkub24oY29scy5wYXRoKSxcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAoaGFzTG9jYWxpemVkUmVsYXRpb25zaGlwRmllbGQpIHtcbiAgICAgICAgICAgIHJlc3VsdC5sb2NhbGVJZHggPSBpbmRleChgJHtyZWxhdGlvbnNoaXBzVGFibGVOYW1lfV9sb2NhbGVfaWR4YCkub24oY29scy5sb2NhbGUpXG4gICAgICAgICAgfVxuXG4gICAgICAgICAgcmV0dXJuIHJlc3VsdFxuICAgICAgICB9LFxuICAgICAgKVxuXG4gICAgICBhZGFwdGVyLnRhYmxlc1tyZWxhdGlvbnNoaXBzVGFibGVOYW1lXSA9IHJlbGF0aW9uc2hpcHNUYWJsZVxuXG4gICAgICBjb25zdCByZWxhdGlvbnNoaXBzVGFibGVSZWxhdGlvbnMgPSByZWxhdGlvbnMocmVsYXRpb25zaGlwc1RhYmxlLCAoeyBvbmUgfSkgPT4ge1xuICAgICAgICBjb25zdCByZXN1bHQ6IFJlY29yZDxzdHJpbmcsIFJlbGF0aW9uPHN0cmluZz4+ID0ge1xuICAgICAgICAgIHBhcmVudDogb25lKHRhYmxlLCB7XG4gICAgICAgICAgICBmaWVsZHM6IFtyZWxhdGlvbnNoaXBzVGFibGUucGFyZW50XSxcbiAgICAgICAgICAgIHJlZmVyZW5jZXM6IFt0YWJsZS5pZF0sXG4gICAgICAgICAgICByZWxhdGlvbk5hbWU6ICdfcmVscycsXG4gICAgICAgICAgfSksXG4gICAgICAgIH1cblxuICAgICAgICByZWxhdGlvbnNoaXBzLmZvckVhY2goKHJlbGF0aW9uVG8pID0+IHtcbiAgICAgICAgICBjb25zdCByZWxhdGVkVGFibGVOYW1lID0gdG9TbmFrZUNhc2UocmVsYXRpb25UbylcbiAgICAgICAg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O1FBQ3pCO1FBRUEsSUFBSU4sa0JBQWtCO1lBQ3BCK0UsT0FBT1ksTUFBTSxHQUFHSCxLQUFLakY7UUFDdkI7UUFDQSxJQUFJTixvQkFBb0I7WUFDdEI4RSxPQUFPYSxRQUFRLEdBQUdKLEtBQUtoRjtRQUN6QjtRQUVBLElBQUlDLGNBQWN1RCxJQUFJLElBQUlyRCxvQkFBb0I7WUFDNUNvRSxPQUFPYyxLQUFLLEdBQUdMLEtBQUs3RSxvQkFBb0I7Z0JBQ3RDeUUsY0FBYztZQUNoQjtRQUNGO1FBRUEsT0FBT0w7SUFDVDtJQUVBbkcsUUFBUWQsU0FBUyxDQUFDLENBQUMsVUFBVSxFQUFFNEIsVUFBVSxDQUFDLENBQUMsR0FBRzZGO0lBRTlDLE9BQU87UUFBRXRGO1FBQW9CRDtRQUFrQlk7SUFBaUI7QUFDbEUsRUFBQyJ9
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,MAAM,EAAEC,SAAS,EAAEC,MAAM,EAAEC,OAAO,QAAQ,sBAAqB;AACjG,SAASC,gBAAgB,QAAQ,gBAAe;AAChD,OAAOC,iBAAiB,gBAAe;AAIvC,SAASC,iBAAiB,QAAQ,yBAAwB;AAC1D,SAASC,WAAW,QAAQ,mBAAkB;AAC9C,SAASC,cAAc,QAAQ,sBAAqB;AA0BpD,OAAO,MAAMC,aAAa,CAAC,EACzBC,OAAO,EACPC,cAAc,CAAC,CAAC,EAChBC,kBAAkB,CAAC,CAAC,EACpBC,YAAY,EACZC,kBAAkB,EAClBC,UAAU,EACVC,cAAc,EACdC,gBAAgB,KAAK,EACrBC,MAAM,EACNC,oBAAoB,EACpBC,iBAAiB,EACjBC,kBAAkB,EAClBC,eAAeC,qBAAqB,EACpCC,SAAS,EACTC,UAAU,EACL;IACL,MAAMH,gBAAgBC,yBAAyBC;IAC/C,MAAME,UAA2Cf;IACjD,MAAMgB,UAAkE,CAAC;IAEzE,IAAIC,oBAAoB;IACxB,IAAIC,gCAAgC;IACpC,IAAIC,mBAAsC;IAC1C,IAAIC,qBAAwC;IAC5C,IAAIC,4BAA4B;IAChC,IAAIC,8BAA8B;IAElC,MAAMC,iBAAkD,CAAC;IACzD,MAAMC,iBAAyE,CAAC;IAChF,IAAIC;IACJ,IAAIC;IACJ,IAAIC;IAEJ,uCAAuC;IACvC,MAAMC,gBAA6BnB,qBAAqB,IAAIoB;IAE5D,IAAIC;IAEJ,oBAAoB;IACpB,MAAMC,mBAAwC,IAAIC;IAElD,MAAMC,YAAoBrC,YAAY;QAAEG;QAASgB;QAASR;IAAO;IAE/D,CAAA,EACAU,iBAAiB,EACjBK,2BAA2B,EAC3BD,yBAAy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3F,mBAAmB;YACrBiF,OAAOW,QAAQ,GAAGF,KAAKlF;QACzB;QAEA,IAAIN,kBAAkB;YACpB+E,OAAOY,MAAM,GAAGH,KAAKjF;QACvB;QACA,IAAIN,oBAAoB;YACtB8E,OAAOa,QAAQ,GAAGJ,KAAKhF;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=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWEvY3JlYXRlSW5kZXgudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyogZXNsaW50LWRpc2FibGUgbm8tcGFyYW0tcmVhc3NpZ24gKi9cbmltcG9ydCB7IGluZGV4LCB1bmlxdWVJbmRleCB9IGZyb20gJ2RyaXp6bGUtb3JtL3BnLWNvcmUnXG5cbmltcG9ydCB0eXBlIHsgR2VuZXJpY0NvbHVtbiB9IGZyb20gJy4uL3R5cGVzLmpzJ1xuXG50eXBlIENyZWF0ZUluZGV4QXJncyA9IHtcbiAgY29sdW1uTmFtZTogc3RyaW5nXG4gIG5hbWU6IHN0cmluZyB8IHN0cmluZ1tdXG4gIHRhYmxlTmFtZTogc3RyaW5nXG4gIHVuaXF1ZT86IGJvb2xlYW5cbn1cblxuZXhwb3J0IGNvbnN0IGNyZWF0ZUluZGV4ID0gKHsgbmFtZSwgY29sdW1uTmFtZSwgdGFibGVOYW1lLCB1bmlxdWUgfTogQ3JlYXRlSW5kZXhBc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QUFXeEQsT0FBTyxNQUFNQyxjQUFjLENBQUMsRUFBRUMsSUFBSSxFQUFFQyxVQUFVLEVBQUVDLFNBQVMsRUFBRUMsTUFBTSxFQUFtQjtJQUNsRixPQUFPLENBQUNDO1FBQ04sSUFBSUM7UUFDSixJQUFJQyxNQUFNQyxPQUFPLENBQUNQLE9BQU87WUFDdkJLLFVBQVVMLEtBQ1BRLEdBQUcsQ0FBQyxDQUFDUCxhQUFlRyxLQUFLLENBQUNILFdBQVcsQ0FDdEMsaUZBQWlGO2FBQ2hGUSxNQUFNLENBQUMsQ0FBQ0MsTUFBUSxPQUFPQSxRQUFRO1FBQ3BDLE9BQU87WUFDTEwsVUFBVTtnQkFBQ0QsS0FBSyxDQUFDSixLQUFLO2FBQUM7UUFDekI7UUFDQSxJQUFJRyxRQUNGLE9BQU9MLFlBQVksQ0FBQyxFQUFFSSxVQUFVLENBQUMsRUFBRUQsV0FBVyxJQUFJLENBQUMsRUFBRVUsRUFBRSxDQUFDTixPQUFPLENBQUMsRUFBRSxLQUFLQSxRQUFRTyxLQUFLLENBQUM7UUFDdkYsT0FBT2YsTUFBTSxDQUFDLEVBQUVLLFVBQVUsQ0FBQyxFQUFFRCxXQUFXLElBQUksQ0FBQyxFQUFFVSxFQUFFLENBQUNOLE9BQU8sQ0FBQyxFQUFFLEtBQUtBLFFBQVFPLEtBQUssQ0FBQztJQUNqRjtBQUNGLEVBQUMifQ==
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"}
@@ -8,4 +8,4 @@ export const idToUUID = (fields)=>fields.map((field)=>{
8
8
  return field;
9
9
  });
10
10
 
11
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWEvaWRUb1VVSUQudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBGaWVsZCB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmV4cG9ydCBjb25zdCBpZFRvVVVJRCA9IChmaWVsZHM6IEZpZWxkW10pOiBGaWVsZFtdID0+XG4gIGZpZWxkcy5tYXAoKGZpZWxkKSA9PiB7XG4gICAgaWYgKCduYW1lJyBpbiBmaWVsZCAmJiBmaWVsZC5uYW1lID09PSAnaWQnKSB7XG4gICAgICByZXR1cm4ge1xuICAgICAgICAuLi5maWVsZCxcbiAgICAgICAgbmFtZTogJ191dWlkJyxcbiAgICAgIH1cbiAgICB9XG5cbiAgICByZXR1cm4gZmllbGRcbiAgfSlcbiJdLCJuYW1lcyI6WyJpZFRvVVVJRCIsImZpZWxkcyIsIm1hcCIsImZpZWxkIiwibmFtZSJdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxNQUFNQSxXQUFXLENBQUNDLFNBQ3ZCQSxPQUFPQyxHQUFHLENBQUMsQ0FBQ0M7UUFDVixJQUFJLFVBQVVBLFNBQVNBLE1BQU1DLElBQUksS0FBSyxNQUFNO1lBQzFDLE9BQU87Z0JBQ0wsR0FBR0QsS0FBSztnQkFDUkMsTUFBTTtZQUNSO1FBQ0Y7UUFFQSxPQUFPRDtJQUNULEdBQUUifQ==
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=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWEvcGFyZW50SURDb2x1bW5NYXAudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgaW50ZWdlciwgbnVtZXJpYywgdXVpZCwgdmFyY2hhciB9IGZyb20gJ2RyaXp6bGUtb3JtL3BnLWNvcmUnXG5cbmltcG9ydCB0eXBlIHsgSURUeXBlIH0gZnJvbSAnLi4vdHlwZXMuanMnXG5cbmV4cG9ydCBjb25zdCBwYXJlbnRJRENvbHVtbk1hcDogUmVjb3JkPFxuICBJRFR5cGUsXG4gIHR5cGVvZiBpbnRlZ2VyPHN0cmluZz4gfCB0eXBlb2YgbnVtZXJpYzxzdHJpbmc+IHwgdHlwZW9mIHV1aWQ8c3RyaW5nPiB8IHR5cGVvZiB2YXJjaGFyXG4+ID0ge1xuICBpbnRlZ2VyLFxuICBudW1lcmljLFxuICB1dWlkLFxuICB2YXJjaGFyLFxufVxuIl0sIm5hbWVzIjpbImludGVnZXIiLCJudW1lcmljIiwidXVpZCIsInZhcmNoYXIiLCJwYXJlbnRJRENvbHVtbk1hcCJdLCJtYXBwaW5ncyI6IkFBQUEsU0FBU0EsT0FBTyxFQUFFQyxPQUFPLEVBQUVDLElBQUksRUFBRUMsT0FBTyxRQUFRLHNCQUFxQjtBQUlyRSxPQUFPLE1BQU1DLG9CQUdUO0lBQ0ZKO0lBQ0FDO0lBQ0FDO0lBQ0FDO0FBQ0YsRUFBQyJ9
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=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWEvc2V0Q29sdW1uSUQudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBQZ0NvbHVtbkJ1aWxkZXIgfSBmcm9tICdkcml6emxlLW9ybS9wZy1jb3JlJ1xuXG5pbXBvcnQgeyBudW1lcmljLCBzZXJpYWwsIHV1aWQsIHZhcmNoYXIgfSBmcm9tICdkcml6emxlLW9ybS9wZy1jb3JlJ1xuaW1wb3J0IHsgdHlwZSBGaWVsZCwgZmllbGRBZmZlY3RzRGF0YSB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5pbXBvcnQgeyBmbGF0dGVuVG9wTGV2ZWxGaWVsZHMgfSBmcm9tICdwYXlsb2FkL3V0aWxpdGllcydcblxuaW1wb3J0IHR5cGUgeyBJRFR5cGUsIFBvc3RncmVzQWRhcHRlciB9IGZyb20gJy4uL3R5cGVzLmpzJ1xuXG50eXBlIEFyZ3MgPSB7IGFkYXB0ZXI6IFBvc3RncmVzQWRhcHRlcjsgY29sdW1uczogUmVjb3JkPHN0cmluZywgUGdDb2x1bW5CdWlsZGVyPjsgZmllbGRzOiBGaWVsZFtdIH1cbmV4cG9ydCBjb25zdCBzZXRDb2x1bW5JRCA9ICh7IGFkYXB0ZXIsIGNvbHVtbnMsIGZ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hbmRvbSJdLCJtYXBwaW5ncyI6IkFBRUEsU0FBU0EsT0FBTyxFQUFFQyxNQUFNLEVBQUVDLElBQUksRUFBRUMsT0FBTyxRQUFRLHNCQUFxQjtBQUNwRSxTQUFxQkMsZ0JBQWdCLFFBQVEsZ0JBQWU7QUFDNUQsU0FBU0MscUJBQXFCLFFBQVEsb0JBQW1CO0FBS3pELE9BQU8sTUFBTUMsY0FBYyxDQUFDLEVBQUVDLE9BQU8sRUFBRUMsT0FBTyxFQUFFQyxNQUFNLEVBQVE7SUFDNUQsTUFBTUMsVUFBVUwsc0JBQXNCSSxRQUFRRSxJQUFJLENBQ2hELENBQUNDLFFBQVVSLGlCQUFpQlEsVUFBVUEsTUFBTUMsSUFBSSxLQUFLO0lBRXZELElBQUlILFNBQVM7UUFDWCxJQUFJQSxRQUFRSSxJQUFJLEtBQUssVUFBVTtZQUM3Qk4sUUFBUU8sRUFBRSxHQUFHZixRQUFRLE1BQU1nQixVQUFVO1lBQ3JDLE9BQU87UUFDVDtRQUVBLElBQUlOLFFBQVFJLElBQUksS0FBSyxRQUFRO1lBQzNCTixRQUFRTyxFQUFFLEdBQUdaLFFBQVEsTUFBTWEsVUFBVTtZQUNyQyxPQUFPO1FBQ1Q7SUFDRjtJQUVBLElBQUlULFFBQVFVLE1BQU0sS0FBSyxRQUFRO1FBQzdCVCxRQUFRTyxFQUFFLEdBQUdiLEtBQUssTUFBTWdCLGFBQWEsR0FBR0YsVUFBVTtRQUNsRCxPQUFPO0lBQ1Q7SUFFQVIsUUFBUU8sRUFBRSxHQUFHZCxPQUFPLE1BQU1lLFVBQVU7SUFDcEMsT0FBTztBQUNULEVBQUMifQ==
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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWEvdHJhdmVyc2VGaWVsZHMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyogZXNsaW50LWRpc2FibGUgbm8tcGFyYW0tcmVhc3NpZ24gKi9cbmltcG9ydCB0eXBlIHsgUmVsYXRpb24gfSBmcm9tICdkcml6emxlLW9ybSdcbmltcG9ydCB0eXBlIHsgSW5kZXhCdWlsZGVyLCBQZ0NvbHVtbkJ1aWxkZXIsIFVuaXF1ZUNvbnN0cmFpbnRCdWlsZGVyIH0gZnJvbSAnZHJpenpsZS1vcm0vcGctY29yZSdcbmltcG9ydCB0eXBlIHsgRmllbGQsIFRhYkFzRmllbGQgfSBmcm9tICdwYXlsb2FkL3R5cGVzJ1xuXG5pbXBvcnQgeyByZWxhdGlvbnMgfSBmcm9tICdkcml6emxlLW9ybSdcbmltcG9ydCB7XG4gIFBnTnVtZXJpY0J1aWxkZXIsXG4gIFBnVVVJREJ1aWxkZXIsXG4gIFBnVmFyY2hhckJ1aWxkZXIsXG4gIGJvb2xlYW4sXG4gIGluZGV4LFxuICBpbnRlZ2VyLFxuICBqc29uYixcbiAgbnVtZXJpYyxcbiAgcGdFbnVtLFxuICB0ZXh0LFxuICB0aW1lc3RhbXAsXG4gIHZhcmNoYXIsXG59IGZyb20gJ2RyaXp6bGUtb3JtL3BnLWNvcmUnXG5pbXBvcnQgeyBJbnZhbGlkQ29uZmlndXJhdGlvbiB9IGZyb20gJ3BheWxvYWQvZXJyb3JzJ1xuaW1wb3J0IHsgZmllbGRBZmZlY3RzRGF0YSwgb3B0aW9uS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GZpZWxkLnR5cGUpIHtcbiAgICAgIGNhc2UgJ3RleHQnOiB7XG4gICAgICAgIGlmIChmaWVsZC5oYXNNYW55KSB7XG4gICAgICAgICAgaWYgKGZpZWxkLmxvY2FsaXplZCkge1xuICAgICAgICAgICAgaGFzTG9jYWxpemVkTWFueVRleHRGaWVsZCA9IHRydWVcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAoZmllbGQuaW5kZXgpIHtcbiAgICAgICAgICAgIGhhc01hbnlUZXh0RmllbGQgPSAnaW5kZXgnXG4gICAgICAgICAgfSBlbHNlIGlmICghaGFzTWFueVRleHRGaWVsZCkge1xuICAgICAgICAgICAgaGFzTWFueVRleHRGaWVsZCA9IHRydWVcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAoZmllbGQudW5pcXVlKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgSW52YWxpZENvbmZpZ3VyYXRpb24oXG4gICAgICAgICAgICAgICdVbmlxdWUgaXMgbm90IHN1cHBvcnRlZCBpbiBQb3N0Z3JlcyBmb3IgaGFzTWFueSB0ZXh0IGZpZWxkcy4nLFxuICAgICAgICAgICAgKVxuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICB0YXJnZXRUYWJsZVtmaWVsZE5hbWVdID0gdmFyY2hhcihjb2x1bW5OYW1lKVxuICAgICAgICB9XG4gICAgICAgIGJyZWFrXG4gICAgICB9XG4gICAgICBjYXNlICdlbWFpbCc6XG4gICAgICBjYXNlICdjb2RlJzpcbiAgICAgIGNhc2UgJ3RleHRhcmVhJzoge1xuICAgICAgICB0YXJnZXRUYWJsZVtmaWVsZE5hbWVdID0gdmFyY2hhcihjb2x1bW5OYW1lKVxuICAgICAgICBicmVha1xuICAgICAgfVxuXG4gICAgICBjYXNlICdudW1iZXInOiB7XG4gICAgICAgIGlmIChmaWVsZC5oYXNNYW55KSB7XG4gICAgICAgICAgaWYgKGZpZWxkLmxvY2FsaXplZCkge1xuICAgICAgICAgICAgaGFzTG9jYWxpemVkTWFueU51bWJlckZpZWxkID0gdHJ1ZVxuICAgICAgICAgIH1cblxuICAgICAgICAgIGlmIChmaWVsZC5pbmRleCkge1xuICAgICAgICAgICAgaGFzTWFueU51bWJlckZpZWxkID0gJ2luZGV4J1xuICAgICAgICAgIH0gZWxzZSBpZiAoIWhhc01hbnlOdW1iZXJGaWVsZCkge1xuICAgICAgICAgICAgaGFzTWFueU51bWJlckZpZWxkID0gdHJ1ZVxuICAgICAgICAgIH1cblxuICAgICAgICAgIGlmIChmaWVsZC51bmlxdWUpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBJbnZhbGlkQ29uZmlndXJhdGlvbihcbiAgICAgICAgICAgICAgJ1VuaXF1ZSBpcyBub3Qgc3VwcG9ydGVkIGluIFBvc3RncmVzIGZvciBoYXNNYW55IG51bWJlciBmaWVsZHMuJyxcbiAgICAgICAgICAgIClcbiAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgdGFyZ2V0VGFibGVbZmllbGROYW1lXSA9IG51bWVyaWMoY29sdW1uTmFtZSlcbiAgICAgICAgfVxuICAgICAgICBicmVha1xuICAgICAgfVxuXG4gICAgICBjYXNlICdyaWNoVGV4dCc6XG4gICAgICBjYXNlICdqc29uJzoge1xuICAgICAgICB0YXJnZXRUYWJsZVtmaWVsZE5hbWVdID0ganNvbmIoY29sdW1uTmFtZSlcbiAgICAgICAgYnJlYWtcbiAgICAgIH1cblxuICAgICAgY2FzZSAnZGF0ZSc6IHtcbiAgICAgICAgdGFyZ2V0VGFibGVbZmllbGROYW1lXSA9IHRpbWVzdGFtcChjb2x1bW5OYW1lLCB7XG4gICAgICAgICAgbW9kZTogJ3N0cmluZycsXG4gICAgICAgICAgcHJlY2lzaW9uOiAzLFxuICAgICAgICAgIHdpdGhUaW1lem9uZTogdHJ1ZSxcbiAgICAgICAgfSlcbiAgICAgICAgYnJlYWtcbiAgICAgIH1cblxuICAgICAgY2FzZSAnc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RGVsZXRlOiAnY2FzY2FkZScgfSlcbiAgICAgICAgICAgICAgLm5vdE51bGwoKSxcbiAgICAgICAgICAgIHZhbHVlOiBhZGFwdGVyLmVudW1zW2VudW1OYW1lXSgndmFsdWUnKSxcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBjb25zdCBiYXNlRXh0cmFDb25maWc6IFJlY29yZDxcbiAgICAgICAgICAgIHN0cmluZyxcbiAgICAgICAgICAgIChjb2xzOiBHZW5lcmljQ29sdW1ucykgPT4gSW5kZXhCdWlsZGVyIHwgVW5pcXVlQ29uc3RyYWludEJ1aWxkZXJcbiAgICAgICAgICA+ID0ge1xuICAgICAgICAgICAgb3JkZXJJZHg6IChjb2xzKSA9PiBpbmRleChgJHtzZWxlY3RUYWJsZU5hbWV9X29yZGVyX2lkeGApLm9uKGNvbHMub3JkZXIpLFxuICAgICAgICAgICAgcGFyZW50SWR4OiAoY29scykgPT4gaW5kZXgoYCR7c2VsZWN0VGFibGVOYW1lfV9wYXJlbnRfaWR4YCkub24oY29scy5wYXJlbnQpLFxuICAgICAgICAgIH1cblxuICAgICAgICAgIGlmIChmaWVsZC5sb2NhbGl6ZWQpIHtcbiAgICAgICAgICAgIGJhc2VDb2x1bW5zLmxvY2FsZSA9IGFkYXB0ZXIuZW51bXMuZW51bV9fbG9jYWxlcygnbG9jYWxlJykubm90TnVsbCgpXG4gICAgICAgICAgICBiYXNlRXh0cmFDb25maWcubG9jYWxlSWR4ID0gKGNvbHMpID0+XG4gICAgICAgICAgICAgIGluZGV4KGAke3NlbGVjdFRhYmxlTmFtZX1fbG9jYWxlX2lkeGApLm9uKGNvbHMubG9jYWxlKVxuICAgICAgICAgIH1cblxuICAgICAgICAgIGlmIChmaWVsZC5pbmRleCkge1xuICAgICAgICAgICAgYmFzZUV4dHJhQ29uZmlnLnZhbHVlID0gKGNvbHMpID0+IGluZGV4KGAke3NlbGVjdFRhYmxlTmFtZX1fdmFsdWVfaWR4YCkub24oY29scy52YWx1ZSlcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBidWlsZFRhYmxlKHtcbiAgICAgICAgICAgIGFkYXB0ZXIsXG4gICAgICAgICAgICBiYXNlQ29sdW1ucyxcbiAgICAgICAgICAgIGJhc2VFeHRyYUNvbmZpZyxcbiAgICAgICAgICAgIGRpc2FibGVOb3ROdWxsLFxuICAgICAgICAgICAgZGlzYWJsZVVuaXF1ZSxcbiAgICAgICAgICAgIGZpZWxkczogW10sXG4gICAgICAgICAgICB0YWJsZU5hbWU6IHNlbGVjdFRhYmxlTmFtZSxcbiAgICAgICAgICB9KVxuXG4gICAgICAgICAgcmVsYXRpb25zVG9CdWlsZC5zZXQoZmllbGROYW1lLCBzZWxlY3RUYWJsZU5hbWUpXG5cbiAgICAgICAgICBjb25zdCBzZWxlY3RUYWJsZVJlbGF0aW9ucyA9IHJlbGF0aW9ucyhhZGFwdGVyLnRhYmxlc1tzZWxlY3RUYWJsZU5hbWVdLCAoeyBvbmUgfSkgPT4ge1xuICAgICAgICAgICAgY29uc3QgcmVzdWx0OiBSZWNvcmQ8c3RyaW5nLCBSZWxhdGlvbjxzdHJpbmc+PiA9IHtcbiAgICAgICAgICAgICAgcGFyZW50OiBvbmUoYWRhcHRlci50YWJsZXNbcGFyZW50VGFibGVOYW1lXSwge1xuICAgICAgICAgICAgICAgIGZpZWxkczogW2FkYXB0ZXIudGFibGVzW3NlbGVjdFRhYmxlTmFtZV0ucGFyZW50XSxcbiAgICAgICAgICAgICAgICByZWZlcmVuY2VzOiBbYWRhcHRlci50YWJsZXNbcGFyZW50VGFibGVOYW1lXS5pZF0sXG4gICAgICAgICAgICAgIH0pLFxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gcmVzdWx0XG4gICAgICAgICAgfSlcblxuICAgICAgICAgIGFkYXB0ZXIucmVsYXRpb25zW2ByZWxhdGlvbl8ke3NlbGVjdFRhYmxlTmFtZX1gXSA9IHNlbGVjdFRhYmxlUmVsYXRpb25zXG4gICAgICAgIH0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VW5pcXVlQ29uc3RyYWludEJ1aWxkZXJcbiAgICAgICAgPiA9IHtcbiAgICAgICAgICBfb3JkZXJJZHg6IChjb2xzKSA9PiBpbmRleChgJHthcnJheVRhYmxlTmFtZX1fb3JkZXJfaWR4YCkub24oY29scy5fb3JkZXIpLFxuICAgICAgICAgIF9wYXJlbnRJRElkeDogKGNvbHMpID0+IGluZGV4KGAke2FycmF5VGFibGVOYW1lfV9wYXJlbnRfaWRfaWR4YCkub24oY29scy5fcGFyZW50SUQpLFxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGZpZWxkLmxvY2FsaXplZCAmJiBhZGFwdGVyLnBheWxvYWQuY29uZmlnLmxvY2FsaXphdGlvbikge1xuICAgICAgICAgIGJhc2VDb2x1bW5zLl9sb2NhbGUgPSBhZGFwdGVyLmVudW1zLmVudW1fX2xvY2FsZXMoJ19sb2NhbGUnKS5ub3ROdWxsKClcbiAgICAgICAgICBiYXNlRXh0cmFDb25maWcuX2xvY2FsZUlkeCA9IChjb2xzKSA9PlxuICAgICAgICAgICAgaW5kZXgoYCR7YXJyYXlUYWJsZU5hbWV9X2xvY2FsZV9pZHhgKS5vbihjb2xzLl9sb2NhbGUpXG4gICAgICAgIH1cblxuICAgICAgICBjb25zdCB7XG4gICAgICAgICAgaGFzTWFueU51bWJlckZpZWxkOiBzdWJIYXNNYW55TnVtYmVyRmllbGQsXG4gICAgICAgICAgaGFzTWFueVRleHRGaWVsZDogc3ViSGFzTWFueVRleHRGaWVsZCxcbiAgICAgICAgICByZWxhdGlvbnNUb0J1aWxkOiBzdWJSZWxhdGlvbnNUb0J1aWxkLFxuICAgICAgICB9ID0gYnVpbGRUYWJsZSh7XG4gICAgICAgICAgYWRhcHRlcixcbiAgICAgICAgICBiYXNlQ29sdW1ucyxcbiAgICAgICAgICBiYXNlRXh0cmFDb25maWcsXG4gICAgICAgICAgZGlzYWJsZU5vdE51bGw6IGRpc2FibGVOb3ROdWxsRnJvbUhlcmUsXG4gICAgICAgICAg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ID0ge1xuICAgICAgICAgICAgX3BhcmVudElEOiBvbmUoYWRhcHRlci50YWJsZXNbcGFyZW50VGFibGVOYW1lXSwge1xuICAgICAgICAgICAgICBmaWVsZHM6IFthZGFwdGVyLnRhYmxlc1thcnJheVRhYmxlTmFtZV0uX3BhcmVudElEXSxcbiAgICAgICAgICAgICAgcmVmZXJlbmNlczogW2FkYXB0ZXIudGFibGVzW3BhcmVudFRhYmxlTmFtZV0uaWRdLFxuICAgICAgICAgICAgfSksXG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKGhhc0xvY2FsZXNUYWJsZShmaWVsZC5maWVsZHMpKSB7XG4gICAgICAgICAgICByZXN1bHQuX2xvY2FsZXMgPSBtYW55KGFkYXB0ZXIudGFibGVzW2Ake2FycmF5VGFibGVOYW1lfV9sb2NhbGVzYF0pXG4gICAgICAgICAgfVxuXG4gICAgICAgICAgc3ViUmVsYXRpb25zVG9CdWlsZC5mb3JFYWNoKCh2YWwsIGtleSkgPT4ge1xuICAgICAgICAgICAgcmVzdWx0W2tleV0gPSBtYW55KGFkYXB0ZXIudGFibGVzW3ZhbF0pXG4gICAgICAgICAgfSlcblxuICAgICAgICAgIHJldHVybiByZXN1bHRcbiAgICAgICAgfSlcblxuICAgICAgICBhZGFwdGVyLnJlbGF0aW9uc1tgcmVsYXRpb25zXyR7YXJyYXlUYWJsZU5hbWV9YF0gPSBhcnJheVRhYmxlUmVsYXRpb25zXG5cbiAgICAgICAgYnJlYWtcbiAgICAgIH1cblxuICAgICAgY2FzZSAnYmxvY2tzJzoge1xuICAgICAgICBjb25zdCBkaXNhYmxlTm90TnVsbEZyb21IZXJlID0gQm9vbGVhbihmaWVsZC5hZG1pbj8uY29uZGl0aW9uKSB8fCBkaXNhYmxlTm90TnVsbFxuXG4gICAgICAgIGZpZWxkLmJsb2Nrcy5mb3JFYWNoKChibG9jaykgPT4ge1xuICAgICAgICAgIGNvbnN0IGJsb2NrVGFibGVOYW1lID0gYCR7cm9vdFRhYm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ICAgIF9wYXRoSWR4OiAoY29scykgPT4gaW5kZXgoYCR7YmxvY2tUYWJsZU5hbWV9X3BhdGhfaWR4YCkub24oY29scy5fcGF0aCksXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChmaWVsZC5sb2NhbGl6ZWQgJiYgYWRhcHRlci5wYXlsb2FkLmNvbmZpZy5sb2NhbGl6YXRpb24pIHtcbiAgICAgICAgICAgICAgYmFzZUNvbHVtbnMuX2xvY2FsZSA9IGFkYXB0ZXIuZW51bXMuZW51bV9fbG9jYWxlcygnX2xvY2FsZScpLm5vdE51bGwoKVxuICAgICAgICAgICAgICBiYXNlRXh0cmFDb25maWcuX2xvY2FsZUlkeCA9IChjb2xzKSA9PlxuICAgICAgICAgICAgICAgIGluZGV4KGAke2Jsb2NrVGFibGVOYW1lfV9sb2NhbGVfaWR4YCkub24oY29scy5fbG9jYWxlKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBjb25zdCB7XG4gICAgICAgICAgICAgIGhhc01hbnlOdW1iZXJGaWVsZDogc3ViSGFzTWFueU51bWJlckZpZWxkLFxuICAgICAgICAgICAgICBoYXNNYW55VGV4dEZpZWxkOiBzdWJIYXNNYW55VGV4dEZpZWxkLFxuICAgICAgICAgICAgICByZWxhdGlvbnNUb0J1aWxkOiBzdWJSZWxhdGlvbnNUb0J1aWxkLFxuICAgICAgICAgICAgfSA9IGJ1aWxkVGFibGUoe1xuICAgICAgICAgICAgICBhZGFwdGVyLFxuICAgICAgICAgICAgICBiYXNlQ29sdW1ucyxcbiAgICAgICAgICAgICAgYmFzZUV4dHJhQ29uZmlnLFxuICAgICAgICAgICAgICBkaXNhYmxlTm90TnVsbDogZGlzYWJsZU5vdE51bGxGcm9tSGVyZSxcbiAgICAgICAgICAgICAgZGlzYWJsZVVuaXF1ZSxcbiAgICAgICAgICAgICAgZmllbGRzOiBkaXNhYmxlVW5pcXVlID8gaWRUb1VVSUQoYmxvY2suZmllbGRzKSA6IGJsb2NrLmZpZWxkcyxcbiAgICAgICAgICAgICAgcm9vdFJlbGF0aW9uc1RvQnVpbGQsXG4gICAgICAgICAgICAgIHJvb3RSZWxhdGlvbnNoaXBzOiByZWxhdGlvbnNoaXBzLFxuICAgICAgICAgICAgICByb290VGFibGVJRENvbFR5cGUsXG4gICAgICAgICAgICAgIHJvb3RUYWJsZU5hbWUsXG4gICAgICAgICAgICAgIHRhYmxlTmFtZTogYmxvY2tUYWJsZU5hbWUsXG4gICAgICAgICAgICB9KVxuXG4gICAgICAgICAgICBpZiAoc3ViSGFzTWFueVRleHRGaWVsZCkge1xuICAgICAgICAgICAgICBpZiAoIWhhc01hbnlUZXh0RmllbGQgfHwgc3ViSGFzTWFueVRleHRGaWVsZCA9PT0gJ2luZGV4JylcbiAgICAgICAgICAgICAgICBoYXNNYW55VGV4dEZpZWxkID0gc3ViSGFzTWFueVRleHRGaWVsZFxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAoc3ViSGFzTWFueU51bWJlckZpZWxkKSB7XG4gICAgICAgICAgICAgIGlmICghaGFzTWFueU51bWJlckZpZWxkIHx8IHN1Ykhhc01hbnlOdW1iZXJGaWVsZCA9PT0gJ2luZGV4JylcbiAgICAgICAgICAgICAgICBoYXNNYW55TnVtYmVyRmllbGQgPSBzdWJIYXNNYW55TnVtYmVyRmllbGRcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgY29uc3QgYmxvY2tUYWJsZVJlbGF0aW9ucyA9IHJlbGF0aW9ucyhcbiAgICAgICAgICAgICAgYWRhcHRlci50YWJsZXNbYmxvY2tUYWJsZU5hbWVdLFxuICAgICAgICAgICAgICAoeyBtYW55LCBvbmUgfSkgPT4ge1xuICAgICAgICAgICAgICAgIGNvbnN0IHJlc3VsdDogUmVjb3JkPHN0cmluZywgUmVsYXRpb248c3RyaW5nPj4gPSB7XG4gICAgICAgICAgICAgICAgICBfcGFyZW50SUQ6IG9uZShhZGFwdGVyLnRhYmxlc1tyb290VGFibGVOYW1lXSwge1xuICAgICAgICAgICAgICAgICAgICBmaWVsZHM6IFthZGFwdGVyLnRhYmxlc1tibG9ja1RhYmxlTmFtZV0uX3BhcmVudElEXSxcbiAgICAgICAgICAgICAgICAgICAgcmVmZXJlbmNlczogW2FkYXB0ZXIudGFibGVzW3Jvb3RUYWJsZU5hbWVdLmlkXSxcbiAgICAgICAgICAgICAgICAgIH0pLFxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmIChoYXNMb2NhbGVzVGFibGUoYmxvY2suZmllbGRzKSkge1xuICAgICAgICAgICAgICAgICAgcmVzdWx0Ll9sb2NhbGVzID0gbWFueShhZGFwdGVyLnRhYmxlc1tgJHtibG9ja1RhYmxlTmFtZX1fbG9jYWxlc2BdKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHN1YlJlbGF0aW9uc1RvQnVpbGQuZm9yRWFjaCgodmFsLCBrZXkpID0+IHtcbiAgICAgICAgICAgICAgICAgIHJlc3VsdFtrZXldID0gbWFueShhZGFwdGVyLnRhYmxlc1t2YWxdKVxuICAgICAgICAgICAgICAgIH0pXG5cbiAgICAgICAgICAgICAgICByZXR1cm4gcmVzdWx0XG4gICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICApXG5cbiAgICAgICAgICAgIGFkYXB0ZXIucmVsYXRpb25zW2ByZWxhdGlvbnNfJHtibG9ja1RhYmxlTmFtZX1gXSA9IGJsb2NrVGFibGVSZWxhdGlvbnNcbiAgICAgICAgICB9IGVsc2UgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSAncHJvZHVjdGlvbicpIHtcbiAgICAgICAgICAgIHZhbGlkYXRlRXhpc3RpbmdCbG9ja0lzSWRlbnRpY2FsKHtcbiAgICAgICAgICAgICAgYmxvY2ssXG4gICAgICAgICAgICAgIGxvY2FsaXplZDogZmllbGQubG9jYWxpemVkLFxuICAgICAgICAgICAgICByb290VGFibGVOYW1lLFxuICAgICAgICAgICAgICB0YWJsZTogYWRhcHRlci50YWJsZXNbYmxvY2tUYWJsZU5hbWVdLFxuICAgICAgICAgICAgfSlcbiAgICAgICAgICB9XG5cbiAgICAgICAgICByb290UmVsYXRpb25zVG9CdWlsZC5zZXQoYF9ibG9ja3NfJHtibG9jay5zbHVnfWAsIGJsb2NrVGFibGVOYW1lKVxuICAgICAgICB9KVxuXG4gICAgICAgIGJyZWFrXG4gICAgICB9XG5cbiAgICAgIGNhc2UgJ3RhYic6XG4gICAgICBjYXNlICdncm91cCc6IHtcbiAgICAgICAgaWYgKCEoJ25hbWUnIGluIGZpZWxkKSkge1xuICAgICAgICAgIGNvbnN0IHtcbiAgICAgICAgICAgIGhhc0xvY2FsaXplZEZpZWxkOiBncm91cEhhc0xvY2FsaXplZEZpZWxkLFxuICAgICAgICAgICAgaGFzTG9jYWxpemVkTWFueU51bWJlckZpZWxkOiBncm91cEhhc0xvY2FsaXplZE1hbnlOdW1iZXJGaWVsZCxcbiAgICAgICAgICAgIGhhc0xvY2FsaXplZE1hbnlUZXh0RmllbGQ6IGdyb3VwSGFzTG9jYWxpemVkTWFueVRleHRGaWVsZCxcbiAgICAgICAgICAgIGhhc0xvY2FsaXplZFJlbGF0aW9uc2hpcEZpZWxkOiBncm91cEhhc0xvY2FsaXplZFJlbGF0aW9uc2hpcEZpZWxkLFxuICAgICAgICAgICAgaGFzTWFueU51bWJlckZpZWxkOiBncm91cEhhc01hbnlOdW1iZXJGaWVsZCxcbiAgICAgICAgICAgIGhhc01hbnlUZXh0RmllbGQ6IGdyb3VwSGFzTWFueVRleHRGaWVsZCxcbiAgICAgICAgICB9ID0gdHJhdmVyc2VGaWVsZHMoe1xuICAgICAgICAgICAgYWRhcHRlcixcbiAgICAgICAgICAgIGJ1aWxkTnVtYmVycyxcbiAgICAgICAgICAgIGJ1aWxkUmVsYXRpb25zaGlwcyxcbiAgICAgICAgICAgIGJ1aWxkVGV4dHMsXG4gICAgICAgICAgICBjb2x1bW5QcmVmaXgsXG4gICAgICAgICAgICBjb2x1bW5zLFxuICAgICAgICAgICAgZGlzYWJsZU5vdE51bGwsXG4gICAgICAgICAgICBkaXNhYmxlVW5pcXVlLFxuICAgICAgICAgICAgZmllbGRQcmVmaXgsXG4gICAgICAgICAgICBmaWVsZHM6IGZpZWxkLmZpZWxkcyxcbiAgICAgICAgICAgIGZvcmNlTG9jYWxpemVkLFxuICAgICAgICAgICAgaW5kZXhlcyxcbiAgICAgICAgICAgIGxvY2FsZXNDb2x1bW5zLFxuICAgICAgICAgICAgbG9jYWxlc0luZGV4ZXMsXG4gICAgICAgICAgICBuZXdUYWJsZU5hbWUsXG4gICAgICAgICAgICBwYXJlbnRUYWJsZU5hbWUsXG4gICAgICAgICAgICByZWxhdGlvbnNUb0J1aWxkLFxuICAgICAgICAgICAgcmVsYXRpb25zaGlwcyxcbiAgICAgICAgICAgIHJvb3RSZWxhdGlvbnNUb0J1aWxkLFxuICAgICAgICAgICAgcm9vdFRhYmxlSURDb2xUeXBlLFxuICAgICAgICAgICAgcm9vdFRhYmxlTmFtZSxcbiAgICAgICAgICB9KVxuXG4gICAgICAgICAgaWYgKGdyb3VwSGFzTG9jYWxpemVkRmllbGQpIGhhc0xvY2FsaXplZEZpZWxkID0gdHJ1ZVxuICAgICAgICAgIGlmIChncm91cEhhc0xvY2FsaXplZFJlbGF0aW9uc2hpcEZpZWxkKSBoYXNMb2NhbGl6ZWRSZWxhdGlvbnNoaXBGaWVsZCA9IHRydWVcbiAgICAgICAgICBpZiAoZ3JvdXBIYXNNYW55VGV4dEZpZWxkKSBoYXNNYW55VGV4dEZpZWxkID0gdHJ1ZVxuICAgICAgICAgIGlmIChncm91cEhhc0xvY2FsaXplZE1hbnlUZXh0RmllbGQpIGhhc0xvY2FsaXplZE1hbnlUZXh0RmllbGQgPSB0cnVlXG4gICAgICAgICAgaWYgKGdyb3VwSGFzTWFueU51bWJlckZpZWxkKSBoYXNNYW55TnVtYmVyRmllbGQgPSB0cnVlXG4gICAgICAgICAgaWYgKGd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ydWVcbiAgICAgICAgYnJlYWtcbiAgICAgIH1cblxuICAgICAgY2FzZSAncm93JzpcbiAgICAgIGNhc2UgJ2NvbGxhcHNpYmxlJzoge1xuICAgICAgICBjb25zdCBkaXNhYmxlTm90TnVsbEZyb21IZXJlID0gQm9vbGVhbihmaWVsZC5hZG1pbj8uY29uZGl0aW9uKSB8fCBkaXNhYmxlTm90TnVsbFxuICAgICAgICBjb25zdCB7XG4gICAgICAgICAgaGFzTG9jYWxpemVkRmllbGQ6IHJvd0hhc0xvY2FsaXplZEZpZWxkLFxuICAgICAgICAgIGhhc0xvY2FsaXplZE1hbnlOdW1iZXJGaWVsZDogcm93SGFzTG9jYWxpemVkTWFueU51bWJlckZpZWxkLFxuICAgICAgICAgIGhhc0xvY2FsaXplZE1hbnlUZXh0RmllbGQ6IHJvd0hhc0xvY2FsaXplZE1hbnlUZXh0RmllbGQsXG4gICAgICAgICAgaGFzTG9jYWxpemVkUmVsYXRpb25zaGlwRmllbGQ6IHJvd0hhc0xvY2FsaXplZFJlbGF0aW9uc2hpcEZpZWxkLFxuICAgICAgICAgIGhhc01hbnlOdW1iZXJGaWVsZDogcm93SGFzTWFueU51bWJlckZpZWxkLFxuICAgICAgICAgIGhhc01hbnlUZXh0RmllbGQ6IHJvd0hhc01hbnlUZXh0RmllbGQsXG4gICAgICAgIH0gPSB0cmF2ZXJzZUZpZWxkcyh7XG4gICAgICAgICAgYWRhcHRlcixcbiAgICAgICAgICBidWlsZE51bWJlcnMsXG4gICAgICAgICAgYnVpbGRSZWxhdGlvbnNoaXBzLFxuICAgICAgICAgIGJ1aWxkVGV4dHMsXG4gICAgICAgICAgY29sdW1uUHJlZml4LFxuICAgICAgICAgIGNvbHVtbnMsXG4gICAgICAgICAgZGlzYWJsZU5vdE51bGw6IGRpc2FibGVOb3ROdWxsRnJvbUhlcmUsXG4gICAgICAgICAgZGlzYWJsZVVuaXF1ZSxcbiAgICAgICAgICBmaWVsZFByZWZpeCxcbiAgICAgICAgICBmaW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GNhc2UgJ3VwbG9hZCc6XG4gICAgICAgIGlmIChBcnJheS5pc0FycmF5KGZpZWxkLnJlbGF0aW9uVG8pKSB7XG4gICAgICAgICAgZmllbGQucmVsYXRpb25Uby5mb3JFYWNoKChyZWxhdGlvbikgPT4gcmVsYXRpb25zaGlwcy5hZGQocmVsYXRpb24pKVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHJlbGF0aW9uc2hpcHMuYWRkKGZpZWxkLnJlbGF0aW9uVG8pXG4gICAgICAgIH1cblxuICAgICAgICBpZiAoZmllbGQubG9jYWxpemVkICYmIGFkYXB0ZXIucGF5bG9hZC5jb25maWcubG9jYWxpemF0aW9uKSB7XG4gICAgICAgICAgaGFzTG9jYWxpemVkUmVsYXRpb25zaGlwRmllbGQgPSB0cnVlXG4gICAgICAgIH1cbiAgICAgICAgYnJlYWtcblxuICAgICAgZGVmYXVsdDpcbiAgICAgICAgYnJlYWtcbiAgICB9XG5cbiAgICBjb25zdCBjb25kaXRpb24gPSBmaWVsZC5hZG1pbiAmJiBmaWVsZC5hZG1pbi5jb25kaXRpb25cblxuICAgIGlmIChcbiAgICAgICFkaXNhYmxlTm90TnVsbCAmJlxuICAgICAgdGFyZ2V0VGFibGVbZmllbGROYW1lXSAmJlxuICAgICAgJ3JlcXVpcmVkJyBpbiBmaWVsZCAmJlxuICAgICAgZmllbGQucmVxdWlyZWQgJiZcbiAgICAgICFjb25kaXRpb25cbiAgICApIHtcbiAgICAgIHRhcmdldFRhYmxlW2ZpZWxkTmFtZV0ubm90TnVsbCgpXG4gICAgfVxuICB9KVxuXG4gIHJldHVybiB7XG4gICAgaGFzTG9jYWxpemVkRmllbGQsXG4gICAgaGFzTG9jYWxpemVkTWFueU51bWJlckZpZWxkLFxuICAgIGhhc0xvY2FsaXplZE1hbnlUZXh0RmllbGQsXG4gICAgaGFzTG9jYWxpemVkUmVsYXRpb25zaGlwRmllbGQsXG4gICAgaGFzTWFueU51bWJlckZpZWxkLFxuICAgIGhhc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UFDaEM7SUFDRjtJQUVBLE9BQU87UUFDTHZDO1FBQ0FLO1FBQ0FGO1FBQ0FGO1FBQ0FHO1FBQ0FGO0lBQ0Y7QUFDRixFQUFDIn0=
493
+ //# sourceMappingURL=traverseFields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/schema/traverseFields.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport type { Relation } from 'drizzle-orm'\nimport type { IndexBuilder, PgColumnBuilder, UniqueConstraintBuilder } from 'drizzle-orm/pg-core'\nimport type { Field, TabAsField } from 'payload/types'\n\nimport { relations } from 'drizzle-orm'\nimport {\n PgNumericBuilder,\n PgUUIDBuilder,\n PgVarcharBuilder,\n boolean,\n index,\n integer,\n jsonb,\n numeric,\n pgEnum,\n text,\n timestamp,\n varchar,\n} from 'drizzle-orm/pg-core'\nimport { InvalidConfiguration } from 'payload/errors'\nimport { fieldAffectsData, optionIsObject } from 'payload/types'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { GenericColumns, IDType, PostgresAdapter } from '../types.js'\n\nimport { hasLocalesTable } from '../utilities/hasLocalesTable.js'\nimport { buildTable } from './build.js'\nimport { createIndex } from './createIndex.js'\nimport { idToUUID } from './idToUUID.js'\nimport { parentIDColumnMap } from './parentIDColumnMap.js'\nimport { validateExistingBlockIsIdentical } from './validateExistingBlockIsIdentical.js'\n\ntype Args = {\n adapter: PostgresAdapter\n buildNumbers: boolean\n buildRelationships: boolean\n buildTexts: boolean\n columnPrefix?: string\n columns: Record<string, PgColumnBuilder>\n disableNotNull: boolean\n disableUnique?: boolean\n fieldPrefix?: string\n fields: (Field | TabAsField)[]\n forceLocalized?: boolean\n indexes: Record<string, (cols: GenericColumns) => IndexBuilder>\n localesColumns: Record<string, PgColumnBuilder>\n localesIndexes: Record<string, (cols: GenericColumns) => IndexBuilder>\n newTableName: string\n parentTableName: string\n relationsToBuild: Map<string, string>\n relationships: Set<string>\n rootRelationsToBuild?: Map<string, string>\n rootTableIDColType: string\n rootTableName: string\n}\n\ntype Result = {\n hasLocalizedField: boolean\n hasLocalizedManyNumberField: boolean\n hasLocalizedManyTextField: boolean\n hasLocalizedRelationshipField: boolean\n hasManyNumberField: 'index' | boolean\n hasManyTextField: 'index' | boolean\n}\n\nexport const traverseFields = ({\n adapter,\n buildNumbers,\n buildRelationships,\n buildTexts,\n columnPrefix,\n columns,\n disableNotNull,\n disableUnique = false,\n fieldPrefix,\n fields,\n forceLocalized,\n indexes,\n localesColumns,\n localesIndexes,\n newTableName,\n parentTableName,\n relationsToBuild,\n relationships,\n rootRelationsToBuild,\n rootTableIDColType,\n rootTableName,\n}: Args): Result => {\n let hasLocalizedField = false\n let hasLocalizedRelationshipField = false\n let hasManyTextField: 'index' | boolean = false\n let hasLocalizedManyTextField = false\n let hasManyNumberField: 'index' | boolean = false\n let hasLocalizedManyNumberField = false\n\n let parentIDColType: IDType = 'integer'\n if (columns.id instanceof PgUUIDBuilder) parentIDColType = 'uuid'\n if (columns.id instanceof PgNumericBuilder) parentIDColType = 'numeric'\n if (columns.id instanceof PgVarcharBuilder) parentIDColType = 'varchar'\n\n fields.forEach((field) => {\n if ('name' in field && field.name === 'id') return\n let columnName: string\n let fieldName: string\n\n let targetTable = columns\n let targetIndexes = indexes\n\n if (fieldAffectsData(field)) {\n columnName = `${columnPrefix || ''}${field.name[0] === '_' ? '_' : ''}${toSnakeCase(\n field.name,\n )}`\n fieldName = `${fieldPrefix?.replace('.', '_') || ''}${field.name}`\n\n // If field is localized,\n // add the column to the locale table instead of main table\n if (adapter.payload.config.localization && (field.localized || forceLocalized)) {\n hasLocalizedField = true\n targetTable = localesColumns\n targetIndexes = localesIndexes\n }\n\n if (\n (field.unique || field.index) &&\n !['array', 'blocks', 'group', 'point', 'relationship', 'upload'].includes(field.type) &&\n !('hasMany' in field && field.hasMany === true)\n ) {\n const unique = disableUnique !== true && field.unique\n if (unique) {\n const constraintValue = `${fieldPrefix || ''}${field.name}`\n if (!adapter.fieldConstraints?.[rootTableName]) {\n adapter.fieldConstraints[rootTableName] = {}\n }\n adapter.fieldConstraints[rootTableName][`${columnName}_idx`] = constraintValue\n }\n targetIndexes[`${newTableName}_${field.name}Idx`] = createIndex({\n name: fieldName,\n columnName,\n tableName: newTableName,\n unique,\n })\n }\n }\n\n switch (field.type) {\n case 'text': {\n if (field.hasMany) {\n if (field.localized) {\n hasLocalizedManyTextField = true\n }\n\n if (field.index) {\n hasManyTextField = 'index'\n } else if (!hasManyTextField) {\n hasManyTextField = true\n }\n\n if (field.unique) {\n throw new InvalidConfiguration(\n 'Unique is not supported in Postgres for hasMany text fields.',\n )\n }\n } else {\n targetTable[fieldName] = varchar(columnName)\n }\n break\n }\n case 'email':\n case 'code':\n case 'textarea': {\n targetTable[fieldName] = varchar(columnName)\n break\n }\n\n case 'number': {\n if (field.hasMany) {\n if (field.localized) {\n hasLocalizedManyNumberField = true\n }\n\n if (field.index) {\n hasManyNumberField = 'index'\n } else if (!hasManyNumberField) {\n hasManyNumberField = true\n }\n\n if (field.unique) {\n throw new InvalidConfiguration(\n 'Unique is not supported in Postgres for hasMany number fields.',\n )\n }\n } else {\n targetTable[fieldName] = numeric(columnName)\n }\n break\n }\n\n case 'richText':\n case 'json': {\n targetTable[fieldName] = jsonb(columnName)\n break\n }\n\n case 'date': {\n targetTable[fieldName] = timestamp(columnName, {\n mode: 'string',\n precision: 3,\n withTimezone: true,\n })\n break\n }\n\n case 'point': {\n break\n }\n\n case 'radio':\n case 'select': {\n const enumName = `enum_${newTableName}_${toSnakeCase(field.name)}`\n\n adapter.enums[enumName] = pgEnum(\n enumName,\n field.options.map((option) => {\n if (optionIsObject(option)) {\n return option.value\n }\n\n return option\n }) as [string, ...string[]],\n )\n\n if (field.type === 'select' && field.hasMany) {\n const selectTableName = `${newTableName}_${toSnakeCase(field.name)}`\n const baseColumns: Record<string, PgColumnBuilder> = {\n order: integer('order').notNull(),\n parent: parentIDColumnMap[parentIDColType]('parent_id')\n .references(() => adapter.tables[parentTableName].id, { onDelete: 'cascade' })\n .notNull(),\n value: adapter.enums[enumName]('value'),\n }\n\n const baseExtraConfig: Record<\n string,\n (cols: GenericColumns) => IndexBuilder | UniqueConstraintBuilder\n > = {\n orderIdx: (cols) => index(`${selectTableName}_order_idx`).on(cols.order),\n parentIdx: (cols) => index(`${selectTableName}_parent_idx`).on(cols.parent),\n }\n\n if (field.localized) {\n baseColumns.locale = adapter.enums.enum__locales('locale').notNull()\n baseExtraConfig.localeIdx = (cols) =>\n index(`${selectTableName}_locale_idx`).on(cols.locale)\n }\n\n if (field.index) {\n baseExtraConfig.value = (cols) => index(`${selectTableName}_value_idx`).on(cols.value)\n }\n\n buildTable({\n adapter,\n baseColumns,\n baseExtraConfig,\n disableNotNull,\n disableUnique,\n fields: [],\n tableName: selectTableName,\n })\n\n relationsToBuild.set(fieldName, selectTableName)\n\n const selectTableRelations = relations(adapter.tables[selectTableName], ({ one }) => {\n const result: Record<string, Relation<string>> = {\n parent: one(adapter.tables[parentTableName], {\n fields: [adapter.tables[selectTableName].parent],\n references: [adapter.tables[parentTableName].id],\n }),\n }\n\n return result\n })\n\n adapter.relations[`relation_${selectTableName}`] = selectTableRelations\n } else {\n targetTable[fieldName] = adapter.enums[enumName](fieldName)\n }\n break\n }\n\n case 'checkbox': {\n targetTable[fieldName] = boolean(columnName)\n break\n }\n\n case 'array': {\n const disableNotNullFromHere = Boolean(field.admin?.condition) || disableNotNull\n\n const arrayTableName = `${newTableName}_${toSnakeCase(field.name)}`\n const baseColumns: Record<string, PgColumnBuilder> = {\n _order: integer('_order').notNull(),\n _parentID: parentIDColumnMap[parentIDColType]('_parent_id')\n .references(() => adapter.tables[parentTableName].id, { onDelete: 'cascade' })\n .notNull(),\n }\n\n const baseExtraConfig: Record<\n string,\n (cols: GenericColumns) => IndexBuilder | UniqueConstraintBuilder\n > = {\n _orderIdx: (cols) => index(`${arrayTableName}_order_idx`).on(cols._order),\n _parentIDIdx: (cols) => index(`${arrayTableName}_parent_id_idx`).on(cols._parentID),\n }\n\n if (field.localized && adapter.payload.config.localization) {\n baseColumns._locale = adapter.enums.enum__locales('_locale').notNull()\n baseExtraConfig._localeIdx = (cols) =>\n index(`${arrayTableName}_locale_idx`).on(cols._locale)\n }\n\n const {\n hasManyNumberField: subHasManyNumberField,\n hasManyTextField: subHasManyTextField,\n relationsToBuild: subRelationsToBuild,\n } = buildTable({\n adapter,\n baseColumns,\n baseExtraConfig,\n disableNotNull: disableNotNullFromHere,\n disableUnique,\n fields: disableUnique ? idToUUID(field.fields) : field.fields,\n rootRelationsToBuild,\n rootRelationships: relationships,\n rootTableIDColType,\n rootTableName,\n tableName: arrayTableName,\n })\n\n if (subHasManyTextField) {\n if (!hasManyTextField || subHasManyTextField === 'index')\n hasManyTextField = subHasManyTextField\n }\n if (subHasManyNumberField) {\n if (!hasManyNumberField || subHasManyNumberField === 'index')\n hasManyNumberField = subHasManyNumberField\n }\n\n relationsToBuild.set(fieldName, arrayTableName)\n\n const arrayTableRelations = relations(adapter.tables[arrayTableName], ({ many, one }) => {\n const result: Record<string, Relation<string>> = {\n _parentID: one(adapter.tables[parentTableName], {\n fields: [adapter.tables[arrayTableName]._parentID],\n references: [adapter.tables[parentTableName].id],\n }),\n }\n\n if (hasLocalesTable(field.fields)) {\n result._locales = many(adapter.tables[`${arrayTableName}_locales`])\n }\n\n subRelationsToBuild.forEach((val, key) => {\n result[key] = many(adapter.tables[val])\n })\n\n return result\n })\n\n adapter.relations[`relations_${arrayTableName}`] = arrayTableRelations\n\n break\n }\n\n case 'blocks': {\n const disableNotNullFromHere = Boolean(field.admin?.condition) || disableNotNull\n\n field.blocks.forEach((block) => {\n const blockTableName = `${rootTableName}_blocks_${toSnakeCase(block.slug)}`\n if (!adapter.tables[blockTableName]) {\n const baseColumns: Record<string, PgColumnBuilder> = {\n _order: integer('_order').notNull(),\n _parentID: parentIDColumnMap[rootTableIDColType]('_parent_id')\n .references(() => adapter.tables[rootTableName].id, { onDelete: 'cascade' })\n .notNull(),\n _path: text('_path').notNull(),\n }\n\n const baseExtraConfig: Record<\n string,\n (cols: GenericColumns) => IndexBuilder | UniqueConstraintBuilder\n > = {\n _orderIdx: (cols) => index(`${blockTableName}_order_idx`).on(cols._order),\n _parentIDIdx: (cols) => index(`${blockTableName}_parent_id_idx`).on(cols._parentID),\n _pathIdx: (cols) => index(`${blockTableName}_path_idx`).on(cols._path),\n }\n\n if (field.localized && adapter.payload.config.localization) {\n baseColumns._locale = adapter.enums.enum__locales('_locale').notNull()\n baseExtraConfig._localeIdx = (cols) =>\n index(`${blockTableName}_locale_idx`).on(cols._locale)\n }\n\n const {\n hasManyNumberField: subHasManyNumberField,\n hasManyTextField: subHasManyTextField,\n relationsToBuild: subRelationsToBuild,\n } = buildTable({\n adapter,\n baseColumns,\n baseExtraConfig,\n disableNotNull: disableNotNullFromHere,\n disableUnique,\n fields: disableUnique ? idToUUID(block.fields) : block.fields,\n rootRelationsToBuild,\n rootRelationships: relationships,\n rootTableIDColType,\n rootTableName,\n tableName: blockTableName,\n })\n\n if (subHasManyTextField) {\n if (!hasManyTextField || subHasManyTextField === 'index')\n hasManyTextField = subHasManyTextField\n }\n\n if (subHasManyNumberField) {\n if (!hasManyNumberField || subHasManyNumberField === 'index')\n hasManyNumberField = subHasManyNumberField\n }\n\n const blockTableRelations = relations(\n adapter.tables[blockTableName],\n ({ many, one }) => {\n const result: Record<string, Relation<string>> = {\n _parentID: one(adapter.tables[rootTableName], {\n fields: [adapter.tables[blockTableName]._parentID],\n references: [adapter.tables[rootTableName].id],\n }),\n }\n\n if (hasLocalesTable(block.fields)) {\n result._locales = many(adapter.tables[`${blockTableName}_locales`])\n }\n\n subRelationsToBuild.forEach((val, key) => {\n result[key] = many(adapter.tables[val])\n })\n\n return result\n },\n )\n\n adapter.relations[`relations_${blockTableName}`] = blockTableRelations\n } else if (process.env.NODE_ENV !== 'production') {\n validateExistingBlockIsIdentical({\n block,\n localized: field.localized,\n rootTableName,\n table: adapter.tables[blockTableName],\n })\n }\n\n rootRelationsToBuild.set(`_blocks_${block.slug}`, blockTableName)\n })\n\n break\n }\n\n case 'tab':\n case 'group': {\n if (!('name' in field)) {\n const {\n hasLocalizedField: groupHasLocalizedField,\n hasLocalizedManyNumberField: groupHasLocalizedManyNumberField,\n hasLocalizedManyTextField: groupHasLocalizedManyTextField,\n hasLocalizedRelationshipField: groupHasLocalizedRelationshipField,\n hasManyNumberField: groupHasManyNumberField,\n hasManyTextField: groupHasManyTextField,\n } = traverseFields({\n adapter,\n buildNumbers,\n buildRelationships,\n buildTexts,\n columnPrefix,\n columns,\n disableNotNull,\n disableUnique,\n fieldPrefix,\n fields: field.fields,\n forceLocalized,\n indexes,\n localesColumns,\n localesIndexes,\n newTableName,\n parentTableName,\n relationsToBuild,\n relationships,\n rootRelationsToBuild,\n rootTableIDColType,\n rootTableName,\n })\n\n if (groupHasLocalizedField) hasLocalizedField = true\n if (groupHasLocalizedRelationshipField) hasLocalizedRelationshipField = true\n if (groupHasManyTextField) hasManyTextField = true\n if (groupHasLocalizedManyTextField) hasLocalizedManyTextField = true\n if (groupHasManyNumberField) hasManyNumberField = true\n if (groupHasLocalizedManyNumberField) hasLocalizedManyNumberField = true\n break\n }\n\n const disableNotNullFromHere = Boolean(field.admin?.condition) || disableNotNull\n\n const {\n hasLocalizedField: groupHasLocalizedField,\n hasLocalizedManyNumberField: groupHasLocalizedManyNumberField,\n hasLocalizedManyTextField: groupHasLocalizedManyTextField,\n hasLocalizedRelationshipField: groupHasLocalizedRelationshipField,\n hasManyNumberField: groupHasManyNumberField,\n hasManyTextField: groupHasManyTextField,\n } = traverseFields({\n adapter,\n buildNumbers,\n buildRelationships,\n buildTexts,\n columnPrefix: `${columnName}_`,\n columns,\n disableNotNull: disableNotNullFromHere,\n disableUnique,\n fieldPrefix: `${fieldName}.`,\n fields: field.fields,\n forceLocalized: field.localized,\n indexes,\n localesColumns,\n localesIndexes,\n newTableName: `${parentTableName}_${columnName}`,\n parentTableName,\n relationsToBuild,\n relationships,\n rootRelationsToBuild,\n rootTableIDColType,\n rootTableName,\n })\n\n if (groupHasLocalizedField) hasLocalizedField = true\n if (groupHasLocalizedRelationshipField) hasLocalizedRelationshipField = true\n if (groupHasManyTextField) hasManyTextField = true\n if (groupHasLocalizedManyTextField) hasLocalizedManyTextField = true\n if (groupHasManyNumberField) hasManyNumberField = true\n if (groupHasLocalizedManyNumberField) hasLocalizedManyNumberField = true\n break\n }\n\n case 'tabs': {\n const disableNotNullFromHere = Boolean(field.admin?.condition) || disableNotNull\n\n const {\n hasLocalizedField: tabHasLocalizedField,\n hasLocalizedManyNumberField: tabHasLocalizedManyNumberField,\n hasLocalizedManyTextField: tabHasLocalizedManyTextField,\n hasLocalizedRelationshipField: tabHasLocalizedRelationshipField,\n hasManyNumberField: tabHasManyNumberField,\n hasManyTextField: tabHasManyTextField,\n } = traverseFields({\n adapter,\n buildNumbers,\n buildRelationships,\n buildTexts,\n columnPrefix,\n columns,\n disableNotNull: disableNotNullFromHere,\n disableUnique,\n fieldPrefix,\n fields: field.tabs.map((tab) => ({ ...tab, type: 'tab' })),\n forceLocalized,\n indexes,\n localesColumns,\n localesIndexes,\n newTableName,\n parentTableName,\n relationsToBuild,\n relationships,\n rootRelationsToBuild,\n rootTableIDColType,\n rootTableName,\n })\n\n if (tabHasLocalizedField) hasLocalizedField = true\n if (tabHasLocalizedRelationshipField) hasLocalizedRelationshipField = true\n if (tabHasManyTextField) hasManyTextField = true\n if (tabHasLocalizedManyTextField) hasLocalizedManyTextField = true\n if (tabHasManyNumberField) hasManyNumberField = true\n if (tabHasLocalizedManyNumberField) hasLocalizedManyNumberField = true\n break\n }\n\n case 'row':\n case 'collapsible': {\n const disableNotNullFromHere = Boolean(field.admin?.condition) || disableNotNull\n const {\n hasLocalizedField: rowHasLocalizedField,\n hasLocalizedManyNumberField: rowHasLocalizedManyNumberField,\n hasLocalizedManyTextField: rowHasLocalizedManyTextField,\n hasLocalizedRelationshipField: rowHasLocalizedRelationshipField,\n hasManyNumberField: rowHasManyNumberField,\n hasManyTextField: rowHasManyTextField,\n } = traverseFields({\n adapter,\n buildNumbers,\n buildRelationships,\n buildTexts,\n columnPrefix,\n columns,\n disableNotNull: disableNotNullFromHere,\n disableUnique,\n fieldPrefix,\n fields: field.fields,\n forceLocalized,\n indexes,\n localesColumns,\n localesIndexes,\n newTableName: parentTableName,\n parentTableName,\n relationsToBuild,\n relationships,\n rootRelationsToBuild,\n rootTableIDColType,\n rootTableName,\n })\n\n if (rowHasLocalizedField) hasLocalizedField = true\n if (rowHasLocalizedRelationshipField) hasLocalizedRelationshipField = true\n if (rowHasManyTextField) hasManyTextField = true\n if (rowHasLocalizedManyTextField) hasLocalizedManyTextField = true\n if (rowHasManyNumberField) hasManyNumberField = true\n if (rowHasLocalizedManyNumberField) hasLocalizedManyNumberField = true\n break\n }\n\n case 'relationship':\n case 'upload':\n if (Array.isArray(field.relationTo)) {\n field.relationTo.forEach((relation) => relationships.add(relation))\n } else {\n relationships.add(field.relationTo)\n }\n\n if (field.localized && adapter.payload.config.localization) {\n hasLocalizedRelationshipField = true\n }\n break\n\n default:\n break\n }\n\n const condition = field.admin && field.admin.condition\n\n if (\n !disableNotNull &&\n targetTable[fieldName] &&\n 'required' in field &&\n field.required &&\n !condition\n ) {\n targetTable[fieldName].notNull()\n }\n })\n\n return {\n hasLocalizedField,\n hasLocalizedManyNumberField,\n hasLocalizedManyTextField,\n hasLocalizedRelationshipField,\n hasManyNumberField,\n hasManyTextField,\n }\n}\n"],"names":["relations","PgNumericBuilder","PgUUIDBuilder","PgVarcharBuilder","boolean","index","integer","jsonb","numeric","pgEnum","text","timestamp","varchar","InvalidConfiguration","fieldAffectsData","optionIsObject","toSnakeCase","hasLocalesTable","buildTable","createIndex","idToUUID","parentIDColumnMap","validateExistingBlockIsIdentical","traverseFields","adapter","buildNumbers","buildRelationships","buildTexts","columnPrefix","columns","disableNotNull","disableUnique","fieldPrefix","fields","forceLocalized","indexes","localesColumns","localesIndexes","newTableName","parentTableName","relationsToBuild","relationships","rootRelationsToBuild","rootTableIDColType","rootTableName","hasLocalizedField","hasLocalizedRelationshipField","hasManyTextField","hasLocalizedManyTextField","hasManyNumberField","hasLocalizedManyNumberField","parentIDColType","id","forEach","field","name","columnName","fieldName","targetTable","targetIndexes","replace","payload","config","localization","localized","unique","includes","type","hasMany","constraintValue","fieldConstraints","tableName","mode","precision","withTimezone","enumName","enums","options","map","option","value","selectTableName","baseColumns","order","notNull","parent","references","tables","onDelete","baseExtraConfig","orderIdx","cols","on","parentIdx","locale","enum__locales","localeIdx","set","selectTableRelations","one","result","disableNotNullFromHere","Boolean","admin","condition","arrayTableName","_order","_parentID","_orderIdx","_parentIDIdx","_locale","_localeIdx","subHasManyNumberField","subHasManyTextField","subRelationsToBuild","rootRelationships","arrayTableRelations","many","_locales","val","key","blocks","block","blockTableName","slug","_path","_pathIdx","blockTableRelations","process","env","NODE_ENV","table","groupHasLocalizedField","groupHasLocalizedManyNumberField","groupHasLocalizedManyTextField","groupHasLocalizedRelationshipField","groupHasManyNumberField","groupHasManyTextField","tabHasLocalizedField","tabHasLocalizedManyNumberField","tabHasLocalizedManyTextField","tabHasLocalizedRelationshipField","tabHasManyNumberField","tabHasManyTextField","tabs","tab","rowHasLocalizedField","rowHasLocalizedManyNumberField","rowHasLocalizedManyTextField","rowHasLocalizedRelationshipField","rowHasManyNumberField","rowHasManyTextField","Array","isArray","relationTo","relation","add","required"],"mappings":"AAAA,oCAAoC,GAKpC,SAASA,SAAS,QAAQ,cAAa;AACvC,SACEC,gBAAgB,EAChBC,aAAa,EACbC,gBAAgB,EAChBC,OAAO,EACPC,KAAK,EACLC,OAAO,EACPC,KAAK,EACLC,OAAO,EACPC,MAAM,EACNC,IAAI,EACJC,SAAS,EACTC,OAAO,QACF,sBAAqB;AAC5B,SAASC,oBAAoB,QAAQ,iBAAgB;AACrD,SAASC,gBAAgB,EAAEC,cAAc,QAAQ,gBAAe;AAChE,OAAOC,iBAAiB,gBAAe;AAIvC,SAASC,eAAe,QAAQ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