@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/types.d.ts
DELETED
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import type { SanitizedCollectionConfig, SanitizedGlobalConfig } from 'payload';
|
|
2
|
-
import type { ComponentsObject, Document, PathsObject, TagObject } from '@scalar/openapi-types/3.2';
|
|
3
|
-
import type { I18n } from '@payloadcms/translations';
|
|
4
|
-
export type OpenApiVersion = '3.0' | '3.1' | '3.2';
|
|
5
|
-
export type EntityKind = 'collection' | 'global';
|
|
6
|
-
export type HttpMethod = 'get' | 'post' | 'patch' | 'put' | 'delete';
|
|
7
|
-
export type IDType = 'text' | 'number';
|
|
8
|
-
export type Entity = SanitizedCollectionConfig | SanitizedGlobalConfig;
|
|
9
|
-
export type EntityOperation = 'read' | 'create' | 'update' | 'delete';
|
|
10
|
-
export type EntitySecurityOverride = boolean | Partial<Record<EntityOperation, boolean>>;
|
|
11
|
-
export interface OpenApiMetadata {
|
|
12
|
-
title: string;
|
|
13
|
-
version: string;
|
|
14
|
-
description?: string;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Interactive "Authorize" login for the docs UI. When on, the plugin adds a
|
|
18
|
-
* token endpoint and a security scheme so Scalar/Swagger can log in with a
|
|
19
|
-
* username and password instead of pasting a token. Off by default. The
|
|
20
|
-
* endpoint path is relative to the API route (`/openapi-auth` → `/api/openapi-auth`).
|
|
21
|
-
* - `true` — on, at the default endpoint (`/openapi-auth`).
|
|
22
|
-
* - `{ endpoint }` — on, at a custom token endpoint path.
|
|
23
|
-
*/
|
|
24
|
-
export type InteractiveAuthOption = boolean | {
|
|
25
|
-
endpoint?: string;
|
|
26
|
-
};
|
|
27
|
-
/** Match an entity by slug (any kind), a {kind,slug} pair, or a slug pattern. */
|
|
28
|
-
export type EntityMatcher = string | RegExp | {
|
|
29
|
-
kind: EntityKind;
|
|
30
|
-
slug: string;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Drops generated operations. Within one rule, every set field must match (AND);
|
|
34
|
-
* an operation is removed if any rule matches it. Fields:
|
|
35
|
-
* - `method` — HTTP method(s); omit to match any.
|
|
36
|
-
* - `slug` — entity slug, exact string or RegExp; omit to match any.
|
|
37
|
-
* - `kind` — restrict to collections or globals; omit to match both.
|
|
38
|
-
* - `path` — RegExp tested against the final route path (e.g. `/api/posts/{id}`).
|
|
39
|
-
*/
|
|
40
|
-
export interface OperationRule {
|
|
41
|
-
method?: HttpMethod | HttpMethod[];
|
|
42
|
-
slug?: string | RegExp;
|
|
43
|
-
kind?: EntityKind;
|
|
44
|
-
path?: RegExp;
|
|
45
|
-
}
|
|
46
|
-
/** Context passed to {@link FilterOptions.excludeWhen} for each operation. */
|
|
47
|
-
export interface OperationContext {
|
|
48
|
-
method: HttpMethod;
|
|
49
|
-
path: string;
|
|
50
|
-
slug: string;
|
|
51
|
-
kind: EntityKind;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Controls what appears in the spec, in one flat object: which entities are
|
|
55
|
-
* documented, which Payload-internal collections to show, which extra endpoint
|
|
56
|
-
* groups to generate, and which operations to drop.
|
|
57
|
-
*/
|
|
58
|
-
export interface FilterOptions {
|
|
59
|
-
/** Allowlist of entities; when non-empty, only matching entities are documented. */
|
|
60
|
-
include?: EntityMatcher[];
|
|
61
|
-
/** Entities to omit entirely (schemas + paths). */
|
|
62
|
-
exclude?: EntityMatcher[];
|
|
63
|
-
/** Include collections flagged `hidden`/`admin.hidden`. Default false. */
|
|
64
|
-
includeHidden?: boolean;
|
|
65
|
-
/** Include Payload-internal collections (payload-jobs, payload-preferences, ...). Default false. */
|
|
66
|
-
includeSystem?: boolean;
|
|
67
|
-
/** Document endpoints carrying `custom.openapi` metadata. Default true. */
|
|
68
|
-
includeCustom?: boolean;
|
|
69
|
-
/** Document auth operation endpoints (login/logout/me/...). Default true. */
|
|
70
|
-
includeAuth?: boolean;
|
|
71
|
-
/** Document admin/bootstrap auth endpoints (/init, /access, first-register). Default false. */
|
|
72
|
-
includeAdminAuth?: boolean;
|
|
73
|
-
/** Document version operation endpoints (/versions, /versions/{id}). Default true. */
|
|
74
|
-
includeVersions?: boolean;
|
|
75
|
-
/** Document jobs endpoints (/payload-jobs/run, /handle-schedules). Default true. */
|
|
76
|
-
includeJobs?: boolean;
|
|
77
|
-
/** Per-operation removal rules. */
|
|
78
|
-
excludeOperations?: OperationRule[];
|
|
79
|
-
/** Escape hatch: return true to drop an operation. Runs after excludeOperations. */
|
|
80
|
-
excludeWhen?: (ctx: OperationContext) => boolean;
|
|
81
|
-
}
|
|
82
|
-
export interface OpenApiExtension {
|
|
83
|
-
paths?: PathsObject;
|
|
84
|
-
components?: ComponentsObject;
|
|
85
|
-
tags?: TagObject[];
|
|
86
|
-
transform?: (doc: Document, ctx: BuildContext) => Document;
|
|
87
|
-
}
|
|
88
|
-
export type OpenApiPluginOptions = {
|
|
89
|
-
metadata: OpenApiMetadata;
|
|
90
|
-
/**
|
|
91
|
-
* OpenAPI version to serve. The document is always built as 3.2; `3.1` and
|
|
92
|
-
* `3.0` each run a downconversion pass on the result. Default `3.2`.
|
|
93
|
-
*/
|
|
94
|
-
openapiVersion?: OpenApiVersion;
|
|
95
|
-
/**
|
|
96
|
-
* Where the spec is served, relative to the Payload API route (`routes.api`,
|
|
97
|
-
* `/api` by default). So the `/openapi.json` default is served at
|
|
98
|
-
* `/api/openapi.json`. Default `/openapi.json`.
|
|
99
|
-
*/
|
|
100
|
-
specEndpoint?: string;
|
|
101
|
-
enabled?: boolean;
|
|
102
|
-
/**
|
|
103
|
-
* Mount the runtime spec (and interactive-auth) endpoints. Default true. Set
|
|
104
|
-
* false to register only the `openapi:generate` CLI bin and skip serving over
|
|
105
|
-
* HTTP — generate the spec to a file and host it however you like (static
|
|
106
|
-
* asset, CDN, committed to the repo). The docs UI plugins (`scalar`/`swaggerUi`)
|
|
107
|
-
* are unaffected; point their `specEndpoint` at wherever the file ends up.
|
|
108
|
-
*/
|
|
109
|
-
serve?: boolean;
|
|
110
|
-
filters?: FilterOptions;
|
|
111
|
-
/** Interactive docs-UI login. See {@link InteractiveAuthOption}. Default false. */
|
|
112
|
-
interactiveAuth?: InteractiveAuthOption;
|
|
113
|
-
/**
|
|
114
|
-
* Emit an OpenAPI 3.2 nested tag hierarchy (nav groups via `kind`/`parent`,
|
|
115
|
-
* plus per-entity auth/version sub-tags). Off by default: Scalar and Swagger UI
|
|
116
|
-
* don't render 3.2 nested tags yet and would show a confusing flat list of group
|
|
117
|
-
* names. When off, `doc.tags` is a flat list of per-entity tags with their
|
|
118
|
-
* descriptions.
|
|
119
|
-
*/
|
|
120
|
-
nestedTags?: boolean;
|
|
121
|
-
/**
|
|
122
|
-
* Override the security marking per operation: `true` marks it public, `false`
|
|
123
|
-
* secured (`PayloadToken`), `undefined` keeps the detected marking. Runs last,
|
|
124
|
-
* after `custom.openapi.security` and the probe, across every operation group.
|
|
125
|
-
*/
|
|
126
|
-
securityWhen?: (ctx: OperationContext) => boolean | undefined;
|
|
127
|
-
/**
|
|
128
|
-
* Cache the built document for the life of the process. The Payload config is
|
|
129
|
-
* static after boot, so the spec is the same every time apart from the server
|
|
130
|
-
* URL, which is filled in fresh per response. Default true; set false in dev to
|
|
131
|
-
* rebuild on every request, e.g. `cache: process.env.NODE_ENV === 'production'`.
|
|
132
|
-
*/
|
|
133
|
-
cache?: boolean;
|
|
134
|
-
extensions?: OpenApiExtension[];
|
|
135
|
-
};
|
|
136
|
-
export interface UiPluginOptions {
|
|
137
|
-
/**
|
|
138
|
-
* Where the docs UI is served, relative to the Payload API route
|
|
139
|
-
* (`routes.api`, `/api` by default). So the `/docs` default is served at
|
|
140
|
-
* `/api/docs`. Default `/docs`.
|
|
141
|
-
*/
|
|
142
|
-
path?: string;
|
|
143
|
-
/** Absolute URL the UI fetches the OpenAPI document from. Default `<apiRoute>/openapi.json`. */
|
|
144
|
-
specEndpoint?: string;
|
|
145
|
-
/** CDN base for the UI's assets. Default is the official jsDelivr package. */
|
|
146
|
-
cdnBase?: string;
|
|
147
|
-
/**
|
|
148
|
-
* Extra UI config, merged into the underlying library's init options (Scalar's
|
|
149
|
-
* `createApiReference` config or Swagger UI's `SwaggerUIBundle`). Must be
|
|
150
|
-
* JSON-serializable, functions aren't supported here.
|
|
151
|
-
*/
|
|
152
|
-
configuration?: Record<string, unknown>;
|
|
153
|
-
/** Set false to skip mounting the docs UI. */
|
|
154
|
-
enabled?: boolean;
|
|
155
|
-
}
|
|
156
|
-
export interface ResolvedFilters {
|
|
157
|
-
include: EntityMatcher[];
|
|
158
|
-
exclude: EntityMatcher[];
|
|
159
|
-
includeHidden: boolean;
|
|
160
|
-
includeSystem: boolean;
|
|
161
|
-
includeCustom: boolean;
|
|
162
|
-
includeAuth: boolean;
|
|
163
|
-
includeAdminAuth: boolean;
|
|
164
|
-
includeVersions: boolean;
|
|
165
|
-
includeJobs: boolean;
|
|
166
|
-
excludeOperations: OperationRule[];
|
|
167
|
-
excludeWhen?: (ctx: OperationContext) => boolean;
|
|
168
|
-
}
|
|
169
|
-
export interface ResolvedOptions {
|
|
170
|
-
metadata: OpenApiMetadata;
|
|
171
|
-
openapiVersion: OpenApiVersion;
|
|
172
|
-
specEndpoint: string;
|
|
173
|
-
serve: boolean;
|
|
174
|
-
filters: ResolvedFilters;
|
|
175
|
-
interactiveAuth: {
|
|
176
|
-
enabled: boolean;
|
|
177
|
-
endpoint: string;
|
|
178
|
-
};
|
|
179
|
-
nestedTags: boolean;
|
|
180
|
-
securityWhen?: (ctx: OperationContext) => boolean | undefined;
|
|
181
|
-
cache: boolean;
|
|
182
|
-
extensions: OpenApiExtension[];
|
|
183
|
-
}
|
|
184
|
-
export interface BuildContext {
|
|
185
|
-
defaultIDType: IDType;
|
|
186
|
-
locales: string[];
|
|
187
|
-
apiRoute: string;
|
|
188
|
-
/** Languages the docs are available in (project `i18n.supportedLanguages`). */
|
|
189
|
-
docLanguages: string[];
|
|
190
|
-
/** Request i18n: resolves Payload entity descriptions and, via {@link makeT}, plugin strings. */
|
|
191
|
-
i18n: I18n;
|
|
192
|
-
}
|
package/dist/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Plugin } from 'payload';
|
|
2
|
-
import type { UiPluginOptions } from '../types.js';
|
|
3
|
-
export interface UiRenderArgs {
|
|
4
|
-
specUrl: string;
|
|
5
|
-
cdnBase: string;
|
|
6
|
-
title: string;
|
|
7
|
-
configuration: Record<string, unknown>;
|
|
8
|
-
}
|
|
9
|
-
export interface UiPluginSpec {
|
|
10
|
-
defaultDocsUrl: string;
|
|
11
|
-
defaultCdnBase: string;
|
|
12
|
-
render: (args: UiRenderArgs) => string;
|
|
13
|
-
}
|
|
14
|
-
export declare const createUiPlugin: (spec: UiPluginSpec) => (options?: UiPluginOptions) => Plugin;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const createUiPlugin = (spec)=>(options = {})=>(config)=>{
|
|
2
|
-
if (false === options.enabled) return config;
|
|
3
|
-
const docsPath = options.path ?? spec.defaultDocsUrl;
|
|
4
|
-
const specUrl = options.specEndpoint ?? `${config.routes?.api ?? '/api'}/openapi.json`;
|
|
5
|
-
const cdnBase = options.cdnBase ?? spec.defaultCdnBase;
|
|
6
|
-
const html = spec.render({
|
|
7
|
-
specUrl,
|
|
8
|
-
cdnBase,
|
|
9
|
-
title: 'API Reference',
|
|
10
|
-
configuration: options.configuration ?? {}
|
|
11
|
-
});
|
|
12
|
-
return {
|
|
13
|
-
...config,
|
|
14
|
-
endpoints: [
|
|
15
|
-
...config.endpoints ?? [],
|
|
16
|
-
{
|
|
17
|
-
path: docsPath,
|
|
18
|
-
method: 'get',
|
|
19
|
-
handler: ()=>new Response(html, {
|
|
20
|
-
headers: {
|
|
21
|
-
'content-type': 'text/html; charset=utf-8'
|
|
22
|
-
}
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
export { createUiPlugin };
|
package/dist/ui/html.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
const escapeHtml = (value)=>value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
2
|
-
const jsonForScript = (value)=>JSON.stringify(value ?? {}).replace(/</g, '\\u003c');
|
|
3
|
-
const htmlPage = ({ title, head, body })=>`<!doctype html><html><head><meta charset="utf-8"/><title>${escapeHtml(title)}</title><meta name="viewport" content="width=device-width, initial-scale=1"/>${head}</head><body>${body}</body></html>`;
|
|
4
|
-
const specUrlExpr = (specUrl)=>{
|
|
5
|
-
const u = JSON.stringify(specUrl);
|
|
6
|
-
return `(function(){var l=new URLSearchParams(location.search).get('lang');return ${u}+(l?((${u}.indexOf('?')>-1?'&':'?')+'lang='+encodeURIComponent(l)):'')})()`;
|
|
7
|
-
};
|
|
8
|
-
export { escapeHtml, htmlPage, jsonForScript, specUrlExpr };
|
package/dist/ui/scalar.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const scalar: (options?: import("../types.js").UiPluginOptions) => import("payload").Plugin;
|
package/dist/ui/scalar.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { createUiPlugin } from "./createUiPlugin.js";
|
|
2
|
-
import { escapeHtml, htmlPage, jsonForScript, specUrlExpr } from "./html.js";
|
|
3
|
-
const scalar = createUiPlugin({
|
|
4
|
-
defaultDocsUrl: '/docs',
|
|
5
|
-
defaultCdnBase: 'https://cdn.jsdelivr.net/npm/@scalar/api-reference',
|
|
6
|
-
render: ({ specUrl, cdnBase, title, configuration })=>htmlPage({
|
|
7
|
-
title,
|
|
8
|
-
head: '',
|
|
9
|
-
body: `<div id="app"></div><script src="${escapeHtml(cdnBase)}"></script><script>Scalar.createApiReference('#app',{url:${specUrlExpr(specUrl)},...${jsonForScript(configuration)}})</script>`
|
|
10
|
-
})
|
|
11
|
-
});
|
|
12
|
-
export { scalar };
|
package/dist/ui/swagger.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const swaggerUi: (options?: import("../types.js").UiPluginOptions) => import("payload").Plugin;
|
package/dist/ui/swagger.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { createUiPlugin } from "./createUiPlugin.js";
|
|
2
|
-
import { escapeHtml, htmlPage, jsonForScript, specUrlExpr } from "./html.js";
|
|
3
|
-
const swaggerUi = createUiPlugin({
|
|
4
|
-
defaultDocsUrl: '/docs',
|
|
5
|
-
defaultCdnBase: 'https://cdn.jsdelivr.net/npm/swagger-ui-dist',
|
|
6
|
-
render: ({ specUrl, cdnBase, title, configuration })=>htmlPage({
|
|
7
|
-
title,
|
|
8
|
-
head: `<link rel="stylesheet" href="${escapeHtml(cdnBase)}/swagger-ui.css"/>`,
|
|
9
|
-
body: `<div id="swagger-ui"></div><script src="${escapeHtml(cdnBase)}/swagger-ui-bundle.js"></script><script>window.onload=()=>SwaggerUIBundle({url:${specUrlExpr(specUrl)},dom_id:'#swagger-ui',...${jsonForScript(configuration)}})</script>`
|
|
10
|
-
})
|
|
11
|
-
});
|
|
12
|
-
export { swaggerUi };
|
package/dist/utils.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const upperFirst = (value)=>0 === value.length ? value : value[0].toUpperCase() + value.slice(1);
|
|
2
|
-
const isPlainObject = (value)=>Boolean(value) && 'object' == typeof value && !Array.isArray(value);
|
|
3
|
-
const deepMerge = (a, b)=>{
|
|
4
|
-
const out = {
|
|
5
|
-
...a
|
|
6
|
-
};
|
|
7
|
-
for (const [key, value] of Object.entries(b)){
|
|
8
|
-
const prev = out[key];
|
|
9
|
-
out[key] = isPlainObject(prev) && isPlainObject(value) ? deepMerge(prev, value) : value;
|
|
10
|
-
}
|
|
11
|
-
return out;
|
|
12
|
-
};
|
|
13
|
-
export { deepMerge, isPlainObject, upperFirst };
|