directus 9.23.1 → 9.23.3

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 (359) hide show
  1. package/dist/app.js +14 -10
  2. package/dist/auth/auth.d.ts +3 -3
  3. package/dist/auth/auth.js +2 -0
  4. package/dist/auth/drivers/ldap.d.ts +1 -1
  5. package/dist/auth/drivers/ldap.js +39 -28
  6. package/dist/auth/drivers/local.d.ts +1 -1
  7. package/dist/auth/drivers/local.js +13 -10
  8. package/dist/auth/drivers/oauth2.d.ts +1 -1
  9. package/dist/auth/drivers/oauth2.js +20 -13
  10. package/dist/auth/drivers/openid.d.ts +1 -1
  11. package/dist/auth/drivers/openid.js +21 -14
  12. package/dist/auth/drivers/saml.d.ts +1 -1
  13. package/dist/auth/drivers/saml.js +10 -7
  14. package/dist/auth.d.ts +1 -1
  15. package/dist/auth.js +4 -4
  16. package/dist/cache.d.ts +9 -1
  17. package/dist/cache.js +57 -14
  18. package/dist/cli/commands/bootstrap/index.js +2 -2
  19. package/dist/cli/commands/init/index.js +3 -3
  20. package/dist/cli/commands/schema/apply.js +14 -15
  21. package/dist/cli/commands/schema/snapshot.js +2 -2
  22. package/dist/cli/utils/create-db-connection.d.ts +1 -1
  23. package/dist/cli/utils/create-db-connection.js +2 -1
  24. package/dist/cli/utils/create-env/index.d.ts +2 -2
  25. package/dist/cli/utils/drivers.d.ts +1 -1
  26. package/dist/constants.d.ts +2 -2
  27. package/dist/constants.js +2 -3
  28. package/dist/controllers/activity.js +1 -2
  29. package/dist/controllers/assets.js +14 -9
  30. package/dist/controllers/auth.js +29 -15
  31. package/dist/controllers/dashboards.js +5 -2
  32. package/dist/controllers/fields.js +4 -4
  33. package/dist/controllers/files.js +10 -5
  34. package/dist/controllers/flows.js +5 -2
  35. package/dist/controllers/folders.js +5 -2
  36. package/dist/controllers/graphql.js +2 -4
  37. package/dist/controllers/items.js +5 -2
  38. package/dist/controllers/not-found.d.ts +1 -1
  39. package/dist/controllers/not-found.js +1 -2
  40. package/dist/controllers/notifications.js +5 -2
  41. package/dist/controllers/operations.js +5 -2
  42. package/dist/controllers/panels.js +5 -2
  43. package/dist/controllers/permissions.js +5 -2
  44. package/dist/controllers/presets.js +5 -2
  45. package/dist/controllers/roles.js +5 -2
  46. package/dist/controllers/shares.js +8 -5
  47. package/dist/controllers/users.js +16 -20
  48. package/dist/controllers/utils.js +6 -11
  49. package/dist/controllers/webhooks.js +5 -2
  50. package/dist/database/helpers/fn/dialects/mssql.d.ts +1 -1
  51. package/dist/database/helpers/fn/dialects/mssql.js +10 -11
  52. package/dist/database/helpers/fn/dialects/mysql.d.ts +1 -1
  53. package/dist/database/helpers/fn/dialects/mysql.js +2 -3
  54. package/dist/database/helpers/fn/dialects/oracle.d.ts +1 -1
  55. package/dist/database/helpers/fn/dialects/oracle.js +10 -11
  56. package/dist/database/helpers/fn/dialects/postgres.d.ts +1 -1
  57. package/dist/database/helpers/fn/dialects/postgres.js +10 -11
  58. package/dist/database/helpers/fn/dialects/sqlite.d.ts +1 -1
  59. package/dist/database/helpers/fn/dialects/sqlite.js +10 -11
  60. package/dist/database/helpers/fn/types.d.ts +5 -5
  61. package/dist/database/helpers/fn/types.js +5 -4
  62. package/dist/database/helpers/geometry/dialects/mssql.d.ts +3 -3
  63. package/dist/database/helpers/geometry/dialects/mysql.d.ts +1 -1
  64. package/dist/database/helpers/geometry/dialects/oracle.d.ts +3 -3
  65. package/dist/database/helpers/geometry/dialects/postgres.d.ts +3 -3
  66. package/dist/database/helpers/geometry/dialects/postgres.js +1 -2
  67. package/dist/database/helpers/geometry/dialects/redshift.d.ts +2 -2
  68. package/dist/database/helpers/geometry/dialects/sqlite.d.ts +1 -1
  69. package/dist/database/helpers/geometry/types.d.ts +2 -2
  70. package/dist/database/helpers/geometry/types.js +1 -2
  71. package/dist/database/helpers/index.d.ts +5 -5
  72. package/dist/database/helpers/schema/dialects/cockroachdb.d.ts +1 -1
  73. package/dist/database/helpers/schema/dialects/mssql.d.ts +1 -1
  74. package/dist/database/helpers/schema/dialects/mysql.d.ts +1 -1
  75. package/dist/database/helpers/schema/dialects/mysql.js +1 -2
  76. package/dist/database/helpers/schema/dialects/oracle.d.ts +2 -2
  77. package/dist/database/helpers/schema/dialects/oracle.js +4 -6
  78. package/dist/database/helpers/schema/types.d.ts +4 -4
  79. package/dist/database/helpers/types.d.ts +1 -1
  80. package/dist/database/helpers/types.js +1 -0
  81. package/dist/database/index.d.ts +1 -1
  82. package/dist/database/index.js +8 -8
  83. package/dist/database/migrations/20201028A-remove-collection-foreign-keys.d.ts +1 -1
  84. package/dist/database/migrations/20201029A-remove-system-relations.d.ts +1 -1
  85. package/dist/database/migrations/20201029B-remove-system-collections.d.ts +1 -1
  86. package/dist/database/migrations/20201029C-remove-system-fields.d.ts +1 -1
  87. package/dist/database/migrations/20201105A-add-cascade-system-relations.d.ts +1 -1
  88. package/dist/database/migrations/20201105B-change-webhook-url-type.d.ts +1 -1
  89. package/dist/database/migrations/20210225A-add-relations-sort-field.d.ts +1 -1
  90. package/dist/database/migrations/20210225A-add-relations-sort-field.js +1 -2
  91. package/dist/database/migrations/20210304A-remove-locked-fields.d.ts +1 -1
  92. package/dist/database/migrations/20210312A-webhooks-collections-text.d.ts +1 -1
  93. package/dist/database/migrations/20210331A-add-refresh-interval.d.ts +1 -1
  94. package/dist/database/migrations/20210415A-make-filesize-nullable.d.ts +1 -1
  95. package/dist/database/migrations/20210416A-add-collections-accountability.d.ts +1 -1
  96. package/dist/database/migrations/20210422A-remove-files-interface.d.ts +1 -1
  97. package/dist/database/migrations/20210506A-rename-interfaces.d.ts +1 -1
  98. package/dist/database/migrations/20210510A-restructure-relations.d.ts +1 -1
  99. package/dist/database/migrations/20210518A-add-foreign-key-constraints.d.ts +1 -1
  100. package/dist/database/migrations/20210518A-add-foreign-key-constraints.js +1 -1
  101. package/dist/database/migrations/20210519A-add-system-fk-triggers.d.ts +1 -1
  102. package/dist/database/migrations/20210519A-add-system-fk-triggers.js +2 -2
  103. package/dist/database/migrations/20210521A-add-collections-icon-color.d.ts +1 -1
  104. package/dist/database/migrations/20210525A-add-insights.d.ts +1 -1
  105. package/dist/database/migrations/20210608A-add-deep-clone-config.d.ts +1 -1
  106. package/dist/database/migrations/20210626A-change-filesize-bigint.d.ts +1 -1
  107. package/dist/database/migrations/20210716A-add-conditions-to-fields.d.ts +1 -1
  108. package/dist/database/migrations/20210721A-add-default-folder.d.ts +1 -1
  109. package/dist/database/migrations/20210802A-replace-groups.d.ts +1 -1
  110. package/dist/database/migrations/20210803A-add-required-to-fields.d.ts +1 -1
  111. package/dist/database/migrations/20210805A-update-groups.d.ts +1 -1
  112. package/dist/database/migrations/20210805B-change-image-metadata-structure.d.ts +1 -1
  113. package/dist/database/migrations/20210811A-add-geometry-config.d.ts +1 -1
  114. package/dist/database/migrations/20210831A-remove-limit-column.d.ts +1 -1
  115. package/dist/database/migrations/20210903A-add-auth-provider.d.ts +1 -1
  116. package/dist/database/migrations/20210907A-webhooks-collections-not-null.d.ts +1 -1
  117. package/dist/database/migrations/20210910A-move-module-setup.d.ts +1 -1
  118. package/dist/database/migrations/20210920A-webhooks-url-not-null.d.ts +1 -1
  119. package/dist/database/migrations/20210924A-add-collection-organization.d.ts +1 -1
  120. package/dist/database/migrations/20210927A-replace-fields-group.d.ts +1 -1
  121. package/dist/database/migrations/20210927B-replace-m2m-interface.d.ts +1 -1
  122. package/dist/database/migrations/20210929A-rename-login-action.d.ts +1 -1
  123. package/dist/database/migrations/20211007A-update-presets.d.ts +1 -1
  124. package/dist/database/migrations/20211007A-update-presets.js +7 -9
  125. package/dist/database/migrations/20211009A-add-auth-data.d.ts +1 -1
  126. package/dist/database/migrations/20211016A-add-webhook-headers.d.ts +1 -1
  127. package/dist/database/migrations/20211103A-set-unique-to-user-token.d.ts +1 -1
  128. package/dist/database/migrations/20211103B-update-special-geometry.d.ts +1 -1
  129. package/dist/database/migrations/20211104A-remove-collections-listing.d.ts +1 -1
  130. package/dist/database/migrations/20211118A-add-notifications.d.ts +1 -1
  131. package/dist/database/migrations/20211211A-add-shares.d.ts +1 -1
  132. package/dist/database/migrations/20211230A-add-project-descriptor.d.ts +1 -1
  133. package/dist/database/migrations/20220303A-remove-default-project-color.d.ts +1 -1
  134. package/dist/database/migrations/20220308A-add-bookmark-icon-and-color.d.ts +1 -1
  135. package/dist/database/migrations/20220314A-add-translation-strings.d.ts +1 -1
  136. package/dist/database/migrations/20220322A-rename-field-typecast-flags.d.ts +1 -1
  137. package/dist/database/migrations/20220323A-add-field-validation.d.ts +1 -1
  138. package/dist/database/migrations/20220325A-fix-typecast-flags.d.ts +1 -1
  139. package/dist/database/migrations/20220325B-add-default-language.d.ts +1 -1
  140. package/dist/database/migrations/20220402A-remove-default-value-panel-icon.d.ts +1 -1
  141. package/dist/database/migrations/20220429A-add-flows.d.ts +1 -1
  142. package/dist/database/migrations/20220429B-add-color-to-insights-icon.d.ts +1 -1
  143. package/dist/database/migrations/20220429C-drop-non-null-from-ip-of-activity.d.ts +1 -1
  144. package/dist/database/migrations/20220429D-drop-non-null-from-sender-of-notifications.d.ts +1 -1
  145. package/dist/database/migrations/20220614A-rename-hook-trigger-to-event.d.ts +1 -1
  146. package/dist/database/migrations/20220801A-update-notifications-timestamp-column.d.ts +1 -1
  147. package/dist/database/migrations/20220802A-add-custom-aspect-ratios.d.ts +1 -1
  148. package/dist/database/migrations/20220826A-add-origin-to-accountability.d.ts +1 -1
  149. package/dist/database/migrations/run.d.ts +1 -1
  150. package/dist/database/run-ast.d.ts +3 -3
  151. package/dist/database/run-ast.js +17 -26
  152. package/dist/database/seeds/run.d.ts +1 -1
  153. package/dist/database/seeds/run.js +1 -2
  154. package/dist/database/system-data/app-access-permissions/index.d.ts +1 -1
  155. package/dist/database/system-data/collections/index.d.ts +1 -1
  156. package/dist/database/system-data/fields/collections.yaml +2 -0
  157. package/dist/database/system-data/fields/index.d.ts +1 -1
  158. package/dist/database/system-data/fields/index.js +1 -2
  159. package/dist/database/system-data/fields/settings.yaml +4 -0
  160. package/dist/database/system-data/relations/index.d.ts +1 -1
  161. package/dist/emitter.d.ts +1 -1
  162. package/dist/emitter.js +3 -0
  163. package/dist/env.js +10 -2
  164. package/dist/exceptions/database/dialects/mssql.d.ts +1 -1
  165. package/dist/exceptions/database/dialects/mssql.js +5 -6
  166. package/dist/exceptions/database/dialects/mysql.d.ts +1 -1
  167. package/dist/exceptions/database/dialects/mysql.js +19 -25
  168. package/dist/exceptions/database/dialects/oracle.d.ts +1 -1
  169. package/dist/exceptions/database/dialects/postgres.d.ts +1 -1
  170. package/dist/exceptions/database/dialects/sqlite.d.ts +1 -1
  171. package/dist/exceptions/database/translate.d.ts +1 -1
  172. package/dist/exceptions/database/value-out-of-range.js +1 -1
  173. package/dist/exceptions/range-not-satisfiable.js +2 -3
  174. package/dist/extensions.d.ts +1 -1
  175. package/dist/extensions.js +33 -23
  176. package/dist/flows.js +42 -25
  177. package/dist/logger.d.ts +1 -1
  178. package/dist/logger.js +19 -3
  179. package/dist/messenger.js +8 -6
  180. package/dist/middleware/authenticate.d.ts +1 -1
  181. package/dist/middleware/authenticate.js +12 -5
  182. package/dist/middleware/cache.d.ts +1 -1
  183. package/dist/middleware/cache.js +5 -5
  184. package/dist/middleware/check-ip.d.ts +1 -1
  185. package/dist/middleware/check-ip.js +1 -1
  186. package/dist/middleware/collection-exists.d.ts +1 -1
  187. package/dist/middleware/collection-exists.js +2 -2
  188. package/dist/middleware/cors.d.ts +1 -1
  189. package/dist/middleware/error-handler.d.ts +1 -1
  190. package/dist/middleware/error-handler.js +9 -10
  191. package/dist/middleware/extract-token.d.ts +1 -1
  192. package/dist/middleware/get-permissions.d.ts +1 -1
  193. package/dist/middleware/graphql.d.ts +1 -1
  194. package/dist/middleware/graphql.js +3 -3
  195. package/dist/middleware/rate-limiter-global.d.ts +5 -0
  196. package/dist/middleware/rate-limiter-global.js +48 -0
  197. package/dist/middleware/{rate-limiter.d.ts → rate-limiter-ip.d.ts} +2 -2
  198. package/dist/middleware/{rate-limiter.js → rate-limiter-ip.js} +3 -3
  199. package/dist/middleware/respond.d.ts +1 -1
  200. package/dist/middleware/respond.js +6 -7
  201. package/dist/middleware/sanitize-query.d.ts +1 -1
  202. package/dist/middleware/schema.d.ts +1 -1
  203. package/dist/middleware/use-collection.d.ts +1 -1
  204. package/dist/operations/condition/index.d.ts +1 -1
  205. package/dist/operations/exec/index.js +14 -3
  206. package/dist/operations/item-create/index.js +1 -2
  207. package/dist/operations/item-delete/index.d.ts +1 -1
  208. package/dist/operations/item-read/index.d.ts +1 -1
  209. package/dist/operations/item-update/index.d.ts +1 -1
  210. package/dist/operations/item-update/index.js +1 -2
  211. package/dist/operations/notification/index.js +1 -2
  212. package/dist/operations/request/index.js +19 -19
  213. package/dist/operations/trigger/index.js +2 -3
  214. package/dist/rate-limiter.d.ts +1 -1
  215. package/dist/rate-limiter.js +8 -8
  216. package/dist/server.js +8 -9
  217. package/dist/services/activity.d.ts +1 -1
  218. package/dist/services/activity.js +7 -6
  219. package/dist/services/assets.d.ts +3 -3
  220. package/dist/services/assets.js +33 -35
  221. package/dist/services/authentication.d.ts +2 -2
  222. package/dist/services/authentication.js +13 -10
  223. package/dist/services/authorization.d.ts +3 -3
  224. package/dist/services/authorization.js +27 -31
  225. package/dist/services/collections.d.ts +5 -5
  226. package/dist/services/collections.js +52 -48
  227. package/dist/services/dashboards.d.ts +1 -1
  228. package/dist/services/fields.d.ts +5 -5
  229. package/dist/services/fields.js +48 -48
  230. package/dist/services/files.d.ts +1 -2
  231. package/dist/services/files.js +27 -21
  232. package/dist/services/flows.d.ts +2 -2
  233. package/dist/services/folders.d.ts +1 -1
  234. package/dist/services/graphql/index.d.ts +4 -4
  235. package/dist/services/graphql/index.js +172 -167
  236. package/dist/services/graphql/utils/add-path-to-validation-error.js +1 -2
  237. package/dist/services/graphql/utils/process-error.d.ts +2 -2
  238. package/dist/services/graphql/utils/process-error.js +11 -4
  239. package/dist/services/import-export.d.ts +3 -3
  240. package/dist/services/import-export.js +25 -22
  241. package/dist/services/items.d.ts +3 -3
  242. package/dist/services/items.js +42 -36
  243. package/dist/services/mail/index.d.ts +4 -4
  244. package/dist/services/mail/index.js +9 -5
  245. package/dist/services/meta.d.ts +3 -3
  246. package/dist/services/meta.js +10 -9
  247. package/dist/services/notifications.d.ts +3 -3
  248. package/dist/services/notifications.js +7 -6
  249. package/dist/services/operations.d.ts +2 -2
  250. package/dist/services/panels.d.ts +1 -1
  251. package/dist/services/payload.d.ts +3 -3
  252. package/dist/services/payload.js +124 -122
  253. package/dist/services/permissions.d.ts +3 -3
  254. package/dist/services/permissions.js +11 -11
  255. package/dist/services/presets.d.ts +1 -1
  256. package/dist/services/relations.d.ts +6 -6
  257. package/dist/services/relations.js +45 -43
  258. package/dist/services/revisions.d.ts +1 -1
  259. package/dist/services/roles.d.ts +2 -2
  260. package/dist/services/roles.js +2 -2
  261. package/dist/services/schema.d.ts +3 -3
  262. package/dist/services/schema.js +9 -11
  263. package/dist/services/server.d.ts +3 -3
  264. package/dist/services/server.js +69 -13
  265. package/dist/services/settings.d.ts +1 -1
  266. package/dist/services/shares.d.ts +1 -1
  267. package/dist/services/shares.js +5 -6
  268. package/dist/services/specifications.d.ts +4 -4
  269. package/dist/services/specifications.js +132 -116
  270. package/dist/services/tfa.d.ts +2 -2
  271. package/dist/services/tfa.js +7 -5
  272. package/dist/services/users.d.ts +3 -3
  273. package/dist/services/users.js +17 -17
  274. package/dist/services/utils.d.ts +3 -3
  275. package/dist/services/utils.js +10 -8
  276. package/dist/services/webhooks.d.ts +2 -2
  277. package/dist/services/webhooks.js +2 -1
  278. package/dist/types/assets.d.ts +1 -1
  279. package/dist/types/ast.d.ts +1 -1
  280. package/dist/types/auth.d.ts +2 -2
  281. package/dist/types/collection.d.ts +2 -2
  282. package/dist/types/events.d.ts +2 -2
  283. package/dist/types/graphql.d.ts +2 -2
  284. package/dist/types/items.d.ts +3 -3
  285. package/dist/types/services.d.ts +5 -5
  286. package/dist/types/snapshot.d.ts +4 -4
  287. package/dist/utils/apply-diff.d.ts +3 -3
  288. package/dist/utils/apply-diff.js +25 -28
  289. package/dist/utils/apply-query.d.ts +3 -3
  290. package/dist/utils/apply-query.js +8 -11
  291. package/dist/utils/apply-snapshot.d.ts +3 -3
  292. package/dist/utils/apply-snapshot.js +5 -6
  293. package/dist/utils/construct-flow-tree.d.ts +1 -1
  294. package/dist/utils/construct-flow-tree.js +2 -2
  295. package/dist/utils/filter-items.d.ts +1 -1
  296. package/dist/utils/get-accountability-for-role.d.ts +2 -2
  297. package/dist/utils/get-accountability-for-role.js +1 -1
  298. package/dist/utils/get-ast-from-query.d.ts +3 -3
  299. package/dist/utils/get-ast-from-query.js +22 -28
  300. package/dist/utils/get-cache-headers.d.ts +1 -1
  301. package/dist/utils/get-cache-headers.js +3 -4
  302. package/dist/utils/get-cache-key.d.ts +1 -1
  303. package/dist/utils/get-cache-key.js +2 -3
  304. package/dist/utils/get-collection-from-alias.d.ts +1 -1
  305. package/dist/utils/get-column-path.d.ts +2 -2
  306. package/dist/utils/get-column-path.js +3 -4
  307. package/dist/utils/get-column.d.ts +4 -4
  308. package/dist/utils/get-column.js +4 -5
  309. package/dist/utils/get-default-value.d.ts +2 -2
  310. package/dist/utils/get-default-value.js +1 -2
  311. package/dist/utils/get-graphql-query-and-variables.d.ts +1 -1
  312. package/dist/utils/get-graphql-query-and-variables.js +1 -2
  313. package/dist/utils/get-graphql-type.d.ts +2 -2
  314. package/dist/utils/get-graphql-type.js +1 -1
  315. package/dist/utils/get-ip-from-req.d.ts +1 -1
  316. package/dist/utils/get-local-type.d.ts +1 -1
  317. package/dist/utils/get-local-type.js +3 -3
  318. package/dist/utils/get-milliseconds.js +1 -2
  319. package/dist/utils/get-permissions.d.ts +1 -1
  320. package/dist/utils/get-permissions.js +1 -1
  321. package/dist/utils/get-relation-info.d.ts +1 -1
  322. package/dist/utils/get-relation-info.js +3 -5
  323. package/dist/utils/get-relation-type.d.ts +1 -1
  324. package/dist/utils/get-relation-type.js +3 -4
  325. package/dist/utils/get-schema.d.ts +2 -2
  326. package/dist/utils/get-schema.js +19 -21
  327. package/dist/utils/get-snapshot-diff.js +2 -3
  328. package/dist/utils/get-snapshot.d.ts +3 -3
  329. package/dist/utils/get-snapshot.js +6 -8
  330. package/dist/utils/is-directus-jwt.js +1 -1
  331. package/dist/utils/job-queue.js +2 -0
  332. package/dist/utils/jwt.d.ts +1 -1
  333. package/dist/utils/merge-permissions-for-share.d.ts +1 -1
  334. package/dist/utils/merge-permissions-for-share.js +3 -4
  335. package/dist/utils/merge-permissions.d.ts +3 -3
  336. package/dist/utils/redact-header-cookies.d.ts +1 -0
  337. package/dist/utils/redact-header-cookies.js +11 -0
  338. package/dist/utils/redact-header-cookies.test.d.ts +1 -0
  339. package/dist/utils/reduce-schema.d.ts +1 -1
  340. package/dist/utils/reduce-schema.js +12 -12
  341. package/dist/utils/sanitize-query.d.ts +1 -1
  342. package/dist/utils/sanitize-query.js +1 -1
  343. package/dist/utils/sanitize-schema.d.ts +2 -2
  344. package/dist/utils/should-skip-cache.d.ts +7 -0
  345. package/dist/utils/should-skip-cache.js +21 -0
  346. package/dist/utils/should-skip-cache.test.d.ts +1 -0
  347. package/dist/utils/transformations.d.ts +1 -1
  348. package/dist/utils/transformations.js +2 -4
  349. package/dist/utils/url.js +7 -2
  350. package/dist/utils/user-name.d.ts +1 -1
  351. package/dist/utils/validate-diff.js +7 -8
  352. package/dist/utils/validate-keys.d.ts +2 -2
  353. package/dist/utils/validate-keys.js +1 -1
  354. package/dist/utils/validate-query.d.ts +1 -1
  355. package/dist/utils/validate-query.js +2 -2
  356. package/dist/webhooks.js +1 -1
  357. package/package.json +36 -37
  358. package/dist/utils/with-timeout.d.ts +0 -1
  359. package/dist/utils/with-timeout.js +0 -16
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.GraphQLService = void 0;
7
+ const constants_1 = require("@directus/shared/constants");
7
8
  const types_1 = require("@directus/shared/types");
