@payloadcms/db-postgres 0.7.1 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. package/dist/count.d.ts +3 -0
  2. package/dist/count.d.ts.map +1 -0
  3. package/dist/count.js +68 -0
  4. package/dist/create.d.ts.map +1 -1
  5. package/dist/create.js +7 -9
  6. package/dist/createGlobal.d.ts +1 -1
  7. package/dist/createGlobal.d.ts.map +1 -1
  8. package/dist/createGlobal.js +8 -10
  9. package/dist/createGlobalVersion.d.ts +1 -1
  10. package/dist/createGlobalVersion.d.ts.map +1 -1
  11. package/dist/createGlobalVersion.js +12 -14
  12. package/dist/createVersion.d.ts.map +1 -1
  13. package/dist/createVersion.js +22 -19
  14. package/dist/deleteMany.js +6 -8
  15. package/dist/deleteOne.d.ts.map +1 -1
  16. package/dist/deleteOne.js +6 -3
  17. package/dist/deleteVersions.d.ts.map +1 -1
  18. package/dist/deleteVersions.js +7 -8
  19. package/dist/find/buildFindManyArgs.js +3 -3
  20. package/dist/find/findMany.js +2 -2
  21. package/dist/find/traverseFields.d.ts.map +1 -1
  22. package/dist/find/traverseFields.js +23 -11
  23. package/dist/find.d.ts.map +1 -1
  24. package/dist/find.js +10 -11
  25. package/dist/findGlobal.d.ts.map +1 -1
  26. package/dist/findGlobal.js +7 -9
  27. package/dist/findGlobalVersions.d.ts.map +1 -1
  28. package/dist/findGlobalVersions.js +7 -8
  29. package/dist/findOne.d.ts +1 -1
  30. package/dist/findOne.d.ts.map +1 -1
  31. package/dist/findOne.js +9 -10
  32. package/dist/findVersions.d.ts.map +1 -1
  33. package/dist/findVersions.js +7 -8
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +7 -1
  36. package/dist/init.d.ts.map +1 -1
  37. package/dist/init.js +28 -15
  38. package/dist/queries/getTableColumnFromPath.d.ts.map +1 -1
  39. package/dist/queries/getTableColumnFromPath.js +148 -42
  40. package/dist/queries/sanitizeQueryValue.d.ts.map +1 -1
  41. package/dist/queries/sanitizeQueryValue.js +5 -2
  42. package/dist/queryDrafts.d.ts.map +1 -1
  43. package/dist/queryDrafts.js +7 -8
  44. package/dist/schema/build.d.ts +2 -1
  45. package/dist/schema/build.d.ts.map +1 -1
  46. package/dist/schema/build.js +19 -14
  47. package/dist/schema/getTableName.d.ts +32 -0
  48. package/dist/schema/getTableName.d.ts.map +1 -0
  49. package/dist/schema/getTableName.js +43 -0
  50. package/dist/schema/traverseFields.d.ts +2 -1
  51. package/dist/schema/traverseFields.d.ts.map +1 -1
  52. package/dist/schema/traverseFields.js +54 -18
  53. package/dist/schema/validateExistingBlockIsIdentical.d.ts +2 -1
  54. package/dist/schema/validateExistingBlockIsIdentical.d.ts.map +1 -1
  55. package/dist/schema/validateExistingBlockIsIdentical.js +14 -8
  56. package/dist/transform/write/blocks.d.ts +2 -2
  57. package/dist/transform/write/blocks.d.ts.map +1 -1
  58. package/dist/transform/write/blocks.js +4 -4
  59. package/dist/transform/write/traverseFields.d.ts +2 -2
  60. package/dist/transform/write/traverseFields.d.ts.map +1 -1
  61. package/dist/transform/write/traverseFields.js +34 -25
  62. package/dist/types.d.ts +13 -0
  63. package/dist/types.d.ts.map +1 -1
  64. package/dist/update.d.ts.map +1 -1
  65. package/dist/update.js +7 -4
  66. package/dist/updateGlobal.d.ts +1 -1
  67. package/dist/updateGlobal.d.ts.map +1 -1
  68. package/dist/updateGlobal.js +9 -11
  69. package/dist/updateGlobalVersion.d.ts.map +1 -1
  70. package/dist/updateGlobalVersion.js +9 -5
  71. package/dist/updateVersion.d.ts.map +1 -1
  72. package/dist/updateVersion.js +9 -5
  73. package/dist/upsertRow/index.d.ts.map +1 -1
  74. package/dist/upsertRow/index.js +7 -6
  75. package/dist/upsertRow/insertArrays.d.ts.map +1 -1
  76. package/dist/upsertRow/insertArrays.js +3 -3
  77. package/dist/upsertRow/types.d.ts +1 -1
  78. package/dist/upsertRow/types.d.ts.map +1 -1
  79. package/package.json +3 -3
