@velocity-astro/cms-api 0.0.0-stage → 0.1.0-beta.11
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/LICENSE +21 -0
- package/README.md +12 -2
- package/dist/api.d.ts +36 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +657 -0
- package/dist/api.js.map +1 -0
- package/dist/authenticator.d.ts +25 -0
- package/dist/authenticator.d.ts.map +1 -0
- package/dist/authenticator.js +2 -0
- package/dist/authenticator.js.map +1 -0
- package/dist/http.d.ts +29 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +49 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/people.d.ts +31 -0
- package/dist/people.d.ts.map +1 -0
- package/dist/people.js +2 -0
- package/dist/people.js.map +1 -0
- package/dist/router.d.ts +23 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.js +46 -0
- package/dist/router.js.map +1 -0
- package/dist/testing/index.d.ts +11 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +14 -0
- package/dist/testing/index.js.map +1 -0
- package/package.json +41 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Southwell Media
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @velocity-astro/cms-api
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Velocity CMS over HTTP: what the editor, the CLI and plugins call. Built on web-standard Request and Response, so it runs wherever the site does.
|
|
4
|
+
|
|
5
|
+
Part of [Velocity CMS](https://github.com/Velocity-Astro/velocity-cms), a content management system for Astro sites. A site installs `@velocity-astro/cms-astro`, which brings the rest:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npx velocity-cms init
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Docs: https://docs.deployvelocity.com/cms/
|
|
12
|
+
|
|
13
|
+
MIT
|
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Cms } from '@velocity-astro/cms-core';
|
|
2
|
+
import type { Authenticator } from './authenticator.js';
|
|
3
|
+
import type { People } from './people.js';
|
|
4
|
+
export interface CmsApiOptions {
|
|
5
|
+
readonly cms: Cms;
|
|
6
|
+
readonly authenticator: Authenticator;
|
|
7
|
+
/** Who can sign in. Without it the API has nothing under `/people`. */
|
|
8
|
+
readonly people?: People;
|
|
9
|
+
/** Where the API is mounted on the site. Defaults to `/api/cms`. */
|
|
10
|
+
readonly basePath?: string;
|
|
11
|
+
/** The language an entry is written in when the request names none. Defaults to `en`. */
|
|
12
|
+
readonly defaultLocale?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Other origins whose pages may change content, such as an editor served from another domain.
|
|
15
|
+
* The site's own origin is always allowed.
|
|
16
|
+
*/
|
|
17
|
+
readonly trustedOrigins?: readonly string[];
|
|
18
|
+
/** The largest request body accepted, in bytes. Defaults to 1 MB. */
|
|
19
|
+
readonly maxBodyBytes?: number;
|
|
20
|
+
/** Told about every fault (a 500), which the response itself says nothing about. */
|
|
21
|
+
readonly onFault?: (error: unknown, request: Request) => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The CMS over HTTP. One object, one method: give `handle` a `Request` and it answers with a
|
|
25
|
+
* `Response`, so it mounts in an Astro endpoint, a Node server or a worker the same way.
|
|
26
|
+
*
|
|
27
|
+
* It holds no rules of its own. Each route checks the shape of what was sent, calls a service in
|
|
28
|
+
* `cms-core` as the person who asked, and turns the result or the refusal into JSON.
|
|
29
|
+
*/
|
|
30
|
+
export declare class CmsApi {
|
|
31
|
+
#private;
|
|
32
|
+
constructor(options: CmsApiOptions);
|
|
33
|
+
/** Answers one request. Never throws: whatever goes wrong becomes a response. */
|
|
34
|
+
readonly handle: (request: Request) => Promise<Response>;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAwR,MAAM,0BAA0B,CAAC;AAE1U,OAAO,KAAK,EAAc,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAClB,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,uEAAuE;IACvE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,oEAAoE;IACpE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,yFAAyF;IACzF,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,qEAAqE;IACrE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,oFAAoF;IACpF,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC/D;AAkND;;;;;;GAMG;AACH,qBAAa,MAAM;;gBAKL,OAAO,EAAE,aAAa;IA0TlC,iFAAiF;IACjF,QAAQ,CAAC,MAAM,GAAU,SAAS,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC,CAmB3D;CAsFH"}
|
package/dist/api.js
ADDED
|
@@ -0,0 +1,657 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ApiError, errorResponse, isFault, json } from './http.js';
|
|
3
|
+
import { Router } from './router.js';
|
|
4
|
+
/** What an upload may say it is. What it really is, the media service reads from the file. */
|
|
5
|
+
const IMAGE_TYPES = new Set(['image/jpeg', 'image/png', 'image/webp']);
|
|
6
|
+
/** A plugin's own address: its name, then at least one more part. */
|
|
7
|
+
const PLUGIN_ADDRESS = /^\/plugins\/([^/]+)\/(.+)$/;
|
|
8
|
+
const PLUGIN_METHODS = new Set(['GET', 'POST', 'PUT', 'DELETE']);
|
|
9
|
+
const contentTypeOf = (request) => (request.headers.get('content-type') ?? '').split(';')[0]?.trim().toLowerCase() ?? '';
|
|
10
|
+
const entryList = z.object({
|
|
11
|
+
type: z.string().min(1),
|
|
12
|
+
locale: z.string().min(1).optional(),
|
|
13
|
+
limit: z.coerce.number().int().min(1).max(200).default(50),
|
|
14
|
+
offset: z.coerce.number().int().min(0).default(0),
|
|
15
|
+
});
|
|
16
|
+
const trashList = entryList.omit({ type: true, locale: true });
|
|
17
|
+
const data = z.record(z.string(), z.unknown());
|
|
18
|
+
const newEntry = z.strictObject({ type: z.string().min(1), locale: z.string().min(1).optional(), slug: z.string(), data });
|
|
19
|
+
const entryChanges = z.strictObject({ slug: z.string(), data, expectedRevision: z.number().int().positive() });
|
|
20
|
+
const pluginSwitch = z.strictObject({ enabled: z.boolean() });
|
|
21
|
+
// What each setting may hold is the plugin's fields' to say, in the service.
|
|
22
|
+
const pluginValues = z.strictObject({ values: z.record(z.string(), z.unknown()) });
|
|
23
|
+
// A secret to save, or `null` to take the saved one away.
|
|
24
|
+
const pluginSecret = z.strictObject({ value: z.string().nullable() });
|
|
25
|
+
const newPerson = z.strictObject({ email: z.string(), name: z.string(), role: z.string() });
|
|
26
|
+
const roleChange = z.strictObject({ role: z.string() });
|
|
27
|
+
const words = z.record(z.string(), z.string());
|
|
28
|
+
const settings = z.record(z.string(), z.unknown());
|
|
29
|
+
const newType = z.strictObject({ key: z.string(), kind: z.enum(['collection', 'single']), label: words, urlPattern: z.string().optional() });
|
|
30
|
+
const path = z.array(z.string()).min(1);
|
|
31
|
+
const typeChanges = z.strictObject({
|
|
32
|
+
label: words.optional(),
|
|
33
|
+
urlPattern: z.string().nullable().optional(),
|
|
34
|
+
titlePath: path.nullable().optional(),
|
|
35
|
+
list: z.strictObject({ imagePath: path.optional(), fieldPaths: z.array(path).optional() }).nullable().optional(),
|
|
36
|
+
forDeals: z.boolean().optional(),
|
|
37
|
+
});
|
|
38
|
+
const sectionList = z.strictObject({
|
|
39
|
+
sections: z.array(z.strictObject({ key: z.string(), label: words, fieldIds: z.array(z.string()), aside: z.boolean().optional() })),
|
|
40
|
+
});
|
|
41
|
+
const newField = z.strictObject({
|
|
42
|
+
key: z.string(),
|
|
43
|
+
type: z.string(),
|
|
44
|
+
label: words,
|
|
45
|
+
help: words.optional(),
|
|
46
|
+
translated: z.boolean().optional(),
|
|
47
|
+
required: z.boolean().optional(),
|
|
48
|
+
options: settings.optional(),
|
|
49
|
+
/** The key of the section that shows the field. */
|
|
50
|
+
section: z.string().optional(),
|
|
51
|
+
});
|
|
52
|
+
const fieldChanges = z.strictObject({
|
|
53
|
+
key: z.string().optional(),
|
|
54
|
+
label: words.optional(),
|
|
55
|
+
help: words.nullable().optional(),
|
|
56
|
+
required: z.boolean().optional(),
|
|
57
|
+
translated: z.boolean().optional(),
|
|
58
|
+
options: settings.optional(),
|
|
59
|
+
});
|
|
60
|
+
const arrangement = z.strictObject({ order: z.array(z.string()), sections: z.record(z.string(), z.array(z.string())).optional(), within: z.array(z.string()).optional() });
|
|
61
|
+
const formField = z.strictObject({
|
|
62
|
+
/** The id the field was loaded with, so it keeps what was sent under it through a new key. */
|
|
63
|
+
id: z.string().optional(),
|
|
64
|
+
key: z.string(),
|
|
65
|
+
type: z.string(),
|
|
66
|
+
label: words,
|
|
67
|
+
help: words.optional(),
|
|
68
|
+
required: z.boolean().optional(),
|
|
69
|
+
options: settings.optional(),
|
|
70
|
+
});
|
|
71
|
+
const formContact = z.strictObject({ name: z.string().optional(), email: z.string().optional(), phone: z.string().optional() });
|
|
72
|
+
const newForm = z.strictObject({
|
|
73
|
+
key: z.string(),
|
|
74
|
+
label: words,
|
|
75
|
+
fields: z.array(formField.omit({ id: true })).optional(),
|
|
76
|
+
submitLabel: words.optional(),
|
|
77
|
+
success: words.optional(),
|
|
78
|
+
notify: z.array(z.string()).optional(),
|
|
79
|
+
contact: formContact.optional(),
|
|
80
|
+
fills: z.record(z.string(), z.string()).optional(),
|
|
81
|
+
retentionDays: z.number().optional(),
|
|
82
|
+
startsDeal: z.boolean().optional(),
|
|
83
|
+
open: z.boolean().optional(),
|
|
84
|
+
});
|
|
85
|
+
const formChanges = z.strictObject({
|
|
86
|
+
key: z.string().optional(),
|
|
87
|
+
label: words.optional(),
|
|
88
|
+
fields: z.array(formField).optional(),
|
|
89
|
+
submitLabel: words.nullable().optional(),
|
|
90
|
+
success: words.nullable().optional(),
|
|
91
|
+
notify: z.array(z.string()).optional(),
|
|
92
|
+
contact: formContact.optional(),
|
|
93
|
+
fills: z.record(z.string(), z.string()).optional(),
|
|
94
|
+
retentionDays: z.number().nullable().optional(),
|
|
95
|
+
startsDeal: z.boolean().optional(),
|
|
96
|
+
open: z.boolean().optional(),
|
|
97
|
+
expectedRevision: z.number().int().positive(),
|
|
98
|
+
});
|
|
99
|
+
const submissionList = z.object({
|
|
100
|
+
status: z.enum(['new', 'handled', 'spam']).optional(),
|
|
101
|
+
limit: z.coerce.number().int().min(1).max(200).default(50),
|
|
102
|
+
offset: z.coerce.number().int().min(0).default(0),
|
|
103
|
+
});
|
|
104
|
+
const submissionMark = z.strictObject({ status: z.enum(['new', 'handled', 'spam']) });
|
|
105
|
+
const forgetRequest = z.strictObject({ email: z.string() });
|
|
106
|
+
const contactList = z.object({
|
|
107
|
+
search: z.string().max(200).optional(),
|
|
108
|
+
stage: z.string().max(100).optional(),
|
|
109
|
+
/** A person's id, or `none` for the contacts nobody looks after. */
|
|
110
|
+
owner: z.string().max(100).optional(),
|
|
111
|
+
due: z.string().max(10).optional(),
|
|
112
|
+
limit: z.coerce.number().int().min(1).max(200).default(50),
|
|
113
|
+
offset: z.coerce.number().int().min(0).default(0),
|
|
114
|
+
});
|
|
115
|
+
// What each custom field may hold is its field type's to say, in the service.
|
|
116
|
+
const customValues = z.record(z.string(), z.unknown());
|
|
117
|
+
const newContact = z.strictObject({ email: z.string(), name: z.string().optional(), phone: z.string().optional(), data: customValues.optional() });
|
|
118
|
+
const contactImport = z.strictObject({
|
|
119
|
+
rows: z.array(z.strictObject({ email: z.string(), name: z.string().optional(), phone: z.string().optional(), data: z.record(z.string(), z.string()).optional() })),
|
|
120
|
+
});
|
|
121
|
+
const contactChanges = z.strictObject({
|
|
122
|
+
email: z.string().optional(),
|
|
123
|
+
name: z.string().nullable().optional(),
|
|
124
|
+
phone: z.string().nullable().optional(),
|
|
125
|
+
stage: z.string().optional(),
|
|
126
|
+
ownerId: z.string().nullable().optional(),
|
|
127
|
+
followUpAt: z.string().nullable().optional(),
|
|
128
|
+
data: customValues.optional(),
|
|
129
|
+
expectedRevision: z.number().int().positive(),
|
|
130
|
+
});
|
|
131
|
+
const customFieldsChanges = z.strictObject({
|
|
132
|
+
contact: z.array(formField).max(100).optional(),
|
|
133
|
+
deal: z.array(formField).max(100).optional(),
|
|
134
|
+
expectedRevision: z.number().int().min(0),
|
|
135
|
+
});
|
|
136
|
+
const emailSettingsChanges = z.strictObject({
|
|
137
|
+
provider: z.enum(['resend']).optional(),
|
|
138
|
+
from: z.string().max(1000),
|
|
139
|
+
apiKey: z.string().max(2000).nullable().optional(),
|
|
140
|
+
expectedRevision: z.number().int().min(0),
|
|
141
|
+
});
|
|
142
|
+
const storageSettingsChanges = z.strictObject({
|
|
143
|
+
endpoint: z.string().max(1000),
|
|
144
|
+
bucket: z.string().max(1000),
|
|
145
|
+
region: z.string().max(1000).optional(),
|
|
146
|
+
accessKeyId: z.string().max(1000),
|
|
147
|
+
secretAccessKey: z.string().max(2000).nullable().optional(),
|
|
148
|
+
expectedRevision: z.number().int().min(0),
|
|
149
|
+
});
|
|
150
|
+
const formsSettingsChanges = z.strictObject({
|
|
151
|
+
siteKey: z.string().max(1000),
|
|
152
|
+
secretKey: z.string().max(2000).nullable().optional(),
|
|
153
|
+
postsPerAddress: z.number(),
|
|
154
|
+
expectedRevision: z.number().int().min(0),
|
|
155
|
+
});
|
|
156
|
+
const generalSettingsChanges = z.strictObject({ siteName: z.string().max(1000), expectedRevision: z.number().int().min(0) });
|
|
157
|
+
const pipelineChanges = z.strictObject({
|
|
158
|
+
stages: z.array(z.strictObject({ id: z.string().optional(), label: z.string().optional(), kind: z.enum(['open', 'won', 'lost']), chance: z.number().optional() })).max(50),
|
|
159
|
+
currency: z.string().max(10).optional(),
|
|
160
|
+
assignTo: z.array(z.string()).max(100).optional(),
|
|
161
|
+
monthlyTarget: z.number().nullable().optional(),
|
|
162
|
+
expectedRevision: z.number().int().min(0),
|
|
163
|
+
});
|
|
164
|
+
const dealSubject = z.strictObject({ typeId: z.string().max(100), entry: z.string().max(100) });
|
|
165
|
+
const dealList = z.object({
|
|
166
|
+
contact: z.string().max(100).optional(),
|
|
167
|
+
/** With `aboutEntry`, only deals about that entry. */
|
|
168
|
+
aboutType: z.string().max(100).optional(),
|
|
169
|
+
aboutEntry: z.string().max(100).optional(),
|
|
170
|
+
stage: z.string().max(100).optional(),
|
|
171
|
+
/** A person's id, or `none` for the deals nobody looks after. */
|
|
172
|
+
owner: z.string().max(100).optional(),
|
|
173
|
+
limit: z.coerce.number().int().min(1).max(200).default(50),
|
|
174
|
+
offset: z.coerce.number().int().min(0).default(0),
|
|
175
|
+
});
|
|
176
|
+
const newDeal = z.strictObject({
|
|
177
|
+
contactId: z.string(),
|
|
178
|
+
title: z.string(),
|
|
179
|
+
about: dealSubject.optional(),
|
|
180
|
+
value: z.number(),
|
|
181
|
+
stage: z.string().optional(),
|
|
182
|
+
ownerId: z.string().optional(),
|
|
183
|
+
closeOn: z.string().optional(),
|
|
184
|
+
data: customValues.optional(),
|
|
185
|
+
});
|
|
186
|
+
const dealChanges = z.strictObject({
|
|
187
|
+
title: z.string().optional(),
|
|
188
|
+
about: dealSubject.nullable().optional(),
|
|
189
|
+
value: z.number().optional(),
|
|
190
|
+
stage: z.string().optional(),
|
|
191
|
+
ownerId: z.string().nullable().optional(),
|
|
192
|
+
closeOn: z.string().nullable().optional(),
|
|
193
|
+
data: customValues.optional(),
|
|
194
|
+
expectedRevision: z.number().int().positive(),
|
|
195
|
+
});
|
|
196
|
+
const newNote = z.strictObject({ text: z.string() });
|
|
197
|
+
const scheduleRequest = z.strictObject({ at: z.string().max(40), expectedRevision: z.number().int().positive() });
|
|
198
|
+
const revertRequest = z.strictObject({ revision: z.number().int().positive(), expectedRevision: z.number().int().positive() });
|
|
199
|
+
const publishRequest = z.strictObject({ expectedRevision: z.number().int().positive() });
|
|
200
|
+
/**
|
|
201
|
+
* The CMS over HTTP. One object, one method: give `handle` a `Request` and it answers with a
|
|
202
|
+
* `Response`, so it mounts in an Astro endpoint, a Node server or a worker the same way.
|
|
203
|
+
*
|
|
204
|
+
* It holds no rules of its own. Each route checks the shape of what was sent, calls a service in
|
|
205
|
+
* `cms-core` as the person who asked, and turns the result or the refusal into JSON.
|
|
206
|
+
*/
|
|
207
|
+
export class CmsApi {
|
|
208
|
+
#options;
|
|
209
|
+
#basePath;
|
|
210
|
+
#router = new Router();
|
|
211
|
+
constructor(options) {
|
|
212
|
+
this.#options = options;
|
|
213
|
+
this.#basePath = `/${(options.basePath ?? '/api/cms').split('/').filter(Boolean).join('/')}`;
|
|
214
|
+
const { schema, content, fields, media, previews, plugins, forms, submissions, contacts, pipeline, deals, customFields, settings } = options.cms;
|
|
215
|
+
const defaultLocale = options.defaultLocale ?? 'en';
|
|
216
|
+
this.#router
|
|
217
|
+
.add('GET', '/session', async ({ session }) => json({ user: session ? { ...session.user, role: session.actor.role } : null }))
|
|
218
|
+
.add('GET', '/content-types', async (call) => {
|
|
219
|
+
actor(call);
|
|
220
|
+
return json({ items: await schema.list() });
|
|
221
|
+
})
|
|
222
|
+
.add('POST', '/content-types', async (call) => {
|
|
223
|
+
const who = actor(call);
|
|
224
|
+
const body = parse(newType, await this.#body(call.request));
|
|
225
|
+
return json(await schema.create(who, given(body)), 201);
|
|
226
|
+
})
|
|
227
|
+
.add('PATCH', '/content-types/:id', async (call) => {
|
|
228
|
+
const who = actor(call);
|
|
229
|
+
const body = parse(typeChanges, await this.#body(call.request));
|
|
230
|
+
return json(await schema.update(who, param(call, 'id'), given(body)));
|
|
231
|
+
})
|
|
232
|
+
.add('GET', '/plugins', async (call) => json({ items: await plugins.list(actor(call)) }))
|
|
233
|
+
.add('PATCH', '/plugins/:name', async (call) => {
|
|
234
|
+
const who = actor(call);
|
|
235
|
+
const { enabled } = parse(pluginSwitch, await this.#body(call.request));
|
|
236
|
+
return json(await plugins.setEnabled(who, param(call, 'name'), enabled));
|
|
237
|
+
})
|
|
238
|
+
.add('GET', '/plugin-editors', async (call) => json({ items: await plugins.editors(actor(call)) }))
|
|
239
|
+
.add('GET', '/plugin-settings/:name', async (call) => json(await plugins.settings(actor(call), param(call, 'name'))))
|
|
240
|
+
.add('PUT', '/plugin-settings/:name', async (call) => {
|
|
241
|
+
const who = actor(call);
|
|
242
|
+
const { values } = parse(pluginValues, await this.#body(call.request));
|
|
243
|
+
return json(await plugins.saveSettings(who, param(call, 'name'), values));
|
|
244
|
+
})
|
|
245
|
+
.add('PUT', '/plugin-secrets/:name/:key', async (call) => {
|
|
246
|
+
const who = actor(call);
|
|
247
|
+
const { value } = parse(pluginSecret, await this.#body(call.request));
|
|
248
|
+
return json(await plugins.setSecret(who, param(call, 'name'), param(call, 'key'), value));
|
|
249
|
+
})
|
|
250
|
+
.add('GET', '/plugin-tasks/:name', async (call) => json({ items: await plugins.tasks(actor(call), param(call, 'name')) }))
|
|
251
|
+
.add('POST', '/plugin-tasks/:name/:id/retry', async (call) => json(await plugins.retryTask(actor(call), param(call, 'name'), param(call, 'id'))))
|
|
252
|
+
.add('GET', '/content-types/archived', async (call) => json({ items: await schema.listArchived(actor(call)) }))
|
|
253
|
+
.add('DELETE', '/content-types/:id', async (call) => json(await schema.archive(actor(call), param(call, 'id'))))
|
|
254
|
+
.add('POST', '/content-types/:id/restore', async (call) => json(await schema.restore(actor(call), param(call, 'id'))))
|
|
255
|
+
.add('POST', '/content-types/:id/fields', async (call) => {
|
|
256
|
+
const who = actor(call);
|
|
257
|
+
const { section, ...field } = parse(newField, await this.#body(call.request));
|
|
258
|
+
const place = { within: within(call), ...(section !== undefined && { section }) };
|
|
259
|
+
return json(await schema.addField(who, param(call, 'id'), given(field), place), 201);
|
|
260
|
+
})
|
|
261
|
+
.add('PUT', '/content-types/:id/fields', async (call) => {
|
|
262
|
+
const who = actor(call);
|
|
263
|
+
return json(await schema.arrangeFields(who, param(call, 'id'), given(parse(arrangement, await this.#body(call.request)))));
|
|
264
|
+
})
|
|
265
|
+
.add('PUT', '/content-types/:id/sections', async (call) => {
|
|
266
|
+
const who = actor(call);
|
|
267
|
+
const { sections } = parse(sectionList, await this.#body(call.request));
|
|
268
|
+
return json(await schema.setSections(who, param(call, 'id'), sections.map((section) => given(section))));
|
|
269
|
+
})
|
|
270
|
+
.add('PATCH', '/content-types/:id/fields/:fieldId', async (call) => {
|
|
271
|
+
const who = actor(call);
|
|
272
|
+
const body = parse(fieldChanges, await this.#body(call.request));
|
|
273
|
+
return json(await schema.changeField(who, param(call, 'id'), param(call, 'fieldId'), given(body), within(call)));
|
|
274
|
+
})
|
|
275
|
+
.add('DELETE', '/content-types/:id/fields/:fieldId', async (call) => json(await schema.removeField(actor(call), param(call, 'id'), param(call, 'fieldId'), within(call))))
|
|
276
|
+
.add('POST', '/content-types/:id/fields/:fieldId/restore', async (call) => json(await schema.restoreField(actor(call), param(call, 'id'), param(call, 'fieldId'), within(call))))
|
|
277
|
+
.add('GET', '/field-types', async (call) => {
|
|
278
|
+
actor(call);
|
|
279
|
+
return json({ items: fields.list().map(({ type, editor, takesSubmissions }) => ({ type, editor, takesSubmissions })) });
|
|
280
|
+
})
|
|
281
|
+
.add('GET', '/images', async (call) => {
|
|
282
|
+
const items = await media.images(actor(call));
|
|
283
|
+
return json({ items, upload: (await media.takesUploads()) ? { maxBytes: media.maxUploadBytes } : null });
|
|
284
|
+
})
|
|
285
|
+
.add('POST', '/images', this.#upload)
|
|
286
|
+
.add('DELETE', '/images/:name', async (call) => {
|
|
287
|
+
await media.remove(actor(call), param(call, 'name'));
|
|
288
|
+
return json({});
|
|
289
|
+
})
|
|
290
|
+
.add('GET', '/entries', async (call) => {
|
|
291
|
+
const query = parse(entryList, Object.fromEntries(call.url.searchParams));
|
|
292
|
+
const type = await schema.getByKey(query.type);
|
|
293
|
+
const page = await content.find(actor(call), {
|
|
294
|
+
typeId: type.id,
|
|
295
|
+
order: 'updated',
|
|
296
|
+
limit: query.limit,
|
|
297
|
+
offset: query.offset,
|
|
298
|
+
...(query.locale !== undefined && { locale: query.locale }),
|
|
299
|
+
});
|
|
300
|
+
return json(page);
|
|
301
|
+
})
|
|
302
|
+
.add('POST', '/entries', async (call) => {
|
|
303
|
+
const who = actor(call);
|
|
304
|
+
const body = parse(newEntry, await this.#body(call.request));
|
|
305
|
+
const type = await schema.getByKey(body.type);
|
|
306
|
+
const entry = await content.create(who, { typeId: type.id, locale: body.locale ?? defaultLocale, slug: body.slug, data: body.data });
|
|
307
|
+
return json(entry, 201);
|
|
308
|
+
})
|
|
309
|
+
.add('GET', '/entries/:id', async (call) => json(await content.get(actor(call), param(call, 'id'))))
|
|
310
|
+
.add('PATCH', '/entries/:id', async (call) => {
|
|
311
|
+
const who = actor(call);
|
|
312
|
+
const changes = parse(entryChanges, await this.#body(call.request));
|
|
313
|
+
return json(await content.update(who, param(call, 'id'), changes));
|
|
314
|
+
})
|
|
315
|
+
.add('POST', '/entries/:id/publish', async (call) => {
|
|
316
|
+
const who = actor(call);
|
|
317
|
+
const { expectedRevision } = parse(publishRequest, await this.#body(call.request));
|
|
318
|
+
return json(await content.publish(who, param(call, 'id'), expectedRevision));
|
|
319
|
+
})
|
|
320
|
+
.add('POST', '/entries/:id/preview', async (call) => json(await previews.link(actor(call), param(call, 'id'))))
|
|
321
|
+
.add('POST', '/entries/:id/unpublish', async (call) => json(await content.unpublish(actor(call), param(call, 'id'))))
|
|
322
|
+
.add('DELETE', '/entries/:id', async (call) => json(await content.trash(actor(call), param(call, 'id'))))
|
|
323
|
+
.add('POST', '/entries/:id/duplicate', async (call) => json(await content.duplicate(actor(call), param(call, 'id')), 201))
|
|
324
|
+
.add('POST', '/entries/:id/schedule', async (call) => json(await content.schedule(actor(call), param(call, 'id'), parse(scheduleRequest, await this.#body(call.request)))))
|
|
325
|
+
.add('POST', '/entries/:id/unschedule', async (call) => json(await content.unschedule(actor(call), param(call, 'id'))))
|
|
326
|
+
.add('GET', '/entries/:id/history', async (call) => json({ items: await content.history(actor(call), param(call, 'id')) }))
|
|
327
|
+
.add('POST', '/entries/:id/revert', async (call) => json(await content.revert(actor(call), param(call, 'id'), parse(revertRequest, await this.#body(call.request)))))
|
|
328
|
+
.add('POST', '/entries/:id/restore', async (call) => json(await content.restore(actor(call), param(call, 'id'))))
|
|
329
|
+
.add('GET', '/trash', async (call) => {
|
|
330
|
+
const query = parse(trashList, Object.fromEntries(call.url.searchParams));
|
|
331
|
+
return json(await content.find(actor(call), { trashed: true, order: 'updated', limit: query.limit, offset: query.offset }));
|
|
332
|
+
})
|
|
333
|
+
.add('DELETE', '/trash/:id', async (call) => {
|
|
334
|
+
await content.delete(actor(call), param(call, 'id'));
|
|
335
|
+
return json({});
|
|
336
|
+
})
|
|
337
|
+
.add('GET', '/forms', async (call) => json({ items: await forms.list(actor(call)) }))
|
|
338
|
+
.add('POST', '/forms', async (call) => {
|
|
339
|
+
const who = actor(call);
|
|
340
|
+
const body = parse(newForm, await this.#body(call.request));
|
|
341
|
+
return json(await forms.create(who, deep(body)), 201);
|
|
342
|
+
})
|
|
343
|
+
.add('GET', '/forms/trash', async (call) => json({ items: await forms.listTrashed(actor(call)) }))
|
|
344
|
+
.add('DELETE', '/forms/trash/:id', async (call) => {
|
|
345
|
+
await forms.delete(actor(call), param(call, 'id'));
|
|
346
|
+
return json({});
|
|
347
|
+
})
|
|
348
|
+
.add('PATCH', '/forms/:id', async (call) => {
|
|
349
|
+
const who = actor(call);
|
|
350
|
+
const body = parse(formChanges, await this.#body(call.request));
|
|
351
|
+
return json(await forms.update(who, param(call, 'id'), deep(body)));
|
|
352
|
+
})
|
|
353
|
+
.add('DELETE', '/forms/:id', async (call) => json(await forms.trash(actor(call), param(call, 'id'))))
|
|
354
|
+
.add('POST', '/forms/:id/restore', async (call) => json(await forms.restore(actor(call), param(call, 'id'))))
|
|
355
|
+
.add('GET', '/forms/:id/submissions', async (call) => {
|
|
356
|
+
const query = parse(submissionList, Object.fromEntries(call.url.searchParams));
|
|
357
|
+
return json(await submissions.find(actor(call), { formId: param(call, 'id'), limit: query.limit, offset: query.offset, ...(query.status !== undefined && { status: query.status }) }));
|
|
358
|
+
})
|
|
359
|
+
.add('GET', '/forms/:id/submission-counts', async (call) => json(await submissions.counts(actor(call), param(call, 'id'))))
|
|
360
|
+
// The file's text inside JSON: every answer here has one shape, and the editor saves it as a file.
|
|
361
|
+
.add('GET', '/forms/:id/export', async (call) => json({ csv: await submissions.export(actor(call), param(call, 'id')) }))
|
|
362
|
+
.add('PATCH', '/submissions/:id', async (call) => {
|
|
363
|
+
const who = actor(call);
|
|
364
|
+
const { status } = parse(submissionMark, await this.#body(call.request));
|
|
365
|
+
return json(await submissions.mark(who, param(call, 'id'), status));
|
|
366
|
+
})
|
|
367
|
+
.add('DELETE', '/submissions/:id', async (call) => {
|
|
368
|
+
await submissions.delete(actor(call), param(call, 'id'));
|
|
369
|
+
return json({});
|
|
370
|
+
})
|
|
371
|
+
.add('POST', '/submissions/forget', async (call) => {
|
|
372
|
+
const who = actor(call);
|
|
373
|
+
const { email } = parse(forgetRequest, await this.#body(call.request));
|
|
374
|
+
return json({ removed: await submissions.erase(who, email) });
|
|
375
|
+
})
|
|
376
|
+
.add('GET', '/settings/email', async (call) => json(await settings.email(actor(call))))
|
|
377
|
+
.add('PUT', '/settings/email', async (call) => {
|
|
378
|
+
const who = actor(call);
|
|
379
|
+
const body = parse(emailSettingsChanges, await this.#body(call.request));
|
|
380
|
+
return json(await settings.saveEmail(who, deep(body)));
|
|
381
|
+
})
|
|
382
|
+
.add('POST', '/settings/email/test', async (call) => {
|
|
383
|
+
await settings.testEmail(actor(call));
|
|
384
|
+
return json({});
|
|
385
|
+
})
|
|
386
|
+
.add('GET', '/settings/general', async (call) => json(await settings.general(actor(call))))
|
|
387
|
+
.add('PUT', '/settings/general', async (call) => {
|
|
388
|
+
const who = actor(call);
|
|
389
|
+
return json(await settings.saveGeneral(who, parse(generalSettingsChanges, await this.#body(call.request))));
|
|
390
|
+
})
|
|
391
|
+
.add('GET', '/settings/storage', async (call) => json(await settings.storage(actor(call))))
|
|
392
|
+
.add('PUT', '/settings/storage', async (call) => {
|
|
393
|
+
const who = actor(call);
|
|
394
|
+
const body = parse(storageSettingsChanges, await this.#body(call.request));
|
|
395
|
+
return json(await settings.saveStorage(who, deep(body)));
|
|
396
|
+
})
|
|
397
|
+
.add('POST', '/settings/storage/test', async (call) => {
|
|
398
|
+
await settings.testStorage(actor(call));
|
|
399
|
+
return json({});
|
|
400
|
+
})
|
|
401
|
+
.add('GET', '/settings/forms', async (call) => json(await settings.forms(actor(call))))
|
|
402
|
+
.add('PUT', '/settings/forms', async (call) => {
|
|
403
|
+
const who = actor(call);
|
|
404
|
+
const body = parse(formsSettingsChanges, await this.#body(call.request));
|
|
405
|
+
return json(await settings.saveForms(who, deep(body)));
|
|
406
|
+
})
|
|
407
|
+
.add('POST', '/settings/forms/test', async (call) => {
|
|
408
|
+
await settings.testForms(actor(call));
|
|
409
|
+
return json({});
|
|
410
|
+
})
|
|
411
|
+
.add('GET', '/pipeline', async (call) => json(await pipeline.get(actor(call))))
|
|
412
|
+
.add('PUT', '/pipeline', async (call) => {
|
|
413
|
+
const who = actor(call);
|
|
414
|
+
const body = parse(pipelineChanges, await this.#body(call.request));
|
|
415
|
+
return json(await pipeline.save(who, deep(body)));
|
|
416
|
+
})
|
|
417
|
+
.add('GET', '/custom-fields', async (call) => json(await customFields.get(actor(call))))
|
|
418
|
+
.add('PUT', '/custom-fields', async (call) => {
|
|
419
|
+
const who = actor(call);
|
|
420
|
+
const body = parse(customFieldsChanges, await this.#body(call.request));
|
|
421
|
+
return json(await customFields.save(who, deep(body)));
|
|
422
|
+
})
|
|
423
|
+
.add('GET', '/deals', async (call) => {
|
|
424
|
+
const query = parse(dealList, Object.fromEntries(call.url.searchParams));
|
|
425
|
+
return json(await deals.find(actor(call), {
|
|
426
|
+
limit: query.limit,
|
|
427
|
+
offset: query.offset,
|
|
428
|
+
...(query.contact !== undefined && { contactId: query.contact }),
|
|
429
|
+
...(query.aboutType !== undefined && query.aboutEntry !== undefined && { about: { typeId: query.aboutType, entry: query.aboutEntry } }),
|
|
430
|
+
...(query.stage !== undefined && { stage: query.stage }),
|
|
431
|
+
...(query.owner !== undefined && { ownerId: query.owner === 'none' ? null : query.owner }),
|
|
432
|
+
}));
|
|
433
|
+
})
|
|
434
|
+
.add('POST', '/deals', async (call) => {
|
|
435
|
+
const who = actor(call);
|
|
436
|
+
const body = parse(newDeal, await this.#body(call.request));
|
|
437
|
+
return json(await deals.create(who, deep(body)), 201);
|
|
438
|
+
})
|
|
439
|
+
.add('GET', '/deals/forecast', async (call) => json(await deals.forecast(actor(call))))
|
|
440
|
+
.add('GET', '/deals/:id', async (call) => json(await deals.get(actor(call), param(call, 'id'))))
|
|
441
|
+
.add('PATCH', '/deals/:id', async (call) => {
|
|
442
|
+
const who = actor(call);
|
|
443
|
+
const body = parse(dealChanges, await this.#body(call.request));
|
|
444
|
+
return json(await deals.update(who, param(call, 'id'), deep(body)));
|
|
445
|
+
})
|
|
446
|
+
.add('DELETE', '/deals/:id', async (call) => {
|
|
447
|
+
await deals.delete(actor(call), param(call, 'id'));
|
|
448
|
+
return json({});
|
|
449
|
+
})
|
|
450
|
+
// Who a contact can be given to: names and roles, never an email.
|
|
451
|
+
.add('GET', '/team', async (call) => json({ items: await contacts.owners(actor(call)) }))
|
|
452
|
+
.add('GET', '/contacts', async (call) => {
|
|
453
|
+
const query = parse(contactList, Object.fromEntries(call.url.searchParams));
|
|
454
|
+
return json(await contacts.find(actor(call), {
|
|
455
|
+
limit: query.limit,
|
|
456
|
+
offset: query.offset,
|
|
457
|
+
...(query.search !== undefined && { search: query.search }),
|
|
458
|
+
...(query.stage !== undefined && { stage: query.stage }),
|
|
459
|
+
...(query.owner !== undefined && { ownerId: query.owner === 'none' ? null : query.owner }),
|
|
460
|
+
...(query.due !== undefined && { followUpBy: query.due }),
|
|
461
|
+
}));
|
|
462
|
+
})
|
|
463
|
+
.add('POST', '/contacts', async (call) => {
|
|
464
|
+
const who = actor(call);
|
|
465
|
+
const body = parse(newContact, await this.#body(call.request));
|
|
466
|
+
return json(await contacts.create(who, deep(body)), 201);
|
|
467
|
+
})
|
|
468
|
+
.add('POST', '/contacts/import', async (call) => {
|
|
469
|
+
const who = actor(call);
|
|
470
|
+
const { rows } = parse(contactImport, await this.#body(call.request));
|
|
471
|
+
return json(await contacts.import(who, deep(rows)));
|
|
472
|
+
})
|
|
473
|
+
.add('GET', '/contacts/:id', async (call) => json(await contacts.get(actor(call), param(call, 'id'))))
|
|
474
|
+
.add('PATCH', '/contacts/:id', async (call) => {
|
|
475
|
+
const who = actor(call);
|
|
476
|
+
const body = parse(contactChanges, await this.#body(call.request));
|
|
477
|
+
return json(await contacts.update(who, param(call, 'id'), deep(body)));
|
|
478
|
+
})
|
|
479
|
+
// Erasing a person: the contact, their notes and everything they sent.
|
|
480
|
+
.add('DELETE', '/contacts/:id', async (call) => json({ removed: await contacts.erase(actor(call), param(call, 'id')) }))
|
|
481
|
+
.add('GET', '/contacts/:id/timeline', async (call) => json({ items: await contacts.timeline(actor(call), param(call, 'id')) }))
|
|
482
|
+
// The file's text inside JSON, as with a form's export: the editor saves it as a file.
|
|
483
|
+
.add('GET', '/contacts/:id/export', async (call) => json({ file: await contacts.export(actor(call), param(call, 'id')) }))
|
|
484
|
+
.add('POST', '/contacts/:id/notes', async (call) => {
|
|
485
|
+
const who = actor(call);
|
|
486
|
+
const { text } = parse(newNote, await this.#body(call.request));
|
|
487
|
+
return json(await contacts.addNote(who, param(call, 'id'), text), 201);
|
|
488
|
+
})
|
|
489
|
+
.add('DELETE', '/contacts/:id/notes/:note', async (call) => {
|
|
490
|
+
await contacts.deleteNote(actor(call), param(call, 'id'), param(call, 'note'));
|
|
491
|
+
return json({});
|
|
492
|
+
});
|
|
493
|
+
const { people } = options;
|
|
494
|
+
if (people) {
|
|
495
|
+
this.#router
|
|
496
|
+
.add('GET', '/people', async (call) => json({ items: await people.listUsers(actor(call)) }))
|
|
497
|
+
.add('POST', '/people', async (call) => {
|
|
498
|
+
const who = actor(call);
|
|
499
|
+
const { role, ...person } = parse(newPerson, await this.#body(call.request));
|
|
500
|
+
// Which roles there are is the people service's to say, in its own words.
|
|
501
|
+
return json(await people.invite(who, { ...person, role: role }), 201);
|
|
502
|
+
})
|
|
503
|
+
.add('PATCH', '/people/:id', async (call) => {
|
|
504
|
+
const who = actor(call);
|
|
505
|
+
const { role } = parse(roleChange, await this.#body(call.request));
|
|
506
|
+
return json(await people.changeRole(who, param(call, 'id'), role));
|
|
507
|
+
})
|
|
508
|
+
.add('DELETE', '/people/:id', async (call) => {
|
|
509
|
+
await people.remove(actor(call), param(call, 'id'));
|
|
510
|
+
return json({});
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
/** Answers one request. Never throws: whatever goes wrong becomes a response. */
|
|
515
|
+
handle = async (request) => {
|
|
516
|
+
try {
|
|
517
|
+
const url = new URL(request.url);
|
|
518
|
+
const inside = url.pathname === this.#basePath || url.pathname.startsWith(`${this.#basePath}/`);
|
|
519
|
+
// A plugin's own addresses: `/plugins/<name>/<whatever it added>`. Which there are is the plugin's to say.
|
|
520
|
+
const own = inside ? PLUGIN_ADDRESS.exec(url.pathname.slice(this.#basePath.length)) : null;
|
|
521
|
+
if (own)
|
|
522
|
+
return await this.#plugin(request, url, decodeURIComponent(own[1] ?? ''), `/${own[2] ?? ''}`);
|
|
523
|
+
const match = inside ? this.#router.match(request.method, url.pathname.slice(this.#basePath.length)) : { kind: 'none' };
|
|
524
|
+
if (match.kind === 'none')
|
|
525
|
+
throw new ApiError(404, 'not_found', 'There is nothing at this address.');
|
|
526
|
+
if (match.kind === 'wrong-method') {
|
|
527
|
+
throw new ApiError(405, 'method_not_allowed', `This address does not take ${request.method}.`, { allow: match.allowed.join(', ') });
|
|
528
|
+
}
|
|
529
|
+
if (request.method !== 'GET')
|
|
530
|
+
this.#requireOwnPage(request, url, match.handler === this.#upload ? IMAGE_TYPES : JSON_ONLY);
|
|
531
|
+
const session = await this.#options.authenticator.authenticate(request);
|
|
532
|
+
return await match.handler({ request, url, params: match.params, session });
|
|
533
|
+
}
|
|
534
|
+
catch (error) {
|
|
535
|
+
if (isFault(error))
|
|
536
|
+
this.#options.onFault?.(error, request);
|
|
537
|
+
return errorResponse(error);
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
/** Hands a request to a plugin, under the rules every address here keeps: a session, and a change only from the site's own pages. */
|
|
541
|
+
async #plugin(request, url, name, path) {
|
|
542
|
+
if (!PLUGIN_METHODS.has(request.method)) {
|
|
543
|
+
throw new ApiError(405, 'method_not_allowed', `This address does not take ${request.method}.`, { allow: [...PLUGIN_METHODS].join(', ') });
|
|
544
|
+
}
|
|
545
|
+
if (request.method !== 'GET')
|
|
546
|
+
this.#requireOwnPage(request, url, JSON_ONLY);
|
|
547
|
+
const session = await this.#options.authenticator.authenticate(request);
|
|
548
|
+
const who = actor({ request, url, params: {}, session });
|
|
549
|
+
const body = request.method === 'GET' ? undefined : await this.#body(request);
|
|
550
|
+
const answer = await this.#options.cms.plugins.call(who, name, request.method, path, { query: Object.fromEntries(url.searchParams), body });
|
|
551
|
+
return json(answer === undefined ? {} : answer);
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Takes one image: the file is the request's body, and `?name=` says what it was called on the
|
|
555
|
+
* person's computer. The one route that is not JSON, since a file inside JSON grows by a third.
|
|
556
|
+
*/
|
|
557
|
+
#upload = async (call) => {
|
|
558
|
+
const who = actor(call);
|
|
559
|
+
const limit = this.#options.cms.media.maxUploadBytes;
|
|
560
|
+
const bytes = await this.#bytes(call.request, limit);
|
|
561
|
+
const image = await this.#options.cms.media.upload(who, { fileName: call.url.searchParams.get('name') ?? '', bytes });
|
|
562
|
+
return json(image, 201);
|
|
563
|
+
};
|
|
564
|
+
/**
|
|
565
|
+
* Refuses a change that another site's page is trying to make with the person's session. A
|
|
566
|
+
* browser always says where such a request comes from, and cannot be made to send JSON or an
|
|
567
|
+
* image as the body across sites without asking first, so both are checked.
|
|
568
|
+
*/
|
|
569
|
+
#requireOwnPage(request, url, accepted) {
|
|
570
|
+
const origin = request.headers.get('origin');
|
|
571
|
+
if (origin !== null && origin !== url.origin && !(this.#options.trustedOrigins ?? []).includes(origin)) {
|
|
572
|
+
throw new ApiError(403, 'forbidden', 'This request came from another site, so it was refused.');
|
|
573
|
+
}
|
|
574
|
+
if (!accepted.has(contentTypeOf(request))) {
|
|
575
|
+
throw new ApiError(415, 'unsupported_media_type', accepted === IMAGE_TYPES
|
|
576
|
+
? 'Send the image itself as the request, with the content type image/jpeg, image/png or image/webp.'
|
|
577
|
+
: 'Send the request as JSON, with the content type application/json.');
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
/** The request's body as it is. Stops reading as soon as it is more than the limit. */
|
|
581
|
+
async #bytes(request, limit, refusal) {
|
|
582
|
+
const megabytes = (limit / 1_000_000).toFixed(1).replace(/\.0$/, '');
|
|
583
|
+
const tooLarge = refusal ?? new ApiError(413, 'too_large', `The file is more than the ${megabytes} MB an upload can be. Make it smaller first.`);
|
|
584
|
+
if (Number(request.headers.get('content-length') ?? 0) > limit)
|
|
585
|
+
throw tooLarge;
|
|
586
|
+
const chunks = [];
|
|
587
|
+
let size = 0;
|
|
588
|
+
const reader = request.body?.getReader();
|
|
589
|
+
for (let part = await reader?.read(); part && !part.done; part = await reader?.read()) {
|
|
590
|
+
size += part.value.length;
|
|
591
|
+
if (size > limit) {
|
|
592
|
+
await reader?.cancel();
|
|
593
|
+
throw tooLarge;
|
|
594
|
+
}
|
|
595
|
+
chunks.push(part.value);
|
|
596
|
+
}
|
|
597
|
+
const bytes = new Uint8Array(size);
|
|
598
|
+
let at = 0;
|
|
599
|
+
for (const chunk of chunks) {
|
|
600
|
+
bytes.set(chunk, at);
|
|
601
|
+
at += chunk.length;
|
|
602
|
+
}
|
|
603
|
+
return bytes;
|
|
604
|
+
}
|
|
605
|
+
/** The request's JSON, or `{}` when it sent none. */
|
|
606
|
+
async #body(request) {
|
|
607
|
+
const limit = this.#options.maxBodyBytes ?? 1_000_000;
|
|
608
|
+
const tooLarge = new ApiError(413, 'too_large', `This is more than the ${Math.round(limit / 1000)} kB one request may carry.`);
|
|
609
|
+
// Read with the limit in force, whatever length the request claimed: a body sent in parts says none.
|
|
610
|
+
const text = new TextDecoder().decode(await this.#bytes(request, limit, tooLarge));
|
|
611
|
+
if (text.trim() === '')
|
|
612
|
+
return {};
|
|
613
|
+
try {
|
|
614
|
+
return JSON.parse(text);
|
|
615
|
+
}
|
|
616
|
+
catch {
|
|
617
|
+
throw new ApiError(400, 'bad_request', 'The request is not valid JSON.');
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
const JSON_ONLY = new Set(['application/json']);
|
|
622
|
+
/** Who is asking, for the services to check. Refuses a request nobody is signed in for. */
|
|
623
|
+
function actor(call) {
|
|
624
|
+
if (!call.session)
|
|
625
|
+
throw new ApiError(401, 'unauthenticated', 'Sign in to continue.');
|
|
626
|
+
return call.session.actor;
|
|
627
|
+
}
|
|
628
|
+
/** What was sent without the properties that were left out, which a service reads as "not given". */
|
|
629
|
+
function given(body) {
|
|
630
|
+
return Object.fromEntries(Object.entries(body).filter(([, value]) => value !== undefined));
|
|
631
|
+
}
|
|
632
|
+
/** `given`, for a body that holds a list of objects: what was left out of each is left out too. */
|
|
633
|
+
function deep(body) {
|
|
634
|
+
const clean = (value) => Array.isArray(value)
|
|
635
|
+
? value.map(clean)
|
|
636
|
+
: typeof value === 'object' && value !== null
|
|
637
|
+
? Object.fromEntries(Object.entries(value).filter(([, inner]) => inner !== undefined).map(([key, inner]) => [key, clean(inner)]))
|
|
638
|
+
: value;
|
|
639
|
+
return clean(body);
|
|
640
|
+
}
|
|
641
|
+
/** The fields that hold the one a request is about, from the top down: `?within=<id>&within=<id>`. None for a type's own field. */
|
|
642
|
+
function within(call) {
|
|
643
|
+
return call.url.searchParams.getAll('within');
|
|
644
|
+
}
|
|
645
|
+
function param(call, name) {
|
|
646
|
+
return call.params[name] ?? '';
|
|
647
|
+
}
|
|
648
|
+
/** What was sent, checked against the shape a route takes. Names the first thing that is wrong. */
|
|
649
|
+
function parse(shape, value) {
|
|
650
|
+
const result = shape.safeParse(value);
|
|
651
|
+
if (result.success)
|
|
652
|
+
return result.data;
|
|
653
|
+
const first = result.error.issues[0];
|
|
654
|
+
const where = first && first.path.length > 0 ? `"${first.path.join('.')}": ` : '';
|
|
655
|
+
throw new ApiError(400, 'bad_request', `The request is not in the shape this address takes. ${where}${first?.message ?? ''}`.trim());
|
|
656
|
+
}
|
|
657
|
+
//# sourceMappingURL=api.js.map
|
package/dist/api.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEnE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAgCrC,8FAA8F;AAC9F,MAAM,WAAW,GAAwB,IAAI,GAAG,CAAC,CAAC,YAAY,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC;AAC5F,qEAAqE;AACrE,MAAM,cAAc,GAAG,4BAA4B,CAAC;AACpD,MAAM,cAAc,GAAwB,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;AACtF,MAAM,aAAa,GAAG,CAAC,OAAgB,EAAU,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAA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AC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAClF,MAAM,IAAI,QAAQ,CAAC,GAAG,EAAE,aAAa,EAAE,uDAAuD,KAAK,GAAG,KAAK,EAAE,OAAO,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;AACvI,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Actor, Role } from '@velocity-astro/cms-core';
|
|
2
|
+
/** The person a request comes from, as the editor shows them. */
|
|
3
|
+
export interface ApiUser {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly email: string;
|
|
6
|
+
readonly name: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ApiSession {
|
|
9
|
+
readonly user: ApiUser;
|
|
10
|
+
/** Who the CMS treats the request as coming from. Its role decides what the request may do. */
|
|
11
|
+
readonly actor: Actor;
|
|
12
|
+
}
|
|
13
|
+
/** The signed-in person as `GET /session` gives them: with their role, so the editor shows what they may use. */
|
|
14
|
+
export interface SessionPerson extends ApiUser {
|
|
15
|
+
readonly role: Role;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Works out who a request comes from. The API never looks at cookies or tokens itself: sign-in
|
|
19
|
+
* belongs to `cms-auth`, and a host can supply its own.
|
|
20
|
+
*/
|
|
21
|
+
export interface Authenticator {
|
|
22
|
+
/** The session the request carries, or `null` when it carries none that is valid. */
|
|
23
|
+
authenticate(request: Request): Promise<ApiSession | null>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=authenticator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authenticator.d.ts","sourceRoot":"","sources":["../src/authenticator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAE5D,iEAAiE;AACjE,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,+FAA+F;IAC/F,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;CACvB;AAED,iHAAiH;AACjH,MAAM,WAAW,aAAc,SAAQ,OAAO;IAC5C,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,qFAAqF;IACrF,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;CAC5D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authenticator.js","sourceRoot":"","sources":["../src/authenticator.ts"],"names":[],"mappings":""}
|
package/dist/http.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ValidationIssue } from '@velocity-astro/cms-core';
|
|
2
|
+
/** The codes an error response can carry. A client reacts to the code and shows the message. */
|
|
3
|
+
export type ApiErrorCode = 'bad_request' | 'unauthenticated' | 'forbidden' | 'not_found' | 'method_not_allowed' | 'conflict' | 'too_large' | 'unsupported_media_type' | 'validation_failed' | 'internal';
|
|
4
|
+
/** What every error response looks like. */
|
|
5
|
+
export interface ApiErrorBody {
|
|
6
|
+
readonly error: {
|
|
7
|
+
readonly code: ApiErrorCode;
|
|
8
|
+
/** Written for the person, and safe to show as it is. */
|
|
9
|
+
readonly message: string;
|
|
10
|
+
/** With `validation_failed`: each field that needs attention, by key. */
|
|
11
|
+
readonly issues?: readonly ValidationIssue[];
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/** A request the API itself refuses, before or apart from any rule of the CMS. */
|
|
15
|
+
export declare class ApiError extends Error {
|
|
16
|
+
readonly status: number;
|
|
17
|
+
readonly code: ApiErrorCode;
|
|
18
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
19
|
+
constructor(status: number, code: ApiErrorCode, message: string, headers?: Readonly<Record<string, string>>);
|
|
20
|
+
}
|
|
21
|
+
export declare function json(body: unknown, status?: number, headers?: Readonly<Record<string, string>>): Response;
|
|
22
|
+
/**
|
|
23
|
+
* The response for something thrown. A refusal keeps its own words. A fault says nothing about
|
|
24
|
+
* what went wrong inside, because the message goes to whoever asked.
|
|
25
|
+
*/
|
|
26
|
+
export declare function errorResponse(error: unknown): Response;
|
|
27
|
+
/** Whether a thrown value is a fault of ours, as opposed to a request we refused on purpose. */
|
|
28
|
+
export declare function isFault(error: unknown): boolean;
|
|
29
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3F,gGAAgG;AAChG,MAAM,MAAM,YAAY,GACpB,aAAa,GACb,iBAAiB,GACjB,WAAW,GACX,WAAW,GACX,oBAAoB,GACpB,UAAU,GACV,WAAW,GACX,wBAAwB,GACxB,mBAAmB,GACnB,UAAU,CAAC;AAEf,4CAA4C;AAC5C,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;QAC5B,yDAAyD;QACzD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,yEAAyE;QACzE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;KAC9C,CAAC;CACH;AAED,kFAAkF;AAClF,qBAAa,QAAS,SAAQ,KAAK;IAE/B,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,IAAI,EAAE,YAAY;IAE3B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBAHzC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,YAAY,EAC3B,OAAO,EAAE,MAAM,EACN,OAAO,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM;CAK1D;AAgBD,wBAAgB,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,SAAM,EAAE,OAAO,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM,GAAG,QAAQ,CAE1G;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAatD;AAED,gGAAgG;AAChG,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE/C"}
|
package/dist/http.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { CmsError, ValidationError } from '@velocity-astro/cms-core';
|
|
2
|
+
/** A request the API itself refuses, before or apart from any rule of the CMS. */
|
|
3
|
+
export class ApiError extends Error {
|
|
4
|
+
status;
|
|
5
|
+
code;
|
|
6
|
+
headers;
|
|
7
|
+
constructor(status, code, message, headers = {}) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.status = status;
|
|
10
|
+
this.code = code;
|
|
11
|
+
this.headers = headers;
|
|
12
|
+
this.name = 'ApiError';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/** The HTTP status for each refusal the CMS can raise. Anything else is a fault of ours: 500. */
|
|
16
|
+
const STATUS = {
|
|
17
|
+
validation_failed: { status: 422, code: 'validation_failed' },
|
|
18
|
+
unknown_type: { status: 422, code: 'validation_failed' },
|
|
19
|
+
conflict: { status: 409, code: 'conflict' },
|
|
20
|
+
not_found: { status: 404, code: 'not_found' },
|
|
21
|
+
forbidden: { status: 403, code: 'forbidden' },
|
|
22
|
+
// A plugin broke while answering. The message is the host's, and says nothing of the inside.
|
|
23
|
+
plugin_failed: { status: 502, code: 'internal' },
|
|
24
|
+
};
|
|
25
|
+
// Nothing the API says may be kept by a cache: it includes drafts, and it differs per person.
|
|
26
|
+
const HEADERS = { 'content-type': 'application/json; charset=utf-8', 'cache-control': 'no-store' };
|
|
27
|
+
export function json(body, status = 200, headers = {}) {
|
|
28
|
+
return new Response(JSON.stringify(body), { status, headers: { ...HEADERS, ...headers } });
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The response for something thrown. A refusal keeps its own words. A fault says nothing about
|
|
32
|
+
* what went wrong inside, because the message goes to whoever asked.
|
|
33
|
+
*/
|
|
34
|
+
export function errorResponse(error) {
|
|
35
|
+
if (error instanceof ApiError) {
|
|
36
|
+
return json({ error: { code: error.code, message: error.message } }, error.status, error.headers);
|
|
37
|
+
}
|
|
38
|
+
const known = error instanceof CmsError ? STATUS[error.code] : undefined;
|
|
39
|
+
if (error instanceof CmsError && known) {
|
|
40
|
+
const issues = error instanceof ValidationError ? { issues: error.issues } : {};
|
|
41
|
+
return json({ error: { code: known.code, message: error.message, ...issues } }, known.status);
|
|
42
|
+
}
|
|
43
|
+
return json({ error: { code: 'internal', message: 'Something went wrong on the server. Try again in a moment.' } }, 500);
|
|
44
|
+
}
|
|
45
|
+
/** Whether a thrown value is a fault of ours, as opposed to a request we refused on purpose. */
|
|
46
|
+
export function isFault(error) {
|
|
47
|
+
return !(error instanceof ApiError) && !(error instanceof CmsError && error.code in STATUS);
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=http.js.map
|
package/dist/http.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAwB,MAAM,0BAA0B,CAAC;AA0B3F,kFAAkF;AAClF,MAAM,OAAO,QAAS,SAAQ,KAAK;IAEtB;IACA;IAEA;IAJX,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AC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,EAAyB,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3H,CAAC;IACD,MAAM,KAAK,GAAG,KAAK,YAAY,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACzE,IAAI,KAAK,YAAY,QAAQ,IAAI,KAAK,EAAE,CAAC;QACvC,MAAM,MAAM,GAAG,KAAK,YAAY,eAAe,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAChF,OAAO,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,GAAG,MAAM,EAAE,EAAyB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACvH,CAAC;IACD,OAAO,IAAI,CACT,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,4DAA4D,EAAE,EAAyB,EAC7H,GAAG,CACJ,CAAC;AACJ,CAAC;AAED,gGAAgG;AAChG,MAAM,UAAU,OAAO,CAAC,KAAc;IACpC,OAAO,CAAC,CAAC,KAAK,YAAY,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,YAAY,QAAQ,IAAI,KAAK,CAAC,IAAI,IAAI,MAAM,CAAC,CAAC;AAC9F,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { CmsApi, type CmsApiOptions } from './api.js';
|
|
2
|
+
export type { ApiSession, ApiUser, Authenticator, SessionPerson } from './authenticator.js';
|
|
3
|
+
export type { NewPerson, People, Person } from './people.js';
|
|
4
|
+
export { ApiError, type ApiErrorBody, type ApiErrorCode } from './http.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AACtD,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC5F,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAsB,MAAM,UAAU,CAAC;AAGtD,OAAO,EAAE,QAAQ,EAAwC,MAAM,WAAW,CAAC"}
|
package/dist/people.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Actor, Role } from '@velocity-astro/cms-core';
|
|
2
|
+
/** Someone who can sign in to the editor. */
|
|
3
|
+
export interface Person {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly email: string;
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly role: Role;
|
|
8
|
+
/** Whether they have ever signed in. Left out by a host that cannot tell. */
|
|
9
|
+
readonly hasSignedIn?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface NewPerson {
|
|
12
|
+
readonly email: string;
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly role: Role;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Who can sign in, and what each may do. Sign-in belongs to `cms-auth`, whose `CmsAuth` is one
|
|
18
|
+
* of these; a host with its own sign-in supplies its own, or none, and the editor then has no
|
|
19
|
+
* People screen. Each method checks for itself that the actor may manage people.
|
|
20
|
+
*/
|
|
21
|
+
export interface People {
|
|
22
|
+
/** Everyone who can sign in, by name. */
|
|
23
|
+
listUsers(actor: Actor): Promise<Person[]>;
|
|
24
|
+
/** Lets someone in. Refused for an address that is already here. */
|
|
25
|
+
invite(actor: Actor, person: NewPerson): Promise<Person>;
|
|
26
|
+
/** Changes what someone may do. Refused when it would leave the site without an owner. */
|
|
27
|
+
changeRole(actor: Actor, id: string, role: Role): Promise<Person>;
|
|
28
|
+
/** Takes away someone's access, at once. Refused for oneself and for the last owner. */
|
|
29
|
+
remove(actor: Actor, id: string): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=people.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"people.d.ts","sourceRoot":"","sources":["../src/people.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAE5D,6CAA6C;AAC7C,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,6EAA6E;IAC7E,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,MAAM;IACrB,yCAAyC;IACzC,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC3C,oEAAoE;IACpE,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACzD,0FAA0F;IAC1F,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAClE,wFAAwF;IACxF,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD"}
|
package/dist/people.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"people.js","sourceRoot":"","sources":["../src/people.ts"],"names":[],"mappings":""}
|
package/dist/router.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type Method = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
|
|
2
|
+
export type Match<THandler> = {
|
|
3
|
+
readonly kind: 'found';
|
|
4
|
+
readonly handler: THandler;
|
|
5
|
+
readonly params: Readonly<Record<string, string>>;
|
|
6
|
+
}
|
|
7
|
+
/** The address exists, but not for this method. `allowed` lists the ones it does take. */
|
|
8
|
+
| {
|
|
9
|
+
readonly kind: 'wrong-method';
|
|
10
|
+
readonly allowed: readonly Method[];
|
|
11
|
+
} | {
|
|
12
|
+
readonly kind: 'none';
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Finds the handler for a method and a path. Patterns are plain segments, with `:name` standing
|
|
16
|
+
* for one segment of any text: `/entries/:id/publish`.
|
|
17
|
+
*/
|
|
18
|
+
export declare class Router<THandler> {
|
|
19
|
+
#private;
|
|
20
|
+
add(method: Method, pattern: string, handler: THandler): this;
|
|
21
|
+
match(method: string, path: string): Match<THandler>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;AAQjE,MAAM,MAAM,KAAK,CAAC,QAAQ,IACtB;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CAAE;AAC3G,0FAA0F;GACxF;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GACtE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAI9B;;;GAGG;AACH,qBAAa,MAAM,CAAC,QAAQ;;IAG1B,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG,IAAI;IAK7D,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC;CAWrD"}
|
package/dist/router.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const split = (path) => path.split('/').filter((segment) => segment !== '');
|
|
2
|
+
/**
|
|
3
|
+
* Finds the handler for a method and a path. Patterns are plain segments, with `:name` standing
|
|
4
|
+
* for one segment of any text: `/entries/:id/publish`.
|
|
5
|
+
*/
|
|
6
|
+
export class Router {
|
|
7
|
+
#routes = [];
|
|
8
|
+
add(method, pattern, handler) {
|
|
9
|
+
this.#routes.push({ method, segments: split(pattern), handler });
|
|
10
|
+
return this;
|
|
11
|
+
}
|
|
12
|
+
match(method, path) {
|
|
13
|
+
const segments = split(path);
|
|
14
|
+
const allowed = [];
|
|
15
|
+
for (const route of this.#routes) {
|
|
16
|
+
const params = capture(route.segments, segments);
|
|
17
|
+
if (!params)
|
|
18
|
+
continue;
|
|
19
|
+
if (route.method === method)
|
|
20
|
+
return { kind: 'found', handler: route.handler, params };
|
|
21
|
+
allowed.push(route.method);
|
|
22
|
+
}
|
|
23
|
+
return allowed.length > 0 ? { kind: 'wrong-method', allowed } : { kind: 'none' };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function capture(pattern, segments) {
|
|
27
|
+
if (pattern.length !== segments.length)
|
|
28
|
+
return null;
|
|
29
|
+
const params = {};
|
|
30
|
+
for (const [index, expected] of pattern.entries()) {
|
|
31
|
+
const actual = segments[index] ?? '';
|
|
32
|
+
if (expected.startsWith(':')) {
|
|
33
|
+
try {
|
|
34
|
+
params[expected.slice(1)] = decodeURIComponent(actual);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else if (expected !== actual) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return params;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.js","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAcA,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC;AAEpF;;;GAGG;AACH,MAAM,OAAO,MAAM;IACR,OAAO,GAAsB,EAAE,CAAC;IAEzC,GAAG,CAAC,MAAc,EAAE,OAAe,EAAE,OAAiB;QACpD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;QACjE,OA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AAC,MAAM,CAAC;gBACP,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;aAAM,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;YAC/B,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ApiSession, Authenticator } from '../authenticator.js';
|
|
2
|
+
/**
|
|
3
|
+
* An `Authenticator` that treats every request as coming from one session, or from nobody. For
|
|
4
|
+
* tests and local previews only: it checks nothing.
|
|
5
|
+
*/
|
|
6
|
+
export declare class FixedAuthenticator implements Authenticator {
|
|
7
|
+
session: ApiSession | null;
|
|
8
|
+
constructor(session: ApiSession | null);
|
|
9
|
+
authenticate(): Promise<ApiSession | null>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAErE;;;GAGG;AACH,qBAAa,kBAAmB,YAAW,aAAa;IACnC,OAAO,EAAE,UAAU,GAAG,IAAI;gBAA1B,OAAO,EAAE,UAAU,GAAG,IAAI;IAEvC,YAAY,IAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;CAGjD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An `Authenticator` that treats every request as coming from one session, or from nobody. For
|
|
3
|
+
* tests and local previews only: it checks nothing.
|
|
4
|
+
*/
|
|
5
|
+
export class FixedAuthenticator {
|
|
6
|
+
session;
|
|
7
|
+
constructor(session) {
|
|
8
|
+
this.session = session;
|
|
9
|
+
}
|
|
10
|
+
async authenticate() {
|
|
11
|
+
return this.session;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IACV;IAAnB,YAAmB,OAA0B;QAA1B,YAAO,GAAP,OAAO,CAAmB;IAAG,CAAC;IAEjD,KAAK,CAAC,YAAY;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velocity-astro/cms-api",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0-beta.11",
|
|
4
|
+
"description": "The Velocity CMS over HTTP: what the editor, the CLI and plugins call. Built on web-standard Request and Response, so it runs wherever the site does.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/Velocity-Astro/velocity-cms.git",
|
|
10
|
+
"directory": "packages/cms-api"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://docs.deployvelocity.com/cms/",
|
|
13
|
+
"bugs": "https://github.com/Velocity-Astro/velocity-cms/issues",
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=22.23.4"
|
|
16
|
+
},
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"default": "./dist/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./testing": {
|
|
27
|
+
"types": "./dist/testing/index.d.ts",
|
|
28
|
+
"default": "./dist/testing/index.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"!dist/**/*.test.*"
|
|
34
|
+
],
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@velocity-astro/cms-core": "0.1.0-beta.11"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"zod": "^4.6.6"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"zod": "^4.6.6"
|
|
43
|
+
}
|
|
6
44
|
}
|