payload 3.8.0 → 3.9.0

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 (37) hide show
  1. package/dist/admin/fields/Array.d.ts +1 -1
  2. package/dist/admin/fields/Array.d.ts.map +1 -1
  3. package/dist/admin/fields/Array.js.map +1 -1
  4. package/dist/admin/fields/Blocks.d.ts +1 -1
  5. package/dist/admin/fields/Blocks.d.ts.map +1 -1
  6. package/dist/admin/fields/Blocks.js.map +1 -1
  7. package/dist/admin/fields/Collapsible.d.ts +1 -1
  8. package/dist/admin/fields/Collapsible.d.ts.map +1 -1
  9. package/dist/admin/fields/Collapsible.js.map +1 -1
  10. package/dist/admin/fields/Group.d.ts +1 -1
  11. package/dist/admin/fields/Group.d.ts.map +1 -1
  12. package/dist/admin/fields/Group.js.map +1 -1
  13. package/dist/admin/fields/Row.d.ts +1 -1
  14. package/dist/admin/fields/Row.d.ts.map +1 -1
  15. package/dist/admin/fields/Row.js.map +1 -1
  16. package/dist/admin/fields/Tabs.d.ts +1 -1
  17. package/dist/admin/fields/Tabs.d.ts.map +1 -1
  18. package/dist/admin/fields/Tabs.js.map +1 -1
  19. package/dist/admin/forms/Field.d.ts +1 -0
  20. package/dist/admin/forms/Field.d.ts.map +1 -1
  21. package/dist/admin/forms/Field.js.map +1 -1
  22. package/dist/fields/hooks/beforeValidate/promise.js +1 -1
  23. package/dist/fields/hooks/beforeValidate/promise.js.map +1 -1
  24. package/dist/queues/config/types/taskTypes.d.ts +29 -2
  25. package/dist/queues/config/types/taskTypes.d.ts.map +1 -1
  26. package/dist/queues/config/types/taskTypes.js.map +1 -1
  27. package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.d.ts.map +1 -1
  28. package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js +36 -16
  29. package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js.map +1 -1
  30. package/dist/uploads/getBaseFields.js +1 -1
  31. package/dist/uploads/getBaseFields.js.map +1 -1
  32. package/dist/utilities/traverseFields.d.ts +3 -3
  33. package/dist/utilities/traverseFields.d.ts.map +1 -1
  34. package/dist/utilities/traverseFields.js +30 -3
  35. package/dist/utilities/traverseFields.js.map +1 -1
  36. package/package.json +2 -2
  37. /package/{license.md → LICENSE.md} +0 -0
@@ -7,7 +7,7 @@ import type { FieldDescriptionClientComponent, FieldDescriptionServerComponent,
7
7
  type ArrayFieldClientWithoutType = MarkOptional<ArrayFieldClient, 'type'>;
8
8
  type ArrayFieldBaseClientProps = {
9
9
  readonly validate?: ArrayFieldValidation;
10
- } & FieldPaths & Pick<ServerFieldBase, 'permissions'>;
10
+ } & FieldPaths;
11
11
  export type ArrayFieldClientProps = ArrayFieldBaseClientProps & ClientFieldBase<ArrayFieldClientWithoutType>;
12
12
  export type ArrayFieldServerProps = ServerFieldBase<ArrayField, ArrayFieldClientWithoutType>;
13
13
  export type ArrayFieldServerComponent = FieldServerComponent<ArrayField, ArrayFieldClientWithoutType>;
@@ -1 +1 @@
1
- {"version":3,"file":"Array.d.ts","sourceRoot":"","sources":["../../../src/admin/fields/Array.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAe,MAAM,8BAA8B,CAAA;AAC7F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,KAAK,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAC7F,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,UAAU,EACV,oBAAoB,EACpB,eAAe,EAChB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACV,+BAA+B,EAC/B,+BAA+B,EAC/B,yBAAyB,EACzB,yBAAyB,EAC1B,MAAM,aAAa,CAAA;AAEpB,KAAK,2BAA2B,GAAG,YAAY,CAAC,gBAAgB,EAAE,MAAM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/Array.ts"],"sourcesContent":["import type { MarkOptional } from 'ts-essentials'\n\nimport type { ArrayField, ArrayFieldClient, ClientField } from '../../fields/config/types.js'\nimport type { ArrayFieldValidation } from '../../fields/validations.js'\nimport type { FieldErrorClientComponent, FieldErrorServerComponent } from '../forms/Error.js'\nimport type {\n ClientFieldBase,\n FieldClientComponent,\n FieldPaths,\n FieldServerComponent,\n ServerFieldBase,\n} from '../forms/Field.js'\nimport type {\n FieldDescriptionClientComponent,\n FieldDescriptionServerComponent,\n FieldLabelClientComponent,\n FieldLabelServerComponent,\n} from '../types.js'\n\ntype ArrayFieldClientWithoutType = MarkOptional<ArrayFieldClient, 'type'>\n\ntype ArrayFieldBaseClientProps = {\n readonly validate?: ArrayFieldValidation\n} & FieldPaths &\n Pick<ServerFieldBase, 'permissions'>\n\nexport type ArrayFieldClientProps = ArrayFieldBaseClientProps &\n ClientFieldBase<ArrayFieldClientWithoutType>\n\nexport type ArrayFieldServerProps = ServerFieldBase<ArrayField, ArrayFieldClientWithoutType>\n\nexport type ArrayFieldServerComponent = FieldServerComponent<\n ArrayField,\n ArrayFieldClientWithoutType\n>\n\nexport type ArrayFieldClientComponent = FieldClientComponent<\n ArrayFieldClientWithoutType,\n ArrayFieldBaseClientProps\n>\n\nexport type ArrayFieldLabelServerComponent = FieldLabelServerComponent<\n ArrayField,\n ArrayFieldClientWithoutType\n>\n\nexport type ArrayFieldLabelClientComponent = FieldLabelClientComponent<ArrayFieldClientWithoutType>\n\nexport type ArrayFieldDescriptionServerComponent = FieldDescriptionServerComponent<\n ArrayField,\n ArrayFieldClientWithoutType\n>\n\nexport type ArrayFieldDescriptionClientComponent =\n FieldDescriptionClientComponent<ArrayFieldClientWithoutType>\n\nexport type ArrayFieldErrorServerComponent = FieldErrorServerComponent<\n ArrayField,\n ArrayFieldClientWithoutType\n>\n\nexport type ArrayFieldErrorClientComponent = FieldErrorClientComponent<ArrayFieldClientWithoutType>\n"],"names":[],"mappings":"AA6DA,WAAmG"}
1
+ {"version":3,"sources":["../../../src/admin/fields/Array.ts"],"sourcesContent":["import type { MarkOptional } from 'ts-essentials'\n\nimport type { ArrayField, ArrayFieldClient, ClientField } from '../../fields/config/types.js'\nimport type { ArrayFieldValidation } from '../../fields/validations.js'\nimport type { FieldErrorClientComponent, FieldErrorServerComponent } from '../forms/Error.js'\nimport type {\n ClientFieldBase,\n FieldClientComponent,\n FieldPaths,\n FieldServerComponent,\n ServerFieldBase,\n} from '../forms/Field.js'\nimport type {\n FieldDescriptionClientComponent,\n FieldDescriptionServerComponent,\n FieldLabelClientComponent,\n FieldLabelServerComponent,\n} from '../types.js'\n\ntype ArrayFieldClientWithoutType = MarkOptional<ArrayFieldClient, 'type'>\n\ntype ArrayFieldBaseClientProps = {\n readonly validate?: ArrayFieldValidation\n} & FieldPaths\n\nexport type ArrayFieldClientProps = ArrayFieldBaseClientProps &\n ClientFieldBase<ArrayFieldClientWithoutType>\n\nexport type ArrayFieldServerProps = ServerFieldBase<ArrayField, ArrayFieldClientWithoutType>\n\nexport type ArrayFieldServerComponent = FieldServerComponent<\n ArrayField,\n ArrayFieldClientWithoutType\n>\n\nexport type ArrayFieldClientComponent = FieldClientComponent<\n ArrayFieldClientWithoutType,\n ArrayFieldBaseClientProps\n>\n\nexport type ArrayFieldLabelServerComponent = FieldLabelServerComponent<\n ArrayField,\n ArrayFieldClientWithoutType\n>\n\nexport type ArrayFieldLabelClientComponent = FieldLabelClientComponent<ArrayFieldClientWithoutType>\n\nexport type ArrayFieldDescriptionServerComponent = FieldDescriptionServerComponent<\n ArrayField,\n ArrayFieldClientWithoutType\n>\n\nexport type ArrayFieldDescriptionClientComponent =\n FieldDescriptionClientComponent<ArrayFieldClientWithoutType>\n\nexport type ArrayFieldErrorServerComponent = FieldErrorServerComponent<\n ArrayField,\n ArrayFieldClientWithoutType\n>\n\nexport type ArrayFieldErrorClientComponent = FieldErrorClientComponent<ArrayFieldClientWithoutType>\n"],"names":[],"mappings":"AA4DA,WAAmG"}
@@ -7,7 +7,7 @@ import type { FieldDescriptionClientComponent, FieldDescriptionServerComponent,
7
7
  type BlocksFieldClientWithoutType = MarkOptional<BlocksFieldClient, 'type'>;
8
8
  type BlocksFieldBaseClientProps = {
9
9
  readonly validate?: BlocksFieldValidation;
10
- } & FieldPaths & Pick<ServerFieldBase, 'permissions'>;
10
+ } & FieldPaths;
11
11
  export type BlocksFieldClientProps = BlocksFieldBaseClientProps & ClientFieldBase<BlocksFieldClientWithoutType>;
12
12
  export type BlocksFieldServerProps = ServerFieldBase<BlocksField, BlocksFieldClientWithoutType>;
13
13
  export type BlocksFieldServerComponent = FieldServerComponent<BlocksField, BlocksFieldClientWithoutType>;
@@ -1 +1 @@
1
- {"version":3,"file":"Blocks.d.ts","sourceRoot":"","sources":["../../../src/admin/fields/Blocks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAClF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AACxE,OAAO,KAAK,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAC7F,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,UAAU,EACV,oBAAoB,EACpB,eAAe,EAChB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACV,+BAA+B,EAC/B,+BAA+B,EAC/B,yBAAyB,EACzB,yBAAyB,EAC1B,MAAM,aAAa,CAAA;AAEpB,KAAK,4BAA4B,GAAG,YAAY,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAA;AAE3E,KAAK,0BAA0B,GAAG;IAChC,QAAQ,CAAC,QAAQ,CAAC,EAAE,qBAAqB,CAAA;CAC1C,GAAG,UAAU,GACZ,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,CAAA;AAEtC,MAAM,MAAM,sBAAsB,GAAG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AC/B,yBAAyB,EACzB,yBAAyB,EAC1B,MAAM,aAAa,CAAA;AAEpB,KAAK,4BAA4B,GAAG,YAAY,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAA;AAE3E,KAAK,0BAA0B,GAAG;IAChC,QAAQ,CAAC,QAAQ,CAAC,EAAE,qBAAqB,CAAA;CAC1C,GAAG,UAAU,CAAA;AAEd,MAAM,MAAM,sBAAsB,GAAG,0BAA0B,GAC7D,eAAe,CAAC,4BAA4B,CAAC,CAAA;AAE/C,MAAM,MAAM,sBAAsB,GAAG,eAAe,CAAC,WAAW,EAAE,4BAA4B,CAAC,CAAA;AAE/F,MAAM,MAAM,0BAA0B,GAAG,oBAAoB,CAC3D,WAAW,EACX,4BAA4B,CAC7B,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG,oBAAoB,CAC3D,4BAA4B,EAC5B,0BAA0B,CAC3B,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG,yBAAyB,CACrE,WAAW,EACX,4BAA4B,CAC7B,CAAA;AAED,MAAM,MAAM,+BAA+B,GACzC,yBAAyB,CAAC,4BAA4B,CAAC,CAAA;AAEzD,MAAM,MAAM,qCAAqC,GAAG,+BAA+B,CACjF,WAAW,EACX,4BAA4B,CAC7B,CAAA;AAED,MAAM,MAAM,qCAAqC,GAC/C,+BAA+B,CAAC,4BAA4B,CAAC,CAAA;AAE/D,MAAM,MAAM,+BAA+B,GAAG,yBAAyB,CACrE,WAAW,EACX,4BAA4B,CAC7B,CAAA;AAED,MAAM,MAAM,+BAA+B,GACzC,yBAAyB,CAAC,4BAA4B,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/admin/fields/Blocks.ts"],"sourcesContent":["import type { MarkOptional } from 'ts-essentials'\n\nimport type { BlocksField, BlocksFieldClient } from '../../fields/config/types.js'\nimport type { BlocksFieldValidation } from '../../fields/validations.js'\nimport type { FieldErrorClientComponent, FieldErrorServerComponent } from '../forms/Error.js'\nimport type {\n ClientFieldBase,\n FieldClientComponent,\n FieldPaths,\n FieldServerComponent,\n ServerFieldBase,\n} from '../forms/Field.js'\nimport type {\n FieldDescriptionClientComponent,\n FieldDescriptionServerComponent,\n FieldLabelClientComponent,\n FieldLabelServerComponent,\n} from '../types.js'\n\ntype BlocksFieldClientWithoutType = MarkOptional<BlocksFieldClient, 'type'>\n\ntype BlocksFieldBaseClientProps = {\n readonly validate?: BlocksFieldValidation\n} & FieldPaths &\n Pick<ServerFieldBase, 'permissions'>\n\nexport type BlocksFieldClientProps = BlocksFieldBaseClientProps &\n ClientFieldBase<BlocksFieldClientWithoutType>\n\nexport type BlocksFieldServerProps = ServerFieldBase<BlocksField, BlocksFieldClientWithoutType>\n\nexport type BlocksFieldServerComponent = FieldServerComponent<\n BlocksField,\n BlocksFieldClientWithoutType\n>\n\nexport type BlocksFieldClientComponent = FieldClientComponent<\n BlocksFieldClientWithoutType,\n BlocksFieldBaseClientProps\n>\n\nexport type BlocksFieldLabelServerComponent = FieldLabelServerComponent<\n BlocksField,\n BlocksFieldClientWithoutType\n>\n\nexport type BlocksFieldLabelClientComponent =\n FieldLabelClientComponent<BlocksFieldClientWithoutType>\n\nexport type BlocksFieldDescriptionServerComponent = FieldDescriptionServerComponent<\n BlocksField,\n BlocksFieldClientWithoutType\n>\n\nexport type BlocksFieldDescriptionClientComponent =\n FieldDescriptionClientComponent<BlocksFieldClientWithoutType>\n\nexport type BlocksFieldErrorServerComponent = FieldErrorServerComponent<\n BlocksField,\n BlocksFieldClientWithoutType\n>\n\nexport type BlocksFieldErrorClientComponent =\n FieldErrorClientComponent<BlocksFieldClientWithoutType>\n"],"names":[],"mappings":"AA8DA,WACyD"}
1
+ {"version":3,"sources":["../../../src/admin/fields/Blocks.ts"],"sourcesContent":["import type { MarkOptional } from 'ts-essentials'\n\nimport type { BlocksField, BlocksFieldClient } from '../../fields/config/types.js'\nimport type { BlocksFieldValidation } from '../../fields/validations.js'\nimport type { FieldErrorClientComponent, FieldErrorServerComponent } from '../forms/Error.js'\nimport type {\n ClientFieldBase,\n FieldClientComponent,\n FieldPaths,\n FieldServerComponent,\n ServerFieldBase,\n} from '../forms/Field.js'\nimport type {\n FieldDescriptionClientComponent,\n FieldDescriptionServerComponent,\n FieldLabelClientComponent,\n FieldLabelServerComponent,\n} from '../types.js'\n\ntype BlocksFieldClientWithoutType = MarkOptional<BlocksFieldClient, 'type'>\n\ntype BlocksFieldBaseClientProps = {\n readonly validate?: BlocksFieldValidation\n} & FieldPaths\n\nexport type BlocksFieldClientProps = BlocksFieldBaseClientProps &\n ClientFieldBase<BlocksFieldClientWithoutType>\n\nexport type BlocksFieldServerProps = ServerFieldBase<BlocksField, BlocksFieldClientWithoutType>\n\nexport type BlocksFieldServerComponent = FieldServerComponent<\n BlocksField,\n BlocksFieldClientWithoutType\n>\n\nexport type BlocksFieldClientComponent = FieldClientComponent<\n BlocksFieldClientWithoutType,\n BlocksFieldBaseClientProps\n>\n\nexport type BlocksFieldLabelServerComponent = FieldLabelServerComponent<\n BlocksField,\n BlocksFieldClientWithoutType\n>\n\nexport type BlocksFieldLabelClientComponent =\n FieldLabelClientComponent<BlocksFieldClientWithoutType>\n\nexport type BlocksFieldDescriptionServerComponent = FieldDescriptionServerComponent<\n BlocksField,\n BlocksFieldClientWithoutType\n>\n\nexport type BlocksFieldDescriptionClientComponent =\n FieldDescriptionClientComponent<BlocksFieldClientWithoutType>\n\nexport type BlocksFieldErrorServerComponent = FieldErrorServerComponent<\n BlocksField,\n BlocksFieldClientWithoutType\n>\n\nexport type BlocksFieldErrorClientComponent =\n FieldErrorClientComponent<BlocksFieldClientWithoutType>\n"],"names":[],"mappings":"AA6DA,WACyD"}
@@ -3,7 +3,7 @@ import type { CollapsibleField, CollapsibleFieldClient } from '../../fields/conf
3
3
  import type { FieldErrorClientComponent, FieldErrorServerComponent } from '../forms/Error.js';
4
4
  import type { ClientFieldBase, FieldClientComponent, FieldPaths, FieldServerComponent, ServerFieldBase } from '../forms/Field.js';
5
5
  import type { FieldDescriptionClientComponent, FieldDescriptionServerComponent, FieldLabelClientComponent, FieldLabelServerComponent } from '../types.js';
6
- type CollapsibleFieldBaseClientProps = FieldPaths & Pick<ServerFieldBase, 'permissions'>;
6
+ type CollapsibleFieldBaseClientProps = FieldPaths;
7
7
  type CollapsibleFieldClientWithoutType = MarkOptional<CollapsibleFieldClient, 'type'>;
8
8
  export type CollapsibleFieldClientProps = ClientFieldBase<CollapsibleFieldClientWithoutType> & CollapsibleFieldBaseClientProps;
9
9
  export type CollapsibleFieldServerProps = ServerFieldBase<CollapsibleField, CollapsibleFieldClientWithoutType>;
@@ -1 +1 @@
1
- {"version":3,"file":"Collapsible.d.ts","sourceRoot":"","sources":["../../../src/admin/fields/Collapsible.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAC5F,OAAO,KAAK,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAC7F,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,UAAU,EACV,oBAAoB,EACpB,eAAe,EAChB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACV,+BAA+B,EAC/B,+BAA+B,EAC/B,yBAAyB,EACzB,yBAAyB,EAC1B,MAAM,aAAa,CAAA;AAEpB,KAAK,+BAA+B,GAAG,UAAU,GAAG,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,CAAA;AAExF,KAAK,iCAAiC,GAAG,YAAY,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAA;AAErF,MAAM,MAAM,2BAA2B,GAAG,eAAe,CAAC,iCAAiC,CAAC,GAC1F,+BAA+B,CAAA;AAEjC,MAAM,MAAM,2BAA2B,GAAG,eAAe,CACvD,gBAAgB,EAChB,iCAAiC,CAClC,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG,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AAC,iCAAiC,CAAC,GAC1F,+BAA+B,CAAA;AAEjC,MAAM,MAAM,2BAA2B,GAAG,eAAe,CACvD,gBAAgB,EAChB,iCAAiC,CAClC,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG,oBAAoB,CAChE,gBAAgB,EAChB,iCAAiC,CAClC,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG,oBAAoB,CAChE,iCAAiC,EACjC,+BAA+B,CAChC,CAAA;AAED,MAAM,MAAM,oCAAoC,GAAG,yBAAyB,CAC1E,gBAAgB,EAChB,iCAAiC,CAClC,CAAA;AAED,MAAM,MAAM,oCAAoC,GAC9C,yBAAyB,CAAC,iCAAiC,CAAC,CAAA;AAE9D,MAAM,MAAM,0CAA0C,GAAG,+BAA+B,CACtF,gBAAgB,EAChB,iCAAiC,CAClC,CAAA;AAED,MAAM,MAAM,0CAA0C,GACpD,+BAA+B,CAAC,iCAAiC,CAAC,CAAA;AAEpE,MAAM,MAAM,oCAAoC,GAAG,yBAAyB,CAC1E,gBAAgB,EAChB,iCAAiC,CAClC,CAAA;AAED,MAAM,MAAM,oCAAoC,GAC9C,yBAAyB,CAAC,iCAAiC,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/admin/fields/Collapsible.ts"],"sourcesContent":["import type { MarkOptional } from 'ts-essentials'\n\nimport type { CollapsibleField, CollapsibleFieldClient } from '../../fields/config/types.js'\nimport type { FieldErrorClientComponent, FieldErrorServerComponent } from '../forms/Error.js'\nimport type {\n ClientFieldBase,\n FieldClientComponent,\n FieldPaths,\n FieldServerComponent,\n ServerFieldBase,\n} from '../forms/Field.js'\nimport type {\n FieldDescriptionClientComponent,\n FieldDescriptionServerComponent,\n FieldLabelClientComponent,\n FieldLabelServerComponent,\n} from '../types.js'\n\ntype CollapsibleFieldBaseClientProps = FieldPaths & Pick<ServerFieldBase, 'permissions'>\n\ntype CollapsibleFieldClientWithoutType = MarkOptional<CollapsibleFieldClient, 'type'>\n\nexport type CollapsibleFieldClientProps = ClientFieldBase<CollapsibleFieldClientWithoutType> &\n CollapsibleFieldBaseClientProps\n\nexport type CollapsibleFieldServerProps = ServerFieldBase<\n CollapsibleField,\n CollapsibleFieldClientWithoutType\n>\n\nexport type CollapsibleFieldServerComponent = FieldServerComponent<\n CollapsibleField,\n CollapsibleFieldClientWithoutType\n>\n\nexport type CollapsibleFieldClientComponent = FieldClientComponent<\n CollapsibleFieldClientWithoutType,\n CollapsibleFieldBaseClientProps\n>\n\nexport type CollapsibleFieldLabelServerComponent = FieldLabelServerComponent<\n CollapsibleField,\n CollapsibleFieldClientWithoutType\n>\n\nexport type CollapsibleFieldLabelClientComponent =\n FieldLabelClientComponent<CollapsibleFieldClientWithoutType>\n\nexport type CollapsibleFieldDescriptionServerComponent = FieldDescriptionServerComponent<\n CollapsibleField,\n CollapsibleFieldClientWithoutType\n>\n\nexport type CollapsibleFieldDescriptionClientComponent =\n FieldDescriptionClientComponent<CollapsibleFieldClientWithoutType>\n\nexport type CollapsibleFieldErrorServerComponent = FieldErrorServerComponent<\n CollapsibleField,\n CollapsibleFieldClientWithoutType\n>\n\nexport type CollapsibleFieldErrorClientComponent =\n FieldErrorClientComponent<CollapsibleFieldClientWithoutType>\n"],"names":[],"mappings":"AA6DA,WAC8D"}
1
+ {"version":3,"sources":["../../../src/admin/fields/Collapsible.ts"],"sourcesContent":["import type { MarkOptional } from 'ts-essentials'\n\nimport type { CollapsibleField, CollapsibleFieldClient } from '../../fields/config/types.js'\nimport type { FieldErrorClientComponent, FieldErrorServerComponent } from '../forms/Error.js'\nimport type {\n ClientFieldBase,\n FieldClientComponent,\n FieldPaths,\n FieldServerComponent,\n ServerFieldBase,\n} from '../forms/Field.js'\nimport type {\n FieldDescriptionClientComponent,\n FieldDescriptionServerComponent,\n FieldLabelClientComponent,\n FieldLabelServerComponent,\n} from '../types.js'\n\ntype CollapsibleFieldBaseClientProps = FieldPaths\n\ntype CollapsibleFieldClientWithoutType = MarkOptional<CollapsibleFieldClient, 'type'>\n\nexport type CollapsibleFieldClientProps = ClientFieldBase<CollapsibleFieldClientWithoutType> &\n CollapsibleFieldBaseClientProps\n\nexport type CollapsibleFieldServerProps = ServerFieldBase<\n CollapsibleField,\n CollapsibleFieldClientWithoutType\n>\n\nexport type CollapsibleFieldServerComponent = FieldServerComponent<\n CollapsibleField,\n CollapsibleFieldClientWithoutType\n>\n\nexport type CollapsibleFieldClientComponent = FieldClientComponent<\n CollapsibleFieldClientWithoutType,\n CollapsibleFieldBaseClientProps\n>\n\nexport type CollapsibleFieldLabelServerComponent = FieldLabelServerComponent<\n CollapsibleField,\n CollapsibleFieldClientWithoutType\n>\n\nexport type CollapsibleFieldLabelClientComponent =\n FieldLabelClientComponent<CollapsibleFieldClientWithoutType>\n\nexport type CollapsibleFieldDescriptionServerComponent = FieldDescriptionServerComponent<\n CollapsibleField,\n CollapsibleFieldClientWithoutType\n>\n\nexport type CollapsibleFieldDescriptionClientComponent =\n FieldDescriptionClientComponent<CollapsibleFieldClientWithoutType>\n\nexport type CollapsibleFieldErrorServerComponent = FieldErrorServerComponent<\n CollapsibleField,\n CollapsibleFieldClientWithoutType\n>\n\nexport type CollapsibleFieldErrorClientComponent =\n FieldErrorClientComponent<CollapsibleFieldClientWithoutType>\n"],"names":[],"mappings":"AA6DA,WAC8D"}
@@ -4,7 +4,7 @@ import type { FieldErrorClientComponent, FieldErrorServerComponent } from '../fo
4
4
  import type { ClientFieldBase, FieldClientComponent, FieldPaths, FieldServerComponent, ServerFieldBase } from '../forms/Field.js';
