@payloadcms/drizzle 3.0.0-canary.cb7fa00 → 3.0.0-canary.cdb9474

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/dist/exports/postgres.d.ts +14 -0
  2. package/dist/exports/postgres.d.ts.map +1 -0
  3. package/dist/exports/postgres.js +15 -0
  4. package/dist/exports/postgres.js.map +1 -0
  5. package/dist/find/traverseFields.d.ts.map +1 -1
  6. package/dist/find/traverseFields.js +2 -2
  7. package/dist/find/traverseFields.js.map +1 -1
  8. package/dist/postgres/countDistinct.d.ts +3 -0
  9. package/dist/postgres/countDistinct.d.ts.map +1 -0
  10. package/dist/postgres/countDistinct.js +24 -0
  11. package/dist/postgres/countDistinct.js.map +1 -0
  12. package/dist/postgres/createJSONQuery/convertPathToJSONTraversal.d.ts +2 -0
  13. package/dist/postgres/createJSONQuery/convertPathToJSONTraversal.d.ts.map +1 -0
  14. package/dist/postgres/createJSONQuery/convertPathToJSONTraversal.js +14 -0
  15. package/dist/postgres/createJSONQuery/convertPathToJSONTraversal.js.map +1 -0
  16. package/dist/postgres/createJSONQuery/formatJSONPathSegment.d.ts +2 -0
  17. package/dist/postgres/createJSONQuery/formatJSONPathSegment.d.ts.map +1 -0
  18. package/dist/postgres/createJSONQuery/formatJSONPathSegment.js +5 -0
  19. package/dist/postgres/createJSONQuery/formatJSONPathSegment.js.map +1 -0
  20. package/dist/postgres/createJSONQuery/index.d.ts +10 -0
  21. package/dist/postgres/createJSONQuery/index.d.ts.map +1 -0
  22. package/dist/postgres/createJSONQuery/index.js +54 -0
  23. package/dist/postgres/createJSONQuery/index.js.map +1 -0
  24. package/dist/postgres/createMigration.d.ts +3 -0
  25. package/dist/postgres/createMigration.d.ts.map +1 -0
  26. package/dist/postgres/createMigration.js +92 -0
  27. package/dist/postgres/createMigration.js.map +1 -0
  28. package/dist/postgres/defaultSnapshot.d.ts +3 -0
  29. package/dist/postgres/defaultSnapshot.d.ts.map +1 -0
  30. package/dist/postgres/defaultSnapshot.js +17 -0
  31. package/dist/postgres/defaultSnapshot.js.map +1 -0
  32. package/dist/postgres/deleteWhere.d.ts +3 -0
  33. package/dist/postgres/deleteWhere.d.ts.map +1 -0
  34. package/dist/postgres/deleteWhere.js +6 -0
  35. package/dist/postgres/deleteWhere.js.map +1 -0
  36. package/dist/postgres/dropDatabase.d.ts +3 -0
  37. package/dist/postgres/dropDatabase.d.ts.map +1 -0
  38. package/dist/postgres/dropDatabase.js +9 -0
  39. package/dist/postgres/dropDatabase.js.map +1 -0
  40. package/dist/postgres/execute.d.ts +3 -0
  41. package/dist/postgres/execute.d.ts.map +1 -0
  42. package/dist/postgres/execute.js +11 -0
  43. package/dist/postgres/execute.js.map +1 -0
  44. package/dist/postgres/getMigrationTemplate.d.ts +4 -0
  45. package/dist/postgres/getMigrationTemplate.d.ts.map +1 -0
  46. package/dist/postgres/getMigrationTemplate.js +13 -0
  47. package/dist/postgres/getMigrationTemplate.js.map +1 -0
  48. package/dist/postgres/init.d.ts +3 -0
  49. package/dist/postgres/init.d.ts.map +1 -0
  50. package/dist/postgres/init.js +95 -0
  51. package/dist/postgres/init.js.map +1 -0
  52. package/dist/postgres/insert.d.ts +3 -0
  53. package/dist/postgres/insert.d.ts.map +1 -0
  54. package/dist/postgres/insert.js +12 -0
  55. package/dist/postgres/insert.js.map +1 -0
  56. package/dist/postgres/requireDrizzleKit.d.ts +3 -0
  57. package/dist/postgres/requireDrizzleKit.d.ts.map +1 -0
  58. package/dist/postgres/requireDrizzleKit.js +5 -0
  59. package/dist/postgres/requireDrizzleKit.js.map +1 -0
  60. package/dist/postgres/schema/build.d.ts +40 -0
  61. package/dist/postgres/schema/build.d.ts.map +1 -0
  62. package/dist/postgres/schema/build.js +373 -0
  63. package/dist/postgres/schema/build.js.map +1 -0
  64. package/dist/postgres/schema/createIndex.d.ts +12 -0
  65. package/dist/postgres/schema/createIndex.d.ts.map +1 -0
  66. package/dist/postgres/schema/createIndex.js +18 -0
  67. package/dist/postgres/schema/createIndex.js.map +1 -0
  68. package/dist/postgres/schema/idToUUID.d.ts +3 -0
  69. package/dist/postgres/schema/idToUUID.d.ts.map +1 -0
  70. package/dist/postgres/schema/idToUUID.js +11 -0
  71. package/dist/postgres/schema/idToUUID.js.map +1 -0
  72. package/dist/postgres/schema/parentIDColumnMap.d.ts +4 -0
  73. package/dist/postgres/schema/parentIDColumnMap.d.ts.map +1 -0
  74. package/dist/postgres/schema/parentIDColumnMap.js +9 -0
  75. package/dist/postgres/schema/parentIDColumnMap.js.map +1 -0
  76. package/dist/postgres/schema/setColumnID.d.ts +11 -0
  77. package/dist/postgres/schema/setColumnID.d.ts.map +1 -0
  78. package/dist/postgres/schema/setColumnID.js +24 -0
  79. package/dist/postgres/schema/setColumnID.js.map +1 -0
  80. package/dist/postgres/schema/traverseFields.d.ts +40 -0
  81. package/dist/postgres/schema/traverseFields.d.ts.map +1 -0
  82. package/dist/postgres/schema/traverseFields.js +644 -0
  83. package/dist/postgres/schema/traverseFields.js.map +1 -0
  84. package/dist/postgres/schema/withDefault.d.ts +4 -0
  85. package/dist/postgres/schema/withDefault.d.ts.map +1 -0
  86. package/dist/postgres/schema/withDefault.js +10 -0
  87. package/dist/postgres/schema/withDefault.js.map +1 -0
  88. package/dist/postgres/types.d.ts +112 -0
  89. package/dist/postgres/types.d.ts.map +1 -0
  90. package/dist/postgres/types.js +3 -0
  91. package/dist/postgres/types.js.map +1 -0
  92. package/dist/queries/getTableColumnFromPath.js +1 -1
  93. package/dist/queries/getTableColumnFromPath.js.map +1 -1
  94. package/dist/transform/read/hasManyNumber.d.ts +2 -1
  95. package/dist/transform/read/hasManyNumber.d.ts.map +1 -1
  96. package/dist/transform/read/hasManyNumber.js +12 -2
  97. package/dist/transform/read/hasManyNumber.js.map +1 -1
  98. package/dist/transform/read/hasManyText.d.ts +2 -1
  99. package/dist/transform/read/hasManyText.d.ts.map +1 -1
  100. package/dist/transform/read/hasManyText.js +12 -2
  101. package/dist/transform/read/hasManyText.js.map +1 -1
  102. package/dist/transform/read/relationship.d.ts +2 -1
  103. package/dist/transform/read/relationship.d.ts.map +1 -1
  104. package/dist/transform/read/relationship.js +15 -6
  105. package/dist/transform/read/relationship.js.map +1 -1
  106. package/dist/transform/read/traverseFields.d.ts +5 -1
  107. package/dist/transform/read/traverseFields.d.ts.map +1 -1
  108. package/dist/transform/read/traverseFields.js +45 -27
  109. package/dist/transform/read/traverseFields.js.map +1 -1
  110. package/dist/transform/write/array.d.ts +6 -1
  111. package/dist/transform/write/array.d.ts.map +1 -1
  112. package/dist/transform/write/array.js +7 -3
  113. package/dist/transform/write/array.js.map +1 -1
  114. package/dist/transform/write/blocks.d.ts +6 -1
  115. package/dist/transform/write/blocks.d.ts.map +1 -1
  116. package/dist/transform/write/blocks.js +5 -3
  117. package/dist/transform/write/blocks.js.map +1 -1
  118. package/dist/transform/write/traverseFields.d.ts +6 -1
  119. package/dist/transform/write/traverseFields.d.ts.map +1 -1
  120. package/dist/transform/write/traverseFields.js +26 -12
  121. package/dist/transform/write/traverseFields.js.map +1 -1
  122. package/dist/upsertRow/index.d.ts.map +1 -1
  123. package/dist/upsertRow/index.js +35 -7
  124. package/dist/upsertRow/index.js.map +1 -1
  125. package/package.json +13 -6
