@payloadcms/db-postgres 3.0.0-canary.67aae47 → 3.0.0-canary.6b9e4be
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.d.ts.map +1 -1
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js +69 -66
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js.map +1 -1
- package/dist/predefinedMigrations/v2-v3/traverseFields.js +32 -32
- package/dist/predefinedMigrations/v2-v3/traverseFields.js.map +1 -1
- package/license.md +22 -0
- package/package.json +12 -5
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"traverseFields.d.ts","sourceRoot":"","sources":["../../../../src/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAIpC,KAAK,IAAI,GAAG;IACV,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC5B,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;CAChC,CAAA;AAED,eAAO,MAAM,cAAc,wCAAyC,IAAI,
|
1
|
+
{"version":3,"file":"traverseFields.d.ts","sourceRoot":"","sources":["../../../../src/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAIpC,KAAK,IAAI,GAAG;IACV,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC5B,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;CAChC,CAAA;AAED,eAAO,MAAM,cAAc,wCAAyC,IAAI,SA6MvE,CAAA"}
|
@@ -2,42 +2,6 @@ import { tabHasName } from 'payload/shared';
|
|
2
2
|
export const traverseFields = ({ doc, fields, locale, path, rows })=>{
|
3
3
|
fields.forEach((field)=>{
|
4
4
|
switch(field.type){
|
5
|
-
case 'group':
|
6
|
-
{
|
7
|
-
const newPath = `${path ? `${path}.` : ''}${field.name}`;
|
8
|
-
const newDoc = doc?.[field.name];
|
9
|
-
if (typeof newDoc === 'object' && newDoc !== null) {
|
10
|
-
if (field.localized) {
|
11
|
-
Object.entries(newDoc).forEach(([locale, localeDoc])=>{
|
12
|
-
return traverseFields({
|
13
|
-
doc: localeDoc,
|
14
|
-
fields: field.fields,
|
15
|
-
locale,
|
16
|
-
path: newPath,
|
17
|
-
rows
|
18
|
-
});
|
19
|
-
});
|
20
|
-
} else {
|
21
|
-
return traverseFields({
|
22
|
-
doc: newDoc,
|
23
|
-
fields: field.fields,
|
24
|
-
path: newPath,
|
25
|
-
rows
|
26
|
-
});
|
27
|
-
}
|
28
|
-
}
|
29
|
-
break;
|
30
|
-
}
|
31
|
-
case 'row':
|
32
|
-
case 'collapsible':
|
33
|
-
{
|
34
|
-
return traverseFields({
|
35
|
-
doc,
|
36
|
-
fields: field.fields,
|
37
|
-
path,
|
38
|
-
rows
|
39
|
-
});
|
40
|
-
}
|
41
5
|
case 'array':
|
42
6
|
{
|
43
7
|
const rowData = doc?.[field.name];
|
@@ -104,43 +68,45 @@ export const traverseFields = ({ doc, fields, locale, path, rows })=>{
|
|
104
68
|
}
|
105
69
|
break;
|
106
70
|
}
|
107
|
-
case '
|
71
|
+
case 'collapsible':
|
72
|
+
// falls through
|
73
|
+
case 'row':
|
108
74
|
{
|
109
|
-
return
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
}
|
132
|
-
}
|
75
|
+
return traverseFields({
|
76
|
+
doc,
|
77
|
+
fields: field.fields,
|
78
|
+
path,
|
79
|
+
rows
|
80
|
+
});
|
81
|
+
}
|
82
|
+
case 'group':
|
83
|
+
{
|
84
|
+
const newPath = `${path ? `${path}.` : ''}${field.name}`;
|
85
|
+
const newDoc = doc?.[field.name];
|
86
|
+
if (typeof newDoc === 'object' && newDoc !== null) {
|
87
|
+
if (field.localized) {
|
88
|
+
Object.entries(newDoc).forEach(([locale, localeDoc])=>{
|
89
|
+
return traverseFields({
|
90
|
+
doc: localeDoc,
|
91
|
+
fields: field.fields,
|
92
|
+
locale,
|
93
|
+
path: newPath,
|
94
|
+
rows
|
95
|
+
});
|
96
|
+
});
|
133
97
|
} else {
|
134
|
-
traverseFields({
|
135
|
-
doc,
|
136
|
-
fields:
|
137
|
-
path,
|
98
|
+
return traverseFields({
|
99
|
+
doc: newDoc,
|
100
|
+
fields: field.fields,
|
101
|
+
path: newPath,
|
138
102
|
rows
|
139
103
|
});
|
140
104
|
}
|
141
|
-
}
|
105
|
+
}
|
106
|
+
break;
|
142
107
|
}
|
143
108
|
case 'relationship':
|
109
|
+
// falls through
|
144
110
|
case 'upload':
|
145
111
|
{
|
146
112
|
if (typeof field.relationTo === 'string') {
|
@@ -185,6 +151,43 @@ export const traverseFields = ({ doc, fields, locale, path, rows })=>{
|
|
185
151
|
}
|
186
152
|
}
|
187
153
|
}
|
154
|
+
break;
|
155
|
+
}
|
156
|
+
case 'tabs':
|
157
|
+
{
|
158
|
+
return field.tabs.forEach((tab)=>{
|
159
|
+
if (tabHasName(tab)) {
|
160
|
+
const newDoc = doc?.[tab.name];
|
161
|
+
const newPath = `${path ? `${path}.` : ''}${tab.name}`;
|
162
|
+
if (typeof newDoc === 'object' && newDoc !== null) {
|
163
|
+
if (tab.localized) {
|
164
|
+
Object.entries(newDoc).forEach(([locale, localeDoc])=>{
|
165
|
+
return traverseFields({
|
166
|
+
doc: localeDoc,
|
167
|
+
fields: tab.fields,
|
168
|
+
locale,
|
169
|
+
path: newPath,
|
170
|
+
rows
|
171
|
+
});
|
172
|
+
});
|
173
|
+
} else {
|
174
|
+
return traverseFields({
|
175
|
+
doc: newDoc,
|
176
|
+
fields: tab.fields,
|
177
|
+
path: newPath,
|
178
|
+
rows
|
179
|
+
});
|
180
|
+
}
|
181
|
+
}
|
182
|
+
} else {
|
183
|
+
traverseFields({
|
184
|
+
doc,
|
185
|
+
fields: tab.fields,
|
186
|
+
path,
|
187
|
+
rows
|
188
|
+
});
|
189
|
+
}
|
190
|
+
});
|
188
191
|
}
|
189
192
|
}
|
190
193
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../src/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.ts"],"sourcesContent":["import type { Field } from 'payload'\n\nimport { tabHasName } from 'payload/shared'\n\ntype Args = {\n doc: Record<string, unknown>\n fields: Field[]\n locale?: string\n path: string\n rows: Record<string, unknown>[]\n}\n\nexport const traverseFields = ({ doc, fields, locale, path, rows }: Args) => {\n fields.forEach((field) => {\n switch (field.type) {\n case 'group': {\n const newPath = `${path ? `${path}.` : ''}${field.name}`\n const newDoc = doc?.[field.name]\n\n if (typeof newDoc === 'object' && newDoc !== null) {\n if (field.localized) {\n Object.entries(newDoc).forEach(([locale, localeDoc]) => {\n return traverseFields({\n doc: localeDoc,\n fields: field.fields,\n locale,\n path: newPath,\n rows,\n })\n })\n } else {\n return traverseFields({\n doc: newDoc as Record<string, unknown>,\n fields: field.fields,\n path: newPath,\n rows,\n })\n }\n }\n\n break\n }\n\n case 'row':\n case 'collapsible': {\n return traverseFields({\n doc,\n fields: field.fields,\n path,\n rows,\n })\n }\n\n case 'array': {\n const rowData = doc?.[field.name]\n\n if (field.localized && typeof rowData === 'object' && rowData !== null) {\n Object.entries(rowData).forEach(([locale, localeRows]) => {\n if (Array.isArray(localeRows)) {\n localeRows.forEach((row, i) => {\n return traverseFields({\n doc: row as Record<string, unknown>,\n fields: field.fields,\n locale,\n path: `${path ? `${path}.` : ''}${field.name}.${i}`,\n rows,\n })\n })\n }\n })\n }\n\n if (Array.isArray(rowData)) {\n rowData.forEach((row, i) => {\n return traverseFields({\n doc: row as Record<string, unknown>,\n fields: field.fields,\n path: `${path ? `${path}.` : ''}${field.name}.${i}`,\n rows,\n })\n })\n }\n\n break\n }\n\n case 'blocks': {\n const rowData = doc?.[field.name]\n\n if (field.localized && typeof rowData === 'object' && rowData !== null) {\n Object.entries(rowData).forEach(([locale, localeRows]) => {\n if (Array.isArray(localeRows)) {\n localeRows.forEach((row, i) => {\n const matchedBlock = field.blocks.find((block) => block.slug === row.blockType)\n\n if (matchedBlock) {\n return traverseFields({\n doc: row as Record<string, unknown>,\n fields: matchedBlock.fields,\n locale,\n path: `${path ? `${path}.` : ''}${field.name}.${i}`,\n rows,\n })\n }\n })\n }\n })\n }\n\n if (Array.isArray(rowData)) {\n rowData.forEach((row, i) => {\n const matchedBlock = field.blocks.find((block) => block.slug === row.blockType)\n\n if (matchedBlock) {\n return traverseFields({\n doc: row as Record<string, unknown>,\n fields: matchedBlock.fields,\n path: `${path ? `${path}.` : ''}${field.name}.${i}`,\n rows,\n })\n }\n })\n }\n\n break\n }\n\n case 'tabs': {\n return field.tabs.forEach((tab) => {\n if (tabHasName(tab)) {\n const newDoc = doc?.[tab.name]\n const newPath = `${path ? `${path}.` : ''}${tab.name}`\n\n if (typeof newDoc === 'object' && newDoc !== null) {\n if (tab.localized) {\n Object.entries(newDoc).forEach(([locale, localeDoc]) => {\n return traverseFields({\n doc: localeDoc,\n fields: tab.fields,\n locale,\n path: newPath,\n rows,\n })\n })\n } else {\n return traverseFields({\n doc: newDoc as Record<string, unknown>,\n fields: tab.fields,\n path: newPath,\n rows,\n })\n }\n }\n } else {\n traverseFields({\n doc,\n fields: tab.fields,\n path,\n rows,\n })\n }\n })\n }\n\n case 'relationship':\n case 'upload': {\n if (typeof field.relationTo === 'string') {\n if (field.type === 'upload' || !field.hasMany) {\n const relationshipPath = `${path ? `${path}.` : ''}${field.name}`\n\n if (field.localized) {\n const matchedRelationshipsWithLocales = rows.filter(\n (row) => row.path === relationshipPath,\n )\n\n if (matchedRelationshipsWithLocales.length && !doc[field.name]) {\n doc[field.name] = {}\n }\n\n const newDoc = doc[field.name] as Record<string, unknown>\n\n matchedRelationshipsWithLocales.forEach((localeRow) => {\n if (typeof localeRow.locale === 'string') {\n const [, id] = Object.entries(localeRow).find(\n ([key, val]) =>\n val !== null && !['id', 'locale', 'order', 'parent_id', 'path'].includes(key),\n )\n\n newDoc[localeRow.locale] = id\n }\n })\n } else {\n const matchedRelationship = rows.find((row) => {\n const matchesPath = row.path === relationshipPath\n\n if (locale) {\n return matchesPath && locale === row.locale\n }\n\n return row.path === relationshipPath\n })\n\n if (matchedRelationship) {\n const [, id] = Object.entries(matchedRelationship).find(\n ([key, val]) =>\n val !== null && !['id', 'locale', 'order', 'parent_id', 'path'].includes(key),\n )\n\n doc[field.name] = id\n }\n }\n }\n }\n }\n }\n })\n}\n"],"names":["tabHasName","traverseFields","doc","fields","locale","path","rows","forEach","field","type","newPath","name","newDoc","localized","Object","entries","localeDoc","rowData","localeRows","Array","isArray","row","i","matchedBlock","blocks","find","block","slug","blockType","tabs","tab","relationTo","hasMany","relationshipPath","matchedRelationshipsWithLocales","filter","length","localeRow","id","key","val","includes","matchedRelationship","matchesPath"],"mappings":"AAEA,SAASA,UAAU,QAAQ,iBAAgB;AAU3C,OAAO,MAAMC,iBAAiB,CAAC,EAAEC,GAAG,EAAEC,MAAM,EAAEC,MAAM,EAAEC,IAAI,EAAEC,IAAI,EAAQ;IACtEH,OAAOI,OAAO,CAAC,CAACC;QACd,OAAQA,MAAMC,IAAI;YAChB,KAAK;gBAAS;oBACZ,MAAMC,UAAU,CAAC,EAAEL,OAAO,CAAC,EA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D,CAACd,MAAQA,IAAIhB,IAAI,KAAK4B;gCAGxB,IAAIC,gCAAgCE,MAAM,IAAI,CAAClC,GAAG,CAACM,MAAMG,IAAI,CAAC,EAAE;oCAC9DT,GAAG,CAACM,MAAMG,IAAI,CAAC,GAAG,CAAC;gCACrB;gCAEA,MAAMC,SAASV,GAAG,CAACM,MAAMG,IAAI,CAAC;gCAE9BuB,gCAAgC3B,OAAO,CAAC,CAAC8B;oCACvC,IAAI,OAAOA,UAAUjC,MAAM,KAAK,UAAU;wCACxC,MAAM,GAAGkC,GAAG,GAAGxB,OAAOC,OAAO,CAACsB,WAAWZ,IAAI,CAC3C,CAAC,CAACc,KAAKC,IAAI,GACTA,QAAQ,QAAQ,CAAC;gDAAC;gDAAM;gDAAU;gDAAS;gDAAa;6CAAO,CAACC,QAAQ,CAACF;wCAG7E3B,MAAM,CAACyB,UAAUjC,MAAM,CAAC,GAAGkC;oCAC7B;gCACF;4BACF,OAAO;gCACL,MAAMI,sBAAsBpC,KAAKmB,IAAI,CAAC,CAACJ;oCACrC,MAAMsB,cAActB,IAAIhB,IAAI,KAAK4B;oCAEjC,IAAI7B,QAAQ;wCACV,OAAOuC,eAAevC,WAAWiB,IAAIjB,MAAM;oCAC7C;oCAEA,OAAOiB,IAAIhB,IAAI,KAAK4B;gCACtB;gCAEA,IAAIS,qBAAqB;oCACvB,MAAM,GAAGJ,GAAG,GAAGxB,OAAOC,OAAO,CAAC2B,qBAAqBjB,IAAI,CACrD,CAAC,CAACc,KAAKC,IAAI,GACTA,QAAQ,QAAQ,CAAC;4CAAC;4CAAM;4CAAU;4CAAS;4CAAa;yCAAO,CAACC,QAAQ,CAACF;oCAG7ErC,GAAG,CAACM,MAAMG,IAAI,CAAC,GAAG2B;gCACpB;4BACF;wBACF;oBACF;gBACF;QACF;IACF;AACF,EAAC"}
|
1
|
+
{"version":3,"sources":["../../../../src/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.ts"],"sourcesContent":["import type { Field } from 'payload'\n\nimport { tabHasName } from 'payload/shared'\n\ntype Args = {\n doc: Record<string, unknown>\n fields: Field[]\n locale?: string\n path: string\n rows: Record<string, unknown>[]\n}\n\nexport const traverseFields = ({ doc, fields, locale, path, rows }: Args) => {\n fields.forEach((field) => {\n switch (field.type) {\n case 'array': {\n const rowData = doc?.[field.name]\n\n if (field.localized && typeof rowData === 'object' && rowData !== null) {\n Object.entries(rowData).forEach(([locale, localeRows]) => {\n if (Array.isArray(localeRows)) {\n localeRows.forEach((row, i) => {\n return traverseFields({\n doc: row as Record<string, unknown>,\n fields: field.fields,\n locale,\n path: `${path ? `${path}.` : ''}${field.name}.${i}`,\n rows,\n })\n })\n }\n })\n }\n\n if (Array.isArray(rowData)) {\n rowData.forEach((row, i) => {\n return traverseFields({\n doc: row as Record<string, unknown>,\n fields: field.fields,\n path: `${path ? `${path}.` : ''}${field.name}.${i}`,\n rows,\n })\n })\n }\n\n break\n }\n\n case 'blocks': {\n const rowData = doc?.[field.name]\n\n if (field.localized && typeof rowData === 'object' && rowData !== null) {\n Object.entries(rowData).forEach(([locale, localeRows]) => {\n if (Array.isArray(localeRows)) {\n localeRows.forEach((row, i) => {\n const matchedBlock = field.blocks.find((block) => block.slug === row.blockType)\n\n if (matchedBlock) {\n return traverseFields({\n doc: row as Record<string, unknown>,\n fields: matchedBlock.fields,\n locale,\n path: `${path ? `${path}.` : ''}${field.name}.${i}`,\n rows,\n })\n }\n })\n }\n })\n }\n\n if (Array.isArray(rowData)) {\n rowData.forEach((row, i) => {\n const matchedBlock = field.blocks.find((block) => block.slug === row.blockType)\n\n if (matchedBlock) {\n return traverseFields({\n doc: row as Record<string, unknown>,\n fields: matchedBlock.fields,\n path: `${path ? `${path}.` : ''}${field.name}.${i}`,\n rows,\n })\n }\n })\n }\n\n break\n }\n case 'collapsible':\n // falls through\n case 'row': {\n return traverseFields({\n doc,\n fields: field.fields,\n path,\n rows,\n })\n }\n\n case 'group': {\n const newPath = `${path ? `${path}.` : ''}${field.name}`\n const newDoc = doc?.[field.name]\n\n if (typeof newDoc === 'object' && newDoc !== null) {\n if (field.localized) {\n Object.entries(newDoc).forEach(([locale, localeDoc]) => {\n return traverseFields({\n doc: localeDoc,\n fields: field.fields,\n locale,\n path: newPath,\n rows,\n })\n })\n } else {\n return traverseFields({\n doc: newDoc as Record<string, unknown>,\n fields: field.fields,\n path: newPath,\n rows,\n })\n }\n }\n\n break\n }\n\n case 'relationship':\n // falls through\n case 'upload': {\n if (typeof field.relationTo === 'string') {\n if (field.type === 'upload' || !field.hasMany) {\n const relationshipPath = `${path ? `${path}.` : ''}${field.name}`\n\n if (field.localized) {\n const matchedRelationshipsWithLocales = rows.filter(\n (row) => row.path === relationshipPath,\n )\n\n if (matchedRelationshipsWithLocales.length && !doc[field.name]) {\n doc[field.name] = {}\n }\n\n const newDoc = doc[field.name] as Record<string, unknown>\n\n matchedRelationshipsWithLocales.forEach((localeRow) => {\n if (typeof localeRow.locale === 'string') {\n const [, id] = Object.entries(localeRow).find(\n ([key, val]) =>\n val !== null && !['id', 'locale', 'order', 'parent_id', 'path'].includes(key),\n )\n\n newDoc[localeRow.locale] = id\n }\n })\n } else {\n const matchedRelationship = rows.find((row) => {\n const matchesPath = row.path === relationshipPath\n\n if (locale) {\n return matchesPath && locale === row.locale\n }\n\n return row.path === relationshipPath\n })\n\n if (matchedRelationship) {\n const [, id] = Object.entries(matchedRelationship).find(\n ([key, val]) =>\n val !== null && !['id', 'locale', 'order', 'parent_id', 'path'].includes(key),\n )\n\n doc[field.name] = id\n }\n }\n }\n }\n break\n }\n case 'tabs': {\n return field.tabs.forEach((tab) => {\n if (tabHasName(tab)) {\n const newDoc = doc?.[tab.name]\n const newPath = `${path ? `${path}.` : ''}${tab.name}`\n\n if (typeof newDoc === 'object' && newDoc !== null) {\n if (tab.localized) {\n Object.entries(newDoc).forEach(([locale, localeDoc]) => {\n return traverseFields({\n doc: localeDoc,\n fields: tab.fields,\n locale,\n path: newPath,\n rows,\n })\n })\n } else {\n return traverseFields({\n doc: newDoc as Record<string, unknown>,\n fields: tab.fields,\n path: newPath,\n rows,\n })\n }\n }\n } else {\n traverseFields({\n doc,\n fields: tab.fields,\n path,\n rows,\n })\n }\n })\n }\n }\n })\n}\n"],"names":["tabHasName","traverseFields","doc","fields","locale","path","rows","forEach","field","type","rowData","name","localized","Object","entries","localeRows","Array","isArray","row","i","matchedBlock","blocks","find","block","slug","blockType","newPath","newDoc","localeDoc","relationTo","hasMany","relationshipPath","matchedRelationshipsWithLocales","filter","length","localeRow","id","key","val","includes","matchedRelationship","matchesPath","tabs","tab"],"mappings":"AAEA,SAASA,UAAU,QAAQ,iBAAgB;AAU3C,OAAO,MAAMC,iBAAiB,CAAC,EAAEC,GAAG,EAAEC,MAAM,EAAEC,MAAM,EAAEC,IAAI,EAAEC,IAAI,EAAQ;IACtEH,OAAOI,OAAO,CAAC,CAACC;QACd,OAAQA,MAAMC,IAAI;YAChB,KAAK;gBAAS;oBACZ,MAAMC,UAAUR,KAAK,CAACM,MAAMG,IAAI,CAAC;oBAEjC,IAAIH,MAAMI,SAAS,IAAI,OAAOF,YAAY,YAAYA,YAAY,MAAM;wBACtEG,OAAOC,OAAO,CAACJ,SAASH,OAAO,CAAC,CAAC,CAACH,QAAQW,WAAW;4BACnD,IAAIC,MAAMC,OAAO,CAACF,aAAa;gCAC7BA,WAAWR,OAAO,CAAC,CAACW,KAAKC;oCACvB,OAAOlB,eAAe;wCACpBC,KAAKgB;wCACLf,QAAQK,MAAML,MAAM;wCACpBC;wCACAC,MAAM,CAAC,EAAEA,OAAO,CAAC,EAAEA,KAAK,CAAC,CAAC,GAAG,GAAG,EAAEG,MAAMG,IAAI,CAAC,CAAC,EAAEQ,EAAE,CAAC;wCACnDb;oCACF;gCACF;4BACF;wBACF;oBACF;oBAEA,IAAIU,MAAMC,OAAO,CAACP,UAAU;wBAC1BA,QAAQH,OAAO,CAAC,CAACW,KAAKC;4BACpB,OAAOlB,eAAe;gCACpBC,KAAKgB;gCACLf,QAAQK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KAAK,CAAC,CAAC,GAAG,GAAG,EAAEsC,IAAIhC,IAAI,CAAC,CAAC;4BAEtD,IAAI,OAAOgB,WAAW,YAAYA,WAAW,MAAM;gCACjD,IAAIgB,IAAI/B,SAAS,EAAE;oCACjBC,OAAOC,OAAO,CAACa,QAAQpB,OAAO,CAAC,CAAC,CAACH,QAAQwB,UAAU;wCACjD,OAAO3B,eAAe;4CACpBC,KAAK0B;4CACLzB,QAAQwC,IAAIxC,MAAM;4CAClBC;4CACAC,MAAMqB;4CACNpB;wCACF;oCACF;gCACF,OAAO;oCACL,OAAOL,eAAe;wCACpBC,KAAKyB;wCACLxB,QAAQwC,IAAIxC,MAAM;wCAClBE,MAAMqB;wCACNpB;oCACF;gCACF;4BACF;wBACF,OAAO;4BACLL,eAAe;gCACbC;gCACAC,QAAQwC,IAAIxC,MAAM;gCAClBE;gCACAC;4BACF;wBACF;oBACF;gBACF;QACF;IACF;AACF,EAAC"}
|
@@ -3,28 +3,6 @@ import toSnakeCase from 'to-snake-case';
|
|
3
3
|
export const traverseFields = (args)=>{
|
4
4
|
args.fields.forEach((field)=>{
|
5
5
|
switch(field.type){
|
6
|
-
case 'group':
|
7
|
-
{
|
8
|
-
let newTableName = `${args.newTableName}_${toSnakeCase(field.name)}`;
|
9
|
-
if (field.localized && args.payload.config.localization) {
|
10
|
-
newTableName += args.adapter.localesSuffix;
|
11
|
-
}
|
12
|
-
return traverseFields({
|
13
|
-
...args,
|
14
|
-
columnPrefix: `${args.columnPrefix}${toSnakeCase(field.name)}_`,
|
15
|
-
fields: field.fields,
|
16
|
-
newTableName,
|
17
|
-
path: `${args.path ? `${args.path}.` : ''}${field.name}`
|
18
|
-
});
|
19
|
-
}
|
20
|
-
case 'row':
|
21
|
-
case 'collapsible':
|
22
|
-
{
|
23
|
-
return traverseFields({
|
24
|
-
...args,
|
25
|
-
fields: field.fields
|
26
|
-
});
|
27
|
-
}
|
28
6
|
case 'array':
|
29
7
|
{
|
30
8
|
const newTableName = args.adapter.tableNameMap.get(`${args.newTableName}_${toSnakeCase(field.name)}`);
|
@@ -51,6 +29,38 @@ export const traverseFields = (args)=>{
|
|
51
29
|
});
|
52
30
|
});
|
53
31
|
}
|
32
|
+
case 'collapsible':
|
33
|
+
case 'row':
|
34
|
+
{
|
35
|
+
return traverseFields({
|
36
|
+
...args,
|
37
|
+
fields: field.fields
|
38
|
+
});
|
39
|
+
}
|
40
|
+
case 'group':
|
41
|
+
{
|
42
|
+
let newTableName = `${args.newTableName}_${toSnakeCase(field.name)}`;
|
43
|
+
if (field.localized && args.payload.config.localization) {
|
44
|
+
newTableName += args.adapter.localesSuffix;
|
45
|
+
}
|
46
|
+
return traverseFields({
|
47
|
+
...args,
|
48
|
+
columnPrefix: `${args.columnPrefix}${toSnakeCase(field.name)}_`,
|
49
|
+
fields: field.fields,
|
50
|
+
newTableName,
|
51
|
+
path: `${args.path ? `${args.path}.` : ''}${field.name}`
|
52
|
+
});
|
53
|
+
}
|
54
|
+
case 'relationship':
|
55
|
+
case 'upload':
|
56
|
+
{
|
57
|
+
if (typeof field.relationTo === 'string') {
|
58
|
+
if (field.type === 'upload' || !field.hasMany) {
|
59
|
+
args.pathsToQuery.add(`${args.path ? `${args.path}.` : ''}${field.name}`);
|
60
|
+
}
|
61
|
+
}
|
62
|
+
return null;
|
63
|
+
}
|
54
64
|
case 'tabs':
|
55
65
|
{
|
56
66
|
return field.tabs.forEach((tab)=>{
|
@@ -68,16 +78,6 @@ export const traverseFields = (args)=>{
|
|
68
78
|
});
|
69
79
|
});
|
70
80
|
}
|
71
|
-
case 'relationship':
|
72
|
-
case 'upload':
|
73
|
-
{
|
74
|
-
if (typeof field.relationTo === 'string') {
|
75
|
-
if (field.type === 'upload' || !field.hasMany) {
|
76
|
-
args.pathsToQuery.add(`${args.path ? `${args.path}.` : ''}${field.name}`);
|
77
|
-
}
|
78
|
-
}
|
79
|
-
return null;
|
80
|
-
}
|
81
81
|
}
|
82
82
|
});
|
83
83
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/predefinedMigrations/v2-v3/traverseFields.ts"],"sourcesContent":["import type { TransactionPg } from '@payloadcms/drizzle/types'\nimport type { Field, Payload } from 'payload'\n\nimport { tabHasName } from 'payload/shared'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { PostgresAdapter } from '../../types.js'\nimport type { PathsToQuery } from './types.js'\n\ntype Args = {\n adapter: PostgresAdapter\n collectionSlug?: string\n columnPrefix: string\n db: TransactionPg\n disableNotNull: boolean\n fields: Field[]\n globalSlug?: string\n isVersions: boolean\n newTableName: string\n parentTableName: string\n path: string\n pathsToQuery: PathsToQuery\n payload: Payload\n rootTableName: string\n}\n\nexport const traverseFields = (args: Args) => {\n args.fields.forEach((field) => {\n switch (field.type) {\n case '
|
1
|
+
{"version":3,"sources":["../../../src/predefinedMigrations/v2-v3/traverseFields.ts"],"sourcesContent":["import type { TransactionPg } from '@payloadcms/drizzle/types'\nimport type { Field, Payload } from 'payload'\n\nimport { tabHasName } from 'payload/shared'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { PostgresAdapter } from '../../types.js'\nimport type { PathsToQuery } from './types.js'\n\ntype Args = {\n adapter: PostgresAdapter\n collectionSlug?: string\n columnPrefix: string\n db: TransactionPg\n disableNotNull: boolean\n fields: Field[]\n globalSlug?: string\n isVersions: boolean\n newTableName: string\n parentTableName: string\n path: string\n pathsToQuery: PathsToQuery\n payload: Payload\n rootTableName: string\n}\n\nexport const traverseFields = (args: Args) => {\n args.fields.forEach((field) => {\n switch (field.type) {\n case 'array': {\n const newTableName = args.adapter.tableNameMap.get(\n `${args.newTableName}_${toSnakeCase(field.name)}`,\n )\n\n return traverseFields({\n ...args,\n columnPrefix: '',\n fields: field.fields,\n newTableName,\n parentTableName: newTableName,\n path: `${args.path ? `${args.path}.` : ''}${field.name}.%`,\n })\n }\n\n case 'blocks': {\n return field.blocks.forEach((block) => {\n const newTableName = args.adapter.tableNameMap.get(\n `${args.rootTableName}_blocks_${toSnakeCase(block.slug)}`,\n )\n\n traverseFields({\n ...args,\n columnPrefix: '',\n fields: block.fields,\n newTableName,\n parentTableName: newTableName,\n path: `${args.path ? `${args.path}.` : ''}${field.name}.%`,\n })\n })\n }\n case 'collapsible':\n\n case 'row': {\n return traverseFields({\n ...args,\n fields: field.fields,\n })\n }\n\n case 'group': {\n let newTableName = `${args.newTableName}_${toSnakeCase(field.name)}`\n\n if (field.localized && args.payload.config.localization) {\n newTableName += args.adapter.localesSuffix\n }\n\n return traverseFields({\n ...args,\n columnPrefix: `${args.columnPrefix}${toSnakeCase(field.name)}_`,\n fields: field.fields,\n newTableName,\n path: `${args.path ? `${args.path}.` : ''}${field.name}`,\n })\n }\n\n case 'relationship':\n\n case 'upload': {\n if (typeof field.relationTo === 'string') {\n if (field.type === 'upload' || !field.hasMany) {\n args.pathsToQuery.add(`${args.path ? `${args.path}.` : ''}${field.name}`)\n }\n }\n\n return null\n }\n case 'tabs': {\n return field.tabs.forEach((tab) => {\n if (tabHasName(tab)) {\n args.columnPrefix = `${args.columnPrefix}_${toSnakeCase(tab.name)}_`\n args.path = `${args.path ? `${args.path}.` : ''}${tab.name}`\n args.newTableName = `${args.newTableName}_${toSnakeCase(tab.name)}`\n\n if (tab.localized && args.payload.config.localization) {\n args.newTableName += args.adapter.localesSuffix\n }\n }\n\n traverseFields({\n ...args,\n fields: tab.fields,\n })\n })\n }\n }\n })\n}\n"],"names":["tabHasName","toSnakeCase","traverseFields","args","fields","forEach","field","type","newTableName","adapter","tableNameMap","get","name","columnPrefix","parentTableName","path","blocks","block","rootTableName","slug","localized","payload","config","localization","localesSuffix","relationTo","hasMany","pathsToQuery","add","tabs","tab"],"mappings":"AAGA,SAASA,UAAU,QAAQ,iBAAgB;AAC3C,OAAOC,iBAAiB,gBAAe;AAsBvC,OAAO,MAAMC,iBAAiB,CAACC;IAC7BA,KAAKC,MAAM,CAACC,OAAO,CAAC,CAACC;QACnB,OAAQA,MAAMC,IAAI;YAChB,KAAK;gBA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AACC,YAAY,EAAE;gCACrDpB,KAAKK,YAAY,IAAIL,KAAKM,OAAO,CAACe,aAAa;4BACjD;wBACF;wBAEAtB,eAAe;4BACb,GAAGC,IAAI;4BACPC,QAAQ0B,IAAI1B,MAAM;wBACpB;oBACF;gBACF;QACF;IACF;AACF,EAAC"}
|
package/license.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2018-2024 Payload CMS, Inc. <info@payloadcms.com>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
'Software'), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@payloadcms/db-postgres",
|
3
|
-
"version": "3.0.0-canary.
|
3
|
+
"version": "3.0.0-canary.6b9e4be",
|
4
4
|
"description": "The officially supported Postgres database adapter for Payload",
|
5
5
|
"homepage": "https://payloadcms.com",
|
6
6
|
"repository": {
|
@@ -10,6 +10,13 @@
|
|
10
10
|
},
|
11
11
|
"license": "MIT",
|
12
12
|
"author": "Payload <dev@payloadcms.com> (https://payloadcms.com)",
|
13
|
+
"maintainers": [
|
14
|
+
{
|
15
|
+
"name": "Payload",
|
16
|
+
"email": "info@payloadcms.com",
|
17
|
+
"url": "https://payloadcms.com"
|
18
|
+
}
|
19
|
+
],
|
13
20
|
"type": "module",
|
14
21
|
"exports": {
|
15
22
|
".": {
|
@@ -43,17 +50,17 @@
|
|
43
50
|
"prompts": "2.4.2",
|
44
51
|
"to-snake-case": "1.0.0",
|
45
52
|
"uuid": "10.0.0",
|
46
|
-
"@payloadcms/drizzle": "3.0.0-canary.
|
53
|
+
"@payloadcms/drizzle": "3.0.0-canary.6b9e4be"
|
47
54
|
},
|
48
55
|
"devDependencies": {
|
49
56
|
"@hyrious/esbuild-plugin-commonjs": "^0.2.4",
|
50
57
|
"@types/to-snake-case": "1.0.0",
|
51
58
|
"esbuild": "0.23.1",
|
52
|
-
"
|
53
|
-
"
|
59
|
+
"payload": "3.0.0-canary.6b9e4be",
|
60
|
+
"@payloadcms/eslint-config": "3.0.0-beta.112"
|
54
61
|
},
|
55
62
|
"peerDependencies": {
|
56
|
-
"payload": "3.0.0-canary.
|
63
|
+
"payload": "3.0.0-canary.6b9e4be"
|
57
64
|
},
|
58
65
|
"scripts": {
|
59
66
|
"build": "rimraf .dist && rimraf tsconfig.tsbuildinfo && pnpm build:types && pnpm build:swc && pnpm build:esbuild && pnpm renamePredefinedMigrations",
|