5
5
  import type { FieldDescriptionClientComponent, FieldDescriptionServerComponent, FieldLabelClientComponent, FieldLabelServerComponent } from '../types.js';
6
6
  type GroupFieldClientWithoutType = MarkOptional<GroupFieldClient, 'type'>;
7
- export type GroupFieldBaseClientProps = FieldPaths & Pick<ServerFieldBase, 'permissions'>;
7
+ export type GroupFieldBaseClientProps = FieldPaths;
8
8
  export type GroupFieldClientProps = ClientFieldBase<GroupFieldClientWithoutType> & GroupFieldBaseClientProps;
9
9
  export type GroupFieldServerProps = ServerFieldBase<GroupField, GroupFieldClientWithoutType>;
10
10
  export type GroupFieldServerComponent = FieldServerComponent<GroupField, GroupFieldClientWithoutType>;
@@ -1 +1 @@
1
- {"version":3,"file":"Group.d.ts","sourceRoot":"","sources":["../../../src/admin/fields/Group.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAChF,OAAO,KAAK,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAC7F,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,UAAU,EACV,oBAAoB,EACpB,eAAe,EAChB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACV,+BAA+B,EAC/B,+BAA+B,EAC/B,yBAAyB,EACzB,yBAAyB,EAC1B,MAAM,aAAa,CAAA;AAEpB,KAAK,2BAA2B,GAAG,YAAY,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAA;AAEzE,MAAM,MAAM,yBAAyB,GAAG,UAAU,GAAG,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,CAAA;AAEzF,MAAM,MAAM,qBAAqB,GAAG,eAAe,CAAC,2BAA2B,CAAC,GAC9E,yBAAyB,CAAA;AAE3B,MAAM,MAAM,qBAAqB,GAAG,eAAe,CAAC,UAAU,EAAE,2BAA2B,CAAC,CAAA;AAE5F,MAAM,MAAM,yBAAyB,GAAG,oBAAoB,CAC1D,UAAU,EACV,2BAA2B,CAC5B,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG,oBAAoB,CAC1D,2BAA2B,EAC3B,yBAAyB,CAC1B,CAAA;AAED,MAAM,MAAM,8BAA8B,GAAG,yBAAyB,CACpE,UAAU,EACV,2BAA2B,CAC5B,CAAA;AAED,MAAM,MAAM,8BAA8B,GAAG,yBAAyB,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yBAAyB,CAC1B,CAAA;AAED,MAAM,MAAM,8BAA8B,GAAG,yBAAyB,CACpE,UAAU,EACV,2BAA2B,CAC5B,CAAA;AAED,MAAM,MAAM,8BAA8B,GAAG,yBAAyB,CAAC,2BAA2B,CAAC,CAAA;AAEnG,MAAM,MAAM,oCAAoC,GAAG,+BAA+B,CAChF,UAAU,EACV,2BAA2B,CAC5B,CAAA;AAED,MAAM,MAAM,oCAAoC,GAC9C,+BAA+B,CAAC,2BAA2B,CAAC,CAAA;AAE9D,MAAM,MAAM,8BAA8B,GAAG,yBAAyB,CACpE,UAAU,EACV,2BAA2B,CAC5B,CAAA;AAED,MAAM,MAAM,8BAA8B,GAAG,yBAAyB,CAAC,2BAA2B,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/admin/fields/Group.ts"],"sourcesContent":["import type { MarkOptional } from 'ts-essentials'\n\nimport type { GroupField, GroupFieldClient } from '../../fields/config/types.js'\nimport type { FieldErrorClientComponent, FieldErrorServerComponent } from '../forms/Error.js'\nimport type {\n ClientFieldBase,\n FieldClientComponent,\n FieldPaths,\n FieldServerComponent,\n ServerFieldBase,\n} from '../forms/Field.js'\nimport type {\n FieldDescriptionClientComponent,\n FieldDescriptionServerComponent,\n FieldLabelClientComponent,\n FieldLabelServerComponent,\n} from '../types.js'\n\ntype GroupFieldClientWithoutType = MarkOptional<GroupFieldClient, 'type'>\n\nexport type GroupFieldBaseClientProps = FieldPaths & Pick<ServerFieldBase, 'permissions'>\n\nexport type GroupFieldClientProps = ClientFieldBase<GroupFieldClientWithoutType> &\n GroupFieldBaseClientProps\n\nexport type GroupFieldServerProps = ServerFieldBase<GroupField, GroupFieldClientWithoutType>\n\nexport type GroupFieldServerComponent = FieldServerComponent<\n GroupField,\n GroupFieldClientWithoutType\n>\n\nexport type GroupFieldClientComponent = FieldClientComponent<\n GroupFieldClientWithoutType,\n GroupFieldBaseClientProps\n>\n\nexport type GroupFieldLabelServerComponent = FieldLabelServerComponent<\n GroupField,\n GroupFieldClientWithoutType\n>\n\nexport type GroupFieldLabelClientComponent = FieldLabelClientComponent<GroupFieldClientWithoutType>\n\nexport type GroupFieldDescriptionServerComponent = FieldDescriptionServerComponent<\n GroupField,\n GroupFieldClientWithoutType\n>\n\nexport type GroupFieldDescriptionClientComponent =\n FieldDescriptionClientComponent<GroupFieldClientWithoutType>\n\nexport type GroupFieldErrorServerComponent = FieldErrorServerComponent<\n GroupField,\n GroupFieldClientWithoutType\n>\n\nexport type GroupFieldErrorClientComponent = FieldErrorClientComponent<GroupFieldClientWithoutType>\n"],"names":[],"mappings":"AAyDA,WAAmG"}
1
+ {"version":3,"sources":["../../../src/admin/fields/Group.ts"],"sourcesContent":["import type { MarkOptional } from 'ts-essentials'\n\nimport type { GroupField, GroupFieldClient } from '../../fields/config/types.js'\nimport type { FieldErrorClientComponent, FieldErrorServerComponent } from '../forms/Error.js'\nimport type {\n ClientFieldBase,\n FieldClientComponent,\n FieldPaths,\n FieldServerComponent,\n ServerFieldBase,\n} from '../forms/Field.js'\nimport type {\n FieldDescriptionClientComponent,\n FieldDescriptionServerComponent,\n FieldLabelClientComponent,\n FieldLabelServerComponent,\n} from '../types.js'\n\ntype GroupFieldClientWithoutType = MarkOptional<GroupFieldClient, 'type'>\n\nexport type GroupFieldBaseClientProps = FieldPaths\n\nexport type GroupFieldClientProps = ClientFieldBase<GroupFieldClientWithoutType> &\n GroupFieldBaseClientProps\n\nexport type GroupFieldServerProps = ServerFieldBase<GroupField, GroupFieldClientWithoutType>\n\nexport type GroupFieldServerComponent = FieldServerComponent<\n GroupField,\n GroupFieldClientWithoutType\n>\n\nexport type GroupFieldClientComponent = FieldClientComponent<\n GroupFieldClientWithoutType,\n GroupFieldBaseClientProps\n>\n\nexport type GroupFieldLabelServerComponent = FieldLabelServerComponent<\n GroupField,\n GroupFieldClientWithoutType\n>\n\nexport type GroupFieldLabelClientComponent = FieldLabelClientComponent<GroupFieldClientWithoutType>\n\nexport type GroupFieldDescriptionServerComponent = FieldDescriptionServerComponent<\n GroupField,\n GroupFieldClientWithoutType\n>\n\nexport type GroupFieldDescriptionClientComponent =\n FieldDescriptionClientComponent<GroupFieldClientWithoutType>\n\nexport type GroupFieldErrorServerComponent = FieldErrorServerComponent<\n GroupField,\n GroupFieldClientWithoutType\n>\n\nexport type GroupFieldErrorClientComponent = FieldErrorClientComponent<GroupFieldClientWithoutType>\n"],"names":[],"mappings":"AAyDA,WAAmG"}
@@ -5,7 +5,7 @@ import type { FieldDescriptionClientComponent, FieldDescriptionServerComponent,
5
5
  type RowFieldClientWithoutType = MarkOptional<RowFieldClient, 'type'>;
6
6
  type RowFieldBaseClientProps = {
7
7
  readonly forceRender?: boolean;
8
- } & Omit<FieldPaths, 'path'> & Pick<ServerFieldBase, 'permissions'>;
8
+ } & Omit<FieldPaths, 'path'>;
9
9
  export type RowFieldClientProps = Omit<ClientFieldBase<RowFieldClientWithoutType>, 'path'> & RowFieldBaseClientProps;
10
10
  export type RowFieldServerProps = ServerFieldBase<RowField, RowFieldClientWithoutType>;
11
11
  export type RowFieldServerComponent = FieldServerComponent<RowField, RowFieldClientWithoutType>;
@@ -1 +1 @@
1
- {"version":3,"file":"Row.d.ts","sourceRoot":"","sources":["../../../src/admin/fields/Row.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC5E,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,UAAU,EACV,oBAAoB,EACpB,eAAe,EAChB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACV,+BAA+B,EAC/B,+BAA+B,EAC/B,yBAAyB,EACzB,yBAAyB,EACzB,yBAAyB,EACzB,yBAAyB,EAC1B,MAAM,aAAa,CAAA;AAEpB,KAAK,yBAAyB,GAAG,YAAY,CAAC,cAAc,EAAE,MAAM,CAAC,CAAA;A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/Row.ts"],"sourcesContent":["import type { MarkOptional } from 'ts-essentials'\n\nimport type { RowField, RowFieldClient } from '../../fields/config/types.js'\nimport type {\n ClientFieldBase,\n FieldClientComponent,\n FieldPaths,\n FieldServerComponent,\n ServerFieldBase,\n} from '../forms/Field.js'\nimport type {\n FieldDescriptionClientComponent,\n FieldDescriptionServerComponent,\n FieldErrorClientComponent,\n FieldErrorServerComponent,\n FieldLabelClientComponent,\n FieldLabelServerComponent,\n} from '../types.js'\n\ntype RowFieldClientWithoutType = MarkOptional<RowFieldClient, 'type'>\n\ntype RowFieldBaseClientProps = {\n readonly forceRender?: boolean\n} & Omit<FieldPaths, 'path'> &\n Pick<ServerFieldBase, 'permissions'>\n\nexport type RowFieldClientProps = Omit<ClientFieldBase<RowFieldClientWithoutType>, 'path'> &\n RowFieldBaseClientProps\n\nexport type RowFieldServerProps = ServerFieldBase<RowField, RowFieldClientWithoutType>\n\nexport type RowFieldServerComponent = FieldServerComponent<RowField, RowFieldClientWithoutType>\n\nexport type RowFieldClientComponent = FieldClientComponent<\n RowFieldClientWithoutType,\n RowFieldBaseClientProps\n>\n\nexport type RowFieldLabelServerComponent = FieldLabelServerComponent<\n RowField,\n RowFieldClientWithoutType\n>\n\nexport type RowFieldLabelClientComponent = FieldLabelClientComponent<RowFieldClientWithoutType>\n\nexport type RowFieldDescriptionServerComponent = FieldDescriptionServerComponent<\n RowField,\n RowFieldClientWithoutType\n>\n\nexport type RowFieldDescriptionClientComponent =\n FieldDescriptionClientComponent<RowFieldClientWithoutType>\n\nexport type RowFieldErrorServerComponent = FieldErrorServerComponent<\n RowField,\n RowFieldClientWithoutType\n>\n\nexport type RowFieldErrorClientComponent = FieldErrorClientComponent<RowFieldClientWithoutType>\n"],"names":[],"mappings":"AA0DA,WAA+F"}
1
+ {"version":3,"sources":["../../../src/admin/fields/Row.ts"],"sourcesContent":["import type { MarkOptional } from 'ts-essentials'\n\nimport type { RowField, RowFieldClient } from '../../fields/config/types.js'\nimport type {\n ClientFieldBase,\n FieldClientComponent,\n FieldPaths,\n FieldServerComponent,\n ServerFieldBase,\n} from '../forms/Field.js'\nimport type {\n FieldDescriptionClientComponent,\n FieldDescriptionServerComponent,\n FieldErrorClientComponent,\n FieldErrorServerComponent,\n FieldLabelClientComponent,\n FieldLabelServerComponent,\n} from '../types.js'\n\ntype RowFieldClientWithoutType = MarkOptional<RowFieldClient, 'type'>\n\ntype RowFieldBaseClientProps = {\n readonly forceRender?: boolean\n} & Omit<FieldPaths, 'path'>\n\nexport type RowFieldClientProps = Omit<ClientFieldBase<RowFieldClientWithoutType>, 'path'> &\n RowFieldBaseClientProps\n\nexport type RowFieldServerProps = ServerFieldBase<RowField, RowFieldClientWithoutType>\n\nexport type RowFieldServerComponent = FieldServerComponent<RowField, RowFieldClientWithoutType>\n\nexport type RowFieldClientComponent = FieldClientComponent<\n RowFieldClientWithoutType,\n RowFieldBaseClientProps\n>\n\nexport type RowFieldLabelServerComponent = FieldLabelServerComponent<\n RowField,\n RowFieldClientWithoutType\n>\n\nexport type RowFieldLabelClientComponent = FieldLabelClientComponent<RowFieldClientWithoutType>\n\nexport type RowFieldDescriptionServerComponent = FieldDescriptionServerComponent<\n RowField,\n RowFieldClientWithoutType\n>\n\nexport type RowFieldDescriptionClientComponent =\n FieldDescriptionClientComponent<RowFieldClientWithoutType>\n\nexport type RowFieldErrorServerComponent = FieldErrorServerComponent<\n RowField,\n RowFieldClientWithoutType\n>\n\nexport type RowFieldErrorClientComponent = FieldErrorClientComponent<RowFieldClientWithoutType>\n"],"names":[],"mappings":"AAyDA,WAA+F"}
@@ -9,7 +9,7 @@ export type ClientTab = ({
9
9
  } & Omit<NamedTab, 'fields'>) | ({
10
10
  fields: ClientField[];
11
11
  } & Omit<UnnamedTab, 'fields'>);
12
- type TabsFieldBaseClientProps = FieldPaths & Pick<ServerFieldBase, 'permissions'>;
12
+ type TabsFieldBaseClientProps = FieldPaths;
13
13
  type TabsFieldClientWithoutType = MarkOptional<TabsFieldClient, 'type'>;
14
14
  export type TabsFieldClientProps = ClientFieldBase<TabsFieldClientWithoutType> & TabsFieldBaseClientProps;
