payload 3.55.0-internal.f8c92b5 → 3.55.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 (132) hide show
  1. package/dist/admin/fields/Row.d.ts +4 -2
  2. package/dist/admin/fields/Row.d.ts.map +1 -1
  3. package/dist/admin/fields/Row.js.map +1 -1
  4. package/dist/admin/forms/Diff.d.ts +5 -4
  5. package/dist/admin/forms/Diff.d.ts.map +1 -1
  6. package/dist/admin/forms/Diff.js.map +1 -1
  7. package/dist/admin/forms/Field.d.ts +0 -7
  8. package/dist/admin/forms/Field.d.ts.map +1 -1
  9. package/dist/admin/forms/Field.js.map +1 -1
  10. package/dist/admin/forms/Form.d.ts +2 -1
  11. package/dist/admin/forms/Form.d.ts.map +1 -1
  12. package/dist/admin/forms/Form.js.map +1 -1
  13. package/dist/admin/functions/index.d.ts +3 -25
  14. package/dist/admin/functions/index.d.ts.map +1 -1
  15. package/dist/admin/functions/index.js.map +1 -1
  16. package/dist/admin/views/index.d.ts +4 -1
  17. package/dist/admin/views/index.d.ts.map +1 -1
  18. package/dist/admin/views/index.js.map +1 -1
  19. package/dist/auth/operations/resetPassword.d.ts.map +1 -1
  20. package/dist/auth/operations/resetPassword.js +12 -1
  21. package/dist/auth/operations/resetPassword.js.map +1 -1
  22. package/dist/auth/types.d.ts +1 -1
  23. package/dist/auth/types.d.ts.map +1 -1
  24. package/dist/auth/types.js.map +1 -1
  25. package/dist/collections/config/types.d.ts +11 -2
  26. package/dist/collections/config/types.d.ts.map +1 -1
  27. package/dist/collections/config/types.js.map +1 -1
  28. package/dist/collections/endpoints/findByID.d.ts.map +1 -1
  29. package/dist/collections/endpoints/findByID.js +5 -4
  30. package/dist/collections/endpoints/findByID.js.map +1 -1
  31. package/dist/collections/operations/create.d.ts.map +1 -1
  32. package/dist/collections/operations/create.js +1 -0
  33. package/dist/collections/operations/create.js.map +1 -1
  34. package/dist/collections/operations/findByID.d.ts +5 -0
  35. package/dist/collections/operations/findByID.d.ts.map +1 -1
  36. package/dist/collections/operations/findByID.js +1 -1
  37. package/dist/collections/operations/findByID.js.map +1 -1
  38. package/dist/collections/operations/local/findByID.d.ts +5 -0
  39. package/dist/collections/operations/local/findByID.d.ts.map +1 -1
  40. package/dist/collections/operations/local/findByID.js +2 -1
  41. package/dist/collections/operations/local/findByID.js.map +1 -1
  42. package/dist/collections/operations/utilities/update.d.ts.map +1 -1
  43. package/dist/collections/operations/utilities/update.js +1 -0
  44. package/dist/collections/operations/utilities/update.js.map +1 -1
  45. package/dist/config/client.d.ts +29 -3
  46. package/dist/config/client.d.ts.map +1 -1
  47. package/dist/config/client.js +22 -0
  48. package/dist/config/client.js.map +1 -1
  49. package/dist/config/defaults.d.ts.map +1 -1
  50. package/dist/config/defaults.js +2 -0
  51. package/dist/config/defaults.js.map +1 -1
  52. package/dist/config/types.d.ts +24 -2
  53. package/dist/config/types.d.ts.map +1 -1
  54. package/dist/config/types.js.map +1 -1
  55. package/dist/database/types.d.ts +2 -0
  56. package/dist/database/types.d.ts.map +1 -1
  57. package/dist/database/types.js.map +1 -1
  58. package/dist/exports/shared.d.ts +0 -1
  59. package/dist/exports/shared.d.ts.map +1 -1
  60. package/dist/exports/shared.js +0 -1
  61. package/dist/exports/shared.js.map +1 -1
  62. package/dist/folders/types.d.ts +2 -2
  63. package/dist/folders/types.d.ts.map +1 -1
  64. package/dist/folders/types.js.map +1 -1
  65. package/dist/folders/utils/getFolderData.d.ts.map +1 -1
  66. package/dist/folders/utils/getFolderData.js +3 -14
  67. package/dist/folders/utils/getFolderData.js.map +1 -1
  68. package/dist/globals/endpoints/findOne.d.ts.map +1 -1
  69. package/dist/globals/endpoints/findOne.js +4 -3
  70. package/dist/globals/endpoints/findOne.js.map +1 -1
  71. package/dist/globals/operations/findOne.d.ts +5 -0
  72. package/dist/globals/operations/findOne.d.ts.map +1 -1
  73. package/dist/globals/operations/findOne.js +1 -1
  74. package/dist/globals/operations/findOne.js.map +1 -1
  75. package/dist/globals/operations/local/findOne.d.ts +5 -0
  76. package/dist/globals/operations/local/findOne.d.ts.map +1 -1
  77. package/dist/globals/operations/local/findOne.js +2 -1
  78. package/dist/globals/operations/local/findOne.js.map +1 -1
  79. package/dist/globals/operations/update.d.ts.map +1 -1
  80. package/dist/globals/operations/update.js +1 -0
  81. package/dist/globals/operations/update.js.map +1 -1
  82. package/dist/index.d.ts +1 -2
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +1 -1
  85. package/dist/index.js.map +1 -1
  86. package/dist/preferences/types.d.ts +1 -0
  87. package/dist/preferences/types.d.ts.map +1 -1
  88. package/dist/preferences/types.js.map +1 -1
  89. package/dist/uploads/getBaseFields.d.ts.map +1 -1
  90. package/dist/uploads/getBaseFields.js +76 -5
  91. package/dist/uploads/getBaseFields.js.map +1 -1
  92. package/dist/uploads/types.d.ts +21 -0
  93. package/dist/uploads/types.d.ts.map +1 -1
  94. package/dist/uploads/types.js.map +1 -1
  95. package/dist/utilities/flattenTopLevelFields.d.ts +1 -1
  96. package/dist/utilities/flattenTopLevelFields.d.ts.map +1 -1
  97. package/dist/utilities/flattenTopLevelFields.js +1 -1
  98. package/dist/utilities/flattenTopLevelFields.js.map +1 -1
  99. package/dist/utilities/getFieldPermissions.d.ts +7 -5
  100. package/dist/utilities/getFieldPermissions.d.ts.map +1 -1
  101. package/dist/utilities/getFieldPermissions.js.map +1 -1
  102. package/dist/utilities/handleEndpoints.d.ts.map +1 -1
  103. package/dist/utilities/handleEndpoints.js +30 -10
  104. package/dist/utilities/handleEndpoints.js.map +1 -1
  105. package/dist/utilities/headersWithCors.d.ts.map +1 -1
  106. package/dist/utilities/headersWithCors.js +2 -1
  107. package/dist/utilities/headersWithCors.js.map +1 -1
  108. package/dist/versions/baseFields.d.ts +2 -0
  109. package/dist/versions/baseFields.d.ts.map +1 -1
  110. package/dist/versions/baseFields.js +23 -0
  111. package/dist/versions/baseFields.js.map +1 -1
  112. package/dist/versions/buildCollectionFields.d.ts.map +1 -1
  113. package/dist/versions/buildCollectionFields.js +16 -1
  114. package/dist/versions/buildCollectionFields.js.map +1 -1
  115. package/dist/versions/buildGlobalFields.d.ts.map +1 -1
  116. package/dist/versions/buildGlobalFields.js +16 -1
  117. package/dist/versions/buildGlobalFields.js.map +1 -1
  118. package/dist/versions/drafts/replaceWithDraftIfAvailable.d.ts.map +1 -1
  119. package/dist/versions/drafts/replaceWithDraftIfAvailable.js +6 -0
  120. package/dist/versions/drafts/replaceWithDraftIfAvailable.js.map +1 -1
  121. package/dist/versions/saveVersion.d.ts +2 -1
  122. package/dist/versions/saveVersion.d.ts.map +1 -1
  123. package/dist/versions/saveVersion.js +64 -31
  124. package/dist/versions/saveVersion.js.map +1 -1
  125. package/dist/versions/types.d.ts +1 -0
  126. package/dist/versions/types.d.ts.map +1 -1
  127. package/dist/versions/types.js.map +1 -1
  128. package/package.json +2 -2
  129. package/dist/utilities/fieldSchemaToJSON.d.ts +0 -14
  130. package/dist/utilities/fieldSchemaToJSON.d.ts.map +0 -1
  131. package/dist/utilities/fieldSchemaToJSON.js +0 -91
  132. package/dist/utilities/fieldSchemaToJSON.js.map +0 -1
@@ -1,9 +1,11 @@
1
1
  import type { MarkOptional } from 'ts-essentials';
2
2
  import type { RowField, RowFieldClient } from '../../fields/config/types.js';
3
- import type { ClientComponentProps, ClientFieldBase, FieldClientComponent, FieldPaths, FieldServerComponent, ServerFieldBase } from '../forms/Field.js';
3
+ import type { ClientFieldBase, FieldClientComponent, FieldPaths, FieldServerComponent, ServerFieldBase } from '../forms/Field.js';
4
4
  import type { FieldDescriptionClientComponent, FieldDescriptionServerComponent, FieldDiffClientComponent, FieldDiffServerComponent, FieldErrorClientComponent, FieldErrorServerComponent, FieldLabelClientComponent, FieldLabelServerComponent } from '../types.js';
5
5
  type RowFieldClientWithoutType = MarkOptional<RowFieldClient, 'type'>;
6
- type RowFieldBaseClientProps = Omit<FieldPaths, 'path'> & Pick<ClientComponentProps, 'forceRender'>;
6
+ type RowFieldBaseClientProps = {
7
+ readonly forceRender?: boolean;
8
+ } & Omit<FieldPaths, 'path'>;
7
9
  export type RowFieldClientProps = Omit<ClientFieldBase<RowFieldClientWithoutType>, 'path'> & RowFieldBaseClientProps;
8
10
  export type RowFieldServerProps = ServerFieldBase<RowField, RowFieldClientWithoutType>;
