payload 3.0.0-beta.107 → 3.0.0-beta.109

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 (218) hide show
  1. package/dist/admin/fields/Join.d.ts +18 -0
  2. package/dist/admin/fields/Join.d.ts.map +1 -0
  3. package/dist/admin/fields/Join.js +3 -0
  4. package/dist/admin/fields/Join.js.map +1 -0
  5. package/dist/admin/forms/Label.d.ts +2 -2
  6. package/dist/admin/forms/Label.d.ts.map +1 -1
  7. package/dist/admin/forms/Label.js.map +1 -1
  8. package/dist/admin/types.d.ts +1 -0
  9. package/dist/admin/types.d.ts.map +1 -1
  10. package/dist/admin/types.js.map +1 -1
  11. package/dist/auth/operations/login.d.ts.map +1 -1
  12. package/dist/auth/operations/login.js +2 -1
  13. package/dist/auth/operations/login.js.map +1 -1
  14. package/dist/auth/operations/me.d.ts.map +1 -1
  15. package/dist/auth/operations/me.js +3 -1
  16. package/dist/auth/operations/me.js.map +1 -1
  17. package/dist/auth/operations/refresh.d.ts.map +1 -1
  18. package/dist/auth/operations/refresh.js +3 -0
  19. package/dist/auth/operations/refresh.js.map +1 -1
  20. package/dist/auth/types.d.ts +7 -3
  21. package/dist/auth/types.d.ts.map +1 -1
  22. package/dist/auth/types.js.map +1 -1
  23. package/dist/checkPayloadDependencies.d.ts.map +1 -1
  24. package/dist/checkPayloadDependencies.js +1 -44
  25. package/dist/checkPayloadDependencies.js.map +1 -1
  26. package/dist/collections/config/client.d.ts +2 -2
  27. package/dist/collections/config/client.d.ts.map +1 -1
  28. package/dist/collections/config/client.js.map +1 -1
  29. package/dist/collections/config/sanitize.d.ts.map +1 -1
  30. package/dist/collections/config/sanitize.js +6 -1
  31. package/dist/collections/config/sanitize.js.map +1 -1
  32. package/dist/collections/config/types.d.ts +31 -9
  33. package/dist/collections/config/types.d.ts.map +1 -1
  34. package/dist/collections/config/types.js.map +1 -1
  35. package/dist/collections/operations/delete.d.ts +1 -0
  36. package/dist/collections/operations/delete.d.ts.map +1 -1
  37. package/dist/collections/operations/delete.js +12 -1
  38. package/dist/collections/operations/delete.js.map +1 -1
  39. package/dist/collections/operations/deleteByID.d.ts +1 -0
  40. package/dist/collections/operations/deleteByID.d.ts.map +1 -1
  41. package/dist/collections/operations/deleteByID.js +12 -1
  42. package/dist/collections/operations/deleteByID.js.map +1 -1
  43. package/dist/collections/operations/find.d.ts +3 -1
  44. package/dist/collections/operations/find.d.ts.map +1 -1
  45. package/dist/collections/operations/find.js +43 -2
  46. package/dist/collections/operations/find.js.map +1 -1
  47. package/dist/collections/operations/findByID.d.ts +3 -1
  48. package/dist/collections/operations/findByID.d.ts.map +1 -1
  49. package/dist/collections/operations/findByID.js +38 -1
  50. package/dist/collections/operations/findByID.js.map +1 -1
  51. package/dist/collections/operations/findVersions.js +1 -1
  52. package/dist/collections/operations/findVersions.js.map +1 -1
  53. package/dist/collections/operations/local/delete.d.ts +1 -0
  54. package/dist/collections/operations/local/delete.d.ts.map +1 -1
  55. package/dist/collections/operations/local/delete.js +2 -1
  56. package/dist/collections/operations/local/delete.js.map +1 -1
  57. package/dist/collections/operations/local/find.d.ts +3 -1
  58. package/dist/collections/operations/local/find.d.ts.map +1 -1
  59. package/dist/collections/operations/local/find.js +3 -1
  60. package/dist/collections/operations/local/find.js.map +1 -1
  61. package/dist/collections/operations/local/findByID.d.ts +5 -3
  62. package/dist/collections/operations/local/findByID.d.ts.map +1 -1
  63. package/dist/collections/operations/local/findByID.js +3 -1
  64. package/dist/collections/operations/local/findByID.js.map +1 -1
  65. package/dist/collections/operations/local/update.d.ts +2 -0
  66. package/dist/collections/operations/local/update.d.ts.map +1 -1
  67. package/dist/collections/operations/local/update.js +3 -1
  68. package/dist/collections/operations/local/update.js.map +1 -1
  69. package/dist/collections/operations/update.d.ts +1 -0
  70. package/dist/collections/operations/update.d.ts.map +1 -1
  71. package/dist/collections/operations/update.js +13 -2
  72. package/dist/collections/operations/update.js.map +1 -1
  73. package/dist/collections/operations/updateByID.d.ts +2 -0
  74. package/dist/collections/operations/updateByID.d.ts.map +1 -1
  75. package/dist/collections/operations/updateByID.js +44 -5
  76. package/dist/collections/operations/updateByID.js.map +1 -1
  77. package/dist/config/client.d.ts +1 -1
  78. package/dist/config/client.d.ts.map +1 -1
  79. package/dist/config/client.js +2 -1
  80. package/dist/config/client.js.map +1 -1
  81. package/dist/config/defaults.d.ts.map +1 -1
  82. package/dist/config/defaults.js +2 -1
  83. package/dist/config/defaults.js.map +1 -1
  84. package/dist/config/sanitize.d.ts.map +1 -1
  85. package/dist/config/sanitize.js +2 -0
  86. package/dist/config/sanitize.js.map +1 -1
  87. package/dist/config/types.d.ts +35 -3
  88. package/dist/config/types.d.ts.map +1 -1
  89. package/dist/config/types.js.map +1 -1
  90. package/dist/database/queryValidation/validateSearchParams.d.ts.map +1 -1
  91. package/dist/database/queryValidation/validateSearchParams.js +6 -1
  92. package/dist/database/queryValidation/validateSearchParams.js.map +1 -1
  93. package/dist/database/types.d.ts +26 -2
  94. package/dist/database/types.d.ts.map +1 -1
  95. package/dist/database/types.js.map +1 -1
  96. package/dist/errors/InvalidFieldJoin.d.ts +6 -0
  97. package/dist/errors/InvalidFieldJoin.d.ts.map +1 -0
  98. package/dist/errors/InvalidFieldJoin.js +8 -0
  99. package/dist/errors/InvalidFieldJoin.js.map +1 -0
  100. package/dist/errors/Locked.d.ts +5 -0
  101. package/dist/errors/Locked.d.ts.map +1 -0
  102. package/dist/errors/Locked.js +9 -0
  103. package/dist/errors/Locked.js.map +1 -0
  104. package/dist/errors/index.d.ts +1 -0
  105. package/dist/errors/index.d.ts.map +1 -1
  106. package/dist/errors/index.js +1 -0
  107. package/dist/errors/index.js.map +1 -1
  108. package/dist/exports/shared.d.ts +1 -1
  109. package/dist/exports/shared.d.ts.map +1 -1
  110. package/dist/exports/shared.js +1 -1
  111. package/dist/exports/shared.js.map +1 -1
  112. package/dist/fields/config/client.d.ts +1 -1
  113. package/dist/fields/config/client.d.ts.map +1 -1
  114. package/dist/fields/config/client.js.map +1 -1
  115. package/dist/fields/config/sanitize.d.ts +7 -2
  116. package/dist/fields/config/sanitize.d.ts.map +1 -1
  117. package/dist/fields/config/sanitize.js +27 -5
  118. package/dist/fields/config/sanitize.js.map +1 -1
  119. package/dist/fields/config/sanitizeJoinField.d.ts +10 -0
  120. package/dist/fields/config/sanitizeJoinField.d.ts.map +1 -0
  121. package/dist/fields/config/sanitizeJoinField.js +68 -0
  122. package/dist/fields/config/sanitizeJoinField.js.map +1 -0
  123. package/dist/fields/config/types.d.ts +108 -48
  124. package/dist/fields/config/types.d.ts.map +1 -1
  125. package/dist/fields/config/types.js +4 -1
  126. package/dist/fields/config/types.js.map +1 -1
  127. package/dist/fields/hooks/afterRead/promise.js +1 -1
  128. package/dist/fields/hooks/afterRead/promise.js.map +1 -1
  129. package/dist/fields/hooks/afterRead/relationshipPopulationPromise.d.ts +2 -2
  130. package/dist/fields/hooks/afterRead/relationshipPopulationPromise.d.ts.map +1 -1
  131. package/dist/fields/hooks/afterRead/relationshipPopulationPromise.js +16 -9
  132. package/dist/fields/hooks/afterRead/relationshipPopulationPromise.js.map +1 -1
  133. package/dist/fields/hooks/beforeChange/index.d.ts +1 -2
  134. package/dist/fields/hooks/beforeChange/index.d.ts.map +1 -1
  135. package/dist/fields/hooks/beforeChange/index.js.map +1 -1
  136. package/dist/fields/hooks/beforeChange/promise.d.ts.map +1 -1
  137. package/dist/fields/hooks/beforeChange/promise.js +1 -1
  138. package/dist/fields/hooks/beforeChange/promise.js.map +1 -1
  139. package/dist/fields/validations.d.ts +11 -1
  140. package/dist/fields/validations.d.ts.map +1 -1
  141. package/dist/fields/validations.js.map +1 -1
  142. package/dist/globals/config/types.d.ts +7 -0
  143. package/dist/globals/config/types.d.ts.map +1 -1
  144. package/dist/globals/config/types.js.map +1 -1
  145. package/dist/globals/operations/findOne.d.ts +1 -0
  146. package/dist/globals/operations/findOne.d.ts.map +1 -1
  147. package/dist/globals/operations/findOne.js +28 -1
  148. package/dist/globals/operations/findOne.js.map +1 -1
  149. package/dist/globals/operations/findVersions.js +1 -1
  150. package/dist/globals/operations/findVersions.js.map +1 -1
  151. package/dist/globals/operations/local/findOne.d.ts +1 -0
  152. package/dist/globals/operations/local/findOne.d.ts.map +1 -1
  153. package/dist/globals/operations/local/findOne.js +2 -1
  154. package/dist/globals/operations/local/findOne.js.map +1 -1
  155. package/dist/globals/operations/local/update.d.ts +2 -0
  156. package/dist/globals/operations/local/update.d.ts.map +1 -1
  157. package/dist/globals/operations/local/update.js +3 -1
  158. package/dist/globals/operations/local/update.js.map +1 -1
  159. package/dist/globals/operations/update.d.ts +2 -0
  160. package/dist/globals/operations/update.d.ts.map +1 -1
  161. package/dist/globals/operations/update.js +47 -7
  162. package/dist/globals/operations/update.js.map +1 -1
  163. package/dist/index.d.ts +15 -9
  164. package/dist/index.d.ts.map +1 -1
  165. package/dist/index.js +28 -10
  166. package/dist/index.js.map +1 -1
  167. package/dist/lockedDocuments/lockedDocumentsCollection.d.ts +4 -0
  168. package/dist/lockedDocuments/lockedDocumentsCollection.d.ts.map +1 -0
  169. package/dist/lockedDocuments/lockedDocumentsCollection.js +31 -0
  170. package/dist/lockedDocuments/lockedDocumentsCollection.js.map +1 -0
  171. package/dist/preferences/operations/update.d.ts.map +1 -1
  172. package/dist/preferences/operations/update.js +6 -17
  173. package/dist/preferences/operations/update.js.map +1 -1
  174. package/dist/types/index.d.ts +11 -2
  175. package/dist/types/index.d.ts.map +1 -1
  176. package/dist/types/index.js.map +1 -1
  177. package/dist/utilities/checkDocumentLockStatus.d.ts +13 -0
  178. package/dist/utilities/checkDocumentLockStatus.d.ts.map +1 -0
  179. package/dist/utilities/checkDocumentLockStatus.js +66 -0
  180. package/dist/utilities/checkDocumentLockStatus.js.map +1 -0
  181. package/dist/utilities/configToJSONSchema.d.ts.map +1 -1
  182. package/dist/utilities/configToJSONSchema.js +26 -0
  183. package/dist/utilities/configToJSONSchema.js.map +1 -1
  184. package/dist/utilities/traverseFields.d.ts +36 -0
  185. package/dist/utilities/traverseFields.d.ts.map +1 -0
  186. package/dist/utilities/traverseFields.js +81 -0
  187. package/dist/utilities/traverseFields.js.map +1 -0
  188. package/dist/versions/baseFields.d.ts +1 -0
  189. package/dist/versions/baseFields.d.ts.map +1 -1
  190. package/dist/versions/baseFields.js +14 -0
  191. package/dist/versions/baseFields.js.map +1 -1
  192. package/dist/versions/buildCollectionFields.d.ts +2 -1
  193. package/dist/versions/buildCollectionFields.d.ts.map +1 -1
  194. package/dist/versions/buildCollectionFields.js +27 -8
  195. package/dist/versions/buildCollectionFields.js.map +1 -1
  196. package/dist/versions/buildGlobalFields.d.ts +2 -1
  197. package/dist/versions/buildGlobalFields.d.ts.map +1 -1
  198. package/dist/versions/buildGlobalFields.js +27 -8
  199. package/dist/versions/buildGlobalFields.js.map +1 -1
  200. package/dist/versions/drafts/replaceWithDraftIfAvailable.d.ts.map +1 -1
  201. package/dist/versions/drafts/replaceWithDraftIfAvailable.js +12 -3
  202. package/dist/versions/drafts/replaceWithDraftIfAvailable.js.map +1 -1
  203. package/dist/versions/getLatestCollectionVersion.d.ts +2 -1
  204. package/dist/versions/getLatestCollectionVersion.d.ts.map +1 -1
  205. package/dist/versions/getLatestCollectionVersion.js +38 -13
  206. package/dist/versions/getLatestCollectionVersion.js.map +1 -1
  207. package/dist/versions/getLatestGlobalVersion.d.ts +2 -1
  208. package/dist/versions/getLatestGlobalVersion.d.ts.map +1 -1
  209. package/dist/versions/getLatestGlobalVersion.js +12 -4
  210. package/dist/versions/getLatestGlobalVersion.js.map +1 -1
  211. package/dist/versions/saveVersion.d.ts +3 -1
  212. package/dist/versions/saveVersion.d.ts.map +1 -1
  213. package/dist/versions/saveVersion.js +44 -20
  214. package/dist/versions/saveVersion.js.map +1 -1
  215. package/dist/versions/types.d.ts +2 -0
  216. package/dist/versions/types.d.ts.map +1 -1
  217. package/dist/versions/types.js.map +1 -1
  218. package/package.json +3 -3
