@nickpaustian/tela 0.1.3 → 0.3.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 +40 -0
- package/bin/tela.ts +8 -0
- package/lib/index.js +171 -7
- package/package.json +5 -2
- package/scripts/check-components.ts +20 -0
- package/scripts/media-sync.ts +41 -0
- package/scripts/republish.ts +24 -0
- package/src/api.ts +3 -3
- package/src/components/EntryEditor.lsp +174 -11
- package/src/components/EntryList.lsp +8 -0
- package/src/components/Field.lsp +92 -2
- package/src/components/LinkField.lsp +477 -0
- package/src/components/MarkdownField.lsp +19 -24
- package/src/components/ReferenceField.lsp +22 -1
- package/src/components/RepeaterField.lsp +141 -13
- package/src/components/ToggleField.lsp +63 -0
- package/src/config/fields.ts +104 -1
- package/src/config/seo.ts +4 -2
- package/src/config/types.ts +187 -7
- package/src/content/derive-values.ts +14 -3
- package/src/content/entry.ts +15 -1
- package/src/content/export.ts +199 -14
- package/src/content/gathered.ts +103 -0
- package/src/content/git.ts +1 -1
- package/src/content/hooks.ts +75 -0
- package/src/content/link-address.ts +168 -0
- package/src/content/links.ts +13 -0
- package/src/content/placement.ts +48 -0
- package/src/content/references.ts +31 -4
- package/src/content/rules.ts +24 -4
- package/src/content/shape.ts +192 -0
- package/src/content/store.ts +17 -0
- package/src/content/url.ts +15 -1
- package/src/content/validate.ts +12 -2
- package/src/index.ts +4 -1
- package/src/keys.ts +47 -0
- package/src/media/index.ts +5 -0
- package/src/server/index.ts +145 -33
- package/src/server/library-routes.ts +11 -3
|
@@ -199,6 +199,8 @@ export function libraryRoutes(deps: {
|
|
|
199
199
|
) => (req: T) => Promise<Response>
|
|
200
200
|
can: Can
|
|
201
201
|
json: Json
|
|
202
|
+
/** After a picture's words, or whether it exists, changed: so what publishes it can be brought up to date. */
|
|
203
|
+
changed?: (key: string, user: SessionUser) => Promise<void>
|
|
202
204
|
/** Tela's own browse and describe, for a store that is not a library. */
|
|
203
205
|
fallback: {
|
|
204
206
|
list: (req: Req, user: SessionUser) => Promise<Response>
|
|
@@ -360,12 +362,16 @@ export function libraryRoutes(deps: {
|
|
|
360
362
|
PATCH: either(async (req, user, library) => {
|
|
361
363
|
const found = await asset(user, library, req.params.key)
|
|
362
364
|
await changeable(user, library, found)
|
|
363
|
-
|
|
365
|
+
const described = await upstream(library.client.describe(found.pid, patchOf(await body(req), { defaults: true })))
|
|
366
|
+
await deps.changed?.(req.params.key, user)
|
|
367
|
+
return json(described)
|
|
364
368
|
}, deps.fallback.describe),
|
|
365
369
|
DELETE: route(async (req, user, library) => {
|
|
366
370
|
const found = await asset(user, library, req.params.key)
|
|
367
371
|
await changeable(user, library, found, "delete")
|
|
368
|
-
|
|
372
|
+
const removed = await upstream(library.client.remove(found.pid, reasonOf(await body(req))))
|
|
373
|
+
await deps.changed?.(req.params.key, user)
|
|
374
|
+
return json(removed)
|
|
369
375
|
}),
|
|
370
376
|
},
|
|
371
377
|
|
|
@@ -373,7 +379,9 @@ export function libraryRoutes(deps: {
|
|
|
373
379
|
POST: route(async (req, user, library) => {
|
|
374
380
|
const found = await asset(user, library, req.params.key)
|
|
375
381
|
await changeable(user, library, found, "delete")
|
|
376
|
-
|
|
382
|
+
const restored = await upstream(library.client.restore(found.pid))
|
|
383
|
+
await deps.changed?.(req.params.key, user)
|
|
384
|
+
return json(restored)
|
|
377
385
|
}),
|
|
378
386
|
},
|
|
379
387
|
|