@crvouga/mockingbird-service-payload-cms 1.8.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -1
- package/DISCOVERY.md +55 -0
- package/README.md +2 -2
- package/SUPPORT.md +12 -0
- package/dist/{chunk-FBRZZAKE.js → chunk-2JAJSWIZ.js} +44 -24
- package/dist/chunk-2JAJSWIZ.js.map +7 -0
- package/dist/chunk-TR5SV7HY.js +3305 -0
- package/dist/chunk-TR5SV7HY.js.map +7 -0
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1 -1
- package/dist/server.d.ts +2 -0
- package/dist/server.js +2 -2
- package/openapi.yaml +206 -0
- package/package.json +29 -4
- package/dist/chunk-COTVMNU6.js +0 -5112
- package/dist/chunk-COTVMNU6.js.map +0 -7
- package/dist/chunk-FBRZZAKE.js.map +0 -7
package/dist/cli.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -893,6 +893,7 @@ type PayloadCmsRuntimeOptions = {
|
|
|
893
893
|
sqlite?: SqliteClient;
|
|
894
894
|
clock?: Clock;
|
|
895
895
|
seed?: number | string;
|
|
896
|
+
adminPrefix?: string;
|
|
896
897
|
adminKey?: string;
|
|
897
898
|
onLog?: (entry: RequestLog) => void;
|
|
898
899
|
/** Collections every namespace starts with. Default: the marketing collection seed. */
|
|
@@ -900,8 +901,8 @@ type PayloadCmsRuntimeOptions = {
|
|
|
900
901
|
};
|
|
901
902
|
type PayloadCmsRuntime = ServiceRuntime<PayloadCmsAPI>;
|
|
902
903
|
/**
|
|
903
|
-
* The Payload CMS mock with Mockingbird's full service contract: `/health`, `/__admin/*`,
|
|
904
|
-
* namespaces by header, by `/ns/<name>` path prefix (on `PAYLOAD_CMS_API_URL`), or by API key
|
|
904
|
+
* The Payload CMS mock with Mockingbird's full service contract: `/__admin/health`, `/__admin/*`,
|
|
905
|
+
* namespaces by header, by `/__admin/ns/<name>` path prefix (on `PAYLOAD_CMS_API_URL`), or by API key
|
|
905
906
|
* / bearer token, clock control, fault presets and a request journal.
|
|
906
907
|
*/
|
|
907
908
|
declare const createRuntime: (options?: PayloadCmsRuntimeOptions) => PayloadCmsRuntime;
|
|
@@ -916,7 +917,7 @@ declare const payloadError: (status: number, message: string) => Response;
|
|
|
916
917
|
/**
|
|
917
918
|
* The credential a request carries: an API key (`Authorization: <collection> API-Key <key>`)
|
|
918
919
|
* or a bearer JWT. Our backend sends none (the marketing collection is public), so namespaces
|
|
919
|
-
* usually come from the header or the `/ns/<name>` prefix on `PAYLOAD_CMS_API_URL`.
|
|
920
|
+
* usually come from the header or the `/__admin/ns/<name>` prefix on `PAYLOAD_CMS_API_URL`.
|
|
920
921
|
*/
|
|
921
922
|
declare const payloadCredential: (request: Request) => string | undefined;
|
|
922
923
|
/** A compiled `where`: a predicate, or the path Payload refuses to query. */
|
package/dist/index.js
CHANGED
package/dist/server.d.ts
CHANGED
|
@@ -593,6 +593,7 @@ type CliOption = {
|
|
|
593
593
|
};
|
|
594
594
|
type CliValues = Record<string, string | boolean | undefined>;
|
|
595
595
|
type CommonServeOptions = {
|
|
596
|
+
adminPrefix?: string;
|
|
596
597
|
adminKey: string | undefined;
|
|
597
598
|
seed: string | undefined;
|
|
598
599
|
onLog: ((entry: RequestLog$1) => void) | undefined;
|
|
@@ -1339,6 +1340,7 @@ type PayloadCmsRuntimeOptions = {
|
|
|
1339
1340
|
sqlite?: SqliteClient;
|
|
1340
1341
|
clock?: Clock;
|
|
1341
1342
|
seed?: number | string;
|
|
1343
|
+
adminPrefix?: string;
|
|
1342
1344
|
adminKey?: string;
|
|
1343
1345
|
onLog?: (entry: RequestLog) => void;
|
|
1344
1346
|
/** Collections every namespace starts with. Default: the marketing collection seed. */
|
package/dist/server.js
CHANGED
package/openapi.yaml
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
openapi: 3.1.0
|
|
2
|
+
info:
|
|
3
|
+
title: Payload CMS REST API (Mockingbird subset)
|
|
4
|
+
description: |
|
|
5
|
+
Stateful mock subset of Payload CMS's auto-generated collection REST API: find documents
|
|
6
|
+
(with a `where` query subset, `limit`, `page`, `sort`) and find one by id. Hand-authored
|
|
7
|
+
from Payload's REST API docs and the consumer's response type (payload-cms-response.type.ts).
|
|
8
|
+
version: "2"
|
|
9
|
+
x-mockingbird-upstream:
|
|
10
|
+
note: >-
|
|
11
|
+
Shapes from https://payloadcms.com/docs/rest-api/overview and
|
|
12
|
+
https://payloadcms.com/docs/queries/overview; the consumer is
|
|
13
|
+
apps/backend/src/modules/cms/payload-cms/payload-cms.service.ts.
|
|
14
|
+
servers:
|
|
15
|
+
- url: https://payload.acme.example
|
|
16
|
+
paths:
|
|
17
|
+
/api/{collection}:
|
|
18
|
+
parameters:
|
|
19
|
+
- name: collection
|
|
20
|
+
in: path
|
|
21
|
+
required: true
|
|
22
|
+
schema:
|
|
23
|
+
type: string
|
|
24
|
+
enum: [marketing]
|
|
25
|
+
get:
|
|
26
|
+
operationId: FindDocuments
|
|
27
|
+
description: >-
|
|
28
|
+
Paginated find. `where[<field>][<operator>]=<value>` supports equals, not_equals, in,
|
|
29
|
+
not_in, exists, greater_than(_equal), less_than(_equal), like, contains, and nested
|
|
30
|
+
`where[and|or][<i>]…`. Only the consumer's filters are declared here for parity walks.
|
|
31
|
+
x-mockingbird:
|
|
32
|
+
supported: true
|
|
33
|
+
parity:
|
|
34
|
+
enabled: true
|
|
35
|
+
safe: true
|
|
36
|
+
parameters:
|
|
37
|
+
- name: where[type][equals]
|
|
38
|
+
in: query
|
|
39
|
+
required: false
|
|
40
|
+
schema:
|
|
41
|
+
type: string
|
|
42
|
+
enum: [referral, banner, email]
|
|
43
|
+
- name: where[isActive][equals]
|
|
44
|
+
in: query
|
|
45
|
+
required: false
|
|
46
|
+
schema:
|
|
47
|
+
type: string
|
|
48
|
+
enum: ["true", "false"]
|
|
49
|
+
- name: limit
|
|
50
|
+
in: query
|
|
51
|
+
required: false
|
|
52
|
+
schema:
|
|
53
|
+
type: integer
|
|
54
|
+
minimum: 0
|
|
55
|
+
maximum: 100
|
|
56
|
+
- name: page
|
|
57
|
+
in: query
|
|
58
|
+
required: false
|
|
59
|
+
schema:
|
|
60
|
+
type: integer
|
|
61
|
+
minimum: 1
|
|
62
|
+
maximum: 20
|
|
63
|
+
- name: sort
|
|
64
|
+
in: query
|
|
65
|
+
required: false
|
|
66
|
+
schema:
|
|
67
|
+
type: string
|
|
68
|
+
enum: [createdAt, -createdAt, name, -name, id, -id]
|
|
69
|
+
responses:
|
|
70
|
+
"200":
|
|
71
|
+
description: A page of documents
|
|
72
|
+
content:
|
|
73
|
+
application/json:
|
|
74
|
+
schema:
|
|
75
|
+
$ref: "#/components/schemas/PaginatedDocs"
|
|
76
|
+
"400":
|
|
77
|
+
description: Invalid query
|
|
78
|
+
content:
|
|
79
|
+
application/json:
|
|
80
|
+
schema:
|
|
81
|
+
$ref: "#/components/schemas/Errors"
|
|
82
|
+
"404":
|
|
83
|
+
description: Unknown collection
|
|
84
|
+
content:
|
|
85
|
+
application/json:
|
|
86
|
+
schema:
|
|
87
|
+
$ref: "#/components/schemas/Errors"
|
|
88
|
+
/api/{collection}/{id}:
|
|
89
|
+
parameters:
|
|
90
|
+
- name: collection
|
|
91
|
+
in: path
|
|
92
|
+
required: true
|
|
93
|
+
schema:
|
|
94
|
+
type: string
|
|
95
|
+
enum: [marketing]
|
|
96
|
+
- name: id
|
|
97
|
+
in: path
|
|
98
|
+
required: true
|
|
99
|
+
schema:
|
|
100
|
+
type: string
|
|
101
|
+
description: The seeded documents are 1-3; anything else is a 404.
|
|
102
|
+
pattern: "^[1-5]$"
|
|
103
|
+
get:
|
|
104
|
+
operationId: FindDocumentById
|
|
105
|
+
x-mockingbird:
|
|
106
|
+
supported: true
|
|
107
|
+
parity:
|
|
108
|
+
enabled: true
|
|
109
|
+
safe: true
|
|
110
|
+
responses:
|
|
111
|
+
"200":
|
|
112
|
+
description: The document
|
|
113
|
+
content:
|
|
114
|
+
application/json:
|
|
115
|
+
schema:
|
|
116
|
+
$ref: "#/components/schemas/MarketingDoc"
|
|
117
|
+
"404":
|
|
118
|
+
description: Unknown document or collection
|
|
119
|
+
content:
|
|
120
|
+
application/json:
|
|
121
|
+
schema:
|
|
122
|
+
$ref: "#/components/schemas/Errors"
|
|
123
|
+
components:
|
|
124
|
+
schemas:
|
|
125
|
+
MarketingDoc:
|
|
126
|
+
type: object
|
|
127
|
+
required: [id, name, type, createdAt, updatedAt]
|
|
128
|
+
properties:
|
|
129
|
+
id:
|
|
130
|
+
type: integer
|
|
131
|
+
description: Integer ids, as Payload's Postgres adapter issues them (the consumer types `id` as a number).
|
|
132
|
+
name:
|
|
133
|
+
type: string
|
|
134
|
+
type:
|
|
135
|
+
type: string
|
|
136
|
+
enum: [referral, banner, email]
|
|
137
|
+
isActive:
|
|
138
|
+
type: boolean
|
|
139
|
+
cardTitle:
|
|
140
|
+
type: ["string", "null"]
|
|
141
|
+
cardSubtitle:
|
|
142
|
+
type: ["string", "null"]
|
|
143
|
+
cardDescription:
|
|
144
|
+
type: ["string", "null"]
|
|
145
|
+
ctaTitle:
|
|
146
|
+
type: ["string", "null"]
|
|
147
|
+
ctaActionText:
|
|
148
|
+
type: ["string", "null"]
|
|
149
|
+
shareMessage:
|
|
150
|
+
type: ["string", "null"]
|
|
151
|
+
createdAt:
|
|
152
|
+
type: string
|
|
153
|
+
x-mockingbird-volatile:
|
|
154
|
+
kind: timestamp
|
|
155
|
+
updatedAt:
|
|
156
|
+
type: string
|
|
157
|
+
x-mockingbird-volatile:
|
|
158
|
+
kind: timestamp
|
|
159
|
+
PaginatedDocs:
|
|
160
|
+
type: object
|
|
161
|
+
required:
|
|
162
|
+
- docs
|
|
163
|
+
- totalDocs
|
|
164
|
+
- limit
|
|
165
|
+
- totalPages
|
|
166
|
+
- page
|
|
167
|
+
- pagingCounter
|
|
168
|
+
- hasPrevPage
|
|
169
|
+
- hasNextPage
|
|
170
|
+
- prevPage
|
|
171
|
+
- nextPage
|
|
172
|
+
properties:
|
|
173
|
+
docs:
|
|
174
|
+
type: array
|
|
175
|
+
items:
|
|
176
|
+
$ref: "#/components/schemas/MarketingDoc"
|
|
177
|
+
totalDocs:
|
|
178
|
+
type: integer
|
|
179
|
+
limit:
|
|
180
|
+
type: integer
|
|
181
|
+
totalPages:
|
|
182
|
+
type: integer
|
|
183
|
+
page:
|
|
184
|
+
type: integer
|
|
185
|
+
pagingCounter:
|
|
186
|
+
type: integer
|
|
187
|
+
hasPrevPage:
|
|
188
|
+
type: boolean
|
|
189
|
+
hasNextPage:
|
|
190
|
+
type: boolean
|
|
191
|
+
prevPage:
|
|
192
|
+
type: ["integer", "null"]
|
|
193
|
+
nextPage:
|
|
194
|
+
type: ["integer", "null"]
|
|
195
|
+
Errors:
|
|
196
|
+
type: object
|
|
197
|
+
required: [errors]
|
|
198
|
+
properties:
|
|
199
|
+
errors:
|
|
200
|
+
type: array
|
|
201
|
+
items:
|
|
202
|
+
type: object
|
|
203
|
+
required: [message]
|
|
204
|
+
properties:
|
|
205
|
+
message:
|
|
206
|
+
type: string
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crvouga/mockingbird-service-payload-cms",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Stateful mock of the Payload CMS collection REST API: paginated finds with a where-query subset, find by id, a seeded marketing collection and admin-editable documents.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
"files": [
|
|
9
9
|
"dist",
|
|
10
10
|
"README.md",
|
|
11
|
-
"CHANGELOG.md"
|
|
11
|
+
"CHANGELOG.md",
|
|
12
|
+
"DISCOVERY.md",
|
|
13
|
+
"SUPPORT.md",
|
|
14
|
+
"openapi.yaml"
|
|
12
15
|
],
|
|
13
16
|
"main": "./dist/index.js",
|
|
14
17
|
"types": "./dist/index.d.ts",
|
|
@@ -56,7 +59,29 @@
|
|
|
56
59
|
"docs": "https://payloadcms.com/docs/rest-api/overview"
|
|
57
60
|
},
|
|
58
61
|
"parity": "Collection REST",
|
|
59
|
-
"parityTier": "cold"
|
|
62
|
+
"parityTier": "cold",
|
|
63
|
+
"discovery": {
|
|
64
|
+
"guide": "DISCOVERY.md",
|
|
65
|
+
"behavior": "README.md",
|
|
66
|
+
"capabilities": "SUPPORT.md",
|
|
67
|
+
"contract": "openapi.yaml",
|
|
68
|
+
"types": "dist/index.d.ts",
|
|
69
|
+
"oracle": {
|
|
70
|
+
"kind": "Live vendor API or sandbox",
|
|
71
|
+
"command": "bun run parity:service -- payload-cms",
|
|
72
|
+
"note": "Run from a Mockingbird checkout; credentials come only from .env.local or GitHub Actions secrets. Missing credentials exit 2."
|
|
73
|
+
},
|
|
74
|
+
"introspection": [
|
|
75
|
+
"GET /__admin/health",
|
|
76
|
+
"GET /__admin",
|
|
77
|
+
"GET /__admin/state",
|
|
78
|
+
"GET /__admin/requests",
|
|
79
|
+
"GET /__admin/metrics",
|
|
80
|
+
"GET /__admin/faults/presets",
|
|
81
|
+
"GET /__admin/ui"
|
|
82
|
+
],
|
|
83
|
+
"reporting": "https://github.com/crvouga/mockingbird/blob/main/docs/REPORTING_ISSUES.md"
|
|
84
|
+
}
|
|
60
85
|
},
|
|
61
86
|
"scripts": {
|
|
62
87
|
"generate": "bun ../../openapi/codegen/dist/cli.js",
|
|
@@ -71,7 +96,7 @@
|
|
|
71
96
|
"pack:check": "bun ../../../scripts/pack-check.ts"
|
|
72
97
|
},
|
|
73
98
|
"dependencies": {
|
|
74
|
-
"@crvouga/mockingbird-service-sqlite": "1.
|
|
99
|
+
"@crvouga/mockingbird-service-sqlite": "2.1.0",
|
|
75
100
|
"hono": "4.11.9"
|
|
76
101
|
},
|
|
77
102
|
"devDependencies": {
|