@crombolo/api-management 0.9.1 → 0.10.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crombolo/api-management",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Umbraco-compatible Management API handlers for crombolo.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Crombolo",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@crombolo/core": "0.
|
|
32
|
-
"@crombolo/contracts": "0.
|
|
31
|
+
"@crombolo/core": "0.10.0",
|
|
32
|
+
"@crombolo/contracts": "0.10.0"
|
|
33
33
|
}
|
|
34
34
|
}
|
package/src/authorization.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* every set), then, for documents and media, the caller's start nodes and the
|
|
5
5
|
* permission verbs the operation needs on the nodes it names. Users and user
|
|
6
6
|
* groups carry rules about the people involved, which their port enforces.
|
|
7
|
-
* See docs/
|
|
7
|
+
* See docs/backoffice-hosting.md for the table's provenance.
|
|
8
8
|
*/
|
|
9
9
|
import type { OperationInfo } from '@crombolo/contracts'
|
|
10
10
|
import {
|
package/src/handlers/media.ts
CHANGED
|
@@ -440,7 +440,7 @@ export function registerMediaHandlers(router: ManagementApiRouter, port: MediaPo
|
|
|
440
440
|
return done(ctx)
|
|
441
441
|
})
|
|
442
442
|
|
|
443
|
-
// References arrive with relations (
|
|
443
|
+
// References arrive with relations (story 046); nothing is known to refer yet.
|
|
444
444
|
for (const operation of [
|
|
445
445
|
'GetMediaByIdReferencedBy',
|
|
446
446
|
'GetMediaByIdReferencedDescendants',
|
package/src/handlers/package.ts
CHANGED
|
@@ -26,14 +26,18 @@ import { created } from './content-type.ts'
|
|
|
26
26
|
|
|
27
27
|
const packageNotFound = () => problemResponse(notFound('The package could not be found'))
|
|
28
28
|
|
|
29
|
-
/**
|
|
30
|
-
|
|
29
|
+
/**
|
|
30
|
+
* A download filename, as `npm pack` names one: the package name with its scope
|
|
31
|
+
* folded in, then the version. No separators, no surprises.
|
|
32
|
+
*/
|
|
33
|
+
export function packageFileName(name: string, version = '1.0.0'): string {
|
|
31
34
|
const slug = name
|
|
32
35
|
.trim()
|
|
33
36
|
.toLowerCase()
|
|
34
|
-
.replace(
|
|
37
|
+
.replace(/^@/, '')
|
|
38
|
+
.replace(/[^a-z0-9.]+/g, '-')
|
|
35
39
|
.replace(/^-+|-+$/g, '')
|
|
36
|
-
return `${slug || 'package'}.
|
|
40
|
+
return `${slug || 'package'}-${version}.tgz`
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
const toResponse = (definition: PackageDefinition) => ({
|
|
@@ -161,7 +165,7 @@ export function registerPackageHandlers(router: ManagementApiRouter, port: Packa
|
|
|
161
165
|
if (!built) return packageNotFound()
|
|
162
166
|
return new Response(built.bytes, {
|
|
163
167
|
headers: {
|
|
164
|
-
'content-type':
|
|
168
|
+
'content-type': built.contentType,
|
|
165
169
|
'content-disposition': `attachment; filename="${built.fileName}"`,
|
|
166
170
|
},
|
|
167
171
|
})
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Settings, Media and Library sections. Each answers an honest empty result in
|
|
4
4
|
* the shape its operation declares, so every section loads, expands and
|
|
5
5
|
* deep-links without an error toast; every one is replaced by a real handler
|
|
6
|
-
* when its
|
|
6
|
+
* when its story in docs/stories/ lands. Counted
|
|
7
7
|
* separately by `coverage:api`.
|
|
8
8
|
*/
|
|
9
9
|
import { invalidSkipTake, notFound, problemResponse } from '@crombolo/core'
|
|
@@ -23,10 +23,10 @@ const PAGED = [
|
|
|
23
23
|
`GetRecycleBin${b}Children`,
|
|
24
24
|
`GetRecycleBin${b}ReferencedBy`,
|
|
25
25
|
]),
|
|
26
|
-
'GetRecycleBinDocumentReferencedBy', // needs relations,
|
|
26
|
+
'GetRecycleBinDocumentReferencedBy', // needs relations, story 046
|
|
27
27
|
'GetRecycleBinMediaReferencedBy',
|
|
28
28
|
'GetRecycleBinElementReferencedBy',
|
|
29
|
-
// The recycle bin and the trash and delete dialogs; needs relations,
|
|
29
|
+
// The recycle bin and the trash and delete dialogs; needs relations, story 046. Until
|
|
30
30
|
// then they cannot warn that other content links to what is being removed.
|
|
31
31
|
'GetTreeStaticFileRoot',
|
|
32
32
|
'GetTreeStaticFileChildren',
|
package/src/handlers/user.ts
CHANGED
|
@@ -476,7 +476,7 @@ function registerUsers(router: ManagementApiRouter, users: UserPort): void {
|
|
|
476
476
|
return found.status === 'Success' ? Response.json([]) : status(found.status)
|
|
477
477
|
})
|
|
478
478
|
router.handle('DeleteUserById2faByProviderName', noProvider)
|
|
479
|
-
// External backoffice logins arrive with
|
|
479
|
+
// External backoffice logins arrive with story 031's providers.
|
|
480
480
|
router.handle('GetUserCurrentLoginProviders', () => Response.json([]))
|
|
481
481
|
|
|
482
482
|
router.handle('PostSecurityForgotPassword', async (ctx) => {
|
package/src/ports-packages.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Created packages: the definitions the Packages section builds, and the zip a
|
|
3
|
-
* download turns one into. `docs/
|
|
3
|
+
* download turns one into. `docs/bundles.md`.
|
|
4
4
|
*
|
|
5
5
|
* The port hands back built bytes rather than a path, because the artifact is
|
|
6
6
|
* never stored — it is serialized when it is asked for, so it cannot be stale.
|
|
@@ -41,6 +41,7 @@ export type PackageWriteStatus = 'NotFound' | 'DuplicateName' | 'InvalidName'
|
|
|
41
41
|
/** A built package, ready to send. */
|
|
42
42
|
export interface BuiltPackage {
|
|
43
43
|
fileName: string
|
|
44
|
+
contentType: string
|
|
44
45
|
/** Owns its buffer, so it can be a response body without a copy. */
|
|
45
46
|
bytes: Uint8Array<ArrayBuffer>
|
|
46
47
|
}
|
|
@@ -53,6 +54,6 @@ export interface PackagePort {
|
|
|
53
54
|
create(input: PackageDefinitionInput, id: string | undefined): Promise<PackageWriteResult>
|
|
54
55
|
update(id: string, input: PackageDefinitionInput): Promise<PackageWriteResult>
|
|
55
56
|
remove(id: string): Promise<'deleted' | 'notFound'>
|
|
56
|
-
/** Serializes and
|
|
57
|
+
/** Serializes and packs the definition now; undefined when it is gone. */
|
|
57
58
|
build(id: string): Promise<BuiltPackage | undefined>
|
|
58
59
|
}
|