@@ -0,0 +1,18 @@
1
+ import type { MarkOptional } from 'ts-essentials';
2
+ import type { JoinField, JoinFieldClient } from '../../fields/config/types.js';
3
+ import type { FieldErrorClientComponent, FieldErrorServerComponent } from '../forms/Error.js';
4
+ import type { ClientFieldBase, FieldClientComponent, FieldServerComponent, ServerFieldBase } from '../forms/Field.js';
5
+ import type { FieldDescriptionClientComponent, FieldDescriptionServerComponent, FieldLabelClientComponent, FieldLabelServerComponent } from '../types.js';
6
+ type JoinFieldClientWithoutType = MarkOptional<JoinFieldClient, 'type'>;
7
+ export type JoinFieldClientProps = ClientFieldBase<JoinFieldClientWithoutType>;
8
+ export type JoinFieldServerProps = ServerFieldBase<JoinField>;
9
+ export type JoinFieldServerComponent = FieldServerComponent<JoinField>;
10
+ export type JoinFieldClientComponent = FieldClientComponent<JoinFieldClientWithoutType>;
11
+ export type JoinFieldLabelServerComponent = FieldLabelServerComponent<JoinField>;
12
+ export type JoinFieldLabelClientComponent = FieldLabelClientComponent<JoinFieldClientWithoutType>;
13
+ export type JoinFieldDescriptionServerComponent = FieldDescriptionServerComponent<JoinField>;
14
+ export type JoinFieldDescriptionClientComponent = FieldDescriptionClientComponent<JoinFieldClientWithoutType>;
15
+ export type JoinFieldErrorServerComponent = FieldErrorServerComponent<JoinField>;
16
+ export type JoinFieldErrorClientComponent = FieldErrorClientComponent<JoinFieldClientWithoutType>;
17
+ export {};
18
+ //# sourceMappingURL=Join.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Join.d.ts","sourceRoot":"","sources":["../../../src/admin/fields/Join.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAC9E,OAAO,KAAK,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAC7F,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EAChB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACV,+BAA+B,EAC/B,+BAA+B,EAC/B,yBAAyB,EACzB,yBAAyB,EAC1B,MAAM,aAAa,CAAA;AAEpB,KAAK,0BAA0B,GAAG,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAA;AAEvE,MAAM,MAAM,oBAAoB,GAAG,eAAe,CAAC,0BAA0B,CAAC,CAAA;AAE9E,MAAM,MAAM,oBAAoB,GAAG,eAAe,CAAC,SAAS,CAAC,CAAA;AAE7D,MAAM,MAAM,wBAAwB,GAAG,oBAAoB,CAAC,SAAS,CAAC,CAAA;AAEtE,MAAM,MAAM,wBAAwB,GAAG,oBAAoB,CAAC,0BAA0B,CAAC,CAAA;AAEvF,MAAM,MAAM,6BAA6B,GAAG,yBAAyB,CAAC,SAAS,CAAC,CAAA;AAEhF,MAAM,MAAM,6BAA6B,GAAG,yBAAyB,CAAC,0BAA0B,CAAC,CAAA;AAEjG,MAAM,MAAM,mCAAmC,GAAG,+BAA+B,CAAC,SAAS,CAAC,CAAA;AAE5F,MAAM,MAAM,mCAAmC,GAC7C,+BAA+B,CAAC,0BAA0B,CAAC,CAAA;AAE7D,MAAM,MAAM,6BAA6B,GAAG,yBAAyB,CAAC,SAAS,CAAC,CAAA;AAEhF,MAAM,MAAM,6BAA6B,GAAG,yBAAyB,CAAC,0BAA0B,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { };
2
+
3
+ //# sourceMappingURL=Join.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/admin/fields/Join.ts"],"sourcesContent":["import type { MarkOptional } from 'ts-essentials'\n\nimport type { JoinField, JoinFieldClient } from '../../fields/config/types.js'\nimport type { FieldErrorClientComponent, FieldErrorServerComponent } from '../forms/Error.js'\nimport type {\n ClientFieldBase,\n FieldClientComponent,\n FieldServerComponent,\n ServerFieldBase,\n} from '../forms/Field.js'\nimport type {\n FieldDescriptionClientComponent,\n FieldDescriptionServerComponent,\n FieldLabelClientComponent,\n FieldLabelServerComponent,\n} from '../types.js'\n\ntype JoinFieldClientWithoutType = MarkOptional<JoinFieldClient, 'type'>\n\nexport type JoinFieldClientProps = ClientFieldBase<JoinFieldClientWithoutType>\n\nexport type JoinFieldServerProps = ServerFieldBase<JoinField>\n\nexport type JoinFieldServerComponent = FieldServerComponent<JoinField>\n\nexport type JoinFieldClientComponent = FieldClientComponent<JoinFieldClientWithoutType>\n\nexport type JoinFieldLabelServerComponent = FieldLabelServerComponent<JoinField>\n\nexport type JoinFieldLabelClientComponent = FieldLabelClientComponent<JoinFieldClientWithoutType>\n\nexport type JoinFieldDescriptionServerComponent = FieldDescriptionServerComponent<JoinField>\n\nexport type JoinFieldDescriptionClientComponent =\n FieldDescriptionClientComponent<JoinFieldClientWithoutType>\n\nexport type JoinFieldErrorServerComponent = FieldErrorServerComponent<JoinField>\n\nexport type JoinFieldErrorClientComponent = FieldErrorClientComponent<JoinFieldClientWithoutType>\n"],"names":[],"mappings":"AAsCA,WAAiG"}
@@ -10,8 +10,8 @@ export type GenericLabelProps = {
10
10
  readonly required?: boolean;
11
11
  readonly unstyled?: boolean;
12
12
  };