@@ -54,7 +54,7 @@ const sanitizeQueryValue = ({ adapter, field, operator: operatorArg, relationOrP
54
54
  if (field.type === 'number' && typeof formattedValue === 'string') {
55
55
  formattedValue = Number(val);
56
56
  }
57
- if (field.type === 'date') {
57
+ if (field.type === 'date' && operator !== 'exists') {
58
58
  if (typeof val === 'string') {
59
59
  formattedValue = new Date(val);
60
60
  if (Number.isNaN(Date.parse(formattedValue))) {
@@ -76,6 +76,9 @@ const sanitizeQueryValue = ({ adapter, field, operator: operatorArg, relationOrP
76
76
  formattedValue = null;
77
77
  }
78
78
  }
79
+ if ('hasMany' in field && field.hasMany && operator === 'contains') {
80
+ operator = 'equals';
81
+ }
79
82
  if (operator === 'near' || operator === 'within' || operator === 'intersects') {
80
83
  throw new _errors.APIError(`Querying with '${operator}' is not supported with the postgres database adapter.`);
81
84
  }
@@ -94,4 +97,4 @@ const sanitizeQueryValue = ({ adapter, field, operator: operatorArg, relationOrP
94
97
  };
95
98
  };
96
99
 
97
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9xdWVyaWVzL3Nhbml0aXplUXVlcnlWYWx1ZS50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBBUElFcnJvciB9IGZyb20gJ3BheWxvYWQvZXJyb3JzJ1xuaW1wb3J0IHsgdHlwZSBGaWVsZCwgdHlwZSBUYWJBc0ZpZWxkLCBmaWVsZEFmZmVjdHNEYXRhIH0gZnJvbSAncGF5bG9hZC90eXBlcydcbmltcG9ydCB7IGNyZWF0ZUFycmF5RnJvbUNvbW1hRGVsaW5lYXRlZCB9IGZyb20gJ3BheWxvYWQvdXRpbGl0aWVzJ1xuXG5pbXBvcnQgdHlwZSB7IFBvc3RncmVzQWRhcHRlciB9IGZyb20gJy4uL3R5cGVzJ1xuXG50eXBlIFNhbml0aXplUXVlcnlWYWx1ZUFyZ3MgPSB7XG4gIGFkYXB0ZXI6IFBvc3RncmVzQWRhcHRlclxuICBmaWVsZDogRmllbGQgfCBUYWJBc0ZpZW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BQVEsQ0FDaEIsQ0FBQyxlQUFlLEVBQUU5QixTQUFTLHNEQUFzRCxDQUFDO0lBRXRGO0lBRUEsSUFBSUEsYUFBYSxZQUFZO1FBQzNCSSxpQkFBaUIsQ0FBQyxDQUFDLEVBQUVBLGVBQWUsQ0FBQyxDQUFDO0lBQ3hDO0lBRUEsSUFBSUosYUFBYSxVQUFVO1FBQ3pCSSxpQkFBaUJBLG1CQUFtQixVQUFVQSxtQkFBbUI7UUFDakUsSUFBSUEsbUJBQW1CLE9BQU87WUFDNUJKLFdBQVc7UUFDYjtJQUNGO0lBRUEsT0FBTztRQUFFQTtRQUFVTSxPQUFPRjtJQUFlO0FBQzNDIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"queryDrafts.d.ts","sourceRoot":"","sources":["../src/queryDrafts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAkB,MAAM,kBAAkB,CAAA;AAMnE,eAAO,MAAM,WAAW,EAAE,WA2CzB,CAAA"}
1
+ {"version":3,"file":"queryDrafts.d.ts","sourceRoot":"","sources":["../src/queryDrafts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAkB,MAAM,kBAAkB,CAAA;AAMnE,eAAO,MAAM,WAAW,EAAE,WA+CzB,CAAA"}
@@ -10,16 +10,15 @@ Object.defineProperty(exports, "queryDrafts", {
10
10
  });
11
11
  const _database = require("payload/database");
12
12
  const _versions = require("payload/versions");
13
- const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
14
13
  const _findMany = require("./find/findMany");
15
- function _interop_require_default(obj) {
16
- return obj && obj.__esModule ? obj : {
17
- default: obj
18
- };
19
- }
14
+ const _getTableName = require("./schema/getTableName");
20
15
  const queryDrafts = async function queryDrafts({ collection, limit, locale, page = 1, pagination, req = {}, sort, where }) {
21
16
  const collectionConfig = this.payload.collections[collection].config;
22
- const tableName = `_${(0, _tosnakecase.default)(collection)}_v`;
17
+ const tableName = (0, _getTableName.getTableName)({
18
+ adapter: this,
19
+ config: collectionConfig,
20
+ versions: true
21
+ });
23
22
  const fields = (0, _versions.buildVersionCollectionFields)(collectionConfig);
24
23
  const combinedWhere = (0, _database.combineQueries)({
25
24
  latest: {
@@ -53,4 +52,4 @@ const queryDrafts = async function queryDrafts({ collection, limit, locale, page
53
52
  };
54
53
  };
55
54
 
56
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9xdWVyeURyYWZ0cy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgdHlwZSB7IFBheWxvYWRSZXF1ZXN0LCBTYW5pdGl6ZWRDb2xsZWN0aW9uQ29uZmlnIH0gZnJvbSAncGF5bG9hZC90eXBlcydcblxuaW1wb3J0IHsgdHlwZSBRdWVyeURyYWZ0cywgY29tYmluZVF1ZXJpZXMgfSBmcm9tICdwYXlsb2FkL2RhdGFiYXNlJ1xuaW1wb3J0IHsgYnVpbGRWZXJzaW9uQ29sbGVjdGlvbkZpZWxkcyB9IGZyb20gJ3BheWxvYWQvdmVyc2lvbnMnXG5pbXBvcnQgdG9TbmFrZUNhc2UgZnJvbSAndG8tc25ha2UtY2FzZSdcblxuaW1wb3J0IHsgZmluZE1hbnkgfSBmcm9tICcuL2ZpbmQvZmluZE1hbnknXG5cbmV4cG9ydCBjb25zdCBxdWVyeURyYWZ0czogUXVlcnlEcmFmdHMgPSBhc3luYyBmdW5jdGlvbiBxdWVyeURyYWZ0cyh7XG4gIGNvbGxlY3Rpb24sXG4gIGxpbWl0LFxuICBsb2NhbGUsXG4gIHBhZ2UgPSAxLFxuICBwYWdpbmF0aW9uLFxuICByZXEgPSB7fSBhcyBQYXlsb2FkUmVxdWVzdCxcbiAgc29ydCxcbiAgd2hlcmUsXG59KSB7XG4gIGNvbnN0IGNvbGxlY3Rpb25Db25maWc6IFNhbml0aXplZENvbGxlY3Rpb25Db25maWcgPSB0aGlzLnBheWxvYWQuY29sbG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EJBQVksRUFBQztRQUM3QkMsU0FBUyxJQUFJO1FBQ2JILFFBQVFIO1FBQ1JPLFVBQVU7SUFDWjtJQUNBLE1BQU1DLFNBQVNDLElBQUFBLHNDQUE0QixFQUFDVDtJQUU1QyxNQUFNVSxnQkFBZ0JDLElBQUFBLHdCQUFjLEVBQUM7UUFBRUMsUUFBUTtZQUFFQyxRQUFRO1FBQUs7SUFBRSxHQUFHZDtJQUVuRSxNQUFNZSxTQUFTLE1BQU1DLElBQUFBLGtCQUFRLEVBQUM7UUFDNUJULFNBQVMsSUFBSTtRQUNiRTtRQUNBZjtRQUNBQztRQUNBQztRQUNBQztRQUNBQztRQUNBQztRQUNBTTtRQUNBTCxPQUFPVztJQUNUO0lBRUEsT0FBTztRQUNMLEdBQUdJLE1BQU07UUFDVEUsTUFBTUYsT0FBT0UsSUFBSSxDQUFDQyxHQUFHLENBQUMsQ0FBQ0M7WUFDckIsNkNBQTZDO1lBQzdDQSxNQUFNO2dCQUNKQyxJQUFJRCxJQUFJRSxNQUFNO2dCQUNkLEdBQUdGLElBQUlHLE9BQU87Z0JBQ2RDLFdBQVdKLElBQUlJLFNBQVM7Z0JBQ3hCQyxXQUFXTCxJQUFJSyxTQUFTO1lBQzFCO1lBRUEsT0FBT0w7UUFDVDtJQUNGO0FBQ0YifQ==
@@ -17,12 +17,13 @@ type Args = {
17
17
  rootTableName?: string;
18
18
  tableName: string;
19
19
  timestamps?: boolean;
20
+ versions: boolean;
20
21
  };
21
22
  type Result = {
22
23
  hasManyNumberField: 'index' | boolean;
23
24
  hasManyTextField: 'index' | boolean;
24
25
  relationsToBuild: Map<string, string>;
25
26
  };
26
- export declare const buildTable: ({ adapter, baseColumns, baseExtraConfig, buildNumbers, buildRelationships, buildTexts, disableNotNull, disableUnique, fields, rootRelationsToBuild, rootRelationships, rootTableIDColType, rootTableName: incomingRootTableName, tableName, timestamps, }: Args) => Result;
27
+ export declare const buildTable: ({ adapter, baseColumns, baseExtraConfig, buildNumbers, buildRelationships, buildTexts, disableNotNull, disableUnique, fields, rootRelationsToBuild, rootRelationships, rootTableIDColType, rootTableName: incomingRootTableName, tableName, timestamps, versions, }: Args) => Result;
27
28
  export {};
28
29
  //# sourceMappingURL=build.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/schema/build.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EAEf,uBAAuB,EACxB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAO1C,OAAO,KAAK,EAAE,cAAc,EAAwB,eAAe,EAAE,MAAM,UAAU,CAAA;AAMrF,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,eAAe,CAAA;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IAC7C,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,YAAY,GAAG,uBAAuB,CAAC,CAAA;IAClG,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,cAAc,EAAE,OAAO,CAAA;IACvB,aAAa,EAAE,OAAO,CAAA;IACtB,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,oBAAoB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC1C,iBAAiB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC/B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,KAAK,MAAM,GAAG;IACZ,kBAAkB,EAAE,OAAO,GAAG,OAAO,CAAA;IACrC,g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AkB,EAAE,OAAO,GAAG,OAAO,CAAA;IACrC,gBAAgB,EAAE,OAAO,GAAG,OAAO,CAAA;IACnC,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACtC,CAAA;AAED,eAAO,MAAM,UAAU,wQAiBpB,IAAI,KAAG,MAyUT,CAAA"}
@@ -11,16 +11,11 @@ Object.defineProperty(exports, "buildTable", {
11
11
  const _drizzleorm = require("drizzle-orm");
12
12
  const _pgcore = require("drizzle-orm/pg-core");
13
13
  const _types = require("payload/types");
14
- const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
14
+ const _getTableName = require("./getTableName");
15
15
  const _parentIDColumnMap = require("./parentIDColumnMap");
16
16
  const _setColumnID = require("./setColumnID");
17
17
  const _traverseFields = require("./traverseFields");
18
- function _interop_require_default(obj) {
19
- return obj && obj.__esModule ? obj : {
20
- default: obj
21
- };
22
- }
23
- const buildTable = ({ adapter, baseColumns = {}, baseExtraConfig = {}, buildNumbers, buildRelationships, buildTexts, disableNotNull, disableUnique = false, fields, rootRelationsToBuild, rootRelationships, rootTableIDColType, rootTableName: incomingRootTableName, tableName, timestamps })=>{
18
+ const buildTable = ({ adapter, baseColumns = {}, baseExtraConfig = {}, buildNumbers, buildRelationships, buildTexts, disableNotNull, disableUnique = false, fields, rootRelationsToBuild, rootRelationships, rootTableIDColType, rootTableName: incomingRootTableName, tableName, timestamps, versions })=>{
24
19
  const rootTableName = incomingRootTableName || tableName;
25
20
  const columns = baseColumns;
26
21
  const indexes = {};
@@ -63,7 +58,8 @@ const buildTable = ({ adapter, baseColumns = {}, baseExtraConfig = {}, buildNumb
63
58
  relationships,
64
59
  rootRelationsToBuild: rootRelationsToBuild || relationsToBuild,
65
60
  rootTableIDColType: rootTableIDColType || idColType,
66
- rootTableName
61
+ rootTableName,
62
+ versions
67
63
  }));
68
64
  if (timestamps) {
69
65
  columns.createdAt = (0, _pgcore.timestamp)('created_at', {
@@ -89,7 +85,7 @@ const buildTable = ({ adapter, baseColumns = {}, baseExtraConfig = {}, buildNumb
89
85
  });
90
86
  adapter.tables[tableName] = table;
91
87
  if (hasLocalizedField) {
92
- const localeTableName = `${tableName}_locales`;
88
+ const localeTableName = `${tableName}${adapter.localesSuffix}`;
93
89
  localesColumns.id = (0, _pgcore.serial)('id').primaryKey();
94
90
  localesColumns._locale = adapter.enums.enum__locales('_locale').notNull();
95
91
  localesColumns._parentID = _parentIDColumnMap.parentIDColumnMap[idColType]('_parent_id').references(()=>table.id, {
@@ -208,16 +204,21 @@ const buildTable = ({ adapter, baseColumns = {}, baseExtraConfig = {}, buildNumb
208
204
  relationshipColumns.locale = adapter.enums.enum__locales('locale');
209
205
  }
210
206
  relationships.forEach((relationTo)=>{
211
- const formattedRelationTo = (0, _tosnakecase.default)(relationTo);
207
+ const relationshipConfig = adapter.payload.collections[relationTo].config;
208
+ const formattedRelationTo = (0, _getTableName.getTableName)({
209
+ adapter,
210
+ config: relationshipConfig,
211
+ throwValidationError: true
212
+ });
212
213
  let colType = adapter.idType === 'uuid' ? 'uuid' : 'integer';
213
- const relatedCollectionCustomID = adapter.payload.collections[relationTo].config.fields.find((field)=>(0, _types.fieldAffectsData)(field) && field.name === 'id');
214
+ const relatedCollectionCustomID = relationshipConfig.fields.find((field)=>(0, _types.fieldAffectsData)(field) && field.name === 'id');
214
215
  if (relatedCollectionCustomID?.type === 'number') colType = 'numeric';
215
216
  if (relatedCollectionCustomID?.type === 'text') colType = 'varchar';
216
217
  relationshipColumns[`${relationTo}ID`] = _parentIDColumnMap.parentIDColumnMap[colType](`${formattedRelationTo}_id`).references(()=>adapter.tables[formattedRelationTo].id, {
217
218
  onDelete: 'cascade'
218
219
  });
219
220
  });
220
- const relationshipsTableName = `${tableName}_rels`;
221
+ const relationshipsTableName = `${tableName}${adapter.relationshipsSuffix}`;
221
222
  relationshipsTable = adapter.pgSchema.table(relationshipsTableName, relationshipColumns, (cols)=>{
222
223
  const result = {
223
224
  order: (0, _pgcore.index)(`${relationshipsTableName}_order_idx`).on(cols.order),
@@ -243,7 +244,11 @@ const buildTable = ({ adapter, baseColumns = {}, baseExtraConfig = {}, buildNumb
243
244
  })
244
245
  };
245
246
  relationships.forEach((relationTo)=>{
246
- const relatedTableName = (0, _tosnakecase.default)(relationTo);
247
+ const relatedTableName = (0, _getTableName.getTableName)({
248
+ adapter,
249
+ config: adapter.payload.collections[relationTo].config,
250
+ throwValidationError: true
251
+ });
247
252
  const idColumnName = `${relationTo}ID`;
248
253
  result[idColumnName] = one(adapter.tables[relatedTableName], {
249
254
  fields: [
@@ -288,4 +293,4 @@ const buildTable = ({ adapter, baseColumns = {}, baseExtraConfig = {}, buildNumb
288
293
  };
289
294
  };
290
295
 
291
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWEvYnVpbGQudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyogZXNsaW50LWRpc2FibGUgbm8tcGFyYW0tcmVhc3NpZ24gKi9cbmltcG9ydCB0eXBlIHsgUmVsYXRpb24gfSBmcm9tICdkcml6emxlLW9ybSdcbmltcG9ydCB0eXBlIHtcbiAgSW5kZXhCdWlsZGVyLFxuICBQZ0NvbHVtbkJ1aWxkZXIsXG4gIFBnVGFibGVXaXRoQ29sdW1ucyxcbiAgVW5pcXVlQ29uc3RyYWludEJ1aWxkZXIsXG59IGZyb20gJ2RyaXp6bGUtb3JtL3BnLWNvcmUnXG5pbXBvcnQgdHlwZSB7IEZpZWxkIH0gZnJvbSAncGF5bG9hZC90eXBlcydcblxuaW1wb3J0IHsgcmVsYXRpb25zIH0gZnJvbSAnZHJpenpsZS1vcm0nXG5pbXBvcnQgeyBpbmRleCwgaW50ZWdlciwgbnVtZXJpYywgc2VyaWFsLCB0aW1lc3RhbXAsIHVuaXF1ZSwgdmFyY2hhciB9IGZyb20gJ2RyaXp6bGUtb3JtL3BnLWNvcmUnXG5pbXBvcnQgeyBm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scy5wYXRoKSxcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAoaGFzTG9jYWxpemVkUmVsYXRpb25zaGlwRmllbGQpIHtcbiAgICAgICAgICAgIHJlc3VsdC5sb2NhbGVJZHggPSBpbmRleChgJHtyZWxhdGlvbnNoaXBzVGFibGVOYW1lfV9sb2NhbGVfaWR4YCkub24oY29scy5sb2NhbGUpXG4gICAgICAgICAgfVxuXG4gICAgICAgICAgcmV0dXJuIHJlc3VsdFxuICAgICAgICB9LFxuICAgICAgKVxuXG4gICAgICBhZGFwdGVyLnRhYmxlc1tyZWxhdGlvbnNoaXBzVGFibGVOYW1lXSA9IHJlbGF0aW9uc2hpcHNUYWJsZVxuXG4gICAgICBjb25zdCByZWxhdGlvbnNoaXBzVGFibGVSZWxhdGlvbnMgPSByZWxhdGlvbnMocmVsYXRpb25zaGlwc1RhYmxlLCAoeyBvbmUgfSkgPT4ge1xuICAgICAgICBjb25zdCByZXN1bHQ6IFJlY29yZDxzdHJpbmcsIFJlbGF0aW9uPHN0cmluZz4+ID0ge1xuICAgICAgICAgIHBhcmVudDogb25lKHRhYmxlLCB7XG4gICAgICAgICAgICBmaWVsZHM6IFtyZWxhdGlvbnNoaXBzVGFibGUucGFyZW50XSxcbiAgICAgICAgICAgIHJlZmVyZW5jZXM6IFt0YWJsZS5pZF0sXG4gICAgICAgICAgICByZWxhdGlvbk5hbWU6ICdfcmVscycsXG4gICAgICAgICAgfSksXG4gICAgICAgIH1cblxuICAgICAgICByZWxhdGlvbnNoaXBzLmZvckVhY2goKHJlbGF0aW9uVG8pID0+IHtcbiAgICAgICAgICBjb25zdCByZWxhdGVkVGFibGVOYW1lID0gdG9TbmFrZUNhc2UocmVsYXRpb25UbylcbiAgICAgICAgICBjb25zdCBpZENvbHVtbk5hbWUgPSBgJHtyZWxhdGlvblRvfUlEYFxuICAgICAgICAgIHJlc3VsdFtpZENvbHVtbk5hbWVdID0gb25lKGFkYXB0ZXIudGFibGVzW3JlbGF0ZWR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YmxlKFxuICAgICAgICByZWxhdGlvbnNoaXBzVGFibGVOYW1lLFxuICAgICAgICByZWxhdGlvbnNoaXBDb2x1bW5zLFxuICAgICAgICAoY29scykgPT4ge1xuICAgICAgICAgIGNvbnN0IHJlc3VsdDogUmVjb3JkPHN0cmluZywgdW5rbm93bj4gPSB7XG4gICAgICAgICAgICBvcmRlcjogaW5kZXgoYCR7cmVsYXRpb25zaGlwc1RhYmxlTmFtZX1fb3JkZXJfaWR4YCkub24oY29scy5vcmRlciksXG4gICAgICAgICAgICBwYXJlbnRJZHg6IGluZGV4KGAke3JlbGF0aW9uc2hpcHNUYWJsZU5hbWV9X3BhcmVudF9pZHhgKS5vbihjb2xzLnBhcmVudCksXG4gICAgICAgICAgICBwYXRoSWR4OiBpbmRleChgJHtyZWxhdGlvbnNoaXBzVGFibGVOYW1lfV9wYXRoX2lkeGApLm9uKGNvbHMucGF0aCksXG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKGhhc0xvY2FsaXplZFJlbGF0aW9uc2hpcEZpZWxkKSB7XG4gICAgICAgICAgICByZXN1bHQubG9jYWxlSWR4ID0gaW5kZXgoYCR7cmVsYXRpb25zaGlwc1RhYmxlTmFtZX1fbG9jYWxlX2lkeGApLm9uKGNvbHMubG9jYWxlKVxuICAgICAgICAgIH1cblxuICAgICAgICAgIHJldHVybiByZXN1bHRcbiAgICAgICAgfSxcbiAgICAgIClcblxuICAgICAgYWRhcHRlci50YWJsZXNbcmVsYXRpb25zaGlwc1RhYmxlTmFtZV0gPSByZWxhdGlvbnNoaXBzVGFibGVcblxuICAgICAgY29uc3QgcmVsYXRpb25zaGlwc1RhYmxlUmVsYXRpb25zID0gcmVsYXRpb25zKHJlbGF0aW9uc2hpcHNUYWJsZSwgKHsgb25lIH0pID0+IHtcbiAgICAgICAgY29uc3QgcmVzdWx0OiBSZWNvcmQ8c3RyaW5nLCBSZWxhdGlvbjxzdHJpbmc+PiA9IHtcbiAgICAgICAgICBwYXJlbnQ6IG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lBQzdCNkQsTUFBTSxDQUFDN0QsSUFBSSxHQUFHc0UsS0FBSzlILFFBQVE0RCxNQUFNLENBQUNtRSxJQUFJO1FBQ3hDO1FBRUEsSUFBSTVHLG1CQUFtQjtZQUNyQmtHLE9BQU9XLFFBQVEsR0FBR0YsS0FBS25HO1FBQ3pCO1FBRUEsSUFBSU4sa0JBQWtCO1lBQ3BCZ0csT0FBT1ksTUFBTSxHQUFHSCxLQUFLbEc7UUFDdkI7UUFDQSxJQUFJTixvQkFBb0I7WUFDdEIrRixPQUFPYSxRQUFRLEdBQUdKLEtBQUtqRztRQUN6QjtRQUVBLElBQUlDLGNBQWNtRSxJQUFJLElBQUlqRSxvQkFBb0I7WUFDNUNxRixPQUFPYyxLQUFLLEdBQUdMLEtBQUs5RixvQkFBb0I7Z0JBQ3RDMEYsY0FBYztZQUNoQjtRQUNGO1FBRUEsT0FBT0w7SUFDVDtJQUVBckgsUUFBUTZFLFNBQVMsQ0FBQyxDQUFDLFVBQVUsRUFBRS9ELFVBQVUsQ0FBQyxDQUFDLEdBQUcrRztJQUU5QyxPQUFPO1FBQUV2RztRQUFvQkQ7UUFBa0JZO0lBQWlCO0FBQ2xFIn0=
@@ -0,0 +1,32 @@
1
+ import type { DBIdentifierName } from 'payload/database';
2
+ import type { PostgresAdapter } from '../types';
3
+ type Args = {
4
+ adapter: PostgresAdapter;
5
+ /** The collection, global or field config **/
6
+ config: {
7
+ dbName?: DBIdentifierName;
8
+ enumName?: DBIdentifierName;
9
+ name?: string;
10
+ slug?: string;
11
+ };
12
+ /** Localized tables need to be given the locales suffix */
13
+ locales?: boolean;
14
+ /** For nested tables passed for the user custom dbName functions to handle their own iterations */
15
+ parentTableName?: string;
16
+ /** For sub tables (array for example) this needs to include the parentTableName */
17
+ prefix?: string;
18
+ /** Adds the relationships suffix */
19
+ relationships?: boolean;
20
+ /** For tables based on fields that could have both enumName and dbName (ie: select with hasMany), default: 'dbName' */
21
+ target?: 'dbName' | 'enumName';
22
+ throwValidationError?: boolean;
23
+ /** Adds the versions suffix, should only be used on the base collection to duplicate suffixing */
24
+ versions?: boolean;
25
+ };
26
+ /**
27
+ * Used to name database enums and tables
28
+ * Returns the table or enum name for a given entity
29
+ */
30
+ export declare const getTableName: ({ adapter, config: { name, slug }, config, locales, parentTableName, prefix, relationships, target, throwValidationError, versions, }: Args) => string;
31
+ export {};
32
+ //# sourceMappingURL=getTableName.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTableName.d.ts","sourceRoot":"","sources":["../../src/schema/getTableName.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAKxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,eAAe,CAAA;IACxB,8CAA8C;IAC9C,MAAM,EAAE;QACN,MAAM,CAAC,EAAE,gBAAgB,CAAA;QACzB,QAAQ,CAAC,EAAE,gBAAgB,CAAA;QAC3B,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,IAAI,CAAC,EAAE,MAAM,CAAA;KACd,CAAA;IACD,2DAA2D;IAC3D,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,mGAAmG;IACnG,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,mFAAmF;IACnF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,oCAAoC;IACpC,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,uHAAuH;IACvH,MAAM,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;IAC9B,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,kGAAkG;IAClG,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,0IAWtB,IAAI,KAAG,MA4BT,CAAA"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "getTableName", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return getTableName;
9
+ }
10
+ });
11
+ const _errors = require("payload/errors");
12
+ const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
13
+ function _interop_require_default(obj) {
14
+ return obj && obj.__esModule ? obj : {
15
+ default: obj
16
+ };
17
+ }
18
+ const getTableName = ({ adapter, config: { name, slug }, config, locales = false, parentTableName, prefix = '', relationships = false, target = 'dbName', throwValidationError = false, versions = false })=>{
19
+ let result;
20
+ let custom = config[target];
21
+ if (!custom && target === 'enumName') {
22
+ custom = config['dbName'];
23
+ }
24
+ if (custom) {
25
+ result = typeof custom === 'function' ? custom({
26
+ tableName: parentTableName
27
+ }) : custom;
28
+ } else {
29
+ result = `${prefix}${(0, _tosnakecase.default)(name ?? slug)}`;
30
+ }
31
+ if (locales) result = `${result}${adapter.localesSuffix}`;
32
+ if (versions) result = `_${result}${adapter.versionsSuffix}`;
33
+ if (relationships) result = `${result}${adapter.relationshipsSuffix}`;
34
+ if (!throwValidationError) {
35
+ return result;
36
+ }
37
+ if (result.length > 63) {
38
+ throw new _errors.APIError(`Exceeded max identifier length for table or enum name of 63 characters. Invalid name: ${result}`);
39
+ }
40
+ return result;
41
+ };
42
+
43
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWEvZ2V0VGFibGVOYW1lLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgREJJZGVudGlmaWVyTmFtZSB9IGZyb20gJ3BheWxvYWQvZGF0YWJhc2UnXG5cbmltcG9ydCB7IEFQSUVycm9yIH0gZnJvbSAncGF5bG9hZC9lcnJvcnMnXG5pbXBvcnQgdG9TbmFrZUNhc2UgZnJvbSAndG8tc25ha2UtY2FzZSdcblxuaW1wb3J0IHR5cGUgeyBQb3N0Z3Jlc0FkYXB0ZXIgfSBmcm9tIC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sT0FBTyxDQUFDO0lBRXJHO0lBQ0EsT0FBT0E7QUFDVCJ9
@@ -23,6 +23,7 @@ type Args = {
23
23
  rootRelationsToBuild?: Map<string, string>;
24
24
  rootTableIDColType: string;
25
25
  rootTableName: string;
26
+ versions: boolean;
26
27
  };
27
28
  type Result = {
28
29
  hasLocalizedField: boolean;
@@ -32,6 +33,6 @@ type Result = {
32
33
  hasManyNumberField: 'index' | boolean;
33
34
  hasManyTextField: 'index' | boolean;
34
35
  };
35
- export declare const traverseFields: ({ adapter, buildNumbers, buildRelationships, buildTexts, columnPrefix, columns, disableNotNull, disableUnique, fieldPrefix, fields, forceLocalized, indexes, localesColumns, localesIndexes, newTableName, parentTableName, relationsToBuild, relationships, rootRelationsToBuild, rootTableIDColType, rootTableName, }: Args) => Result;
36
+ export declare const traverseFields: ({ adapter, buildNumbers, buildRelationships, buildTexts, columnPrefix, columns, disableNotNull, disableUnique, fieldPrefix, fields, forceLocalized, indexes, localesColumns, localesIndexes, newTableName, parentTableName, relationsToBuild, relationships, rootRelationsToBuild, rootTableIDColType, rootTableName, versions, }: Args) => Result;
36
37
  export {};
37
38
  //# sourceMappingURL=traverseFields.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"traverseFields.d.ts","sourceRoot":"","sources":["../../src/schema/traverseFields.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAA2B,MAAM,qBAAqB,CAAA;AACjG,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAqBtD,OAAO,KAAK,EAAE,cAAc,EAAU,eAAe,EAAE,MAAM,UAAU,CAAA;AASvE,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,eAAe,CAAA;IACxB,YAAY,EAAE,OAAO,CAAA;IACrB,kBAAkB,EAAE,OAAO,CAAA;IAC3B,UAAU,EAAE,OAAO,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,EAAE,MA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