15
15
  export type TabsFieldServerProps = ServerFieldBase<TabsField, TabsFieldClientWithoutType>;
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/admin/fields/Tabs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,KAAK,EACV,WAAW,EACX,QAAQ,EACR,SAAS,EACT,eAAe,EACf,UAAU,EACX,MAAM,8BAA8B,CAAA;AACrC,OAAO,KAAK,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAC7F,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,UAAU,EACV,oBAAoB,EACpB,eAAe,EAChB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACV,+BAA+B,EAC/B,+BAA+B,EAC/B,yBAAyB,EACzB,yBAAyB,EAC1B,MAAM,aAAa,CAAA;AAEpB,MAAM,MAAM,SAAS,GACjB,CAAC;IAAE,MAAM,EAAE,WAAW,EAAE,CAAC;IAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,GAC9E,CAAC;IAAE,MAAM,EAAE,WAAW,EAAE,CAAA;CAAE,GAAG,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAA;AAE5D,KAAK,wBAAwB,GAAG,UAAU,GAAG,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,CAAA;AAEjF,KAAK,0BAA0B,GAAG,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAA;AAEvE,MAAM,MAAM,oBAAoB,GAAG,eAAe,CAAC,0BAA0B,CAAC,GAC5E,wBAAwB,CAAA;AAE1B,MAAM,MAAM,oBAAoB,GAAG,eAAe,CAAC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;IAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,GAC9E,CAAC;IAAE,MAAM,EAAE,WAAW,EAAE,CAAA;CAAE,GAAG,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAA;AAE5D,KAAK,wBAAwB,GAAG,UAAU,CAAA;AAE1C,KAAK,0BAA0B,GAAG,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAA;AAEvE,MAAM,MAAM,oBAAoB,GAAG,eAAe,CAAC,0BAA0B,CAAC,GAC5E,wBAAwB,CAAA;AAE1B,MAAM,MAAM,oBAAoB,GAAG,eAAe,CAAC,SAAS,EAAE,0BAA0B,CAAC,CAAA;AAEzF,MAAM,MAAM,wBAAwB,GAAG,oBAAoB,CAAC,SAAS,EAAE,0BAA0B,CAAC,CAAA;AAElG,MAAM,MAAM,wBAAwB,GAAG,oBAAoB,CACzD,0BAA0B,EAC1B,wBAAwB,CACzB,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG,yBAAyB,CACnE,SAAS,EACT,0BAA0B,CAC3B,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG,yBAAyB,CAAC,0BAA0B,CAAC,CAAA;AAEjG,MAAM,MAAM,mCAAmC,GAAG,+BAA+B,CAC/E,SAAS,EACT,0BAA0B,CAC3B,CAAA;AAED,MAAM,MAAM,mCAAmC,GAC7C,+BAA+B,CAAC,0BAA0B,CAAC,CAAA;AAE7D,MAAM,MAAM,6BAA6B,GAAG,yBAAyB,CACnE,SAAS,EACT,0BAA0B,CAC3B,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG,yBAAyB,CAAC,0BAA0B,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/admin/fields/Tabs.ts"],"sourcesContent":["import type { MarkOptional } from 'ts-essentials'\n\nimport type {\n ClientField,\n NamedTab,\n TabsField,\n TabsFieldClient,\n UnnamedTab,\n} from '../../fields/config/types.js'\nimport type { FieldErrorClientComponent, FieldErrorServerComponent } from '../forms/Error.js'\nimport type {\n ClientFieldBase,\n FieldClientComponent,\n FieldPaths,\n FieldServerComponent,\n ServerFieldBase,\n} from '../forms/Field.js'\nimport type {\n FieldDescriptionClientComponent,\n FieldDescriptionServerComponent,\n FieldLabelClientComponent,\n FieldLabelServerComponent,\n} from '../types.js'\n\nexport type ClientTab =\n | ({ fields: ClientField[]; readonly path?: string } & Omit<NamedTab, 'fields'>)\n | ({ fields: ClientField[] } & Omit<UnnamedTab, 'fields'>)\n\ntype TabsFieldBaseClientProps = FieldPaths & Pick<ServerFieldBase, 'permissions'>\n\ntype TabsFieldClientWithoutType = MarkOptional<TabsFieldClient, 'type'>\n\nexport type TabsFieldClientProps = ClientFieldBase<TabsFieldClientWithoutType> &\n TabsFieldBaseClientProps\n\nexport type TabsFieldServerProps = ServerFieldBase<TabsField, TabsFieldClientWithoutType>\n\nexport type TabsFieldServerComponent = FieldServerComponent<TabsField, TabsFieldClientWithoutType>\n\nexport type TabsFieldClientComponent = FieldClientComponent<\n TabsFieldClientWithoutType,\n TabsFieldBaseClientProps\n>\n\nexport type TabsFieldLabelServerComponent = FieldLabelServerComponent<\n TabsField,\n TabsFieldClientWithoutType\n>\n\nexport type TabsFieldLabelClientComponent = FieldLabelClientComponent<TabsFieldClientWithoutType>\n\nexport type TabsFieldDescriptionServerComponent = FieldDescriptionServerComponent<\n TabsField,\n TabsFieldClientWithoutType\n>\n\nexport type TabsFieldDescriptionClientComponent =\n FieldDescriptionClientComponent<TabsFieldClientWithoutType>\n\nexport type TabsFieldErrorServerComponent = FieldErrorServerComponent<\n TabsField,\n TabsFieldClientWithoutType\n>\n\nexport type TabsFieldErrorClientComponent = FieldErrorClientComponent<TabsFieldClientWithoutType>\n"],"names":[],"mappings":"AAgEA,WAAiG"}
1
+ {"version":3,"sources":["../../../src/admin/fields/Tabs.ts"],"sourcesContent":["import type { MarkOptional } from 'ts-essentials'\n\nimport type {\n ClientField,\n NamedTab,\n TabsField,\n TabsFieldClient,\n UnnamedTab,\n} from '../../fields/config/types.js'\nimport type { FieldErrorClientComponent, FieldErrorServerComponent } from '../forms/Error.js'\nimport type {\n ClientFieldBase,\n FieldClientComponent,\n FieldPaths,\n FieldServerComponent,\n ServerFieldBase,\n} from '../forms/Field.js'\nimport type {\n FieldDescriptionClientComponent,\n FieldDescriptionServerComponent,\n FieldLabelClientComponent,\n FieldLabelServerComponent,\n} from '../types.js'\n\nexport type ClientTab =\n | ({ fields: ClientField[]; readonly path?: string } & Omit<NamedTab, 'fields'>)\n | ({ fields: ClientField[] } & Omit<UnnamedTab, 'fields'>)\n\ntype TabsFieldBaseClientProps = FieldPaths\n\ntype TabsFieldClientWithoutType = MarkOptional<TabsFieldClient, 'type'>\n\nexport type TabsFieldClientProps = ClientFieldBase<TabsFieldClientWithoutType> &\n TabsFieldBaseClientProps\n\nexport type TabsFieldServerProps = ServerFieldBase<TabsField, TabsFieldClientWithoutType>\n\nexport type TabsFieldServerComponent = FieldServerComponent<TabsField, TabsFieldClientWithoutType>\n\nexport type TabsFieldClientComponent = FieldClientComponent<\n TabsFieldClientWithoutType,\n TabsFieldBaseClientProps\n>\n\nexport type TabsFieldLabelServerComponent = FieldLabelServerComponent<\n TabsField,\n TabsFieldClientWithoutType\n>\n\nexport type TabsFieldLabelClientComponent = FieldLabelClientComponent<TabsFieldClientWithoutType>\n\nexport type TabsFieldDescriptionServerComponent = FieldDescriptionServerComponent<\n TabsField,\n TabsFieldClientWithoutType\n>\n\nexport type TabsFieldDescriptionClientComponent =\n FieldDescriptionClientComponent<TabsFieldClientWithoutType>\n\nexport type TabsFieldErrorServerComponent = FieldErrorServerComponent<\n TabsField,\n TabsFieldClientWithoutType\n>\n\nexport type TabsFieldErrorClientComponent = FieldErrorClientComponent<TabsFieldClientWithoutType>\n"],"names":[],"mappings":"AAgEA,WAAiG"}
@@ -10,6 +10,7 @@ export type ClientComponentProps = {
10
10
  customComponents: FormField['customComponents'];
11
11
  field: ClientBlock | ClientField | ClientTab;
12
12
  forceRender?: boolean;
13
+ permissions?: SanitizedFieldPermissions;
13
14
  readOnly?: boolean;
14
15
  renderedBlocks?: RenderedField[];
15
16
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../../src/admin/forms/Field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,KAAK,EAAE,yBAAyB,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACnF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC9E,OAAO,KAAK,EACV,oBAAoB,EACpB,SAAS,EACT,IAAI,EACJ,cAAc,EACd,SAAS,EACT,SAAS,EACT,aAAa,EACd,MAAM,aAAa,CAAA;AAEpB,MAAM,MAAM,2BAA2B,GAAG,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;AAE3E,MAAM,MAAM,oBAAoB,GAAG;IACjC,gBAAgB,EAAE,SAAS,CAAC,kBAAkB,CAAC,CAAA;IAC/C,KAAK,EAAE,WAAW,GAAG,WAAW,GAAG,SAAS,CAAA;IAC5C,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,cAAc,CAAC,EAAE,aAAa,EAAE,CAAA;IAChC;;;;;QAKI;IACJ,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAGD,MAAM,MAAM,UAAU,GAAG;IACvB;;OAEG;IACH,SAAS,C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,CACzB,YAAY,SAAS,2BAA2B,GAAG,2BAA2B,IAC5E;IACF,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAA;CAC7B,GAAG,IAAI,CAAC,oBAAoB,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAA;AAE5D,MAAM,MAAM,eAAe,CACzB,YAAY,SAAS,KAAK,GAAG,KAAK,EAClC,YAAY,SAAS,2BAA2B,GAAG,2BAA2B,IAC5E;IACF,QAAQ,CAAC,WAAW,EAAE,YAAY,CAAA;IAClC,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAA;CAC7B,GAAG,IAAI,CAAC,oBAAoB,EAAE,OAAO,CAAC,GACrC,IAAI,CAAC,oBAAoB,EAAE,aAAa,GAAG,OAAO,CAAC,CAAA;AAErD,MAAM,MAAM,oBAAoB,CAC9B,YAAY,SAAS,2BAA2B,GAAG,2BAA2B,EAC9E,eAAe,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IACvE,KAAK,CAAC,aAAa,CAAC,eAAe,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC,CAAA;AAExE,MAAM,MAAM,oBAAoB,CAC9B,YAAY,SAAS,KAAK,GAAG,KAAK,EAClC,YAAY,SAAS,2BAA2B,GAAG,2BAA2B,EAC9E,eAAe,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IACvE,KAAK,CAAC,aAAa,CAAC,eAAe,GAAG,eAAe,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/admin/forms/Field.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { MarkOptional } from 'ts-essentials'\n\nimport type { SanitizedFieldPermissions, User } from '../../auth/types.js'\nimport type { ClientBlock, ClientField, Field } from '../../fields/config/types.js'\nimport type { DocumentPreferences } from '../../preferences/types.js'\nimport type { Operation, Payload, PayloadRequest } from '../../types/index.js'\nimport type {\n ClientFieldSchemaMap,\n ClientTab,\n Data,\n FieldSchemaMap,\n FormField,\n FormState,\n RenderedField,\n} from '../types.js'\n\nexport type ClientFieldWithOptionalType = MarkOptional<ClientField, 'type'>\n\nexport type ClientComponentProps = {\n customComponents: FormField['customComponents']\n field: ClientBlock | ClientField | ClientTab\n forceRender?: boolean\n readOnly?: boolean\n renderedBlocks?: RenderedField[]\n /**\n * Used to extract field configs from a schemaMap.\n * Does not include indexes.\n *\n * @default field.name\n **/\n schemaPath?: string\n}\n\n// TODO: maybe we can come up with a better name?\nexport type FieldPaths = {\n /**\n * @default ''\n */\n indexPath?: string\n /**\n * @default ''\n */\n parentPath?: string\n /**\n * The path built up to the point of the field\n * excluding the field name.\n *\n * @default ''\n */\n parentSchemaPath?: string\n /**\n * A built up path to access FieldState in the form state.\n * Nested fields will have a path that includes the parent field names\n * if they are nested within a group, array, block or named tab.\n *\n * Collapsibles and unnamed tabs will have arbitrary paths\n * that look like _index-0, _index-1, etc.\n *\n * Row fields will not have a path.\n *\n * @example 'parentGroupField.childTextField'\n *\n * @default field.name\n */\n path: string\n}\n\nexport type ServerComponentProps = {\n clientField: ClientFieldWithOptionalType\n clientFieldSchemaMap: ClientFieldSchemaMap\n collectionSlug: string\n data: Data\n field: Field\n /**\n * The fieldSchemaMap that is created before form state is built is made available here.\n */\n fieldSchemaMap: FieldSchemaMap\n /**\n * Server Components will also have available to the entire form state.\n * We cannot add it to ClientComponentProps as that would blow up the size of the props sent to the client.\n */\n formState: FormState\n i18n: I18nClient\n id?: number | string\n operation: Operation\n payload: Payload\n permissions: SanitizedFieldPermissions\n preferences: DocumentPreferences\n req: PayloadRequest\n siblingData: Data\n user: User\n}\n\nexport type ClientFieldBase<\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n> = {\n readonly field: TFieldClient\n} & Omit<ClientComponentProps, 'customComponents' | 'field'>\n\nexport type ServerFieldBase<\n TFieldServer extends Field = Field,\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n> = {\n readonly clientField: TFieldClient\n readonly field: TFieldServer\n} & Omit<ClientComponentProps, 'field'> &\n Omit<ServerComponentProps, 'clientField' | 'field'>\n\nexport type FieldClientComponent<\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n AdditionalProps extends Record<string, unknown> = Record<string, unknown>,\n> = React.ComponentType<AdditionalProps & ClientFieldBase<TFieldClient>>\n\nexport type FieldServerComponent<\n TFieldServer extends Field = Field,\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n AdditionalProps extends Record<string, unknown> = Record<string, unknown>,\n> = React.ComponentType<AdditionalProps & ServerFieldBase<TFieldServer, TFieldClient>>\n"],"names":[],"mappings":"AAkHA,WAIsF"}
1
+ {"version":3,"sources":["../../../src/admin/forms/Field.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { MarkOptional } from 'ts-essentials'\n\nimport type { SanitizedFieldPermissions, User } from '../../auth/types.js'\nimport type { ClientBlock, ClientField, Field } from '../../fields/config/types.js'\nimport type { DocumentPreferences } from '../../preferences/types.js'\nimport type { Operation, Payload, PayloadRequest } from '../../types/index.js'\nimport type {\n ClientFieldSchemaMap,\n ClientTab,\n Data,\n FieldSchemaMap,\n FormField,\n FormState,\n RenderedField,\n} from '../types.js'\n\nexport type ClientFieldWithOptionalType = MarkOptional<ClientField, 'type'>\n\nexport type ClientComponentProps = {\n customComponents: FormField['customComponents']\n field: ClientBlock | ClientField | ClientTab\n forceRender?: boolean\n permissions?: SanitizedFieldPermissions\n readOnly?: boolean\n renderedBlocks?: RenderedField[]\n /**\n * Used to extract field configs from a schemaMap.\n * Does not include indexes.\n *\n * @default field.name\n **/\n schemaPath?: string\n}\n\n// TODO: maybe we can come up with a better name?\nexport type FieldPaths = {\n /**\n * @default ''\n */\n indexPath?: string\n /**\n * @default ''\n */\n parentPath?: string\n /**\n * The path built up to the point of the field\n * excluding the field name.\n *\n * @default ''\n */\n parentSchemaPath?: string\n /**\n * A built up path to access FieldState in the form state.\n * Nested fields will have a path that includes the parent field names\n * if they are nested within a group, array, block or named tab.\n *\n * Collapsibles and unnamed tabs will have arbitrary paths\n * that look like _index-0, _index-1, etc.\n *\n * Row fields will not have a path.\n *\n * @example 'parentGroupField.childTextField'\n *\n * @default field.name\n */\n path: string\n}\n\nexport type ServerComponentProps = {\n clientField: ClientFieldWithOptionalType\n clientFieldSchemaMap: ClientFieldSchemaMap\n collectionSlug: string\n data: Data\n field: Field\n /**\n * The fieldSchemaMap that is created before form state is built is made available here.\n */\n fieldSchemaMap: FieldSchemaMap\n /**\n * Server Components will also have available to the entire form state.\n * We cannot add it to ClientComponentProps as that would blow up the size of the props sent to the client.\n */\n formState: FormState\n i18n: I18nClient\n id?: number | string\n operation: Operation\n payload: Payload\n permissions: SanitizedFieldPermissions\n preferences: DocumentPreferences\n req: PayloadRequest\n siblingData: Data\n user: User\n}\n\nexport type ClientFieldBase<\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n> = {\n readonly field: TFieldClient\n} & Omit<ClientComponentProps, 'customComponents' | 'field'>\n\nexport type ServerFieldBase<\n TFieldServer extends Field = Field,\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n> = {\n readonly clientField: TFieldClient\n readonly field: TFieldServer\n} & Omit<ClientComponentProps, 'field'> &\n Omit<ServerComponentProps, 'clientField' | 'field'>\n\nexport type FieldClientComponent<\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n AdditionalProps extends Record<string, unknown> = Record<string, unknown>,\n> = React.ComponentType<AdditionalProps & ClientFieldBase<TFieldClient>>\n\nexport type FieldServerComponent<\n TFieldServer extends Field = Field,\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n AdditionalProps extends Record<string, unknown> = Record<string, unknown>,\n> = React.ComponentType<AdditionalProps & ServerFieldBase<TFieldServer, TFieldClient>>\n"],"names":[],"mappings":"AAmHA,WAIsF"}
@@ -185,7 +185,7 @@ export const promise = async ({ id, collection, context, data, doc, field, field
185
185
  overrideAccess,
186
186
  path: fieldPath,
187
187
  previousSiblingDoc: siblingDoc,
188
- previousValue: siblingData[field.name],
188
+ previousValue: siblingDoc[field.name],
189
189
  req,
190
190
  schemaPath: fieldSchemaPath,
191
191
  siblingData,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/fields/hooks/beforeValidate/promise.ts"],"sourcesContent":["import type { RichTextAdapter } from '../../../admin/RichText.js'\nimport type { SanitizedCollectionConfig, TypeWithID } from '../../../collections/config/types.js'\nimport type { SanitizedGlobalConfig } from '../../../globals/config/types.js'\nimport type { RequestContext } from '../../../index.js'\nimport type { JsonObject, JsonValue, PayloadRequest } from '../../../types/index.js'\nimport type { Field, TabAsField } from '../../config/types.js'\n\nimport { MissingEditorProp } from '../../../errors/index.js'\nimport { fieldAffectsData, tabHasName, valueIsValueWithRelation } from '../../config/types.js'\nimport { getDefaultValue } from '../../getDefaultValue.js'\nimport { getFieldPaths } from '../../getFieldPaths.js'\nimport { cloneDataFromOriginalDoc } from '../beforeChange/cloneDataFromOriginalDoc.js'\nimport { getExistingRowDoc } from '../beforeChange/getExistingRowDoc.js'\nimport { traverseFields } from './traverseFields.js'\n\ntype Args<T> = {\n collection: null | SanitizedCollectionConfig\n context: RequestContext\n data: T\n /**\n * The original data (not modified by any hooks)\n */\n doc: T\n field: Field | TabAsField\n fieldIndex: number\n global: null | SanitizedGlobalConfig\n id?: number | string\n operation: 'create' | 'update'\n overrideAccess: boolean\n parentPath: (number | string)[]\n parentSchemaPath: string[]\n req: PayloadRequest\n siblingData: JsonObject\n /**\n * The original siblingData (not modified by any hooks)\n */\n siblingDoc: JsonObject\n}\n\n// This function is responsible for the following actions, in order:\n// - Sanitize incoming data\n// - Execute field hooks\n// - Execute field access control\n// - Merge original document data into incoming data\n// - Compute default values for undefined fields\n\nexport const promise = async <T>({\n id,\n collection,\n context,\n data,\n doc,\n field,\n fieldIndex,\n global,\n operation,\n overrideAccess,\n parentPath,\n parentSchemaPath,\n req,\n siblingData,\n siblingDoc,\n}: Args<T>): Promise<void> => {\n const { path: _fieldPath, schemaPath: _fieldSchemaPath } = getFieldPaths({\n field,\n index: fieldIndex,\n parentIndexPath: '', // Doesn't matter, as unnamed fields do not affect data, and hooks are only run on fields that affect data\n parentPath: parentPath.join('.'),\n parentSchemaPath: parentSchemaPath.join('.'),\n })\n const fieldPath = _fieldPath ? _fieldPath.split('.') : []\n const fieldSchemaPath = _fieldSchemaPath ? _fieldSchemaPath.split('.') : []\n\n if (fieldAffectsData(field)) {\n if (field.name === 'id') {\n if (field.type === 'number' && typeof siblingData[field.name] === 'string') {\n const value = siblingData[field.name] as string\n\n siblingData[field.name] = parseFloat(value)\n }\n\n if (\n field.type === 'text' &&\n typeof siblingData[field.name]?.toString === 'function' &&\n typeof siblingData[field.name] !== 'string'\n ) {\n siblingData[field.name] = siblingData[field.name].toString()\n }\n }\n\n // Sanitize incoming data\n switch (field.type) {\n case 'array':\n case 'blocks': {\n // Handle cases of arrays being intentionally set to 0\n if (siblingData[field.name] === '0' || siblingData[field.name] === 0) {\n siblingData[field.name] = []\n }\n\n break\n }\n\n case 'checkbox': {\n if (siblingData[field.name] === 'true') {\n siblingData[field.name] = true\n }\n if (siblingData[field.name] === 'false') {\n siblingData[field.name] = false\n }\n if (siblingData[field.name] === '') {\n siblingData[field.name] = false\n }\n\n break\n }\n\n case 'number': {\n if (typeof siblingData[field.name] === 'string') {\n const value = siblingData[field.name] as string\n const trimmed = value.trim()\n siblingData[field.name] = trimmed.length === 0 ? null : parseFloat(trimmed)\n }\n\n break\n }\n\n case 'point': {\n if (Array.isArray(siblingData[field.name])) {\n siblingData[field.name] = (siblingData[field.name] as string[]).map((coordinate, i) => {\n if (typeof coordinate === 'string') {\n const value = siblingData[field.name][i] as string\n const trimmed = value.trim()\n return trimmed.length === 0 ? null : parseFloat(trimmed)\n }\n return coordinate\n })\n }\n\n break\n }\n case 'relationship':\n case 'upload': {\n if (\n siblingData[field.name] === '' ||\n siblingData[field.name] === 'none' ||\n siblingData[field.name] === 'null' ||\n siblingData[field.name] === null\n ) {\n if (field.hasMany === true) {\n siblingData[field.name] = []\n } else {\n siblingData[field.name] = null\n }\n }\n\n const value = siblingData[field.name]\n\n if (Array.isArray(field.relationTo)) {\n if (Array.isArray(value)) {\n value.forEach((relatedDoc: { relationTo: string; value: JsonValue }, i) => {\n const relatedCollection = req.payload.config.collections.find(\n (collection) => collection.slug === relatedDoc.relationTo,\n )\n\n if (\n typeof relatedDoc.value === 'object' &&\n relatedDoc.value &&\n 'id' in relatedDoc.value\n ) {\n relatedDoc.value = relatedDoc.value.id\n }\n\n if (relatedCollection?.fields) {\n const relationshipIDField = relatedCollection.fields.find(\n (collectionField) =>\n fieldAffectsData(collectionField) && collectionField.name === 'id',\n )\n if (relationshipIDField?.type === 'number') {\n siblingData[field.name][i] = {\n ...relatedDoc,\n value: parseFloat(relatedDoc.value as string),\n }\n }\n }\n })\n }\n if (field.hasMany !== true && valueIsValueWithRelation(value)) {\n const relatedCollection = req.payload.config.collections.find(\n (collection) => collection.slug === value.relationTo,\n )\n\n if (typeof value.value === 'object' && value.value && 'id' in value.value) {\n value.value = (value.value as TypeWithID).id\n }\n\n if (relatedCollection?.fields) {\n const relationshipIDField = relatedCollection.fields.find(\n (collectionField) =>\n fieldAffectsData(collectionField) && collectionField.name === 'id',\n )\n if (relationshipIDField?.type === 'number') {\n siblingData[field.name] = { ...value, value: parseFloat(value.value as string) }\n }\n }\n }\n } else {\n if (Array.isArray(value)) {\n value.forEach((relatedDoc: unknown, i) => {\n const relatedCollection = req.payload.config.collections.find(\n (collection) => collection.slug === field.relationTo,\n )\n\n if (typeof relatedDoc === 'object' && relatedDoc && 'id' in relatedDoc) {\n value[i] = relatedDoc.id\n }\n\n if (relatedCollection?.fields) {\n const relationshipIDField = relatedCollection.fields.find(\n (collectionField) =>\n fieldAffectsData(collectionField) && collectionField.name === 'id',\n )\n if (relationshipIDField?.type === 'number') {\n siblingData[field.name][i] = parseFloat(relatedDoc as string)\n }\n }\n })\n }\n if (field.hasMany !== true && value) {\n const relatedCollection = req.payload.config.collections.find(\n (collection) => collection.slug === field.relationTo,\n )\n\n if (typeof value === 'object' && value && 'id' in value) {\n siblingData[field.name] = value.id\n }\n\n if (relatedCollection?.fields) {\n const relationshipIDField = relatedCollection.fields.find(\n (collectionField) =>\n fieldAffectsData(collectionField) && collectionField.name === 'id',\n )\n if (relationshipIDField?.type === 'number') {\n siblingData[field.name] = parseFloat(value as string)\n }\n }\n }\n }\n break\n }\n case 'richText': {\n if (typeof siblingData[field.name] === 'string') {\n try {\n const richTextJSON = JSON.parse(siblingData[field.name] as string)\n siblingData[field.name] = richTextJSON\n } catch {\n // Disregard this data as it is not valid.\n // Will be reported to user by field validation\n }\n }\n\n break\n }\n\n default: {\n break\n }\n }\n\n // Execute hooks\n if (field.hooks?.beforeValidate) {\n await field.hooks.beforeValidate.reduce(async (priorHook, currentHook) => {\n await priorHook\n\n const hookedValue = await currentHook({\n collection,\n context,\n data,\n field,\n global,\n operation,\n originalDoc: doc,\n overrideAccess,\n path: fieldPath,\n previousSiblingDoc: siblingDoc,\n previousValue: siblingData[field.name],\n req,\n schemaPath: fieldSchemaPath,\n siblingData,\n value: siblingData[field.name],\n })\n\n if (hookedValue !== undefined) {\n siblingData[field.name] = hookedValue\n }\n }, Promise.resolve())\n }\n\n // Execute access control\n if (field.access && field.access[operation]) {\n const result = overrideAccess\n ? true\n : await field.access[operation]({ id, data, doc, req, siblingData })\n\n if (!result) {\n delete siblingData[field.name]\n }\n }\n\n if (typeof siblingData[field.name] === 'undefined') {\n // If no incoming data, but existing document data is found, merge it in\n if (typeof siblingDoc[field.name] !== 'undefined') {\n siblingData[field.name] = cloneDataFromOriginalDoc(siblingDoc[field.name])\n\n // Otherwise compute default value\n } else if (typeof field.defaultValue !== 'undefined') {\n siblingData[field.name] = await getDefaultValue({\n defaultValue: field.defaultValue,\n locale: req.locale,\n req,\n user: req.user,\n value: siblingData[field.name],\n })\n }\n }\n }\n\n // Traverse subfields\n switch (field.type) {\n case 'array': {\n const rows = siblingData[field.name]\n\n if (Array.isArray(rows)) {\n const promises = []\n rows.forEach((row, i) => {\n promises.push(\n traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n overrideAccess,\n path: [...fieldPath, i],\n req,\n schemaPath: fieldSchemaPath,\n siblingData: row as JsonObject,\n siblingDoc: getExistingRowDoc(row as JsonObject, siblingDoc[field.name]),\n }),\n )\n })\n await Promise.all(promises)\n }\n break\n }\n\n case 'blocks': {\n const rows = siblingData[field.name]\n\n if (Array.isArray(rows)) {\n const promises = []\n rows.forEach((row, i) => {\n const rowSiblingDoc = getExistingRowDoc(row as JsonObject, siblingDoc[field.name])\n const blockTypeToMatch = (row as JsonObject).blockType || rowSiblingDoc.blockType\n const block = field.blocks.find((blockType) => blockType.slug === blockTypeToMatch)\n\n if (block) {\n ;(row as JsonObject).blockType = blockTypeToMatch\n\n promises.push(\n traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: block.fields,\n global,\n operation,\n overrideAccess,\n path: [...fieldPath, i],\n req,\n schemaPath: fieldSchemaPath,\n siblingData: row as JsonObject,\n siblingDoc: rowSiblingDoc,\n }),\n )\n }\n })\n await Promise.all(promises)\n }\n\n break\n }\n\n case 'collapsible':\n case 'row': {\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n overrideAccess,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData,\n siblingDoc,\n })\n\n break\n }\n case 'group': {\n if (typeof siblingData[field.name] !== 'object') {\n siblingData[field.name] = {}\n }\n if (typeof siblingDoc[field.name] !== 'object') {\n siblingDoc[field.name] = {}\n }\n\n const groupData = siblingData[field.name] as Record<string, unknown>\n const groupDoc = siblingDoc[field.name] as Record<string, unknown>\n\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n overrideAccess,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData: groupData as JsonObject,\n siblingDoc: groupDoc as JsonObject,\n })\n\n break\n }\n\n case 'richText': {\n if (!field?.editor) {\n throw new MissingEditorProp(field) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n if (typeof field?.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n const editor: RichTextAdapter = field?.editor\n\n if (editor?.hooks?.beforeValidate?.length) {\n await editor.hooks.beforeValidate.reduce(async (priorHook, currentHook) => {\n await priorHook\n\n const hookedValue = await currentHook({\n collection,\n context,\n data,\n field,\n global,\n operation,\n originalDoc: doc,\n overrideAccess,\n path: fieldPath,\n previousSiblingDoc: siblingDoc,\n previousValue: siblingData[field.name],\n req,\n schemaPath: fieldSchemaPath,\n siblingData,\n value: siblingData[field.name],\n })\n\n if (hookedValue !== undefined) {\n siblingData[field.name] = hookedValue\n }\n }, Promise.resolve())\n }\n break\n }\n\n case 'tab': {\n let tabSiblingData\n let tabSiblingDoc\n if (tabHasName(field)) {\n if (typeof siblingData[field.name] !== 'object') {\n siblingData[field.name] = {}\n }\n if (typeof siblingDoc[field.name] !== 'object') {\n siblingDoc[field.name] = {}\n }\n\n tabSiblingData = siblingData[field.name] as Record<string, unknown>\n tabSiblingDoc = siblingDoc[field.name] as Record<string, unknown>\n } else {\n tabSiblingData = siblingData\n tabSiblingDoc = siblingDoc\n }\n\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n overrideAccess,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData: tabSiblingData,\n siblingDoc: tabSiblingDoc,\n })\n\n break\n }\n\n case 'tabs': {\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: field.tabs.map((tab) => ({ ...tab, type: 'tab' })),\n global,\n operation,\n overrideAccess,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData,\n siblingDoc,\n })\n\n break\n }\n\n default: {\n break\n }\n }\n}\n"],"names":["MissingEditorProp","fieldAffectsData","tabHasName","valueIsValueWithRelation","getDefaultValue","getFieldPaths","cloneDataFromOriginalDoc","getExistingRowDoc","traverseFields","promise","id","collection","context","data","doc","field","fieldIndex","global","operation","overrideAccess","parentPath","parentSchemaPath","req","siblingData","siblingDoc","path","_fieldPath","schemaPath","_fieldSchemaPath","index","parentIndexPath","join","fieldPath","split","fieldSchemaPath","name","type","value","parseFloat","toString","trimmed","trim","length","Array","isArray","map","coordinate","i","hasMany","relationTo","forEach","relatedDoc","relatedCollection","payload","config","collections","find","slug","fields","relationshipIDField","collectionField","richTextJSON","JSON","parse","hooks","beforeValidate","reduce","priorHook","currentHook","hookedValue","originalDoc","previousSiblingDoc","previousValue","undefined","Promise","resolve","access","result","defaultValue","locale","user","rows","promises","row","push","all","rowSiblingDoc","blockTypeToMatch","blockType","block","blocks","groupData","groupDoc","editor","Error","tabSiblingData","tabSiblingDoc","tabs","tab"],"mappings":"AAOA,SAASA,iBAAiB,QAAQ,2BAA0B;AAC5D,SAASC,gBAAgB,EAAEC,UAAU,EAAEC,wBAAwB,QAAQ,wBAAuB;AAC9F,SAASC,eAAe,QAAQ,2BAA0B;AAC1D,SAASC,aAAa,QAAQ,yBAAwB;AACtD,SAASC,wBAAwB,QAAQ,8CAA6C;AACtF,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,cAAc,QAAQ,sBAAqB;AA0BpD,oEAAoE;AACpE,2BAA2B;AAC3B,wBAAwB;AACxB,iCAAiC;AACjC,oDAAoD;AACpD,gDAAgD;AAEhD,OAAO,MAAMC,UAAU,OAAU,EAC/BC,EAAE,EACFC,UAAU,EACVC,OAAO,EACPC,IAAI,EACJC,GAAG,EACHC,KAAK,EACLC,UAAU,EACVC,MAAM,EACNC,SAAS,EACTC,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AC"}
1
+ {"version":3,"sources":["../../../../src/fields/hooks/beforeValidate/promise.ts"],"sourcesContent":["import type { RichTextAdapter } from '../../../admin/RichText.js'\nimport type { SanitizedCollectionConfig, TypeWithID } from '../../../collections/config/types.js'\nimport type { SanitizedGlobalConfig } from '../../../globals/config/types.js'\nimport type { RequestContext } from '../../../index.js'\nimport type { JsonObject, JsonValue, PayloadRequest } from '../../../types/index.js'\nimport type { Field, TabAsField } from '../../config/types.js'\n\nimport { MissingEditorProp } from '../../../errors/index.js'\nimport { fieldAffectsData, tabHasName, valueIsValueWithRelation } from '../../config/types.js'\nimport { getDefaultValue } from '../../getDefaultValue.js'\nimport { getFieldPaths } from '../../getFieldPaths.js'\nimport { cloneDataFromOriginalDoc } from '../beforeChange/cloneDataFromOriginalDoc.js'\nimport { getExistingRowDoc } from '../beforeChange/getExistingRowDoc.js'\nimport { traverseFields } from './traverseFields.js'\n\ntype Args<T> = {\n collection: null | SanitizedCollectionConfig\n context: RequestContext\n data: T\n /**\n * The original data (not modified by any hooks)\n */\n doc: T\n field: Field | TabAsField\n fieldIndex: number\n global: null | SanitizedGlobalConfig\n id?: number | string\n operation: 'create' | 'update'\n overrideAccess: boolean\n parentPath: (number | string)[]\n parentSchemaPath: string[]\n req: PayloadRequest\n siblingData: JsonObject\n /**\n * The original siblingData (not modified by any hooks)\n */\n siblingDoc: JsonObject\n}\n\n// This function is responsible for the following actions, in order:\n// - Sanitize incoming data\n// - Execute field hooks\n// - Execute field access control\n// - Merge original document data into incoming data\n// - Compute default values for undefined fields\n\nexport const promise = async <T>({\n id,\n collection,\n context,\n data,\n doc,\n field,\n fieldIndex,\n global,\n operation,\n overrideAccess,\n parentPath,\n parentSchemaPath,\n req,\n siblingData,\n siblingDoc,\n}: Args<T>): Promise<void> => {\n const { path: _fieldPath, schemaPath: _fieldSchemaPath } = getFieldPaths({\n field,\n index: fieldIndex,\n parentIndexPath: '', // Doesn't matter, as unnamed fields do not affect data, and hooks are only run on fields that affect data\n parentPath: parentPath.join('.'),\n parentSchemaPath: parentSchemaPath.join('.'),\n })\n const fieldPath = _fieldPath ? _fieldPath.split('.') : []\n const fieldSchemaPath = _fieldSchemaPath ? _fieldSchemaPath.split('.') : []\n\n if (fieldAffectsData(field)) {\n if (field.name === 'id') {\n if (field.type === 'number' && typeof siblingData[field.name] === 'string') {\n const value = siblingData[field.name] as string\n\n siblingData[field.name] = parseFloat(value)\n }\n\n if (\n field.type === 'text' &&\n typeof siblingData[field.name]?.toString === 'function' &&\n typeof siblingData[field.name] !== 'string'\n ) {\n siblingData[field.name] = siblingData[field.name].toString()\n }\n }\n\n // Sanitize incoming data\n switch (field.type) {\n case 'array':\n case 'blocks': {\n // Handle cases of arrays being intentionally set to 0\n if (siblingData[field.name] === '0' || siblingData[field.name] === 0) {\n siblingData[field.name] = []\n }\n\n break\n }\n\n case 'checkbox': {\n if (siblingData[field.name] === 'true') {\n siblingData[field.name] = true\n }\n if (siblingData[field.name] === 'false') {\n siblingData[field.name] = false\n }\n if (siblingData[field.name] === '') {\n siblingData[field.name] = false\n }\n\n break\n }\n\n case 'number': {\n if (typeof siblingData[field.name] === 'string') {\n const value = siblingData[field.name] as string\n const trimmed = value.trim()\n siblingData[field.name] = trimmed.length === 0 ? null : parseFloat(trimmed)\n }\n\n break\n }\n\n case 'point': {\n if (Array.isArray(siblingData[field.name])) {\n siblingData[field.name] = (siblingData[field.name] as string[]).map((coordinate, i) => {\n if (typeof coordinate === 'string') {\n const value = siblingData[field.name][i] as string\n const trimmed = value.trim()\n return trimmed.length === 0 ? null : parseFloat(trimmed)\n }\n return coordinate\n })\n }\n\n break\n }\n case 'relationship':\n case 'upload': {\n if (\n siblingData[field.name] === '' ||\n siblingData[field.name] === 'none' ||\n siblingData[field.name] === 'null' ||\n siblingData[field.name] === null\n ) {\n if (field.hasMany === true) {\n siblingData[field.name] = []\n } else {\n siblingData[field.name] = null\n }\n }\n\n const value = siblingData[field.name]\n\n if (Array.isArray(field.relationTo)) {\n if (Array.isArray(value)) {\n value.forEach((relatedDoc: { relationTo: string; value: JsonValue }, i) => {\n const relatedCollection = req.payload.config.collections.find(\n (collection) => collection.slug === relatedDoc.relationTo,\n )\n\n if (\n typeof relatedDoc.value === 'object' &&\n relatedDoc.value &&\n 'id' in relatedDoc.value\n ) {\n relatedDoc.value = relatedDoc.value.id\n }\n\n if (relatedCollection?.fields) {\n const relationshipIDField = relatedCollection.fields.find(\n (collectionField) =>\n fieldAffectsData(collectionField) && collectionField.name === 'id',\n )\n if (relationshipIDField?.type === 'number') {\n siblingData[field.name][i] = {\n ...relatedDoc,\n value: parseFloat(relatedDoc.value as string),\n }\n }\n }\n })\n }\n if (field.hasMany !== true && valueIsValueWithRelation(value)) {\n const relatedCollection = req.payload.config.collections.find(\n (collection) => collection.slug === value.relationTo,\n )\n\n if (typeof value.value === 'object' && value.value && 'id' in value.value) {\n value.value = (value.value as TypeWithID).id\n }\n\n if (relatedCollection?.fields) {\n const relationshipIDField = relatedCollection.fields.find(\n (collectionField) =>\n fieldAffectsData(collectionField) && collectionField.name === 'id',\n )\n if (relationshipIDField?.type === 'number') {\n siblingData[field.name] = { ...value, value: parseFloat(value.value as string) }\n }\n }\n }\n } else {\n if (Array.isArray(value)) {\n value.forEach((relatedDoc: unknown, i) => {\n const relatedCollection = req.payload.config.collections.find(\n (collection) => collection.slug === field.relationTo,\n )\n\n if (typeof relatedDoc === 'object' && relatedDoc && 'id' in relatedDoc) {\n value[i] = relatedDoc.id\n }\n\n if (relatedCollection?.fields) {\n const relationshipIDField = relatedCollection.fields.find(\n (collectionField) =>\n fieldAffectsData(collectionField) && collectionField.name === 'id',\n )\n if (relationshipIDField?.type === 'number') {\n siblingData[field.name][i] = parseFloat(relatedDoc as string)\n }\n }\n })\n }\n if (field.hasMany !== true && value) {\n const relatedCollection = req.payload.config.collections.find(\n (collection) => collection.slug === field.relationTo,\n )\n\n if (typeof value === 'object' && value && 'id' in value) {\n siblingData[field.name] = value.id\n }\n\n if (relatedCollection?.fields) {\n const relationshipIDField = relatedCollection.fields.find(\n (collectionField) =>\n fieldAffectsData(collectionField) && collectionField.name === 'id',\n )\n if (relationshipIDField?.type === 'number') {\n siblingData[field.name] = parseFloat(value as string)\n }\n }\n }\n }\n break\n }\n case 'richText': {\n if (typeof siblingData[field.name] === 'string') {\n try {\n const richTextJSON = JSON.parse(siblingData[field.name] as string)\n siblingData[field.name] = richTextJSON\n } catch {\n // Disregard this data as it is not valid.\n // Will be reported to user by field validation\n }\n }\n\n break\n }\n\n default: {\n break\n }\n }\n\n // Execute hooks\n if (field.hooks?.beforeValidate) {\n await field.hooks.beforeValidate.reduce(async (priorHook, currentHook) => {\n await priorHook\n\n const hookedValue = await currentHook({\n collection,\n context,\n data,\n field,\n global,\n operation,\n originalDoc: doc,\n overrideAccess,\n path: fieldPath,\n previousSiblingDoc: siblingDoc,\n previousValue: siblingDoc[field.name],\n req,\n schemaPath: fieldSchemaPath,\n siblingData,\n value: siblingData[field.name],\n })\n\n if (hookedValue !== undefined) {\n siblingData[field.name] = hookedValue\n }\n }, Promise.resolve())\n }\n\n // Execute access control\n if (field.access && field.access[operation]) {\n const result = overrideAccess\n ? true\n : await field.access[operation]({ id, data, doc, req, siblingData })\n\n if (!result) {\n delete siblingData[field.name]\n }\n }\n\n if (typeof siblingData[field.name] === 'undefined') {\n // If no incoming data, but existing document data is found, merge it in\n if (typeof siblingDoc[field.name] !== 'undefined') {\n siblingData[field.name] = cloneDataFromOriginalDoc(siblingDoc[field.name])\n\n // Otherwise compute default value\n } else if (typeof field.defaultValue !== 'undefined') {\n siblingData[field.name] = await getDefaultValue({\n defaultValue: field.defaultValue,\n locale: req.locale,\n req,\n user: req.user,\n value: siblingData[field.name],\n })\n }\n }\n }\n\n // Traverse subfields\n switch (field.type) {\n case 'array': {\n const rows = siblingData[field.name]\n\n if (Array.isArray(rows)) {\n const promises = []\n rows.forEach((row, i) => {\n promises.push(\n traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n overrideAccess,\n path: [...fieldPath, i],\n req,\n schemaPath: fieldSchemaPath,\n siblingData: row as JsonObject,\n siblingDoc: getExistingRowDoc(row as JsonObject, siblingDoc[field.name]),\n }),\n )\n })\n await Promise.all(promises)\n }\n break\n }\n\n case 'blocks': {\n const rows = siblingData[field.name]\n\n if (Array.isArray(rows)) {\n const promises = []\n rows.forEach((row, i) => {\n const rowSiblingDoc = getExistingRowDoc(row as JsonObject, siblingDoc[field.name])\n const blockTypeToMatch = (row as JsonObject).blockType || rowSiblingDoc.blockType\n const block = field.blocks.find((blockType) => blockType.slug === blockTypeToMatch)\n\n if (block) {\n ;(row as JsonObject).blockType = blockTypeToMatch\n\n promises.push(\n traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: block.fields,\n global,\n operation,\n overrideAccess,\n path: [...fieldPath, i],\n req,\n schemaPath: fieldSchemaPath,\n siblingData: row as JsonObject,\n siblingDoc: rowSiblingDoc,\n }),\n )\n }\n })\n await Promise.all(promises)\n }\n\n break\n }\n\n case 'collapsible':\n case 'row': {\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n overrideAccess,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData,\n siblingDoc,\n })\n\n break\n }\n case 'group': {\n if (typeof siblingData[field.name] !== 'object') {\n siblingData[field.name] = {}\n }\n if (typeof siblingDoc[field.name] !== 'object') {\n siblingDoc[field.name] = {}\n }\n\n const groupData = siblingData[field.name] as Record<string, unknown>\n const groupDoc = siblingDoc[field.name] as Record<string, unknown>\n\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n overrideAccess,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData: groupData as JsonObject,\n siblingDoc: groupDoc as JsonObject,\n })\n\n break\n }\n\n case 'richText': {\n if (!field?.editor) {\n throw new MissingEditorProp(field) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n if (typeof field?.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n const editor: RichTextAdapter = field?.editor\n\n if (editor?.hooks?.beforeValidate?.length) {\n await editor.hooks.beforeValidate.reduce(async (priorHook, currentHook) => {\n await priorHook\n\n const hookedValue = await currentHook({\n collection,\n context,\n data,\n field,\n global,\n operation,\n originalDoc: doc,\n overrideAccess,\n path: fieldPath,\n previousSiblingDoc: siblingDoc,\n previousValue: siblingData[field.name],\n req,\n schemaPath: fieldSchemaPath,\n siblingData,\n value: siblingData[field.name],\n })\n\n if (hookedValue !== undefined) {\n siblingData[field.name] = hookedValue\n }\n }, Promise.resolve())\n }\n break\n }\n\n case 'tab': {\n let tabSiblingData\n let tabSiblingDoc\n if (tabHasName(field)) {\n if (typeof siblingData[field.name] !== 'object') {\n siblingData[field.name] = {}\n }\n if (typeof siblingDoc[field.name] !== 'object') {\n siblingDoc[field.name] = {}\n }\n\n tabSiblingData = siblingData[field.name] as Record<string, unknown>\n tabSiblingDoc = siblingDoc[field.name] as Record<string, unknown>\n } else {\n tabSiblingData = siblingData\n tabSiblingDoc = siblingDoc\n }\n\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n overrideAccess,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData: tabSiblingData,\n siblingDoc: tabSiblingDoc,\n })\n\n break\n }\n\n case 'tabs': {\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: field.tabs.map((tab) => ({ ...tab, type: 'tab' })),\n global,\n operation,\n overrideAccess,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData,\n siblingDoc,\n })\n\n break\n }\n\n default: {\n break\n }\n }\n}\n"],"names":["MissingEditorProp","fieldAffectsData","tabHasName","valueIsValueWithRelation","getDefaultValue","getFieldPaths","cloneDataFromOriginalDoc","getExistingRowDoc","traverseFields","promise","id","collection","context","data","doc","field","fieldIndex","global","operation","overrideAccess","parentPath","parentSchemaPath","req","siblingData","siblingDoc","path","_fieldPath","schemaPath","_fieldSchemaPath","index","parentIndexPath","join","fieldPath","split","fieldSchemaPath","name","type","value","parseFloat","toString","trimmed","trim","length","Array","isArray","map","coordinate","i","hasMany","relationTo","forEach","relatedDoc","relatedCollection","payload","config","collections","find","slug","fields","relationshipIDField","collectionField","richTextJSON","JSON","parse","hooks","beforeValidate","reduce","priorHook","currentHook","hookedValue","originalDoc","previousSiblingDoc","previousValue","undefined","Promise","resolve","access","result","defaultValue","locale","user","rows","promises","row","push","all","rowSiblingDoc","blockTypeToMatch","blockType","block","blocks","groupData","groupDoc","editor","Error","tabSiblingData","tabSiblingDoc","tabs","tab"],"mappings":"AAOA,SAASA,iBAAiB,QAAQ,2BAA0B;AAC5D,SAASC,gBAAgB,EAAEC,UAAU,EAAEC,wBAAwB,QAAQ,wBAAuB;AAC9F,SAASC,eAAe,QAAQ,2BAA0B;AAC1D,SAASC,aAAa,QAAQ,yBAAwB;AACtD,SAASC,wBAAwB,QAAQ,8CAA6C;AACtF,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,cAAc,QAAQ,sBAAqB;AA0BpD,oEAAoE;AACpE,2BAA2B;AAC3B,wBAAwB;AACxB,iCAAiC;AACjC,oDAAoD;AACpD,gDAAgD;AAEhD,OAAO,MAAMC,UAAU,OAAU,EAC/BC,EAAE,EACFC,UAAU,EACVC,OAAO,EACPC,IAAI,EACJC,GAAG,EACHC,KAAK,EACLC,UAAU,EACVC,MAAM,EACNC,SAAS,EACTC,cAAc,EACdC,UAAU,EACVC,gBAAgB,EAChBC,GAAG,EACHC,WAAW,EACXC,UAAU,EACF;IACR,MAAM,EAAEC,MAAMC,UAAU,EAAEC,YAAYC,gBAAgB,EAAE,GAAGvB,cAAc;QACvEU;QACAc,OAAOb;QACPc,iBAAiB;QACjBV,YAAYA,WAAWW,IAAI,CAAC;QAC5BV,kBAAkBA,iBAAiBU,IAAI,CAAC;IAC1C;IACA,MA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AAWa,QAAQ;oBACrB,IAAI,OAAOQ,WAAW,CAACR,MAAMoB,IAAI,CAAC,KAAK,UAAU;wBAC/CZ,WAAW,CAACR,MAAMoB,IAAI,CAAC,GAAG,CAAC;oBAC7B;oBACA,IAAI,OAAOX,UAAU,CAACT,MAAMoB,IAAI,CAAC,KAAK,UAAU;wBAC9CX,UAAU,CAACT,MAAMoB,IAAI,CAAC,GAAG,CAAC;oBAC5B;oBAEA4D,iBAAiBxE,WAAW,CAACR,MAAMoB,IAAI,CAAC;oBACxC6D,gBAAgBxE,UAAU,CAACT,MAAMoB,IAAI,CAAC;gBACxC,OAAO;oBACL4D,iBAAiBxE;oBACjByE,gBAAgBxE;gBAClB;gBAEA,MAAMhB,eAAe;oBACnBE;oBACAC;oBACAC;oBACAC;oBACAC;oBACA4C,QAAQ3C,MAAM2C,MAAM;oBACpBzC;oBACAC;oBACAC;oBACAM,MAAMO;oBACNV;oBACAK,YAAYO;oBACZX,aAAawE;oBACbvE,YAAYwE;gBACd;gBAEA;YACF;QAEA,KAAK;YAAQ;gBACX,MAAMxF,eAAe;oBACnBE;oBACAC;oBACAC;oBACAC;oBACAC;oBACA4C,QAAQ3C,MAAMkF,IAAI,CAACpD,GAAG,CAAC,CAACqD,MAAS,CAAA;4BAAE,GAAGA,GAAG;4BAAE9D,MAAM;wBAAM,CAAA;oBACvDnB;oBACAC;oBACAC;oBACAM,MAAMO;oBACNV;oBACAK,YAAYO;oBACZX;oBACAC;gBACF;gBAEA;YACF;QAEA;YAAS;gBACP;YACF;IACF;AACF,EAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { Field, PayloadRequest, StringKeyOf, TypedJobs } from '../../../index.js';
2
- import type { RunningJob, RunningJobSimple } from './workflowTypes.js';
2
+ import type { BaseJob, RunningJob, RunningJobSimple, SingleTaskStatus } from './workflowTypes.js';
3
3
  export type TaskInputOutput = {
4
4
  input: object;
5
5
  output: object;
@@ -66,8 +66,22 @@ export type RunInlineTaskFunction = <TTaskInput extends object, TTaskOutput exte
66
66
  state?: 'failed' | 'succeeded';
67
67
  }>;
68
68
  }) => Promise<TTaskOutput>;
69
+ export type ShouldRestoreFn = (args: {
70
+ /**
71
+ * Input data passed to the task
72
+ */
73
+ input: object;
74
+ job: BaseJob;
75
+ req: PayloadRequest;
76
+ taskStatus: SingleTaskStatus<string>;
77
+ }) => boolean | Promise<boolean>;
69
78
  export type RetryConfig = {
70
- attempts: number;
79
+ /**
80
+ * This controls how many times the task should be retried if it fails.
81
+ *
82
+ * @default undefined - attempts are either inherited from the workflow retry config or set to 0.
83
+ */
84
+ attempts?: number;
71
85
  /**
72
86
  * The backoff strategy to use when retrying the task. This determines how long to wait before retrying the task.
73
87
  *
@@ -102,6 +116,19 @@ export type RetryConfig = {
102
116
  */
103
117
  type: 'exponential' | 'fixed';
104
118
  };
119
+ /**
120
+ * This controls whether the task output should be restored if the task previously succeeded and the workflow is being retried.
121
+ *
122
+ * If this is set to false, the task will be re-run even if it previously succeeded, ignoring the maximum number of retries.
123
+ *
124
+ * If this is set to true, the task will only be re-run if it previously failed.
125
+ *
126
+ * If this is a function, the return value of the function will determine whether the task should be re-run. This can be used for more complex restore logic,
127
+ * e.g you may want to re-run a task up until a certain point and then restore it, or only re-run a task if the input has changed.
128
+ *
129
+ * @default true - the task output will be restored if the task previously succeeded.
130
+ */
131
+ shouldRestore?: boolean | ShouldRestoreFn;
105
132
  };
106
133
  export type TaskConfig<TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput = TaskType> = {
107
134
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"taskTypes.d.ts","sourceRoot":"","sources":["../../../../src/queues/config/types/taskTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AACtF,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAEtE,MAAM,MAAM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YAAY,CAAC,EAAE,KAAK,EAAE,CAAA;IACtB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAAA;IAC1C;;OAEG;IACH,IAAI,EAAE,sBAAsB,SAAS,MAAM,SAAS,CAAC,OAAO,CAAC,GAAG,sBAAsB,GAAG,MAAM,CAAA;CAChG,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/queues/config/types/taskTypes.ts"],"sourcesContent":["import type { Field, PayloadRequest, StringKeyOf, TypedJobs } from '../../../index.js'\nimport type { RunningJob, RunningJobSimple } from './workflowTypes.js'\n\nexport type TaskInputOutput = {\n input: object\n output: object\n}\nexport type TaskHandlerResult<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput,\n> = {\n output: TTaskSlugOrInputOutput extends keyof TypedJobs['tasks']\n ? TypedJobs['tasks'][TTaskSlugOrInputOutput]['output']\n : TTaskSlugOrInputOutput extends TaskInputOutput // Check if it's actually TaskInputOutput type\n ? TTaskSlugOrInputOutput['output']\n : never\n state?: 'failed' | 'succeeded'\n}\n\nexport type TaskHandlerArgs<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput,\n TWorkflowSlug extends keyof TypedJobs['workflows'] = string,\n> = {\n input: TTaskSlugOrInputOutput extends keyof TypedJobs['tasks']\n ? TypedJobs['tasks'][TTaskSlugOrInputOutput]['input']\n : TTaskSlugOrInputOutput extends TaskInputOutput // Check if it's actually TaskInputOutput type\n ? TTaskSlugOrInputOutput['input']\n : never\n job: RunningJob<TWorkflowSlug>\n req: PayloadRequest\n}\n\n/**\n * Inline tasks in JSON workflows have no input, as they can just get the input from job.taskStatus\n */\nexport type TaskHandlerArgsNoInput<TWorkflowInput extends object> = {\n job: RunningJobSimple<TWorkflowInput>\n req: PayloadRequest\n}\n\nexport type TaskHandler<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput,\n TWorkflowSlug extends keyof TypedJobs['workflows'] = string,\n> = (\n args: TaskHandlerArgs<TTaskSlugOrInputOutput, TWorkflowSlug>,\n) => Promise<TaskHandlerResult<TTaskSlugOrInputOutput>> | TaskHandlerResult<TTaskSlugOrInputOutput>\n\nexport type TaskType = StringKeyOf<TypedJobs['tasks']>\n\n// Extracts the type of `input` corresponding to each task\nexport type TaskInput<T extends keyof TypedJobs['tasks']> = TypedJobs['tasks'][T]['input']\n\nexport type TaskOutput<T extends keyof TypedJobs['tasks']> = TypedJobs['tasks'][T]['output']\n\nexport type TaskHandlerResults = {\n [TTaskSlug in keyof TypedJobs['tasks']]: {\n [id: string]: TaskHandlerResult<TTaskSlug>\n }\n}\n\n// Helper type to create correct argument type for the function corresponding to each task.\nexport type RunTaskFunctionArgs<TTaskSlug extends keyof TypedJobs['tasks']> = {\n input?: TaskInput<TTaskSlug>\n /**\n * Specify the number of times that this task should be retried if it fails for any reason.\n * If this is undefined, the task will either inherit the retries from the workflow or have no retries.\n * If this is 0, the task will not be retried.\n *\n * @default By default, tasks are not retried and `retries` is `undefined`.\n */\n retries?: number | RetryConfig | undefined\n}\n\nexport type RunTaskFunction<TTaskSlug extends keyof TypedJobs['tasks']> = (\n taskID: string,\n taskArgs?: RunTaskFunctionArgs<TTaskSlug>,\n) => Promise<TaskOutput<TTaskSlug>>\n\nexport type RunTaskFunctions = {\n [TTaskSlug in keyof TypedJobs['tasks']]: RunTaskFunction<TTaskSlug>\n}\n\nexport type RunInlineTaskFunction = <TTaskInput extends object, TTaskOutput extends object>(\n taskID: string,\n taskArgs: {\n input?: TTaskInput\n /**\n * Specify the number of times that this task should be retried if it fails for any reason.\n * If this is undefined, the task will either inherit the retries from the workflow or have no retries.\n * If this is 0, the task will not be retried.\n *\n * @default By default, tasks are not retried and `retries` is `undefined`.\n */\n retries?: number | RetryConfig | undefined\n // This is the same as TaskHandler, but typed out explicitly in order to improve type inference\n task: (args: { input: TTaskInput; job: RunningJob<any>; req: PayloadRequest }) =>\n | {\n output: TTaskOutput\n state?: 'failed' | 'succeeded'\n }\n | Promise<{ output: TTaskOutput; state?: 'failed' | 'succeeded' }>\n },\n) => Promise<TTaskOutput>\n\nexport type RetryConfig = {\n attempts: number\n /**\n * The backoff strategy to use when retrying the task. This determines how long to wait before retrying the task.\n *\n * If this is set on a single task, the longest backoff time of a task will determine the time until the entire workflow is retried.\n */\n backoff?: {\n /**\n * Base delay between running jobs in ms\n */\n delay?: number\n /**\n * @default fixed\n *\n * The backoff strategy to use when retrying the task. This determines how long to wait before retrying the task.\n * If fixed (default) is used, the delay will be the same between each retry.\n *\n * If exponential is used, the delay will increase exponentially with each retry.\n *\n * @example\n * delay = 1000\n * attempts = 3\n * type = 'fixed'\n *\n * The task will be retried 3 times with a delay of 1000ms between each retry.\n *\n * @example\n * delay = 1000\n * attempts = 3\n * type = 'exponential'\n *\n * The task will be retried 3 times with a delay of 1000ms, 2000ms, and 4000ms between each retry.\n */\n type: 'exponential' | 'fixed'\n }\n}\n\nexport type TaskConfig<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput = TaskType,\n> = {\n /**\n * The function that should be responsible for running the job.\n * You can either pass a string-based path to the job function file, or the job function itself.\n *\n * If you are using large dependencies within your job, you might prefer to pass the string path\n * because that will avoid bundling large dependencies in your Next.js app. Passing a string path is an advanced feature\n * that may require a sophisticated build pipeline in order to work.\n */\n handler: string | TaskHandler<TTaskSlugOrInputOutput>\n /**\n * Define the input field schema - payload will generate a type for this schema.\n */\n inputSchema?: Field[]\n /**\n * You can use interfaceName to change the name of the interface that is generated for this task. By default, this is \"Task\" + the capitalized task slug.\n */\n interfaceName?: string\n /**\n * Define a human-friendly label for this task.\n */\n label?: string\n /**\n * Function to be executed if the task fails.\n */\n onFail?: () => Promise<void> | void\n /**\n * Function to be executed if the task succeeds.\n */\n onSuccess?: () => Promise<void> | void\n /**\n * Define the output field schema - payload will generate a type for this schema.\n */\n outputSchema?: Field[]\n /**\n * Specify the number of times that this step should be retried if it fails.\n * If this is undefined, the task will either inherit the retries from the workflow or have no retries.\n * If this is 0, the task will not be retried.\n *\n * @default By default, tasks are not retried and `retries` is `undefined`.\n */\n retries?: number | RetryConfig | undefined\n /**\n * Define a slug-based name for this job. This slug needs to be unique among both tasks and workflows.\n */\n slug: TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] ? TTaskSlugOrInputOutput : string\n}\n"],"names":[],"mappings":"AA6IA,WAgDC"}
1
+ {"version":3,"sources":["../../../../src/queues/config/types/taskTypes.ts"],"sourcesContent":["import type { Field, PayloadRequest, StringKeyOf, TypedJobs } from '../../../index.js'\nimport type { BaseJob, RunningJob, RunningJobSimple, SingleTaskStatus } from './workflowTypes.js'\n\nexport type TaskInputOutput = {\n input: object\n output: object\n}\nexport type TaskHandlerResult<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput,\n> = {\n output: TTaskSlugOrInputOutput extends keyof TypedJobs['tasks']\n ? TypedJobs['tasks'][TTaskSlugOrInputOutput]['output']\n : TTaskSlugOrInputOutput extends TaskInputOutput // Check if it's actually TaskInputOutput type\n ? TTaskSlugOrInputOutput['output']\n : never\n state?: 'failed' | 'succeeded'\n}\n\nexport type TaskHandlerArgs<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput,\n TWorkflowSlug extends keyof TypedJobs['workflows'] = string,\n> = {\n input: TTaskSlugOrInputOutput extends keyof TypedJobs['tasks']\n ? TypedJobs['tasks'][TTaskSlugOrInputOutput]['input']\n : TTaskSlugOrInputOutput extends TaskInputOutput // Check if it's actually TaskInputOutput type\n ? TTaskSlugOrInputOutput['input']\n : never\n job: RunningJob<TWorkflowSlug>\n req: PayloadRequest\n}\n\n/**\n * Inline tasks in JSON workflows have no input, as they can just get the input from job.taskStatus\n */\nexport type TaskHandlerArgsNoInput<TWorkflowInput extends object> = {\n job: RunningJobSimple<TWorkflowInput>\n req: PayloadRequest\n}\n\nexport type TaskHandler<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput,\n TWorkflowSlug extends keyof TypedJobs['workflows'] = string,\n> = (\n args: TaskHandlerArgs<TTaskSlugOrInputOutput, TWorkflowSlug>,\n) => Promise<TaskHandlerResult<TTaskSlugOrInputOutput>> | TaskHandlerResult<TTaskSlugOrInputOutput>\n\nexport type TaskType = StringKeyOf<TypedJobs['tasks']>\n\n// Extracts the type of `input` corresponding to each task\nexport type TaskInput<T extends keyof TypedJobs['tasks']> = TypedJobs['tasks'][T]['input']\n\nexport type TaskOutput<T extends keyof TypedJobs['tasks']> = TypedJobs['tasks'][T]['output']\n\nexport type TaskHandlerResults = {\n [TTaskSlug in keyof TypedJobs['tasks']]: {\n [id: string]: TaskHandlerResult<TTaskSlug>\n }\n}\n\n// Helper type to create correct argument type for the function corresponding to each task.\nexport type RunTaskFunctionArgs<TTaskSlug extends keyof TypedJobs['tasks']> = {\n input?: TaskInput<TTaskSlug>\n /**\n * Specify the number of times that this task should be retried if it fails for any reason.\n * If this is undefined, the task will either inherit the retries from the workflow or have no retries.\n * If this is 0, the task will not be retried.\n *\n * @default By default, tasks are not retried and `retries` is `undefined`.\n */\n retries?: number | RetryConfig | undefined\n}\n\nexport type RunTaskFunction<TTaskSlug extends keyof TypedJobs['tasks']> = (\n taskID: string,\n taskArgs?: RunTaskFunctionArgs<TTaskSlug>,\n) => Promise<TaskOutput<TTaskSlug>>\n\nexport type RunTaskFunctions = {\n [TTaskSlug in keyof TypedJobs['tasks']]: RunTaskFunction<TTaskSlug>\n}\n\nexport type RunInlineTaskFunction = <TTaskInput extends object, TTaskOutput extends object>(\n taskID: string,\n taskArgs: {\n input?: TTaskInput\n /**\n * Specify the number of times that this task should be retried if it fails for any reason.\n * If this is undefined, the task will either inherit the retries from the workflow or have no retries.\n * If this is 0, the task will not be retried.\n *\n * @default By default, tasks are not retried and `retries` is `undefined`.\n */\n retries?: number | RetryConfig | undefined\n // This is the same as TaskHandler, but typed out explicitly in order to improve type inference\n task: (args: { input: TTaskInput; job: RunningJob<any>; req: PayloadRequest }) =>\n | {\n output: TTaskOutput\n state?: 'failed' | 'succeeded'\n }\n | Promise<{ output: TTaskOutput; state?: 'failed' | 'succeeded' }>\n },\n) => Promise<TTaskOutput>\n\nexport type ShouldRestoreFn = (args: {\n /**\n * Input data passed to the task\n */\n input: object\n job: BaseJob\n req: PayloadRequest\n taskStatus: SingleTaskStatus<string>\n}) => boolean | Promise<boolean>\n\nexport type RetryConfig = {\n /**\n * This controls how many times the task should be retried if it fails.\n *\n * @default undefined - attempts are either inherited from the workflow retry config or set to 0.\n */\n attempts?: number\n /**\n * The backoff strategy to use when retrying the task. This determines how long to wait before retrying the task.\n *\n * If this is set on a single task, the longest backoff time of a task will determine the time until the entire workflow is retried.\n */\n backoff?: {\n /**\n * Base delay between running jobs in ms\n */\n delay?: number\n /**\n * @default fixed\n *\n * The backoff strategy to use when retrying the task. This determines how long to wait before retrying the task.\n * If fixed (default) is used, the delay will be the same between each retry.\n *\n * If exponential is used, the delay will increase exponentially with each retry.\n *\n * @example\n * delay = 1000\n * attempts = 3\n * type = 'fixed'\n *\n * The task will be retried 3 times with a delay of 1000ms between each retry.\n *\n * @example\n * delay = 1000\n * attempts = 3\n * type = 'exponential'\n *\n * The task will be retried 3 times with a delay of 1000ms, 2000ms, and 4000ms between each retry.\n */\n type: 'exponential' | 'fixed'\n }\n /**\n * This controls whether the task output should be restored if the task previously succeeded and the workflow is being retried.\n *\n * If this is set to false, the task will be re-run even if it previously succeeded, ignoring the maximum number of retries.\n *\n * If this is set to true, the task will only be re-run if it previously failed.\n *\n * If this is a function, the return value of the function will determine whether the task should be re-run. This can be used for more complex restore logic,\n * e.g you may want to re-run a task up until a certain point and then restore it, or only re-run a task if the input has changed.\n *\n * @default true - the task output will be restored if the task previously succeeded.\n */\n shouldRestore?: boolean | ShouldRestoreFn\n}\n\nexport type TaskConfig<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput = TaskType,\n> = {\n /**\n * The function that should be responsible for running the job.\n * You can either pass a string-based path to the job function file, or the job function itself.\n *\n * If you are using large dependencies within your job, you might prefer to pass the string path\n * because that will avoid bundling large dependencies in your Next.js app. Passing a string path is an advanced feature\n * that may require a sophisticated build pipeline in order to work.\n */\n handler: string | TaskHandler<TTaskSlugOrInputOutput>\n /**\n * Define the input field schema - payload will generate a type for this schema.\n */\n inputSchema?: Field[]\n /**\n * You can use interfaceName to change the name of the interface that is generated for this task. By default, this is \"Task\" + the capitalized task slug.\n */\n interfaceName?: string\n /**\n * Define a human-friendly label for this task.\n */\n label?: string\n /**\n * Function to be executed if the task fails.\n */\n onFail?: () => Promise<void> | void\n /**\n * Function to be executed if the task succeeds.\n */\n onSuccess?: () => Promise<void> | void\n /**\n * Define the output field schema - payload will generate a type for this schema.\n */\n outputSchema?: Field[]\n /**\n * Specify the number of times that this step should be retried if it fails.\n * If this is undefined, the task will either inherit the retries from the workflow or have no retries.\n * If this is 0, the task will not be retried.\n *\n * @default By default, tasks are not retried and `retries` is `undefined`.\n */\n retries?: number | RetryConfig | undefined\n /**\n * Define a slug-based name for this job. This slug needs to be unique among both tasks and workflows.\n */\n slug: TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] ? TTaskSlugOrInputOutput : string\n}\n"],"names":[],"mappings":"AAyKA,WAgDC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getRunTaskFunction.d.ts","sourceRoot":"","sources":["../../../../../src/queues/operations/runJobs/runJob/getRunTaskFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EAErB,gBAAgB,EAChB,UAAU,EAEV,iBAAiB,EAElB,MAAM,oCAAoC,CAAA;AAC3C,OAAO,KAAK,EACV,OAAO,EAEP,gBAAgB,EAChB,cAAc,EAEf,MAAM,wCAAwC,CAAA;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAMlE,MAAM,MAAM,oBAAoB,GAAG;IACjC,iBAAiB,EAAE,OAAO,CAAA;CAC3B,CAAA;AAaD,wBAAsB,gBAAgB,CAAC,EACrC,KAAK,EACL,UAAU,EACV,KAAK,EACL,GAAG,EACH,UAAU,EACV,MAAM,EACN,GAAG,EACH,aAAa,EACb,YAAY,EACZ,KAAK,EACL,UAAU,EACV,MAAM,EACN,QAAQ,EACR,UAAU,EACV,SAAS,GACV,EAAE;IACD,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,UAAU,EAAE,IAAI,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,OAAO,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,cAAc,CAAA;IACnB,aAAa,EAAE,MAAM,GAAG,WAAW,CAAA;IACnC,YAAY,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAA;IACxC,KAAK,EAAE,oBAAoB,CAAA;IAC3B,UAAU,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAA;IAC/B,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,IAAI,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAA;IAC3C,SAAS,EAAE,iBAAiB,CAAA;CAC7B,GAAG,OAAO,CAAC,KAAK,CAAC,CAuEjB;AAED,eAAO,MAAM,kBAAkB,GAAI,SAAS,SAAS,OAAO,SACnD,oBAAoB,OACtB,OAAO,kBACI,cAAc,CAAC,MAAM,CAAC,OACjC,cAAc,YACT,SAAS,aACR,iBAAiB,KAC3B,SAAS,SAAS,IAAI,GAAG,qBAAqB,GAAG,gBAiLnD,CAAA"}
1
+ {"version":3,"file":"getRunTaskFunction.d.ts","sourceRoot":"","sources":["../../../../../src/queues/operations/runJobs/runJob/getRunTaskFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAA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nD,oBAAoB,OACtB,OAAO,kBACI,cAAc,CAAC,MAAM,CAAC,OACjC,cAAc,YACT,SAAS,aACR,iBAAiB,KAC3B,SAAS,SAAS,IAAI,GAAG,qBAAqB,GAAG,gBAuMnD,CAAA"}
@@ -80,29 +80,40 @@ export const getRunTaskFunction = (state, job, workflowConfig, req, isInline, up
80
80
  if (isInline) {
81
81
  inlineRunner = task;
82
82
  }
83
- let retriesConfig = retries;
84
83
  let taskConfig;
85
84
  if (!isInline) {
86
85
  taskConfig = req.payload.config.jobs.tasks.find((t)=>t.slug === taskSlug);
87
- if (!retriesConfig) {
88
- retriesConfig = taskConfig.retries;
89
- }
90
86
  if (!taskConfig) {
91
87
  throw new Error(`Task ${taskSlug} not found in workflow ${job.workflowSlug}`);
92
88
  }
93
89
  }
94
- let maxRetries = typeof retriesConfig === 'object' ? retriesConfig?.attempts : retriesConfig;
95
- if (maxRetries === undefined || maxRetries === null) {
96
- // Inherit retries from workflow config, if they are undefined and the workflow config has retries configured
97
- if (workflowConfig.retries !== undefined && workflowConfig.retries !== null) {
98
- maxRetries = typeof workflowConfig.retries === 'object' ? workflowConfig.retries.attempts : workflowConfig.retries;
99
- } else {
100
- maxRetries = 0;
101
- }
102
- }
90
+ const retriesConfigFromPropsNormalized = retries == undefined || retries == null ? {} : typeof retries === 'number' ? {
91
+ attempts: retries
92
+ } : retries;
93
+ const retriesConfigFromTaskConfigNormalized = taskConfig ? typeof taskConfig.retries === 'number' ? {
94
+ attempts: taskConfig.retries
95
+ } : taskConfig.retries : {};
96
+ const finalRetriesConfig = {
97
+ ...retriesConfigFromTaskConfigNormalized,
98
+ ...retriesConfigFromPropsNormalized
99
+ };
103
100
  const taskStatus = job?.taskStatus?.[taskSlug] ? job.taskStatus[taskSlug][taskID] : null;
101
+ // Handle restoration of task if it succeeded in a previous run
104
102
  if (taskStatus && taskStatus.complete === true) {
105
- return taskStatus.output;
103
+ let shouldRestore = true;
104
+ if (finalRetriesConfig?.shouldRestore === false) {
105
+ shouldRestore = false;
106
+ } else if (typeof finalRetriesConfig?.shouldRestore === 'function') {
107
+ shouldRestore = await finalRetriesConfig.shouldRestore({
108
+ input,
109
+ job,
110
+ req,
111
+ taskStatus
112
+ });
113
+ }
114
+ if (shouldRestore) {
115
+ return taskStatus.output;
116
+ }
106
117
  }
107
118
  let runner;
108
119
  if (isInline) {
@@ -137,6 +148,15 @@ export const getRunTaskFunction = (state, job, workflowConfig, req, isInline, up
137
148
  return;
138
149
  }
139
150
  let output = {};
151
+ let maxRetries = finalRetriesConfig?.attempts;
152
+ if (maxRetries === undefined || maxRetries === null) {
153
+ // Inherit retries from workflow config, if they are undefined and the workflow config has retries configured
154
+ if (workflowConfig.retries !== undefined && workflowConfig.retries !== null) {
155
+ maxRetries = typeof workflowConfig.retries === 'object' ? workflowConfig.retries.attempts : workflowConfig.retries;
156
+ } else {
157
+ maxRetries = 0;
158
+ }
159
+ }
140
160
  try {
141
161
  const runnerOutput = await runner({
142
162
  input,
@@ -151,7 +171,7 @@ export const getRunTaskFunction = (state, job, workflowConfig, req, isInline, up
151
171
  maxRetries,
152
172
  output,
153
173
  req,
154
- retriesConfig,
174
+ retriesConfig: finalRetriesConfig,
155
175
  runnerOutput,
156
176
  state,
157
177
  taskConfig,
@@ -173,7 +193,7 @@ export const getRunTaskFunction = (state, job, workflowConfig, req, isInline, up
173
193
  maxRetries,
174
194
  output,
175
195
  req,
176
- retriesConfig,
196
+ retriesConfig: finalRetriesConfig,
177
197
  state,
178
198
  taskConfig,
179
199
  taskID,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/queues/operations/runJobs/runJob/getRunTaskFunction.ts"],"sourcesContent":["import type { PayloadRequest } from '../../../../types/index.js'\nimport type {\n RetryConfig,\n RunInlineTaskFunction,\n RunTaskFunction,\n RunTaskFunctions,\n TaskConfig,\n TaskHandler,\n TaskHandlerResult,\n TaskType,\n} from '../../../config/types/taskTypes.js'\nimport type {\n BaseJob,\n RunningJob,\n SingleTaskStatus,\n WorkflowConfig,\n WorkflowTypes,\n} from '../../../config/types/workflowTypes.js'\nimport type { UpdateJobFunction } from './getUpdateJobFunction.js'\n\nimport { calculateBackoffWaitUntil } from './calculateBackoffWaitUntil.js'\nimport { importHandlerPath } from './importHandlerPath.js'\n\n// Helper object type to force being passed by reference\nexport type RunTaskFunctionState = {\n reachedMaxRetries: boolean\n}\n\nasync function getTaskHandlerFromConfig(taskConfig: TaskConfig<string>) {\n let handler: TaskHandler<TaskType>\n\n if (typeof taskConfig.handler === 'function') {\n handler = taskConfig.handler\n } else {\n handler = await importHandlerPath<TaskHandler<TaskType>>(taskConfig.handler)\n }\n return handler\n}\n\nexport async function handleTaskFailed({\n error,\n executedAt,\n input,\n job,\n maxRetries,\n output,\n req,\n retriesConfig,\n runnerOutput,\n state,\n taskConfig,\n taskID,\n taskSlug,\n taskStatus,\n updateJob,\n}: {\n error?: Error\n executedAt: Date\n input: object\n job: BaseJob\n maxRetries: number\n output: object\n req: PayloadRequest\n retriesConfig: number | RetryConfig\n runnerOutput?: TaskHandlerResult<string>\n state: RunTaskFunctionState\n taskConfig?: TaskConfig<string>\n taskID: string\n taskSlug: string\n taskStatus: null | SingleTaskStatus<string>\n updateJob: UpdateJobFunction\n}): Promise<never> {\n req.payload.logger.error({ err: error, job, msg: `Error running task ${taskID}`, taskSlug })\n\n if (taskConfig?.onFail) {\n await taskConfig.onFail()\n }\n\n if (!job.log) {\n job.log = []\n }\n const errorJSON = error\n ? {\n name: error.name,\n message: error.message,\n stack: error.stack,\n }\n : runnerOutput.state\n\n job.log.push({\n completedAt: new Date().toISOString(),\n error: errorJSON,\n executedAt: executedAt.toISOString(),\n input,\n output,\n state: 'failed',\n taskID,\n taskSlug,\n })\n\n if (job.waitUntil) {\n // Check if waitUntil is in the past\n const waitUntil = new Date(job.waitUntil)\n if (waitUntil < new Date()) {\n // Outdated waitUntil, remove it\n delete job.waitUntil\n }\n }\n\n if (!taskStatus?.complete && (taskStatus?.totalTried ?? 0) >= maxRetries) {\n state.reachedMaxRetries = true\n\n await updateJob({\n error,\n hasError: true,\n log: job.log,\n processing: false,\n waitUntil: job.waitUntil,\n })\n\n throw new Error(\n `Task ${taskSlug} has failed more than the allowed retries in workflow ${job.workflowSlug}${error ? `. Error: ${String(error)}` : ''}`,\n )\n } else {\n // Job will retry. Let's determine when!\n const waitUntil: Date = calculateBackoffWaitUntil({\n retriesConfig,\n totalTried: taskStatus?.totalTried ?? 0,\n })\n\n // Update job's waitUntil only if this waitUntil is later than the current one\n if (!job.waitUntil || waitUntil > new Date(job.waitUntil)) {\n job.waitUntil = waitUntil.toISOString()\n }\n\n await updateJob({\n log: job.log,\n processing: false,\n waitUntil: job.waitUntil,\n })\n throw error ?? new Error('Task failed')\n }\n}\n\nexport const getRunTaskFunction = <TIsInline extends boolean>(\n state: RunTaskFunctionState,\n job: BaseJob,\n workflowConfig: WorkflowConfig<string>,\n req: PayloadRequest,\n isInline: TIsInline,\n updateJob: UpdateJobFunction,\n): TIsInline extends true ? RunInlineTaskFunction : RunTaskFunctions => {\n const runTask: <TTaskSlug extends string>(\n taskSlug: TTaskSlug,\n ) => TTaskSlug extends 'inline' ? RunInlineTaskFunction : RunTaskFunction<TTaskSlug> = (\n taskSlug,\n ) =>\n (async (\n taskID: Parameters<RunInlineTaskFunction>[0],\n {\n input,\n retries,\n task,\n }: Parameters<RunInlineTaskFunction>[1] & Parameters<RunTaskFunction<string>>[1],\n ) => {\n const executedAt = new Date()\n\n let inlineRunner: TaskHandler<TaskType> = null\n if (isInline) {\n inlineRunner = task\n }\n\n let retriesConfig: number | RetryConfig = retries\n let taskConfig: TaskConfig<string>\n if (!isInline) {\n taskConfig = req.payload.config.jobs.tasks.find((t) => t.slug === taskSlug)\n if (!retriesConfig) {\n retriesConfig = taskConfig.retries\n }\n\n if (!taskConfig) {\n throw new Error(`Task ${taskSlug} not found in workflow ${job.workflowSlug}`)\n }\n }\n let maxRetries: number =\n typeof retriesConfig === 'object' ? retriesConfig?.attempts : retriesConfig\n\n if (maxRetries === undefined || maxRetries === null) {\n // Inherit retries from workflow config, if they are undefined and the workflow config has retries configured\n if (workflowConfig.retries !== undefined && workflowConfig.retries !== null) {\n maxRetries =\n typeof workflowConfig.retries === 'object'\n ? workflowConfig.retries.attempts\n : workflowConfig.retries\n } else {\n maxRetries = 0\n }\n }\n\n const taskStatus: null | SingleTaskStatus<string> = job?.taskStatus?.[taskSlug]\n ? job.taskStatus[taskSlug][taskID]\n : null\n\n if (taskStatus && taskStatus.complete === true) {\n return taskStatus.output\n }\n\n let runner: TaskHandler<TaskType>\n if (isInline) {\n runner = inlineRunner\n } else {\n if (!taskConfig) {\n throw new Error(`Task ${taskSlug} not found in workflow ${job.workflowSlug}`)\n }\n runner = await getTaskHandlerFromConfig(taskConfig)\n }\n\n if (!runner || typeof runner !== 'function') {\n const errorMessage = isInline\n ? `Can't find runner for inline task with ID ${taskID}`\n : `Can't find runner while importing with the path ${typeof workflowConfig.handler === 'string' ? workflowConfig.handler : 'unknown - no string path'} in job type ${job.workflowSlug} for task ${taskSlug}.`\n req.payload.logger.error(errorMessage)\n\n await updateJob({\n error: {\n error: errorMessage,\n },\n hasError: true,\n log: [\n ...job.log,\n {\n completedAt: new Date().toISOString(),\n error: errorMessage,\n executedAt: executedAt.toISOString(),\n state: 'failed',\n taskID,\n taskSlug,\n },\n ],\n processing: false,\n })\n\n return\n }\n\n let output: object = {}\n\n try {\n const runnerOutput = await runner({\n input,\n job: job as unknown as RunningJob<WorkflowTypes>, // TODO: Type this better\n req,\n })\n\n if (runnerOutput.state === 'failed') {\n await handleTaskFailed({\n executedAt,\n input,\n job,\n maxRetries,\n output,\n req,\n retriesConfig,\n runnerOutput,\n state,\n taskConfig,\n taskID,\n taskSlug,\n taskStatus,\n updateJob,\n })\n throw new Error('Task failed')\n } else {\n output = runnerOutput.output\n }\n } catch (err) {\n await handleTaskFailed({\n error: err,\n executedAt,\n input,\n job,\n maxRetries,\n output,\n req,\n retriesConfig,\n state,\n taskConfig,\n taskID,\n taskSlug,\n taskStatus,\n updateJob,\n })\n throw new Error('Task failed')\n }\n\n if (taskConfig?.onSuccess) {\n await taskConfig.onSuccess()\n }\n\n if (!job.log) {\n job.log = []\n }\n job.log.push({\n completedAt: new Date().toISOString(),\n executedAt: executedAt.toISOString(),\n input,\n output,\n state: 'succeeded',\n taskID,\n taskSlug,\n })\n\n await updateJob({\n log: job.log,\n })\n\n return output\n }) as any\n\n if (isInline) {\n return runTask('inline') as TIsInline extends true ? RunInlineTaskFunction : RunTaskFunctions\n } else {\n const tasks: RunTaskFunctions = {}\n for (const task of req?.payload?.config?.jobs?.tasks ?? []) {\n tasks[task.slug] = runTask(task.slug)\n }\n return tasks as TIsInline extends true ? RunInlineTaskFunction : RunTaskFunctions\n }\n}\n"],"names":["calculateBackoffWaitUntil","importHandlerPath","getTaskHandlerFromConfig","taskConfig","handler","handleTaskFailed","error","executedAt","input","job","maxRetries","output","req","retriesConfig","runnerOutput","state","taskID","taskSlug","taskStatus","updateJob","payload","logger","err","msg","onFail","log","errorJSON","name","message","stack","push","completedAt","Date","toISOString","waitUntil","complete","totalTried","reachedMaxRetries","hasError","processing","Error","workflowSlug","String","getRunTaskFunction","workflowConfig","isInline","runTask","retries","task","inlineRunner","config","jobs","tasks","find","t","slug","attempts","undefined","runner","errorMessage","onSuccess"],"mappings":"AAoBA,SAASA,yBAAyB,QAAQ,iCAAgC;AAC1E,SAASC,iBAAiB,QAAQ,yBAAwB;AAO1D,eAAeC,yBAAyBC,UAA8B;IACpE,IAAIC;IAEJ,IAAI,OAAOD,WAAWC,OAAO,KAAK,YAAY;QAC5CA,UAAUD,WAAWC,OAAO;IAC9B,OAAO;QACLA,UAAU,MAAMH,kBAAyCE,WAAWC,OAAO;IAC7E;IACA,OAAOA;AACT;AAEA,OAAO,eAAeC,iBAAiB,EACrCC,KAAK,EACLC,UAAU,EACVC,KAAK,EACLC,GAAG,EACHC,UAAU,EACVC,MAAM,EACNC,GAAG,EACHC,aAAa,EACbC,YAA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,KAAK,KAAK,UAAU;oBACnC,MAAMV,iBAAiB;wBACrBE;wBACAC;wBACAC;wBACAC;wBACAC;wBACAC;wBACAC;wBACAC;wBACAC;wBACAZ;wBACAa;wBACAC;wBACAC;wBACAC;oBACF;oBACA,MAAM,IAAIqB,MAAM;gBAClB,OAAO;oBACL7B,SAASG,aAAaH,MAAM;gBAC9B;YACF,EAAE,OAAOW,KAAK;gBACZ,MAAMjB,iBAAiB;oBACrBC,OAAOgB;oBACPf;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;oBACAE;oBACAZ;oBACAa;oBACAC;oBACAC;oBACAC;gBACF;gBACA,MAAM,IAAIqB,MAAM;YAClB;YAEA,IAAIrC,YAAYyD,WAAW;gBACzB,MAAMzD,WAAWyD,SAAS;YAC5B;YAEA,IAAI,CAACnD,IAAIgB,GAAG,EAAE;gBACZhB,IAAIgB,GAAG,GAAG,EAAE;YACd;YACAhB,IAAIgB,GAAG,CAACK,IAAI,CAAC;gBACXC,aAAa,IAAIC,OAAOC,WAAW;gBACnC1B,YAAYA,WAAW0B,WAAW;gBAClCzB;gBACAG;gBACAI,OAAO;gBACPC;gBACAC;YACF;YAEA,MAAME,UAAU;gBACdM,KAAKhB,IAAIgB,GAAG;YACd;YAEA,OAAOd;QACT;IAEF,IAAIkC,UAAU;QACZ,OAAOC,QAAQ;IACjB,OAAO;QACL,MAAMM,QAA0B,CAAC;QACjC,KAAK,MAAMJ,QAAQpC,KAAKQ,SAAS8B,QAAQC,MAAMC,SAAS,EAAE,CAAE;YAC1DA,KAAK,CAACJ,KAAKO,IAAI,CAAC,GAAGT,QAAQE,KAAKO,IAAI;QACtC;QACA,OAAOH;IACT;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/queues/operations/runJobs/runJob/getRunTaskFunction.ts"],"sourcesContent":["import type { PayloadRequest } from '../../../../types/index.js'\nimport type {\n RetryConfig,\n RunInlineTaskFunction,\n RunTaskFunction,\n RunTaskFunctions,\n TaskConfig,\n TaskHandler,\n TaskHandlerResult,\n TaskType,\n} from '../../../config/types/taskTypes.js'\nimport type {\n BaseJob,\n RunningJob,\n SingleTaskStatus,\n WorkflowConfig,\n WorkflowTypes,\n} from '../../../config/types/workflowTypes.js'\nimport type { UpdateJobFunction } from './getUpdateJobFunction.js'\n\nimport { calculateBackoffWaitUntil } from './calculateBackoffWaitUntil.js'\nimport { importHandlerPath } from './importHandlerPath.js'\n\n// Helper object type to force being passed by reference\nexport type RunTaskFunctionState = {\n reachedMaxRetries: boolean\n}\n\nasync function getTaskHandlerFromConfig(taskConfig: TaskConfig<string>) {\n let handler: TaskHandler<TaskType>\n\n if (typeof taskConfig.handler === 'function') {\n handler = taskConfig.handler\n } else {\n handler = await importHandlerPath<TaskHandler<TaskType>>(taskConfig.handler)\n }\n return handler\n}\n\nexport async function handleTaskFailed({\n error,\n executedAt,\n input,\n job,\n maxRetries,\n output,\n req,\n retriesConfig,\n runnerOutput,\n state,\n taskConfig,\n taskID,\n taskSlug,\n taskStatus,\n updateJob,\n}: {\n error?: Error\n executedAt: Date\n input: object\n job: BaseJob\n maxRetries: number\n output: object\n req: PayloadRequest\n retriesConfig: number | RetryConfig\n runnerOutput?: TaskHandlerResult<string>\n state: RunTaskFunctionState\n taskConfig?: TaskConfig<string>\n taskID: string\n taskSlug: string\n taskStatus: null | SingleTaskStatus<string>\n updateJob: UpdateJobFunction\n}): Promise<never> {\n req.payload.logger.error({ err: error, job, msg: `Error running task ${taskID}`, taskSlug })\n\n if (taskConfig?.onFail) {\n await taskConfig.onFail()\n }\n\n if (!job.log) {\n job.log = []\n }\n const errorJSON = error\n ? {\n name: error.name,\n message: error.message,\n stack: error.stack,\n }\n : runnerOutput.state\n\n job.log.push({\n completedAt: new Date().toISOString(),\n error: errorJSON,\n executedAt: executedAt.toISOString(),\n input,\n output,\n state: 'failed',\n taskID,\n taskSlug,\n })\n\n if (job.waitUntil) {\n // Check if waitUntil is in the past\n const waitUntil = new Date(job.waitUntil)\n if (waitUntil < new Date()) {\n // Outdated waitUntil, remove it\n delete job.waitUntil\n }\n }\n\n if (!taskStatus?.complete && (taskStatus?.totalTried ?? 0) >= maxRetries) {\n state.reachedMaxRetries = true\n\n await updateJob({\n error,\n hasError: true,\n log: job.log,\n processing: false,\n waitUntil: job.waitUntil,\n })\n\n throw new Error(\n `Task ${taskSlug} has failed more than the allowed retries in workflow ${job.workflowSlug}${error ? `. Error: ${String(error)}` : ''}`,\n )\n } else {\n // Job will retry. Let's determine when!\n const waitUntil: Date = calculateBackoffWaitUntil({\n retriesConfig,\n totalTried: taskStatus?.totalTried ?? 0,\n })\n\n // Update job's waitUntil only if this waitUntil is later than the current one\n if (!job.waitUntil || waitUntil > new Date(job.waitUntil)) {\n job.waitUntil = waitUntil.toISOString()\n }\n\n await updateJob({\n log: job.log,\n processing: false,\n waitUntil: job.waitUntil,\n })\n throw error ?? new Error('Task failed')\n }\n}\n\nexport const getRunTaskFunction = <TIsInline extends boolean>(\n state: RunTaskFunctionState,\n job: BaseJob,\n workflowConfig: WorkflowConfig<string>,\n req: PayloadRequest,\n isInline: TIsInline,\n updateJob: UpdateJobFunction,\n): TIsInline extends true ? RunInlineTaskFunction : RunTaskFunctions => {\n const runTask: <TTaskSlug extends string>(\n taskSlug: TTaskSlug,\n ) => TTaskSlug extends 'inline' ? RunInlineTaskFunction : RunTaskFunction<TTaskSlug> = (\n taskSlug,\n ) =>\n (async (\n taskID: Parameters<RunInlineTaskFunction>[0],\n {\n input,\n retries,\n task,\n }: Parameters<RunInlineTaskFunction>[1] & Parameters<RunTaskFunction<string>>[1],\n ) => {\n const executedAt = new Date()\n\n let inlineRunner: TaskHandler<TaskType> = null\n if (isInline) {\n inlineRunner = task\n }\n\n let taskConfig: TaskConfig<string>\n if (!isInline) {\n taskConfig = req.payload.config.jobs.tasks.find((t) => t.slug === taskSlug)\n\n if (!taskConfig) {\n throw new Error(`Task ${taskSlug} not found in workflow ${job.workflowSlug}`)\n }\n }\n\n const retriesConfigFromPropsNormalized =\n retries == undefined || retries == null\n ? {}\n : typeof retries === 'number'\n ? { attempts: retries }\n : retries\n const retriesConfigFromTaskConfigNormalized = taskConfig\n ? typeof taskConfig.retries === 'number'\n ? { attempts: taskConfig.retries }\n : taskConfig.retries\n : {}\n\n const finalRetriesConfig: RetryConfig = {\n ...retriesConfigFromTaskConfigNormalized,\n ...retriesConfigFromPropsNormalized, // Retry config from props takes precedence\n }\n\n const taskStatus: null | SingleTaskStatus<string> = job?.taskStatus?.[taskSlug]\n ? job.taskStatus[taskSlug][taskID]\n : null\n\n // Handle restoration of task if it succeeded in a previous run\n if (taskStatus && taskStatus.complete === true) {\n let shouldRestore = true\n if (finalRetriesConfig?.shouldRestore === false) {\n shouldRestore = false\n } else if (typeof finalRetriesConfig?.shouldRestore === 'function') {\n shouldRestore = await finalRetriesConfig.shouldRestore({ input, job, req, taskStatus })\n }\n if (shouldRestore) {\n return taskStatus.output\n }\n }\n\n let runner: TaskHandler<TaskType>\n if (isInline) {\n runner = inlineRunner\n } else {\n if (!taskConfig) {\n throw new Error(`Task ${taskSlug} not found in workflow ${job.workflowSlug}`)\n }\n runner = await getTaskHandlerFromConfig(taskConfig)\n }\n\n if (!runner || typeof runner !== 'function') {\n const errorMessage = isInline\n ? `Can't find runner for inline task with ID ${taskID}`\n : `Can't find runner while importing with the path ${typeof workflowConfig.handler === 'string' ? workflowConfig.handler : 'unknown - no string path'} in job type ${job.workflowSlug} for task ${taskSlug}.`\n req.payload.logger.error(errorMessage)\n\n await updateJob({\n error: {\n error: errorMessage,\n },\n hasError: true,\n log: [\n ...job.log,\n {\n completedAt: new Date().toISOString(),\n error: errorMessage,\n executedAt: executedAt.toISOString(),\n state: 'failed',\n taskID,\n taskSlug,\n },\n ],\n processing: false,\n })\n\n return\n }\n\n let output: object = {}\n\n let maxRetries: number | undefined = finalRetriesConfig?.attempts\n\n if (maxRetries === undefined || maxRetries === null) {\n // Inherit retries from workflow config, if they are undefined and the workflow config has retries configured\n if (workflowConfig.retries !== undefined && workflowConfig.retries !== null) {\n maxRetries =\n typeof workflowConfig.retries === 'object'\n ? workflowConfig.retries.attempts\n : workflowConfig.retries\n } else {\n maxRetries = 0\n }\n }\n\n try {\n const runnerOutput = await runner({\n input,\n job: job as unknown as RunningJob<WorkflowTypes>, // TODO: Type this better\n req,\n })\n\n if (runnerOutput.state === 'failed') {\n await handleTaskFailed({\n executedAt,\n input,\n job,\n maxRetries,\n output,\n req,\n retriesConfig: finalRetriesConfig,\n runnerOutput,\n state,\n taskConfig,\n taskID,\n taskSlug,\n taskStatus,\n updateJob,\n })\n throw new Error('Task failed')\n } else {\n output = runnerOutput.output\n }\n } catch (err) {\n await handleTaskFailed({\n error: err,\n executedAt,\n input,\n job,\n maxRetries,\n output,\n req,\n retriesConfig: finalRetriesConfig,\n state,\n taskConfig,\n taskID,\n taskSlug,\n taskStatus,\n updateJob,\n })\n throw new Error('Task failed')\n }\n\n if (taskConfig?.onSuccess) {\n await taskConfig.onSuccess()\n }\n\n if (!job.log) {\n job.log = []\n }\n job.log.push({\n completedAt: new Date().toISOString(),\n executedAt: executedAt.toISOString(),\n input,\n output,\n state: 'succeeded',\n taskID,\n taskSlug,\n })\n\n await updateJob({\n log: job.log,\n })\n\n return output\n }) as any\n\n if (isInline) {\n return runTask('inline') as TIsInline extends true ? RunInlineTaskFunction : RunTaskFunctions\n } else {\n const tasks: RunTaskFunctions = {}\n for (const task of req?.payload?.config?.jobs?.tasks ?? []) {\n tasks[task.slug] = runTask(task.slug)\n }\n return tasks as TIsInline extends true ? RunInlineTaskFunction : RunTaskFunctions\n }\n}\n"],"names":["calculateBackoffWaitUntil","importHandlerPath","getTaskHandlerFromConfig","taskConfig","handler","handleTaskFailed","error","executedAt","input","job","maxRetries","output","req","retriesConfig","runnerOutput","state","taskID","taskSlug","taskStatus","updateJob","payload","logger","err","msg","onFail","log","errorJSON","name","message","stack","push","completedAt","Date","toISOString","waitUntil","complete","totalTried","reachedMaxRetries","hasError","processing","Error","workflowSlug","String","getRunTaskFunction","workflowConfig","isInline","runTask","retries","task","inlineRunner","config","jobs","tasks","find","t","slug","retriesConfigFromPropsNormalized","undefined","attempts","retriesConfigFromTaskConfigNormalized","finalRetriesConfig","shouldRestore","runner","errorMessage","onSuccess"],"mappings":"AAoBA,SAASA,yBAAyB,QAAQ,iCAAgC;AAC1E,SAASC,iBAAiB,QAAQ,yBAAwB;AAO1D,eAAeC,yBAAyBC,UAA8B;IACpE,IAAIC;IAEJ,IAAI,OAAOD,WAAWC,OAAO,KAAK,YAAY;QAC5CA,UAAUD,WAAWC,OAAO;IAC9B,OAAO;QACLA,UAAU,MAAMH,kBAAyCE,WAAWC,OAAO;IAC7E;IACA,OAAOA;AACT;AAEA,OAAO,eAAeC,iBAAiB,EACrCC,KAAK,EACLC,UAAU,EACVC,KAAK,EACLC,GAAG,EACHC,UAAU,EACVC,MAAM,EACNC,GAAG,EACHC,aAAa,EACbC,YAAY,EACZC,KAAK,EACLZ,UAAU,EACVa,MAAM,EACNC,QAAQ,EACRC,UAAU,EACVC,SAAS,EAiBV;IACCP,IAAIQ,OAAO,CAACC,MAAM,CAACf,KAAK,CAAC;QAAEgB,KAAKhB;QAAOG;QAAKc,KAAK,CAAC,mBAAmB,EAAEP,QAAQ;QAAEC;IAAS;IAE1F,IAAId,YAAYqB,QAAQ;QACtB,MAAMrB,WAAWqB,MAAM;IACzB;IAEA,IAAI,CAACf,IAAIgB,GAAG,EAAE;QACZhB,IAAIgB,GAAG,GAAG,EAAE;IACd;IACA,MAAMC,YAAYpB,QACd;QACEqB,MAAMrB,MAAMqB,IAAI;QAChBC,SAAStB,MAAMsB,OAAO;QACtBC,OAAOvB,MAAMuB,KAAK;IACpB,IACAf,aAAaC,KAAK;IAEtBN,IAAIgB,GAAG,CAACK,IAAI,CAAC;QACXC,aAAa,IAAIC,OAAOC,WAAW;QACnC3B,OAAOoB;QACPnB,YAAYA,WAAW0B,WAAW;QAClCzB;QACAG;QACAI,OAAO;QACPC;QACAC;IACF;IAE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gBAClB,OAAO;oBACL7B,SAASG,aAAaH,MAAM;gBAC9B;YACF,EAAE,OAAOW,KAAK;gBACZ,MAAMjB,iBAAiB;oBACrBC,OAAOgB;oBACPf;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC,eAAe+C;oBACf7C;oBACAZ;oBACAa;oBACAC;oBACAC;oBACAC;gBACF;gBACA,MAAM,IAAIqB,MAAM;YAClB;YAEA,IAAIrC,YAAY6D,WAAW;gBACzB,MAAM7D,WAAW6D,SAAS;YAC5B;YAEA,IAAI,CAACvD,IAAIgB,GAAG,EAAE;gBACZhB,IAAIgB,GAAG,GAAG,EAAE;YACd;YACAhB,IAAIgB,GAAG,CAACK,IAAI,CAAC;gBACXC,aAAa,IAAIC,OAAOC,WAAW;gBACnC1B,YAAYA,WAAW0B,WAAW;gBAClCzB;gBACAG;gBACAI,OAAO;gBACPC;gBACAC;YACF;YAEA,MAAME,UAAU;gBACdM,KAAKhB,IAAIgB,GAAG;YACd;YAEA,OAAOd;QACT;IAEF,IAAIkC,UAAU;QACZ,OAAOC,QAAQ;IACjB,OAAO;QACL,MAAMM,QAA0B,CAAC;QACjC,KAAK,MAAMJ,QAAQpC,KAAKQ,SAAS8B,QAAQC,MAAMC,SAAS,EAAE,CAAE;YAC1DA,KAAK,CAACJ,KAAKO,IAAI,CAAC,GAAGT,QAAQE,KAAKO,IAAI;QACtC;QACA,OAAOH;IACT;AACF,EAAC"}
@@ -1,7 +1,7 @@
1
1
  import { mimeTypeValidator } from './mimeTypeValidator.js';
2
2
  const generateURL = ({ collectionSlug, config, filename })=>{
3
3
  if (filename) {
4
- return `${config.serverURL || ''}${config.routes.api || ''}/${collectionSlug}/file/${filename}`;
4
+ return `${config.serverURL || ''}${config.routes.api || ''}/${collectionSlug}/file/${encodeURIComponent(filename)}`;
5
5
  }
6
6
  return undefined;
7
7
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/uploads/getBaseFields.ts"],"sourcesContent":["import type { CollectionConfig } from '../collections/config/types.js'\nimport type { Config } from '../config/types.js'\nimport type { Field } from '../fields/config/types.js'\nimport type { UploadConfig } from './types.js'\n\nimport { mimeTypeValidator } from './mimeTypeValidator.js'\n\ntype GenerateURLArgs = {\n collectionSlug: string\n config: Config\n filename?: string\n}\nconst generateURL = ({ collectionSlug, config, filename }: GenerateURLArgs) => {\n if (filename) {\n return `${config.serverURL || ''}${config.routes.api || ''}/${collectionSlug}/file/${filename}`\n }\n return undefined\n}\n\ntype Options = {\n collection: CollectionConfig\n config: Config\n}\n\nexport const getBaseUploadFields = ({ collection, config }: Options): Field[] => {\n const uploadOptions: UploadConfig = typeof collection.upload === 'object' ? collection.upload : {}\n\n const mimeType: Field = {\n name: 'mimeType',\n type: 'text',\n admin: {\n hidden: true,\n readOnly: true,\n },\n label: 'MIME Type',\n }\n\n const thumbnailURL: Field = {\n name: 'thumbnailURL',\n type: 'text',\n admin: {\n hidden: true,\n readOnly: true,\n },\n hooks: {\n afterRead: [\n ({ originalDoc }) => {\n const adminThumbnail =\n typeof collection.upload !== 'boolean' ? collection.upload?.adminThumbnail : undefined\n\n if (typeof adminThumbnail === 'function') {\n return adminThumbnail({ doc: originalDoc })\n }\n\n if (\n typeof adminThumbnail === 'string' &&\n 'sizes' in originalDoc &&\n originalDoc.sizes?.[adminThumbnail]?.filename\n ) {\n return generateURL({\n collectionSlug: collection.slug,\n config,\n filename: originalDoc.sizes?.[adminThumbnail].filename as string,\n })\n }\n\n return null\n },\n ],\n },\n label: 'Thumbnail URL',\n }\n\n const width: Field = {\n name: 'width',\n type: 'number',\n admin: {\n hidden: true,\n readOnly: true,\n },\n label: ({ t }) => t('upload:width'),\n }\n\n const height: Field = {\n name: 'height',\n type: 'number',\n admin: {\n hidden: true,\n readOnly: true,\n },\n label: ({ t }) => t('upload:height'),\n }\n\n const filesize: Field = {\n name: 'filesize',\n type: 'number',\n admin: {\n hidden: true,\n readOnly: true,\n },\n label: ({ t }) => t('upload:fileSize'),\n }\n\n const filename: Field = {\n name: 'filename',\n type: 'text',\n admin: {\n disableBulkEdit: true,\n hidden: true,\n readOnly: true,\n },\n index: true,\n label: ({ t }) => t('upload:fileName'),\n }\n\n // Only set unique: true if the collection does not have a compound index\n if (\n collection.upload === true ||\n (typeof collection.upload === 'object' && !collection.upload.filenameCompoundIndex)\n ) {\n filename.unique = true\n }\n\n const url: Field = {\n name: 'url',\n type: 'text',\n admin: {\n hidden: true,\n readOnly: true,\n },\n label: 'URL',\n }\n\n let uploadFields: Field[] = [\n {\n ...url,\n hooks: {\n afterRead: [\n ({ data, value }) => {\n if (value && !data.filename) {\n return value\n }\n\n return generateURL({\n collectionSlug: collection.slug,\n config,\n filename: data?.filename,\n })\n },\n ],\n },\n },\n thumbnailURL,\n filename,\n mimeType,\n filesize,\n width,\n height,\n ]\n\n // Add focal point fields if not disabled\n if (\n uploadOptions.focalPoint !== false ||\n uploadOptions.imageSizes ||\n uploadOptions.resizeOptions\n ) {\n uploadFields = uploadFields.concat(\n ['focalX', 'focalY'].map((name) => {\n return {\n name,\n type: 'number',\n admin: {\n hidden: true,\n },\n }\n }),\n )\n }\n\n if (uploadOptions.mimeTypes) {\n mimeType.validate = mimeTypeValidator(uploadOptions.mimeTypes)\n }\n\n if (uploadOptions.imageSizes) {\n uploadFields = uploadFields.concat([\n {\n name: 'sizes',\n type: 'group',\n admin: {\n hidden: true,\n },\n fields: uploadOptions.imageSizes.map((size) => ({\n name: size.name,\n type: 'group',\n admin: {\n hidden: true,\n },\n fields: [\n {\n ...url,\n hooks: {\n afterRead: [\n ({ data, value }) => {\n if (value && size.height && size.width && !data.filename) {\n return value\n }\n\n const sizeFilename = data?.sizes?.[size.name]?.filename\n\n if (sizeFilename) {\n return `${config.serverURL}${config.routes.api}/${collection.slug}/file/${sizeFilename}`\n }\n\n return null\n },\n ],\n },\n },\n width,\n height,\n mimeType,\n filesize,\n {\n ...filename,\n unique: false,\n },\n ],\n label: size.name,\n })),\n label: ({ t }) => t('upload:sizes'),\n },\n ])\n }\n return uploadFields\n}\n"],"names":["mimeTypeValidator","generateURL","collectionSlug","config","filename","serverURL","routes","api","undefined","getBaseUploadFields","collection","uploadOptions","upload","mimeType","name","type","admin","hidden","readOnly","label","thumbnailURL","hooks","afterRead","originalDoc","adminThumbnail","doc","sizes","slug","width","t","height","filesize","disableBulkEdit","index","filenameCompoundIndex","unique","url","uploadFields","data","value","focalPoint","imageSizes","resizeOptions","concat","map","mimeTypes","validate","fields","size","sizeFilename"],"mappings":"AAKA,SAASA,iBAAiB,QAAQ,yBAAwB;AAO1D,MAAMC,cAAc,CAAC,EAAEC,cAAc,EAAEC,MAAM,EAAEC,QAAQ,EAAmB;IACxE,IAAIA,UAAU;QACZ,OAAO,GAAGD,OAAOE,SAAS,IAAI,KAAKF,OAAOG,MAAM,CAACC,GAAG,IAAI,GAAG,CAAC,EAAEL,eAAe,MAAM,EAAEE,UAAU;IACjG;IACA,OAAOI;AACT;AAOA,OAAO,MAAMC,sBAAsB,CAAC,EAAEC,UAAU,EAAEP,MAAM,EAAW;IACjE,MAAMQ,gBAA8B,OAAOD,WAAWE,MAAM,KAAK,WAAWF,WAAWE,MAAM,GAAG,CAAC;IAEjG,MAAMC,WAAkB;QACtBC,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,QAAQ;YACRC,UAAU;QACZ;QACAC,OAAO;IACT;IAEA,MAAMC,eAAsB;QAC1BN,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,QAAQ;YACRC,UAAU;QACZ;QACAG,OAAO;YACLC,WAAW;gBACT,CAAC,EAAEC,WAAW,EAAE;oBACd,MAAMC,iBACJ,OAAOd,WAAWE,MAAM,KAAK,YAAYF,WAAWE,MAAM,EAAEY,iBAAiBhB;oBAE/E,IAAI,OAAOgB,mBAAmB,YAAY;wBACxC,OAAOA,eAAe;4BAAEC,KAAKF;wBAAY;oBAC3C;oBAEA,IACE,OAAOC,mBAAmB,YAC1B,WAAWD,eACXA,YAAYG,KAAK,EAAE,CAACF,eAAe,EAAEp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AAWiB,IAAI,CAAC,MAAM,EAAEsB,cAAc;4CAC1F;4CAEA,OAAO;wCACT;qCACD;gCACH;4BACF;4BACArB;4BACAE;4BACAjB;4BACAkB;4BACA;gCACE,GAAG3B,QAAQ;gCACX+B,QAAQ;4BACV;yBACD;wBACDhB,OAAO6B,KAAKlC,IAAI;oBAClB,CAAA;gBACAK,OAAO,CAAC,EAAEU,CAAC,EAAE,GAAKA,EAAE;YACtB;SACD;IACH;IACA,OAAOQ;AACT,EAAC"}
1
+ {"version":3,"sources":["../../src/uploads/getBaseFields.ts"],"sourcesContent":["import type { CollectionConfig } from '../collections/config/types.js'\nimport type { Config } from '../config/types.js'\nimport type { Field } from '../fields/config/types.js'\nimport type { UploadConfig } from './types.js'\n\nimport { mimeTypeValidator } from './mimeTypeValidator.js'\n\ntype GenerateURLArgs = {\n collectionSlug: string\n config: Config\n filename?: string\n}\nconst generateURL = ({ collectionSlug, config, filename }: GenerateURLArgs) => {\n if (filename) {\n return `${config.serverURL || ''}${config.routes.api || ''}/${collectionSlug}/file/${encodeURIComponent(filename)}`\n }\n return undefined\n}\n\ntype Options = {\n collection: CollectionConfig\n config: Config\n}\n\nexport const getBaseUploadFields = ({ collection, config }: Options): Field[] => {\n const uploadOptions: UploadConfig = typeof collection.upload === 'object' ? collection.upload : {}\n\n const mimeType: Field = {\n name: 'mimeType',\n type: 'text',\n admin: {\n hidden: true,\n readOnly: true,\n },\n label: 'MIME Type',\n }\n\n const thumbnailURL: Field = {\n name: 'thumbnailURL',\n type: 'text',\n admin: {\n hidden: true,\n readOnly: true,\n },\n hooks: {\n afterRead: [\n ({ originalDoc }) => {\n const adminThumbnail =\n typeof collection.upload !== 'boolean' ? collection.upload?.adminThumbnail : undefined\n\n if (typeof adminThumbnail === 'function') {\n return adminThumbnail({ doc: originalDoc })\n }\n\n if (\n typeof adminThumbnail === 'string' &&\n 'sizes' in originalDoc &&\n originalDoc.sizes?.[adminThumbnail]?.filename\n ) {\n return generateURL({\n collectionSlug: collection.slug,\n config,\n filename: originalDoc.sizes?.[adminThumbnail].filename as string,\n })\n }\n\n return null\n },\n ],\n },\n label: 'Thumbnail URL',\n }\n\n const width: Field = {\n name: 'width',\n type: 'number',\n admin: {\n hidden: true,\n readOnly: true,\n },\n label: ({ t }) => t('upload:width'),\n }\n\n const height: Field = {\n name: 'height',\n type: 'number',\n admin: {\n hidden: true,\n readOnly: true,\n },\n label: ({ t }) => t('upload:height'),\n }\n\n const filesize: Field = {\n name: 'filesize',\n type: 'number',\n admin: {\n hidden: true,\n readOnly: true,\n },\n label: ({ t }) => t('upload:fileSize'),\n }\n\n const filename: Field = {\n name: 'filename',\n type: 'text',\n admin: {\n disableBulkEdit: true,\n hidden: true,\n readOnly: true,\n },\n index: true,\n label: ({ t }) => t('upload:fileName'),\n }\n\n // Only set unique: true if the collection does not have a compound index\n if (\n collection.upload === true ||\n (typeof collection.upload === 'object' && !collection.upload.filenameCompoundIndex)\n ) {\n filename.unique = true\n }\n\n const url: Field = {\n name: 'url',\n type: 'text',\n admin: {\n hidden: true,\n readOnly: true,\n },\n label: 'URL',\n }\n\n let uploadFields: Field[] = [\n {\n ...url,\n hooks: {\n afterRead: [\n ({ data, value }) => {\n if (value && !data.filename) {\n return value\n }\n\n return generateURL({\n collectionSlug: collection.slug,\n config,\n filename: data?.filename,\n })\n },\n ],\n },\n },\n thumbnailURL,\n filename,\n mimeType,\n filesize,\n width,\n height,\n ]\n\n // Add focal point fields if not disabled\n if (\n uploadOptions.focalPoint !== false ||\n uploadOptions.imageSizes ||\n uploadOptions.resizeOptions\n ) {\n uploadFields = uploadFields.concat(\n ['focalX', 'focalY'].map((name) => {\n return {\n name,\n type: 'number',\n admin: {\n hidden: true,\n },\n }\n }),\n )\n }\n\n if (uploadOptions.mimeTypes) {\n mimeType.validate = mimeTypeValidator(uploadOptions.mimeTypes)\n }\n\n if (uploadOptions.imageSizes) {\n uploadFields = uploadFields.concat([\n {\n name: 'sizes',\n type: 'group',\n admin: {\n hidden: true,\n },\n fields: uploadOptions.imageSizes.map((size) => ({\n name: size.name,\n type: 'group',\n admin: {\n hidden: true,\n },\n fields: [\n {\n ...url,\n hooks: {\n afterRead: [\n ({ data, value }) => {\n if (value && size.height && size.width && !data.filename) {\n return value\n }\n\n const sizeFilename = data?.sizes?.[size.name]?.filename\n\n if (sizeFilename) {\n return `${config.serverURL}${config.routes.api}/${collection.slug}/file/${sizeFilename}`\n }\n\n return null\n },\n ],\n },\n },\n width,\n height,\n mimeType,\n filesize,\n {\n ...filename,\n unique: false,\n },\n ],\n label: size.name,\n })),\n label: ({ t }) => t('upload:sizes'),\n },\n ])\n }\n return uploadFields\n}\n"],"names":["mimeTypeValidator","generateURL","collectionSlug","config","filename","serverURL","routes","api","encodeURIComponent","undefined","getBaseUploadFields","collection","uploadOptions","upload","mimeType","name","type","admin","hidden","readOnly","label","thumbnailURL","hooks","afterRead","originalDoc","adminThumbnail","doc","sizes","slug","width","t","height","filesize","disableBulkEdit","index","filenameCompoundIndex","unique","url","uploadFields","data","value","focalPoint","imageSizes","resizeOptions","concat","map","mimeTypes","validate","fields","size","sizeFilename"],"mappings":"AAKA,SAASA,iBAAiB,QAAQ,yBAAwB;AAO1D,MAAMC,cAAc,CAAC,EAAEC,cAAc,EAAEC,MAAM,EAAEC,QAAQ,EAAmB;IACxE,IAAIA,UAAU;QACZ,OAAO,GAAGD,OAAOE,SAAS,IAAI,KAAKF,OAAOG,MAAM,CAACC,GAAG,IAAI,GAAG,CAAC,EAAEL,eAAe,MAAM,EAAEM,mBAAmBJ,WAAW;IACrH;IACA,OAAOK;AACT;AAOA,OAAO,MAAMC,sBAAsB,CAAC,EAAEC,UAAU,EAAER,MAAM,EAAW;IACjE,MAAMS,gBAA8B,OAAOD,WAAWE,MAAM,KAAK,WAAWF,WAAWE,MAAM,GAAG,CAAC;IAEjG,MAAMC,WAAkB;QACtBC,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,QAAQ;YACRC,UAAU;QACZ;QACAC,OAAO;I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BACA8B,QAAQ;4BACN;gCACE,GAAGX,GAAG;gCACNf,OAAO;oCACLC,WAAW;wCACT,CAAC,EAAEgB,IAAI,EAAEC,KAAK,EAAE;4CACd,IAAIA,SAASS,KAAKlB,MAAM,IAAIkB,KAAKpB,KAAK,IAAI,CAACU,KAAKnC,QAAQ,EAAE;gDACxD,OAAOoC;4CACT;4CAEA,MAAMU,eAAeX,MAAMZ,OAAO,CAACsB,KAAKlC,IAAI,CAAC,EAAEX;4CAE/C,IAAI8C,cAAc;gDAChB,OAAO,GAAG/C,OAAOE,SAAS,GAAGF,OAAOG,MAAM,CAACC,GAAG,CAAC,CAAC,EAAEI,WAAWiB,IAAI,CAAC,MAAM,EAAEsB,cAAc;4CAC1F;4CAEA,OAAO;wCACT;qCACD;gCACH;4BACF;4BACArB;4BACAE;4BACAjB;4BACAkB;4BACA;gCACE,GAAG5B,QAAQ;gCACXgC,QAAQ;4BACV;yBACD;wBACDhB,OAAO6B,KAAKlC,IAAI;oBAClB,CAAA;gBACAK,OAAO,CAAC,EAAEU,CAAC,EAAE,GAAKA,EAAE;YACtB;SACD;IACH;IACA,OAAOQ;AACT,EAAC"}
@@ -20,7 +20,6 @@ export type TraverseFieldsCallback = (args: {
20
20
  type TraverseFieldsArgs = {
21
21
  callback: TraverseFieldsCallback;
22
22
  fields: (Field | TabAsField)[];
23
- /** fill empty properties to use this without data */
24
23
  fillEmpty?: boolean;
25
24
  parentRef?: Record<string, unknown> | unknown;
26
25
  ref?: Record<string, unknown> | unknown;
@@ -30,8 +29,9 @@ type TraverseFieldsArgs = {
30
29
  *
31
30
  * @param fields
32
31
  * @param callback callback called for each field, discontinue looping if callback returns truthy
33
- * @param ref
34
- * @param parentRef
32
+ * @param fillEmpty fill empty properties to use this without data
33
+ * @param ref the data or any artifacts assigned in the callback during field recursion
34
+ * @param parentRef the data or any artifacts assigned in the callback during field recursion one level up
35
35
  */
36
36
  export declare const traverseFields: ({ callback, fields, fillEmpty, parentRef, ref, }: TraverseFieldsArgs) => void;
37
37
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"traverseFields.d.ts","sourceRoot":"","sources":["../../src/utilities/traverseFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA2B,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AA8B3F,MAAM,MAAM,sBAAsB,GAAG,CAAC,IAAI,EAAE;IAC1C;;OAEG;IACH,KAAK,EAAE,KAAK,GAAG,UAAU,CAAA;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,IAAI,CAAA;IACjB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAA;IAC7C;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAA;CACxC,KAAK,OAAO,GAAG,IAAI,CAAA;AAEpB,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,sBAAsB,CAAA;IAChC,MAAM,EAAE,CAAC,KAAK,GAAG,UAAU,CAAC,EAAE,CAAA;IAC9B,qDAAqD;IACrD,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAA;IAC7C,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAA;CACxC,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,qDAMxB,kBAAkB,KAAG,IA4JvB,CAAA"}
1
+ {"version":3,"file":"traverseFields.d.ts","sourceRoot":"","sources":["../../src/utilities/traverseFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA2B,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AA2C3F,MAAM,MAAM,sBAAsB,GAAG,CAAC,IAAI,EAAE;IAC1C;;OAEG;IACH,KAAK,EAAE,KAAK,GAAG,UAAU,CAAA;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,IAAI,CAAA;IACjB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAA;IAC7C;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAA;CACxC,KAAK,OAAO,GAAG,IAAI,CAAA;AAEpB,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,sBAAsB,CAAA;IAChC,MAAM,EAAE,CAAC,KAAK,GAAG,UAAU,CAAC,EAAE,CAAA;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAA;IAC7C,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAA;CACxC,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,qDAMxB,kBAAkB,KAAG,IAkKvB,CAAA"}
@@ -1,5 +1,24 @@
1
1
  import { fieldHasSubFields } from '../fields/config/types.js';
2
- const traverseArrayOrBlocksField = ({ callback, data, field, parentRef })=>{
2
+ const traverseArrayOrBlocksField = ({ callback, data, field, fillEmpty, parentRef })=>{
3
+ if (fillEmpty) {
4
+ if (field.type === 'array') {
5
+ traverseFields({
6
+ callback,
7
+ fields: field.fields,
8
+ parentRef
9
+ });
10
+ }
11
+ if (field.type === 'blocks') {
12
+ field.blocks.forEach((block)=>{
13
+ traverseFields({
14
+ callback,
15
+ fields: block.fields,
16
+ parentRef
17
+ });
18
+ });
19
+ }
20
+ return;
21
+ }
3
22
  for (const ref of data){
4
23
  let fields;
5
24
  if (field.type === 'blocks' && typeof ref?.blockType === 'string') {
@@ -12,6 +31,7 @@ const traverseArrayOrBlocksField = ({ callback, data, field, parentRef })=>{
12
31
  traverseFields({
13
32
  callback,
14
33
  fields,
34
+ fillEmpty,
15
35
  parentRef,
16
36
  ref
17
37
  });
@@ -23,8 +43,9 @@ const traverseArrayOrBlocksField = ({ callback, data, field, parentRef })=>{
23
43
  *
24
44
  * @param fields
25
45
  * @param callback callback called for each field, discontinue looping if callback returns truthy
26
- * @param ref
27
- * @param parentRef
46
+ * @param fillEmpty fill empty properties to use this without data
47
+ * @param ref the data or any artifacts assigned in the callback during field recursion
48
+ * @param parentRef the data or any artifacts assigned in the callback during field recursion one level up
28
49
  */ export const traverseFields = ({ callback, fields, fillEmpty = true, parentRef = {}, ref = {} })=>{
29
50
  fields.some((field)=>{
30
51
  let skip = false;
@@ -66,6 +87,7 @@ const traverseArrayOrBlocksField = ({ callback, data, field, parentRef })=>{
66
87
  traverseFields({
67
88
  callback,
68
89
  fields: tab.fields,
90
+ fillEmpty,
69
91
  parentRef: currentParentRef,
70
92
  ref: tabRef[key]
71
93
  });
@@ -88,6 +110,7 @@ const traverseArrayOrBlocksField = ({ callback, data, field, parentRef })=>{
88
110
  traverseFields({
89
111
  callback,
90
112
  fields: tab.fields,
113
+ fillEmpty,
91
114
  parentRef: currentParentRef,
92
115
  ref: tabRef
93
116
  });
@@ -120,6 +143,7 @@ const traverseArrayOrBlocksField = ({ callback, data, field, parentRef })=>{
120
143
  traverseFields({
121
144
  callback,
122
145
  fields: field.fields,
146
+ fillEmpty,
123
147
  parentRef: currentParentRef,
124
148
  ref: currentRef[key]
125
149
  });
@@ -141,6 +165,7 @@ const traverseArrayOrBlocksField = ({ callback, data, field, parentRef })=>{
141
165
  callback,
142
166
  data: localeData,
143
167
  field,
168
+ fillEmpty,
144
169
  parentRef: currentParentRef
145
170
  });
146
171
  }
@@ -149,6 +174,7 @@ const traverseArrayOrBlocksField = ({ callback, data, field, parentRef })=>{
149
174
  callback,
150
175
  data: currentRef,
151
176
  field,
177
+ fillEmpty,
152
178
  parentRef: currentParentRef
153
179
  });
154
180
  }
@@ -156,6 +182,7 @@ const traverseArrayOrBlocksField = ({ callback, data, field, parentRef })=>{
156
182
  traverseFields({
157
183
  callback,
158
184
  fields: field.fields,
185
+ fillEmpty,
159
186
  parentRef: currentParentRef,
160
187
  ref: currentRef
161
188
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/traverseFields.ts"],"sourcesContent":["import type { ArrayField, BlocksField, Field, TabAsField } from '../fields/config/types.js'\n\nimport { fieldHasSubFields } from '../fields/config/types.js'\n\nconst traverseArrayOrBlocksField = ({\n callback,\n data,\n field,\n parentRef,\n}: {\n callback: TraverseFieldsCallback\n data: Record<string, unknown>[]\n field: ArrayField | BlocksField\n parentRef?: unknown\n}) => {\n for (const ref of data) {\n let fields: Field[]\n if (field.type === 'blocks' && typeof ref?.blockType === 'string') {\n const block = field.blocks.find((block) => block.slug === ref.blockType)\n fields = block?.fields\n } else if (field.type === 'array') {\n fields = field.fields\n }\n\n if (fields) {\n traverseFields({ callback, fields, parentRef, ref })\n }\n }\n}\n\nexport type TraverseFieldsCallback = (args: {\n /**\n * The current field\n */\n field: Field | TabAsField\n /**\n * Function that when called will skip the current field and continue to the next\n */\n next?: () => void\n /**\n * The parent reference object\n */\n parentRef?: Record<string, unknown> | unknown\n /**\n * The current reference object\n */\n ref?: Record<string, unknown> | unknown\n}) => boolean | void\n\ntype TraverseFieldsArgs = {\n callback: TraverseFieldsCallback\n fields: (Field | TabAsField)[]\n /** fill empty properties to use this without data */\n fillEmpty?: boolean\n parentRef?: Record<string, unknown> | unknown\n ref?: Record<string, unknown> | unknown\n}\n\n/**\n * Iterate a recurse an array of fields, calling a callback for each field\n *\n * @param fields\n * @param callback callback called for each field, discontinue looping if callback returns truthy\n * @param ref\n * @param parentRef\n */\nexport const traverseFields = ({\n callback,\n fields,\n fillEmpty = true,\n parentRef = {},\n ref = {},\n}: TraverseFieldsArgs): void => {\n fields.some((field) => {\n let skip = false\n const next = () => {\n skip = true\n }\n\n if (!ref || typeof ref !== 'object') {\n return\n }\n\n if (callback && callback({ field, next, parentRef, ref })) {\n return true\n }\n\n if (skip) {\n return false\n }\n\n // avoid mutation of ref for all fields\n let currentRef = ref\n let currentParentRef = parentRef\n\n if (field.type === 'tabs' && 'tabs' in field) {\n for (const tab of field.tabs) {\n let tabRef = ref\n if ('name' in tab && tab.name) {\n if (!ref[tab.name] || typeof ref[tab.name] !== 'object') {\n if (fillEmpty) {\n ref[tab.name] = {}\n } else {\n continue\n }\n }\n\n tabRef = tabRef[tab.name]\n\n if (tab.localized) {\n for (const key in tabRef as Record<string, unknown>) {\n if (tabRef[key] && typeof tabRef[key] === 'object') {\n traverseFields({\n callback,\n fields: tab.fields,\n parentRef: currentParentRef,\n ref: tabRef[key],\n })\n }\n }\n continue\n }\n }\n\n if (\n callback &&\n callback({\n field: { ...tab, type: 'tab' },\n next,\n parentRef: currentParentRef,\n ref: tabRef,\n })\n ) {\n return true\n }\n\n traverseFields({\n callback,\n fields: tab.fields,\n parentRef: currentParentRef,\n ref: tabRef,\n })\n }\n\n return\n }\n\n if (field.type !== 'tab' && (fieldHasSubFields(field) || field.type === 'blocks')) {\n if ('name' in field && field.name) {\n currentParentRef = currentRef\n if (!ref[field.name]) {\n if (fillEmpty) {\n if (field.type === 'group') {\n ref[field.name] = {}\n } else if (field.type === 'array' || field.type === 'blocks') {\n if (field.localized) {\n ref[field.name] = {}\n } else {\n ref[field.name] = []\n }\n }\n } else {\n return\n }\n }\n currentRef = ref[field.name]\n }\n\n if (\n field.type === 'group' &&\n field.localized &&\n currentRef &&\n typeof currentRef === 'object'\n ) {\n for (const key in currentRef as Record<string, unknown>) {\n if (currentRef[key]) {\n traverseFields({\n callback,\n fields: field.fields,\n parentRef: currentParentRef,\n ref: currentRef[key],\n })\n }\n }\n return\n }\n\n if (\n (field.type === 'blocks' || field.type === 'array') &&\n currentRef &&\n typeof currentRef === 'object'\n ) {\n if (field.localized) {\n if (Array.isArray(currentRef)) {\n return\n }\n\n for (const key in currentRef as Record<string, unknown>) {\n const localeData = currentRef[key]\n if (!Array.isArray(localeData)) {\n continue\n }\n\n traverseArrayOrBlocksField({\n callback,\n data: localeData,\n field,\n parentRef: currentParentRef,\n })\n }\n } else if (Array.isArray(currentRef)) {\n traverseArrayOrBlocksField({\n callback,\n data: currentRef as Record<string, unknown>[],\n field,\n parentRef: currentParentRef,\n })\n }\n } else if (currentRef && typeof currentRef === 'object' && 'fields' in field) {\n traverseFields({\n callback,\n fields: field.fields,\n parentRef: currentParentRef,\n ref: currentRef,\n })\n }\n }\n })\n}\n"],"names":["fieldHasSubFields","traverseArrayOrBlocksField","callback","data","field","parentRef","ref","fields","type","blockType","block","blocks","find","slug","traverseFields","fillEmpty","some","skip","next","currentRef","currentParentRef","tab","tabs","tabRef","name","localized","key","Array","isArray","localeData"],"mappings":"AAEA,SAASA,iBAAiB,QAAQ,4BAA2B;AAE7D,MAAMC,6BAA6B,CAAC,EAClCC,QAAQ,EACRC,IAAI,EACJC,KAAK,EACLC,SAAS,EAMV;IACC,KAAK,MAAMC,OAAOH,KAAM;QACtB,IAAII;QACJ,IAAIH,MAAMI,IAAI,KAAK,YAAY,OAAOF,KAAKG,cAAc,UAAU;YACjE,MAAMC,QAAQN,MAAMO,MAAM,CAACC,IAAI,CAAC,CAACF,QAAUA,MAAMG,IAAI,KAAKP,IAAIG,SAAS;YACvEF,SAASG,OAAOH;QAClB,OAAO,IAAIH,MAAMI,IAAI,KAAK,SAAS;YACjCD,SAASH,MAAMG,MAAM;QACvB;QAEA,IAAIA,QAAQ;YACVO,eAAe;gBAAEZ;gBAAUK;gBAAQF;gBAAWC;YAAI;QACpD;IACF;AACF;AA8BA;;;;;;;CAOC,GACD,OAAO,MAAMQ,iBAAiB,CAAC,EAC7BZ,QAAQ,EACRK,MAAM,EACNQ,YAAY,IAAI,EAChBV,YAAY,CAAC,CAAC,EACdC,MAAM,CAAC,CAAC,EACW;IACnBC,OAAOS,IAAI,CAAC,CAACZ;QACX,IAAIa,OAAO;QACX,MAAMC,OAAO;YACXD,OAAO;QACT;QAEA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wBACF;wBAEA5B,2BAA2B;4BACzBC;4BACAC,MAAM0B;4BACNzB;4BACAC,WAAWe;wBACb;oBACF;gBACF,OAAO,IAAIO,MAAMC,OAAO,CAACT,aAAa;oBACpClB,2BAA2B;wBACzBC;wBACAC,MAAMgB;wBACNf;wBACAC,WAAWe;oBACb;gBACF;YACF,OAAO,IAAID,cAAc,OAAOA,eAAe,YAAY,YAAYf,OAAO;gBAC5EU,eAAe;oBACbZ;oBACAK,QAAQH,MAAMG,MAAM;oBACpBF,WAAWe;oBACXd,KAAKa;gBACP;YACF;QACF;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../../src/utilities/traverseFields.ts"],"sourcesContent":["import type { ArrayField, BlocksField, Field, TabAsField } from '../fields/config/types.js'\n\nimport { fieldHasSubFields } from '../fields/config/types.js'\n\nconst traverseArrayOrBlocksField = ({\n callback,\n data,\n field,\n fillEmpty,\n parentRef,\n}: {\n callback: TraverseFieldsCallback\n data: Record<string, unknown>[]\n field: ArrayField | BlocksField\n fillEmpty: boolean\n parentRef?: unknown\n}) => {\n if (fillEmpty) {\n if (field.type === 'array') {\n traverseFields({ callback, fields: field.fields, parentRef })\n }\n if (field.type === 'blocks') {\n field.blocks.forEach((block) => {\n traverseFields({ callback, fields: block.fields, parentRef })\n })\n }\n return\n }\n for (const ref of data) {\n let fields: Field[]\n if (field.type === 'blocks' && typeof ref?.blockType === 'string') {\n const block = field.blocks.find((block) => block.slug === ref.blockType)\n fields = block?.fields\n } else if (field.type === 'array') {\n fields = field.fields\n }\n\n if (fields) {\n traverseFields({ callback, fields, fillEmpty, parentRef, ref })\n }\n }\n}\n\nexport type TraverseFieldsCallback = (args: {\n /**\n * The current field\n */\n field: Field | TabAsField\n /**\n * Function that when called will skip the current field and continue to the next\n */\n next?: () => void\n /**\n * The parent reference object\n */\n parentRef?: Record<string, unknown> | unknown\n /**\n * The current reference object\n */\n ref?: Record<string, unknown> | unknown\n}) => boolean | void\n\ntype TraverseFieldsArgs = {\n callback: TraverseFieldsCallback\n fields: (Field | TabAsField)[]\n fillEmpty?: boolean\n parentRef?: Record<string, unknown> | unknown\n ref?: Record<string, unknown> | unknown\n}\n\n/**\n * Iterate a recurse an array of fields, calling a callback for each field\n *\n * @param fields\n * @param callback callback called for each field, discontinue looping if callback returns truthy\n * @param fillEmpty fill empty properties to use this without data\n * @param ref the data or any artifacts assigned in the callback during field recursion\n * @param parentRef the data or any artifacts assigned in the callback during field recursion one level up\n */\nexport const traverseFields = ({\n callback,\n fields,\n fillEmpty = true,\n parentRef = {},\n ref = {},\n}: TraverseFieldsArgs): void => {\n fields.some((field) => {\n let skip = false\n const next = () => {\n skip = true\n }\n\n if (!ref || typeof ref !== 'object') {\n return\n }\n\n if (callback && callback({ field, next, parentRef, ref })) {\n return true\n }\n\n if (skip) {\n return false\n }\n\n // avoid mutation of ref for all fields\n let currentRef = ref\n let currentParentRef = parentRef\n\n if (field.type === 'tabs' && 'tabs' in field) {\n for (const tab of field.tabs) {\n let tabRef = ref\n if ('name' in tab && tab.name) {\n if (!ref[tab.name] || typeof ref[tab.name] !== 'object') {\n if (fillEmpty) {\n ref[tab.name] = {}\n } else {\n continue\n }\n }\n\n tabRef = tabRef[tab.name]\n\n if (tab.localized) {\n for (const key in tabRef as Record<string, unknown>) {\n if (tabRef[key] && typeof tabRef[key] === 'object') {\n traverseFields({\n callback,\n fields: tab.fields,\n fillEmpty,\n parentRef: currentParentRef,\n ref: tabRef[key],\n })\n }\n }\n continue\n }\n }\n\n if (\n callback &&\n callback({\n field: { ...tab, type: 'tab' },\n next,\n parentRef: currentParentRef,\n ref: tabRef,\n })\n ) {\n return true\n }\n\n traverseFields({\n callback,\n fields: tab.fields,\n fillEmpty,\n parentRef: currentParentRef,\n ref: tabRef,\n })\n }\n\n return\n }\n\n if (field.type !== 'tab' && (fieldHasSubFields(field) || field.type === 'blocks')) {\n if ('name' in field && field.name) {\n currentParentRef = currentRef\n if (!ref[field.name]) {\n if (fillEmpty) {\n if (field.type === 'group') {\n ref[field.name] = {}\n } else if (field.type === 'array' || field.type === 'blocks') {\n if (field.localized) {\n ref[field.name] = {}\n } else {\n ref[field.name] = []\n }\n }\n } else {\n return\n }\n }\n currentRef = ref[field.name]\n }\n\n if (\n field.type === 'group' &&\n field.localized &&\n currentRef &&\n typeof currentRef === 'object'\n ) {\n for (const key in currentRef as Record<string, unknown>) {\n if (currentRef[key]) {\n traverseFields({\n callback,\n fields: field.fields,\n fillEmpty,\n parentRef: currentParentRef,\n ref: currentRef[key],\n })\n }\n }\n return\n }\n\n if (\n (field.type === 'blocks' || field.type === 'array') &&\n currentRef &&\n typeof currentRef === 'object'\n ) {\n if (field.localized) {\n if (Array.isArray(currentRef)) {\n return\n }\n\n for (const key in currentRef as Record<string, unknown>) {\n const localeData = currentRef[key]\n if (!Array.isArray(localeData)) {\n continue\n }\n\n traverseArrayOrBlocksField({\n callback,\n data: localeData,\n field,\n fillEmpty,\n parentRef: currentParentRef,\n })\n }\n } else if (Array.isArray(currentRef)) {\n traverseArrayOrBlocksField({\n callback,\n data: currentRef as Record<string, unknown>[],\n field,\n fillEmpty,\n parentRef: currentParentRef,\n })\n }\n } else if (currentRef && typeof currentRef === 'object' && 'fields' in field) {\n traverseFields({\n callback,\n fields: field.fields,\n fillEmpty,\n parentRef: currentParentRef,\n ref: currentRef,\n })\n }\n }\n })\n}\n"],"names":["fieldHasSubFields","traverseArrayOrBlocksField","callback","data","field","fillEmpty","parentRef","type","traverseFields","fields","blocks","forEach","block","ref","blockType","find","slug","some","skip","next","currentRef","currentParentRef","tab","tabs","tabRef","name","localized","key","Array","isArray","localeData"],"mappings":"AAEA,SAASA,iBAAiB,QAAQ,4BAA2B;AAE7D,MAAMC,6BAA6B,CAAC,EAClCC,QAAQ,EACRC,IAAI,EACJC,KAAK,EACLC,SAAS,EACTC,SAAS,EAOV;IACC,IAAID,WAAW;QACb,IAAID,MAAMG,IAAI,KAAK,SAAS;YAC1BC,eAAe;gBAAEN;gBAAUO,QAAQL,MAAMK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AAKO;gBACP;YACF;QACF;IACF;AACF,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payload",
3
- "version": "3.8.0",
3
+ "version": "3.9.0",
4
4
  "description": "Node, React, Headless CMS and Application Framework built on Next.js",
5
5
  "keywords": [
6
6
  "admin panel",
@@ -97,7 +97,7 @@
97
97
  "tsx": "4.19.2",
98
98
  "uuid": "10.0.0",
99
99
  "ws": "^8.16.0",
100
- "@payloadcms/translations": "3.8.0"
100
+ "@payloadcms/translations": "3.9.0"
101
101
  },
102
102
  "devDependencies": {
103
103
  "@hyrious/esbuild-plugin-commonjs": "^0.2.4",
File without changes