13
- export type FieldLabelClientProps<TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType> = {
14
- field: TFieldClient;
13
+ export type FieldLabelClientProps<TFieldClient extends Partial<ClientFieldWithOptionalType> = Partial<ClientFieldWithOptionalType>> = {
14
+ field?: TFieldClient;
15
15
  } & GenericLabelProps;
16
16
  export type FieldLabelServerProps<TFieldServer extends Field, TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType> = {
17
17
  clientField: TFieldClient;
@@ -1 +1 @@
1
- {"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../src/admin/forms/Label.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACrE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAA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Y,CAAC,EACnC,OAAO,GAAG,UAAU,CACrB,CAAA;AAED,MAAM,MAAM,yBAAyB,CACnC,YAAY,SAAS,2BAA2B,GAAG,2BAA2B,IAC5E,KAAK,CAAC,aAAa,CAAC,qBAAqB,CAAC,YAAY,CAAC,CAAC,CAAA;AAE5D,MAAM,MAAM,yBAAyB,CACnC,YAAY,SAAS,KAAK,GAAG,KAAK,EAClC,YAAY,SAAS,2BAA2B,GAAG,2BAA2B,IAC5E,KAAK,CAAC,aAAa,CAAC,qBAAqB,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/admin/forms/Label.ts"],"sourcesContent":["import type { ServerProps, StaticLabel } from '../../config/types.js'\nimport type { Field } from '../../fields/config/types.js'\nimport type { MappedComponent } from '../types.js'\nimport type { ClientFieldWithOptionalType } from './Field.js'\n\nexport type GenericLabelProps = {\n readonly as?: 'label' | 'span'\n readonly htmlFor?: string\n readonly Label?: MappedComponent\n readonly label?: StaticLabel\n readonly required?: boolean\n readonly unstyled?: boolean\n}\n\nexport type FieldLabelClientProps<\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n> = {\n field: TFieldClient\n} & GenericLabelProps\n\nexport type FieldLabelServerProps<\n TFieldServer extends Field,\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n> = {\n clientField: TFieldClient\n readonly field: TFieldServer\n} & GenericLabelProps &\n Partial<ServerProps>\n\nexport type SanitizedLabelProps<TFieldClient extends ClientFieldWithOptionalType> = Omit<\n FieldLabelClientProps<TFieldClient>,\n 'label' | 'required'\n>\n\nexport type FieldLabelClientComponent<\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n> = React.ComponentType<FieldLabelClientProps<TFieldClient>>\n\nexport type FieldLabelServerComponent<\n TFieldServer extends Field = Field,\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n> = React.ComponentType<FieldLabelServerProps<TFieldServer, TFieldClient>>\n"],"names":[],"mappings":"AAsCA,WAG0E"}
1
+ {"version":3,"sources":["../../../src/admin/forms/Label.ts"],"sourcesContent":["import type { ServerProps, StaticLabel } from '../../config/types.js'\nimport type { Field } from '../../fields/config/types.js'\nimport type { MappedComponent } from '../types.js'\nimport type { ClientFieldWithOptionalType } from './Field.js'\n\nexport type GenericLabelProps = {\n readonly as?: 'label' | 'span'\n readonly htmlFor?: string\n readonly Label?: MappedComponent\n readonly label?: StaticLabel\n readonly required?: boolean\n readonly unstyled?: boolean\n}\n\nexport type FieldLabelClientProps<\n TFieldClient extends Partial<ClientFieldWithOptionalType> = Partial<ClientFieldWithOptionalType>,\n> = {\n field?: TFieldClient\n} & GenericLabelProps\n\nexport type FieldLabelServerProps<\n TFieldServer extends Field,\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n> = {\n clientField: TFieldClient\n readonly field: TFieldServer\n} & GenericLabelProps &\n Partial<ServerProps>\n\nexport type SanitizedLabelProps<TFieldClient extends ClientFieldWithOptionalType> = Omit<\n FieldLabelClientProps<TFieldClient>,\n 'label' | 'required'\n>\n\nexport type FieldLabelClientComponent<\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n> = React.ComponentType<FieldLabelClientProps<TFieldClient>>\n\nexport type FieldLabelServerComponent<\n TFieldServer extends Field = Field,\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n> = React.ComponentType<FieldLabelServerProps<TFieldServer, TFieldClient>>\n"],"names":[],"mappings":"AAsCA,WAG0E"}
@@ -20,6 +20,7 @@ export type { DateFieldClientComponent, DateFieldClientProps, DateFieldDescripti
20
20
  export type { EmailFieldClientComponent, EmailFieldClientProps, EmailFieldDescriptionClientComponent, EmailFieldDescriptionServerComponent, EmailFieldErrorClientComponent, EmailFieldErrorServerComponent, EmailFieldLabelClientComponent, EmailFieldLabelServerComponent, EmailFieldServerComponent, EmailFieldServerProps, } from './fields/Email.js';
21
21
  export type { GroupFieldClientComponent, GroupFieldClientProps, GroupFieldDescriptionClientComponent, GroupFieldDescriptionServerComponent, GroupFieldErrorClientComponent, GroupFieldErrorServerComponent, GroupFieldLabelClientComponent, GroupFieldLabelServerComponent, GroupFieldServerComponent, GroupFieldServerProps, } from './fields/Group.js';
22
22
  export type { HiddenFieldProps } from './fields/Hidden.js';
23
+ export type { JoinFieldClientComponent, JoinFieldClientProps, JoinFieldDescriptionClientComponent, JoinFieldDescriptionServerComponent, JoinFieldErrorClientComponent, JoinFieldErrorServerComponent, JoinFieldLabelClientComponent, JoinFieldLabelServerComponent, JoinFieldServerComponent, JoinFieldServerProps, } from './fields/Join.js';
23
24
  export type { JSONFieldClientComponent, JSONFieldClientProps, JSONFieldDescriptionClientComponent, JSONFieldDescriptionServerComponent, JSONFieldErrorClientComponent, JSONFieldErrorServerComponent, JSONFieldLabelClientComponent, JSONFieldLabelServerComponent, JSONFieldServerComponent, JSONFieldServerProps, } from './fields/JSON.js';
24
25
  export type { NumberFieldClientComponent, NumberFieldClientProps, NumberFieldDescriptionClientComponent, NumberFieldDescriptionServerComponent, NumberFieldErrorClientComponent, NumberFieldErrorServerComponent, NumberFieldLabelClientComponent, NumberFieldLabelServerComponent, NumberFieldServerComponent, NumberFieldServerProps, } from './fields/Number.js';
25
26
  export type { PointFieldClientComponent, PointFieldClientProps, PointFieldDescriptionClientComponent, PointFieldDescriptionServerComponent, PointFieldErrorClientComponent, PointFieldErrorServerComponent, PointFieldLabelClientComponent, PointFieldLabelServerComponent, PointFieldServerComponent, PointFieldServerProps, } from './fields/Point.js';
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/admin/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAA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AE,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG,IAAI,GAAG,gBAAgB,CAAC,CAAC,CAAC,EAClE,KAAK,EAAE;QACL,WAAW,CAAC,EAAE,UAAU,CAAA;QACxB,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,EACD,QAAQ,EAAE,KAAK,CAAC,EAAE,EAClB,UAAU,EAAE,MAAM,GACjB,eAAe,CAAC,CAAC,CAAC,CAAA;IAErB,CAAC,CAAC,SAAS,UAAU,EACnB,UAAU,EAAE,CAAC;QAAE,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,EAChE,KAAK,EAAE;QACL,WAAW,CAAC,EAAE,UAAU,CAAA;QACxB,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,EACD,QAAQ,EAAE,KAAK,CAAC,EAAE,EAClB,UAAU,EAAE,MAAM,GACjB,eAAe,CAAC,CAAC,CAAC,EAAE,CAAA;CACxB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/admin/types.ts"],"sourcesContent":["import type React from 'react'\n\nimport type { PayloadComponent } from '../config/types.js'\nimport type { JsonObject } from '../types/index.js'\n\nexport type { CellComponentProps, DefaultCellComponentProps } from './elements/Cell.js'\nexport type { ConditionalDateProps } from './elements/DatePicker.js'\nexport type { DayPickerProps, SharedProps, TimePickerProps } from './elements/DatePicker.js'\nexport type { CustomPreviewButton } from './elements/PreviewButton.js'\nexport type { CustomPublishButton } from './elements/PublishButton.js'\nexport type { CustomSaveButton } from './elements/SaveButton.js'\nexport type { CustomSaveDraftButton } from './elements/SaveDraftButton.js'\nexport type {\n DocumentTabComponent,\n DocumentTabCondition,\n DocumentTabConfig,\n DocumentTabProps,\n} from './elements/Tab.js'\nexport type { CustomUpload } from './elements/Upload.js'\n\nexport type {\n WithServerSidePropsComponent,\n WithServerSidePropsComponentProps,\n} from './elements/WithServerSideProps.js'\n\nexport type {\n ArrayFieldClientComponent,\n ArrayFieldClientProps,\n ArrayFieldDescriptionClientComponent,\n ArrayFieldDescriptionServerComponent,\n ArrayFieldErrorClientComponent,\n ArrayFieldErrorServerComponent,\n ArrayFieldLabelClientComponent,\n ArrayFieldLabelServerComponent,\n ArrayFieldServerComponent,\n ArrayFieldServerProps,\n} from './fields/Array.js'\n\nexport type {\n BlocksFieldClientComponent,\n BlocksFieldClientProps,\n BlocksFieldDescriptionClientComponent,\n BlocksFieldDescriptionServerComponent,\n BlocksFieldErrorClientComponent,\n BlocksFieldErrorServerComponent,\n BlocksFieldLabelClientComponent,\n BlocksFieldLabelServerComponent,\n BlocksFieldServerComponent,\n BlocksFieldServerProps,\n} from './fields/Blocks.js'\n\nexport type {\n CheckboxFieldClientComponent,\n CheckboxFieldClientProps,\n CheckboxFieldDescriptionClientComponent,\n CheckboxFieldDescriptionServerComponent,\n CheckboxFieldErrorClientComponent,\n CheckboxFieldErrorServerComponent,\n CheckboxFieldLabelClientComponent,\n CheckboxFieldLabelServerComponent,\n CheckboxFieldServerComponent,\n CheckboxFieldServerProps,\n} from './fields/Checkbox.js'\n\nexport type {\n CodeFieldClientComponent,\n CodeFieldClientProps,\n CodeFieldDescriptionClientComponent,\n CodeFieldDescriptionServerComponent,\n CodeFieldErrorClientComponent,\n CodeFieldErrorServerComponent,\n CodeFieldLabelClientComponent,\n CodeFieldLabelServerComponent,\n CodeFieldServerComponent,\n CodeFieldServerProps,\n} from './fields/Code.js'\n\nexport type {\n CollapsibleFieldClientComponent,\n CollapsibleFieldClientProps,\n CollapsibleFieldDescriptionClientComponent,\n CollapsibleFieldDescriptionServerComponent,\n CollapsibleFieldErrorClientComponent,\n CollapsibleFieldErrorServerComponent,\n CollapsibleFieldLabelClientComponent,\n CollapsibleFieldLabelServerComponent,\n CollapsibleFieldServerComponent,\n CollapsibleFieldServerProps,\n} from './fields/Collapsible.js'\n\nexport type {\n DateFieldClientComponent,\n DateFieldClientProps,\n DateFieldDescriptionClientComponent,\n DateFieldDescriptionServerComponent,\n DateFieldErrorClientComponent,\n DateFieldErrorServerComponent,\n DateFieldLabelClientComponent,\n DateFieldLabelServerComponent,\n DateFieldServerComponent,\n DateFieldServerProps,\n} from './fields/Date.js'\n\nexport type {\n EmailFieldClientComponent,\n EmailFieldClientProps,\n EmailFieldDescriptionClientComponent,\n EmailFieldDescriptionServerComponent,\n EmailFieldErrorClientComponent,\n EmailFieldErrorServerComponent,\n EmailFieldLabelClientComponent,\n EmailFieldLabelServerComponent,\n EmailFieldServerComponent,\n EmailFieldServerProps,\n} from './fields/Email.js'\n\nexport type {\n GroupFieldClientComponent,\n GroupFieldClientProps,\n GroupFieldDescriptionClientComponent,\n GroupFieldDescriptionServerComponent,\n GroupFieldErrorClientComponent,\n GroupFieldErrorServerComponent,\n GroupFieldLabelClientComponent,\n GroupFieldLabelServerComponent,\n GroupFieldServerComponent,\n GroupFieldServerProps,\n} from './fields/Group.js'\n\nexport type { HiddenFieldProps } from './fields/Hidden.js'\n\nexport type {\n JSONFieldClientComponent,\n JSONFieldClientProps,\n JSONFieldDescriptionClientComponent,\n JSONFieldDescriptionServerComponent,\n JSONFieldErrorClientComponent,\n JSONFieldErrorServerComponent,\n JSONFieldLabelClientComponent,\n JSONFieldLabelServerComponent,\n JSONFieldServerComponent,\n JSONFieldServerProps,\n} from './fields/JSON.js'\n\nexport type {\n NumberFieldClientComponent,\n NumberFieldClientProps,\n NumberFieldDescriptionClientComponent,\n NumberFieldDescriptionServerComponent,\n NumberFieldErrorClientComponent,\n NumberFieldErrorServerComponent,\n NumberFieldLabelClientComponent,\n NumberFieldLabelServerComponent,\n NumberFieldServerComponent,\n NumberFieldServerProps,\n} from './fields/Number.js'\n\nexport type {\n PointFieldClientComponent,\n PointFieldClientProps,\n PointFieldDescriptionClientComponent,\n PointFieldDescriptionServerComponent,\n PointFieldErrorClientComponent,\n PointFieldErrorServerComponent,\n PointFieldLabelClientComponent,\n PointFieldLabelServerComponent,\n PointFieldServerComponent,\n PointFieldServerProps,\n} from './fields/Point.js'\n\nexport type {\n RadioFieldClientComponent,\n RadioFieldClientProps,\n RadioFieldDescriptionClientComponent,\n RadioFieldDescriptionServerComponent,\n RadioFieldErrorClientComponent,\n RadioFieldErrorServerComponent,\n RadioFieldLabelClientComponent,\n RadioFieldLabelServerComponent,\n RadioFieldServerComponent,\n RadioFieldServerProps,\n} from './fields/Radio.js'\n\nexport type {\n RelationshipFieldClientComponent,\n RelationshipFieldClientProps,\n RelationshipFieldDescriptionClientComponent,\n RelationshipFieldDescriptionServerComponent,\n RelationshipFieldErrorClientComponent,\n RelationshipFieldErrorServerComponent,\n RelationshipFieldLabelClientComponent,\n RelationshipFieldLabelServerComponent,\n RelationshipFieldServerComponent,\n RelationshipFieldServerProps,\n} from './fields/Relationship.js'\n\nexport type {\n RichTextFieldClientComponent,\n RichTextFieldClientProps,\n RichTextFieldDescriptionClientComponent,\n RichTextFieldDescriptionServerComponent,\n RichTextFieldErrorClientComponent,\n RichTextFieldErrorServerComponent,\n RichTextFieldLabelClientComponent,\n RichTextFieldLabelServerComponent,\n RichTextFieldServerComponent,\n RichTextFieldServerProps,\n} from './fields/RichText.js'\n\nexport type {\n RowFieldClientComponent,\n RowFieldClientProps,\n RowFieldDescriptionClientComponent,\n RowFieldDescriptionServerComponent,\n RowFieldErrorClientComponent,\n RowFieldErrorServerComponent,\n RowFieldLabelClientComponent,\n RowFieldLabelServerComponent,\n RowFieldServerComponent,\n RowFieldServerProps,\n} from './fields/Row.js'\n\nexport type {\n SelectFieldClientComponent,\n SelectFieldClientProps,\n SelectFieldDescriptionClientComponent,\n SelectFieldDescriptionServerComponent,\n SelectFieldErrorClientComponent,\n SelectFieldErrorServerComponent,\n SelectFieldLabelClientComponent,\n SelectFieldLabelServerComponent,\n SelectFieldServerComponent,\n SelectFieldServerProps,\n} from './fields/Select.js'\n\nexport type {\n ClientTab,\n TabsFieldClientComponent,\n TabsFieldClientProps,\n TabsFieldDescriptionClientComponent,\n TabsFieldDescriptionServerComponent,\n TabsFieldErrorClientComponent,\n TabsFieldErrorServerComponent,\n TabsFieldLabelClientComponent,\n TabsFieldLabelServerComponent,\n TabsFieldServerComponent,\n TabsFieldServerProps,\n} from './fields/Tabs.js'\n\nexport type {\n TextFieldClientComponent,\n TextFieldClientProps,\n TextFieldDescriptionClientComponent,\n TextFieldDescriptionServerComponent,\n TextFieldErrorClientComponent,\n TextFieldErrorServerComponent,\n TextFieldLabelClientComponent,\n TextFieldLabelServerComponent,\n TextFieldServerComponent,\n TextFieldServerProps,\n} from './fields/Text.js'\n\nexport type {\n TextareaFieldClientComponent,\n TextareaFieldClientProps,\n TextareaFieldDescriptionClientComponent,\n TextareaFieldDescriptionServerComponent,\n TextareaFieldErrorClientComponent,\n TextareaFieldErrorServerComponent,\n TextareaFieldLabelClientComponent,\n TextareaFieldLabelServerComponent,\n TextareaFieldServerComponent,\n TextareaFieldServerProps,\n} from './fields/Textarea.js'\n\nexport type {\n UploadFieldClientComponent,\n UploadFieldClientProps,\n UploadFieldDescriptionClientComponent,\n UploadFieldDescriptionServerComponent,\n UploadFieldErrorClientComponent,\n UploadFieldErrorServerComponent,\n UploadFieldLabelClientComponent,\n UploadFieldLabelServerComponent,\n UploadFieldServerComponent,\n UploadFieldServerProps,\n} from './fields/Upload.js'\n\nexport type {\n Description,\n DescriptionFunction,\n FieldDescriptionClientComponent,\n FieldDescriptionClientProps,\n FieldDescriptionServerComponent,\n FieldDescriptionServerProps,\n GenericDescriptionProps,\n StaticDescription,\n} from './forms/Description.js'\n\nexport type {\n FieldErrorClientComponent,\n FieldErrorClientProps,\n FieldErrorServerComponent,\n FieldErrorServerProps,\n GenericErrorProps,\n} from './forms/Error.js'\n\nexport type { FormFieldBase, ServerFieldBase } from './forms/Field.js'\n\nexport type { Data, FilterOptionsResult, FormField, FormState, Row } from './forms/Form.js'\n\nexport type {\n FieldLabelClientComponent,\n FieldLabelClientProps,\n FieldLabelServerComponent,\n FieldLabelServerProps,\n GenericLabelProps,\n SanitizedLabelProps,\n} from './forms/Label.js'\n\nexport type { RowLabel, RowLabelComponent } from './forms/RowLabel.js'\n\nexport type { LanguageOptions } from './LanguageOptions.js'\n\nexport type {\n RichTextAdapter,\n RichTextAdapterProvider,\n RichTextGenerateComponentMap,\n RichTextHooks,\n} from './RichText.js'\n\nexport type {\n AdminViewComponent,\n AdminViewConfig,\n AdminViewProps,\n EditViewProps,\n InitPageResult,\n ServerSideEditViewProps,\n VisibleEntities,\n} from './views/types.js'\n\nexport type MappedServerComponent<TComponentClientProps extends JsonObject = JsonObject> = {\n Component: React.ComponentType<TComponentClientProps>\n props?: Partial<any>\n RenderedComponent: React.ReactNode\n type: 'server'\n}\n\nexport type MappedClientComponent<TComponentClientProps extends JsonObject = JsonObject> = {\n Component: React.ComponentType<TComponentClientProps>\n props?: Partial<TComponentClientProps>\n RenderedComponent?: React.ReactNode\n type: 'client'\n}\n\nexport type MappedEmptyComponent = {\n type: 'empty'\n}\n\nexport type MappedComponent<TComponentClientProps extends JsonObject = JsonObject> =\n | MappedClientComponent<TComponentClientProps>\n | MappedEmptyComponent\n | MappedServerComponent<TComponentClientProps>\n | undefined\n\nexport type CreateMappedComponent = {\n <T extends JsonObject>(\n component: { Component: React.FC<T> } | null | PayloadComponent<T>,\n props: {\n clientProps?: JsonObject\n serverProps?: object\n },\n fallback: React.FC,\n identifier: string,\n ): MappedComponent<T>\n\n <T extends JsonObject>(\n components: ({ Component: React.FC<T> } | PayloadComponent<T>)[],\n props: {\n clientProps?: JsonObject\n serverProps?: object\n },\n fallback: React.FC,\n identifier: string,\n ): MappedComponent<T>[]\n}\n"],"names":[],"mappings":"AA6WA,WAoBC"}
1
+ {"version":3,"sources":["../../src/admin/types.ts"],"sourcesContent":["import type React from 'react'\n\nimport type { PayloadComponent } from '../config/types.js'\nimport type { JsonObject } from '../types/index.js'\n\nexport type { CellComponentProps, DefaultCellComponentProps } from './elements/Cell.js'\nexport type { ConditionalDateProps } from './elements/DatePicker.js'\nexport type { DayPickerProps, SharedProps, TimePickerProps } from './elements/DatePicker.js'\nexport type { CustomPreviewButton } from './elements/PreviewButton.js'\nexport type { CustomPublishButton } from './elements/PublishButton.js'\nexport type { CustomSaveButton } from './elements/SaveButton.js'\nexport type { CustomSaveDraftButton } from './elements/SaveDraftButton.js'\nexport type {\n DocumentTabComponent,\n DocumentTabCondition,\n DocumentTabConfig,\n DocumentTabProps,\n} from './elements/Tab.js'\nexport type { CustomUpload } from './elements/Upload.js'\n\nexport type {\n WithServerSidePropsComponent,\n WithServerSidePropsComponentProps,\n} from './elements/WithServerSideProps.js'\n\nexport type {\n ArrayFieldClientComponent,\n ArrayFieldClientProps,\n ArrayFieldDescriptionClientComponent,\n ArrayFieldDescriptionServerComponent,\n ArrayFieldErrorClientComponent,\n ArrayFieldErrorServerComponent,\n ArrayFieldLabelClientComponent,\n ArrayFieldLabelServerComponent,\n ArrayFieldServerComponent,\n ArrayFieldServerProps,\n} from './fields/Array.js'\n\nexport type {\n BlocksFieldClientComponent,\n BlocksFieldClientProps,\n BlocksFieldDescriptionClientComponent,\n BlocksFieldDescriptionServerComponent,\n BlocksFieldErrorClientComponent,\n BlocksFieldErrorServerComponent,\n BlocksFieldLabelClientComponent,\n BlocksFieldLabelServerComponent,\n BlocksFieldServerComponent,\n BlocksFieldServerProps,\n} from './fields/Blocks.js'\n\nexport type {\n CheckboxFieldClientComponent,\n CheckboxFieldClientProps,\n CheckboxFieldDescriptionClientComponent,\n CheckboxFieldDescriptionServerComponent,\n CheckboxFieldErrorClientComponent,\n CheckboxFieldErrorServerComponent,\n CheckboxFieldLabelClientComponent,\n CheckboxFieldLabelServerComponent,\n CheckboxFieldServerComponent,\n CheckboxFieldServerProps,\n} from './fields/Checkbox.js'\n\nexport type {\n CodeFieldClientComponent,\n CodeFieldClientProps,\n CodeFieldDescriptionClientComponent,\n CodeFieldDescriptionServerComponent,\n CodeFieldErrorClientComponent,\n CodeFieldErrorServerComponent,\n CodeFieldLabelClientComponent,\n CodeFieldLabelServerComponent,\n CodeFieldServerComponent,\n CodeFieldServerProps,\n} from './fields/Code.js'\n\nexport type {\n CollapsibleFieldClientComponent,\n CollapsibleFieldClientProps,\n CollapsibleFieldDescriptionClientComponent,\n CollapsibleFieldDescriptionServerComponent,\n CollapsibleFieldErrorClientComponent,\n CollapsibleFieldErrorServerComponent,\n CollapsibleFieldLabelClientComponent,\n CollapsibleFieldLabelServerComponent,\n CollapsibleFieldServerComponent,\n CollapsibleFieldServerProps,\n} from './fields/Collapsible.js'\n\nexport type {\n DateFieldClientComponent,\n DateFieldClientProps,\n DateFieldDescriptionClientComponent,\n DateFieldDescriptionServerComponent,\n DateFieldErrorClientComponent,\n DateFieldErrorServerComponent,\n DateFieldLabelClientComponent,\n DateFieldLabelServerComponent,\n DateFieldServerComponent,\n DateFieldServerProps,\n} from './fields/Date.js'\n\nexport type {\n EmailFieldClientComponent,\n EmailFieldClientProps,\n EmailFieldDescriptionClientComponent,\n EmailFieldDescriptionServerComponent,\n EmailFieldErrorClientComponent,\n EmailFieldErrorServerComponent,\n EmailFieldLabelClientComponent,\n EmailFieldLabelServerComponent,\n EmailFieldServerComponent,\n EmailFieldServerProps,\n} from './fields/Email.js'\n\nexport type {\n GroupFieldClientComponent,\n GroupFieldClientProps,\n GroupFieldDescriptionClientComponent,\n GroupFieldDescriptionServerComponent,\n GroupFieldErrorClientComponent,\n GroupFieldErrorServerComponent,\n GroupFieldLabelClientComponent,\n GroupFieldLabelServerComponent,\n GroupFieldServerComponent,\n GroupFieldServerProps,\n} from './fields/Group.js'\n\nexport type { HiddenFieldProps } from './fields/Hidden.js'\n\nexport type {\n JoinFieldClientComponent,\n JoinFieldClientProps,\n JoinFieldDescriptionClientComponent,\n JoinFieldDescriptionServerComponent,\n JoinFieldErrorClientComponent,\n JoinFieldErrorServerComponent,\n JoinFieldLabelClientComponent,\n JoinFieldLabelServerComponent,\n JoinFieldServerComponent,\n JoinFieldServerProps,\n} from './fields/Join.js'\n\nexport type {\n JSONFieldClientComponent,\n JSONFieldClientProps,\n JSONFieldDescriptionClientComponent,\n JSONFieldDescriptionServerComponent,\n JSONFieldErrorClientComponent,\n JSONFieldErrorServerComponent,\n JSONFieldLabelClientComponent,\n JSONFieldLabelServerComponent,\n JSONFieldServerComponent,\n JSONFieldServerProps,\n} from './fields/JSON.js'\n\nexport type {\n NumberFieldClientComponent,\n NumberFieldClientProps,\n NumberFieldDescriptionClientComponent,\n NumberFieldDescriptionServerComponent,\n NumberFieldErrorClientComponent,\n NumberFieldErrorServerComponent,\n NumberFieldLabelClientComponent,\n NumberFieldLabelServerComponent,\n NumberFieldServerComponent,\n NumberFieldServerProps,\n} from './fields/Number.js'\n\nexport type {\n PointFieldClientComponent,\n PointFieldClientProps,\n PointFieldDescriptionClientComponent,\n PointFieldDescriptionServerComponent,\n PointFieldErrorClientComponent,\n PointFieldErrorServerComponent,\n PointFieldLabelClientComponent,\n PointFieldLabelServerComponent,\n PointFieldServerComponent,\n PointFieldServerProps,\n} from './fields/Point.js'\n\nexport type {\n RadioFieldClientComponent,\n RadioFieldClientProps,\n RadioFieldDescriptionClientComponent,\n RadioFieldDescriptionServerComponent,\n RadioFieldErrorClientComponent,\n RadioFieldErrorServerComponent,\n RadioFieldLabelClientComponent,\n RadioFieldLabelServerComponent,\n RadioFieldServerComponent,\n RadioFieldServerProps,\n} from './fields/Radio.js'\n\nexport type {\n RelationshipFieldClientComponent,\n RelationshipFieldClientProps,\n RelationshipFieldDescriptionClientComponent,\n RelationshipFieldDescriptionServerComponent,\n RelationshipFieldErrorClientComponent,\n RelationshipFieldErrorServerComponent,\n RelationshipFieldLabelClientComponent,\n RelationshipFieldLabelServerComponent,\n RelationshipFieldServerComponent,\n RelationshipFieldServerProps,\n} from './fields/Relationship.js'\n\nexport type {\n RichTextFieldClientComponent,\n RichTextFieldClientProps,\n RichTextFieldDescriptionClientComponent,\n RichTextFieldDescriptionServerComponent,\n RichTextFieldErrorClientComponent,\n RichTextFieldErrorServerComponent,\n RichTextFieldLabelClientComponent,\n RichTextFieldLabelServerComponent,\n RichTextFieldServerComponent,\n RichTextFieldServerProps,\n} from './fields/RichText.js'\n\nexport type {\n RowFieldClientComponent,\n RowFieldClientProps,\n RowFieldDescriptionClientComponent,\n RowFieldDescriptionServerComponent,\n RowFieldErrorClientComponent,\n RowFieldErrorServerComponent,\n RowFieldLabelClientComponent,\n RowFieldLabelServerComponent,\n RowFieldServerComponent,\n RowFieldServerProps,\n} from './fields/Row.js'\n\nexport type {\n SelectFieldClientComponent,\n SelectFieldClientProps,\n SelectFieldDescriptionClientComponent,\n SelectFieldDescriptionServerComponent,\n SelectFieldErrorClientComponent,\n SelectFieldErrorServerComponent,\n SelectFieldLabelClientComponent,\n SelectFieldLabelServerComponent,\n SelectFieldServerComponent,\n SelectFieldServerProps,\n} from './fields/Select.js'\n\nexport type {\n ClientTab,\n TabsFieldClientComponent,\n TabsFieldClientProps,\n TabsFieldDescriptionClientComponent,\n TabsFieldDescriptionServerComponent,\n TabsFieldErrorClientComponent,\n TabsFieldErrorServerComponent,\n TabsFieldLabelClientComponent,\n TabsFieldLabelServerComponent,\n TabsFieldServerComponent,\n TabsFieldServerProps,\n} from './fields/Tabs.js'\n\nexport type {\n TextFieldClientComponent,\n TextFieldClientProps,\n TextFieldDescriptionClientComponent,\n TextFieldDescriptionServerComponent,\n TextFieldErrorClientComponent,\n TextFieldErrorServerComponent,\n TextFieldLabelClientComponent,\n TextFieldLabelServerComponent,\n TextFieldServerComponent,\n TextFieldServerProps,\n} from './fields/Text.js'\n\nexport type {\n TextareaFieldClientComponent,\n TextareaFieldClientProps,\n TextareaFieldDescriptionClientComponent,\n TextareaFieldDescriptionServerComponent,\n TextareaFieldErrorClientComponent,\n TextareaFieldErrorServerComponent,\n TextareaFieldLabelClientComponent,\n TextareaFieldLabelServerComponent,\n TextareaFieldServerComponent,\n TextareaFieldServerProps,\n} from './fields/Textarea.js'\n\nexport type {\n UploadFieldClientComponent,\n UploadFieldClientProps,\n UploadFieldDescriptionClientComponent,\n UploadFieldDescriptionServerComponent,\n UploadFieldErrorClientComponent,\n UploadFieldErrorServerComponent,\n UploadFieldLabelClientComponent,\n UploadFieldLabelServerComponent,\n UploadFieldServerComponent,\n UploadFieldServerProps,\n} from './fields/Upload.js'\n\nexport type {\n Description,\n DescriptionFunction,\n FieldDescriptionClientComponent,\n FieldDescriptionClientProps,\n FieldDescriptionServerComponent,\n FieldDescriptionServerProps,\n GenericDescriptionProps,\n StaticDescription,\n} from './forms/Description.js'\n\nexport type {\n FieldErrorClientComponent,\n FieldErrorClientProps,\n FieldErrorServerComponent,\n FieldErrorServerProps,\n GenericErrorProps,\n} from './forms/Error.js'\n\nexport type { FormFieldBase, ServerFieldBase } from './forms/Field.js'\n\nexport type { Data, FilterOptionsResult, FormField, FormState, Row } from './forms/Form.js'\n\nexport type {\n FieldLabelClientComponent,\n FieldLabelClientProps,\n FieldLabelServerComponent,\n FieldLabelServerProps,\n GenericLabelProps,\n SanitizedLabelProps,\n} from './forms/Label.js'\n\nexport type { RowLabel, RowLabelComponent } from './forms/RowLabel.js'\n\nexport type { LanguageOptions } from './LanguageOptions.js'\n\nexport type {\n RichTextAdapter,\n RichTextAdapterProvider,\n RichTextGenerateComponentMap,\n RichTextHooks,\n} from './RichText.js'\n\nexport type {\n AdminViewComponent,\n AdminViewConfig,\n AdminViewProps,\n EditViewProps,\n InitPageResult,\n ServerSideEditViewProps,\n VisibleEntities,\n} from './views/types.js'\n\nexport type MappedServerComponent<TComponentClientProps extends JsonObject = JsonObject> = {\n Component: React.ComponentType<TComponentClientProps>\n props?: Partial<any>\n RenderedComponent: React.ReactNode\n type: 'server'\n}\n\nexport type MappedClientComponent<TComponentClientProps extends JsonObject = JsonObject> = {\n Component: React.ComponentType<TComponentClientProps>\n props?: Partial<TComponentClientProps>\n RenderedComponent?: React.ReactNode\n type: 'client'\n}\n\nexport type MappedEmptyComponent = {\n type: 'empty'\n}\n\nexport type MappedComponent<TComponentClientProps extends JsonObject = JsonObject> =\n | MappedClientComponent<TComponentClientProps>\n | MappedEmptyComponent\n | MappedServerComponent<TComponentClientProps>\n | undefined\n\nexport type CreateMappedComponent = {\n <T extends JsonObject>(\n component: { Component: React.FC<T> } | null | PayloadComponent<T>,\n props: {\n clientProps?: JsonObject\n serverProps?: object\n },\n fallback: React.FC,\n identifier: string,\n ): MappedComponent<T>\n\n <T extends JsonObject>(\n components: ({ Component: React.FC<T> } | PayloadComponent<T>)[],\n props: {\n clientProps?: JsonObject\n serverProps?: object\n },\n fallback: React.FC,\n identifier: string,\n ): MappedComponent<T>[]\n}\n"],"names":[],"mappings":"AA0XA,WAoBC"}
@@ -1 +1 @@
1
- {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/auth/operations/login.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gCAAgC,EAChC,UAAU,EACV,sBAAsB,EACvB,MAAM,mCAAmC,CAAA;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAS,MAAM,sBAAsB,CAAA;AACjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAavC,MAAM,MAAM,MAAM,GAAG;IACnB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,IAAI,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,SAAS,CAAC,KAAK,SAAS,cAAc,IAAI;IACpD,UAAU,EAAE,UAAU,CAAA;IACtB,IAAI,EAAE,gCAAgC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAA;IACtD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,GAAG,EAAE,cAAc,CAAA;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,cAAc,GAAU,KAAK,SAAS,cAAc,gBACjD,SAAS,CAAC,KAAK,CAAC,KAC7B,OAAO,CAAC;IAAE,IAAI,EAAE,sBAAsB,CAAC,KAAK,CAAC,CAAA;CAAE,GAAG,MAAM,CAsS1D,CAAA"}
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/auth/operations/login.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gCAAgC,EAChC,UAAU,EACV,sBAAsB,EACvB,MAAM,mCAAmC,CAAA;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAS,MAAM,sBAAsB,CAAA;AACjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAavC,MAAM,MAAM,MAAM,GAAG;IACnB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,IAAI,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,SAAS,CAAC,KAAK,SAAS,cAAc,IAAI;IACpD,UAAU,EAAE,UAAU,CAAA;IACtB,IAAI,EAAE,gCAAgC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAA;IACtD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,GAAG,EAAE,cAAc,CAAA;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,cAAc,GAAU,KAAK,SAAS,cAAc,gBACjD,SAAS,CAAC,KAAK,CAAC,KAC7B,OAAO,CAAC;IAAE,IAAI,EAAE,sBAAsB,CAAC,KAAK,CAAC,CAAA;CAAE,GAAG,MAAM,CAwS1D,CAAA"}
@@ -136,7 +136,8 @@ export const loginOperation = async (incomingArgs)=>{
136
136
  if (!user || args.collection.config.auth.verify && user._verified === false) {
137
137
  throw new AuthenticationError(req.t, Boolean(canLoginWithUsername && sanitizedUsername));
138
138
  }
139
- if (user && isLocked(new Date(user.lockUntil).getTime())) {
139
+ user.collection = collectionConfig.slug;
140
+ if (isLocked(new Date(user.lockUntil).getTime())) {
140
141
  throw new LockedAuth(req.t);
141
142
  }
142
143
  const authResult = await authenticateLocalStrategy({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/auth/operations/login.ts"],"sourcesContent":["import jwt from 'jsonwebtoken'\n\nimport type {\n AuthOperationsFromCollectionSlug,\n Collection,\n DataFromCollectionSlug,\n} from '../../collections/config/types.js'\nimport type { CollectionSlug } from '../../index.js'\nimport type { PayloadRequest, Where } from '../../types/index.js'\nimport type { User } from '../types.js'\n\nimport { buildAfterOperation } from '../../collections/operations/utils.js'\nimport { AuthenticationError, LockedAuth, ValidationError } from '../../errors/index.js'\nimport { afterRead } from '../../fields/hooks/afterRead/index.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport sanitizeInternalFields from '../../utilities/sanitizeInternalFields.js'\nimport { getFieldsToSign } from '../getFieldsToSign.js'\nimport isLocked from '../isLocked.js'\nimport { authenticateLocalStrategy } from '../strategies/local/authenticate.js'\nimport { incrementLoginAttempts } from '../strategies/local/incrementLoginAttempts.js'\nimport { resetLoginAttempts } from '../strategies/local/resetLoginAttempts.js'\n\nexport type Result = {\n exp?: number\n token?: string\n user?: User\n}\n\nexport type Arguments<TSlug extends CollectionSlug> = {\n collection: Collection\n data: AuthOperationsFromCollectionSlug<TSlug>['login']\n depth?: number\n overrideAccess?: boolean\n req: PayloadRequest\n showHiddenFields?: boolean\n}\n\nexport const loginOperation = async <TSlug extends CollectionSlug>(\n incomingArgs: Arguments<TSlug>,\n): Promise<{ user: DataFromCollectionSlug<TSlug> } & Result> => {\n let args = incomingArgs\n\n try {\n // /////////////////////////////////////\n // beforeOperation - Collection\n // /////////////////////////////////////\n\n await args.collection.config.hooks.beforeOperation.reduce(async (priorHook, hook) => {\n await priorHook\n\n args =\n (await hook({\n args,\n collection: args.collection?.config,\n context: args.req.context,\n operation: 'login',\n req: args.req,\n })) || args\n }, Promise.resolve())\n\n const {\n collection: { config: collectionConfig },\n data,\n depth,\n overrideAccess,\n req,\n req: {\n fallbackLocale,\n locale,\n payload,\n payload: { secret },\n },\n showHiddenFields,\n } = args\n\n // /////////////////////////////////////\n // Login\n // /////////////////////////////////////\n\n let user\n const { email: unsanitizedEmail, password } = data\n const loginWithUsername = collectionConfig.auth.loginWithUsername\n\n const sanitizedEmail =\n typeof unsanitizedEmail === 'string' ? unsanitizedEmail.toLowerCase().trim() : null\n const sanitizedUsername =\n 'username' in data && typeof data?.username === 'string'\n ? data.username.toLowerCase().trim()\n : null\n\n const canLoginWithUsername = Boolean(loginWithUsername)\n const canLoginWithEmail = !loginWithUsername || loginWithUsername.allowEmailLogin\n\n // cannot login with email, did not provide username\n if (!canLoginWithEmail && !sanitizedUsername) {\n throw new ValidationError({\n collection: collectionConfig.slug,\n errors: [{ field: 'username', message: req.i18n.t('validation:required') }],\n })\n }\n\n // cannot login with username, did not provide email\n if (!canLoginWithUsername && !sanitizedEmail) {\n throw new ValidationError({\n collection: collectionConfig.slug,\n errors: [{ field: 'email', message: req.i18n.t('validation:required') }],\n })\n }\n\n // can login with either email or username, did not provide either\n if (!sanitizedUsername && !sanitizedEmail) {\n throw new ValidationError({\n collection: collectionConfig.slug,\n errors: [\n { field: 'email', message: req.i18n.t('validation:required') },\n { field: 'username', message: req.i18n.t('validation:required') },\n ],\n })\n }\n\n // did not provide password for login\n if (typeof password !== 'string' || password.trim() === '') {\n throw new ValidationError({\n collection: collectionConfig.slug,\n errors: [{ field: 'password', message: req.i18n.t('validation:required') }],\n })\n }\n\n let whereConstraint: Where = {}\n const emailConstraint: Where = {\n email: {\n equals: sanitizedEmail,\n },\n }\n const usernameConstraint: Where = {\n username: {\n equals: sanitizedUsername,\n },\n }\n\n if (canLoginWithEmail && canLoginWithUsername && (sanitizedUsername || sanitizedEmail)) {\n if (sanitizedUsername) {\n whereConstraint = {\n or: [\n usernameConstraint,\n {\n email: {\n equals: sanitizedUsername,\n },\n },\n ],\n }\n } else {\n whereConstraint = {\n or: [\n emailConstraint,\n {\n username: {\n equals: sanitizedEmail,\n },\n },\n ],\n }\n }\n } else if (canLoginWithEmail && sanitizedEmail) {\n whereConstraint = emailConstraint\n } else if (canLoginWithUsername && sanitizedUsername) {\n whereConstraint = usernameConstraint\n }\n\n user = await payload.db.findOne<any>({\n collection: collectionConfig.slug,\n req,\n where: whereConstraint,\n })\n\n if (!user || (args.collection.config.auth.verify && user._verified === false)) {\n throw new AuthenticationError(req.t, Boolean(canLoginWithUsername && sanitizedUsername))\n }\n\n if (user && isLocked(new Date(user.lockUntil).getTime())) {\n throw new LockedAuth(req.t)\n }\n\n const authResult = await authenticateLocalStrategy({ doc: user, password })\n\n user = sanitizeInternalFields(user)\n\n const maxLoginAttemptsEnabled = args.collection.config.auth.maxLoginAttempts > 0\n\n if (!authResult) {\n if (maxLoginAttemptsEnabled) {\n await incrementLoginAttempts({\n collection: collectionConfig,\n doc: user,\n payload: req.payload,\n req,\n })\n }\n\n throw new AuthenticationError(req.t)\n }\n\n if (maxLoginAttemptsEnabled) {\n await resetLoginAttempts({\n collection: collectionConfig,\n doc: user,\n payload: req.payload,\n req,\n })\n }\n\n const fieldsToSign = getFieldsToSign({\n collectionConfig,\n email: sanitizedEmail,\n user,\n })\n\n // /////////////////////////////////////\n // beforeLogin - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.beforeLogin.reduce(async (priorHook, hook) => {\n await priorHook\n\n user =\n (await hook({\n collection: args.collection?.config,\n context: args.req.context,\n req: args.req,\n user,\n })) || user\n }, Promise.resolve())\n\n const token = jwt.sign(fieldsToSign, secret, {\n expiresIn: collectionConfig.auth.tokenExpiration,\n })\n\n req.user = user\n\n // /////////////////////////////////////\n // afterLogin - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.afterLogin.reduce(async (priorHook, hook) => {\n await priorHook\n\n user =\n (await hook({\n collection: args.collection?.config,\n context: args.req.context,\n req: args.req,\n token,\n user,\n })) || user\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // afterRead - Fields\n // /////////////////////////////////////\n\n user = await afterRead({\n collection: collectionConfig,\n context: req.context,\n depth,\n doc: user,\n draft: undefined,\n fallbackLocale,\n global: null,\n locale,\n overrideAccess,\n req,\n showHiddenFields,\n })\n\n // /////////////////////////////////////\n // afterRead - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.afterRead.reduce(async (priorHook, hook) => {\n await priorHook\n\n user =\n (await hook({\n collection: args.collection?.config,\n context: req.context,\n doc: user,\n req,\n })) || user\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // afterRead - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.afterRead.reduce(async (priorHook, hook) => {\n await priorHook\n\n user =\n (await hook({\n collection: args.collection?.config,\n context: req.context,\n doc: user,\n req,\n })) || user\n }, Promise.resolve())\n\n let result: { user: DataFromCollectionSlug<TSlug> } & Result = {\n exp: (jwt.decode(token) as jwt.JwtPayload).exp,\n token,\n user,\n }\n\n // /////////////////////////////////////\n // afterOperation - Collection\n // /////////////////////////////////////\n\n result = await buildAfterOperation({\n args,\n collection: args.collection?.config,\n operation: 'login',\n result,\n })\n\n // /////////////////////////////////////\n // Return results\n // /////////////////////////////////////\n\n return result\n } catch (error: unknown) {\n await killTransaction(args.req)\n throw error\n }\n}\n"],"names":["jwt","buildAfterOperation","AuthenticationError","LockedAuth","ValidationError","afterRead","killTransaction","sanitizeInternalFields","getFieldsToSign","isLocked","authenticateLocalStrategy","incrementLoginAttempts","resetLoginAttempts","loginOperation","incomingArgs","args","collection","config","hooks","beforeOperation","reduce","priorHook","hook","context","req","operation","Promise","resolve","collectionConfig","data","depth","overrideAccess","fallbackLocale","locale","payload","secret","showHiddenFields","user","email","unsanitizedEmail","password","loginWithUsername","auth","sanitizedEmail","toLowerCase","trim","sanitizedUsername","username","canLoginWithUsername","Boolean","canLoginWithEmail","allowEmailLogin","slug","errors","field","message","i18n","t","whereConstraint","emailConstraint","equals","usernameConstraint","or","db","findOne","where","verify","_verified","Date","lockUntil","getTime","authResult","doc","maxLoginAttemptsEnabled","maxLoginAttempts","fieldsToSign","beforeLogin","token","sign","expiresIn","tokenExpiration","afterLogin","draft","undefined","global","result","exp","decode","error"],"mappings":"AAAA,OAAOA,SAAS,eAAc;AAW9B,SAASC,mBAAmB,QAAQ,wCAAuC;AAC3E,SAASC,mBAAmB,EAAEC,UAAU,EAAEC,eAAe,QAAQ,wBAAuB;AACxF,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,OAAOC,4BAA4B,4CAA2C;AAC9E,SAASC,eAAe,QAAQ,wBAAuB;AACvD,OAAOC,cAAc,iBAAgB;AACrC,SAASC,yBAAyB,QAAQ,sCAAqC;AAC/E,SAASC,sBAAsB,QAAQ,gDAA+C;AACtF,SAASC,kBAAkB,QAAQ,4CAA2C;AAiB9E,OAAO,MAAMC,iBAAiB,OAC5BC;IAEA,IAAIC,OAAOD;IAEX,IAAI;QACF,wCAAwC;QACxC,+BAA+B;QAC/B,wCAAwC;QAExC,MAAMC,KAAKC,UAAU,CAACC,MAAM,CAACC,KAAK,CAACC,eAAe,CAACC,MAAM,CAAC,OAAOC,WAAWC;YAC1E,MAAMD;YAENN,OACE,AAAC,MAAMO,KAAK;gBACVP;gBACAC,YAAYD,KAAKC,UAAU,EAAEC;gBAC7BM,SAASR,KAAKS,GAAG,CAACD,OAAO;gBACzBE,WAAW;gBACXD,KAAKT,KAAKS,GAAG;YACf,MAAOT;QACX,GAAGW,QAAQC,OAAO;QAElB,MAAM,EACJX,YAAY,EAAEC,QAAQW,gBAAgB,EAAE,EACxCC,IAAI,EACJC,KAAK,EACLC,cAAc,EACdP,GAAG,EACHA,KAAK,EACHQ,cAAc,EACdC,MAAM,EACNC,OAAO,EACPA,SAAS,EAAEC,MAAM,EAAE,EACpB,EACDC,gBAAgB,EACjB,GAAGrB;QAEJ,wCAAwC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AAKS,GAAG;QAC9B,MAAMgE;IACR;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/auth/operations/login.ts"],"sourcesContent":["import jwt from 'jsonwebtoken'\n\nimport type {\n AuthOperationsFromCollectionSlug,\n Collection,\n DataFromCollectionSlug,\n} from '../../collections/config/types.js'\nimport type { CollectionSlug } from '../../index.js'\nimport type { PayloadRequest, Where } from '../../types/index.js'\nimport type { User } from '../types.js'\n\nimport { buildAfterOperation } from '../../collections/operations/utils.js'\nimport { AuthenticationError, LockedAuth, ValidationError } from '../../errors/index.js'\nimport { afterRead } from '../../fields/hooks/afterRead/index.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport sanitizeInternalFields from '../../utilities/sanitizeInternalFields.js'\nimport { getFieldsToSign } from '../getFieldsToSign.js'\nimport isLocked from '../isLocked.js'\nimport { authenticateLocalStrategy } from '../strategies/local/authenticate.js'\nimport { incrementLoginAttempts } from '../strategies/local/incrementLoginAttempts.js'\nimport { resetLoginAttempts } from '../strategies/local/resetLoginAttempts.js'\n\nexport type Result = {\n exp?: number\n token?: string\n user?: User\n}\n\nexport type Arguments<TSlug extends CollectionSlug> = {\n collection: Collection\n data: AuthOperationsFromCollectionSlug<TSlug>['login']\n depth?: number\n overrideAccess?: boolean\n req: PayloadRequest\n showHiddenFields?: boolean\n}\n\nexport const loginOperation = async <TSlug extends CollectionSlug>(\n incomingArgs: Arguments<TSlug>,\n): Promise<{ user: DataFromCollectionSlug<TSlug> } & Result> => {\n let args = incomingArgs\n\n try {\n // /////////////////////////////////////\n // beforeOperation - Collection\n // /////////////////////////////////////\n\n await args.collection.config.hooks.beforeOperation.reduce(async (priorHook, hook) => {\n await priorHook\n\n args =\n (await hook({\n args,\n collection: args.collection?.config,\n context: args.req.context,\n operation: 'login',\n req: args.req,\n })) || args\n }, Promise.resolve())\n\n const {\n collection: { config: collectionConfig },\n data,\n depth,\n overrideAccess,\n req,\n req: {\n fallbackLocale,\n locale,\n payload,\n payload: { secret },\n },\n showHiddenFields,\n } = args\n\n // /////////////////////////////////////\n // Login\n // /////////////////////////////////////\n\n let user\n const { email: unsanitizedEmail, password } = data\n const loginWithUsername = collectionConfig.auth.loginWithUsername\n\n const sanitizedEmail =\n typeof unsanitizedEmail === 'string' ? unsanitizedEmail.toLowerCase().trim() : null\n const sanitizedUsername =\n 'username' in data && typeof data?.username === 'string'\n ? data.username.toLowerCase().trim()\n : null\n\n const canLoginWithUsername = Boolean(loginWithUsername)\n const canLoginWithEmail = !loginWithUsername || loginWithUsername.allowEmailLogin\n\n // cannot login with email, did not provide username\n if (!canLoginWithEmail && !sanitizedUsername) {\n throw new ValidationError({\n collection: collectionConfig.slug,\n errors: [{ field: 'username', message: req.i18n.t('validation:required') }],\n })\n }\n\n // cannot login with username, did not provide email\n if (!canLoginWithUsername && !sanitizedEmail) {\n throw new ValidationError({\n collection: collectionConfig.slug,\n errors: [{ field: 'email', message: req.i18n.t('validation:required') }],\n })\n }\n\n // can login with either email or username, did not provide either\n if (!sanitizedUsername && !sanitizedEmail) {\n throw new ValidationError({\n collection: collectionConfig.slug,\n errors: [\n { field: 'email', message: req.i18n.t('validation:required') },\n { field: 'username', message: req.i18n.t('validation:required') },\n ],\n })\n }\n\n // did not provide password for login\n if (typeof password !== 'string' || password.trim() === '') {\n throw new ValidationError({\n collection: collectionConfig.slug,\n errors: [{ field: 'password', message: req.i18n.t('validation:required') }],\n })\n }\n\n let whereConstraint: Where = {}\n const emailConstraint: Where = {\n email: {\n equals: sanitizedEmail,\n },\n }\n const usernameConstraint: Where = {\n username: {\n equals: sanitizedUsername,\n },\n }\n\n if (canLoginWithEmail && canLoginWithUsername && (sanitizedUsername || sanitizedEmail)) {\n if (sanitizedUsername) {\n whereConstraint = {\n or: [\n usernameConstraint,\n {\n email: {\n equals: sanitizedUsername,\n },\n },\n ],\n }\n } else {\n whereConstraint = {\n or: [\n emailConstraint,\n {\n username: {\n equals: sanitizedEmail,\n },\n },\n ],\n }\n }\n } else if (canLoginWithEmail && sanitizedEmail) {\n whereConstraint = emailConstraint\n } else if (canLoginWithUsername && sanitizedUsername) {\n whereConstraint = usernameConstraint\n }\n\n user = await payload.db.findOne<any>({\n collection: collectionConfig.slug,\n req,\n where: whereConstraint,\n })\n\n if (!user || (args.collection.config.auth.verify && user._verified === false)) {\n throw new AuthenticationError(req.t, Boolean(canLoginWithUsername && sanitizedUsername))\n }\n\n user.collection = collectionConfig.slug\n\n if (isLocked(new Date(user.lockUntil).getTime())) {\n throw new LockedAuth(req.t)\n }\n\n const authResult = await authenticateLocalStrategy({ doc: user, password })\n\n user = sanitizeInternalFields(user)\n\n const maxLoginAttemptsEnabled = args.collection.config.auth.maxLoginAttempts > 0\n\n if (!authResult) {\n if (maxLoginAttemptsEnabled) {\n await incrementLoginAttempts({\n collection: collectionConfig,\n doc: user,\n payload: req.payload,\n req,\n })\n }\n\n throw new AuthenticationError(req.t)\n }\n\n if (maxLoginAttemptsEnabled) {\n await resetLoginAttempts({\n collection: collectionConfig,\n doc: user,\n payload: req.payload,\n req,\n })\n }\n\n const fieldsToSign = getFieldsToSign({\n collectionConfig,\n email: sanitizedEmail,\n user,\n })\n\n // /////////////////////////////////////\n // beforeLogin - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.beforeLogin.reduce(async (priorHook, hook) => {\n await priorHook\n\n user =\n (await hook({\n collection: args.collection?.config,\n context: args.req.context,\n req: args.req,\n user,\n })) || user\n }, Promise.resolve())\n\n const token = jwt.sign(fieldsToSign, secret, {\n expiresIn: collectionConfig.auth.tokenExpiration,\n })\n\n req.user = user\n\n // /////////////////////////////////////\n // afterLogin - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.afterLogin.reduce(async (priorHook, hook) => {\n await priorHook\n\n user =\n (await hook({\n collection: args.collection?.config,\n context: args.req.context,\n req: args.req,\n token,\n user,\n })) || user\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // afterRead - Fields\n // /////////////////////////////////////\n\n user = await afterRead({\n collection: collectionConfig,\n context: req.context,\n depth,\n doc: user,\n draft: undefined,\n fallbackLocale,\n global: null,\n locale,\n overrideAccess,\n req,\n showHiddenFields,\n })\n\n // /////////////////////////////////////\n // afterRead - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.afterRead.reduce(async (priorHook, hook) => {\n await priorHook\n\n user =\n (await hook({\n collection: args.collection?.config,\n context: req.context,\n doc: user,\n req,\n })) || user\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // afterRead - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.afterRead.reduce(async (priorHook, hook) => {\n await priorHook\n\n user =\n (await hook({\n collection: args.collection?.config,\n context: req.context,\n doc: user,\n req,\n })) || user\n }, Promise.resolve())\n\n let result: { user: DataFromCollectionSlug<TSlug> } & Result = {\n exp: (jwt.decode(token) as jwt.JwtPayload).exp,\n token,\n user,\n }\n\n // /////////////////////////////////////\n // afterOperation - Collection\n // /////////////////////////////////////\n\n result = await buildAfterOperation({\n args,\n collection: args.collection?.config,\n operation: 'login',\n result,\n })\n\n // /////////////////////////////////////\n // Return results\n // /////////////////////////////////////\n\n return result\n } catch (error: unknown) {\n await killTransaction(args.req)\n throw error\n }\n}\n"],"names":["jwt","buildAfterOperation","AuthenticationError","LockedAuth","ValidationError","afterRead","killTransaction","sanitizeInternalFields","getFieldsToSign","isLocked","authenticateLocalStrategy","incrementLoginAttempts","resetLoginAttempts","loginOperation","incomingArgs","args","collection","config","hooks","beforeOperation","reduce","priorHook","hook","context","req","operation","Promise","resolve","collectionConfig","data","depth","overrideAccess","fallbackLocale","locale","payload","secret","showHiddenFields","user","email","unsanitizedEmail","password","loginWithUsername","auth","sanitizedEmail","toLowerCase","trim","sanitizedUsername","username","canLoginWithUsername","Boolean","canLoginWithEmail","allowEmailLogin","slug","errors","field","message","i18n","t","whereConstraint","emailConstraint","equals","usernameConstraint","or","db","findOne","where","verify","_verified","Date","lockUntil","getTime","authResult","doc","maxLoginAttemptsEnabled","maxLoginAttempts","fieldsToSign","beforeLogin","token","sign","expiresIn","tokenExpiration","afterLogin","draft","undefined","global","result","exp","decode","error"],"mappings":"AAAA,OAAOA,SAAS,eAAc;AAW9B,SAASC,mBAAmB,QAAQ,wCAAuC;AAC3E,SAASC,mBAAmB,EAAEC,UAAU,EAAEC,eAAe,QAAQ,wBAAuB;AACxF,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,OAAOC,4BAA4B,4CAA2C;AAC9E,SAASC,eAAe,QAAQ,wBAAuB;AACvD,OAAOC,cAAc,iBAAgB;AACrC,SAASC,yBAAyB,QAAQ,sCAAqC;AAC/E,SAASC,sBAAsB,QAAQ,gDAA+C;AACtF,SAASC,kBAAkB,QAAQ,4CAA2C;AAiB9E,OAAO,MAAMC,iBAAiB,OAC5BC;IAEA,IAAIC,OAAOD;IAEX,IAAI;QACF,wCAAwC;QACxC,+BAA+B;QAC/B,wCAAwC;QAExC,MAAMC,KAAKC,UAAU,CAACC,MAAM,CAACC,KAAK,CAACC,eAAe,CAACC,MAAM,CAAC,OAAOC,WAAWC;YAC1E,MAAMD;YAENN,OACE,AAAC,MAAMO,KAAK;gBACVP;gBACAC,YAAYD,KAAKC,UAAU,EAAEC;gBAC7BM,SAASR,KAAKS,GAAG,CAACD,OAAO;gBACzBE,WAAW;gBACXD,KAAKT,KAAKS,GAAG;YACf,MAAOT;QACX,GAAGW,QAAQC,OAAO;QAElB,MAAM,EACJX,YAAY,EAAEC,QAAQW,gBAAgB,EAAE,EACxCC,IAAI,EACJC,KAAK,EACLC,cAAc,EACdP,GAAG,EACHA,KAAK,EACHQ,cAAc,EACdC,MAAM,EACNC,OAAO,EACPA,SAAS,EAAEC,MAAM,EAAE,EACpB,EACDC,gBAAgB,EACjB,GAAGrB;QAEJ,wCAAwC;QACxC,QAAQ;QACR,wCAAwC;QAExC,IAAIsB;QACJ,MAAM,EAAEC,OAAOC,gBAAgB,EAAEC,QAAQ,EAAE,GAAGX;QAC9C,MAAMY,o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ts","sourceRoot":"","sources":["../../../src/auth/operations/me.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAQ,MAAM,aAAa,CAAA;AAEnD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,UAAU,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,UAAU,EAAE,UAAU,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,WAAW,SAAgB,SAAS,KAAG,OAAO,CAAC,iBAAiB,CA8E5E,CAAA"}
1
+ {"version":3,"file":"me.d.ts","sourceRoot":"","sources":["../../../src/auth/operations/me.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAQ,MAAM,aAAa,CAAA;AAEnD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,UAAU,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,UAAU,EAAE,UAAU,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,WAAW,SAAgB,SAAS,KAAG,OAAO,CAAC,iBAAiB,CAgF5E,CAAA"}
@@ -15,12 +15,14 @@ export const meOperation = async (args)=>{
15
15
  req,
16
16
  showHiddenFields: false
17
17
  });
18
+ if (user) {
19
+ user.collection = collection.config.slug;
20
+ }
18
21
  if (req.user.collection !== collection.config.slug) {
19
22
  return {
20
23
  user: null
21
24
  };
22
25
  }
23
- delete user.collection;
24
26
  // /////////////////////////////////////
25
27
  // me hook - Collection
26
28
  // /////////////////////////////////////
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/auth/operations/me.ts"],"sourcesContent":["import jwt from 'jsonwebtoken'\n\nimport type { Collection } from '../../collections/config/types.js'\nimport type { PayloadRequest } from '../../types/index.js'\nimport type { ClientUser, User } from '../types.js'\n\nexport type MeOperationResult = {\n collection?: string\n exp?: number\n strategy?: string\n token?: string\n user?: ClientUser\n}\n\nexport type Arguments = {\n collection: Collection\n currentToken?: string\n req: PayloadRequest\n}\n\nexport const meOperation = async (args: Arguments): Promise<MeOperationResult> => {\n const { collection, currentToken, req } = args\n\n let result: MeOperationResult = {\n user: null,\n }\n\n if (req.user) {\n const { pathname } = req\n const isGraphQL = pathname === `/api${req.payload.config.routes.graphQL}`\n\n const user = (await req.payload.findByID({\n id: req.user.id,\n collection: collection.config.slug,\n depth: isGraphQL ? 0 : collection.config.auth.depth,\n overrideAccess: false,\n req,\n showHiddenFields: false,\n })) as User\n\n if (req.user.collection !== collection.config.slug) {\n return {\n user: null,\n }\n }\n\n delete user.collection\n\n // /////////////////////////////////////\n // me hook - Collection\n // /////////////////////////////////////\n\n for (const meHook of collection.config.hooks.me) {\n const hookResult = await meHook({ args, user })\n\n if (hookResult) {\n result.user = hookResult.user\n result.exp = hookResult.exp\n\n break\n }\n }\n\n result.collection = req.user.collection\n result.strategy = req.user._strategy\n\n if (!result.user) {\n result.user = user\n\n if (currentToken) {\n const decoded = jwt.decode(currentToken) as jwt.JwtPayload\n if (decoded) {\n result.exp = decoded.exp\n }\n if (!collection.config.auth.removeTokenFromResponses) {\n result.token = currentToken\n }\n }\n }\n }\n\n // /////////////////////////////////////\n // After Me - Collection\n // /////////////////////////////////////\n\n await collection.config.hooks.afterMe.reduce(async (priorHook, hook) => {\n await priorHook\n\n result =\n (await hook({\n collection: collection?.config,\n context: req.context,\n req,\n response: result,\n })) || result\n }, Promise.resolve())\n\n return result\n}\n"],"names":["jwt","meOperation","args","collection","currentToken","req","result","user","pathname","isGraphQL","payload","config","routes","graphQL","findByID","id","slug","depth","auth","overrideAccess","showHiddenFields","meHook","hooks","me","hookResult","exp","strategy","_strategy","decoded","decode","removeTokenFromResponses","token","afterMe","reduce","priorHook","hook","context","response","Promise","resolve"],"mappings":"AAAA,OAAOA,SAAS,eAAc;AAoB9B,OAAO,MAAMC,cAAc,OAAOC;IAChC,MAAM,EAAEC,UAAU,EAAEC,YAAY,EAAEC,GAAG,EAAE,GAAGH;IAE1C,IAAII,SAA4B;QAC9BC,MAAM;IACR;IAEA,IAAIF,IAAIE,IAAI,EAAE;QACZ,MAAM,EAAEC,QAAQ,EAAE,GAAGH;QACrB,MAAMI,YAAYD,aAAa,CAAC,IAAI,EAAEH,IAAIK,OAAO,CAACC,MAAM,CAACC,MAAM,CAACC,OAAO,CAAC,CAAC;QAEzE,MAAMN,OAAQ,MAAMF,IAAIK,OAAO,CAACI,QAAQ,CAAC;YACvCC,IAAIV,IAAIE,IAAI,CAACQ,EAAE;YACfZ,YAAYA,WAAWQ,MAAM,CAACK,IAAI;YAClCC,OAAOR,YAAY,IAAIN,WAAWQ,MAAM,CAACO,IAAI,CAACD,KAAK;YACnDE,gBAAgB;YAChBd;YACAe,kBAAkB;QACpB;QAEA,IAAIf,IAAIE,IAAI,CAACJ,UAAU,KAAKA,WAAWQ,MAAM,CAACK,IAAI,EAAE;YAClD,OAAO;gBACLT,MAAM;YACR;QACF;QAEA,OAAOA,KAAKJ,UAAU;QAEtB,wCAAwC;QACxC,uBAAuB;QACvB,wCAAwC;QAExC,KAAK,MAAMkB,UAAUlB,WAAWQ,MAAM,CAACW,KAAK,CAACC,EAAE,CAAE;YAC/C,MAAMC,aAAa,MAAMH,OAAO;gBAAEnB;gBAAMK;YAAK;YAE7C,IAAIiB,YAAY;gBACdlB,OAAOC,IAAI,GAAGiB,WAAWjB,IAAI;gBAC7BD,OAAOmB,GAAG,GAAGD,WAAWC,GAAG;gBAE3B;YACF;QACF;QAEAnB,OAAOH,UAAU,GAAGE,IAAIE,IAAI,CAACJ,UAAU;QACvCG,OAAOoB,QAAQ,GAAGrB,IAAIE,IAAI,CAACoB,SAAS;QAEpC,IAAI,CAACrB,OAAOC,IAAI,EAAE;YAChBD,OAAOC,IAAI,GAAGA;YAEd,IAAIH,cAAc;gBAChB,MAAMwB,UAAU5B,IAAI6B,MAAM,CAACzB;gBAC3B,IAAIwB,SAAS;oBACXtB,OAAOmB,GAAG,GAAGG,QAAQH,GAAG;gBAC1B;gBACA,IAAI,CAACtB,WAAWQ,MAAM,CAACO,IAAI,CAACY,wBAAwB,EAAE;oBACpDxB,OAAOyB,KAAK,GAAG3B;gBACjB;YACF;QACF;IACF;IAEA,wCAAwC;IACxC,wBAAwB;IACxB,wCAAwC;IAExC,MAAMD,WAAWQ,MAAM,CAACW,KAAK,CAACU,OAAO,CAACC,MAAM,CAAC,OAAOC,WAAWC;QAC7D,MAAMD;QAEN5B,SACE,AAAC,MAAM6B,KAAK;YACVhC,YAAYA,YAAYQ;YACxByB,SAAS/B,IAAI+B,OAAO;YACpB/B;YACAgC,UAAU/B;QACZ,MAAOA;IACX,GAAGgC,QAAQC,OAAO;IAElB,OAAOjC;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../src/auth/operations/me.ts"],"sourcesContent":["import jwt from 'jsonwebtoken'\n\nimport type { Collection } from '../../collections/config/types.js'\nimport type { PayloadRequest } from '../../types/index.js'\nimport type { ClientUser, User } from '../types.js'\n\nexport type MeOperationResult = {\n collection?: string\n exp?: number\n strategy?: string\n token?: string\n user?: ClientUser\n}\n\nexport type Arguments = {\n collection: Collection\n currentToken?: string\n req: PayloadRequest\n}\n\nexport const meOperation = async (args: Arguments): Promise<MeOperationResult> => {\n const { collection, currentToken, req } = args\n\n let result: MeOperationResult = {\n user: null,\n }\n\n if (req.user) {\n const { pathname } = req\n const isGraphQL = pathname === `/api${req.payload.config.routes.graphQL}`\n\n const user = (await req.payload.findByID({\n id: req.user.id,\n collection: collection.config.slug,\n depth: isGraphQL ? 0 : collection.config.auth.depth,\n overrideAccess: false,\n req,\n showHiddenFields: false,\n })) as User\n\n if (user) {\n user.collection = collection.config.slug\n }\n\n if (req.user.collection !== collection.config.slug) {\n return {\n user: null,\n }\n }\n\n // /////////////////////////////////////\n // me hook - Collection\n // /////////////////////////////////////\n\n for (const meHook of collection.config.hooks.me) {\n const hookResult = await meHook({ args, user })\n\n if (hookResult) {\n result.user = hookResult.user\n result.exp = hookResult.exp\n\n break\n }\n }\n\n result.collection = req.user.collection\n result.strategy = req.user._strategy\n\n if (!result.user) {\n result.user = user\n\n if (currentToken) {\n const decoded = jwt.decode(currentToken) as jwt.JwtPayload\n if (decoded) {\n result.exp = decoded.exp\n }\n if (!collection.config.auth.removeTokenFromResponses) {\n result.token = currentToken\n }\n }\n }\n }\n\n // /////////////////////////////////////\n // After Me - Collection\n // /////////////////////////////////////\n\n await collection.config.hooks.afterMe.reduce(async (priorHook, hook) => {\n await priorHook\n\n result =\n (await hook({\n collection: collection?.config,\n context: req.context,\n req,\n response: result,\n })) || result\n }, Promise.resolve())\n\n return result\n}\n"],"names":["jwt","meOperation","args","collection","currentToken","req","result","user","pathname","isGraphQL","payload","config","routes","graphQL","findByID","id","slug","depth","auth","overrideAccess","showHiddenFields","meHook","hooks","me","hookResult","exp","strategy","_strategy","decoded","decode","removeTokenFromResponses","token","afterMe","reduce","priorHook","hook","context","response","Promise","resolve"],"mappings":"AAAA,OAAOA,SAAS,eAA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AAOC,IAAI,GAAGA;YAEd,IAAIH,cAAc;gBAChB,MAAMwB,UAAU5B,IAAI6B,MAAM,CAACzB;gBAC3B,IAAIwB,SAAS;oBACXtB,OAAOmB,GAAG,GAAGG,QAAQH,GAAG;gBAC1B;gBACA,IAAI,CAACtB,WAAWQ,MAAM,CAACO,IAAI,CAACY,wBAAwB,EAAE;oBACpDxB,OAAOyB,KAAK,GAAG3B;gBACjB;YACF;QACF;IACF;IAEA,wCAAwC;IACxC,wBAAwB;IACxB,wCAAwC;IAExC,MAAMD,WAAWQ,MAAM,CAACW,KAAK,CAACU,OAAO,CAACC,MAAM,CAAC,OAAOC,WAAWC;QAC7D,MAAMD;QAEN5B,SACE,AAAC,MAAM6B,KAAK;YACVhC,YAAYA,YAAYQ;YACxByB,SAAS/B,IAAI+B,OAAO;YACpB/B;YACAgC,UAAU/B;QACZ,MAAOA;IACX,GAAGgC,QAAQC,OAAO;IAElB,OAAOjC;AACT,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../../../src/auth/operations/refresh.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAuB,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACxF,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AASpE,MAAM,MAAM,MAAM,GAAG;IACnB,GAAG,EAAE,MAAM,CAAA;IACX,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,QAAQ,CAAA;CACf,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,UAAU,EAAE,UAAU,CAAA;IACtB,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,gBAAgB,iBAAwB,SAAS,KAAG,OAAO,CAAC,MAAM,CAkI9E,CAAA"}
1
+ {"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../../../src/auth/operations/refresh.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAuB,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACxF,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AASpE,MAAM,MAAM,MAAM,GAAG;IACnB,GAAG,EAAE,MAAM,CAAA;IACX,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,QAAQ,CAAA;CACf,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,UAAU,EAAE,UAAU,CAAA;IACtB,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,gBAAgB,iBAAwB,SAAS,KAAG,OAAO,CAAC,MAAM,CAsI9E,CAAA"}
@@ -38,6 +38,9 @@ export const refreshOperation = async (incomingArgs)=>{
38
38
  depth: isGraphQL ? 0 : args.collection.config.auth.depth,
39
39
  req: args.req
40
40
  });
41
+ if (user) {
42
+ user.collection = args.req.user.collection;
43
+ }
41
44
  let result;
42
45
  // /////////////////////////////////////
43
46
  // refresh hook - Collection
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/auth/operations/refresh.ts"],"sourcesContent":["import jwt from 'jsonwebtoken'\nimport url from 'url'\n\nimport type { BeforeOperationHook, Collection } from '../../collections/config/types.js'\nimport type { Document, PayloadRequest } from '../../types/index.js'\n\nimport { buildAfterOperation } from '../../collections/operations/utils.js'\nimport { Forbidden } from '../../errors/index.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { getFieldsToSign } from '../getFieldsToSign.js'\n\nexport type Result = {\n exp: number\n refreshedToken: string\n setCookie?: boolean\n strategy?: string\n user: Document\n}\n\nexport type Arguments = {\n collection: Collection\n req: PayloadRequest\n}\n\nexport const refreshOperation = async (incomingArgs: Arguments): Promise<Result> => {\n let args = incomingArgs\n\n try {\n const shouldCommit = await initTransaction(args.req)\n\n // /////////////////////////////////////\n // beforeOperation - Collection\n // /////////////////////////////////////\n\n await args.collection.config.hooks.beforeOperation.reduce(\n async (priorHook: BeforeOperationHook | Promise<void>, hook: BeforeOperationHook) => {\n await priorHook\n\n args =\n (await hook({\n args,\n collection: args.collection?.config,\n context: args.req.context,\n operation: 'refresh',\n req: args.req,\n })) || args\n },\n Promise.resolve(),\n )\n\n // /////////////////////////////////////\n // Refresh\n // /////////////////////////////////////\n\n const {\n collection: { config: collectionConfig },\n req,\n req: {\n payload: { config, secret },\n },\n } = args\n\n if (!args.req.user) {\n throw new Forbidden(args.req.t)\n }\n\n const parsedURL = url.parse(args.req.url)\n const isGraphQL = parsedURL.pathname === config.routes.graphQL\n\n const user = await args.req.payload.findByID({\n id: args.req.user.id,\n collection: args.req.user.collection,\n depth: isGraphQL ? 0 : args.collection.config.auth.depth,\n req: args.req,\n })\n\n let result: Result\n\n // /////////////////////////////////////\n // refresh hook - Collection\n // /////////////////////////////////////\n\n for (const refreshHook of args.collection.config.hooks.refresh) {\n const hookResult = await refreshHook({ args, user })\n\n if (hookResult) {\n result = hookResult\n break\n }\n }\n\n if (!result) {\n const fieldsToSign = getFieldsToSign({\n collectionConfig,\n email: user?.email as string,\n user: args?.req?.user,\n })\n\n const refreshedToken = jwt.sign(fieldsToSign, secret, {\n expiresIn: collectionConfig.auth.tokenExpiration,\n })\n\n const exp = (jwt.decode(refreshedToken) as Record<string, unknown>).exp as number\n\n result = {\n exp,\n refreshedToken,\n setCookie: true,\n strategy: args.req.user._strategy,\n user,\n }\n }\n\n // /////////////////////////////////////\n // After Refresh - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.afterRefresh.reduce(async (priorHook, hook) => {\n await priorHook\n\n result =\n (await hook({\n collection: args.collection?.config,\n context: args.req.context,\n exp: result.exp,\n req: args.req,\n token: result.refreshedToken,\n })) || result\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // afterOperation - Collection\n // /////////////////////////////////////\n\n result = await buildAfterOperation({\n args,\n collection: args.collection?.config,\n operation: 'refresh',\n result,\n })\n\n // /////////////////////////////////////\n // Return results\n // /////////////////////////////////////\n\n if (shouldCommit) {\n await commitTransaction(req)\n }\n\n return result\n } catch (error: unknown) {\n await killTransaction(args.req)\n throw error\n }\n}\n"],"names":["jwt","url","buildAfterOperation","Forbidden","commitTransaction","initTransaction","killTransaction","getFieldsToSign","refreshOperation","incomingArgs","args","shouldCommit","req","collection","config","hooks","beforeOperation","reduce","priorHook","hook","context","operation","Promise","resolve","collectionConfig","payload","secret","user","t","parsedURL","parse","isGraphQL","pathname","routes","graphQL","findByID","id","depth","auth","result","refreshHook","refresh","hookResult","fieldsToSign","email","refreshedToken","sign","expiresIn","tokenExpiration","exp","decode","setCookie","strategy","_strategy","afterRefresh","token","error"],"mappings":"AAAA,OAAOA,SAAS,eAAc;AAC9B,OAAOC,SAAS,MAAK;AAKrB,SAASC,mBAAmB,QAAQ,wCAAuC;AAC3E,SAASC,SAAS,QAAQ,wBAAuB;AACjD,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,wBAAuB;AAevD,OAAO,MAAMC,mBAAmB,OAAOC;IACrC,IAAIC,OAAOD;IAEX,IAAI;QACF,MAAME,eAAe,MAAMN,gBAAgBK,KAAKE,GAAG;QAEnD,wCAAwC;QACxC,+BAA+B;QAC/B,wCAAwC;QAExC,MAAMF,KAAKG,UAAU,CAACC,MAAM,CAACC,KAAK,CAACC,eAAe,CAACC,MAAM,CACvD,OAAOC,WAAgDC;YACrD,MAAMD;YAENR,OACE,AAAC,MAAMS,KAAK;gBACVT;gBACAG,YAAYH,KAAKG,UAAU,EAAEC;gBAC7BM,SAASV,KAAKE,GAAG,CA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I,CAACH,cAAcjB,QAAQ;gBACpDqB,WAAWvB,iBAAiBc,IAAI,CAACU,eAAe;YAClD;YAEA,MAAMC,MAAM,AAACjD,IAAIkD,MAAM,CAACL,gBAA4CI,GAAG;YAEvEV,SAAS;gBACPU;gBACAJ;gBACAM,WAAW;gBACXC,UAAU1C,KAAKE,GAAG,CAACe,IAAI,CAAC0B,SAAS;gBACjC1B;YACF;QACF;QAEA,wCAAwC;QACxC,6BAA6B;QAC7B,wCAAwC;QAExC,MAAMH,iBAAiBT,KAAK,CAACuC,YAAY,CAACrC,MAAM,CAAC,OAAOC,WAAWC;YACjE,MAAMD;YAENqB,SACE,AAAC,MAAMpB,KAAK;gBACVN,YAAYH,KAAKG,UAAU,EAAEC;gBAC7BM,SAASV,KAAKE,GAAG,CAACQ,OAAO;gBACzB6B,KAAKV,OAAOU,GAAG;gBACfrC,KAAKF,KAAKE,GAAG;gBACb2C,OAAOhB,OAAOM,cAAc;YAC9B,MAAON;QACX,GAAGjB,QAAQC,OAAO;QAElB,wCAAwC;QACxC,8BAA8B;QAC9B,wCAAwC;QAExCgB,SAAS,MAAMrC,oBAAoB;YACjCQ;YACAG,YAAYH,KAAKG,UAAU,EAAEC;YAC7BO,WAAW;YACXkB;QACF;QAEA,wCAAwC;QACxC,iBAAiB;QACjB,wCAAwC;QAExC,IAAI5B,cAAc;YAChB,MAAMP,kBAAkBQ;QAC1B;QAEA,OAAO2B;IACT,EAAE,OAAOiB,OAAgB;QACvB,MAAMlD,gBAAgBI,KAAKE,GAAG;QAC9B,MAAM4C;IACR;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/auth/operations/refresh.ts"],"sourcesContent":["import jwt from 'jsonwebtoken'\nimport url from 'url'\n\nimport type { BeforeOperationHook, Collection } from '../../collections/config/types.js'\nimport type { Document, PayloadRequest } from '../../types/index.js'\n\nimport { buildAfterOperation } from '../../collections/operations/utils.js'\nimport { Forbidden } from '../../errors/index.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { getFieldsToSign } from '../getFieldsToSign.js'\n\nexport type Result = {\n exp: number\n refreshedToken: string\n setCookie?: boolean\n strategy?: string\n user: Document\n}\n\nexport type Arguments = {\n collection: Collection\n req: PayloadRequest\n}\n\nexport const refreshOperation = async (incomingArgs: Arguments): Promise<Result> => {\n let args = incomingArgs\n\n try {\n const shouldCommit = await initTransaction(args.req)\n\n // /////////////////////////////////////\n // beforeOperation - Collection\n // /////////////////////////////////////\n\n await args.collection.config.hooks.beforeOperation.reduce(\n async (priorHook: BeforeOperationHook | Promise<void>, hook: BeforeOperationHook) => {\n await priorHook\n\n args =\n (await hook({\n args,\n collection: args.collection?.config,\n context: args.req.context,\n operation: 'refresh',\n req: args.req,\n })) || args\n },\n Promise.resolve(),\n )\n\n // /////////////////////////////////////\n // Refresh\n // /////////////////////////////////////\n\n const {\n collection: { config: collectionConfig },\n req,\n req: {\n payload: { config, secret },\n },\n } = args\n\n if (!args.req.user) {\n throw new Forbidden(args.req.t)\n }\n\n const parsedURL = url.parse(args.req.url)\n const isGraphQL = parsedURL.pathname === config.routes.graphQL\n\n const user = await args.req.payload.findByID({\n id: args.req.user.id,\n collection: args.req.user.collection,\n depth: isGraphQL ? 0 : args.collection.config.auth.depth,\n req: args.req,\n })\n\n if (user) {\n user.collection = args.req.user.collection\n }\n\n let result: Result\n\n // /////////////////////////////////////\n // refresh hook - Collection\n // /////////////////////////////////////\n\n for (const refreshHook of args.collection.config.hooks.refresh) {\n const hookResult = await refreshHook({ args, user })\n\n if (hookResult) {\n result = hookResult\n break\n }\n }\n\n if (!result) {\n const fieldsToSign = getFieldsToSign({\n collectionConfig,\n email: user?.email as string,\n user: args?.req?.user,\n })\n\n const refreshedToken = jwt.sign(fieldsToSign, secret, {\n expiresIn: collectionConfig.auth.tokenExpiration,\n })\n\n const exp = (jwt.decode(refreshedToken) as Record<string, unknown>).exp as number\n\n result = {\n exp,\n refreshedToken,\n setCookie: true,\n strategy: args.req.user._strategy,\n user,\n }\n }\n\n // /////////////////////////////////////\n // After Refresh - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.afterRefresh.reduce(async (priorHook, hook) => {\n await priorHook\n\n result =\n (await hook({\n collection: args.collection?.config,\n context: args.req.context,\n exp: result.exp,\n req: args.req,\n token: result.refreshedToken,\n })) || result\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // afterOperation - Collection\n // /////////////////////////////////////\n\n result = await buildAfterOperation({\n args,\n collection: args.collection?.config,\n operation: 'refresh',\n result,\n })\n\n // /////////////////////////////////////\n // Return results\n // /////////////////////////////////////\n\n if (shouldCommit) {\n await commitTransaction(req)\n }\n\n return result\n } catch (error: unknown) {\n await killTransaction(args.req)\n throw error\n }\n}\n"],"names":["jwt","url","buildAfterOperation","Forbidden","commitTransaction","initTransaction","killTransaction","getFieldsToSign","refreshOperation","incomingArgs","args","shouldCommit","req","collection","config","hooks","beforeOperation","reduce","priorHook","hook","context","operation","Promise","resolve","collectionConfig","payload","secret","user","t","parsedURL","parse","isGraphQL","pathname","routes","graphQL","findByID","id","depth","auth","result","refreshHook","refresh","hookResult","fieldsToSign","email","refreshedToken","sign","expiresIn","tokenExpiration","exp","decode","setCookie","strategy","_strategy","afterRefresh","token","error"],"mappings":"AAAA,OAAOA,SAAS,eAAc;AAC9B,OAAOC,SAAS,MAAK;AAKrB,SAASC,mBAAmB,QAAQ,wCAAuC;AAC3E,SAASC,SAAS,QAAQ,wBAAuB;AACjD,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,wBAAuB;AAevD,OAAO,MAAMC,mBAAmB,OAAOC;IACrC,IAAIC,OAAOD;IAEX,IAAI;QACF,MAAME,eAAe,MAAMN,gBAAgBK,KAAKE,GAAG;QAEnD,wCAAwC;QACxC,+BAA+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vB,MAAMlD,gBAAgBI,KAAKE,GAAG;QAC9B,MAAM4C;IACR;AACF,EAAC"}
@@ -54,18 +54,22 @@ export type Permissions = {
54
54
  [globalSlug: string]: GlobalPermission;
55
55
  };
56
56
  };
57
- export type User = {
58
- [key: string]: any;
57
+ type BaseUser = {
59
58
  collection: string;
60
59
  email?: string;
61
60
  id: number | string;
62
61
  username?: string;
63
62
  };
63
+ export type User = {
64
+ [key: string]: any;
65
+ } & BaseUser;
64
66
  /**
65
67
  * `collection` is not available one the client. It's only available on the server (req.user)
66
68
  * On the client, you can access the collection via config.admin.user. Config can be accessed using the useConfig() hook
67
69
  */
68
- export type ClientUser = Omit<User, 'collection'>;
70
+ export type ClientUser = {
71
+ [key: string]: any;
72
+ } & BaseUser;
69
73
  type GenerateVerifyEmailHTML<TUser = any> = (args: {
70
74
  req: PayloadRequest;
71
75
  token: string;
@@ -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,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE9D,MAAM,MAAM,UAAU,GAAG;IACvB,UAAU,EAAE,OAAO,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAChC,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,CAAC,EAAE;QACP,CAAC,SAAS,EAAE,MAAM,GAAG;YACnB,MAAM,EAAE;gBACN,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,CAAA;aACtC,CAAA;SACF,CAAA;KACF,CAAA;IACD,MAAM,EAAE;QACN,UAAU,EAAE,OAAO,CAAA;KACpB,CAAA;IACD,MAAM,CAAC,EAAE;QACP,CAAC,S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C,CAAA;KAC1D,CAAA;IACD;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,GAAG,wBAAwB,CAAA;IACtD;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;OAEG;IACH,wBAAwB,CAAC,EAAE,IAAI,CAAA;IAC/B;;;OAGG;IACH,UAAU,CAAC,EAAE,YAAY,EAAE,CAAA;IAC3B;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;OAGG;IACH,MAAM,CAAC,EACH;QACE,iBAAiB,CAAC,EAAE,uBAAuB,CAAA;QAC3C,oBAAoB,CAAC,EAAE,0BAA0B,CAAA;KAClD,GACD,OAAO,CAAA;CACZ;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,iBAAiB,CAAC,EAAE,uBAAuB,CAAA;IAC3C,oBAAoB,CAAC,EAAE,0BAA0B,CAAA;CAClD,CAAA;AAED,MAAM,WAAW,IACf,SAAQ,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,mBAAmB,GAAG,QAAQ,CAAC;IAC/F,cAAc,CAAC,EAAE;QACf,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 { Payload } from '../index.js'\nimport type { PayloadRequest, Where } from '../types/index.js'\n\nexport type Permission = {\n permission: boolean\n where?: Record<string, unknown>\n}\n\nexport type FieldPermissions = {\n blocks?: {\n [blockSlug: string]: {\n fields: {\n [fieldName: string]: FieldPermissions\n }\n }\n }\n create: {\n permission: boolean\n }\n fields?: {\n [fieldName: string]: FieldPermissions\n }\n read: {\n permission: boolean\n }\n update: {\n permission: boolean\n }\n}\n\nexport type CollectionPermission = {\n create: Permission\n delete: Permission\n fields: {\n [fieldName: string]: FieldPermissions\n }\n read: Permission\n readVersions?: Permission\n update: Permission\n}\n\nexport type GlobalPermission = {\n fields: {\n [fieldName: string]: FieldPermissions\n }\n read: Permission\n readVersions?: Permission\n update: Permission\n}\n\nexport type DocumentPermissions = CollectionPermission | GlobalPermission\nexport type Permissions = {\n canAccessAdmin: boolean\n collections: {\n [collectionSlug: string]: CollectionPermission\n }\n globals?: {\n [globalSlug: string]: GlobalPermission\n }\n}\n\nexport type User = {\n [key: string]: any // This NEEDS to be an any, otherwise it breaks the Omit for ClientUser below\n collection: string\n email?: string\n id: number | string\n username?: string\n}\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 = Omit<User, 'collection'>\n\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 headers: Request['headers']\n isGraphQL?: boolean\n payload: Payload\n}\n\nexport type AuthStrategyResult = {\n responseHeaders?: Headers\n user: null | User\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?: true\n /**\n * Customize the way that the forgotPassword operation functions.\n * @link https://payloadcms.com/docs/beta/authentication/email#forgot-password\n */\n forgotPassword?: {\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/beta/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/beta/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/beta/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/beta/authentication/api-keys\n */\n useAPIKey?: boolean\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/beta/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 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":"AA6NA,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 { Payload } from '../index.js'\nimport type { PayloadRequest, Where } from '../types/index.js'\n\nexport type Permission = {\n permission: boolean\n where?: Record<string, unknown>\n}\n\nexport type FieldPermissions = {\n blocks?: {\n [blockSlug: string]: {\n fields: {\n [fieldName: string]: FieldPermissions\n }\n }\n }\n create: {\n permission: boolean\n }\n fields?: {\n [fieldName: string]: FieldPermissions\n }\n read: {\n permission: boolean\n }\n update: {\n permission: boolean\n }\n}\n\nexport type CollectionPermission = {\n create: Permission\n delete: Permission\n fields: {\n [fieldName: string]: FieldPermissions\n }\n read: Permission\n readVersions?: Permission\n update: Permission\n}\n\nexport type GlobalPermission = {\n fields: {\n [fieldName: string]: FieldPermissions\n }\n read: Permission\n readVersions?: Permission\n update: Permission\n}\n\nexport type DocumentPermissions = CollectionPermission | GlobalPermission\nexport type Permissions = {\n canAccessAdmin: boolean\n collections: {\n [collectionSlug: string]: CollectionPermission\n }\n globals?: {\n [globalSlug: string]: GlobalPermission\n }\n}\n\ntype BaseUser = {\n collection: string\n email?: string\n id: number | string\n username?: string\n}\n\nexport type User = {\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\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 headers: Request['headers']\n isGraphQL?: boolean\n payload: Payload\n}\n\nexport type AuthStrategyResult = {\n responseHeaders?: Headers\n user: null | User\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?: true\n /**\n * Customize the way that the forgotPassword operation functions.\n * @link https://payloadcms.com/docs/beta/authentication/email#forgot-password\n */\n forgotPassword?: {\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/beta/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/beta/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/beta/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/beta/authentication/api-keys\n */\n useAPIKey?: boolean\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/beta/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 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":"AAkOA,OAAO,SAASA,qBAAqBC,MAAuB;IAC1D,OAAOA,UAAU,OAAOA,WAAW;AACrC"}
@@ -1 +1 @@
1
- {"version":3,"file":"checkPayloadDependencies.d.ts","sourceRoot":"","sources":["../src/checkPayloadDependencies.ts"],"names":[],"mappings":"AAoBA,wBAAsB,wBAAwB,kBAsC7C"}
1
+ {"version":3,"file":"checkPayloadDependencies.d.ts","sourceRoot":"","sources":["../src/checkPayloadDependencies.ts"],"names":[],"mappings":"AAGA,wBAAsB,wBAAwB,kBAiB7C"}
@@ -1,24 +1,5 @@
1
1
  import { checkDependencies } from './utilities/dependencies/dependencyChecker.js';
2
2
  import { PAYLOAD_PACKAGE_LIST } from './versions/payloadPackageList.js';
3
- const customReactVersionParser = (version)=>{
4
- const [mainVersion, ...preReleases] = version.split('-');
5
- if (preReleases?.length === 3) {
6
- // Needs different handling, as it's in a format like 19.0.0-rc-06d0b89e-20240801 format
7
- const date = preReleases[2];
8
- const parts = mainVersion.split('.').map(Number);
9
- return {
10
- parts,
11
- preReleases: [
12
- date
13
- ]
14
- };
15
- }
16
- const parts = mainVersion.split('.').map(Number);
17
- return {
18
- parts,
19
- preReleases
20
- };
21
- };
22
3
  export async function checkPayloadDependencies() {
23
4
  const dependencies = [
24
5
  ...PAYLOAD_PACKAGE_LIST
@@ -33,32 +14,8 @@ export async function checkPayloadDependencies() {
33
14
  name: 'payload',
34
15
  dependencies,
35
16
  targetVersionDependency: 'payload'
36
- },
37
- {
38
- name: 'react',
39
- dependencies: [
40
- 'react',
41
- 'react-dom'
42
- ],
43
- targetVersionDependency: 'react'
44
- }
45
- ],
46
- dependencyVersions: {
47
- next: {
48
- required: false,
49
- version: '>=15.0.0-canary.104'
50
- },
51
- react: {
52
- customVersionParser: customReactVersionParser,
53
- required: false,
54
- version: '>=19.0.0-rc-06d0b89e-20240801'
55
- },
56
- 'react-dom': {
57
- customVersionParser: customReactVersionParser,
58
- required: false,
59
- version: '>=19.0.0-rc-06d0b89e-20240801'
60
17
  }
61
- }
18
+ ]
62
19
  });
63
20
  }
64
21
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/checkPayloadDependencies.ts"],"sourcesContent":["import type { CustomVersionParser } from './utilities/dependencies/dependencyChecker.js'\n\nimport { checkDependencies } from './utilities/dependencies/dependencyChecker.js'\nimport { PAYLOAD_PACKAGE_LIST } from './versions/payloadPackageList.js'\n\nconst customReactVersionParser: CustomVersionParser = (version) => {\n const [mainVersion, ...preReleases] = version.split('-')\n\n if (preReleases?.length === 3) {\n // Needs different handling, as it's in a format like 19.0.0-rc-06d0b89e-20240801 format\n const date = preReleases[2]\n\n const parts = mainVersion.split('.').map(Number)\n return { parts, preReleases: [date] }\n }\n\n const parts = mainVersion.split('.').map(Number)\n return { parts, preReleases }\n}\n\nexport async function checkPayloadDependencies() {\n const dependencies = [...PAYLOAD_PACKAGE_LIST]\n\n if (process.env.PAYLOAD_CI_DEPENDENCY_CHECKER !== 'true') {\n dependencies.push('@payloadcms/plugin-sentry')\n }\n\n // First load. First check if there are mismatching dependency versions of payload packages\n await checkDependencies({\n dependencyGroups: [\n {\n name: 'payload',\n dependencies,\n targetVersionDependency: 'payload',\n },\n {\n name: 'react',\n dependencies: ['react', 'react-dom'],\n targetVersionDependency: 'react',\n },\n ],\n dependencyVersions: {\n next: {\n required: false,\n version: '>=15.0.0-canary.104',\n },\n react: {\n customVersionParser: customReactVersionParser,\n required: false,\n version: '>=19.0.0-rc-06d0b89e-20240801',\n },\n 'react-dom': {\n customVersionParser: customReactVersionParser,\n required: false,\n version: '>=19.0.0-rc-06d0b89e-20240801',\n },\n },\n })\n}\n"],"names":["checkDependencies","PAYLOAD_PACKAGE_LIST","customReactVersionParser","version","mainVersion","preReleases","split","length","date","parts","map","Number","checkPayloadDependencies","dependencies","process","env","PAYLOAD_CI_DEPENDENCY_CHECKER","push","dependencyGroups","name","targetVersionDependency","dependencyVersions","next","required","react","customVersionParser"],"mappings":"AAEA,SAASA,iBAAiB,QAAQ,gDAA+C;AACjF,SAASC,oBAAoB,QAAQ,mCAAkC;AAEvE,MAAMC,2BAAgD,CAACC;IACrD,MAAM,CAACC,aAAa,GAAGC,YAAY,GAAGF,QAAQG,KAAK,CAAC;IAEpD,IAAID,aAAaE,WAAW,GAAG;QAC7B,wFAAwF;QACxF,MAAMC,OAAOH,WAAW,CAAC,EAAE;QAE3B,MAAMI,QAAQL,YAAYE,KAAK,CAAC,KAAKI,GAAG,CAACC;QACzC,OAAO;YAAEF;YAAOJ,aAAa;gBAACG;aAAK;QAAC;IACtC;IAEA,MAAMC,QAAQL,YAAYE,KAAK,CAAC,KAAKI,GAAG,CAACC;IACzC,OAAO;QAAEF;QAAOJ;IAAY;AAC9B;AAEA,OAAO,eAAeO;IACpB,MAAMC,eAAe;WAAIZ;KAAqB;IAE9C,IAAIa,QAAQC,GAAG,CAACC,6BAA6B,KAAK,QAAQ;QACxDH,aAAaI,IAAI,CAAC;IACpB;IAEA,2FAA2F;IAC3F,MAAMjB,kBAAkB;QACtBkB,kBAAkB;YAChB;gBACEC,MAAM;gBACNN;gBACAO,yBAAyB;YAC3B;YACA;gBACED,MAAM;gBACNN,cAAc;oBAAC;oBAAS;iBAAY;gBACpCO,yBAAyB;YAC3B;SACD;QACDC,oBAAoB;YAClBC,MAAM;gBACJC,UAAU;gBACVpB,SAAS;YACX;YACAqB,OAAO;gBACLC,qBAAqBvB;gBACrBqB,UAAU;gBACVpB,SAAS;YACX;YACA,aAAa;gBACXsB,qBAAqBvB;gBACrBqB,UAAU;gBACVpB,SAAS;YACX;QACF;IACF;AACF"}
1
+ {"version":3,"sources":["../src/checkPayloadDependencies.ts"],"sourcesContent":["import { checkDependencies } from './utilities/dependencies/dependencyChecker.js'\nimport { PAYLOAD_PACKAGE_LIST } from './versions/payloadPackageList.js'\n\nexport async function checkPayloadDependencies() {\n const dependencies = [...PAYLOAD_PACKAGE_LIST]\n\n if (process.env.PAYLOAD_CI_DEPENDENCY_CHECKER !== 'true') {\n dependencies.push('@payloadcms/plugin-sentry')\n }\n\n // First load. First check if there are mismatching dependency versions of payload packages\n await checkDependencies({\n dependencyGroups: [\n {\n name: 'payload',\n dependencies,\n targetVersionDependency: 'payload',\n },\n ],\n })\n}\n"],"names":["checkDependencies","PAYLOAD_PACKAGE_LIST","checkPayloadDependencies","dependencies","process","env","PAYLOAD_CI_DEPENDENCY_CHECKER","push","dependencyGroups","name","targetVersionDependency"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,gDAA+C;AACjF,SAASC,oBAAoB,QAAQ,mCAAkC;AAEvE,OAAO,eAAeC;IACpB,MAAMC,eAAe;WAAIF;KAAqB;IAE9C,IAAIG,QAAQC,GAAG,CAACC,6BAA6B,KAAK,QAAQ;QACxDH,aAAaI,IAAI,CAAC;IACpB;IAEA,2FAA2F;IAC3F,MAAMP,kBAAkB;QACtBQ,kBAAkB;YAChB;gBACEC,MAAM;gBACNN;gBACAO,yBAAyB;YAC3B;SACD;IACH;AACF"}