@seshuk/payload-plugin-openapi 0.2.1 → 1.0.0-beta.1
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.
- package/README.md +67 -25
- package/dist/_tooling/telemetry.js +168 -0
- package/dist/_tooling/telemetry.js.map +1 -0
- package/dist/cli/generateSpec.d.ts +2 -0
- package/dist/cli/generateSpec.js +40 -0
- package/dist/cli/generateSpec.js.map +1 -0
- package/dist/index.d.ts +8 -9
- package/dist/index.js +76 -65
- package/dist/index.js.map +1 -0
- package/dist/{endpoints → server/endpoints}/interactiveAuth.d.ts +2 -2
- package/dist/server/endpoints/interactiveAuth.js +25 -0
- package/dist/server/endpoints/interactiveAuth.js.map +1 -0
- package/dist/server/endpoints/spec.d.ts +5 -0
- package/dist/server/endpoints/spec.js +39 -0
- package/dist/server/endpoints/spec.js.map +1 -0
- package/dist/server/options/resolveOptions.d.ts +4 -0
- package/dist/server/options/resolveOptions.js +65 -0
- package/dist/server/options/resolveOptions.js.map +1 -0
- package/dist/server/spec/build.d.ts +14 -0
- package/dist/server/spec/build.js +40 -0
- package/dist/server/spec/build.js.map +1 -0
- package/dist/server/spec/buildDocument.d.ts +16 -0
- package/dist/server/spec/buildDocument.js +287 -0
- package/dist/server/spec/buildDocument.js.map +1 -0
- package/dist/server/spec/components.d.ts +61 -0
- package/dist/server/spec/components.js +265 -0
- package/dist/server/spec/components.js.map +1 -0
- package/dist/{spec → server/spec}/downconvert.d.ts +2 -1
- package/dist/server/spec/downconvert.js +69 -0
- package/dist/server/spec/downconvert.js.map +1 -0
- package/dist/server/spec/entitySchemas.d.ts +16 -0
- package/dist/server/spec/entitySchemas.js +207 -0
- package/dist/server/spec/entitySchemas.js.map +1 -0
- package/dist/{spec → server/spec}/fields.d.ts +2 -1
- package/dist/server/spec/fields.js +47 -0
- package/dist/server/spec/fields.js.map +1 -0
- package/dist/server/spec/filters.d.ts +12 -0
- package/dist/server/spec/filters.js +91 -0
- package/dist/server/spec/filters.js.map +1 -0
- package/dist/server/spec/hierarchy.d.ts +11 -0
- package/dist/server/spec/hierarchy.js +38 -0
- package/dist/server/spec/hierarchy.js.map +1 -0
- package/dist/{spec → server/spec}/names.d.ts +2 -2
- package/dist/server/spec/names.js +43 -0
- package/dist/server/spec/names.js.map +1 -0
- package/dist/server/spec/params.d.ts +57 -0
- package/dist/server/spec/params.js +394 -0
- package/dist/server/spec/params.js.map +1 -0
- package/dist/server/spec/paths/auth.d.ts +10 -0
- package/dist/server/spec/paths/auth.js +190 -0
- package/dist/server/spec/paths/auth.js.map +1 -0
- package/dist/server/spec/paths/collections.d.ts +11 -0
- package/dist/server/spec/paths/collections.js +314 -0
- package/dist/server/spec/paths/collections.js.map +1 -0
- package/dist/server/spec/paths/custom.d.ts +10 -0
- package/dist/server/spec/paths/custom.js +42 -0
- package/dist/server/spec/paths/custom.js.map +1 -0
- package/dist/server/spec/paths/globals.d.ts +11 -0
- package/dist/server/spec/paths/globals.js +87 -0
- package/dist/server/spec/paths/globals.js.map +1 -0
- package/dist/server/spec/paths/jobs.d.ts +9 -0
- package/dist/server/spec/paths/jobs.js +98 -0
- package/dist/server/spec/paths/jobs.js.map +1 -0
- package/dist/server/spec/paths/system.d.ts +8 -0
- package/dist/server/spec/paths/system.js +137 -0
- package/dist/server/spec/paths/system.js.map +1 -0
- package/dist/server/spec/paths/versions.d.ts +22 -0
- package/dist/server/spec/paths/versions.js +185 -0
- package/dist/server/spec/paths/versions.js.map +1 -0
- package/dist/server/spec/security.d.ts +33 -0
- package/dist/server/spec/security.js +97 -0
- package/dist/server/spec/security.js.map +1 -0
- package/dist/server/spec/tags.d.ts +34 -0
- package/dist/server/spec/tags.js +83 -0
- package/dist/server/spec/tags.js.map +1 -0
- package/dist/server/telemetry.d.ts +31 -0
- package/dist/server/telemetry.js +33 -0
- package/dist/server/telemetry.js.map +1 -0
- package/dist/server/ui/createUiPlugin.d.ts +16 -0
- package/dist/server/ui/createUiPlugin.js +33 -0
- package/dist/server/ui/createUiPlugin.js.map +1 -0
- package/dist/{ui → server/ui}/html.d.ts +5 -3
- package/dist/server/ui/html.js +11 -0
- package/dist/server/ui/html.js.map +1 -0
- package/dist/server/ui/scalar.d.ts +4 -0
- package/dist/server/ui/scalar.js +17 -0
- package/dist/server/ui/scalar.js.map +1 -0
- package/dist/server/ui/swagger.d.ts +4 -0
- package/dist/server/ui/swagger.js +18 -0
- package/dist/server/ui/swagger.js.map +1 -0
- package/dist/shared/constants.d.ts +4 -0
- package/dist/shared/constants.js +6 -0
- package/dist/shared/constants.js.map +1 -0
- package/dist/shared/translations/index.d.ts +5 -0
- package/dist/{translations → shared/translations}/index.js +49 -47
- package/dist/shared/translations/index.js.map +1 -0
- package/dist/shared/translations/locales/ar.d.ts +3 -0
- package/dist/shared/translations/locales/ar.js +99 -0
- package/dist/shared/translations/locales/ar.js.map +1 -0
- package/dist/shared/translations/locales/az.d.ts +3 -0
- package/dist/shared/translations/locales/az.js +99 -0
- package/dist/shared/translations/locales/az.js.map +1 -0
- package/dist/shared/translations/locales/bg.d.ts +3 -0
- package/dist/shared/translations/locales/bg.js +99 -0
- package/dist/shared/translations/locales/bg.js.map +1 -0
- package/dist/shared/translations/locales/bnBd.d.ts +3 -0
- package/dist/shared/translations/locales/bnBd.js +99 -0
- package/dist/shared/translations/locales/bnBd.js.map +1 -0
- package/dist/shared/translations/locales/bnIn.d.ts +3 -0
- package/dist/shared/translations/locales/bnIn.js +99 -0
- package/dist/shared/translations/locales/bnIn.js.map +1 -0
- package/dist/shared/translations/locales/ca.d.ts +3 -0
- package/dist/shared/translations/locales/ca.js +99 -0
- package/dist/shared/translations/locales/ca.js.map +1 -0
- package/dist/shared/translations/locales/cs.d.ts +3 -0
- package/dist/shared/translations/locales/cs.js +99 -0
- package/dist/shared/translations/locales/cs.js.map +1 -0
- package/dist/shared/translations/locales/da.d.ts +3 -0
- package/dist/shared/translations/locales/da.js +99 -0
- package/dist/shared/translations/locales/da.js.map +1 -0
- package/dist/shared/translations/locales/de.d.ts +3 -0
- package/dist/shared/translations/locales/de.js +99 -0
- package/dist/shared/translations/locales/de.js.map +1 -0
- package/dist/shared/translations/locales/en.d.ts +3 -0
- package/dist/shared/translations/locales/en.js +99 -0
- package/dist/shared/translations/locales/en.js.map +1 -0
- package/dist/shared/translations/locales/es.d.ts +3 -0
- package/dist/shared/translations/locales/es.js +99 -0
- package/dist/shared/translations/locales/es.js.map +1 -0
- package/dist/shared/translations/locales/et.d.ts +3 -0
- package/dist/shared/translations/locales/et.js +99 -0
- package/dist/shared/translations/locales/et.js.map +1 -0
- package/dist/shared/translations/locales/fa.d.ts +3 -0
- package/dist/shared/translations/locales/fa.js +99 -0
- package/dist/shared/translations/locales/fa.js.map +1 -0
- package/dist/shared/translations/locales/fr.d.ts +3 -0
- package/dist/shared/translations/locales/fr.js +99 -0
- package/dist/shared/translations/locales/fr.js.map +1 -0
- package/dist/shared/translations/locales/he.d.ts +3 -0
- package/dist/shared/translations/locales/he.js +99 -0
- package/dist/shared/translations/locales/he.js.map +1 -0
- package/dist/shared/translations/locales/hr.d.ts +3 -0
- package/dist/shared/translations/locales/hr.js +99 -0
- package/dist/shared/translations/locales/hr.js.map +1 -0
- package/dist/shared/translations/locales/hu.d.ts +3 -0
- package/dist/shared/translations/locales/hu.js +99 -0
- package/dist/shared/translations/locales/hu.js.map +1 -0
- package/dist/shared/translations/locales/hy.d.ts +3 -0
- package/dist/shared/translations/locales/hy.js +99 -0
- package/dist/shared/translations/locales/hy.js.map +1 -0
- package/dist/shared/translations/locales/id.d.ts +3 -0
- package/dist/shared/translations/locales/id.js +99 -0
- package/dist/shared/translations/locales/id.js.map +1 -0
- package/dist/shared/translations/locales/is.d.ts +3 -0
- package/dist/shared/translations/locales/is.js +99 -0
- package/dist/shared/translations/locales/is.js.map +1 -0
- package/dist/shared/translations/locales/it.d.ts +3 -0
- package/dist/shared/translations/locales/it.js +99 -0
- package/dist/shared/translations/locales/it.js.map +1 -0
- package/dist/shared/translations/locales/ja.d.ts +3 -0
- package/dist/shared/translations/locales/ja.js +99 -0
- package/dist/shared/translations/locales/ja.js.map +1 -0
- package/dist/shared/translations/locales/ko.d.ts +3 -0
- package/dist/shared/translations/locales/ko.js +99 -0
- package/dist/shared/translations/locales/ko.js.map +1 -0
- package/dist/shared/translations/locales/lt.d.ts +3 -0
- package/dist/shared/translations/locales/lt.js +99 -0
- package/dist/shared/translations/locales/lt.js.map +1 -0
- package/dist/shared/translations/locales/lv.d.ts +3 -0
- package/dist/shared/translations/locales/lv.js +99 -0
- package/dist/shared/translations/locales/lv.js.map +1 -0
- package/dist/shared/translations/locales/my.d.ts +3 -0
- package/dist/shared/translations/locales/my.js +99 -0
- package/dist/shared/translations/locales/my.js.map +1 -0
- package/dist/shared/translations/locales/nb.d.ts +3 -0
- package/dist/shared/translations/locales/nb.js +99 -0
- package/dist/shared/translations/locales/nb.js.map +1 -0
- package/dist/shared/translations/locales/nl.d.ts +3 -0
- package/dist/shared/translations/locales/nl.js +99 -0
- package/dist/shared/translations/locales/nl.js.map +1 -0
- package/dist/shared/translations/locales/pl.d.ts +3 -0
- package/dist/shared/translations/locales/pl.js +99 -0
- package/dist/shared/translations/locales/pl.js.map +1 -0
- package/dist/shared/translations/locales/pt.d.ts +3 -0
- package/dist/shared/translations/locales/pt.js +99 -0
- package/dist/shared/translations/locales/pt.js.map +1 -0
- package/dist/shared/translations/locales/ro.d.ts +3 -0
- package/dist/shared/translations/locales/ro.js +99 -0
- package/dist/shared/translations/locales/ro.js.map +1 -0
- package/dist/shared/translations/locales/rs.d.ts +3 -0
- package/dist/shared/translations/locales/rs.js +99 -0
- package/dist/shared/translations/locales/rs.js.map +1 -0
- package/dist/shared/translations/locales/rsLatin.d.ts +3 -0
- package/dist/shared/translations/locales/rsLatin.js +99 -0
- package/dist/shared/translations/locales/rsLatin.js.map +1 -0
- package/dist/shared/translations/locales/ru.d.ts +3 -0
- package/dist/shared/translations/locales/ru.js +99 -0
- package/dist/shared/translations/locales/ru.js.map +1 -0
- package/dist/shared/translations/locales/sk.d.ts +3 -0
- package/dist/shared/translations/locales/sk.js +99 -0
- package/dist/shared/translations/locales/sk.js.map +1 -0
- package/dist/shared/translations/locales/sl.d.ts +3 -0
- package/dist/shared/translations/locales/sl.js +99 -0
- package/dist/shared/translations/locales/sl.js.map +1 -0
- package/dist/shared/translations/locales/sv.d.ts +3 -0
- package/dist/shared/translations/locales/sv.js +99 -0
- package/dist/shared/translations/locales/sv.js.map +1 -0
- package/dist/shared/translations/locales/ta.d.ts +3 -0
- package/dist/shared/translations/locales/ta.js +99 -0
- package/dist/shared/translations/locales/ta.js.map +1 -0
- package/dist/shared/translations/locales/th.d.ts +3 -0
- package/dist/shared/translations/locales/th.js +99 -0
- package/dist/shared/translations/locales/th.js.map +1 -0
- package/dist/shared/translations/locales/tr.d.ts +3 -0
- package/dist/shared/translations/locales/tr.js +99 -0
- package/dist/shared/translations/locales/tr.js.map +1 -0
- package/dist/shared/translations/locales/uk.d.ts +3 -0
- package/dist/shared/translations/locales/uk.js +99 -0
- package/dist/shared/translations/locales/uk.js.map +1 -0
- package/dist/shared/translations/locales/vi.d.ts +3 -0
- package/dist/shared/translations/locales/vi.js +99 -0
- package/dist/shared/translations/locales/vi.js.map +1 -0
- package/dist/shared/translations/locales/zh.d.ts +3 -0
- package/dist/shared/translations/locales/zh.js +99 -0
- package/dist/shared/translations/locales/zh.js.map +1 -0
- package/dist/shared/translations/locales/zhTw.d.ts +3 -0
- package/dist/shared/translations/locales/zhTw.js +99 -0
- package/dist/shared/translations/locales/zhTw.js.map +1 -0
- package/dist/shared/translations/types.d.ts +106 -0
- package/dist/shared/translations/types.js +1 -0
- package/dist/shared/types/index.d.ts +397 -0
- package/dist/shared/types/index.js +1 -0
- package/dist/{utils.d.ts → shared/utils.d.ts} +1 -0
- package/dist/shared/utils.js +13 -0
- package/dist/shared/utils.js.map +1 -0
- package/package.json +67 -56
- package/dist/bin/generateSpec.d.ts +0 -25
- package/dist/bin/generateSpec.js +0 -61
- package/dist/constants.d.ts +0 -1
- package/dist/constants.js +0 -2
- package/dist/endpoints/interactiveAuth.js +0 -27
- package/dist/endpoints/spec.d.ts +0 -5
- package/dist/endpoints/spec.js +0 -39
- package/dist/options.d.ts +0 -2
- package/dist/options.js +0 -45
- package/dist/spec/build.d.ts +0 -14
- package/dist/spec/build.js +0 -36
- package/dist/spec/buildDocument.d.ts +0 -15
- package/dist/spec/buildDocument.js +0 -268
- package/dist/spec/components.d.ts +0 -44
- package/dist/spec/components.js +0 -265
- package/dist/spec/downconvert.js +0 -74
- package/dist/spec/entitySchemas.d.ts +0 -15
- package/dist/spec/entitySchemas.js +0 -250
- package/dist/spec/fields.js +0 -44
- package/dist/spec/filters.d.ts +0 -11
- package/dist/spec/filters.js +0 -83
- package/dist/spec/names.js +0 -37
- package/dist/spec/params.d.ts +0 -55
- package/dist/spec/params.js +0 -436
- package/dist/spec/paths/auth.d.ts +0 -9
- package/dist/spec/paths/auth.js +0 -274
- package/dist/spec/paths/collections.d.ts +0 -9
- package/dist/spec/paths/collections.js +0 -278
- package/dist/spec/paths/custom.d.ts +0 -9
- package/dist/spec/paths/custom.js +0 -41
- package/dist/spec/paths/globals.d.ts +0 -9
- package/dist/spec/paths/globals.js +0 -78
- package/dist/spec/paths/jobs.d.ts +0 -7
- package/dist/spec/paths/jobs.js +0 -130
- package/dist/spec/paths/versions.d.ts +0 -19
- package/dist/spec/paths/versions.js +0 -252
- package/dist/spec/security.d.ts +0 -19
- package/dist/spec/security.js +0 -96
- package/dist/spec/tags.d.ts +0 -27
- package/dist/spec/tags.js +0 -79
- package/dist/translations/index.d.ts +0 -6
- package/dist/translations/locales/ar.d.ts +0 -2
- package/dist/translations/locales/ar.js +0 -81
- package/dist/translations/locales/az.d.ts +0 -2
- package/dist/translations/locales/az.js +0 -81
- package/dist/translations/locales/bg.d.ts +0 -2
- package/dist/translations/locales/bg.js +0 -81
- package/dist/translations/locales/bnBd.d.ts +0 -2
- package/dist/translations/locales/bnBd.js +0 -81
- package/dist/translations/locales/bnIn.d.ts +0 -2
- package/dist/translations/locales/bnIn.js +0 -81
- package/dist/translations/locales/ca.d.ts +0 -2
- package/dist/translations/locales/ca.js +0 -81
- package/dist/translations/locales/cs.d.ts +0 -2
- package/dist/translations/locales/cs.js +0 -81
- package/dist/translations/locales/da.d.ts +0 -2
- package/dist/translations/locales/da.js +0 -81
- package/dist/translations/locales/de.d.ts +0 -2
- package/dist/translations/locales/de.js +0 -81
- package/dist/translations/locales/en.d.ts +0 -2
- package/dist/translations/locales/en.js +0 -81
- package/dist/translations/locales/es.d.ts +0 -2
- package/dist/translations/locales/es.js +0 -81
- package/dist/translations/locales/et.d.ts +0 -2
- package/dist/translations/locales/et.js +0 -81
- package/dist/translations/locales/fa.d.ts +0 -2
- package/dist/translations/locales/fa.js +0 -81
- package/dist/translations/locales/fr.d.ts +0 -2
- package/dist/translations/locales/fr.js +0 -81
- package/dist/translations/locales/he.d.ts +0 -2
- package/dist/translations/locales/he.js +0 -81
- package/dist/translations/locales/hr.d.ts +0 -2
- package/dist/translations/locales/hr.js +0 -81
- package/dist/translations/locales/hu.d.ts +0 -2
- package/dist/translations/locales/hu.js +0 -81
- package/dist/translations/locales/hy.d.ts +0 -2
- package/dist/translations/locales/hy.js +0 -81
- package/dist/translations/locales/id.d.ts +0 -2
- package/dist/translations/locales/id.js +0 -81
- package/dist/translations/locales/is.d.ts +0 -2
- package/dist/translations/locales/is.js +0 -81
- package/dist/translations/locales/it.d.ts +0 -2
- package/dist/translations/locales/it.js +0 -81
- package/dist/translations/locales/ja.d.ts +0 -2
- package/dist/translations/locales/ja.js +0 -81
- package/dist/translations/locales/ko.d.ts +0 -2
- package/dist/translations/locales/ko.js +0 -81
- package/dist/translations/locales/lt.d.ts +0 -2
- package/dist/translations/locales/lt.js +0 -81
- package/dist/translations/locales/lv.d.ts +0 -2
- package/dist/translations/locales/lv.js +0 -81
- package/dist/translations/locales/my.d.ts +0 -2
- package/dist/translations/locales/my.js +0 -81
- package/dist/translations/locales/nb.d.ts +0 -2
- package/dist/translations/locales/nb.js +0 -81
- package/dist/translations/locales/nl.d.ts +0 -2
- package/dist/translations/locales/nl.js +0 -81
- package/dist/translations/locales/pl.d.ts +0 -2
- package/dist/translations/locales/pl.js +0 -81
- package/dist/translations/locales/pt.d.ts +0 -2
- package/dist/translations/locales/pt.js +0 -81
- package/dist/translations/locales/ro.d.ts +0 -2
- package/dist/translations/locales/ro.js +0 -81
- package/dist/translations/locales/rs.d.ts +0 -2
- package/dist/translations/locales/rs.js +0 -81
- package/dist/translations/locales/rsLatin.d.ts +0 -2
- package/dist/translations/locales/rsLatin.js +0 -81
- package/dist/translations/locales/ru.d.ts +0 -2
- package/dist/translations/locales/ru.js +0 -81
- package/dist/translations/locales/sk.d.ts +0 -2
- package/dist/translations/locales/sk.js +0 -81
- package/dist/translations/locales/sl.d.ts +0 -2
- package/dist/translations/locales/sl.js +0 -81
- package/dist/translations/locales/sv.d.ts +0 -2
- package/dist/translations/locales/sv.js +0 -81
- package/dist/translations/locales/ta.d.ts +0 -2
- package/dist/translations/locales/ta.js +0 -81
- package/dist/translations/locales/th.d.ts +0 -2
- package/dist/translations/locales/th.js +0 -81
- package/dist/translations/locales/tr.d.ts +0 -2
- package/dist/translations/locales/tr.js +0 -81
- package/dist/translations/locales/uk.d.ts +0 -2
- package/dist/translations/locales/uk.js +0 -81
- package/dist/translations/locales/vi.d.ts +0 -2
- package/dist/translations/locales/vi.js +0 -81
- package/dist/translations/locales/zh.d.ts +0 -2
- package/dist/translations/locales/zh.js +0 -81
- package/dist/translations/locales/zhTw.d.ts +0 -2
- package/dist/translations/locales/zhTw.js +0 -81
- package/dist/translations/types.d.ts +0 -87
- package/dist/translations/types.js +0 -1
- package/dist/types.d.ts +0 -192
- package/dist/types.js +0 -1
- package/dist/ui/createUiPlugin.d.ts +0 -14
- package/dist/ui/createUiPlugin.js +0 -28
- package/dist/ui/html.js +0 -8
- package/dist/ui/scalar.d.ts +0 -1
- package/dist/ui/scalar.js +0 -12
- package/dist/ui/swagger.d.ts +0 -1
- package/dist/ui/swagger.js +0 -12
- package/dist/utils.js +0 -13
package/dist/spec/filters.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
const SYSTEM_COLLECTIONS = new Set([
|
|
2
|
-
'payload-jobs',
|
|
3
|
-
'payload-locked-documents',
|
|
4
|
-
'payload-preferences',
|
|
5
|
-
'payload-migrations',
|
|
6
|
-
'payload-folders',
|
|
7
|
-
'payload-kv',
|
|
8
|
-
'payload-query-presets'
|
|
9
|
-
]);
|
|
10
|
-
const HTTP_METHODS = [
|
|
11
|
-
'get',
|
|
12
|
-
'post',
|
|
13
|
-
'patch',
|
|
14
|
-
'put',
|
|
15
|
-
'delete'
|
|
16
|
-
];
|
|
17
|
-
const matchesEntity = (matcher, { slug, kind })=>{
|
|
18
|
-
if ('string' == typeof matcher) return matcher === slug;
|
|
19
|
-
if (matcher instanceof RegExp) return matcher.test(slug);
|
|
20
|
-
return matcher.kind === kind && matcher.slug === slug;
|
|
21
|
-
};
|
|
22
|
-
const anyMatch = (matchers, entity)=>matchers.some((m)=>matchesEntity(m, entity));
|
|
23
|
-
const isHiddenCollection = (collection)=>{
|
|
24
|
-
if (true === collection.hidden) return true;
|
|
25
|
-
const hidden = collection.admin?.hidden;
|
|
26
|
-
if ('function' == typeof hidden) try {
|
|
27
|
-
return true === hidden({
|
|
28
|
-
user: null
|
|
29
|
-
});
|
|
30
|
-
} catch {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
return true === hidden;
|
|
34
|
-
};
|
|
35
|
-
const passesIncludeExclude = (entity, filters)=>{
|
|
36
|
-
if (filters.include.length > 0 && !anyMatch(filters.include, entity)) return false;
|
|
37
|
-
if (anyMatch(filters.exclude, entity)) return false;
|
|
38
|
-
return true;
|
|
39
|
-
};
|
|
40
|
-
const shouldIncludeCollection = (collection, filters)=>{
|
|
41
|
-
const { slug } = collection;
|
|
42
|
-
if (SYSTEM_COLLECTIONS.has(slug) && !filters.includeSystem) return false;
|
|
43
|
-
if (!filters.includeHidden && isHiddenCollection(collection)) return false;
|
|
44
|
-
return passesIncludeExclude({
|
|
45
|
-
slug,
|
|
46
|
-
kind: 'collection'
|
|
47
|
-
}, filters);
|
|
48
|
-
};
|
|
49
|
-
const shouldIncludeGlobal = (global, filters)=>passesIncludeExclude({
|
|
50
|
-
slug: global.slug,
|
|
51
|
-
kind: 'global'
|
|
52
|
-
}, filters);
|
|
53
|
-
const ruleMatchesMethod = (rule, method)=>{
|
|
54
|
-
if (void 0 === rule.method) return true;
|
|
55
|
-
return Array.isArray(rule.method) ? rule.method.includes(method) : rule.method === method;
|
|
56
|
-
};
|
|
57
|
-
const ruleMatchesSlug = (rule, slug)=>{
|
|
58
|
-
if (void 0 === rule.slug) return true;
|
|
59
|
-
return rule.slug instanceof RegExp ? rule.slug.test(slug) : rule.slug === slug;
|
|
60
|
-
};
|
|
61
|
-
const ruleMatches = (rule, { method, slug, kind, path })=>ruleMatchesMethod(rule, method) && ruleMatchesSlug(rule, slug) && (void 0 === rule.kind || rule.kind === kind) && (void 0 === rule.path || rule.path.test(path));
|
|
62
|
-
const isOperationExcluded = (filters, op)=>{
|
|
63
|
-
if (filters.excludeOperations.some((rule)=>ruleMatches(rule, op))) return true;
|
|
64
|
-
return filters.excludeWhen?.(op) ?? false;
|
|
65
|
-
};
|
|
66
|
-
const filterOperations = ({ paths, slug, kind, filters })=>{
|
|
67
|
-
if (0 === filters.excludeOperations.length && !filters.excludeWhen) return paths;
|
|
68
|
-
for (const [path, item] of Object.entries(paths)){
|
|
69
|
-
if (!item) continue;
|
|
70
|
-
let remaining = 0;
|
|
71
|
-
const ops = item;
|
|
72
|
-
for (const method of HTTP_METHODS)if (ops[method]) if (isOperationExcluded(filters, {
|
|
73
|
-
method,
|
|
74
|
-
slug,
|
|
75
|
-
kind,
|
|
76
|
-
path
|
|
77
|
-
})) delete ops[method];
|
|
78
|
-
else remaining += 1;
|
|
79
|
-
if (0 === remaining) delete paths[path];
|
|
80
|
-
}
|
|
81
|
-
return paths;
|
|
82
|
-
};
|
|
83
|
-
export { filterOperations, shouldIncludeCollection, shouldIncludeGlobal };
|
package/dist/spec/names.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { upperFirst } from "../utils.js";
|
|
2
|
-
const schemaName = (slug)=>upperFirst(slug.replace(/-([a-z])/g, (_, c)=>c.toUpperCase()));
|
|
3
|
-
const blockSchemaName = (slug)=>{
|
|
4
|
-
const stripped = slug.replace(/^block[-_]?/i, '').replace(/[-_]?block$/i, '');
|
|
5
|
-
return `Block${schemaName(stripped || slug)}`;
|
|
6
|
-
};
|
|
7
|
-
const globalSchemaName = (slug)=>`Global${schemaName(slug)}`;
|
|
8
|
-
const listSchemaName = (base)=>`${base}List`;
|
|
9
|
-
const createSchemaName = (base)=>`${base}Create`;
|
|
10
|
-
const updateSchemaName = (base)=>`${base}Update`;
|
|
11
|
-
const querySchemaName = (base)=>`${base}QueryOperations`;
|
|
12
|
-
const selectSchemaName = (base)=>`${base}Select`;
|
|
13
|
-
const populateSchemaName = (base)=>`${base}Populate`;
|
|
14
|
-
const joinsSchemaName = (base)=>`${base}Joins`;
|
|
15
|
-
const refTo = (name)=>`#/components/schemas/${name}`;
|
|
16
|
-
const REF = /^#\/(?:definitions|\$defs|components\/schemas)\/(.+)$/;
|
|
17
|
-
const normalizeRef = (ref, blockSlugs)=>{
|
|
18
|
-
const match = REF.exec(ref);
|
|
19
|
-
if (!match) return ref;
|
|
20
|
-
const captured = match[1];
|
|
21
|
-
const pascal = schemaName(captured);
|
|
22
|
-
const blockSlug = [
|
|
23
|
-
...blockSlugs
|
|
24
|
-
].find((s)=>s === captured || schemaName(s) === pascal);
|
|
25
|
-
if (blockSlug) return `#/components/schemas/${blockSchemaName(blockSlug)}`;
|
|
26
|
-
return `#/components/schemas/${pascal}`;
|
|
27
|
-
};
|
|
28
|
-
const rewriteRefs = (node, blockSlugs = new Set())=>{
|
|
29
|
-
if (Array.isArray(node)) return node.map((item)=>rewriteRefs(item, blockSlugs));
|
|
30
|
-
if (node && 'object' == typeof node) {
|
|
31
|
-
const out = {};
|
|
32
|
-
for (const [key, value] of Object.entries(node))out[key] = '$ref' === key && 'string' == typeof value ? normalizeRef(value, blockSlugs) : rewriteRefs(value, blockSlugs);
|
|
33
|
-
return out;
|
|
34
|
-
}
|
|
35
|
-
return node;
|
|
36
|
-
};
|
|
37
|
-
export { blockSchemaName, createSchemaName, globalSchemaName, joinsSchemaName, listSchemaName, populateSchemaName, querySchemaName, refTo, rewriteRefs, schemaName, selectSchemaName, updateSchemaName };
|
package/dist/spec/params.d.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { Field } from 'payload';
|
|
2
|
-
import type { ParameterObject, SchemaObject } from '@scalar/openapi-types/3.2';
|
|
3
|
-
import type { BuildContext, Entity } from '../types.js';
|
|
4
|
-
export declare const buildSelectSchema: ({ fields, ctx }: {
|
|
5
|
-
fields: Field[];
|
|
6
|
-
ctx: BuildContext;
|
|
7
|
-
}) => SchemaObject;
|
|
8
|
-
export declare const buildPopulateSchema: ({ fields, ctx, }: {
|
|
9
|
-
fields: Field[];
|
|
10
|
-
ctx: BuildContext;
|
|
11
|
-
}) => SchemaObject | undefined;
|
|
12
|
-
export declare const buildJoinsSchema: ({ fields, ctx }: {
|
|
13
|
-
fields: Field[];
|
|
14
|
-
ctx: BuildContext;
|
|
15
|
-
}) => SchemaObject | undefined;
|
|
16
|
-
export interface ParamSchemas {
|
|
17
|
-
select: SchemaObject;
|
|
18
|
-
populate?: SchemaObject;
|
|
19
|
-
joins?: SchemaObject;
|
|
20
|
-
}
|
|
21
|
-
export declare const buildParamSchemas: ({ fields, ctx }: {
|
|
22
|
-
fields: Field[];
|
|
23
|
-
ctx: BuildContext;
|
|
24
|
-
}) => ParamSchemas;
|
|
25
|
-
export declare const collectionHasFilters: (fields: Field[]) => boolean;
|
|
26
|
-
export declare const buildQueryOperationsSchema: ({ base, fields, ctx, }: {
|
|
27
|
-
base: string;
|
|
28
|
-
fields: Field[];
|
|
29
|
-
ctx: BuildContext;
|
|
30
|
-
}) => SchemaObject;
|
|
31
|
-
export interface ReadParamRefs {
|
|
32
|
-
select: boolean;
|
|
33
|
-
populate: boolean;
|
|
34
|
-
joins: boolean;
|
|
35
|
-
}
|
|
36
|
-
export declare const commonReadParams: ({ base, ctx, refs, }: {
|
|
37
|
-
base: string;
|
|
38
|
-
ctx: BuildContext;
|
|
39
|
-
refs: ReadParamRefs;
|
|
40
|
-
}) => ParameterObject[];
|
|
41
|
-
export type WriteOperation = 'create' | 'update' | 'updateByID' | 'delete' | 'duplicate' | 'globalUpdate';
|
|
42
|
-
export declare const writeParams: ({ base, entity, ctx, refs, operation, }: {
|
|
43
|
-
base: string;
|
|
44
|
-
entity: Entity;
|
|
45
|
-
ctx: BuildContext;
|
|
46
|
-
refs: ReadParamRefs;
|
|
47
|
-
operation: WriteOperation;
|
|
48
|
-
}) => ParameterObject[];
|
|
49
|
-
export declare const whereParam: (base: string) => ParameterObject;
|
|
50
|
-
export declare const buildListParams: ({ base, fields, ctx, refs, }: {
|
|
51
|
-
base: string;
|
|
52
|
-
fields: Field[];
|
|
53
|
-
ctx: BuildContext;
|
|
54
|
-
refs: ReadParamRefs;
|
|
55
|
-
}) => ParameterObject[];
|
package/dist/spec/params.js
DELETED
|
@@ -1,436 +0,0 @@
|
|
|
1
|
-
import { makeT } from "../translations/index.js";
|
|
2
|
-
import { exposableFields } from "./fields.js";
|
|
3
|
-
import { joinsSchemaName, populateSchemaName, querySchemaName, refTo, selectSchemaName } from "./names.js";
|
|
4
|
-
const fieldName = (field)=>'name' in field && 'string' == typeof field.name ? field.name : void 0;
|
|
5
|
-
const relationTargets = (field)=>{
|
|
6
|
-
if ('relationship' !== field.type && 'upload' !== field.type) return [];
|
|
7
|
-
const relTo = field.relationTo;
|
|
8
|
-
return Array.isArray(relTo) ? relTo : [
|
|
9
|
-
relTo
|
|
10
|
-
];
|
|
11
|
-
};
|
|
12
|
-
const buildSelectSchema = ({ fields, ctx })=>{
|
|
13
|
-
const properties = {};
|
|
14
|
-
for (const field of exposableFields(fields)){
|
|
15
|
-
const name = fieldName(field);
|
|
16
|
-
if (name) properties[name] = {
|
|
17
|
-
type: 'boolean'
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
return {
|
|
21
|
-
type: 'object',
|
|
22
|
-
additionalProperties: false,
|
|
23
|
-
description: makeT(ctx.i18n)('schemaSelect'),
|
|
24
|
-
properties
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
const buildPopulateSchema = ({ fields, ctx })=>{
|
|
28
|
-
const targets = new Set();
|
|
29
|
-
for (const field of exposableFields(fields))for (const target of relationTargets(field))targets.add(target);
|
|
30
|
-
if (0 === targets.size) return;
|
|
31
|
-
const properties = {};
|
|
32
|
-
for (const target of targets)properties[target] = {
|
|
33
|
-
type: 'object',
|
|
34
|
-
additionalProperties: {
|
|
35
|
-
type: 'boolean'
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
return {
|
|
39
|
-
type: 'object',
|
|
40
|
-
additionalProperties: false,
|
|
41
|
-
description: makeT(ctx.i18n)('schemaPopulate'),
|
|
42
|
-
properties
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
const buildJoinsSchema = ({ fields, ctx })=>{
|
|
46
|
-
const joinControls = {
|
|
47
|
-
type: 'object',
|
|
48
|
-
additionalProperties: false,
|
|
49
|
-
properties: {
|
|
50
|
-
limit: {
|
|
51
|
-
type: 'integer'
|
|
52
|
-
},
|
|
53
|
-
page: {
|
|
54
|
-
type: 'integer'
|
|
55
|
-
},
|
|
56
|
-
sort: {
|
|
57
|
-
type: 'string'
|
|
58
|
-
},
|
|
59
|
-
count: {
|
|
60
|
-
type: 'boolean'
|
|
61
|
-
},
|
|
62
|
-
where: {
|
|
63
|
-
type: 'object',
|
|
64
|
-
additionalProperties: true
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
const properties = {};
|
|
69
|
-
for (const field of exposableFields(fields)){
|
|
70
|
-
if ('join' !== field.type) continue;
|
|
71
|
-
const name = fieldName(field);
|
|
72
|
-
if (name) properties[name] = joinControls;
|
|
73
|
-
}
|
|
74
|
-
if (0 === Object.keys(properties).length) return;
|
|
75
|
-
return {
|
|
76
|
-
type: 'object',
|
|
77
|
-
additionalProperties: false,
|
|
78
|
-
description: makeT(ctx.i18n)('schemaJoins'),
|
|
79
|
-
properties
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
const buildParamSchemas = ({ fields, ctx })=>({
|
|
83
|
-
select: buildSelectSchema({
|
|
84
|
-
fields,
|
|
85
|
-
ctx
|
|
86
|
-
}),
|
|
87
|
-
populate: buildPopulateSchema({
|
|
88
|
-
fields,
|
|
89
|
-
ctx
|
|
90
|
-
}),
|
|
91
|
-
joins: buildJoinsSchema({
|
|
92
|
-
fields,
|
|
93
|
-
ctx
|
|
94
|
-
})
|
|
95
|
-
});
|
|
96
|
-
const OPERATORS_BY_TYPE = {
|
|
97
|
-
text: [
|
|
98
|
-
'equals',
|
|
99
|
-
'not_equals',
|
|
100
|
-
'like',
|
|
101
|
-
'contains',
|
|
102
|
-
'in',
|
|
103
|
-
'not_in',
|
|
104
|
-
'exists'
|
|
105
|
-
],
|
|
106
|
-
textarea: [
|
|
107
|
-
'equals',
|
|
108
|
-
'not_equals',
|
|
109
|
-
'like',
|
|
110
|
-
'contains',
|
|
111
|
-
'in',
|
|
112
|
-
'not_in',
|
|
113
|
-
'exists'
|
|
114
|
-
],
|
|
115
|
-
email: [
|
|
116
|
-
'equals',
|
|
117
|
-
'not_equals',
|
|
118
|
-
'like',
|
|
119
|
-
'contains',
|
|
120
|
-
'in',
|
|
121
|
-
'not_in',
|
|
122
|
-
'exists'
|
|
123
|
-
],
|
|
124
|
-
code: [
|
|
125
|
-
'equals',
|
|
126
|
-
'not_equals',
|
|
127
|
-
'like',
|
|
128
|
-
'contains',
|
|
129
|
-
'exists'
|
|
130
|
-
],
|
|
131
|
-
number: [
|
|
132
|
-
'equals',
|
|
133
|
-
'not_equals',
|
|
134
|
-
'greater_than',
|
|
135
|
-
'greater_than_equal',
|
|
136
|
-
'less_than',
|
|
137
|
-
'less_than_equal',
|
|
138
|
-
'in',
|
|
139
|
-
'not_in',
|
|
140
|
-
'exists'
|
|
141
|
-
],
|
|
142
|
-
date: [
|
|
143
|
-
'equals',
|
|
144
|
-
'not_equals',
|
|
145
|
-
'greater_than',
|
|
146
|
-
'greater_than_equal',
|
|
147
|
-
'less_than',
|
|
148
|
-
'less_than_equal',
|
|
149
|
-
'exists'
|
|
150
|
-
],
|
|
151
|
-
checkbox: [
|
|
152
|
-
'equals',
|
|
153
|
-
'not_equals',
|
|
154
|
-
'exists'
|
|
155
|
-
],
|
|
156
|
-
radio: [
|
|
157
|
-
'equals',
|
|
158
|
-
'not_equals',
|
|
159
|
-
'in',
|
|
160
|
-
'not_in',
|
|
161
|
-
'exists'
|
|
162
|
-
],
|
|
163
|
-
select: [
|
|
164
|
-
'equals',
|
|
165
|
-
'not_equals',
|
|
166
|
-
'in',
|
|
167
|
-
'not_in',
|
|
168
|
-
'exists'
|
|
169
|
-
],
|
|
170
|
-
relationship: [
|
|
171
|
-
'equals',
|
|
172
|
-
'not_equals',
|
|
173
|
-
'in',
|
|
174
|
-
'not_in',
|
|
175
|
-
'exists'
|
|
176
|
-
],
|
|
177
|
-
upload: [
|
|
178
|
-
'equals',
|
|
179
|
-
'not_equals',
|
|
180
|
-
'in',
|
|
181
|
-
'not_in',
|
|
182
|
-
'exists'
|
|
183
|
-
]
|
|
184
|
-
};
|
|
185
|
-
const fieldHasQueryOperators = (field)=>Boolean(OPERATORS_BY_TYPE[field.type]);
|
|
186
|
-
const collectionHasFilters = (fields)=>exposableFields(fields).some((f)=>fieldName(f) && fieldHasQueryOperators(f));
|
|
187
|
-
const buildQueryOperationsSchema = ({ base, fields, ctx })=>{
|
|
188
|
-
const properties = {};
|
|
189
|
-
for (const field of exposableFields(fields)){
|
|
190
|
-
const name = fieldName(field);
|
|
191
|
-
const operators = OPERATORS_BY_TYPE[field.type];
|
|
192
|
-
if (name && operators) properties[name] = {
|
|
193
|
-
type: 'object',
|
|
194
|
-
additionalProperties: false,
|
|
195
|
-
properties: Object.fromEntries(operators.map((op)=>[
|
|
196
|
-
op,
|
|
197
|
-
{}
|
|
198
|
-
]))
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
const selfRef = {
|
|
202
|
-
$ref: refTo(querySchemaName(base))
|
|
203
|
-
};
|
|
204
|
-
properties.and = {
|
|
205
|
-
type: 'array',
|
|
206
|
-
items: selfRef
|
|
207
|
-
};
|
|
208
|
-
properties.or = {
|
|
209
|
-
type: 'array',
|
|
210
|
-
items: selfRef
|
|
211
|
-
};
|
|
212
|
-
return {
|
|
213
|
-
type: 'object',
|
|
214
|
-
additionalProperties: false,
|
|
215
|
-
description: makeT(ctx.i18n)('schemaWhere'),
|
|
216
|
-
properties
|
|
217
|
-
};
|
|
218
|
-
};
|
|
219
|
-
const objectParam = (name, ref)=>({
|
|
220
|
-
name,
|
|
221
|
-
in: 'query',
|
|
222
|
-
content: {
|
|
223
|
-
'application/json': {
|
|
224
|
-
schema: ref ? {
|
|
225
|
-
$ref: ref
|
|
226
|
-
} : {
|
|
227
|
-
type: 'object',
|
|
228
|
-
additionalProperties: true
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
const localeParam = (ctx)=>({
|
|
234
|
-
name: 'locale',
|
|
235
|
-
in: 'query',
|
|
236
|
-
description: makeT(ctx.i18n)('paramLocale'),
|
|
237
|
-
schema: ctx.locales.length > 0 ? {
|
|
238
|
-
type: 'string',
|
|
239
|
-
enum: [
|
|
240
|
-
...ctx.locales,
|
|
241
|
-
'all'
|
|
242
|
-
]
|
|
243
|
-
} : {
|
|
244
|
-
type: 'string'
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
const fallbackLocaleParam = (ctx)=>({
|
|
248
|
-
name: 'fallback-locale',
|
|
249
|
-
in: 'query',
|
|
250
|
-
description: makeT(ctx.i18n)('paramFallbackLocale'),
|
|
251
|
-
schema: ctx.locales.length > 0 ? {
|
|
252
|
-
type: 'string',
|
|
253
|
-
enum: [
|
|
254
|
-
...ctx.locales,
|
|
255
|
-
'none'
|
|
256
|
-
]
|
|
257
|
-
} : {
|
|
258
|
-
type: 'string'
|
|
259
|
-
}
|
|
260
|
-
});
|
|
261
|
-
const commonReadParams = ({ base, ctx, refs })=>{
|
|
262
|
-
const params = [
|
|
263
|
-
{
|
|
264
|
-
name: 'depth',
|
|
265
|
-
in: 'query',
|
|
266
|
-
description: makeT(ctx.i18n)('paramDepth'),
|
|
267
|
-
schema: {
|
|
268
|
-
type: 'integer'
|
|
269
|
-
}
|
|
270
|
-
},
|
|
271
|
-
localeParam(ctx),
|
|
272
|
-
fallbackLocaleParam(ctx),
|
|
273
|
-
objectParam('select', refs.select ? refTo(selectSchemaName(base)) : void 0),
|
|
274
|
-
{
|
|
275
|
-
name: 'flattenLocales',
|
|
276
|
-
in: 'query',
|
|
277
|
-
description: makeT(ctx.i18n)('paramFlattenLocales'),
|
|
278
|
-
schema: {
|
|
279
|
-
type: 'boolean'
|
|
280
|
-
}
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
name: 'draft',
|
|
284
|
-
in: 'query',
|
|
285
|
-
description: makeT(ctx.i18n)('paramDraft'),
|
|
286
|
-
schema: {
|
|
287
|
-
type: 'boolean'
|
|
288
|
-
}
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
name: 'trash',
|
|
292
|
-
in: 'query',
|
|
293
|
-
description: makeT(ctx.i18n)('paramTrash'),
|
|
294
|
-
schema: {
|
|
295
|
-
type: 'boolean'
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
];
|
|
299
|
-
if (refs.populate) params.push(objectParam('populate', refTo(populateSchemaName(base))));
|
|
300
|
-
if (refs.joins) params.push(objectParam('joins', refTo(joinsSchemaName(base))));
|
|
301
|
-
return params;
|
|
302
|
-
};
|
|
303
|
-
const SHARED = [
|
|
304
|
-
'depth',
|
|
305
|
-
'locale',
|
|
306
|
-
'fallback-locale',
|
|
307
|
-
'select',
|
|
308
|
-
'populate'
|
|
309
|
-
];
|
|
310
|
-
const ALL_LOCALES = [
|
|
311
|
-
'publishAllLocales',
|
|
312
|
-
'unpublishAllLocales'
|
|
313
|
-
];
|
|
314
|
-
const WRITE_PARAMS = {
|
|
315
|
-
create: new Set([
|
|
316
|
-
...SHARED,
|
|
317
|
-
'draft',
|
|
318
|
-
'autosave',
|
|
319
|
-
'publishAllLocales'
|
|
320
|
-
]),
|
|
321
|
-
update: new Set([
|
|
322
|
-
...SHARED,
|
|
323
|
-
'draft',
|
|
324
|
-
'trash',
|
|
325
|
-
'overrideLock',
|
|
326
|
-
...ALL_LOCALES
|
|
327
|
-
]),
|
|
328
|
-
updateByID: new Set([
|
|
329
|
-
...SHARED,
|
|
330
|
-
'draft',
|
|
331
|
-
'trash',
|
|
332
|
-
'autosave',
|
|
333
|
-
'overrideLock',
|
|
334
|
-
...ALL_LOCALES
|
|
335
|
-
]),
|
|
336
|
-
delete: new Set([
|
|
337
|
-
...SHARED,
|
|
338
|
-
'trash',
|
|
339
|
-
'overrideLock'
|
|
340
|
-
]),
|
|
341
|
-
duplicate: new Set([
|
|
342
|
-
...SHARED,
|
|
343
|
-
'draft',
|
|
344
|
-
'selectedLocales[]'
|
|
345
|
-
]),
|
|
346
|
-
globalUpdate: new Set([
|
|
347
|
-
...SHARED,
|
|
348
|
-
'draft',
|
|
349
|
-
'autosave',
|
|
350
|
-
...ALL_LOCALES
|
|
351
|
-
])
|
|
352
|
-
};
|
|
353
|
-
const entityWriteParams = (entity, ctx)=>{
|
|
354
|
-
const t = makeT(ctx.i18n);
|
|
355
|
-
const flag = (name, key)=>({
|
|
356
|
-
name,
|
|
357
|
-
in: 'query',
|
|
358
|
-
description: t(key),
|
|
359
|
-
schema: {
|
|
360
|
-
type: 'boolean'
|
|
361
|
-
}
|
|
362
|
-
});
|
|
363
|
-
const drafts = entity.versions ? entity.versions.drafts : false;
|
|
364
|
-
const params = [];
|
|
365
|
-
if (drafts && drafts.autosave) params.push(flag('autosave', 'paramAutosave'));
|
|
366
|
-
if (drafts && drafts.localizeStatus) {
|
|
367
|
-
params.push(flag('publishAllLocales', 'paramPublishAllLocales'));
|
|
368
|
-
params.push(flag('unpublishAllLocales', 'paramUnpublishAllLocales'));
|
|
369
|
-
}
|
|
370
|
-
if (false !== entity.lockDocuments) params.push(flag('overrideLock', 'paramOverrideLock'));
|
|
371
|
-
if (ctx.locales.length > 0) params.push({
|
|
372
|
-
name: 'selectedLocales[]',
|
|
373
|
-
in: 'query',
|
|
374
|
-
description: t('paramSelectedLocales'),
|
|
375
|
-
style: 'form',
|
|
376
|
-
explode: true,
|
|
377
|
-
schema: {
|
|
378
|
-
type: 'array',
|
|
379
|
-
items: {
|
|
380
|
-
type: 'string',
|
|
381
|
-
enum: ctx.locales
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
});
|
|
385
|
-
return params;
|
|
386
|
-
};
|
|
387
|
-
const writeParams = ({ base, entity, ctx, refs, operation })=>[
|
|
388
|
-
...commonReadParams({
|
|
389
|
-
base,
|
|
390
|
-
ctx,
|
|
391
|
-
refs
|
|
392
|
-
}),
|
|
393
|
-
...entityWriteParams(entity, ctx)
|
|
394
|
-
].filter((p)=>WRITE_PARAMS[operation].has(p.name));
|
|
395
|
-
const whereParam = (base)=>objectParam('where', refTo(querySchemaName(base)));
|
|
396
|
-
const buildListParams = ({ base, fields, ctx, refs })=>{
|
|
397
|
-
const params = [
|
|
398
|
-
{
|
|
399
|
-
name: 'page',
|
|
400
|
-
in: 'query',
|
|
401
|
-
schema: {
|
|
402
|
-
type: 'integer'
|
|
403
|
-
}
|
|
404
|
-
},
|
|
405
|
-
{
|
|
406
|
-
name: 'limit',
|
|
407
|
-
in: 'query',
|
|
408
|
-
schema: {
|
|
409
|
-
type: 'integer'
|
|
410
|
-
}
|
|
411
|
-
},
|
|
412
|
-
{
|
|
413
|
-
name: 'pagination',
|
|
414
|
-
in: 'query',
|
|
415
|
-
schema: {
|
|
416
|
-
type: 'boolean'
|
|
417
|
-
}
|
|
418
|
-
},
|
|
419
|
-
{
|
|
420
|
-
name: 'sort',
|
|
421
|
-
in: 'query',
|
|
422
|
-
description: makeT(ctx.i18n)('paramSort'),
|
|
423
|
-
schema: {
|
|
424
|
-
type: 'string'
|
|
425
|
-
}
|
|
426
|
-
},
|
|
427
|
-
...commonReadParams({
|
|
428
|
-
base,
|
|
429
|
-
ctx,
|
|
430
|
-
refs
|
|
431
|
-
})
|
|
432
|
-
];
|
|
433
|
-
if (collectionHasFilters(fields)) params.push(whereParam(base));
|
|
434
|
-
return params;
|
|
435
|
-
};
|
|
436
|
-
export { buildJoinsSchema, buildListParams, buildParamSchemas, buildPopulateSchema, buildQueryOperationsSchema, buildSelectSchema, collectionHasFilters, commonReadParams, whereParam, writeParams };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { SanitizedCollectionConfig } from 'payload';
|
|
2
|
-
import type { PathsObject } from '@scalar/openapi-types/3.2';
|
|
3
|
-
import type { BuildContext } from '../../types.js';
|
|
4
|
-
export declare const buildAuthPaths: ({ collection, ctx, includeAdmin, nestedTags, }: {
|
|
5
|
-
collection: SanitizedCollectionConfig;
|
|
6
|
-
ctx: BuildContext;
|
|
7
|
-
includeAdmin: boolean;
|
|
8
|
-
nestedTags: boolean;
|
|
9
|
-
}) => PathsObject;
|