8
9
  const utils_1 = require("@directus/shared/utils");
9
10
  const argon2_1 = __importDefault(require("argon2"));
@@ -11,13 +12,14 @@ const graphql_1 = require("graphql");
11
12
  const graphql_compose_1 = require("graphql-compose");
12
13
  const lodash_1 = require("lodash");
13
14
  const cache_1 = require("../../cache");
14
- const constants_1 = require("../../constants");
15
+ const constants_2 = require("../../constants");
15
16
  const database_1 = __importDefault(require("../../database"));
16
17
  const env_1 = __importDefault(require("../../env"));
17
18
  const exceptions_1 = require("../../exceptions");
18
19
  const extensions_1 = require("../../extensions");
19
20
  const generate_hash_1 = require("../../utils/generate-hash");
20
21
  const get_graphql_type_1 = require("../../utils/get-graphql-type");
22
+ const get_milliseconds_1 = require("../../utils/get-milliseconds");
21
23
  const reduce_schema_1 = require("../../utils/reduce-schema");
22
24
  const sanitize_query_1 = require("../../utils/sanitize-query");
23
25
  const validate_query_1 = require("../../utils/validate-query");
@@ -44,16 +46,14 @@ const tfa_1 = require("../tfa");
44
46
  const users_1 = require("../users");