9
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,oBAAoB,EACpB,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,wBAAwB,EACxB,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,yBAAyB,EACzB,yBAAyB,EAC1B,MAAM,aAAa,CAAA;AAEpB,KAAK,yBAAyB,GAAG,YAAY,CAAC,cAAc,EAAE,MAAM,CAAC,CAAA;AAErE,KAAK,uBAAuB,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,oBAAoB,EAAE,aAAa,CAAC,CAAA;AAEnG,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,eAAe,CAAC,yBAAyB,CAAC,EAAE,MAAM,CAAC,GACxF,uBAAuB,CAAA;AAEzB,MAAM,MAAM,mBAAmB,GAAG,eAAe,CAAC,QAAQ,EAAE,yBAAyB,CAAC,CAAA;AAEtF,MAAM,MAAM,uBAAuB,GAAG,oBAAoB,CAAC,QAAQ,EAAE,yBAAyB,CAAC,CAAA;AAE/F,MAAM,MAAM,uBAAuB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AC,WAAW,CAAC,EAAE,OAAO,CAAA;CAC/B,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;AAE5B,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,eAAe,CAAC,yBAAyB,CAAC,EAAE,MAAM,CAAC,GACxF,uBAAuB,CAAA;AAEzB,MAAM,MAAM,mBAAmB,GAAG,eAAe,CAAC,QAAQ,EAAE,yBAAyB,CAAC,CAAA;AAEtF,MAAM,MAAM,uBAAuB,GAAG,oBAAoB,CAAC,QAAQ,EAAE,yBAAyB,CAAC,CAAA;AAE/F,MAAM,MAAM,uBAAuB,GAAG,oBAAoB,CACxD,yBAAyB,EACzB,uBAAuB,CACxB,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG,yBAAyB,CAClE,QAAQ,EACR,yBAAyB,CAC1B,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG,yBAAyB,CAAC,yBAAyB,CAAC,CAAA;AAE/F,MAAM,MAAM,kCAAkC,GAAG,+BAA+B,CAC9E,QAAQ,EACR,yBAAyB,CAC1B,CAAA;AAED,MAAM,MAAM,kCAAkC,GAC5C,+BAA+B,CAAC,yBAAyB,CAAC,CAAA;AAE5D,MAAM,MAAM,4BAA4B,GAAG,yBAAyB,CAClE,QAAQ,EACR,yBAAyB,CAC1B,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG,yBAAyB,CAAC,yBAAyB,CAAC,CAAA;AAE/F,MAAM,MAAM,2BAA2B,GAAG,wBAAwB,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAA;AAE5F,MAAM,MAAM,2BAA2B,GAAG,wBAAwB,CAAC,cAAc,CAAC,CAAA"}
@@ -1 +1 @@
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 ClientComponentProps,\n ClientFieldBase,\n FieldClientComponent,\n FieldPaths,\n FieldServerComponent,\n ServerFieldBase,\n} from '../forms/Field.js'\nimport type {\n FieldDescriptionClientComponent,\n FieldDescriptionServerComponent,\n FieldDiffClientComponent,\n FieldDiffServerComponent,\n FieldErrorClientComponent,\n FieldErrorServerComponent,\n FieldLabelClientComponent,\n FieldLabelServerComponent,\n} from '../types.js'\n\ntype RowFieldClientWithoutType = MarkOptional<RowFieldClient, 'type'>\n\ntype RowFieldBaseClientProps = Omit<FieldPaths, 'path'> & Pick<ClientComponentProps, 'forceRender'>\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\nexport type RowFieldDiffServerComponent = FieldDiffServerComponent<RowField, RowFieldClient>\n\nexport type RowFieldDiffClientComponent = FieldDiffClientComponent<RowFieldClient>\n"],"names":[],"mappings":"AA8DA,WAAkF"}
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 FieldDiffClientComponent,\n FieldDiffServerComponent,\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\nexport type RowFieldDiffServerComponent = FieldDiffServerComponent<RowField, RowFieldClient>\n\nexport type RowFieldDiffClientComponent = FieldDiffClientComponent<RowFieldClient>\n"],"names":[],"mappings":"AA+DA,WAAkF"}
@@ -1,6 +1,6 @@
1
1
  import type { I18nClient } from '@payloadcms/translations';
2
2
  import type { ClientField, Field, FieldTypes, Tab } from '../../fields/config/types.js';