@@ -1,17 +1,22 @@
1
- /* eslint-disable no-param-reassign */ export const transformRelationship = ({ field, locale, ref, relations })=>{
1
+ export const transformRelationship = ({ field, locale, ref, relations, withinArrayOrBlockLocale })=>{
2
2
  let result;
3
3
  if (!('hasMany' in field) || field.hasMany === false) {
4
- const relation = relations[0];
4
+ let relation = relations[0];
5
+ if (withinArrayOrBlockLocale) {
6
+ relation = relations.find((rel)=>rel.locale === withinArrayOrBlockLocale);
7
+ }
5
8
  if (relation) {
6
9
  // Handle hasOne Poly
7
10
  if (Array.isArray(field.relationTo)) {
8
- const matchedRelation = Object.entries(relation).find(([key, val])=>val !== null && ![
11
+ const matchedRelation = Object.entries(relation).find(([key, val])=>{
12
+ return val !== null && ![
9
13
  'id',
10
14
  'locale',
11
15
  'order',
12
16
  'parent',
13
17
  'path'
14
- ].includes(key));
18
+ ].includes(key);
19
+ });
15
20
  if (matchedRelation) {
16
21
  const relationTo = matchedRelation[0].replace('ID', '');
17
22
  result = {
@@ -24,10 +29,14 @@
24
29
  } else {
25
30
  const transformedRelations = [];
26
31
  relations.forEach((relation)=>{
32
+ let matchedLocale = true;
33
+ if (withinArrayOrBlockLocale) {
34
+ matchedLocale = relation.locale === withinArrayOrBlockLocale;
35
+ }
27
36
  // Handle hasMany
28
37
  if (!Array.isArray(field.relationTo)) {
29
38
  const relatedData = relation[`${field.relationTo}ID`];
30
- if (relatedData) {
39
+ if (relatedData && matchedLocale) {
31
40
  transformedRelations.push(relatedData);
32
41
  }
33
42
  } else {
@@ -38,7 +47,7 @@
38
47
  'order',
39
48
  'parent',
40
49
  'path'
41
- ].includes(key));
50
+ ].includes(key) && matchedLocale);
42
51
  if (matchedRelation) {
43
52
  const relationTo = matchedRelation[0].replace('ID', '');
44
53
  transformedRelations.push({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/transform/read/relationship.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport type { RelationshipField, UploadField } from 'payload'\n\ntype Args = {\n field: RelationshipField | UploadField\n locale?: string\n ref: Record<string, unknown>\n relations: Record<string, unknown>[]\n}\n\nexport const transformRelationship = ({ field, locale, ref, relations }: Args) => {\n let result: unknown\n\n if (!('hasMany' in field) || field.hasMany === false) {\n const relation = relations[0]\n\n if (relation) {\n // Handle hasOne Poly\n if (Array.isArray(field.relationTo)) {\n const matchedRelation = Object.entries(relation).find(\n ([key, val]) =>\n val !== null && !['id', 'locale', 'order', 'parent', 'path'].includes(key),\n )\n\n if (matchedRelation) {\n const relationTo = matchedRelation[0].replace('ID', '')\n\n result = {\n relationTo,\n value: matchedRelation[1],\n }\n }\n }\n }\n } else {\n const transformedRelations = []\n\n relations.forEach((relation) => {\n // Handle hasMany\n if (!Array.isArray(field.relationTo)) {\n const relatedData = relation[`${field.relationTo}ID`]\n\n if (relatedData) {\n transformedRelations.push(relatedData)\n }\n } else {\n // Handle hasMany Poly\n const matchedRelation = Object.entries(relation).find(\n ([key, val]) =>\n val !== null && !['id', 'locale', 'order', 'parent', 'path'].includes(key),\n )\n\n if (matchedRelation) {\n const relationTo = matchedRelation[0].replace('ID', '')\n\n transformedRelations.push({\n relationTo,\n value: matchedRelation[1],\n })\n }\n }\n })\n\n result = transformedRelations\n }\n\n if (locale) {\n ref[field.name][locale] = result\n } else {\n ref[field.name] = result\n }\n}\n"],"names":["transformRelationship","field","locale","ref","relations","result","hasMany","relation","Array","isArray","relationTo","matchedRelation","Object","entries","find","key","val","includes","replace","value","transformedRelations","forEach","relatedData","push","name"],"mappings":"AAAA,oCAAoC,GAUpC,OAAO,MAAMA,wBAAwB,CAAC,EAAEC,KAAK,EAAEC,MAAM,EAAEC,GAAG,EAAEC,SAAS,EAAQ;IAC3E,IAAIC;IAEJ,IAAI,CAAE,CAAA,aAAaJ,KAAI,KAAMA,MAAMK,OAAO,KAAK,OAAO;QACpD,MAAMC,WAAWH,SAAS,CAAC,EAAE;QAE7B,IAAIG,UAAU;YACZ,qBAAqB;YACrB,IAAIC,MAAMC,OAAO,CAACR,MAAMS,UAAU,GAAG;gBACnC,MAAMC,kBAAkBC,OAAOC,OAAO,CAACN,UAAUO,IAAI,CACnD,CAAC,CAACC,KAAKC,IAAI,GACTA,QAAQ,QAAQ,CAAC;wBAAC;wBAAM;wBAAU;wBAAS;wBAAU;qBAAO,CAACC,QAAQ,CAACF;gBAG1E,IAAIJ,iBAAiB;oBACnB,MAAMD,aAAaC,eAAe,CAAC,EAAE,CAACO,OAAO,CAAC,MAAM;oBAEpDb,SAAS;wBACPK;wBACAS,OAAOR,eAAe,CAAC,EAAE;oBAC3B;gBACF;YACF;QACF;IACF,OAAO;QACL,MAAMS,uBAAuB,EAAE;QAE/BhB,UAAUiB,OAAO,CAAC,CAACd;YACjB,iBAAiB;YACjB,IAAI,CAACC,MAAMC,OAAO,CAACR,MAAMS,UAAU,GAAG;gBACpC,MAAMY,cAAcf,QAAQ,CAAC,CAAC,EAAEN,MAAMS,UAAU,CAAC,EAAE,CAAC,CAAC;gBAErD,IAAIY,aAAa;oBACfF,qBAAqBG,IAAI,CAACD;gBAC5B;YACF,OAAO;gBACL,sBAAsB;gBACtB,MAAMX,kBAAkBC,OAAOC,OAAO,CAACN,UAAUO,IAAI,CACnD,CAAC,CAACC,KAAKC,IAAI,GACTA,QAAQ,QAAQ,CAAC;wBAAC;wBAAM;wBAAU;wBAAS;wBAAU;qBAAO,CAACC,QAAQ,CAACF;gBAG1E,IAAIJ,iBAAiB;oBACnB,MAAMD,aAAaC,eAAe,CAAC,EAAE,CAACO,OAAO,CAAC,MAAM;oBAEpDE,qBAAqBG,IAAI,CAAC;wBACxBb;wBACAS,OAAOR,eAAe,CAAC,EAAE;oBAC3B;gBACF;YACF;QACF;QAEAN,SAASe;IACX;IAEA,IAAIlB,QAAQ;QACVC,GAAG,CAACF,MAAMuB,IAAI,CAAC,CAACtB,OAAO,GAAGG;IAC5B,OAAO;QACLF,GAAG,CAACF,MAAMuB,IAAI,CAAC,GAAGnB;IACpB;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/transform/read/relationship.ts"],"sourcesContent":["import type { RelationshipField, UploadField } from 'payload'\n\ntype Args = {\n field: RelationshipField | UploadField\n locale?: string\n ref: Record<string, unknown>\n relations: Record<string, unknown>[]\n withinArrayOrBlockLocale?: string\n}\n\nexport const transformRelationship = ({\n field,\n locale,\n ref,\n relations,\n withinArrayOrBlockLocale,\n}: Args) => {\n let result: unknown\n\n if (!('hasMany' in field) || field.hasMany === false) {\n let relation = relations[0]\n\n if (withinArrayOrBlockLocale) {\n relation = relations.find((rel) => rel.locale === withinArrayOrBlockLocale)\n }\n\n if (relation) {\n // Handle hasOne Poly\n if (Array.isArray(field.relationTo)) {\n const matchedRelation = Object.entries(relation).find(([key, val]) => {\n return val !== null && !['id', 'locale', 'order', 'parent', 'path'].includes(key)\n })\n\n if (matchedRelation) {\n const relationTo = matchedRelation[0].replace('ID', '')\n\n result = {\n relationTo,\n value: matchedRelation[1],\n }\n }\n }\n }\n } else {\n const transformedRelations = []\n\n relations.forEach((relation) => {\n let matchedLocale = true\n\n if (withinArrayOrBlockLocale) {\n matchedLocale = relation.locale === withinArrayOrBlockLocale\n }\n\n // Handle hasMany\n if (!Array.isArray(field.relationTo)) {\n const relatedData = relation[`${field.relationTo}ID`]\n\n if (relatedData && matchedLocale) {\n transformedRelations.push(relatedData)\n }\n } else {\n // Handle hasMany Poly\n const matchedRelation = Object.entries(relation).find(\n ([key, val]) =>\n val !== null &&\n !['id', 'locale', 'order', 'parent', 'path'].includes(key) &&\n matchedLocale,\n )\n\n if (matchedRelation) {\n const relationTo = matchedRelation[0].replace('ID', '')\n\n transformedRelations.push({\n relationTo,\n value: matchedRelation[1],\n })\n }\n }\n })\n\n result = transformedRelations\n }\n\n if (locale) {\n ref[field.name][locale] = result\n } else {\n ref[field.name] = result\n }\n}\n"],"names":["transformRelationship","field","locale","ref","relations","withinArrayOrBlockLocale","result","hasMany","relation","find","rel","Array","isArray","relationTo","matchedRelation","Object","entries","key","val","includes","replace","value","transformedRelations","forEach","matchedLocale","relatedData","push","name"],"mappings":"AAUA,OAAO,MAAMA,wBAAwB,CAAC,EACpCC,KAAK,EACLC,MAAM,EACNC,GAAG,EACHC,SAAS,EACTC,wBAAwB,EACnB;IACL,IAAIC;IAEJ,IAAI,CAAE,CAAA,aAAaL,KAAI,KAAMA,MAAMM,OAAO,KAAK,OAAO;QACpD,IAAIC,WAAWJ,SAAS,CAAC,EAAE;QAE3B,IAAIC,0BAA0B;YAC5BG,WAAWJ,UAAUK,IAAI,CAAC,CAACC,MAAQA,IAAIR,MAAM,KAAKG;QACpD;QAEA,IAAIG,UAAU;YACZ,qBAAqB;YACrB,IAAIG,MAAMC,OAAO,CAACX,MAAMY,UAAU,GAAG;gBACnC,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,GAAGI;IAC5B,OAAO;QACLH,GAAG,CAACF,MAAM0B,IAAI,CAAC,GAAGrB;IACpB;AACF,EAAC"}
@@ -50,7 +50,11 @@ type TraverseFieldsArgs = {
50
50
  * All hasMany text fields, as returned by Drizzle, keyed on an object by field path
51
51
  */
52
52
  texts: Record<string, Record<string, unknown>[]>;
53
+ /**
54
+ * Set to a locale if this group of fields is within a localized array or block.
55
+ */
56
+ withinArrayOrBlockLocale?: string;
53
57
  };
54
- export declare const traverseFields: <T extends Record<string, unknown>>({ adapter, blocks, config, dataRef, deletions, fieldPrefix, fields, numbers, path, relationships, table, texts, }: TraverseFieldsArgs) => T;
58
+ export declare const traverseFields: <T extends Record<string, unknown>>({ adapter, blocks, config, dataRef, deletions, fieldPrefix, fields, numbers, path, relationships, table, texts, withinArrayOrBlockLocale, }: TraverseFieldsArgs) => T;
55
59
  export {};
56
60
  //# sourceMappingURL=traverseFields.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"traverseFields.d.ts","sourceRoot":"","sources":["../../../src/transform/read/traverseFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAIjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAA;AAMnE,KAAK,kBAAkB,GAAG;IACxB;;OAEG;IACH,OAAO,EAAE,cAAc,CAAA;IACvB;;OAEG;IACH,MAAM,EAAE,SAAS,CAAA;IACjB;;OAEG;IACH,MAAM,EAAE,eAAe,CAAA;IACvB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC;;OAEG;IACH,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,CAAA;IACzB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,MAAM,EAAE,CA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;IACH,MAAM,EAAE,CAAC,KAAK,GAAG,UAAU,CAAC,EAAE,CAAA;IAC9B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAAA;IAClD;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAAA;IACxD;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAAA;IAChD;;OAEG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAA;CAClC,CAAA;AAID,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,+IAc7D,kBAAkB,KAAG,CAwevB,CAAA"}
@@ -4,7 +4,7 @@ import { transformHasManyText } from './hasManyText.js';
4
4
  import { transformRelationship } from './relationship.js';
5
5
  // Traverse fields recursively, transforming data
6
6
  // for each field type into required Payload shape
7
- export const traverseFields = ({ adapter, blocks, config, dataRef, deletions, fieldPrefix, fields, numbers, path, relationships, table, texts })=>{
7
+ export const traverseFields = ({ adapter, blocks, config, dataRef, deletions, fieldPrefix, fields, numbers, path, relationships, table, texts, withinArrayOrBlockLocale })=>{
8
8
  const sanitizedPath = path ? `${path}.` : path;
9
9
  const formatted = fields.reduce((result, field)=>{
10
10
  if (field.type === 'tabs') {
@@ -23,7 +23,8 @@ export const traverseFields = ({ adapter, blocks, config, dataRef, deletions, fi
23
23
  path,
24
24
  relationships,
25
25
  table,
26
- texts
26
+ texts,
27
+ withinArrayOrBlockLocale
27
28
  });
28
29
  }
29
30
  if (field.type === 'collapsible' || field.type === 'row' || field.type === 'tab' && !('name' in field)) {
@@ -39,7 +40,8 @@ export const traverseFields = ({ adapter, blocks, config, dataRef, deletions, fi
39
40
  path,
40
41
  relationships,
41
42
  table,
42
- texts
43
+ texts,
44
+ withinArrayOrBlockLocale
43
45
  });
44
46
  }
45
47
  if (fieldAffectsData(field)) {
@@ -75,7 +77,8 @@ export const traverseFields = ({ adapter, blocks, config, dataRef, deletions, fi
75
77
  path: `${sanitizedPath}${field.name}.${row._order - 1}`,
76
78
  relationships,
77
79
  table: row,
78
- texts
80
+ texts,
81
+ withinArrayOrBlockLocale: locale
79
82
  });
80
83
  if ('_order' in rowResult) {
81
84
  delete rowResult._order;
@@ -105,7 +108,8 @@ export const traverseFields = ({ adapter, blocks, config, dataRef, deletions, fi
105
108
  path: `${sanitizedPath}${field.name}.${i}`,
106
109
  relationships,
107
110
  table: row,
108
- texts
111
+ texts,
112
+ withinArrayOrBlockLocale
109
113
  });
110
114
  });
111
115
  }
@@ -144,7 +148,8 @@ export const traverseFields = ({ adapter, blocks, config, dataRef, deletions, fi
144
148
  path: `${blockFieldPath}.${row._order - 1}`,
145
149
  relationships,
146
150
  table: row,
147
- texts
151
+ texts,
152
+ withinArrayOrBlockLocale: locale
148
153
  });
149
154
  delete blockResult._order;
150
155
  return blockResult;
@@ -153,7 +158,7 @@ export const traverseFields = ({ adapter, blocks, config, dataRef, deletions, fi
153
158
  });
154
159
  });
155
160
  } else {
156
- result[field.name] = blocks[blockFieldPath].map((row, i)=>{
161
+ result[field.name] = blocks[blockFieldPath].reduce((acc, row, i)=>{
157
162
  delete row._order;
158
163
  if (row._uuid) {
159
164
  row.id = row._uuid;
@@ -161,23 +166,32 @@ export const traverseFields = ({ adapter, blocks, config, dataRef, deletions, fi
161
166
  }
162
167
  const block = field.blocks.find(({ slug })=>slug === row.blockType);
163
168
  if (block) {
164
- return traverseFields({
165
- adapter,
166
- blocks,
167
- config,
168
- dataRef: row,
169
- deletions,
170
- fieldPrefix: '',
171
- fields: block.fields,
172
- numbers,
173
- path: `${blockFieldPath}.${i}`,
174
- relationships,
175
- table: row,
176
- texts
177
- });
169
+ if (!withinArrayOrBlockLocale || withinArrayOrBlockLocale && withinArrayOrBlockLocale === row._locale) {
170
+ if (row._locale) {
171
+ delete row._locale;
172
+ }
173
+ acc.push(traverseFields({
174
+ adapter,
175
+ blocks,
176
+ config,
177
+ dataRef: row,
178
+ deletions,
179
+ fieldPrefix: '',
180
+ fields: block.fields,
181
+ numbers,
182
+ path: `${blockFieldPath}.${i}`,
183
+ relationships,
184
+ table: row,
185
+ texts,
186
+ withinArrayOrBlockLocale
187
+ }));
188
+ return acc;
189
+ }
190
+ } else {
191
+ acc.push({});
178
192
  }
179
- return {};
180
- });
193
+ return acc;
194
+ }, []);
181
195
  }
182
196
  }
183
197
  return result;
@@ -231,7 +245,8 @@ export const traverseFields = ({ adapter, blocks, config, dataRef, deletions, fi
231
245
  transformRelationship({
232
246
  field,
233
247
  ref: result,
234
- relations: relationPathMatch
248
+ relations: relationPathMatch,
249
+ withinArrayOrBlockLocale
235
250
  });
236
251
  }
237
252
  return result;
@@ -261,7 +276,8 @@ export const traverseFields = ({ adapter, blocks, config, dataRef, deletions, fi
261
276
  transformHasManyText({
262
277
  field,
263
278
  ref: result,
264
- textRows: textPathMatch
279
+ textRows: textPathMatch,
280
+ withinArrayOrBlockLocale
265
281
  });
266
282
  }
267
283
  return result;
@@ -290,7 +306,8 @@ export const traverseFields = ({ adapter, blocks, config, dataRef, deletions, fi
290
306
  transformHasManyNumber({
291
307
  field,
292
308
  numberRows: numberPathMatch,
293
- ref: result
309
+ ref: result,
310
+ withinArrayOrBlockLocale
294
311
  });
295
312
  }
296
313
  return result;
@@ -351,7 +368,8 @@ export const traverseFields = ({ adapter, blocks, config, dataRef, deletions, fi
351
368
  path: `${sanitizedPath}${field.name}`,
352
369
  relationships,
353
370
  table,
354
- texts
371
+ texts,
372
+ withinArrayOrBlockLocale
355
373
  });
356
374
  if ('_order' in ref) {
357
375
  delete ref._order;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/transform/read/traverseFields.ts"],"sourcesContent":["import type { Field, SanitizedConfig, TabAsField } from 'payload'\n\nimport { fieldAffectsData } from 'payload/shared'\n\nimport type { DrizzleAdapter } from '../../types.js'\nimport type { BlocksMap } from '../../utilities/createBlocksMap.js'\n\nimport { transformHasManyNumber } from './hasManyNumber.js'\nimport { transformHasManyText } from './hasManyText.js'\nimport { transformRelationship } from './relationship.js'\n\ntype TraverseFieldsArgs = {\n /**\n * The DB adapter\n */\n adapter: DrizzleAdapter\n /**\n * Pre-formatted blocks map\n */\n blocks: BlocksMap\n /**\n * The full Payload config\n */\n config: SanitizedConfig\n /**\n * The data reference to be mutated within this recursive function\n */\n dataRef: Record<string, unknown>\n /**\n * Data that needs to be removed from the result after all fields have populated\n */\n deletions: (() => void)[]\n /**\n * Column prefix can be built up by group and named tab fields\n */\n fieldPrefix: string\n /**\n * An array of Payload fields to traverse\n */\n fields: (Field | TabAsField)[]\n /**\n * All hasMany number fields, as returned by Drizzle, keyed on an object by field path\n */\n numbers: Record<string, Record<string, unknown>[]>\n /**\n * The current field path (in dot notation), used to merge in relationships\n */\n path: string\n /**\n * All related documents, as returned by Drizzle, keyed on an object by field path\n */\n relationships: Record<string, Record<string, unknown>[]>\n /**\n * Data structure representing the nearest table from db\n */\n table: Record<string, unknown>\n /**\n * All hasMany text fields, as returned by Drizzle, keyed on an object by field path\n */\n texts: Record<string, Record<string, unknown>[]>\n}\n\n// Traverse fields recursively, transforming data\n// for each field type into required Payload shape\nexport const traverseFields = <T extends Record<string, unknown>>({\n adapter,\n blocks,\n config,\n dataRef,\n deletions,\n fieldPrefix,\n fields,\n numbers,\n path,\n relationships,\n table,\n texts,\n}: TraverseFieldsArgs): T => {\n const sanitizedPath = path ? `${path}.` : path\n\n const formatted = fields.reduce((result, field) => {\n if (field.type === 'tabs') {\n traverseFields({\n adapter,\n blocks,\n config,\n dataRef,\n deletions,\n fieldPrefix,\n fields: field.tabs.map((tab) => ({ ...tab, type: 'tab' })),\n numbers,\n path,\n relationships,\n table,\n texts,\n })\n }\n\n if (\n field.type === 'collapsible' ||\n field.type === 'row' ||\n (field.type === 'tab' && !('name' in field))\n ) {\n traverseFields({\n adapter,\n blocks,\n config,\n dataRef,\n deletions,\n fieldPrefix,\n fields: field.fields,\n numbers,\n path,\n relationships,\n table,\n texts,\n })\n }\n\n if (fieldAffectsData(field)) {\n const fieldName = `${fieldPrefix || ''}${field.name}`\n const fieldData = table[fieldName]\n const localizedFieldData = {}\n const valuesToTransform: {\n ref: Record<string, unknown>\n table: Record<string, unknown>\n }[] = []\n\n if (fieldPrefix) {\n deletions.push(() => delete table[fieldName])\n }\n\n if (field.type === 'array') {\n if (Array.isArray(fieldData)) {\n if (field.localized) {\n result[field.name] = fieldData.reduce((arrayResult, row) => {\n if (typeof row._locale === 'string') {\n if (!arrayResult[row._locale]) arrayResult[row._locale] = []\n const locale = row._locale\n const data = {}\n delete row._locale\n if (row._uuid) {\n row.id = row._uuid\n delete row._uuid\n }\n\n const rowResult = traverseFields<T>({\n adapter,\n blocks,\n config,\n dataRef: data,\n deletions,\n fieldPrefix: '',\n fields: field.fields,\n numbers,\n path: `${sanitizedPath}${field.name}.${row._order - 1}`,\n relationships,\n table: row,\n texts,\n })\n\n if ('_order' in rowResult) {\n delete rowResult._order\n }\n\n arrayResult[locale].push(rowResult)\n }\n\n return arrayResult\n }, {})\n } else {\n result[field.name] = fieldData.map((row, i) => {\n if (row._uuid) {\n row.id = row._uuid\n delete row._uuid\n }\n\n if ('_order' in row) {\n delete row._order\n }\n\n return traverseFields<T>({\n adapter,\n blocks,\n config,\n dataRef: row,\n deletions,\n fieldPrefix: '',\n fields: field.fields,\n numbers,\n path: `${sanitizedPath}${field.name}.${i}`,\n relationships,\n table: row,\n texts,\n })\n })\n }\n }\n\n return result\n }\n\n if (field.type === 'blocks') {\n const blockFieldPath = `${sanitizedPath}${field.name}`\n\n if (Array.isArray(blocks[blockFieldPath])) {\n if (field.localized) {\n result[field.name] = {}\n\n blocks[blockFieldPath].forEach((row) => {\n if (row._uuid) {\n row.id = row._uuid\n delete row._uuid\n }\n if (typeof row._locale === 'string') {\n if (!result[field.name][row._locale]) result[field.name][row._locale] = []\n result[field.name][row._locale].push(row)\n delete row._locale\n }\n })\n\n Object.entries(result[field.name]).forEach(([locale, localizedBlocks]) => {\n result[field.name][locale] = localizedBlocks.map((row) => {\n const block = field.blocks.find(({ slug }) => slug === row.blockType)\n\n if (block) {\n const blockResult = traverseFields<T>({\n adapter,\n blocks,\n config,\n dataRef: row,\n deletions,\n fieldPrefix: '',\n fields: block.fields,\n numbers,\n path: `${blockFieldPath}.${row._order - 1}`,\n relationships,\n table: row,\n texts,\n })\n\n delete blockResult._order\n return blockResult\n }\n\n return {}\n })\n })\n } else {\n result[field.name] = blocks[blockFieldPath].map((row, i) => {\n delete row._order\n if (row._uuid) {\n row.id = row._uuid\n delete row._uuid\n }\n const block = field.blocks.find(({ slug }) => slug === row.blockType)\n\n if (block) {\n return traverseFields<T>({\n adapter,\n blocks,\n config,\n dataRef: row,\n deletions,\n fieldPrefix: '',\n fields: block.fields,\n numbers,\n path: `${blockFieldPath}.${i}`,\n relationships,\n table: row,\n texts,\n })\n }\n\n return {}\n })\n }\n }\n\n return result\n }\n\n if (field.type === 'relationship' || field.type === 'upload') {\n if (typeof field.relationTo === 'string' && !('hasMany' in field && field.hasMany)) {\n if (\n field.localized &&\n config.localization &&\n config.localization.locales &&\n Array.isArray(table?._locales)\n ) {\n table._locales.forEach((localeRow) => {\n result[field.name] = { [localeRow._locale]: localeRow[fieldName] }\n })\n } else {\n valuesToTransform.push({ ref: result, table })\n }\n } else {\n const relationPathMatch = relationships[`${sanitizedPath}${field.name}`]\n if (!relationPathMatch) {\n if ('hasMany' in field && field.hasMany) {\n if (field.localized && config.localization && config.localization.locales) {\n result[field.name] = {\n [config.localization.defaultLocale]: [],\n }\n } else {\n result[field.name] = []\n }\n }\n\n return result\n }\n\n if (field.localized) {\n result[field.name] = {}\n const relationsByLocale: Record<string, Record<string, unknown>[]> = {}\n\n relationPathMatch.forEach((row) => {\n if (typeof row.locale === 'string') {\n if (!relationsByLocale[row.locale]) relationsByLocale[row.locale] = []\n relationsByLocale[row.locale].push(row)\n }\n })\n\n Object.entries(relationsByLocale).forEach(([locale, relations]) => {\n transformRelationship({\n field,\n locale,\n ref: result,\n relations,\n })\n })\n } else {\n transformRelationship({\n field,\n ref: result,\n relations: relationPathMatch,\n })\n }\n return result\n }\n }\n\n if (field.type === 'text' && field?.hasMany) {\n const textPathMatch = texts[`${sanitizedPath}${field.name}`]\n if (!textPathMatch) return result\n\n if (field.localized) {\n result[field.name] = {}\n const textsByLocale: Record<string, Record<string, unknown>[]> = {}\n\n textPathMatch.forEach((row) => {\n if (typeof row.locale === 'string') {\n if (!textsByLocale[row.locale]) textsByLocale[row.locale] = []\n textsByLocale[row.locale].push(row)\n }\n })\n\n Object.entries(textsByLocale).forEach(([locale, texts]) => {\n transformHasManyText({\n field,\n locale,\n ref: result,\n textRows: texts,\n })\n })\n } else {\n transformHasManyText({\n field,\n ref: result,\n textRows: textPathMatch,\n })\n }\n\n return result\n }\n\n if (field.type === 'number' && field.hasMany) {\n const numberPathMatch = numbers[`${sanitizedPath}${field.name}`]\n if (!numberPathMatch) return result\n\n if (field.localized) {\n result[field.name] = {}\n const numbersByLocale: Record<string, Record<string, unknown>[]> = {}\n\n numberPathMatch.forEach((row) => {\n if (typeof row.locale === 'string') {\n if (!numbersByLocale[row.locale]) numbersByLocale[row.locale] = []\n numbersByLocale[row.locale].push(row)\n }\n })\n\n Object.entries(numbersByLocale).forEach(([locale, numbers]) => {\n transformHasManyNumber({\n field,\n locale,\n numberRows: numbers,\n ref: result,\n })\n })\n } else {\n transformHasManyNumber({\n field,\n numberRows: numberPathMatch,\n ref: result,\n })\n }\n\n return result\n }\n\n if (field.type === 'select' && field.hasMany) {\n if (Array.isArray(fieldData)) {\n if (field.localized) {\n result[field.name] = fieldData.reduce((selectResult, row) => {\n if (typeof row.locale === 'string') {\n if (!selectResult[row.locale]) selectResult[row.locale] = []\n selectResult[row.locale].push(row.value)\n }\n\n return selectResult\n }, {})\n } else {\n result[field.name] = fieldData.map(({ value }) => value)\n }\n }\n return result\n }\n\n if (field.localized && Array.isArray(table._locales)) {\n table._locales.forEach((localeRow) => {\n valuesToTransform.push({\n ref: localizedFieldData,\n table: {\n ...localeRow,\n },\n })\n })\n } else {\n valuesToTransform.push({ ref: result, table })\n }\n\n valuesToTransform.forEach(({ ref, table }) => {\n const fieldData = table[`${fieldPrefix || ''}${field.name}`]\n const locale = table?._locale\n let val = fieldData\n\n switch (field.type) {\n case 'tab':\n case 'group': {\n const groupFieldPrefix = `${fieldPrefix || ''}${field.name}_`\n const groupData = {}\n const locale = table._locale as string\n const refKey = field.localized && locale ? locale : field.name\n\n if (field.localized && locale) delete table._locale\n ref[refKey] = traverseFields<Record<string, unknown>>({\n adapter,\n blocks,\n config,\n dataRef: groupData as Record<string, unknown>,\n deletions,\n fieldPrefix: groupFieldPrefix,\n fields: field.fields,\n numbers,\n path: `${sanitizedPath}${field.name}`,\n relationships,\n table,\n texts,\n })\n\n if ('_order' in ref) {\n delete ref._order\n }\n\n return\n }\n\n case 'text': {\n if (typeof fieldData === 'string') {\n val = String(fieldData)\n }\n\n break\n }\n\n case 'number': {\n if (typeof fieldData === 'string') {\n val = Number.parseFloat(fieldData)\n }\n\n break\n }\n\n case 'date': {\n if (typeof fieldData === 'string') {\n val = new Date(fieldData).toISOString()\n }\n\n break\n }\n\n case 'relationship':\n case 'upload': {\n if (\n val &&\n typeof field.relationTo === 'string' &&\n adapter.payload.collections[field.relationTo].customIDType === 'number'\n ) {\n val = Number(val)\n }\n\n break\n }\n\n default: {\n break\n }\n }\n if (typeof locale === 'string') {\n ref[locale] = val\n } else {\n result[field.name] = val\n }\n })\n\n if (Object.keys(localizedFieldData).length > 0) {\n result[field.name] = localizedFieldData\n }\n\n return result\n }\n\n return result\n }, dataRef)\n\n if (Array.isArray(table._locales)) {\n deletions.push(() => delete table._locales)\n }\n\n return formatted as T\n}\n"],"names":["fieldAffectsData","transformHasManyNumber","transformHasManyText","transformRelationship","traverseFields","adapter","blocks","config","dataRef","deletions","fieldPrefix","fields","numbers","path","relationships","table","texts","sanitizedPath","formatted","reduce","result","field","type","tabs","map","tab","fieldName","name","fieldData","localizedFieldData","valuesToTransform","push","Array","isArray","localized","arrayResult","row","_locale","locale","data","_uuid","id","rowResult","_order","i","blockFieldPath","forEach","Object","entries","localizedBlocks","block","find","slug","blockType","blockResult","relationTo","hasMany","localization","locales","_locales","localeRow","ref","relationPathMatch","defaultLocale","relationsByLocale","relations","textPathMatch","textsByLocale","textRows","numberPathMatch","numbersByLocale","numberRows","selectResult","value","val","groupFieldPrefix","groupData","refKey","String","Number","parseFloat","Date","toISOString","payload","collections","customIDType","keys","length"],"mappings":"AAEA,SAASA,gBAAgB,QAAQ,iBAAgB;AAKjD,SAASC,sBAAsB,QAAQ,qBAAoB;AAC3D,SAASC,oBAAoB,QAAQ,mBAAkB;AACvD,SAASC,qBAAqB,QAAQ,oBAAmB;AAqDzD,iDAAiD;AACjD,kDAAkD;AAClD,OAAO,MAAMC,iBAAiB,CAAoC,EAChEC,OAAO,EACPC,MAAM,EACNC,MAAM,EACNC,OAAO,EACPC,SAAS,EACTC,WAAW,EACXC,MAAM,EACNC,OAAO,EACPC,IAAI,EACJC,aAAa,EACbC,KAAK,EACLC,KAAK,EACc;IACnB,MAAMC,gBAAgBJ,OAAO,CAAC,EAAEA,KAAK,CAAC,CAAC,GAAGA;IAE1C,MAAMK,YAAYP,OAAOQ,MAAM,CAAC,CAACC,QAAQC;QACvC,IAAIA,MAAMC,IAAI,KAAK,QAAQ;YACzBlB,eAAe;gBACbC;gBACAC;gBACAC;gBACAC;gBACAC;gBACAC;gBACAC,QAAQU,MAAME,IAAI,CAACC,GAAG,CAAC,CAACC,MAAS,CAAA;wBAAE,GAAGA,GAAG;wBAAEH,MAAM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gCACAX,MAAMK,OAAOL;4BACf;4BAEA;wBACF;oBAEA;wBAAS;4BACP;wBACF;gBACF;gBACA,IAAI,OAAOpC,WAAW,UAAU;oBAC9BuB,GAAG,CAACvB,OAAO,GAAGoC;gBAChB,OAAO;oBACLtD,MAAM,CAACC,MAAMM,IAAI,CAAC,GAAG+C;gBACvB;YACF;YAEA,IAAI3B,OAAOuC,IAAI,CAACzD,oBAAoB0D,MAAM,GAAG,GAAG;gBAC9CnE,MAAM,CAACC,MAAMM,IAAI,CAAC,GAAGE;YACvB;YAEA,OAAOT;QACT;QAEA,OAAOA;IACT,GAAGZ;IAEH,IAAIwB,MAAMC,OAAO,CAAClB,MAAM4C,QAAQ,GAAG;QACjClD,UAAUsB,IAAI,CAAC,IAAM,OAAOhB,MAAM4C,QAAQ;IAC5C;IAEA,OAAOzC;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../src/transform/read/traverseFields.ts"],"sourcesContent":["import type { Field, SanitizedConfig, TabAsField } from 'payload'\n\nimport { fieldAffectsData } from 'payload/shared'\n\nimport type { DrizzleAdapter } from '../../types.js'\nimport type { BlocksMap } from '../../utilities/createBlocksMap.js'\n\nimport { transformHasManyNumber } from './hasManyNumber.js'\nimport { transformHasManyText } from './hasManyText.js'\nimport { transformRelationship } from './relationship.js'\n\ntype TraverseFieldsArgs = {\n /**\n * The DB adapter\n */\n adapter: DrizzleAdapter\n /**\n * Pre-formatted blocks map\n */\n blocks: BlocksMap\n /**\n * The full Payload config\n */\n config: SanitizedConfig\n /**\n * The data reference to be mutated within this recursive function\n */\n dataRef: Record<string, unknown>\n /**\n * Data that needs to be removed from the result after all fields have populated\n */\n deletions: (() => void)[]\n /**\n * Column prefix can be built up by group and named tab fields\n */\n fieldPrefix: string\n /**\n * An array of Payload fields to traverse\n */\n fields: (Field | TabAsField)[]\n /**\n * All hasMany number fields, as returned by Drizzle, keyed on an object by field path\n */\n numbers: Record<string, Record<string, unknown>[]>\n /**\n * The current field path (in dot notation), used to merge in relationships\n */\n path: string\n /**\n * All related documents, as returned by Drizzle, keyed on an object by field path\n */\n relationships: Record<string, Record<string, unknown>[]>\n /**\n * Data structure representing the nearest table from db\n */\n table: Record<string, unknown>\n /**\n * All hasMany text fields, as returned by Drizzle, keyed on an object by field path\n */\n texts: Record<string, Record<string, unknown>[]>\n /**\n * Set to a locale if this group of fields is within a localized array or block.\n */\n withinArrayOrBlockLocale?: string\n}\n\n// Traverse fields recursively, transforming data\n// for each field type into required Payload shape\nexport const traverseFields = <T extends Record<string, unknown>>({\n adapter,\n blocks,\n config,\n dataRef,\n deletions,\n fieldPrefix,\n fields,\n numbers,\n path,\n relationships,\n table,\n texts,\n withinArrayOrBlockLocale,\n}: TraverseFieldsArgs): T => {\n const sanitizedPath = path ? `${path}.` : path\n\n const formatted = fields.reduce((result, field) => {\n if (field.type === 'tabs') {\n traverseFields({\n adapter,\n blocks,\n config,\n dataRef,\n deletions,\n fieldPrefix,\n fields: field.tabs.map((tab) => ({ ...tab, type: 'tab' })),\n numbers,\n path,\n relationships,\n table,\n texts,\n withinArrayOrBlockLocale,\n })\n }\n\n if (\n field.type === 'collapsible' ||\n field.type === 'row' ||\n (field.type === 'tab' && !('name' in field))\n ) {\n traverseFields({\n adapter,\n blocks,\n config,\n dataRef,\n deletions,\n fieldPrefix,\n fields: field.fields,\n numbers,\n path,\n relationships,\n table,\n texts,\n withinArrayOrBlockLocale,\n })\n }\n\n if (fieldAffectsData(field)) {\n const fieldName = `${fieldPrefix || ''}${field.name}`\n const fieldData = table[fieldName]\n const localizedFieldData = {}\n const valuesToTransform: {\n ref: Record<string, unknown>\n table: Record<string, unknown>\n }[] = []\n\n if (fieldPrefix) {\n deletions.push(() => delete table[fieldName])\n }\n\n if (field.type === 'array') {\n if (Array.isArray(fieldData)) {\n if (field.localized) {\n result[field.name] = fieldData.reduce((arrayResult, row) => {\n if (typeof row._locale === 'string') {\n if (!arrayResult[row._locale]) arrayResult[row._locale] = []\n const locale = row._locale\n const data = {}\n delete row._locale\n if (row._uuid) {\n row.id = row._uuid\n delete row._uuid\n }\n\n const rowResult = traverseFields<T>({\n adapter,\n blocks,\n config,\n dataRef: data,\n deletions,\n fieldPrefix: '',\n fields: field.fields,\n numbers,\n path: `${sanitizedPath}${field.name}.${row._order - 1}`,\n relationships,\n table: row,\n texts,\n withinArrayOrBlockLocale: locale,\n })\n\n if ('_order' in rowResult) {\n delete rowResult._order\n }\n\n arrayResult[locale].push(rowResult)\n }\n\n return arrayResult\n }, {})\n } else {\n result[field.name] = fieldData.map((row, i) => {\n if (row._uuid) {\n row.id = row._uuid\n delete row._uuid\n }\n\n if ('_order' in row) {\n delete row._order\n }\n\n return traverseFields<T>({\n adapter,\n blocks,\n config,\n dataRef: row,\n deletions,\n fieldPrefix: '',\n fields: field.fields,\n numbers,\n path: `${sanitizedPath}${field.name}.${i}`,\n relationships,\n table: row,\n texts,\n withinArrayOrBlockLocale,\n })\n })\n }\n }\n\n return result\n }\n\n if (field.type === 'blocks') {\n const blockFieldPath = `${sanitizedPath}${field.name}`\n\n if (Array.isArray(blocks[blockFieldPath])) {\n if (field.localized) {\n result[field.name] = {}\n\n blocks[blockFieldPath].forEach((row) => {\n if (row._uuid) {\n row.id = row._uuid\n delete row._uuid\n }\n if (typeof row._locale === 'string') {\n if (!result[field.name][row._locale]) result[field.name][row._locale] = []\n result[field.name][row._locale].push(row)\n delete row._locale\n }\n })\n\n Object.entries(result[field.name]).forEach(([locale, localizedBlocks]) => {\n result[field.name][locale] = localizedBlocks.map((row) => {\n const block = field.blocks.find(({ slug }) => slug === row.blockType)\n\n if (block) {\n const blockResult = traverseFields<T>({\n adapter,\n blocks,\n config,\n dataRef: row,\n deletions,\n fieldPrefix: '',\n fields: block.fields,\n numbers,\n path: `${blockFieldPath}.${row._order - 1}`,\n relationships,\n table: row,\n texts,\n withinArrayOrBlockLocale: locale,\n })\n\n delete blockResult._order\n return blockResult\n }\n\n return {}\n })\n })\n } else {\n result[field.name] = blocks[blockFieldPath].reduce((acc, row, i) => {\n delete row._order\n if (row._uuid) {\n row.id = row._uuid\n delete row._uuid\n }\n const block = field.blocks.find(({ slug }) => slug === row.blockType)\n\n if (block) {\n if (\n !withinArrayOrBlockLocale ||\n (withinArrayOrBlockLocale && withinArrayOrBlockLocale === row._locale)\n ) {\n if (row._locale) {\n delete row._locale\n }\n\n acc.push(\n traverseFields<T>({\n adapter,\n blocks,\n config,\n dataRef: row,\n deletions,\n fieldPrefix: '',\n fields: block.fields,\n numbers,\n path: `${blockFieldPath}.${i}`,\n relationships,\n table: row,\n texts,\n withinArrayOrBlockLocale,\n }),\n )\n\n return acc\n }\n } else {\n acc.push({})\n }\n\n return acc\n }, [])\n }\n }\n\n return result\n }\n\n if (field.type === 'relationship' || field.type === 'upload') {\n if (typeof field.relationTo === 'string' && !('hasMany' in field && field.hasMany)) {\n if (\n field.localized &&\n config.localization &&\n config.localization.locales &&\n Array.isArray(table?._locales)\n ) {\n table._locales.forEach((localeRow) => {\n result[field.name] = { [localeRow._locale]: localeRow[fieldName] }\n })\n } else {\n valuesToTransform.push({ ref: result, table })\n }\n } else {\n const relationPathMatch = relationships[`${sanitizedPath}${field.name}`]\n if (!relationPathMatch) {\n if ('hasMany' in field && field.hasMany) {\n if (field.localized && config.localization && config.localization.locales) {\n result[field.name] = {\n [config.localization.defaultLocale]: [],\n }\n } else {\n result[field.name] = []\n }\n }\n\n return result\n }\n\n if (field.localized) {\n result[field.name] = {}\n const relationsByLocale: Record<string, Record<string, unknown>[]> = {}\n\n relationPathMatch.forEach((row) => {\n if (typeof row.locale === 'string') {\n if (!relationsByLocale[row.locale]) relationsByLocale[row.locale] = []\n relationsByLocale[row.locale].push(row)\n }\n })\n\n Object.entries(relationsByLocale).forEach(([locale, relations]) => {\n transformRelationship({\n field,\n locale,\n ref: result,\n relations,\n })\n })\n } else {\n transformRelationship({\n field,\n ref: result,\n relations: relationPathMatch,\n withinArrayOrBlockLocale,\n })\n }\n return result\n }\n }\n\n if (field.type === 'text' && field?.hasMany) {\n const textPathMatch = texts[`${sanitizedPath}${field.name}`]\n if (!textPathMatch) return result\n\n if (field.localized) {\n result[field.name] = {}\n const textsByLocale: Record<string, Record<string, unknown>[]> = {}\n\n textPathMatch.forEach((row) => {\n if (typeof row.locale === 'string') {\n if (!textsByLocale[row.locale]) textsByLocale[row.locale] = []\n textsByLocale[row.locale].push(row)\n }\n })\n\n Object.entries(textsByLocale).forEach(([locale, texts]) => {\n transformHasManyText({\n field,\n locale,\n ref: result,\n textRows: texts,\n })\n })\n } else {\n transformHasManyText({\n field,\n ref: result,\n textRows: textPathMatch,\n withinArrayOrBlockLocale,\n })\n }\n\n return result\n }\n\n if (field.type === 'number' && field.hasMany) {\n const numberPathMatch = numbers[`${sanitizedPath}${field.name}`]\n if (!numberPathMatch) return result\n\n if (field.localized) {\n result[field.name] = {}\n const numbersByLocale: Record<string, Record<string, unknown>[]> = {}\n\n numberPathMatch.forEach((row) => {\n if (typeof row.locale === 'string') {\n if (!numbersByLocale[row.locale]) numbersByLocale[row.locale] = []\n numbersByLocale[row.locale].push(row)\n }\n })\n\n Object.entries(numbersByLocale).forEach(([locale, numbers]) => {\n transformHasManyNumber({\n field,\n locale,\n numberRows: numbers,\n ref: result,\n })\n })\n } else {\n transformHasManyNumber({\n field,\n numberRows: numberPathMatch,\n ref: result,\n withinArrayOrBlockLocale,\n })\n }\n\n return result\n }\n\n if (field.type === 'select' && field.hasMany) {\n if (Array.isArray(fieldData)) {\n if (field.localized) {\n result[field.name] = fieldData.reduce((selectResult, row) => {\n if (typeof row.locale === 'string') {\n if (!selectResult[row.locale]) selectResult[row.locale] = []\n selectResult[row.locale].push(row.value)\n }\n\n return selectResult\n }, {})\n } else {\n result[field.name] = fieldData.map(({ value }) => value)\n }\n }\n return result\n }\n\n if (field.localized && Array.isArray(table._locales)) {\n table._locales.forEach((localeRow) => {\n valuesToTransform.push({\n ref: localizedFieldData,\n table: {\n ...localeRow,\n },\n })\n })\n } else {\n valuesToTransform.push({ ref: result, table })\n }\n\n valuesToTransform.forEach(({ ref, table }) => {\n const fieldData = table[`${fieldPrefix || ''}${field.name}`]\n const locale = table?._locale\n let val = fieldData\n\n switch (field.type) {\n case 'tab':\n case 'group': {\n const groupFieldPrefix = `${fieldPrefix || ''}${field.name}_`\n const groupData = {}\n const locale = table._locale as string\n const refKey = field.localized && locale ? locale : field.name\n\n if (field.localized && locale) delete table._locale\n ref[refKey] = traverseFields<Record<string, unknown>>({\n adapter,\n blocks,\n config,\n dataRef: groupData as Record<string, unknown>,\n deletions,\n fieldPrefix: groupFieldPrefix,\n fields: field.fields,\n numbers,\n path: `${sanitizedPath}${field.name}`,\n relationships,\n table,\n texts,\n withinArrayOrBlockLocale,\n })\n\n if ('_order' in ref) {\n delete ref._order\n }\n\n return\n }\n\n case 'text': {\n if (typeof fieldData === 'string') {\n val = String(fieldData)\n }\n\n break\n }\n\n case 'number': {\n if (typeof fieldData === 'string') {\n val = Number.parseFloat(fieldData)\n }\n\n break\n }\n\n case 'date': {\n if (typeof fieldData === 'string') {\n val = new Date(fieldData).toISOString()\n }\n\n break\n }\n\n case 'relationship':\n case 'upload': {\n if (\n val &&\n typeof field.relationTo === 'string' &&\n adapter.payload.collections[field.relationTo].customIDType === 'number'\n ) {\n val = Number(val)\n }\n\n break\n }\n\n default: {\n break\n }\n }\n if (typeof locale === 'string') {\n ref[locale] = val\n } else {\n result[field.name] = val\n }\n })\n\n if (Object.keys(localizedFieldData).length > 0) {\n result[field.name] = localizedFieldData\n }\n\n return result\n }\n\n return result\n }, dataRef)\n\n if (Array.isArray(table._locales)) {\n deletions.push(() => delete table._locales)\n }\n\n return formatted as T\n}\n"],"names":["fieldAffectsData","transformHasManyNumber","transformHasManyText","transformRelationship","traverseFields","adapter","blocks","config","dataRef","deletions","fieldPrefix","fields","numbers","path","relationships","table","texts","withinArrayOrBlockLocale","sanitizedPath","formatted","reduce","result","field","type","tabs","map","tab","fieldName","name","fieldData","localizedFieldData","valuesToTransform","push","Array","isArray","localized","arrayResult","row","_locale","locale","data","_uuid","id","rowResult","_order","i","blockFieldPath","forEach","Object","entries","localizedBlocks","block","find","slug","blockType","blockResult","acc","relationTo","hasMany","localization","locales","_locales","localeRow","ref","relationPathMatch","defaultLocale","relationsByLocale","relations","textPathMatch","textsByLocale","textRows","numberPathMatch","numbersByLocale","numberRows","selectResult","value","val","groupFieldPrefix","groupData","refKey","String","Number","parseFloat","Date","toISOString","payload","collections","customIDType","keys","length"],"mappings":"AAEA,SAASA,gBAAgB,QAAQ,iBAAgB;AAKjD,SAASC,sBAAsB,QAAQ,qBAAoB;AAC3D,SAASC,oBAAoB,QAAQ,mBAAkB;AACvD,SAASC,qBAAqB,QAAQ,oBAAmB;AAyDzD,iDAAiD;AACjD,kDAAkD;AAClD,OAAO,MAAMC,iBAAiB,CAAoC,EAChEC,OAAO,EACPC,MAAM,EACNC,MAAM,EACNC,OAAO,EACPC,SAAS,EACTC,WAAW,EACXC,MAAM,EACNC,OAAO,EACPC,IAAI,EACJC,aAAa,EACbC,KAAK,EACLC,KAAK,EACLC,wBAAwB,EACL;IACnB,MAAMC,gBAAgBL,OAAO,CAAC,EAAEA,KAAK,CAAC,CAAC,GAAGA;IAE1C,MAAMM,YAAYR,OAAOS,MAAM,CAAC,CAACC,QAAQC;QACvC,IAAIA,MAAMC,IAAI,KAAK,QAAQ;YACzBnB,eAAe;gBACbC;gBACAC;gBACAC;gBACAC;gBACAC;gBACAC;gBACAC,QAAQW,MAAME,IAAI,CAACC,GAAG,CAAC,CAACC,MAAS,CAAA;wBAAE,GAAGA,GAAG;wBAAEH,MAAM;oBAAM,CAAA;gBACvDX;gBACAC;gBACAC;gBACAC;gBACAC;gBACAC;YACF;QACF;QAEA,IACEK,MAAMC,IAAI,KAAK,iBACfD,MAAMC,IAAI,KAAK,SACdD,MAAMC,IAAI,KAAK,SAAS,CAAE,CAAA,UAAUD,KAAI,GACzC;YACAlB,eAAe;gBACbC;gBACAC;gBACAC;gBACAC;gBACAC;gBACAC;gBACAC,Q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QgF,OAAO,CAACC,WAAW,CAAChE,MAAMmC,UAAU,CAAC,CAAC8B,YAAY,KAAK,UAC/D;gCACAX,MAAMK,OAAOL;4BACf;4BAEA;wBACF;oBAEA;wBAAS;4BACP;wBACF;gBACF;gBACA,IAAI,OAAOrC,WAAW,UAAU;oBAC9BwB,GAAG,CAACxB,OAAO,GAAGqC;gBAChB,OAAO;oBACLvD,MAAM,CAACC,MAAMM,IAAI,CAAC,GAAGgD;gBACvB;YACF;YAEA,IAAI5B,OAAOwC,IAAI,CAAC1D,oBAAoB2D,MAAM,GAAG,GAAG;gBAC9CpE,MAAM,CAACC,MAAMM,IAAI,CAAC,GAAGE;YACvB;YAEA,OAAOT;QACT;QAEA,OAAOA;IACT,GAAGb;IAEH,IAAIyB,MAAMC,OAAO,CAACnB,MAAM8C,QAAQ,GAAG;QACjCpD,UAAUuB,IAAI,CAAC,IAAM,OAAOjB,MAAM8C,QAAQ;IAC5C;IAEA,OAAO1C;AACT,EAAC"}
@@ -20,7 +20,12 @@ type Args = {
20
20
  [tableName: string]: Record<string, unknown>[];
21
21
  };
22
22
  texts: Record<string, unknown>[];
23
+ /**
24
+ * Set to a locale code if this set of fields is traversed within a
25
+ * localized array or block field
26
+ */
27
+ withinArrayOrBlockLocale?: string;
23
28
  };
24
- export declare const transformArray: ({ adapter, arrayTableName, baseTableName, blocks, blocksToDelete, data, field, locale, numbers, path, relationships, relationshipsToDelete, selects, texts, }: Args) => ArrayRowToInsert[];
29
+ export declare const transformArray: ({ adapter, arrayTableName, baseTableName, blocks, blocksToDelete, data, field, locale, numbers, path, relationships, relationshipsToDelete, selects, texts, withinArrayOrBlockLocale, }: Args) => ArrayRowToInsert[];
25
30
  export {};
26
31
  //# sourceMappingURL=array.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../src/transform/write/array.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC,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,EAAE,cAAc,CAAA;IACvB,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE;QACN,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;KACxC,CAAA;IACD,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC3B,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,UAAU,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IACxC,qBAAqB,EAAE,oBAAoB,EAAE,CAAA;IAC7C,OAAO,EAAE;QACP,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;KAC/C,CAAA;IACD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IAChC;;;OAGG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAA;CAClC,CAAA;AAED,eAAO,MAAM,cAAc,4LAgBxB,IAAI,uBAkEN,CAAA"}
@@ -1,6 +1,6 @@
1
- /* eslint-disable no-param-reassign */ import { isArrayOfRows } from '../../utilities/isArrayOfRows.js';
1
+ import { isArrayOfRows } from '../../utilities/isArrayOfRows.js';
2
2
  import { traverseFields } from './traverseFields.js';
3
- export const transformArray = ({ adapter, arrayTableName, baseTableName, blocks, blocksToDelete, data, field, locale, numbers, path, relationships, relationshipsToDelete, selects, texts })=>{
3
+ export const transformArray = ({ adapter, arrayTableName, baseTableName, blocks, blocksToDelete, data, field, locale, numbers, path, relationships, relationshipsToDelete, selects, texts, withinArrayOrBlockLocale })=>{
4
4
  const newRows = [];
5
5
  const hasUUID = adapter.tables[arrayTableName]._uuid;
6
6
  if (isArrayOfRows(data)) {
@@ -29,6 +29,9 @@ export const transformArray = ({ adapter, arrayTableName, baseTableName, blocks,
29
29
  if (field.localized) {
30
30
  newRow.row._locale = locale;
31
31
  }
32
+ if (withinArrayOrBlockLocale) {
33
+ newRow.row._locale = withinArrayOrBlockLocale;
34
+ }
32
35
  traverseFields({
33
36
  adapter,
34
37
  arrays: newRow.arrays,
@@ -47,7 +50,8 @@ export const transformArray = ({ adapter, arrayTableName, baseTableName, blocks,
47
50
  relationshipsToDelete,
48
51
  row: newRow.row,
49
52
  selects,
50
- texts
53
+ texts,
54
+ withinArrayOrBlockLocale
51
55
  });
52
56
  newRows.push(newRow);
53
57
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/transform/write/array.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport type { ArrayField } from 'payload'\n\nimport type { DrizzleAdapter } from '../../types.js'\nimport type { ArrayRowToInsert, BlockRowToInsert, RelationshipToDelete } from './types.js'\n\nimport { isArrayOfRows } from '../../utilities/isArrayOfRows.js'\nimport { traverseFields } from './traverseFields.js'\n\ntype Args = {\n adapter: DrizzleAdapter\n arrayTableName: string\n baseTableName: string\n blocks: {\n [blockType: string]: BlockRowToInsert[]\n }\n blocksToDelete: Set<string>\n data: unknown\n field: ArrayField\n locale?: string\n numbers: Record<string, unknown>[]\n path: string\n relationships: Record<string, unknown>[]\n relationshipsToDelete: RelationshipToDelete[]\n selects: {\n [tableName: string]: Record<string, unknown>[]\n }\n texts: Record<string, unknown>[]\n}\n\nexport const transformArray = ({\n adapter,\n arrayTableName,\n baseTableName,\n blocks,\n blocksToDelete,\n data,\n field,\n locale,\n numbers,\n path,\n relationships,\n relationshipsToDelete,\n selects,\n texts,\n}: Args) => {\n const newRows: ArrayRowToInsert[] = []\n\n const hasUUID = adapter.tables[arrayTableName]._uuid\n\n if (isArrayOfRows(data)) {\n data.forEach((arrayRow, i) => {\n const newRow: ArrayRowToInsert = {\n arrays: {},\n locales: {},\n row: {\n _order: i + 1,\n },\n }\n\n // If we have declared a _uuid field on arrays,\n // that means the ID has to be unique,\n // and our ids within arrays are not unique.\n // So move the ID to a uuid field for storage\n // and allow the database to generate a serial id automatically\n if (hasUUID) {\n newRow.row._uuid = arrayRow.id\n delete arrayRow.id\n }\n\n if (locale) {\n newRow.locales[locale] = {\n _locale: locale,\n }\n }\n\n if (field.localized) {\n newRow.row._locale = locale\n }\n\n traverseFields({\n adapter,\n arrays: newRow.arrays,\n baseTableName,\n blocks,\n blocksToDelete,\n columnPrefix: '',\n data: arrayRow,\n fieldPrefix: '',\n fields: field.fields,\n locales: newRow.locales,\n numbers,\n parentTableName: arrayTableName,\n path: `${path || ''}${field.name}.${i}.`,\n relationships,\n relationshipsToDelete,\n row: newRow.row,\n selects,\n texts,\n })\n\n newRows.push(newRow)\n })\n }\n\n return newRows\n}\n"],"names":["isArrayOfRows","traverseFields","transformArray","adapter","arrayTableName","baseTableName","blocks","blocksToDelete","data","field","locale","numbers","path","relationships","relationshipsToDelete","selects","texts","newRows","hasUUID","tables","_uuid","forEach","arrayRow","i","newRow","arrays","locales","row","_order","id","_locale","localized","columnPrefix","fieldPrefix","fields","parentTableName","name","push"],"mappings":"AAAA,oCAAoC,GAMpC,SAASA,aAAa,QAAQ,mCAAkC;AAChE,SAASC,cAAc,QAAQ,sBAAqB;AAuBpD,OAAO,MAAMC,iBAAiB,CAAC,EAC7BC,OAAO,EACPC,cAAc,EACdC,aAAa,EACbC,MAAM,EACNC,cAAc,EACdC,IAAI,EACJC,KAAK,EACLC,MAAM,EACNC,OAAO,EACPC,IAAI,EACJC,aAAa,EACbC,qBAAqB,EACrBC,OAAO,EACPC,KAAK,EACA;IACL,MAAMC,UAA8B,EAAE;IAEtC,MAAMC,UAAUf,QAAQgB,MAAM,CAACf,eAAe,CAACgB,KAAK;IAEpD,IAAIpB,cAAcQ,OAAO;QACvBA,KAAKa,OAAO,CAAC,CAACC,UAAUC;YACtB,MAAMC,SAA2B;gBAC/BC,QAAQ,CAAC;gBACTC,SAAS,CAAC;gBACVC,KAAK;oBACHC,QAAQL,IAAI;gBACd;YACF;YAEA,+CAA+C;YAC/C,sCAAsC;YACtC,4CAA4C;YAC5C,6CAA6C;YAC7C,+DAA+D;YAC/D,IAAIL,SAAS;gBACXM,OAAOG,GAAG,CAACP,KAAK,GAAGE,SAASO,EAAE;gBAC9B,OAAOP,SAASO,EAAE;YACpB;YAEA,IAAInB,QAAQ;gBACVc,OAAOE,OAAO,CAAChB,OAAO,GAAG;oBACvBoB,SAASpB;gBACX;YACF;YAEA,IAAID,MAAMsB,SAAS,EAAE;gBACnBP,OAAOG,GAAG,CAACG,OAAO,GAAGpB;YACvB;YAEAT,eAAe;gBACbE;gBACAsB,QAAQD,OAAOC,MAAM;gBACrBpB;gBACAC;gBACAC;gBACAyB,cAAc;gBACdxB,MAAMc;gBACNW,aAAa;gBACbC,QAAQzB,MAAMyB,MAAM;gBACpBR,SAASF,OAAOE,OAAO;gBACvBf;gBACAwB,iBAAiB/B;gBACjBQ,MAAM,CAAC,EAAEA,QAAQ,GAAG,EAAEH,MAAM2B,IAAI,CAAC,CAAC,EAAEb,EAAE,CAAC,CAAC;gBACxCV;gBACAC;gBACAa,KAAKH,OAAOG,GAAG;gBACfZ;gBACAC;YACF;YAEAC,QAAQoB,IAAI,CAACb;QACf;IACF;IAEA,OAAOP;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../src/transform/write/array.ts"],"sourcesContent":["import type { ArrayField } from 'payload'\n\nimport type { DrizzleAdapter } from '../../types.js'\nimport type { ArrayRowToInsert, BlockRowToInsert, RelationshipToDelete } from './types.js'\n\nimport { isArrayOfRows } from '../../utilities/isArrayOfRows.js'\nimport { traverseFields } from './traverseFields.js'\n\ntype Args = {\n adapter: DrizzleAdapter\n arrayTableName: string\n baseTableName: string\n blocks: {\n [blockType: string]: BlockRowToInsert[]\n }\n blocksToDelete: Set<string>\n data: unknown\n field: ArrayField\n locale?: string\n numbers: Record<string, unknown>[]\n path: string\n relationships: Record<string, unknown>[]\n relationshipsToDelete: RelationshipToDelete[]\n selects: {\n [tableName: string]: Record<string, unknown>[]\n }\n texts: Record<string, unknown>[]\n /**\n * Set to a locale code if this set of fields is traversed within a\n * localized array or block field\n */\n withinArrayOrBlockLocale?: string\n}\n\nexport const transformArray = ({\n adapter,\n arrayTableName,\n baseTableName,\n blocks,\n blocksToDelete,\n data,\n field,\n locale,\n numbers,\n path,\n relationships,\n relationshipsToDelete,\n selects,\n texts,\n withinArrayOrBlockLocale,\n}: Args) => {\n const newRows: ArrayRowToInsert[] = []\n\n const hasUUID = adapter.tables[arrayTableName]._uuid\n\n if (isArrayOfRows(data)) {\n data.forEach((arrayRow, i) => {\n const newRow: ArrayRowToInsert = {\n arrays: {},\n locales: {},\n row: {\n _order: i + 1,\n },\n }\n\n // If we have declared a _uuid field on arrays,\n // that means the ID has to be unique,\n // and our ids within arrays are not unique.\n // So move the ID to a uuid field for storage\n // and allow the database to generate a serial id automatically\n if (hasUUID) {\n newRow.row._uuid = arrayRow.id\n delete arrayRow.id\n }\n\n if (locale) {\n newRow.locales[locale] = {\n _locale: locale,\n }\n }\n\n if (field.localized) {\n newRow.row._locale = locale\n }\n\n if (withinArrayOrBlockLocale) {\n newRow.row._locale = withinArrayOrBlockLocale\n }\n\n traverseFields({\n adapter,\n arrays: newRow.arrays,\n baseTableName,\n blocks,\n blocksToDelete,\n columnPrefix: '',\n data: arrayRow,\n fieldPrefix: '',\n fields: field.fields,\n locales: newRow.locales,\n numbers,\n parentTableName: arrayTableName,\n path: `${path || ''}${field.name}.${i}.`,\n relationships,\n relationshipsToDelete,\n row: newRow.row,\n selects,\n texts,\n withinArrayOrBlockLocale,\n })\n\n newRows.push(newRow)\n })\n }\n\n return newRows\n}\n"],"names":["isArrayOfRows","traverseFields","transformArray","adapter","arrayTableName","baseTableName","blocks","blocksToDelete","data","field","locale","numbers","path","relationships","relationshipsToDelete","selects","texts","withinArrayOrBlockLocale","newRows","hasUUID","tables","_uuid","forEach","arrayRow","i","newRow","arrays","locales","row","_order","id","_locale","localized","columnPrefix","fieldPrefix","fields","parentTableName","name","push"],"mappings":"AAKA,SAASA,aAAa,QAAQ,mCAAkC;AAChE,SAASC,cAAc,QAAQ,sBAAqB;AA4BpD,OAAO,MAAMC,iBAAiB,CAAC,EAC7BC,OAAO,EACPC,cAAc,EACdC,aAAa,EACbC,MAAM,EACNC,cAAc,EACdC,IAAI,EACJC,KAAK,EACLC,MAAM,EACNC,OAAO,EACPC,IAAI,EACJC,aAAa,EACbC,qBAAqB,EACrBC,OAAO,EACPC,KAAK,EACLC,wBAAwB,EACnB;IACL,MAAMC,UAA8B,EAAE;IAEtC,MAAMC,UAAUhB,QAAQiB,MAAM,CAAChB,eAAe,CAACiB,KAAK;IAEpD,IAAIrB,cAAcQ,OAAO;QACvBA,KAAKc,OAAO,CAAC,CAACC,UAAUC;YACtB,MAAMC,SAA2B;gBAC/BC,QAAQ,CAAC;gBACTC,SAAS,CAAC;gBACVC,KAAK;oBACHC,QAAQL,IAAI;gBACd;YACF;YAEA,+CAA+C;YAC/C,sCAAsC;YACtC,4CAA4C;YAC5C,6CAA6C;YAC7C,+DAA+D;YAC/D,IAAIL,SAAS;gBACXM,OAAOG,GAAG,CAACP,KAAK,GAAGE,SAASO,EAAE;gBAC9B,OAAOP,SAASO,EAAE;YACpB;YAEA,IAAIpB,QAAQ;gBACVe,OAAOE,OAAO,CAACjB,OAAO,GAAG;oBACvBqB,SAASrB;gBACX;YACF;YAEA,IAAID,MAAMuB,SAAS,EAAE;gBACnBP,OAAOG,GAAG,CAACG,OAAO,GAAGrB;YACvB;YAEA,IAAIO,0BAA0B;gBAC5BQ,OAAOG,GAAG,CAACG,OAAO,GAAGd;YACvB;YAEAhB,eAAe;gBACbE;gBACAuB,QAAQD,OAAOC,MAAM;gBACrBrB;gBACAC;gBACAC;gBACA0B,cAAc;gBACdzB,MAAMe;gBACNW,aAAa;gBACbC,QAAQ1B,MAAM0B,MAAM;gBACpBR,SAASF,OAAOE,OAAO;gBACvBhB;gBACAyB,iBAAiBhC;gBACjBQ,MAAM,CAAC,EAAEA,QAAQ,GAAG,EAAEH,MAAM4B,IAAI,CAAC,CAAC,EAAEb,EAAE,CAAC,CAAC;gBACxCX;gBACAC;gBACAc,KAAKH,OAAOG,GAAG;gBACfb;gBACAC;gBACAC;YACF;YAEAC,QAAQoB,IAAI,CAACb;QACf;IACF;IAEA,OAAOP;AACT,EAAC"}
@@ -19,7 +19,12 @@ type Args = {
19
19
  [tableName: string]: Record<string, unknown>[];
20
20
  };
21
21
  texts: Record<string, unknown>[];
22
+ /**
23
+ * Set to a locale code if this set of fields is traversed within a
24
+ * localized array or block field
25
+ */
26
+ withinArrayOrBlockLocale?: string;
22
27
  };
23
- export declare const transformBlocks: ({ adapter, baseTableName, blocks, blocksToDelete, data, field, locale, numbers, path, relationships, relationshipsToDelete, selects, texts, }: Args) => void;
28
+ export declare const transformBlocks: ({ adapter, baseTableName, blocks, blocksToDelete, data, field, locale, numbers, path, relationships, relationshipsToDelete, selects, texts, withinArrayOrBlockLocale, }: Args) => void;
24
29
  export {};
25
30
  //# sourceMappingURL=blocks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../../src/transform/write/blocks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAIzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAIxE,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,cAAc,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE;QACN,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;KACxC,CAAA;IACD,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC3B,IAAI,EAAE,MAAM,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;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IACxC,qBAAqB,EAAE,oBAAoB,EAAE,CAAA;IAC7C,OAAO,EAAE;QACP,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;KAC/C,CAAA;IACD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IAChC;;;OAGG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAA;CAClC,CAAA;AACD,eAAO,MAAM,eAAe,4KAezB,IAAI,SA2DN,CAAA"}
@@ -1,6 +1,6 @@
1
- /* eslint-disable no-param-reassign */ import toSnakeCase from 'to-snake-case';
1
+ import toSnakeCase from 'to-snake-case';
2
2
  import { traverseFields } from './traverseFields.js';
3
- export const transformBlocks = ({ adapter, baseTableName, blocks, blocksToDelete, data, field, locale, numbers, path, relationships, relationshipsToDelete, selects, texts })=>{
3
+ export const transformBlocks = ({ adapter, baseTableName, blocks, blocksToDelete, data, field, locale, numbers, path, relationships, relationshipsToDelete, selects, texts, withinArrayOrBlockLocale })=>{
4
4
  data.forEach((blockRow, i)=>{
5
5
  if (typeof blockRow.blockType !== 'string') return;
6
6
  const matchedBlock = field.blocks.find(({ slug })=>slug === blockRow.blockType);
@@ -16,6 +16,7 @@ export const transformBlocks = ({ adapter, baseTableName, blocks, blocksToDelete
16
16
  }
17
17
  };
18
18
  if (field.localized && locale) newRow.row._locale = locale;
19
+ if (withinArrayOrBlockLocale) newRow.row._locale = withinArrayOrBlockLocale;
19
20
  const blockTableName = adapter.tableNameMap.get(`${baseTableName}_blocks_${blockType}`);
20
21
  const hasUUID = adapter.tables[blockTableName]._uuid;
21
22
  // If we have declared a _uuid field on arrays,
@@ -45,7 +46,8 @@ export const transformBlocks = ({ adapter, baseTableName, blocks, blocksToDelete
45
46
  relationshipsToDelete,
46
47
  row: newRow.row,
47
48
  selects,
48
- texts
49
+ texts,
50
+ withinArrayOrBlockLocale
49
51
  });
50
52
  blocks[blockType].push(newRow);
51
53
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/transform/write/blocks.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport type { BlockField } from 'payload'\n\nimport toSnakeCase from 'to-snake-case'\n\nimport type { DrizzleAdapter } from '../../types.js'\nimport type { BlockRowToInsert, RelationshipToDelete } from './types.js'\n\nimport { traverseFields } from './traverseFields.js'\n\ntype Args = {\n adapter: DrizzleAdapter\n baseTableName: string\n blocks: {\n [blockType: string]: BlockRowToInsert[]\n }\n blocksToDelete: Set<string>\n data: Record<string, unknown>[]\n field: BlockField\n locale?: string\n numbers: Record<string, unknown>[]\n path: string\n relationships: Record<string, unknown>[]\n relationshipsToDelete: RelationshipToDelete[]\n selects: {\n [tableName: string]: Record<string, unknown>[]\n }\n texts: Record<string, unknown>[]\n}\nexport const transformBlocks = ({\n adapter,\n baseTableName,\n blocks,\n blocksToDelete,\n data,\n field,\n locale,\n numbers,\n path,\n relationships,\n relationshipsToDelete,\n selects,\n texts,\n}: Args) => {\n data.forEach((blockRow, i) => {\n if (typeof blockRow.blockType !== 'string') return\n const matchedBlock = field.blocks.find(({ slug }) => slug === blockRow.blockType)\n if (!matchedBlock) return\n const blockType = toSnakeCase(blockRow.blockType)\n\n if (!blocks[blockType]) blocks[blockType] = []\n\n const newRow: BlockRowToInsert = {\n arrays: {},\n locales: {},\n row: {\n _order: i + 1,\n _path: `${path}${field.name}`,\n },\n }\n\n if (field.localized && locale) newRow.row._locale = locale\n\n const blockTableName = adapter.tableNameMap.get(`${baseTableName}_blocks_${blockType}`)\n\n const hasUUID = adapter.tables[blockTableName]._uuid\n\n // If we have declared a _uuid field on arrays,\n // that means the ID has to be unique,\n // and our ids within arrays are not unique.\n // So move the ID to a uuid field for storage\n // and allow the database to generate a serial id automatically\n if (hasUUID) {\n newRow.row._uuid = blockRow.id\n delete blockRow.id\n }\n\n traverseFields({\n adapter,\n arrays: newRow.arrays,\n baseTableName,\n blocks,\n blocksToDelete,\n columnPrefix: '',\n data: blockRow,\n fieldPrefix: '',\n fields: matchedBlock.fields,\n locales: newRow.locales,\n numbers,\n parentTableName: blockTableName,\n path: `${path || ''}${field.name}.${i}.`,\n relationships,\n relationshipsToDelete,\n row: newRow.row,\n selects,\n texts,\n })\n\n blocks[blockType].push(newRow)\n })\n}\n"],"names":["toSnakeCase","traverseFields","transformBlocks","adapter","baseTableName","blocks","blocksToDelete","data","field","locale","numbers","path","relationships","relationshipsToDelete","selects","texts","forEach","blockRow","i","blockType","matchedBlock","find","slug","newRow","arrays","locales","row","_order","_path","name","localized","_locale","blockTableName","tableNameMap","get","hasUUID","tables","_uuid","id","columnPrefix","fieldPrefix","fields","parentTableName","push"],"mappings":"AAAA,oCAAoC,GAGpC,OAAOA,iBAAiB,gBAAe;AAKvC,SAASC,cAAc,QAAQ,sBAAqB;AAqBpD,OAAO,MAAMC,kBAAkB,CAAC,EAC9BC,OAAO,EACPC,aAAa,EACbC,MAAM,EACNC,cAAc,EACdC,IAAI,EACJC,KAAK,EACLC,MAAM,EACNC,OAAO,EACPC,IAAI,EACJC,aAAa,EACbC,qBAAqB,EACrBC,OAAO,EACPC,KAAK,EACA;IACLR,KAAKS,OAAO,CAAC,CAACC,UAAUC;QACtB,IAAI,OAAOD,SAASE,SAAS,KAAK,UAAU;QAC5C,MAAMC,eAAeZ,MAAMH,MAAM,CAACgB,IAAI,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKA,SAASL,SAASE,SAAS;QAChF,IAAI,CAACC,cAAc;QACnB,MAAMD,YAAYnB,YAAYiB,SAASE,SAAS;QAEhD,IAAI,CAACd,MAAM,CAACc,UAAU,EAAEd,MAAM,CAACc,UAAU,GAAG,EAAE;QAE9C,MAAMI,SAA2B;YAC/BC,QAAQ,CAAC;YACTC,SAAS,CAAC;YACVC,KAAK;gBACHC,QAAQT,IAAI;gBACZU,OAAO,CAAC,EAAEjB,KAAK,EAAEH,MAAMqB,IAAI,CAAC,CAAC;YAC/B;QACF;QAEA,IAAIrB,MAAMsB,SAAS,IAAIrB,QAAQc,OAAOG,GAAG,CAACK,OAAO,GAAGtB;QAEpD,MAAMuB,iBAAiB7B,QAAQ8B,YAAY,CAACC,GAAG,CAAC,CAAC,EAAE9B,cAAc,QAAQ,EAAEe,UAAU,CAAC;QAEtF,MAAMgB,UAAUhC,QAAQiC,MAAM,CAACJ,eAAe,CAACK,KAAK;QAEpD,+CAA+C;QAC/C,sCAAsC;QACtC,4CAA4C;QAC5C,6CAA6C;QAC7C,+DAA+D;QAC/D,IAAIF,SAAS;YACXZ,OAAOG,GAAG,CAACW,KAAK,GAAGpB,SAASqB,EAAE;YAC9B,OAAOrB,SAASqB,EAAE;QACpB;QAEArC,eAAe;YACbE;YACAqB,QAAQD,OAAOC,MAAM;YACrBpB;YACAC;YACAC;YACAiC,cAAc;YACdhC,MAAMU;YACNuB,aAAa;YACbC,QAAQrB,aAAaqB,MAAM;YAC3BhB,SAASF,OAAOE,OAAO;YACvBf;YACAgC,iBAAiBV;YACjBrB,MAAM,CAAC,EAAEA,QAAQ,GAAG,EAAEH,MAAMqB,IAAI,CAAC,CAAC,EAAEX,EAAE,CAAC,CAAC;YACxCN;YACAC;YACAa,KAAKH,OAAOG,GAAG;YACfZ;YACAC;QACF;QAEAV,MAAM,CAACc,UAAU,CAACwB,IAAI,CAACpB;IACzB;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/transform/write/blocks.ts"],"sourcesContent":["import type { BlockField } from 'payload'\n\nimport toSnakeCase from 'to-snake-case'\n\nimport type { DrizzleAdapter } from '../../types.js'\nimport type { BlockRowToInsert, RelationshipToDelete } from './types.js'\n\nimport { traverseFields } from './traverseFields.js'\n\ntype Args = {\n adapter: DrizzleAdapter\n baseTableName: string\n blocks: {\n [blockType: string]: BlockRowToInsert[]\n }\n blocksToDelete: Set<string>\n data: Record<string, unknown>[]\n field: BlockField\n locale?: string\n numbers: Record<string, unknown>[]\n path: string\n relationships: Record<string, unknown>[]\n relationshipsToDelete: RelationshipToDelete[]\n selects: {\n [tableName: string]: Record<string, unknown>[]\n }\n texts: Record<string, unknown>[]\n /**\n * Set to a locale code if this set of fields is traversed within a\n * localized array or block field\n */\n withinArrayOrBlockLocale?: string\n}\nexport const transformBlocks = ({\n adapter,\n baseTableName,\n blocks,\n blocksToDelete,\n data,\n field,\n locale,\n numbers,\n path,\n relationships,\n relationshipsToDelete,\n selects,\n texts,\n withinArrayOrBlockLocale,\n}: Args) => {\n data.forEach((blockRow, i) => {\n if (typeof blockRow.blockType !== 'string') return\n const matchedBlock = field.blocks.find(({ slug }) => slug === blockRow.blockType)\n if (!matchedBlock) return\n const blockType = toSnakeCase(blockRow.blockType)\n\n if (!blocks[blockType]) blocks[blockType] = []\n\n const newRow: BlockRowToInsert = {\n arrays: {},\n locales: {},\n row: {\n _order: i + 1,\n _path: `${path}${field.name}`,\n },\n }\n\n if (field.localized && locale) newRow.row._locale = locale\n if (withinArrayOrBlockLocale) newRow.row._locale = withinArrayOrBlockLocale\n\n const blockTableName = adapter.tableNameMap.get(`${baseTableName}_blocks_${blockType}`)\n\n const hasUUID = adapter.tables[blockTableName]._uuid\n\n // If we have declared a _uuid field on arrays,\n // that means the ID has to be unique,\n // and our ids within arrays are not unique.\n // So move the ID to a uuid field for storage\n // and allow the database to generate a serial id automatically\n if (hasUUID) {\n newRow.row._uuid = blockRow.id\n delete blockRow.id\n }\n\n traverseFields({\n adapter,\n arrays: newRow.arrays,\n baseTableName,\n blocks,\n blocksToDelete,\n columnPrefix: '',\n data: blockRow,\n fieldPrefix: '',\n fields: matchedBlock.fields,\n locales: newRow.locales,\n numbers,\n parentTableName: blockTableName,\n path: `${path || ''}${field.name}.${i}.`,\n relationships,\n relationshipsToDelete,\n row: newRow.row,\n selects,\n texts,\n withinArrayOrBlockLocale,\n })\n\n blocks[blockType].push(newRow)\n })\n}\n"],"names":["toSnakeCase","traverseFields","transformBlocks","adapter","baseTableName","blocks","blocksToDelete","data","field","locale","numbers","path","relationships","relationshipsToDelete","selects","texts","withinArrayOrBlockLocale","forEach","blockRow","i","blockType","matchedBlock","find","slug","newRow","arrays","locales","row","_order","_path","name","localized","_locale","blockTableName","tableNameMap","get","hasUUID","tables","_uuid","id","columnPrefix","fieldPrefix","fields","parentTableName","push"],"mappings":"AAEA,OAAOA,iBAAiB,gBAAe;AAKvC,SAASC,cAAc,QAAQ,sBAAqB;AA0BpD,OAAO,MAAMC,kBAAkB,CAAC,EAC9BC,OAAO,EACPC,aAAa,EACbC,MAAM,EACNC,cAAc,EACdC,IAAI,EACJC,KAAK,EACLC,MAAM,EACNC,OAAO,EACPC,IAAI,EACJC,aAAa,EACbC,qBAAqB,EACrBC,OAAO,EACPC,KAAK,EACLC,wBAAwB,EACnB;IACLT,KAAKU,OAAO,CAAC,CAACC,UAAUC;QACtB,IAAI,OAAOD,SAASE,SAAS,KAAK,UAAU;QAC5C,MAAMC,eAAeb,MAAMH,MAAM,CAACiB,IAAI,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKA,SAASL,SAASE,SAAS;QAChF,IAAI,CAACC,cAAc;QACnB,MAAMD,YAAYpB,YAAYkB,SAASE,SAAS;QAEhD,IAAI,CAACf,MAAM,CAACe,UAAU,EAAEf,MAAM,CAACe,UAAU,GAAG,EAAE;QAE9C,MAAMI,SAA2B;YAC/BC,QAAQ,CAAC;YACTC,SAAS,CAAC;YACVC,KAAK;gBACHC,QAAQT,IAAI;gBACZU,OAAO,CAAC,EAAElB,KAAK,EAAEH,MAAMsB,IAAI,CAAC,CAAC;YAC/B;QACF;QAEA,IAAItB,MAAMuB,SAAS,IAAItB,QAAQe,OAAOG,GAAG,CAACK,OAAO,GAAGvB;QACpD,IAAIO,0BAA0BQ,OAAOG,GAAG,CAACK,OAAO,GAAGhB;QAEnD,MAAMiB,iBAAiB9B,QAAQ+B,YAAY,CAACC,GAAG,CAAC,CAAC,EAAE/B,cAAc,QAAQ,EAAEgB,UAAU,CAAC;QAEtF,MAAMgB,UAAUjC,QAAQkC,MAAM,CAACJ,eAAe,CAACK,KAAK;QAEpD,+CAA+C;QAC/C,sCAAsC;QACtC,4CAA4C;QAC5C,6CAA6C;QAC7C,+DAA+D;QAC/D,IAAIF,SAAS;YACXZ,OAAOG,GAAG,CAACW,KAAK,GAAGpB,SAASqB,EAAE;YAC9B,OAAOrB,SAASqB,EAAE;QACpB;QAEAtC,eAAe;YACbE;YACAsB,QAAQD,OAAOC,MAAM;YACrBrB;YACAC;YACAC;YACAkC,cAAc;YACdjC,MAAMW;YACNuB,aAAa;YACbC,QAAQrB,aAAaqB,MAAM;YAC3BhB,SAASF,OAAOE,OAAO;YACvBhB;YACAiC,iBAAiBV;YACjBtB,MAAM,CAAC,EAAEA,QAAQ,GAAG,EAAEH,MAAMsB,IAAI,CAAC,CAAC,EAAEX,EAAE,CAAC,CAAC;YACxCP;YACAC;YACAc,KAAKH,OAAOG,GAAG;YACfb;YACAC;YACAC;QACF;QAEAX,MAAM,CAACe,UAAU,CAACwB,IAAI,CAACpB;IACzB;AACF,EAAC"}
@@ -44,7 +44,12 @@ type Args = {
44
44
  [tableName: string]: Record<string, unknown>[];
45
45
  };
46
46
  texts: Record<string, unknown>[];
47
+ /**
48
+ * Set to a locale code if this set of fields is traversed within a
49
+ * localized array or block field
50
+ */
51
+ withinArrayOrBlockLocale?: string;
47
52
  };
48
- export declare const traverseFields: ({ adapter, arrays, baseTableName, blocks, blocksToDelete, columnPrefix, data, existingLocales, fieldPrefix, fields, forcedLocale, locales, numbers, parentTableName, path, relationships, relationshipsToDelete, row, selects, texts, }: Args) => void;
53
+ export declare const traverseFields: ({ adapter, arrays, baseTableName, blocks, blocksToDelete, columnPrefix, data, existingLocales, fieldPrefix, fields, forcedLocale, locales, numbers, parentTableName, path, relationships, relationshipsToDelete, row, selects, texts, withinArrayOrBlockLocale, }: Args) => void;
49
54
  export {};
50
55
  //# sourceMappingURL=traverseFields.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"traverseFields.d.ts","sourceRoot":"","sources":["../../../src/transform/write/traverseFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAKpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAU1F,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,cAAc,CAAA;IACvB,MAAM,EAAE;QACN,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;KACxC,CAAA;IACD;;OAEG;IACH,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE;QACN,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;KACxC,CAAA;IACD,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC3B;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IAC3C;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,EAAE;QACP,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAC1C,CAAA;IACD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IAClC;;OAEG;IACH,eAAe,EAAE,MAAM,CAAA;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IACx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