45
47
  const utils_2 = require("../utils");
46
48
  const webhooks_1 = require("../webhooks");
47
- const process_error_1 = __importDefault(require("./utils/process-error"));
49
+ const bigint_1 = require("./types/bigint");
48
50
  const date_1 = require("./types/date");
49
51
  const geojson_1 = require("./types/geojson");
52
+ const hash_1 = require("./types/hash");
50
53
  const string_or_float_1 = require("./types/string-or-float");
51
54
  const void_1 = require("./types/void");
52
- const constants_2 = require("@directus/shared/constants");
53
- const get_milliseconds_1 = require("../../utils/get-milliseconds");
54
- const bigint_1 = require("./types/bigint");
55
- const hash_1 = require("./types/hash");
56
55
  const add_path_to_validation_error_1 = require("./utils/add-path-to-validation-error");
56
+ const process_error_1 = __importDefault(require("./utils/process-error"));
57
57
  const validationRules = Array.from(graphql_1.specifiedRules);
58
58
  if (env_1.default.GRAPHQL_INTROSPECTION === false) {
59
59
  validationRules.push(graphql_1.NoSchemaIntrospectionCustomRule);
@@ -70,9 +70,13 @@ const SYSTEM_DENY_LIST = [
70
70
  ];
71
71
  const READ_ONLY = ['directus_activity', 'directus_revisions'];
72
72
  class GraphQLService {
73
+ accountability;
74
+ knex;
75
+ schema;
76
+ scope;
73
77
  constructor(options) {
74
- this.accountability = (options === null || options === void 0 ? void 0 : options.accountability) || null;
75
- this.knex = (options === null || options === void 0 ? void 0 : options.knex) || (0, database_1.default)();
78
+ this.accountability = options?.accountability || null;
79
+ this.knex = options?.knex || (0, database_1.default)();
76
80
  this.schema = options.schema;
77
81
  this.scope = options.scope;
78
82
  }
@@ -80,7 +84,6 @@ class GraphQLService {
80
84
  * Execute a GraphQL structure
81
85
  */
82
86
  async execute({ document, variables, operationName, contextValue, }) {
83
- var _a;
84
87
  const schema = this.getSchema();
85
88
  const validationErrors = (0, graphql_1.validate)(schema, document, validationRules).map((validationError) => (0, add_path_to_validation_error_1.addPathToValidationError)(validationError));
86
89
  if (validationErrors.length > 0) {
@@ -99,30 +102,32 @@ class GraphQLService {
99
102
  catch (err) {
100
103
  throw new exceptions_1.InvalidPayloadException('GraphQL execution error.', { graphqlErrors: [err.message] });
101
104
  }
102
- const formattedResult = {
103
- ...result,
104
- errors: (_a = result.errors) === null || _a === void 0 ? void 0 : _a.map((error) => (0, process_error_1.default)(this.accountability, error)),
105
- };
105
+ const formattedResult = {};
106
+ if (result.data)
107
+ formattedResult.data = result.data;
108
+ if (result.errors)
109
+ formattedResult.errors = result.errors.map((error) => (0, process_error_1.default)(this.accountability, error));
110
+ if (result.extensions)
111
+ formattedResult.extensions = result.extensions;
106
112
  return formattedResult;
107
113
  }
108
114
  getSchema(type = 'schema') {
109
- var _a, _b, _c, _d, _e, _f, _g, _h;
110
115
  // eslint-disable-next-line @typescript-eslint/no-this-alias
111
116
  const self = this;
112
117
  const schemaComposer = new graphql_compose_1.SchemaComposer();
113
118
  const schema = {
114
- read: ((_a = this.accountability) === null || _a === void 0 ? void 0 : _a.admin) === true
119
+ read: this.accountability?.admin === true
115
120
  ? this.schema
116
- : (0, reduce_schema_1.reduceSchema)(this.schema, ((_b = this.accountability) === null || _b === void 0 ? void 0 : _b.permissions) || null, ['read']),
117
- create: ((_c = this.accountability) === null || _c === void 0 ? void 0 : _c.admin) === true
121
+ : (0, reduce_schema_1.reduceSchema)(this.schema, this.accountability?.permissions || null, ['read']),
122
+ create: this.accountability?.admin === true
118
123
  ? this.schema
119
- : (0, reduce_schema_1.reduceSchema)(this.schema, ((_d = this.accountability) === null || _d === void 0 ? void 0 : _d.permissions) || null, ['create']),
120
- update: ((_e = this.accountability) === null || _e === void 0 ? void 0 : _e.admin) === true
124
+ : (0, reduce_schema_1.reduceSchema)(this.schema, this.accountability?.permissions || null, ['create']),
125
+ update: this.accountability?.admin === true
121
126
  ? this.schema
122
- : (0, reduce_schema_1.reduceSchema)(this.schema, ((_f = this.accountability) === null || _f === void 0 ? void 0 : _f.permissions) || null, ['update']),
123
- delete: ((_g = this.accountability) === null || _g === void 0 ? void 0 : _g.admin) === true
127
+ : (0, reduce_schema_1.reduceSchema)(this.schema, this.accountability?.permissions || null, ['update']),
128
+ delete: this.accountability?.admin === true
124
129
  ? this.schema
125
- : (0, reduce_schema_1.reduceSchema)(this.schema, ((_h = this.accountability) === null || _h === void 0 ? void 0 : _h.permissions) || null, ['delete']),
130
+ : (0, reduce_schema_1.reduceSchema)(this.schema, this.accountability?.permissions || null, ['delete']),
126
131
  };
127
132
  const { ReadCollectionTypes } = getReadableTypes();
128
133
  const { CreateCollectionTypes, UpdateCollectionTypes, DeleteCollectionTypes } = getWritableTypes();
@@ -218,7 +223,6 @@ class GraphQLService {
218
223
  * as it's fields.
219
224
  */
220
225
  function getTypes(action) {
221
- var _a, _b, _c, _d, _e;
222
226
  const CollectionTypes = {};
223
227
  const CountFunctions = schemaComposer.createObjectTC({
224
228
  name: 'count_functions',
@@ -283,7 +287,7 @@ class GraphQLService {
283
287
  // submitted on updates
284
288
  if (field.nullable === false &&
285
289
  !field.defaultValue &&
286
- !constants_1.GENERATE_SPECIAL.some((flag) => field.special.includes(flag)) &&
290
+ !constants_2.GENERATE_SPECIAL.some((flag) => field.special.includes(flag)) &&
287
291
  action !== 'update') {
288
292
  type = new graphql_1.GraphQLNonNull(type);
289
293
  }
@@ -348,30 +352,28 @@ class GraphQLService {
348
352
  if (relation.related_collection) {
349
353
  if (SYSTEM_DENY_LIST.includes(relation.related_collection))
350
354
  continue;
351
- (_a = CollectionTypes[relation.collection]) === null || _a === void 0 ? void 0 : _a.addFields({
355
+ CollectionTypes[relation.collection]?.addFields({
352
356
  [relation.field]: {
353
357
  type: CollectionTypes[relation.related_collection],
354
358
  resolve: (obj, _, __, info) => {
355
- var _a, _b;
356
- return obj[(_b = (_a = info === null || info === void 0 ? void 0 : info.path) === null || _a === void 0 ? void 0 : _a.key) !== null && _b !== void 0 ? _b : relation.field];
359
+ return obj[info?.path?.key ?? relation.field];
357
360
  },
358
361
  },
359
362
  });
360
- if ((_b = relation.meta) === null || _b === void 0 ? void 0 : _b.one_field) {
361
- (_c = CollectionTypes[relation.related_collection]) === null || _c === void 0 ? void 0 : _c.addFields({
363
+ if (relation.meta?.one_field) {
364
+ CollectionTypes[relation.related_collection]?.addFields({
362
365
  [relation.meta.one_field]: {
363
366
  type: [CollectionTypes[relation.collection]],
364
367
  resolve: (obj, _, __, info) => {
365
- var _a, _b;
366
- return obj[(_b = (_a = info === null || info === void 0 ? void 0 : info.path) === null || _a === void 0 ? void 0 : _a.key) !== null && _b !== void 0 ? _b : relation.meta.one_field];
368
+ return obj[info?.path?.key ?? relation.meta.one_field];
367
369
  },
368
370
  },
369
371
  });
370
372
  }
371
373
  }
372
- else if (((_d = relation.meta) === null || _d === void 0 ? void 0 : _d.one_allowed_collections) && action === 'read') {
374
+ else if (relation.meta?.one_allowed_collections && action === 'read') {
373
375
  // NOTE: There are no union input types in GraphQL, so this only applies to Read actions
374
- (_e = CollectionTypes[relation.collection]) === null || _e === void 0 ? void 0 : _e.addFields({
376
+ CollectionTypes[relation.collection]?.addFields({
375
377
  [relation.field]: {
376
378
  type: new graphql_1.GraphQLUnionType({
377
379
  name: `${relation.collection}_${relation.field}_union`,
@@ -393,8 +395,7 @@ class GraphQLService {
393
395
  },
394
396
  }),
395
397
  resolve: (obj, _, __, info) => {
396
- var _a, _b;
397
- return obj[(_b = (_a = info === null || info === void 0 ? void 0 : info.path) === null || _a === void 0 ? void 0 : _a.key) !== null && _b !== void 0 ? _b : relation.field];
398
+ return obj[info?.path?.key ?? relation.field];
398
399
  },
399
400
  },
400
401
  });
@@ -406,7 +407,6 @@ class GraphQLService {
406
407
  * Create readable types and attach resolvers for each. Also prepares full filter argument structures
407
408
  */
408
409
  function getReadableTypes() {
409
- var _a, _b, _c, _d, _e, _f, _g, _h;
410
410
  const { CollectionTypes: ReadCollectionTypes } = getTypes('read');
411
411
  const ReadableCollectionFilterTypes = {};
412
412
  const AggregatedFunctions = {};
@@ -802,28 +802,8 @@ class GraphQLService {
802
802
  name: `${collection.collection}_aggregated`,
803
803
  fields: AggregateMethods[collection.collection],
804
804
  });
805
- ReadCollectionTypes[collection.collection].addResolver({
805
+ const resolver = {
806
806
  name: collection.collection,
807
- args: collection.singleton
808
- ? undefined
809
- : {
810
- filter: ReadableCollectionFilterTypes[collection.collection],
811
- sort: {
812
- type: new graphql_1.GraphQLList(graphql_1.GraphQLString),
813
- },
814
- limit: {
815
- type: graphql_1.GraphQLInt,
816
- },
817
- offset: {
818
- type: graphql_1.GraphQLInt,
819
- },
820
- page: {
821
- type: graphql_1.GraphQLInt,
822
- },
823
- search: {
824
- type: graphql_1.GraphQLString,
825
- },
826
- },
827
807
  type: collection.singleton
828
808
  ? ReadCollectionTypes[collection.collection]
829
809
  : new graphql_1.GraphQLNonNull(new graphql_1.GraphQLList(new graphql_1.GraphQLNonNull(ReadCollectionTypes[collection.collection].getType()))),
@@ -832,7 +812,28 @@ class GraphQLService {
832
812
  context.data = result;
833
813
  return result;
834
814
  },
835
- });
815
+ };
816
+ if (collection.singleton === false) {
817
+ resolver.args = {
818
+ filter: ReadableCollectionFilterTypes[collection.collection],
819
+ sort: {
820
+ type: new graphql_1.GraphQLList(graphql_1.GraphQLString),
821
+ },
822
+ limit: {
823
+ type: graphql_1.GraphQLInt,
824
+ },
825
+ offset: {
826
+ type: graphql_1.GraphQLInt,
827
+ },
828
+ page: {
829
+ type: graphql_1.GraphQLInt,
830
+ },
831
+ search: {
832
+ type: graphql_1.GraphQLString,
833
+ },
834
+ };
835
+ }
836
+ ReadCollectionTypes[collection.collection].addResolver(resolver);
836
837
  ReadCollectionTypes[collection.collection].addResolver({
837
838
  name: `${collection.collection}_aggregated`,
838
839
  type: new graphql_1.GraphQLNonNull(new graphql_1.GraphQLList(new graphql_1.GraphQLNonNull(AggregatedFunctions[collection.collection].getType()))),
@@ -880,10 +881,10 @@ class GraphQLService {
880
881
  if (relation.related_collection) {
881
882
  if (SYSTEM_DENY_LIST.includes(relation.related_collection))
882
883
  continue;
883
- (_a = ReadableCollectionFilterTypes[relation.collection]) === null || _a === void 0 ? void 0 : _a.addFields({
884
+ ReadableCollectionFilterTypes[relation.collection]?.addFields({
884
885
  [relation.field]: ReadableCollectionFilterTypes[relation.related_collection],
885
886
  });
886
- (_b = ReadCollectionTypes[relation.collection]) === null || _b === void 0 ? void 0 : _b.addFieldArgs(relation.field, {
887
+ ReadCollectionTypes[relation.collection]?.addFieldArgs(relation.field, {
887
888
  filter: ReadableCollectionFilterTypes[relation.related_collection],
888
889
  sort: {
889
890
  type: new graphql_1.GraphQLList(graphql_1.GraphQLString),
@@ -901,11 +902,11 @@ class GraphQLService {
901
902
  type: graphql_1.GraphQLString,
902
903
  },
903
904
  });
904
- if ((_c = relation.meta) === null || _c === void 0 ? void 0 : _c.one_field) {
905
- (_d = ReadableCollectionFilterTypes[relation.related_collection]) === null || _d === void 0 ? void 0 : _d.addFields({
905
+ if (relation.meta?.one_field) {
906
+ ReadableCollectionFilterTypes[relation.related_collection]?.addFields({
906
907
  [relation.meta.one_field]: ReadableCollectionFilterTypes[relation.collection],
907
908
  });
908
- (_e = ReadCollectionTypes[relation.related_collection]) === null || _e === void 0 ? void 0 : _e.addFieldArgs(relation.meta.one_field, {
909
+ ReadCollectionTypes[relation.related_collection]?.addFieldArgs(relation.meta.one_field, {
909
910
  filter: ReadableCollectionFilterTypes[relation.collection],
910
911
  sort: {
911
912
  type: new graphql_1.GraphQLList(graphql_1.GraphQLString),
@@ -925,10 +926,10 @@ class GraphQLService {
925
926
  });
926
927
  }
927
928
  }
928
- else if ((_f = relation.meta) === null || _f === void 0 ? void 0 : _f.one_allowed_collections) {
929
- (_g = ReadableCollectionFilterTypes[relation.collection]) === null || _g === void 0 ? void 0 : _g.removeField('item');
929
+ else if (relation.meta?.one_allowed_collections) {
930
+ ReadableCollectionFilterTypes[relation.collection]?.removeField('item');
930
931
  for (const collection of relation.meta.one_allowed_collections) {
931
- (_h = ReadableCollectionFilterTypes[relation.collection]) === null || _h === void 0 ? void 0 : _h.addFields({
932
+ ReadableCollectionFilterTypes[relation.collection]?.addFields({
932
933
  [`item__${collection}`]: ReadableCollectionFilterTypes[collection],
933
934
  });
934
935
  }
@@ -937,7 +938,6 @@ class GraphQLService {
937
938
  return { ReadCollectionTypes, ReadableCollectionFilterTypes };
938
939
  }
939
940
  function getWritableTypes() {
940
- var _a, _b;
941
941
  const { CollectionTypes: CreateCollectionTypes } = getTypes('create');
942
942
  const { CollectionTypes: UpdateCollectionTypes } = getTypes('update');
943
943
  const DeleteCollectionTypes = {};
@@ -949,18 +949,21 @@ class GraphQLService {
949
949
  if (collection.collection in CreateCollectionTypes === false)
950
950
  continue;
951
951
  const collectionIsReadable = collection.collection in ReadCollectionTypes;
952
- const creatableFields = ((_a = CreateCollectionTypes[collection.collection]) === null || _a === void 0 ? void 0 : _a.getFields()) || {};
952
+ const creatableFields = CreateCollectionTypes[collection.collection]?.getFields() || {};
953
953
  if (Object.keys(creatableFields).length > 0) {
954
- CreateCollectionTypes[collection.collection].addResolver({
954
+ const resolverDefinition = {
955
955
  name: `create_${collection.collection}_items`,
956
956
  type: collectionIsReadable
957
957
  ? new graphql_1.GraphQLNonNull(new graphql_1.GraphQLList(new graphql_1.GraphQLNonNull(ReadCollectionTypes[collection.collection].getType())))
958
958
  : graphql_1.GraphQLBoolean,
959
- args: collectionIsReadable
960
- ? ReadCollectionTypes[collection.collection].getResolver(collection.collection).getArgs()
961
- : undefined,
962
959
  resolve: async ({ args, info }) => await self.resolveMutation(args, info),
963
- });
960
+ };
961
+ if (collectionIsReadable) {
962
+ resolverDefinition.args = ReadCollectionTypes[collection.collection]
963
+ .getResolver(collection.collection)
964
+ .getArgs();
965
+ }
966
+ CreateCollectionTypes[collection.collection].addResolver(resolverDefinition);
964
967
  CreateCollectionTypes[collection.collection].addResolver({
965
968
  name: `create_${collection.collection}_item`,
966
969
  type: collectionIsReadable ? ReadCollectionTypes[collection.collection] : graphql_1.GraphQLBoolean,
@@ -990,7 +993,7 @@ class GraphQLService {
990
993
  if (collection.collection in UpdateCollectionTypes === false)
991
994
  continue;
992
995
  const collectionIsReadable = collection.collection in ReadCollectionTypes;
993
- const updatableFields = ((_b = UpdateCollectionTypes[collection.collection]) === null || _b === void 0 ? void 0 : _b.getFields()) || {};
996
+ const updatableFields = UpdateCollectionTypes[collection.collection]?.getFields() || {};
994
997
  if (Object.keys(updatableFields).length > 0) {
995
998
  if (collection.singleton) {
996
999
  UpdateCollectionTypes[collection.collection].addResolver({
@@ -1082,11 +1085,10 @@ class GraphQLService {
1082
1085
  * Directus' query structure which is then executed by the services.
1083
1086
  */
1084
1087
  async resolveQuery(info) {
1085
- var _a, _b, _c, _d;
1086
1088
  let collection = info.fieldName;
1087
1089
  if (this.scope === 'system')
1088
1090
  collection = `directus_${collection}`;
1089
- const selections = this.replaceFragmentsInSelections((_b = (_a = info.fieldNodes[0]) === null || _a === void 0 ? void 0 : _a.selectionSet) === null || _b === void 0 ? void 0 : _b.selections, info.fragments);
1091
+ const selections = this.replaceFragmentsInSelections(info.fieldNodes[0]?.selectionSet?.selections, info.fragments);
1090
1092
  if (!selections)
1091
1093
  return null;
1092
1094
  const args = this.parseArgs(info.fieldNodes[0].arguments || [], info.variableValues);
@@ -1116,18 +1118,18 @@ class GraphQLService {
1116
1118
  query.limit = 1;
1117
1119
  }
1118
1120
  // Transform count(a.b.c) into a.b.count(c)
1119
- if ((_c = query.fields) === null || _c === void 0 ? void 0 : _c.length) {
1121
+ if (query.fields?.length) {
1120
1122
  for (let fieldIndex = 0; fieldIndex < query.fields.length; fieldIndex++) {
1121
1123
  query.fields[fieldIndex] = (0, utils_1.parseFilterFunctionPath)(query.fields[fieldIndex]);
1122
1124
  }
1123
1125
  }
1124
1126
  const result = await this.read(collection, query);
1125
1127
  if (args.id) {
1126
- return (result === null || result === void 0 ? void 0 : result[0]) || null;
1128
+ return result?.[0] || null;
1127
1129
  }
1128
1130
  if (query.group) {
1129
1131
  // for every entry in result add a group field based on query.group;
1130
- const aggregateKeys = Object.keys((_d = query.aggregate) !== null && _d !== void 0 ? _d : {});
1132
+ const aggregateKeys = Object.keys(query.aggregate ?? {});
1131
1133
  result.map((field) => {
1132
1134
  field.group = (0, lodash_1.omit)(field, aggregateKeys);
1133
1135
  });
@@ -1135,12 +1137,11 @@ class GraphQLService {
1135
1137
  return result;
1136
1138
  }
1137
1139
  async resolveMutation(args, info) {
1138
- var _a, _b;
1139
1140
  const action = info.fieldName.split('_')[0];
1140
1141
  let collection = info.fieldName.substring(action.length + 1);
1141
1142
  if (this.scope === 'system')
1142
1143
  collection = `directus_${collection}`;
1143
- const selections = this.replaceFragmentsInSelections((_b = (_a = info.fieldNodes[0]) === null || _a === void 0 ? void 0 : _a.selectionSet) === null || _b === void 0 ? void 0 : _b.selections, info.fragments);
1144
+ const selections = this.replaceFragmentsInSelections(info.fieldNodes[0]?.selectionSet?.selections, info.fragments);
1144
1145
  const query = this.getQuery(args, selections || [], info.variableValues);
1145
1146
  const singleton = collection.endsWith('_batch') === false &&
1146
1147
  collection.endsWith('_items') === false &&
@@ -1268,12 +1269,11 @@ class GraphQLService {
1268
1269
  getQuery(rawQuery, selections, variableValues) {
1269
1270
  const query = (0, sanitize_query_1.sanitizeQuery)(rawQuery, this.accountability);
1270
1271
  const parseAliases = (selections) => {
1271
- var _a;
1272
1272
  const aliases = {};
1273
1273
  for (const selection of selections) {
1274
1274
  if (selection.kind !== 'Field')
1275
1275
  continue;
1276
- if ((_a = selection.alias) === null || _a === void 0 ? void 0 : _a.value) {
1276
+ if (selection.alias?.value) {
1277
1277
  aliases[selection.alias.value] = selection.name.value;
1278
1278
  }
1279
1279
  }
@@ -1329,7 +1329,7 @@ class GraphQLService {
1329
1329
  }
1330
1330
  }
1331
1331
  else {
1332
- children = parseFields(selection.selectionSet.selections, currentAlias !== null && currentAlias !== void 0 ? currentAlias : current);
1332
+ children = parseFields(selection.selectionSet.selections, currentAlias ?? current);
1333
1333
  }
1334
1334
  fields.push(...children);
1335
1335
  }
@@ -1341,7 +1341,7 @@ class GraphQLService {
1341
1341
  if (!query.deep)
1342
1342
  query.deep = {};
1343
1343
  const args = this.parseArgs(selection.arguments, variableValues);
1344
- (0, lodash_1.set)(query.deep, currentAlias !== null && currentAlias !== void 0 ? currentAlias : current, (0, lodash_1.merge)({}, (0, lodash_1.get)(query.deep, currentAlias !== null && currentAlias !== void 0 ? currentAlias : current), (0, lodash_1.mapKeys)((0, sanitize_query_1.sanitizeQuery)(args, this.accountability), (value, key) => `_${key}`)));
1344
+ (0, lodash_1.set)(query.deep, currentAlias ?? current, (0, lodash_1.merge)({}, (0, lodash_1.get)(query.deep, currentAlias ?? current), (0, lodash_1.mapKeys)((0, sanitize_query_1.sanitizeQuery)(args, this.accountability), (value, key) => `_${key}`)));
1345
1345
  }
1346
1346
  }
1347
1347
  }
@@ -1349,7 +1349,8 @@ class GraphQLService {
1349
1349
  };
1350
1350
  query.alias = parseAliases(selections);
1351
1351
  query.fields = parseFields(selections);
1352
- query.filter = this.replaceFuncs(query.filter);
1352
+ if (query.filter)
1353
+ query.filter = this.replaceFuncs(query.filter);
1353
1354
  query.deep = this.replaceFuncs(query.deep);
1354
1355
  (0, validate_query_1.validateQuery)(query);
1355
1356
  return query;
@@ -1358,7 +1359,6 @@ class GraphQLService {
1358
1359
  * Resolve the aggregation query based on the requested aggregated fields
1359
1360
  */
1360
1361
  getAggregateQuery(rawQuery, selections) {
1361
- var _a, _b;
1362
1362
  const query = (0, sanitize_query_1.sanitizeQuery)(rawQuery, this.accountability);
1363
1363
  query.aggregate = {};
1364
1364
  for (let aggregationGroup of selections) {
@@ -1370,12 +1370,17 @@ class GraphQLService {
1370
1370
  continue;
1371
1371
  const aggregateProperty = aggregationGroup.name.value;
1372
1372
  query.aggregate[aggregateProperty] =
1373
- (_b = (_a = aggregationGroup.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.filter((selectionNode) => !(selectionNode === null || selectionNode === void 0 ? void 0 : selectionNode.name.value.startsWith('__'))).map((selectionNode) => {
1373
+ aggregationGroup.selectionSet?.selections
1374
+ // filter out graphql pointers, like __typename
1375
+ .filter((selectionNode) => !selectionNode?.name.value.startsWith('__'))
1376
+ .map((selectionNode) => {
1374
1377
  selectionNode = selectionNode;
1375
1378
  return selectionNode.name.value;
1376
- })) !== null && _b !== void 0 ? _b : [];
1379
+ }) ?? [];
1380
+ }
1381
+ if (query.filter) {
1382
+ query.filter = this.replaceFuncs(query.filter);
1377
1383
  }
1378
- query.filter = this.replaceFuncs(query.filter);
1379
1384
  (0, validate_query_1.validateQuery)(query);
1380
1385
  return query;
1381
1386
  }
@@ -1383,19 +1388,17 @@ class GraphQLService {
1383
1388
  * Replace functions from GraphQL format to Directus-Filter format
1384
1389
  */
1385
1390
  replaceFuncs(filter) {
1386
- if (!filter)
1387
- return filter;
1388
1391
  return replaceFuncDeep(filter);
1389
1392
  function replaceFuncDeep(filter) {
1390
1393
  return (0, lodash_1.transform)(filter, (result, value, key) => {
1391
- const isFunctionKey = typeof key === 'string' && key.endsWith('_func') && constants_2.FUNCTIONS.includes(Object.keys(value)[0]);
1394
+ const isFunctionKey = typeof key === 'string' && key.endsWith('_func') && constants_1.FUNCTIONS.includes(Object.keys(value)[0]);
1392
1395
  if (isFunctionKey) {
1393
1396
  const functionName = Object.keys(value)[0];
1394
1397
  const fieldName = key.slice(0, -5);
1395
1398
  result[`${functionName}(${fieldName})`] = Object.values(value)[0];
1396
1399
  }
1397
1400
  else {
1398
- result[key] = (value === null || value === void 0 ? void 0 : value.constructor) === Object || (value === null || value === void 0 ? void 0 : value.constructor) === Array ? replaceFuncDeep(value) : value;
1401
+ result[key] = value?.constructor === Object || value?.constructor === Array ? replaceFuncDeep(value) : value;
1399
1402
  }
1400
1403
  });
1401
1404
  }
@@ -1475,7 +1478,6 @@ class GraphQLService {
1475
1478
  return result;
1476
1479
  }
1477
1480
  injectSystemResolvers(schemaComposer, { CreateCollectionTypes, ReadCollectionTypes, UpdateCollectionTypes, DeleteCollectionTypes, }, schema) {
1478
- var _a, _b, _c, _d, _e, _f;
1479
1481
  const AuthTokens = schemaComposer.createObjectTC({
1480
1482
  name: 'auth_tokens',
1481
1483
  fields: {
@@ -1503,7 +1505,7 @@ class GraphQLService {
1503
1505
  custom_css: { type: graphql_1.GraphQLString },
1504
1506
  },
1505
1507
  });
1506
- if (((_a = this.accountability) === null || _a === void 0 ? void 0 : _a.admin) === true) {
1508
+ if (this.accountability?.admin === true) {
1507
1509
  ServerInfo.addFields({
1508
1510
  directus: {
1509
1511
  type: new graphql_1.GraphQLObjectType({
@@ -1590,11 +1592,10 @@ class GraphQLService {
1590
1592
  }),
1591
1593
  },
1592
1594
  resolve: async (_, args) => {
1593
- var _a;
1594
1595
  const service = new GraphQLService({
1595
1596
  schema: this.schema,
1596
1597
  accountability: this.accountability,
1597
- scope: (_a = args.scope) !== null && _a !== void 0 ? _a : 'items',
1598
+ scope: args.scope ?? 'items',
1598
1599
  });
1599
1600
  return service.getSchema('sdl');
1600
1601
  },
@@ -1646,24 +1647,26 @@ class GraphQLService {
1646
1647
  otp: graphql_1.GraphQLString,
1647
1648
  },
1648
1649
  resolve: async (_, args, { req, res }) => {
1649
- var _a;
1650
- const accountability = {
1651
- ip: req === null || req === void 0 ? void 0 : req.ip,
1652
- userAgent: req === null || req === void 0 ? void 0 : req.get('user-agent'),
1653
- origin: req === null || req === void 0 ? void 0 : req.get('origin'),
1654
- role: null,
1655
- };
1650
+ const accountability = { role: null };
1651
+ if (req?.ip)
1652
+ accountability.ip = req.ip;
1653
+ const userAgent = req?.get('user-agent');
1654
+ if (userAgent)
1655
+ accountability.userAgent = userAgent;
1656
+ const origin = req?.get('origin');
1657
+ if (origin)
1658
+ accountability.origin = origin;
1656
1659
  const authenticationService = new authentication_1.AuthenticationService({
1657
1660
  accountability: accountability,
1658
1661
  schema: this.schema,
1659
1662
  });
1660
- const result = await authenticationService.login(constants_1.DEFAULT_AUTH_PROVIDER, args, args === null || args === void 0 ? void 0 : args.otp);
1663
+ const result = await authenticationService.login(constants_2.DEFAULT_AUTH_PROVIDER, args, args?.otp);
1661
1664
  if (args.mode === 'cookie') {
1662
- res === null || res === void 0 ? void 0 : res.cookie(env_1.default.REFRESH_TOKEN_COOKIE_NAME, result.refreshToken, {
1665
+ res?.cookie(env_1.default.REFRESH_TOKEN_COOKIE_NAME, result.refreshToken, {
1663
1666
  httpOnly: true,
1664
1667
  domain: env_1.default.REFRESH_TOKEN_COOKIE_DOMAIN,
1665
1668
  maxAge: (0, get_milliseconds_1.getMilliseconds)(env_1.default.REFRESH_TOKEN_TTL),
1666
- secure: (_a = env_1.default.REFRESH_TOKEN_COOKIE_SECURE) !== null && _a !== void 0 ? _a : false,
1669
+ secure: env_1.default.REFRESH_TOKEN_COOKIE_SECURE ?? false,
1667
1670
  sameSite: env_1.default.REFRESH_TOKEN_COOKIE_SAME_SITE || 'strict',
1668
1671
  });
1669
1672
  }
@@ -1681,28 +1684,30 @@ class GraphQLService {
1681
1684
  mode: AuthMode,
1682
1685
  },
1683
1686
  resolve: async (_, args, { req, res }) => {
1684
- var _a;
1685
- const accountability = {
1686
- ip: req === null || req === void 0 ? void 0 : req.ip,
1687
- userAgent: req === null || req === void 0 ? void 0 : req.get('user-agent'),
1688
- origin: req === null || req === void 0 ? void 0 : req.get('origin'),
1689
- role: null,
1690
- };
1687
+ const accountability = { role: null };
1688
+ if (req?.ip)
1689
+ accountability.ip = req.ip;
1690
+ const userAgent = req?.get('user-agent');
1691
+ if (userAgent)
1692
+ accountability.userAgent = userAgent;
1693
+ const origin = req?.get('origin');
1694
+ if (origin)
1695
+ accountability.origin = origin;
1691
1696
  const authenticationService = new authentication_1.AuthenticationService({
1692
1697
  accountability: accountability,
1693
1698
  schema: this.schema,
1694
1699
  });
1695
- const currentRefreshToken = args.refresh_token || (req === null || req === void 0 ? void 0 : req.cookies[env_1.default.REFRESH_TOKEN_COOKIE_NAME]);
1700
+ const currentRefreshToken = args.refresh_token || req?.cookies[env_1.default.REFRESH_TOKEN_COOKIE_NAME];
1696
1701
  if (!currentRefreshToken) {
1697
1702
  throw new exceptions_1.InvalidPayloadException(`"refresh_token" is required in either the JSON payload or Cookie`);
1698
1703
  }
1699
1704
  const result = await authenticationService.refresh(currentRefreshToken);
1700
1705
  if (args.mode === 'cookie') {
1701
- res === null || res === void 0 ? void 0 : res.cookie(env_1.default.REFRESH_TOKEN_COOKIE_NAME, result.refreshToken, {
1706
+ res?.cookie(env_1.default.REFRESH_TOKEN_COOKIE_NAME, result.refreshToken, {
1702
1707
  httpOnly: true,
1703
1708
  domain: env_1.default.REFRESH_TOKEN_COOKIE_DOMAIN,
1704
1709
  maxAge: (0, get_milliseconds_1.getMilliseconds)(env_1.default.REFRESH_TOKEN_TTL),
1705
- secure: (_a = env_1.default.REFRESH_TOKEN_COOKIE_SECURE) !== null && _a !== void 0 ? _a : false,
1710
+ secure: env_1.default.REFRESH_TOKEN_COOKIE_SECURE ?? false,
1706
1711
  sameSite: env_1.default.REFRESH_TOKEN_COOKIE_SAME_SITE || 'strict',
1707
1712
  });
1708
1713
  }
@@ -1719,17 +1724,20 @@ class GraphQLService {
1719
1724
  refresh_token: graphql_1.GraphQLString,
1720
1725
  },
1721
1726
  resolve: async (_, args, { req }) => {
1722
- const accountability = {
1723
- ip: req === null || req === void 0 ? void 0 : req.ip,
1724
- userAgent: req === null || req === void 0 ? void 0 : req.get('user-agent'),
1725
- origin: req === null || req === void 0 ? void 0 : req.get('origin'),
1726
- role: null,
1727
- };
1727
+ const accountability = { role: null };
1728
+ if (req?.ip)
1729
+ accountability.ip = req.ip;
1730
+ const userAgent = req?.get('user-agent');
1731
+ if (userAgent)
1732
+ accountability.userAgent = userAgent;
1733
+ const origin = req?.get('origin');
1734
+ if (origin)
1735
+ accountability.origin = origin;
1728
1736
  const authenticationService = new authentication_1.AuthenticationService({
1729
1737
  accountability: accountability,
1730
1738
  schema: this.schema,
1731
1739
  });
1732
- const currentRefreshToken = args.refresh_token || (req === null || req === void 0 ? void 0 : req.cookies[env_1.default.REFRESH_TOKEN_COOKIE_NAME]);
1740
+ const currentRefreshToken = args.refresh_token || req?.cookies[env_1.default.REFRESH_TOKEN_COOKIE_NAME];
1733
1741
  if (!currentRefreshToken) {
1734
1742
  throw new exceptions_1.InvalidPayloadException(`"refresh_token" is required in either the JSON payload or Cookie`);
1735
1743
  }
@@ -1744,12 +1752,15 @@ class GraphQLService {
1744
1752
  reset_url: graphql_1.GraphQLString,
1745
1753
  },
1746
1754
  resolve: async (_, args, { req }) => {
1747
- const accountability = {
1748
- ip: req === null || req === void 0 ? void 0 : req.ip,
1749
- userAgent: req === null || req === void 0 ? void 0 : req.get('user-agent'),
1750
- origin: req === null || req === void 0 ? void 0 : req.get('origin'),
1751
- role: null,
1752
- };
1755
+ const accountability = { role: null };
1756
+ if (req?.ip)
1757
+ accountability.ip = req.ip;
1758
+ const userAgent = req?.get('user-agent');
1759
+ if (userAgent)
1760
+ accountability.userAgent = userAgent;
1761
+ const origin = req?.get('origin');
1762
+ if (origin)
1763
+ accountability.origin = origin;
1753
1764
  const service = new users_1.UsersService({ accountability, schema: this.schema });
1754
1765
  try {
1755
1766
  await service.requestPasswordReset(args.email, args.reset_url || null);
@@ -1769,12 +1780,15 @@ class GraphQLService {
1769
1780
  password: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString),
1770
1781
  },
1771
1782
  resolve: async (_, args, { req }) => {
1772
- const accountability = {
1773
- ip: req === null || req === void 0 ? void 0 : req.ip,
1774
- userAgent: req === null || req === void 0 ? void 0 : req.get('user-agent'),
1775
- origin: req === null || req === void 0 ? void 0 : req.get('origin'),
1776
- role: null,
1777
- };
1783
+ const accountability = { role: null };
1784
+ if (req?.ip)
1785
+ accountability.ip = req.ip;
1786
+ const userAgent = req?.get('user-agent');
1787
+ if (userAgent)
1788
+ accountability.userAgent = userAgent;
1789
+ const origin = req?.get('origin');
1790
+ if (origin)
1791
+ accountability.origin = origin;
1778
1792
  const service = new users_1.UsersService({ accountability, schema: this.schema });
1779
1793
  await service.resetPassword(args.token, args.password);
1780
1794
  return true;
@@ -1792,8 +1806,7 @@ class GraphQLService {
1792
1806
  password: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString),
1793
1807
  },
1794
1808
  resolve: async (_, args) => {
1795
- var _a;
1796
- if (!((_a = this.accountability) === null || _a === void 0 ? void 0 : _a.user))
1809
+ if (!this.accountability?.user)
1797
1810
  return null;
1798
1811
  const service = new tfa_1.TFAService({
1799
1812
  accountability: this.accountability,
@@ -1815,8 +1828,7 @@ class GraphQLService {
1815
1828
  secret: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString),
1816
1829
  },
1817
1830
  resolve: async (_, args) => {
1818
- var _a;
1819
- if (!((_a = this.accountability) === null || _a === void 0 ? void 0 : _a.user))
1831
+ if (!this.accountability?.user)
1820
1832
  return null;
1821
1833
  const service = new tfa_1.TFAService({
1822
1834
  accountability: this.accountability,
@@ -1832,8 +1844,7 @@ class GraphQLService {
1832
1844
  otp: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString),
1833
1845
  },
1834
1846
  resolve: async (_, args) => {
1835
- var _a;
1836
- if (!((_a = this.accountability) === null || _a === void 0 ? void 0 : _a.user))
1847
+ if (!this.accountability?.user)
1837
1848
  return null;
1838
1849
  const service = new tfa_1.TFAService({
1839
1850
  accountability: this.accountability,
@@ -1900,12 +1911,11 @@ class GraphQLService {
1900
1911
  utils_cache_clear: {
1901
1912
  type: void_1.GraphQLVoid,
1902
1913
  resolve: async () => {
1903
- var _a;
1904
- if (((_a = this.accountability) === null || _a === void 0 ? void 0 : _a.admin) !== true) {
1914
+ if (this.accountability?.admin !== true) {
1905
1915
  throw new exceptions_1.ForbiddenException();
1906
1916
  }
1907
1917
  const { cache } = (0, cache_1.getCache)();
1908
- await (cache === null || cache === void 0 ? void 0 : cache.clear());
1918
+ await cache?.clear();
1909
1919
  await (0, cache_1.clearSystemCache)();
1910
1920
  return;
1911
1921
  },
@@ -2120,7 +2130,7 @@ class GraphQLService {
2120
2130
  },
2121
2131
  });
2122
2132
  }
2123
- if (((_b = this.accountability) === null || _b === void 0 ? void 0 : _b.admin) === true) {
2133
+ if (this.accountability?.admin === true) {
2124
2134
  schemaComposer.Mutation.addFields({
2125
2135
  create_collections_item: {
2126
2136
  type: Collection,
@@ -2296,18 +2306,17 @@ class GraphQLService {
2296
2306
  users_me: {
2297
2307
  type: ReadCollectionTypes['directus_users'],
2298
2308
  resolve: async (_, args, __, info) => {
2299
- var _a, _b, _c;
2300
- if (!((_a = this.accountability) === null || _a === void 0 ? void 0 : _a.user))
2309
+ if (!this.accountability?.user)
2301
2310
  return null;
2302
2311
  const service = new users_1.UsersService({ schema: this.schema, accountability: this.accountability });
2303
- const selections = this.replaceFragmentsInSelections((_c = (_b = info.fieldNodes[0]) === null || _b === void 0 ? void 0 : _b.selectionSet) === null || _c === void 0 ? void 0 : _c.selections, info.fragments);
2312
+ const selections = this.replaceFragmentsInSelections(info.fieldNodes[0]?.selectionSet?.selections, info.fragments);
2304
2313
  const query = this.getQuery(args, selections || [], info.variableValues);
2305
2314
  return await service.readOne(this.accountability.user, query);
2306
2315
  },
2307
2316
  },
2308
2317
  });
2309
2318
  }
2310
- if ('directus_users' in schema.update.collections && ((_c = this.accountability) === null || _c === void 0 ? void 0 : _c.user)) {
2319
+ if ('directus_users' in schema.update.collections && this.accountability?.user) {
2311
2320
  schemaComposer.Mutation.addFields({
2312
2321
  update_users_me: {
2313
2322
  type: ReadCollectionTypes['directus_users'],
@@ -2315,8 +2324,7 @@ class GraphQLService {
2315
2324
  data: (0, graphql_compose_1.toInputObjectType)(UpdateCollectionTypes['directus_users']),
2316
2325
  },
2317
2326
  resolve: async (_, args, __, info) => {
2318
- var _a, _b, _c;
2319
- if (!((_a = this.accountability) === null || _a === void 0 ? void 0 : _a.user))
2327
+ if (!this.accountability?.user)
2320
2328
  return null;
2321
2329
  const service = new users_1.UsersService({
2322
2330
  schema: this.schema,
@@ -2324,7 +2332,7 @@ class GraphQLService {
2324
2332
  });
2325
2333
  await service.updateOne(this.accountability.user, args.data);
2326
2334
  if ('directus_users' in ReadCollectionTypes) {
2327
- const selections = this.replaceFragmentsInSelections((_c = (_b = info.fieldNodes[0]) === null || _b === void 0 ? void 0 : _b.selectionSet) === null || _c === void 0 ? void 0 : _c.selections, info.fragments);
2335
+ const selections = this.replaceFragmentsInSelections(info.fieldNodes[0]?.selectionSet?.selections, info.fragments);
2328
2336
  const query = this.getQuery(args, selections || [], info.variableValues);
2329
2337
  return await service.readOne(this.accountability.user, query);
2330
2338
  }
@@ -2336,14 +2344,13 @@ class GraphQLService {
2336
2344
  if ('directus_activity' in schema.create.collections) {
2337
2345
  schemaComposer.Mutation.addFields({
2338
2346
  create_comment: {
2339
- type: (_d = ReadCollectionTypes['directus_activity']) !== null && _d !== void 0 ? _d : graphql_1.GraphQLBoolean,
2347
+ type: ReadCollectionTypes['directus_activity'] ?? graphql_1.GraphQLBoolean,
2340
2348
  args: {
2341
2349
  collection: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString),
2342
2350
  item: new graphql_1.GraphQLNonNull(graphql_1.GraphQLID),
2343
2351
  comment: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString),
2344
2352
  },
2345
2353
  resolve: async (_, args, __, info) => {
2346
- var _a, _b, _c, _d, _e, _f;
2347
2354
  const service = new activity_1.ActivityService({
2348
2355
  accountability: this.accountability,
2349
2356
  schema: this.schema,
@@ -2351,13 +2358,13 @@ class GraphQLService {
2351
2358
  const primaryKey = await service.createOne({
2352
2359
  ...args,
2353
2360
  action: types_1.Action.COMMENT,
2354
- user: (_a = this.accountability) === null || _a === void 0 ? void 0 : _a.user,
2355
- ip: (_b = this.accountability) === null || _b === void 0 ? void 0 : _b.ip,
2356
- user_agent: (_c = this.accountability) === null || _c === void 0 ? void 0 : _c.userAgent,
2357
- origin: (_d = this.accountability) === null || _d === void 0 ? void 0 : _d.origin,
2361
+ user: this.accountability?.user,
2362
+ ip: this.accountability?.ip,
2363
+ user_agent: this.accountability?.userAgent,
2364
+ origin: this.accountability?.origin,
2358
2365
  });
2359
2366
  if ('directus_activity' in ReadCollectionTypes) {
2360
- const selections = this.replaceFragmentsInSelections((_f = (_e = info.fieldNodes[0]) === null || _e === void 0 ? void 0 : _e.selectionSet) === null || _f === void 0 ? void 0 : _f.selections, info.fragments);
2367
+ const selections = this.replaceFragmentsInSelections(info.fieldNodes[0]?.selectionSet?.selections, info.fragments);
2361
2368
  const query = this.getQuery(args, selections || [], info.variableValues);
2362
2369
  return await service.readOne(primaryKey, query);
2363
2370
  }
@@ -2369,20 +2376,19 @@ class GraphQLService {
2369
2376
  if ('directus_activity' in schema.update.collections) {
2370
2377
  schemaComposer.Mutation.addFields({
2371
2378
  update_comment: {
2372
- type: (_e = ReadCollectionTypes['directus_activity']) !== null && _e !== void 0 ? _e : graphql_1.GraphQLBoolean,
2379
+ type: ReadCollectionTypes['directus_activity'] ?? graphql_1.GraphQLBoolean,
2373
2380
  args: {
2374
2381
  id: new graphql_1.GraphQLNonNull(graphql_1.GraphQLID),
2375
2382
  comment: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString),
2376
2383
  },
2377
2384
  resolve: async (_, args, __, info) => {
2378
- var _a, _b;
2379
2385
  const service = new activity_1.ActivityService({
2380
2386
  accountability: this.accountability,
2381
2387
  schema: this.schema,
2382
2388
  });
2383
2389
  const primaryKey = await service.updateOne(args.id, { comment: args.comment });
2384
2390
  if ('directus_activity' in ReadCollectionTypes) {
2385
- const selections = this.replaceFragmentsInSelections((_b = (_a = info.fieldNodes[0]) === null || _a === void 0 ? void 0 : _a.selectionSet) === null || _b === void 0 ? void 0 : _b.selections, info.fragments);
2391
+ const selections = this.replaceFragmentsInSelections(info.fieldNodes[0]?.selectionSet?.selections, info.fragments);
2386
2392
  const query = this.getQuery(args, selections || [], info.variableValues);
2387
2393
  return await service.readOne(primaryKey, query);
2388
2394
  }
@@ -2412,20 +2418,19 @@ class GraphQLService {
2412
2418
  if ('directus_files' in schema.create.collections) {
2413
2419
  schemaComposer.Mutation.addFields({
2414
2420
  import_file: {
2415
- type: (_f = ReadCollectionTypes['directus_files']) !== null && _f !== void 0 ? _f : graphql_1.GraphQLBoolean,
2421
+ type: ReadCollectionTypes['directus_files'] ?? graphql_1.GraphQLBoolean,
2416
2422
  args: {
2417
2423
  url: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString),
2418
2424
  data: (0, graphql_compose_1.toInputObjectType)(CreateCollectionTypes['directus_files']).setTypeName('create_directus_files_input'),
2419
2425
  },
2420
2426
  resolve: async (_, args, __, info) => {
2421
- var _a, _b;
2422
2427
  const service = new files_1.FilesService({
2423
2428
  accountability: this.accountability,
2424
2429
  schema: this.schema,
2425
2430
  });
2426
2431
  const primaryKey = await service.importOne(args.url, args.data);
2427
2432
  if ('directus_files' in ReadCollectionTypes) {
2428
- const selections = this.replaceFragmentsInSelections((_b = (_a = info.fieldNodes[0]) === null || _a === void 0 ? void 0 : _a.selectionSet) === null || _b === void 0 ? void 0 : _b.selections, info.fragments);
2433
+ const selections = this.replaceFragmentsInSelections(info.fieldNodes[0]?.selectionSet?.selections, info.fragments);
2429
2434
  const query = this.getQuery(args, selections || [], info.variableValues);
2430
2435
  return await service.readOne(primaryKey, query);
2431
2436
  }