3
- import type { ClientFieldWithOptionalType, PayloadRequest, SanitizedFieldPermissions } from '../../index.js';
3
+ import type { ClientFieldWithOptionalType, PayloadRequest, SanitizedFieldPermissions, SanitizedFieldsPermissions } from '../../index.js';
4
4
  export type VersionTab = {
5
5
  fields: VersionField[];
6
6
  name?: string;
@@ -44,9 +44,10 @@ export type FieldDiffClientProps<TClientField extends ClientFieldWithOptionalTyp
44
44
  */
45
45
  diffMethod: any;
46
46
  field: TClientField;
47
- fieldPermissions: {
48
- [key: string]: SanitizedFieldPermissions;
49
- } | true;
47
+ /**
48
+ * Permissions at this level of the field. If this field is unnamed, this will be `SanitizedFieldsPermissions` - if it is named, it will be `SanitizedFieldPermissions`
49
+ */
50
+ fieldPermissions: SanitizedFieldPermissions | SanitizedFieldsPermissions;
50
51
  /**
51
52
  * If this field is localized, this will be the locale of the field
52
53
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Diff.d.ts","sourceRoot":"","sources":["../../../src/admin/forms/Diff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,8BAA8B,CAAA;AACvF,OAAO,KAAK,EACV,2BAA2B,EAC3B,cAAc,EACd,yBAAyB,EAC1B,MAAM,gBAAgB,CAAA;AAEvB,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,YAAY,EAAE,CAAA;IACtB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,GAAG,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;AAEtB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACjC,MAAM,EAAE,YAAY,EAAE,CAAA;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,YAAY,EAAE,EAAE,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,UAA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AA2B,GAAG,2BAA2B,IAC5E,KAAK,CAAC,aAAa,CAAC,oBAAoB,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/admin/forms/Diff.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\n\nimport type { ClientField, Field, FieldTypes, Tab } from '../../fields/config/types.js'\nimport type {\n ClientFieldWithOptionalType,\n PayloadRequest,\n SanitizedFieldPermissions,\n} from '../../index.js'\n\nexport type VersionTab = {\n fields: VersionField[]\n name?: string\n} & Pick<Tab, 'label'>\n\nexport type BaseVersionField = {\n CustomComponent?: React.ReactNode\n fields: VersionField[]\n path: string\n rows?: VersionField[][]\n schemaPath: string\n tabs?: VersionTab[]\n type: FieldTypes\n}\n\nexport type VersionField = {\n field?: BaseVersionField\n fieldByLocale?: Record<string, BaseVersionField>\n}\n\n/**\n * Taken from react-diff-viewer-continued\n *\n * @deprecated remove in 4.0 - react-diff-viewer-continued is no longer a dependency\n */\nexport declare enum DiffMethod {\n CHARS = 'diffChars',\n CSS = 'diffCss',\n JSON = 'diffJson',\n LINES = 'diffLines',\n SENTENCES = 'diffSentences',\n TRIMMED_LINES = 'diffTrimmedLines',\n WORDS = 'diffWords',\n WORDS_WITH_SPACE = 'diffWordsWithSpace',\n}\n\nexport type FieldDiffClientProps<TClientField extends ClientFieldWithOptionalType = ClientField> = {\n baseVersionField: BaseVersionField\n /**\n * Field value from the version being compared from\n */\n comparisonValue: unknown // TODO: change to valueFrom in 4.0\n /**\n * @deprecated remove in 4.0. react-diff-viewer-continued is no longer a dependency\n */\n diffMethod: any\n field: TClientField\n fieldPermissions:\n | {\n [key: string]: SanitizedFieldPermissions\n }\n | true\n /**\n * If this field is localized, this will be the locale of the field\n */\n locale?: string\n nestingLevel?: number\n parentIsLocalized: boolean\n /**\n * Field value from the version being compared to\n *\n */\n versionValue: unknown // TODO: change to valueTo in 4.0\n}\n\nexport type FieldDiffServerProps<\n TField extends Field = Field,\n TClientField extends ClientFieldWithOptionalType = ClientField,\n> = {\n clientField: TClientField\n field: TField\n i18n: I18nClient\n req: PayloadRequest\n selectedLocales: string[]\n} & Omit<FieldDiffClientProps, 'field'>\n\nexport type FieldDiffClientComponent<\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n> = React.ComponentType<FieldDiffClientProps<TFieldClient>>\n\nexport type FieldDiffServerComponent<\n TFieldServer extends Field = Field,\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n> = React.ComponentType<FieldDiffServerProps<TFieldServer, TFieldClient>>\n"],"names":[],"mappings":"AAyFA,WAGyE"}
1
+ {"version":3,"sources":["../../../src/admin/forms/Diff.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\n\nimport type { ClientField, Field, FieldTypes, Tab } from '../../fields/config/types.js'\nimport type {\n ClientFieldWithOptionalType,\n PayloadRequest,\n SanitizedFieldPermissions,\n SanitizedFieldsPermissions,\n} from '../../index.js'\n\nexport type VersionTab = {\n fields: VersionField[]\n name?: string\n} & Pick<Tab, 'label'>\n\nexport type BaseVersionField = {\n CustomComponent?: React.ReactNode\n fields: VersionField[]\n path: string\n rows?: VersionField[][]\n schemaPath: string\n tabs?: VersionTab[]\n type: FieldTypes\n}\n\nexport type VersionField = {\n field?: BaseVersionField\n fieldByLocale?: Record<string, BaseVersionField>\n}\n\n/**\n * Taken from react-diff-viewer-continued\n *\n * @deprecated remove in 4.0 - react-diff-viewer-continued is no longer a dependency\n */\nexport declare enum DiffMethod {\n CHARS = 'diffChars',\n CSS = 'diffCss',\n JSON = 'diffJson',\n LINES = 'diffLines',\n SENTENCES = 'diffSentences',\n TRIMMED_LINES = 'diffTrimmedLines',\n WORDS = 'diffWords',\n WORDS_WITH_SPACE = 'diffWordsWithSpace',\n}\n\nexport type FieldDiffClientProps<TClientField extends ClientFieldWithOptionalType = ClientField> = {\n baseVersionField: BaseVersionField\n /**\n * Field value from the version being compared from\n */\n comparisonValue: unknown // TODO: change to valueFrom in 4.0\n /**\n * @deprecated remove in 4.0. react-diff-viewer-continued is no longer a dependency\n */\n diffMethod: any\n field: TClientField\n /**\n * Permissions at this level of the field. If this field is unnamed, this will be `SanitizedFieldsPermissions` - if it is named, it will be `SanitizedFieldPermissions`\n */\n fieldPermissions: SanitizedFieldPermissions | SanitizedFieldsPermissions\n /**\n * If this field is localized, this will be the locale of the field\n */\n locale?: string\n nestingLevel?: number\n parentIsLocalized: boolean\n /**\n * Field value from the version being compared to\n *\n */\n versionValue: unknown // TODO: change to valueTo in 4.0\n}\n\nexport type FieldDiffServerProps<\n TField extends Field = Field,\n TClientField extends ClientFieldWithOptionalType = ClientField,\n> = {\n clientField: TClientField\n field: TField\n i18n: I18nClient\n req: PayloadRequest\n selectedLocales: string[]\n} & Omit<FieldDiffClientProps, 'field'>\n\nexport type FieldDiffClientComponent<\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n> = React.ComponentType<FieldDiffClientProps<TFieldClient>>\n\nexport type FieldDiffServerComponent<\n TFieldServer extends Field = Field,\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n> = React.ComponentType<FieldDiffServerProps<TFieldServer, TFieldClient>>\n"],"names":[],"mappings":"AAyFA,WAGyE"}
@@ -10,13 +10,6 @@ export type ClientFieldWithOptionalType = MarkOptional<ClientField, 'type'>;
10
10
  export type ClientComponentProps = {
11
11
  customComponents?: FormField['customComponents'];
12
12
  field: ClientBlock | ClientField | ClientTab;
13
- /**
14
- * Controls the rendering behavior of the fields, i.e. defers rendering until they intersect with the viewport using the Intersection Observer API.
15
- *
16
- * If true, the fields will be rendered immediately, rather than waiting for them to intersect with the viewport.
17
- *
18
- * If a number is provided, will immediately render fields _up to that index_.
19
- */
20
13
  forceRender?: boolean;
21
14
  permissions?: SanitizedFieldPermissions;
22
15
  readOnly?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../../src/adm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,CAAA;AAED,MAAM,MAAM,eAAe,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 } from '../../auth/types.js'\nimport type { ClientBlock, ClientField, Field } from '../../fields/config/types.js'\nimport type { TypedUser } from '../../index.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 /**\n * Controls the rendering behavior of the fields, i.e. defers rendering until they intersect with the viewport using the Intersection Observer API.\n *\n * If true, the fields will be rendered immediately, rather than waiting for them to intersect with the viewport.\n *\n * If a number is provided, will immediately render fields _up to that index_.\n */\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\n/**\n * TODO: This should be renamed to `FieldComponentServerProps` or similar\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: TypedUser\n value?: unknown\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":"AA+HA,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 } from '../../auth/types.js'\nimport type { ClientBlock, ClientField, Field } from '../../fields/config/types.js'\nimport type { TypedUser } from '../../index.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\n/**\n * TODO: This should be renamed to `FieldComponentServerProps` or similar\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: TypedUser\n value?: unknown\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":"AAwHA,WAIsF"}
@@ -53,9 +53,10 @@ export type FieldState = {
53
53
  filterOptions?: FilterOptionsResult;
54
54
  initialValue?: unknown;
55
55
  /**
56
- * @experimental - Note: this property is experimental and may change in the future. Use at your own discretion.
57
56
  * Every time a field is changed locally, this flag is set to true. Prevents form state from server from overwriting local changes.
58
57
  * After merging server form state, this flag is reset.
58
+ *
59
+ * @experimental This property is experimental and may change in the future. Use at your own discretion.
59
60
  */
60
61
  isModified?: boolean;
61
62
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../src/admin/forms/Form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAElE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAE7E,MAAM,MAAM,IAAI,GAAG;IACjB,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IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,GAAG,CACA;IACE,cAAc,EAAE,MAAM,CAAA;IAGtB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,GACD;IACE,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;CACnB,CACJ,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/admin/forms/Form.ts"],"sourcesContent":["import { type SupportedLanguages } from '@payloadcms/translations'\n\nimport type { SanitizedDocumentPermissions } from '../../auth/types.js'\nimport type { Field, Option, Validate } from '../../fields/config/types.js'\nimport type { TypedLocale } from '../../index.js'\nimport type { DocumentPreferences } from '../../preferences/types.js'\nimport type { PayloadRequest, SelectType, Where } from '../../types/index.js'\n\nexport type Data = {\n [key: string]: any\n}\n\nexport type Row = {\n addedByServer?: FieldState['addedByServer']\n blockType?: string\n collapsed?: boolean\n customComponents?: {\n RowLabel?: React.ReactNode\n }\n id: string\n isLoading?: boolean\n lastRenderedPath?: string\n}\n\nexport type FilterOptionsResult = {\n [relation: string]: boolean | Where\n}\n\nexport type FieldState = {\n /**\n * This is used to determine if the field was added by the server.\n * This ensures the field is not ignored by the client when merging form state.\n * This can happen because the current local state is treated as the source of truth.\n * See `mergeServerFormState` for more details.\n */\n addedByServer?: boolean\n customComponents?: {\n /**\n * This is used by UI fields, as they can have arbitrary components defined if used\n * as a vessel to bring in custom components.\n */\n [key: string]: React.ReactNode | React.ReactNode[] | undefined\n AfterInput?: React.ReactNode\n BeforeInput?: React.ReactNode\n Description?: React.ReactNode\n Error?: React.ReactNode\n Field?: React.ReactNode\n Label?: React.ReactNode\n }\n disableFormData?: boolean\n errorMessage?: string\n errorPaths?: string[]\n /**\n * The fieldSchema may be part of the form state if `includeSchema: true` is passed to buildFormState.\n * This will never be in the form state of the client.\n */\n fieldSchema?: Field\n filterOptions?: FilterOptionsResult\n initialValue?: unknown\n /**\n * @experimental - Note: this property is experimental and may change in the future. Use at your own discretion.\n * Every time a field is changed locally, this flag is set to true. Prevents form state from server from overwriting local changes.\n * After merging server form state, this flag is reset.\n */\n isModified?: boolean\n /**\n * The path of the field when its custom components were last rendered.\n * This is used to denote if a field has been rendered, and if so,\n * what path it was rendered under last.\n *\n * If this path is undefined, or, if it is different\n * from the current path of a given field, the field's components will be re-rendered.\n */\n lastRenderedPath?: string\n passesCondition?: boolean\n rows?: Row[]\n /**\n * The result of running `field.filterOptions` on select fields.\n */\n selectFilterOptions?: Option[]\n valid?: boolean\n validate?: Validate\n value?: unknown\n}\n\nexport type FieldStateWithoutComponents = Omit<FieldState, 'customComponents'>\n\nexport type FormState = {\n [path: string]: FieldState\n}\n\nexport type FormStateWithoutComponents = {\n [path: string]: FieldStateWithoutComponents\n}\n\nexport type BuildFormStateArgs = {\n data?: Data\n docPermissions: SanitizedDocumentPermissions | undefined\n docPreferences: DocumentPreferences\n /**\n * In case `formState` is not the top-level, document form state, this can be passed to\n * provide the top-level form state.\n */\n documentFormState?: FormState\n fallbackLocale?: false | TypedLocale\n formState?: FormState\n id?: number | string\n initialBlockData?: Data\n initialBlockFormState?: FormState\n /*\n If not i18n was passed, the language can be passed to init i18n\n */\n language?: keyof SupportedLanguages\n locale?: string\n /**\n * If true, will not render RSCs and instead return a simple string in their place.\n * This is useful for environments that lack RSC support, such as Jest.\n * Form state can still be built, but any server components will be omitted.\n * @default false\n */\n mockRSCs?: boolean\n operation?: 'create' | 'update'\n readOnly?: boolean\n /**\n * If true, will render field components within their state object.\n * Performance optimization: Setting to `false` ensures that only fields that have changed paths will re-render, e.g. new array rows, etc.\n * For example, you only need to render ALL fields on initial render, not on every onChange.\n */\n renderAllFields?: boolean\n req: PayloadRequest\n returnLockStatus?: boolean\n schemaPath: string\n select?: SelectType\n skipValidation?: boolean\n updateLastEdited?: boolean\n} & (\n | {\n collectionSlug: string\n // Do not type it as never. This still makes it so that either collectionSlug or globalSlug is required, but makes it easier to provide both collectionSlug and globalSlug if it's\n // unclear which one is actually available.\n globalSlug?: string\n }\n | {\n collectionSlug?: string\n globalSlug: string\n }\n)\n"],"names":[],"mappings":"AA+FA,WAmDC"}
1
+ {"version":3,"sources":["../../../src/admin/forms/Form.ts"],"sourcesContent":["import { type SupportedLanguages } from '@payloadcms/translations'\n\nimport type { SanitizedDocumentPermissions } from '../../auth/types.js'\nimport type { Field, Option, Validate } from '../../fields/config/types.js'\nimport type { TypedLocale } from '../../index.js'\nimport type { DocumentPreferences } from '../../preferences/types.js'\nimport type { PayloadRequest, SelectType, Where } from '../../types/index.js'\n\nexport type Data = {\n [key: string]: any\n}\n\nexport type Row = {\n addedByServer?: FieldState['addedByServer']\n blockType?: string\n collapsed?: boolean\n customComponents?: {\n RowLabel?: React.ReactNode\n }\n id: string\n isLoading?: boolean\n lastRenderedPath?: string\n}\n\nexport type FilterOptionsResult = {\n [relation: string]: boolean | Where\n}\n\nexport type FieldState = {\n /**\n * This is used to determine if the field was added by the server.\n * This ensures the field is not ignored by the client when merging form state.\n * This can happen because the current local state is treated as the source of truth.\n * See `mergeServerFormState` for more details.\n */\n addedByServer?: boolean\n customComponents?: {\n /**\n * This is used by UI fields, as they can have arbitrary components defined if used\n * as a vessel to bring in custom components.\n */\n [key: string]: React.ReactNode | React.ReactNode[] | undefined\n AfterInput?: React.ReactNode\n BeforeInput?: React.ReactNode\n Description?: React.ReactNode\n Error?: React.ReactNode\n Field?: React.ReactNode\n Label?: React.ReactNode\n }\n disableFormData?: boolean\n errorMessage?: string\n errorPaths?: string[]\n /**\n * The fieldSchema may be part of the form state if `includeSchema: true` is passed to buildFormState.\n * This will never be in the form state of the client.\n */\n fieldSchema?: Field\n filterOptions?: FilterOptionsResult\n initialValue?: unknown\n /**\n * Every time a field is changed locally, this flag is set to true. Prevents form state from server from overwriting local changes.\n * After merging server form state, this flag is reset.\n *\n * @experimental This property is experimental and may change in the future. Use at your own discretion.\n */\n isModified?: boolean\n /**\n * The path of the field when its custom components were last rendered.\n * This is used to denote if a field has been rendered, and if so,\n * what path it was rendered under last.\n *\n * If this path is undefined, or, if it is different\n * from the current path of a given field, the field's components will be re-rendered.\n */\n lastRenderedPath?: string\n passesCondition?: boolean\n rows?: Row[]\n /**\n * The result of running `field.filterOptions` on select fields.\n */\n selectFilterOptions?: Option[]\n valid?: boolean\n validate?: Validate\n value?: unknown\n}\n\nexport type FieldStateWithoutComponents = Omit<FieldState, 'customComponents'>\n\nexport type FormState = {\n [path: string]: FieldState\n}\n\nexport type FormStateWithoutComponents = {\n [path: string]: FieldStateWithoutComponents\n}\n\nexport type BuildFormStateArgs = {\n data?: Data\n docPermissions: SanitizedDocumentPermissions | undefined\n docPreferences: DocumentPreferences\n /**\n * In case `formState` is not the top-level, document form state, this can be passed to\n * provide the top-level form state.\n */\n documentFormState?: FormState\n fallbackLocale?: false | TypedLocale\n formState?: FormState\n id?: number | string\n initialBlockData?: Data\n initialBlockFormState?: FormState\n /*\n If not i18n was passed, the language can be passed to init i18n\n */\n language?: keyof SupportedLanguages\n locale?: string\n /**\n * If true, will not render RSCs and instead return a simple string in their place.\n * This is useful for environments that lack RSC support, such as Jest.\n * Form state can still be built, but any server components will be omitted.\n * @default false\n */\n mockRSCs?: boolean\n operation?: 'create' | 'update'\n readOnly?: boolean\n /**\n * If true, will render field components within their state object.\n * Performance optimization: Setting to `false` ensures that only fields that have changed paths will re-render, e.g. new array rows, etc.\n * For example, you only need to render ALL fields on initial render, not on every onChange.\n */\n renderAllFields?: boolean\n req: PayloadRequest\n returnLockStatus?: boolean\n schemaPath: string\n select?: SelectType\n skipValidation?: boolean\n updateLastEdited?: boolean\n} & (\n | {\n collectionSlug: string\n // Do not type it as never. This still makes it so that either collectionSlug or globalSlug is required, but makes it easier to provide both collectionSlug and globalSlug if it's\n // unclear which one is actually available.\n globalSlug?: string\n }\n | {\n collectionSlug?: string\n globalSlug: string\n }\n)\n"],"names":[],"mappings":"AAgGA,WAmDC"}
@@ -25,31 +25,6 @@ export type ServerFunctionConfig = {
25
25
  export type ServerFunctionHandler = (args: {
26
26
  config: Promise<SanitizedConfig> | SanitizedConfig;
27
27
  importMap: ImportMap;
28
- /**
29
- * A map of server function names to their implementations. These are
30
- * registered alongside the base server functions and can be called
31
- * using the useServerFunctions() hook.
32
- *
33
- * @example
34
- * const { serverFunction } = useServerFunctions()
35
- *
36
- * const callServerFunction = useCallback(() => {
37
- *
38
- * async function call() {
39
- * const result = (await serverFunction({
40
- * name: 'record-key',
41
- * args: {
42
- * // Your args
43
- * },
44
- * }))
45
- *
46
- * // Do someting with the result
47
- * }
48
- *
49
- * void call()
50
- * }, [serverFunction])
51
- */
52
- serverFunctions?: Record<string, ServerFunction<any, any>>;
53
28
  } & ServerFunctionClientArgs) => Promise<unknown>;
54
29
  export type ListQuery = {
55
30
  columns?: ColumnsFromURL;
@@ -63,6 +38,9 @@ export type ListQuery = {
63
38
  where?: Where;
64
39
  } & Record<string, unknown>;
65
40
  export type BuildTableStateArgs = {
41
+ /**
42
+ * If an array is provided, the table will be built to support polymorphic collections.
43
+ */
66
44
  collectionSlug: string | string[];
67
45
  columns?: ColumnPreference[];
68
46
  data?: PaginatedDocs;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/admin/functions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACtF,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACvE,OAAO,KAA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B,MAAM,CAAC,EAAE;QACP,cAAc,EAAE,cAAc,CAAA;QAC9B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;QACnB,QAAQ,EAAE,MAAM,CAAA;KACjB,CAAA;IACD,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,GAAG,EAAE,cAAc,CAAA;IACnB,eAAe,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;CAC1C,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,KAAK,CAAC,SAAS,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,oCAAoC,GAAG;IACjD;;;OAGG;IACH,cAAc,EAAE,OAAO,CAAA;IACvB;;;;;;OAMG;IACH,oBAAoB,EAAE,cAAc,EAAE,CAAA;IACtC;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,MAAM,CAAA;IAC1B;;;;OAIG;IACH,yBAAyB,EAAE,cAAc,EAAE,CAAA;IAC3C;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;IACrC,GAAG,EAAE,cAAc,CAAA;IACnB;;OAEG;IACH,IAAI,EAAE,cAAc,CAAA;CACrB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/admin/functions/index.ts"],"sourcesContent":["import type { ImportMap } from '../../bin/generateImportMap/index.js'\nimport type { SanitizedConfig } from '../../config/types.js'\nimport type { PaginatedDocs } from '../../database/types.js'\nimport type { CollectionSlug, ColumnPreference, FolderSortKeys } from '../../index.js'\nimport type { PayloadRequest, Sort, Where } from '../../types/index.js'\nimport type { ColumnsFromURL } from '../../utilities/transformColumnPreferences.js'\n\nexport type DefaultServerFunctionArgs = {\n importMap: ImportMap\n req: PayloadRequest\n}\n\nexport type ServerFunctionArgs = {\n args: Record<string, unknown>\n name: string\n}\n\nexport type ServerFunctionClientArgs = {\n args: Record<string, unknown>\n name: string\n}\n\nexport type ServerFunctionClient = (args: ServerFunctionClientArgs) => Promise<unknown> | unknown\n\nexport type ServerFunction<\n TArgs extends object = Record<string, unknown>,\n TReturnType = Promise<unknown> | unknown,\n> = (args: DefaultServerFunctionArgs & TArgs) => TReturnType\n\nexport type ServerFunctionConfig = {\n fn: ServerFunction\n name: string\n}\n\nexport type ServerFunctionHandler = (\n args: {\n config: Promise<SanitizedConfig> | SanitizedConfig\n importMap: ImportMap\n /**\n * A map of server function names to their implementations. These are\n * registered alongside the base server functions and can be called\n * using the useServerFunctions() hook.\n *\n * @example\n * const { serverFunction } = useServerFunctions()\n *\n * const callServerFunction = useCallback(() => {\n *\n * async function call() {\n * const result = (await serverFunction({\n * name: 'record-key',\n * args: {\n * // Your args\n * },\n * }))\n *\n * // Do someting with the result\n * }\n *\n * void call()\n * }, [serverFunction])\n */\n serverFunctions?: Record<string, ServerFunction<any, any>>\n } & ServerFunctionClientArgs,\n) => Promise<unknown>\n\nexport type ListQuery = {\n /*\n * This is an of strings, i.e. `['title', '-slug']`\n * Use `transformColumnsToPreferences` and `transformColumnsToSearchParams` to convert it back and forth\n */\n columns?: ColumnsFromURL\n /*\n * A string representing the field to group by, e.g. `category`\n * A leading hyphen represents descending order, e.g. `-category`\n */\n groupBy?: string\n limit?: number\n page?: number\n preset?: number | string\n queryByGroup?: Record<string, ListQuery>\n /*\n When provided, is automatically injected into the `where` object\n */\n search?: string\n sort?: Sort\n where?: Where\n} & Record<string, unknown>\n\nexport type BuildTableStateArgs = {\n collectionSlug: string | string[]\n columns?: ColumnPreference[]\n data?: PaginatedDocs\n /**\n * @deprecated Use `data` instead\n */\n docs?: PaginatedDocs['docs']\n enableRowSelections?: boolean\n orderableFieldName: string\n parent?: {\n collectionSlug: CollectionSlug\n id: number | string\n joinPath: string\n }\n query?: ListQuery\n renderRowTypes?: boolean\n req: PayloadRequest\n tableAppearance?: 'condensed' | 'default'\n}\n\nexport type BuildCollectionFolderViewResult = {\n View: React.ReactNode\n}\n\nexport type GetFolderResultsComponentAndDataArgs = {\n /**\n * If true and no folderID is provided, only folders will be returned.\n * If false, the results will include documents from the active collections.\n */\n browseByFolder: boolean\n /**\n * Used to filter document types to include in the results/display.\n *\n * i.e. ['folders', 'posts'] will only include folders and posts in the results.\n *\n * collectionsToQuery?\n */\n collectionsToDisplay: CollectionSlug[]\n /**\n * Used to determine how the results should be displayed.\n */\n displayAs: 'grid' | 'list'\n /**\n * Used to filter folders by the collections they are assigned to.\n *\n * i.e. ['posts'] will only include folders that are assigned to the posts collections.\n */\n folderAssignedCollections: CollectionSlug[]\n /**\n * The ID of the folder to filter results by.\n */\n folderID: number | string | undefined\n req: PayloadRequest\n /**\n * The sort order for the results.\n */\n sort: FolderSortKeys\n}\n"],"names":[],"mappings":"AAkHA,WAiCC"}
1
+ {"version":3,"sources":["../../../src/admin/functions/index.ts"],"sourcesContent":["import type { ImportMap } from '../../bin/generateImportMap/index.js'\nimport type { SanitizedConfig } from '../../config/types.js'\nimport type { PaginatedDocs } from '../../database/types.js'\nimport type { CollectionSlug, ColumnPreference, FolderSortKeys } from '../../index.js'\nimport type { PayloadRequest, Sort, Where } from '../../types/index.js'\nimport type { ColumnsFromURL } from '../../utilities/transformColumnPreferences.js'\n\nexport type DefaultServerFunctionArgs = {\n importMap: ImportMap\n req: PayloadRequest\n}\n\nexport type ServerFunctionArgs = {\n args: Record<string, unknown>\n name: string\n}\n\nexport type ServerFunctionClientArgs = {\n args: Record<string, unknown>\n name: string\n}\n\nexport type ServerFunctionClient = (args: ServerFunctionClientArgs) => Promise<unknown> | unknown\n\nexport type ServerFunction<\n TArgs extends object = Record<string, unknown>,\n TReturnType = Promise<unknown> | unknown,\n> = (args: DefaultServerFunctionArgs & TArgs) => TReturnType\n\nexport type ServerFunctionConfig = {\n fn: ServerFunction\n name: string\n}\n\nexport type ServerFunctionHandler = (\n args: {\n config: Promise<SanitizedConfig> | SanitizedConfig\n importMap: ImportMap\n } & ServerFunctionClientArgs,\n) => Promise<unknown>\n\nexport type ListQuery = {\n /*\n * This is an of strings, i.e. `['title', '-slug']`\n * Use `transformColumnsToPreferences` and `transformColumnsToSearchParams` to convert it back and forth\n */\n columns?: ColumnsFromURL\n /*\n * A string representing the field to group by, e.g. `category`\n * A leading hyphen represents descending order, e.g. `-category`\n */\n groupBy?: string\n limit?: number\n page?: number\n preset?: number | string\n queryByGroup?: Record<string, ListQuery>\n /*\n When provided, is automatically injected into the `where` object\n */\n search?: string\n sort?: Sort\n where?: Where\n} & Record<string, unknown>\n\nexport type BuildTableStateArgs = {\n /**\n * If an array is provided, the table will be built to support polymorphic collections.\n */\n collectionSlug: string | string[]\n columns?: ColumnPreference[]\n data?: PaginatedDocs\n /**\n * @deprecated Use `data` instead\n */\n docs?: PaginatedDocs['docs']\n enableRowSelections?: boolean\n orderableFieldName: string\n parent?: {\n collectionSlug: CollectionSlug\n id: number | string\n joinPath: string\n }\n query?: ListQuery\n renderRowTypes?: boolean\n req: PayloadRequest\n tableAppearance?: 'condensed' | 'default'\n}\n\nexport type BuildCollectionFolderViewResult = {\n View: React.ReactNode\n}\n\nexport type GetFolderResultsComponentAndDataArgs = {\n /**\n * If true and no folderID is provided, only folders will be returned.\n * If false, the results will include documents from the active collections.\n */\n browseByFolder: boolean\n /**\n * Used to filter document types to include in the results/display.\n *\n * i.e. ['folders', 'posts'] will only include folders and posts in the results.\n *\n * collectionsToQuery?\n */\n collectionsToDisplay: CollectionSlug[]\n /**\n * Used to determine how the results should be displayed.\n */\n displayAs: 'grid' | 'list'\n /**\n * Used to filter folders by the collections they are assigned to.\n *\n * i.e. ['posts'] will only include folders that are assigned to the posts collections.\n */\n folderAssignedCollections: CollectionSlug[]\n /**\n * The ID of the folder to filter results by.\n */\n folderID: number | string | undefined\n req: PayloadRequest\n /**\n * The sort order for the results.\n */\n sort: FolderSortKeys\n}\n"],"names":[],"mappings":"AA4FA,WAiCC"}
@@ -29,12 +29,14 @@ export type AdminViewClientProps = {
29
29
  };
30
30
  export type AdminViewServerPropsOnly = {
31
31
  readonly clientConfig: ClientConfig;
32
+ readonly collectionConfig?: SanitizedCollectionConfig;
32
33
  readonly disableActions?: boolean;
33
34
  /**
34
35
  * @todo remove `docID` here as it is already contained in `initPageResult`
35
36
  */
36
37
  readonly docID?: number | string;
37
38
  readonly folderID?: number | string;
39
+ readonly globalConfig?: SanitizedGlobalConfig;
38
40
  readonly importMap: ImportMap;
39
41
  readonly initialData?: Data;
40
42
  readonly initPageResult: InitPageResult;
@@ -45,6 +47,7 @@ export type AdminViewServerPropsOnly = {
45
47
  readonly redirectAfterDelete?: boolean;
46
48
  readonly redirectAfterDuplicate?: boolean;
47
49
  readonly redirectAfterRestore?: boolean;
50
+ readonly viewActions?: CustomComponent[];
48
51
  } & ServerProps;
49
52
  export type AdminViewServerProps = AdminViewClientProps & AdminViewServerPropsOnly;
50
53
  /**
@@ -71,7 +74,7 @@ export type InitPageResult = {
71
74
  /**
72
75
  * @todo This should be renamed to `ViewType` (singular)
73
76
  */
74
- export type ViewTypes = 'account' | 'collection-folders' | 'dashboard' | 'document' | 'folders' | 'list' | 'reset' | 'trash' | 'verify' | 'version';
77
+ export type ViewTypes = 'account' | 'collection-folders' | 'createFirstUser' | 'dashboard' | 'document' | 'folders' | 'list' | 'reset' | 'trash' | 'verify' | 'version';
75
78
  export type ServerPropsFromView = {
76
79
  collectionConfig?: SanitizedConfig['collections'][number];
77
80
  globalConfig?: SanitizedConfig['globals'][number];
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/admin/views/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAA;AAExE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AACrE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAA;AAClF,OAAO,KAAK,EAAE,YAAY,EAAE,M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U,GACV,SAAS,GACT,MAAM,GACN,OAAO,GACP,OAAO,GACP,QAAQ,GACR,SAAS,CAAA;AAEb,MAAM,MAAM,mBAAmB,GAAG;IAChC,gBAAgB,CAAC,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAA;IACzD,YAAY,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAA;IACjD,WAAW,EAAE,eAAe,EAAE,CAAA;CAC/B,CAAA;AAGD,MAAM,MAAM,0BAA0B,GAAG;IACvC,cAAc,CAAC,EAAE,yBAAyB,CAAC,MAAM,CAAC,CAAA;IAClD,WAAW,EAAE,iBAAiB,CAAA;CAC/B,CAAA;AAED,MAAM,MAAM,8BAA8B,GAAG,EAAE,GAAG,WAAW,CAAA;AAE7D,MAAM,MAAM,0BAA0B,GAAG,0BAA0B,GAAG,8BAA8B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/admin/views/index.ts"],"sourcesContent":["import type { ClientTranslationsObject } from '@payloadcms/translations'\n\nimport type { SanitizedPermissions } from '../../auth/index.js'\nimport type { ImportMap } from '../../bin/generateImportMap/index.js'\nimport type { SanitizedCollectionConfig } from '../../collections/config/types.js'\nimport type { ClientConfig } from '../../config/client.js'\nimport type {\n CustomComponent,\n Locale,\n MetaConfig,\n PayloadComponent,\n SanitizedConfig,\n ServerProps,\n} from '../../config/types.js'\nimport type { SanitizedGlobalConfig } from '../../globals/config/types.js'\nimport type { PayloadRequest } from '../../types/index.js'\nimport type { LanguageOptions } from '../LanguageOptions.js'\nimport type { Data, StaticDescription } from '../types.js'\nimport type { DocumentSubViewTypes } from './document.js'\n\nexport type AdminViewConfig = {\n Component: PayloadComponent\n /** Whether the path should be matched exactly or as a prefix */\n exact?: boolean\n meta?: MetaConfig\n /**\n * Any valid URL path or array of paths that [`path-to-regexp`](https://www.npmjs.com/package/path-to-regex) understands. Must begin with a forward slash (`/`).\n */\n path?: `/${string}`\n sensitive?: boolean\n strict?: boolean\n}\n\nexport type AdminViewClientProps = {\n browseByFolderSlugs?: SanitizedCollectionConfig['slug'][]\n clientConfig: ClientConfig\n documentSubViewType?: DocumentSubViewTypes\n viewType: ViewTypes\n}\n\nexport type AdminViewServerPropsOnly = {\n readonly clientConfig: ClientConfig\n readonly disableActions?: boolean\n /**\n * @todo remove `docID` here as it is already contained in `initPageResult`\n */\n readonly docID?: number | string\n readonly folderID?: number | string\n readonly importMap: ImportMap\n readonly initialData?: Data\n readonly initPageResult: InitPageResult\n readonly params?: { [key: string]: string | string[] | undefined }\n readonly redirectAfterCreate?: boolean\n readonly redirectAfterDelete?: boolean\n readonly redirectAfterDuplicate?: boolean\n readonly redirectAfterRestore?: boolean\n} & ServerProps\n\nexport type AdminViewServerProps = AdminViewClientProps & AdminViewServerPropsOnly\n\n/**\n * @deprecated This should be removed in favor of direct props\n */\nexport type AdminViewComponent = PayloadComponent<AdminViewServerProps>\n\nexport type VisibleEntities = {\n collections: SanitizedCollectionConfig['slug'][]\n globals: SanitizedGlobalConfig['slug'][]\n}\n\nexport type InitPageResult = {\n collectionConfig?: SanitizedCollectionConfig\n cookies: Map<string, string>\n docID?: number | string\n globalConfig?: SanitizedGlobalConfig\n languageOptions: LanguageOptions\n locale?: Locale\n permissions: SanitizedPermissions\n redirectTo?: string\n req: PayloadRequest\n translations: ClientTranslationsObject\n visibleEntities: VisibleEntities\n}\n\n/**\n * @todo This should be renamed to `ViewType` (singular)\n */\nexport type ViewTypes =\n | 'account'\n | 'collection-folders'\n | 'dashboard'\n | 'document'\n | 'folders'\n | 'list'\n | 'reset'\n | 'trash'\n | 'verify'\n | 'version'\n\nexport type ServerPropsFromView = {\n collectionConfig?: SanitizedConfig['collections'][number]\n globalConfig?: SanitizedConfig['globals'][number]\n viewActions: CustomComponent[]\n}\n\n// Description\nexport type ViewDescriptionClientProps = {\n collectionSlug?: SanitizedCollectionConfig['slug']\n description: StaticDescription\n}\n\nexport type ViewDescriptionServerPropsOnly = {} & ServerProps\n\nexport type ViewDescriptionServerProps = ViewDescriptionClientProps & ViewDescriptionServerPropsOnly\n"],"names":[],"mappings":"AAiHA,WAAoG"}
1
+ {"version":3,"sources":["../../../src/admin/views/index.ts"],"sourcesContent":["import type { ClientTranslationsObject } from '@payloadcms/translations'\n\nimport type { SanitizedPermissions } from '../../auth/index.js'\nimport type { ImportMap } from '../../bin/generateImportMap/index.js'\nimport type { SanitizedCollectionConfig } from '../../collections/config/types.js'\nimport type { ClientConfig } from '../../config/client.js'\nimport type {\n CustomComponent,\n Locale,\n MetaConfig,\n PayloadComponent,\n SanitizedConfig,\n ServerProps,\n} from '../../config/types.js'\nimport type { SanitizedGlobalConfig } from '../../globals/config/types.js'\nimport type { PayloadRequest } from '../../types/index.js'\nimport type { LanguageOptions } from '../LanguageOptions.js'\nimport type { Data, StaticDescription } from '../types.js'\nimport type { DocumentSubViewTypes } from './document.js'\n\nexport type AdminViewConfig = {\n Component: PayloadComponent\n /** Whether the path should be matched exactly or as a prefix */\n exact?: boolean\n meta?: MetaConfig\n /**\n * Any valid URL path or array of paths that [`path-to-regexp`](https://www.npmjs.com/package/path-to-regex) understands. Must begin with a forward slash (`/`).\n */\n path?: `/${string}`\n sensitive?: boolean\n strict?: boolean\n}\n\nexport type AdminViewClientProps = {\n browseByFolderSlugs?: SanitizedCollectionConfig['slug'][]\n clientConfig: ClientConfig\n documentSubViewType?: DocumentSubViewTypes\n viewType: ViewTypes\n}\n\nexport type AdminViewServerPropsOnly = {\n readonly clientConfig: ClientConfig\n readonly collectionConfig?: SanitizedCollectionConfig\n readonly disableActions?: boolean\n /**\n * @todo remove `docID` here as it is already contained in `initPageResult`\n */\n readonly docID?: number | string\n readonly folderID?: number | string\n readonly globalConfig?: SanitizedGlobalConfig\n readonly importMap: ImportMap\n readonly initialData?: Data\n readonly initPageResult: InitPageResult\n readonly params?: { [key: string]: string | string[] | undefined }\n readonly redirectAfterCreate?: boolean\n readonly redirectAfterDelete?: boolean\n readonly redirectAfterDuplicate?: boolean\n readonly redirectAfterRestore?: boolean\n readonly viewActions?: CustomComponent[]\n} & ServerProps\n\nexport type AdminViewServerProps = AdminViewClientProps & AdminViewServerPropsOnly\n\n/**\n * @deprecated This should be removed in favor of direct props\n */\nexport type AdminViewComponent = PayloadComponent<AdminViewServerProps>\n\nexport type VisibleEntities = {\n collections: SanitizedCollectionConfig['slug'][]\n globals: SanitizedGlobalConfig['slug'][]\n}\n\nexport type InitPageResult = {\n collectionConfig?: SanitizedCollectionConfig\n cookies: Map<string, string>\n docID?: number | string\n globalConfig?: SanitizedGlobalConfig\n languageOptions: LanguageOptions\n locale?: Locale\n permissions: SanitizedPermissions\n redirectTo?: string\n req: PayloadRequest\n translations: ClientTranslationsObject\n visibleEntities: VisibleEntities\n}\n\n/**\n * @todo This should be renamed to `ViewType` (singular)\n */\nexport type ViewTypes =\n | 'account'\n | 'collection-folders'\n | 'createFirstUser'\n | 'dashboard'\n | 'document'\n | 'folders'\n | 'list'\n | 'reset'\n | 'trash'\n | 'verify'\n | 'version'\n\nexport type ServerPropsFromView = {\n collectionConfig?: SanitizedConfig['collections'][number]\n globalConfig?: SanitizedConfig['globals'][number]\n viewActions: CustomComponent[]\n}\n\n// Description\nexport type ViewDescriptionClientProps = {\n collectionSlug?: SanitizedCollectionConfig['slug']\n description: StaticDescription\n}\n\nexport type ViewDescriptionServerPropsOnly = {} & ServerProps\n\nexport type ViewDescriptionServerProps = ViewDescriptionClientProps & ViewDescriptionServerPropsOnly\n"],"names":[],"mappings":"AAqHA,WAAoG"}
@@ -1 +1 @@
1
- {"version":3,"file":"resetPassword.d.ts","sourceRoot":"","sources":["../../../src/auth/operations/resetPassword.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAA0B,MAAM,mCAAmC,CAAA;AAC3F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAa1D,MAA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CA8KhB,CAAA"}
@@ -7,6 +7,7 @@ import { initTransaction } from '../../utilities/initTransaction.js';
7
7
  import { killTransaction } from '../../utilities/killTransaction.js';
8
8
  import { getFieldsToSign } from '../getFieldsToSign.js';
9
9
  import { jwtSign } from '../jwt.js';
10
+ import { addSessionToUser } from '../sessions.js';
10
11
  import { authenticateLocalStrategy } from '../strategies/local/authenticate.js';
11
12
  import { generatePasswordSaltHash } from '../strategies/local/generatePasswordSaltHash.js';
12
13
  export const resetPasswordOperation = async (args)=>{
@@ -94,11 +95,21 @@ export const resetPasswordOperation = async (args)=>{
94
95
  doc,
95
96
  password: data.password
96
97
  });
97
- const fieldsToSign = getFieldsToSign({
98
+ const fieldsToSignArgs = {
98
99
  collectionConfig,
99
100
  email: user.email,
100
101
  user
102
+ };
103
+ const { sid } = await addSessionToUser({
104
+ collectionConfig,
105
+ payload,
106
+ req,
107
+ user
101
108
  });
109
+ if (sid) {
110
+ fieldsToSignArgs.sid = sid;
111
+ }
112
+ const fieldsToSign = getFieldsToSign(fieldsToSignArgs);
102
113
  const { token } = await jwtSign({
103
114
  fieldsToSign,
104
115
  secret,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/auth/operations/resetPassword.ts"],"sourcesContent":["import { status as httpStatus } from 'http-status'\n\nimport type { Collection, DataFromCollectionSlug } from '../../collections/config/types.js'\nimport type { CollectionSlug } from '../../index.js'\nimport type { PayloadRequest } from '../../types/index.js'\n\nimport { buildAfterOperation } from '../../collections/operations/utils.js'\nimport { APIError, Forbidden } from '../../errors/index.js'\nimport { appendNonTrashedFilter } from '../../utilities/appendNonTrashedFilter.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { getFieldsToSign } from '../getFieldsToSign.js'\nimport { jwtSign } from '../jwt.js'\nimport { authenticateLocalStrategy } from '../strategies/local/authenticate.js'\nimport { generatePasswordSaltHash } from '../strategies/local/generatePasswordSaltHash.js'\n\nexport type Result = {\n token?: string\n user: Record<string, unknown>\n}\n\nexport type Arguments = {\n collection: Collection\n data: {\n password: string\n token: string\n }\n depth?: number\n overrideAccess?: boolean\n req: PayloadRequest\n}\n\nexport const resetPasswordOperation = async <TSlug extends CollectionSlug>(\n args: Arguments,\n): Promise<Result> => {\n const {\n collection: { config: collectionConfig },\n data,\n depth,\n overrideAccess,\n req: {\n payload: { secret },\n payload,\n },\n req,\n } = args\n\n if (\n !Object.prototype.hasOwnProperty.call(data, 'token') ||\n !Object.prototype.hasOwnProperty.call(data, 'password')\n ) {\n throw new APIError('Missing required data.', httpStatus.BAD_REQUEST)\n }\n\n if (collectionConfig.auth.disableLocalStrategy) {\n throw new Forbidden(req.t)\n }\n\n try {\n const shouldCommit = await initTransaction(req)\n\n if (args.collection.config.hooks?.beforeOperation?.length) {\n for (const hook of args.collection.config.hooks.beforeOperation) {\n args =\n (await hook({\n args,\n collection: args.collection?.config,\n context: args.req.context,\n operation: 'resetPassword',\n req: args.req,\n })) || args\n }\n }\n\n // /////////////////////////////////////\n // Reset Password\n // /////////////////////////////////////\n\n const where = appendNonTrashedFilter({\n enableTrash: Boolean(collectionConfig.trash),\n trash: false,\n where: {\n resetPasswordExpiration: { greater_than: new Date().toISOString() },\n resetPasswordToken: { equals: data.token },\n },\n })\n\n const user = await payload.db.findOne<any>({\n collection: collectionConfig.slug,\n req,\n where,\n })\n\n if (!user) {\n throw new APIError('Token is either invalid or has expired.', httpStatus.FORBIDDEN)\n }\n\n // TODO: replace this method\n const { hash, salt } = await generatePasswordSaltHash({\n collection: collectionConfig,\n password: data.password,\n req,\n })\n\n user.salt = salt\n user.hash = hash\n\n user.resetPasswordExpiration = new Date().toISOString()\n\n if (collectionConfig.auth.verify) {\n user._verified = Boolean(user._verified)\n }\n // /////////////////////////////////////\n // beforeValidate - Collection\n // /////////////////////////////////////\n\n if (collectionConfig.hooks?.beforeValidate?.length) {\n for (const hook of collectionConfig.hooks.beforeValidate) {\n await hook({\n collection: args.collection?.config,\n context: req.context,\n data: user,\n operation: 'update',\n req,\n })\n }\n }\n\n // /////////////////////////////////////\n // Update new password\n // /////////////////////////////////////\n\n // Ensure updatedAt date is always updated\n user.updatedAt = new Date().toISOString()\n\n const doc = await payload.db.updateOne({\n id: user.id,\n collection: collectionConfig.slug,\n data: user,\n req,\n })\n\n await authenticateLocalStrategy({ doc, password: data.password })\n\n const fieldsToSign = getFieldsToSign({\n collectionConfig,\n email: user.email,\n user,\n })\n\n const { token } = await jwtSign({\n fieldsToSign,\n secret,\n tokenExpiration: collectionConfig.auth.tokenExpiration,\n })\n\n const fullUser = await payload.findByID({\n id: user.id,\n collection: collectionConfig.slug,\n depth,\n overrideAccess,\n req,\n trash: false,\n })\n\n if (shouldCommit) {\n await commitTransaction(req)\n }\n\n if (fullUser) {\n fullUser.collection = collectionConfig.slug\n fullUser._strategy = 'local-jwt'\n }\n\n let result: { user: DataFromCollectionSlug<TSlug> } & Result = {\n token,\n user: fullUser,\n }\n\n // /////////////////////////////////////\n // afterOperation - Collection\n // /////////////////////////////////////\n\n result = await buildAfterOperation({\n args,\n collection: args.collection?.config,\n operation: 'resetPassword',\n result,\n })\n\n return result\n } catch (error: unknown) {\n await killTransaction(req)\n throw error\n }\n}\n"],"names":["status","httpStatus","buildAfterOperation","APIError","Forbidden","appendNonTrashedFilter","commitTransaction","initTransaction","killTransaction","getFieldsToSign","jwtSign","authenticateLocalStrategy","generatePasswordSaltHash","resetPasswordOperation","args","collection","config","collectionConfig","data","depth","overrideAccess","req","payload","secret","Object","prototype","hasOwnProperty","call","BAD_REQUEST","auth","disableLocalStrategy","t","shouldCommit","hooks","beforeOperation","length","hook","context","operation","where","enableTrash","Boolean","trash","resetPasswordExpiration","greater_than","Date","toISOString","resetPasswordToken","equals","token","user","db","findOne","slug","FORBIDDEN","hash","salt","password","verify","_verified","beforeValidate","updatedAt","doc","updateOne","id","fieldsToSign","email","tokenExpiration","fullUser","findByID","_strategy","result","error"],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AAsB;QACtB,wCAAwC;QAExC,0CAA0C;QAC1C6B,KAAKW,SAAS,GAAG,IAAIhB,OAAOC,WAAW;QAEvC,MAAMgB,MAAM,MAAMxC,QAAQ6B,EAAE,CAACY,SAAS,CAAC;YACrCC,IAAId,KAAKc,EAAE;YACXjD,YAAYE,iBAAiBoC,IAAI;YACjCnC,MAAMgC;YACN7B;QACF;QAEA,MAAMV,0BAA0B;YAAEmD;YAAKL,UAAUvC,KAAKuC,QAAQ;QAAC;QAE/D,MAAMQ,eAAexD,gBAAgB;YACnCQ;YACAiD,OAAOhB,KAAKgB,KAAK;YACjBhB;QACF;QAEA,MAAM,EAAED,KAAK,EAAE,GAAG,MAAMvC,QAAQ;YAC9BuD;YACA1C;YACA4C,iBAAiBlD,iBAAiBY,IAAI,CAACsC,eAAe;QACxD;QAEA,MAAMC,WAAW,MAAM9C,QAAQ+C,QAAQ,CAAC;YACtCL,IAAId,KAAKc,EAAE;YACXjD,YAAYE,iBAAiBoC,IAAI;YACjClC;YACAC;YACAC;YACAqB,OAAO;QACT;QAEA,IAAIV,cAAc;YAChB,MAAM1B,kBAAkBe;QAC1B;QAEA,IAAI+C,UAAU;YACZA,SAASrD,UAAU,GAAGE,iBAAiBoC,IAAI;YAC3Ce,SAASE,SAAS,GAAG;QACvB;QAEA,IAAIC,SAA2D;YAC7DtB;YACAC,MAAMkB;QACR;QAEA,wCAAwC;QACxC,8BAA8B;QAC9B,wCAAwC;QAExCG,SAAS,MAAMrE,oBAAoB;YACjCY;YACAC,YAAYD,KAAKC,UAAU,EAAEC;YAC7BsB,WAAW;YACXiC;QACF;QAEA,OAAOA;IACT,EAAE,OAAOC,OAAgB;QACvB,MAAMhE,gBAAgBa;QACtB,MAAMmD;IACR;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/auth/operations/resetPassword.ts"],"sourcesContent":["import { status as httpStatus } from 'http-status'\n\nimport type { Collection, DataFromCollectionSlug } from '../../collections/config/types.js'\nimport type { CollectionSlug } from '../../index.js'\nimport type { PayloadRequest } from '../../types/index.js'\n\nimport { buildAfterOperation } from '../../collections/operations/utils.js'\nimport { APIError, Forbidden } from '../../errors/index.js'\nimport { appendNonTrashedFilter } from '../../utilities/appendNonTrashedFilter.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { getFieldsToSign } from '../getFieldsToSign.js'\nimport { jwtSign } from '../jwt.js'\nimport { addSessionToUser } from '../sessions.js'\nimport { authenticateLocalStrategy } from '../strategies/local/authenticate.js'\nimport { generatePasswordSaltHash } from '../strategies/local/generatePasswordSaltHash.js'\n\nexport type Result = {\n token?: string\n user: Record<string, unknown>\n}\n\nexport type Arguments = {\n collection: Collection\n data: {\n password: string\n token: string\n }\n depth?: number\n overrideAccess?: boolean\n req: PayloadRequest\n}\n\nexport const resetPasswordOperation = async <TSlug extends CollectionSlug>(\n args: Arguments,\n): Promise<Result> => {\n const {\n collection: { config: collectionConfig },\n data,\n depth,\n overrideAccess,\n req: {\n payload: { secret },\n payload,\n },\n req,\n } = args\n\n if (\n !Object.prototype.hasOwnProperty.call(data, 'token') ||\n !Object.prototype.hasOwnProperty.call(data, 'password')\n ) {\n throw new APIError('Missing required data.', httpStatus.BAD_REQUEST)\n }\n\n if (collectionConfig.auth.disableLocalStrategy) {\n throw new Forbidden(req.t)\n }\n\n try {\n const shouldCommit = await initTransaction(req)\n\n if (args.collection.config.hooks?.beforeOperation?.length) {\n for (const hook of args.collection.config.hooks.beforeOperation) {\n args =\n (await hook({\n args,\n collection: args.collection?.config,\n context: args.req.context,\n operation: 'resetPassword',\n req: args.req,\n })) || args\n }\n }\n\n // /////////////////////////////////////\n // Reset Password\n // /////////////////////////////////////\n\n const where = appendNonTrashedFilter({\n enableTrash: Boolean(collectionConfig.trash),\n trash: false,\n where: {\n resetPasswordExpiration: { greater_than: new Date().toISOString() },\n resetPasswordToken: { equals: data.token },\n },\n })\n\n const user = await payload.db.findOne<any>({\n collection: collectionConfig.slug,\n req,\n where,\n })\n\n if (!user) {\n throw new APIError('Token is either invalid or has expired.', httpStatus.FORBIDDEN)\n }\n\n // TODO: replace this method\n const { hash, salt } = await generatePasswordSaltHash({\n collection: collectionConfig,\n password: data.password,\n req,\n })\n\n user.salt = salt\n user.hash = hash\n\n user.resetPasswordExpiration = new Date().toISOString()\n\n if (collectionConfig.auth.verify) {\n user._verified = Boolean(user._verified)\n }\n // /////////////////////////////////////\n // beforeValidate - Collection\n // /////////////////////////////////////\n\n if (collectionConfig.hooks?.beforeValidate?.length) {\n for (const hook of collectionConfig.hooks.beforeValidate) {\n await hook({\n collection: args.collection?.config,\n context: req.context,\n data: user,\n operation: 'update',\n req,\n })\n }\n }\n\n // /////////////////////////////////////\n // Update new password\n // /////////////////////////////////////\n\n // Ensure updatedAt date is always updated\n user.updatedAt = new Date().toISOString()\n\n const doc = await payload.db.updateOne({\n id: user.id,\n collection: collectionConfig.slug,\n data: user,\n req,\n })\n\n await authenticateLocalStrategy({ doc, password: data.password })\n\n const fieldsToSignArgs: Parameters<typeof getFieldsToSign>[0] = {\n collectionConfig,\n email: user.email,\n user,\n }\n\n const { sid } = await addSessionToUser({\n collectionConfig,\n payload,\n req,\n user,\n })\n\n if (sid) {\n fieldsToSignArgs.sid = sid\n }\n\n const fieldsToSign = getFieldsToSign(fieldsToSignArgs)\n\n const { token } = await jwtSign({\n fieldsToSign,\n secret,\n tokenExpiration: collectionConfig.auth.tokenExpiration,\n })\n\n const fullUser = await payload.findByID({\n id: user.id,\n collection: collectionConfig.slug,\n depth,\n overrideAccess,\n req,\n trash: false,\n })\n\n if (shouldCommit) {\n await commitTransaction(req)\n }\n\n if (fullUser) {\n fullUser.collection = collectionConfig.slug\n fullUser._strategy = 'local-jwt'\n }\n\n let result: { user: DataFromCollectionSlug<TSlug> } & Result = {\n token,\n user: fullUser,\n }\n\n // /////////////////////////////////////\n // afterOperation - Collection\n // /////////////////////////////////////\n\n result = await buildAfterOperation({\n args,\n collection: args.collection?.config,\n operation: 'resetPassword',\n result,\n })\n\n return result\n } catch (error: unknown) {\n await killTransaction(req)\n throw error\n }\n}\n"],"names":["status","httpStatus","buildAfterOperation","APIError","Forbidden","appendNonTrashedFilter","commitTransaction","initTransaction","killTransaction","getFieldsToSign","jwtSign","addSessionToUser","authenticateLocalStrategy","generatePasswordSaltHash","resetPasswordOperation","args","collection","config","collectionConfig","data","depth","overrideAccess","req","payload","secret","Object","prototype","hasOwnProperty","call","BAD_REQUEST","auth","disableLocalStrategy","t","shouldCommit","hooks","beforeOperation","length","hook","context","operation","where","enableTrash","Boolean","trash","resetPasswordExpiration","greater_than","Date","toISOString","resetPasswordToken","equals","token","user","db","findOne","slug","FORBIDDEN","hash","salt","password","verify","_verified","beforeValidate","updatedAt","doc","updateOne","id","fieldsToSignArgs","email","sid","fieldsToSign","tokenExpiration","fullUser","findByID","_strategy","result","error"],"mappings":"AAAA,SAASA,UAAUC,UAAU,QAAQ,cAAa;AAMlD,SAASC,mBAAmB,QAAQ,wCAAuC;AAC3E,SAASC,QAAQ,EAAEC,SAAS,QAAQ,wBAAuB;AAC3D,SAASC,sBAAsB,QAAQ,4CAA2C;AAClF,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,wBAAuB;AACvD,SAASC,OAAO,QAAQ,YAAW;AACnC,SAASC,gBAAgB,QAAQ,iBAAgB;AACjD,SAASC,yBAAyB,QAAQ,sCAAqC;AAC/E,SAASC,wBAAwB,QAAQ,kDAAiD;AAkB1F,OAAO,MAAMC,yBAAyB,OACpCC;IAEA,MAAM,EACJC,YAAY,EAAEC,QAAQC,gBAAgB,EAAE,EACxCC,IAAI,EACJC,KAAK,EACLC,cAAc,EACdC,KAAK,EACHC,SAAS,EAAEC,MAAM,EAAE,EACnBD,OAAO,EACR,EACDD,GAAG,EACJ,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YACA7C;YACA8C,iBAAiBpD,iBAAiBY,IAAI,CAACwC,eAAe;QACxD;QAEA,MAAMC,WAAW,MAAMhD,QAAQiD,QAAQ,CAAC;YACtCP,IAAId,KAAKc,EAAE;YACXjD,YAAYE,iBAAiBoC,IAAI;YACjClC;YACAC;YACAC;YACAqB,OAAO;QACT;QAEA,IAAIV,cAAc;YAChB,MAAM3B,kBAAkBgB;QAC1B;QAEA,IAAIiD,UAAU;YACZA,SAASvD,UAAU,GAAGE,iBAAiBoC,IAAI;YAC3CiB,SAASE,SAAS,GAAG;QACvB;QAEA,IAAIC,SAA2D;YAC7DxB;YACAC,MAAMoB;QACR;QAEA,wCAAwC;QACxC,8BAA8B;QAC9B,wCAAwC;QAExCG,SAAS,MAAMxE,oBAAoB;YACjCa;YACAC,YAAYD,KAAKC,UAAU,EAAEC;YAC7BsB,WAAW;YACXmC;QACF;QAEA,OAAOA;IACT,EAAE,OAAOC,OAAgB;QACvB,MAAMnE,gBAAgBc;QACtB,MAAMqD;IACR;AACF,EAAC"}
@@ -22,7 +22,7 @@ export type SanitizedBlockPermissions = {
22
22
  } | true;
23
23
  export type BlocksPermissions = {
24
24
  [blockSlug: string]: BlockPermissions;
25
- };
25
+ } | true;
26
26
  export type SanitizedBlocksPermissions = {
27
27
  [blockSlug: string]: SanitizedBlockPermissions;
28
28
  } | true;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/auth/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE9D;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,UAAU,EAAE,OAAO,CAAA;IACnB,KAAK,CAAC,EAAE,KA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BAAmB,GAAG,QAAQ,CAAC;IAC/F,cAAc,CAAC,EAAE;QACf,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,iBAAiB,CAAC,EAAE,+BAA+B,CAAA;QACnD,oBAAoB,CAAC,EAAE,kCAAkC,CAAA;KAC1D,CAAA;IACD,iBAAiB,EAAE,KAAK,GAAG,wBAAwB,CAAA;IACnD,MAAM,CAAC,EAAE,OAAO,GAAG,YAAY,CAAA;CAChC;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,IAAI,KAAK,CAE7E"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/auth/types.ts"],"sourcesContent":["import type { DeepRequired } from 'ts-essentials'\n\nimport type { CollectionSlug, GlobalSlug, Payload, TypedUser } from '../index.js'\nimport type { PayloadRequest, Where } from '../types/index.js'\n\n/**\n * A permission object that can be used to determine if a user has access to a specific operation.\n */\nexport type Permission = {\n permission: boolean\n where?: Where\n}\n\nexport type FieldsPermissions = {\n [fieldName: string]: FieldPermissions\n}\n\nexport type BlockPermissions = {\n create: Permission\n fields: FieldsPermissions\n read: Permission\n update: Permission\n}\n\nexport type SanitizedBlockPermissions =\n | {\n fields: SanitizedFieldsPermissions\n }\n | true\n\nexport type BlocksPermissions = {\n [blockSlug: string]: BlockPermissions\n}\n\nexport type SanitizedBlocksPermissions =\n | {\n [blockSlug: string]: SanitizedBlockPermissions\n }\n | true\n\nexport type FieldPermissions = {\n blocks?: BlocksPermissions\n create: Permission\n fields?: FieldsPermissions\n read: Permission\n update: Permission\n}\n\nexport type SanitizedFieldPermissions =\n | {\n blocks?: SanitizedBlocksPermissions\n create: true\n fields?: SanitizedFieldsPermissions\n read: true\n update: true\n }\n | true\n\nexport type SanitizedFieldsPermissions =\n | {\n [fieldName: string]: SanitizedFieldPermissions\n }\n | true\n\nexport type CollectionPermission = {\n create: Permission\n delete: Permission\n fields: FieldsPermissions\n read: Permission\n readVersions?: Permission\n update: Permission\n}\n\nexport type SanitizedCollectionPermission = {\n create?: true\n delete?: true\n fields: SanitizedFieldsPermissions\n read?: true\n readVersions?: true\n update?: true\n}\n\nexport type GlobalPermission = {\n fields: FieldsPermissions\n read: Permission\n readVersions?: Permission\n update: Permission\n}\n\nexport type SanitizedGlobalPermission = {\n fields: SanitizedFieldsPermissions\n read?: true\n readVersions?: true\n update?: true\n}\n\nexport type DocumentPermissions = CollectionPermission | GlobalPermission\n\nexport type SanitizedDocumentPermissions = SanitizedCollectionPermission | SanitizedGlobalPermission\n\nexport type Permissions = {\n canAccessAdmin: boolean\n collections?: Record<CollectionSlug, CollectionPermission>\n globals?: Record<GlobalSlug, GlobalPermission>\n}\n\nexport type SanitizedPermissions = {\n canAccessAdmin?: boolean\n collections?: {\n [collectionSlug: string]: SanitizedCollectionPermission\n }\n globals?: {\n [globalSlug: string]: SanitizedGlobalPermission\n }\n}\n\ntype BaseUser = {\n collection: string\n email?: string\n id: number | string\n sessions?: Array<UserSession>\n username?: string\n}\n\n/**\n * @deprecated Use `TypedUser` instead. This will be removed in 4.0.\n */\nexport type UntypedUser = {\n [key: string]: any\n} & BaseUser\n\n/**\n * `collection` is not available one the client. It's only available on the server (req.user)\n * On the client, you can access the collection via config.admin.user. Config can be accessed using the useConfig() hook\n */\nexport type ClientUser = {\n [key: string]: any\n} & BaseUser\n\nexport type UserSession = { createdAt: Date | string; expiresAt: Date | string; id: string }\ntype GenerateVerifyEmailHTML<TUser = any> = (args: {\n req: PayloadRequest\n token: string\n user: TUser\n}) => Promise<string> | string\n\ntype GenerateVerifyEmailSubject<TUser = any> = (args: {\n req: PayloadRequest\n token: string\n user: TUser\n}) => Promise<string> | string\n\ntype GenerateForgotPasswordEmailHTML<TUser = any> = (args?: {\n req?: PayloadRequest\n token?: string\n user?: TUser\n}) => Promise<string> | string\n\ntype GenerateForgotPasswordEmailSubject<TUser = any> = (args?: {\n req?: PayloadRequest\n token?: string\n user?: TUser\n}) => Promise<string> | string\n\nexport type AuthStrategyFunctionArgs = {\n /**\n * Specifies whether or not response headers can be set from this strategy.\n */\n canSetHeaders?: boolean\n headers: Request['headers']\n isGraphQL?: boolean\n payload: Payload\n /**\n * The AuthStrategy name property from the payload config.\n */\n strategyName?: string\n}\n\nexport type AuthStrategyResult = {\n responseHeaders?: Headers\n user:\n | ({\n _strategy?: string\n collection?: string\n } & TypedUser)\n | null\n}\n\nexport type AuthStrategyFunction = (\n args: AuthStrategyFunctionArgs,\n) => AuthStrategyResult | Promise<AuthStrategyResult>\nexport type AuthStrategy = {\n authenticate: AuthStrategyFunction\n name: string\n}\n\nexport type LoginWithUsernameOptions =\n | {\n allowEmailLogin?: false\n requireEmail?: boolean\n // If `allowEmailLogin` is false, `requireUsername` must be true (default: true)\n requireUsername?: true\n }\n | {\n allowEmailLogin?: true\n requireEmail?: boolean\n requireUsername?: boolean\n }\n\nexport interface IncomingAuthType {\n /**\n * Set cookie options, including secure, sameSite, and domain. For advanced users.\n */\n cookies?: {\n domain?: string\n sameSite?: 'Lax' | 'None' | 'Strict' | boolean\n secure?: boolean\n }\n /**\n * How many levels deep a user document should be populated when creating the JWT and binding the user to the req. Defaults to 0 and should only be modified if absolutely necessary, as this will affect performance.\n * @default 0\n */\n depth?: number\n /**\n * Advanced - disable Payload's built-in local auth strategy. Only use this property if you have replaced Payload's auth mechanisms with your own.\n */\n disableLocalStrategy?:\n | {\n /**\n * Include auth fields on the collection even though the local strategy is disabled.\n * Useful when you do not want the database or types to vary depending on the auth configuration.\n */\n enableFields?: true\n optionalPassword?: true\n }\n | true\n /**\n * Customize the way that the forgotPassword operation functions.\n * @link https://payloadcms.com/docs/authentication/email#forgot-password\n */\n forgotPassword?: {\n /**\n * The number of milliseconds that the forgot password token should be valid for.\n * @default 3600000 // 1 hour\n */\n expiration?: number\n generateEmailHTML?: GenerateForgotPasswordEmailHTML\n generateEmailSubject?: GenerateForgotPasswordEmailSubject\n }\n /**\n * Set the time (in milliseconds) that a user should be locked out if they fail authentication more times than maxLoginAttempts allows for.\n */\n lockTime?: number\n /**\n * Ability to allow users to login with username/password.\n *\n * @link https://payloadcms.com/docs/authentication/overview#login-with-username\n */\n loginWithUsername?: boolean | LoginWithUsernameOptions\n /**\n * Only allow a user to attempt logging in X amount of times. Automatically locks out a user from authenticating if this limit is passed. Set to 0 to disable.\n */\n maxLoginAttempts?: number\n /***\n * Set to true if you want to remove the token from the returned authentication API responses such as login or refresh.\n */\n removeTokenFromResponses?: true\n /**\n * Advanced - an array of custom authentification strategies to extend this collection's authentication with.\n * @link https://payloadcms.com/docs/authentication/custom-strategies\n */\n strategies?: AuthStrategy[]\n /**\n * Controls how many seconds the token will be valid for. Default is 2 hours.\n * @default 7200\n * @link https://payloadcms.com/docs/authentication/overview#config-options\n */\n tokenExpiration?: number\n /**\n * Payload Authentication provides for API keys to be set on each user within an Authentication-enabled Collection.\n * @default false\n * @link https://payloadcms.com/docs/authentication/api-keys\n */\n useAPIKey?: boolean\n\n /**\n * Use sessions for authentication. Enabled by default.\n * @default true\n */\n useSessions?: boolean\n\n /**\n * Set to true or pass an object with verification options to require users to verify by email before they are allowed to log into your app.\n * @link https://payloadcms.com/docs/authentication/email#email-verification\n */\n verify?:\n | {\n generateEmailHTML?: GenerateVerifyEmailHTML\n generateEmailSubject?: GenerateVerifyEmailSubject\n }\n | boolean\n}\n\nexport type VerifyConfig = {\n generateEmailHTML?: GenerateVerifyEmailHTML\n generateEmailSubject?: GenerateVerifyEmailSubject\n}\n\nexport interface Auth\n extends Omit<DeepRequired<IncomingAuthType>, 'forgotPassword' | 'loginWithUsername' | 'verify'> {\n forgotPassword?: {\n expiration?: number\n generateEmailHTML?: GenerateForgotPasswordEmailHTML\n generateEmailSubject?: GenerateForgotPasswordEmailSubject\n }\n loginWithUsername: false | LoginWithUsernameOptions\n verify?: boolean | VerifyConfig\n}\n\nexport function hasWhereAccessResult(result: boolean | Where): result is Where {\n return result && typeof result === 'object'\n}\n"],"names":["hasWhereAccessResult","result"],"mappings":"AA+TA,OAAO,SAASA,qBAAqBC,MAAuB;IAC1D,OAAOA,UAAU,OAAOA,WAAW;AACrC"}
1
+ {"version":3,"sources":["../../src/auth/types.ts"],"sourcesContent":["import type { DeepRequired } from 'ts-essentials'\n\nimport type { CollectionSlug, GlobalSlug, Payload, TypedUser } from '../index.js'\nimport type { PayloadRequest, Where } from '../types/index.js'\n\n/**\n * A permission object that can be used to determine if a user has access to a specific operation.\n */\nexport type Permission = {\n permission: boolean\n where?: Where\n}\n\nexport type FieldsPermissions = {\n [fieldName: string]: FieldPermissions\n}\n\nexport type BlockPermissions = {\n create: Permission\n fields: FieldsPermissions\n read: Permission\n update: Permission\n}\n\nexport type SanitizedBlockPermissions =\n | {\n fields: SanitizedFieldsPermissions\n }\n | true\n\nexport type BlocksPermissions =\n | {\n [blockSlug: string]: BlockPermissions\n }\n | true\n\nexport type SanitizedBlocksPermissions =\n | {\n [blockSlug: string]: SanitizedBlockPermissions\n }\n | true\n\nexport type FieldPermissions = {\n blocks?: BlocksPermissions\n create: Permission\n fields?: FieldsPermissions\n read: Permission\n update: Permission\n}\n\nexport type SanitizedFieldPermissions =\n | {\n blocks?: SanitizedBlocksPermissions\n create: true\n fields?: SanitizedFieldsPermissions\n read: true\n update: true\n }\n | true\n\nexport type SanitizedFieldsPermissions =\n | {\n [fieldName: string]: SanitizedFieldPermissions\n }\n | true\n\nexport type CollectionPermission = {\n create: Permission\n delete: Permission\n fields: FieldsPermissions\n read: Permission\n readVersions?: Permission\n update: Permission\n}\n\nexport type SanitizedCollectionPermission = {\n create?: true\n delete?: true\n fields: SanitizedFieldsPermissions\n read?: true\n readVersions?: true\n update?: true\n}\n\nexport type GlobalPermission = {\n fields: FieldsPermissions\n read: Permission\n readVersions?: Permission\n update: Permission\n}\n\nexport type SanitizedGlobalPermission = {\n fields: SanitizedFieldsPermissions\n read?: true\n readVersions?: true\n update?: true\n}\n\nexport type DocumentPermissions = CollectionPermission | GlobalPermission\n\nexport type SanitizedDocumentPermissions = SanitizedCollectionPermission | SanitizedGlobalPermission\n\nexport type Permissions = {\n canAccessAdmin: boolean\n collections?: Record<CollectionSlug, CollectionPermission>\n globals?: Record<GlobalSlug, GlobalPermission>\n}\n\nexport type SanitizedPermissions = {\n canAccessAdmin?: boolean\n collections?: {\n [collectionSlug: string]: SanitizedCollectionPermission\n }\n globals?: {\n [globalSlug: string]: SanitizedGlobalPermission\n }\n}\n\ntype BaseUser = {\n collection: string\n email?: string\n id: number | string\n sessions?: Array<UserSession>\n username?: string\n}\n\n/**\n * @deprecated Use `TypedUser` instead. This will be removed in 4.0.\n */\nexport type UntypedUser = {\n [key: string]: any\n} & BaseUser\n\n/**\n * `collection` is not available one the client. It's only available on the server (req.user)\n * On the client, you can access the collection via config.admin.user. Config can be accessed using the useConfig() hook\n */\nexport type ClientUser = {\n [key: string]: any\n} & BaseUser\n\nexport type UserSession = { createdAt: Date | string; expiresAt: Date | string; id: string }\ntype GenerateVerifyEmailHTML<TUser = any> = (args: {\n req: PayloadRequest\n token: string\n user: TUser\n}) => Promise<string> | string\n\ntype GenerateVerifyEmailSubject<TUser = any> = (args: {\n req: PayloadRequest\n token: string\n user: TUser\n}) => Promise<string> | string\n\ntype GenerateForgotPasswordEmailHTML<TUser = any> = (args?: {\n req?: PayloadRequest\n token?: string\n user?: TUser\n}) => Promise<string> | string\n\ntype GenerateForgotPasswordEmailSubject<TUser = any> = (args?: {\n req?: PayloadRequest\n token?: string\n user?: TUser\n}) => Promise<string> | string\n\nexport type AuthStrategyFunctionArgs = {\n /**\n * Specifies whether or not response headers can be set from this strategy.\n */\n canSetHeaders?: boolean\n headers: Request['headers']\n isGraphQL?: boolean\n payload: Payload\n /**\n * The AuthStrategy name property from the payload config.\n */\n strategyName?: string\n}\n\nexport type AuthStrategyResult = {\n responseHeaders?: Headers\n user:\n | ({\n _strategy?: string\n collection?: string\n } & TypedUser)\n | null\n}\n\nexport type AuthStrategyFunction = (\n args: AuthStrategyFunctionArgs,\n) => AuthStrategyResult | Promise<AuthStrategyResult>\nexport type AuthStrategy = {\n authenticate: AuthStrategyFunction\n name: string\n}\n\nexport type LoginWithUsernameOptions =\n | {\n allowEmailLogin?: false\n requireEmail?: boolean\n // If `allowEmailLogin` is false, `requireUsername` must be true (default: true)\n requireUsername?: true\n }\n | {\n allowEmailLogin?: true\n requireEmail?: boolean\n requireUsername?: boolean\n }\n\nexport interface IncomingAuthType {\n /**\n * Set cookie options, including secure, sameSite, and domain. For advanced users.\n */\n cookies?: {\n domain?: string\n sameSite?: 'Lax' | 'None' | 'Strict' | boolean\n secure?: boolean\n }\n /**\n * How many levels deep a user document should be populated when creating the JWT and binding the user to the req. Defaults to 0 and should only be modified if absolutely necessary, as this will affect performance.\n * @default 0\n */\n depth?: number\n /**\n * Advanced - disable Payload's built-in local auth strategy. Only use this property if you have replaced Payload's auth mechanisms with your own.\n */\n disableLocalStrategy?:\n | {\n /**\n * Include auth fields on the collection even though the local strategy is disabled.\n * Useful when you do not want the database or types to vary depending on the auth configuration.\n */\n enableFields?: true\n optionalPassword?: true\n }\n | true\n /**\n * Customize the way that the forgotPassword operation functions.\n * @link https://payloadcms.com/docs/authentication/email#forgot-password\n */\n forgotPassword?: {\n /**\n * The number of milliseconds that the forgot password token should be valid for.\n * @default 3600000 // 1 hour\n */\n expiration?: number\n generateEmailHTML?: GenerateForgotPasswordEmailHTML\n generateEmailSubject?: GenerateForgotPasswordEmailSubject\n }\n /**\n * Set the time (in milliseconds) that a user should be locked out if they fail authentication more times than maxLoginAttempts allows for.\n */\n lockTime?: number\n /**\n * Ability to allow users to login with username/password.\n *\n * @link https://payloadcms.com/docs/authentication/overview#login-with-username\n */\n loginWithUsername?: boolean | LoginWithUsernameOptions\n /**\n * Only allow a user to attempt logging in X amount of times. Automatically locks out a user from authenticating if this limit is passed. Set to 0 to disable.\n */\n maxLoginAttempts?: number\n /***\n * Set to true if you want to remove the token from the returned authentication API responses such as login or refresh.\n */\n removeTokenFromResponses?: true\n /**\n * Advanced - an array of custom authentification strategies to extend this collection's authentication with.\n * @link https://payloadcms.com/docs/authentication/custom-strategies\n */\n strategies?: AuthStrategy[]\n /**\n * Controls how many seconds the token will be valid for. Default is 2 hours.\n * @default 7200\n * @link https://payloadcms.com/docs/authentication/overview#config-options\n */\n tokenExpiration?: number\n /**\n * Payload Authentication provides for API keys to be set on each user within an Authentication-enabled Collection.\n * @default false\n * @link https://payloadcms.com/docs/authentication/api-keys\n */\n useAPIKey?: boolean\n\n /**\n * Use sessions for authentication. Enabled by default.\n * @default true\n */\n useSessions?: boolean\n\n /**\n * Set to true or pass an object with verification options to require users to verify by email before they are allowed to log into your app.\n * @link https://payloadcms.com/docs/authentication/email#email-verification\n */\n verify?:\n | {\n generateEmailHTML?: GenerateVerifyEmailHTML\n generateEmailSubject?: GenerateVerifyEmailSubject\n }\n | boolean\n}\n\nexport type VerifyConfig = {\n generateEmailHTML?: GenerateVerifyEmailHTML\n generateEmailSubject?: GenerateVerifyEmailSubject\n}\n\nexport interface Auth\n extends Omit<DeepRequired<IncomingAuthType>, 'forgotPassword' | 'loginWithUsername' | 'verify'> {\n forgotPassword?: {\n expiration?: number\n generateEmailHTML?: GenerateForgotPasswordEmailHTML\n generateEmailSubject?: GenerateForgotPasswordEmailSubject\n }\n loginWithUsername: false | LoginWithUsernameOptions\n verify?: boolean | VerifyConfig\n}\n\nexport function hasWhereAccessResult(result: boolean | Where): result is Where {\n return result && typeof result === 'object'\n}\n"],"names":["hasWhereAccessResult","result"],"mappings":"AAiUA,OAAO,SAASA,qBAAqBC,MAAuB;IAC1D,OAAOA,UAAU,OAAOA,WAAW;AACrC"}
@@ -288,6 +288,15 @@ export type CollectionAdminOptions = {
288
288
  * @default false
289
289
  */
290
290
  disableCopyToLocale?: boolean;
291
+ /**
292
+ * Performance opt-in. If true, will use the [Select API](https://payloadcms.com/docs/queries/select) when
293
+ * loading the list view to query only the active columns, as opposed to the entire documents.
294
+ * If your cells require specific fields that may be unselected, such as within hooks, etc.,
295
+ * use `forceSelect` in conjunction with this property.
296
+ *
297
+ * @experimental This is an experimental feature and may change in the future. Use at your own discretion.
298
+ */
299
+ enableListViewSelectAPI?: boolean;
291
300
  enableRichTextLink?: boolean;
292
301
  enableRichTextRelationship?: boolean;
293
302
  /**
@@ -298,10 +307,10 @@ export type CollectionAdminOptions = {
298
307
  */
299
308
  group?: false | Record<string, string> | string;
300
309
  /**
301
- * @experimental This option is currently in beta and may change in future releases and/or contain bugs.
302
- * Use at your own risk.
303
310
  * @description Enable grouping by a field in the list view.
304
311
  * Uses `payload.findDistinct` under the hood to populate the group-by options.
312
+ *
313
+ * @experimental This option is currently in beta and may change in future releases. Use at your own discretion.
305
314
  */
306
315
  groupBy?: boolean;
307
316
  /**