@jini-ai/cms 0.3.11 → 0.4.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/CHANGELOG.md +59 -0
- package/README.md +47 -19
- package/dist/content-types/agent-tools.d.ts +3 -56
- package/dist/content-types/agent-tools.js +22 -6
- package/dist/content-types/cleanup.d.ts +18 -13
- package/dist/content-types/cleanup.js +16 -11
- package/dist/content-types/errors.d.ts +57 -24
- package/dist/content-types/errors.js +56 -39
- package/dist/content-types/field-defs.d.ts +8 -4
- package/dist/content-types/field-defs.js +19 -14
- package/dist/content-types/index-provisioning.d.ts +61 -47
- package/dist/content-types/index-provisioning.js +90 -66
- package/dist/content-types/index.d.ts +4 -3
- package/dist/content-types/lifecycle-dispatch.d.ts +11 -5
- package/dist/content-types/lifecycle-dispatch.js +5 -4
- package/dist/content-types/lifecycle.d.ts +23 -18
- package/dist/content-types/lifecycle.js +71 -64
- package/dist/content-types/repo.memory.d.ts +5 -4
- package/dist/content-types/repo.memory.js +3 -2
- package/dist/content-types/tool-registrations.d.ts +6 -8
- package/dist/content-types/tool-registrations.js +24 -28
- package/dist/content-types/types.d.ts +17 -13
- package/dist/content-types/types.js +11 -5
- package/dist/content-types/write-service.d.ts +20 -22
- package/dist/content-types/write-service.js +78 -75
- package/dist/core/authorization.d.ts +15 -0
- package/dist/core/authorization.js +2 -0
- package/dist/core/commands/change-set.d.ts +15 -7
- package/dist/core/commands/command.d.ts +45 -26
- package/dist/core/commands/command.js +73 -63
- package/dist/core/entity-liveness.d.ts +11 -7
- package/dist/core/entity-liveness.js +5 -4
- package/dist/core/index.d.ts +12 -5
- package/dist/core/index.js +10 -4
- package/dist/core/ports.d.ts +25 -24
- package/dist/core/ports.js +1 -0
- package/dist/core/tools/args.d.ts +49 -0
- package/dist/core/tools/args.js +46 -0
- package/dist/core/tools/index.d.ts +3 -0
- package/dist/core/tools/index.js +3 -0
- package/dist/entries/agent-tools.d.ts +1 -73
- package/dist/entries/agent-tools.js +19 -13
- package/dist/entries/errors.d.ts +28 -14
- package/dist/entries/errors.js +17 -11
- package/dist/entries/field-validation.d.ts +5 -3
- package/dist/entries/field-validation.js +7 -5
- package/dist/entries/index.d.ts +2 -2
- package/dist/entries/lifecycle-dispatch.d.ts +5 -2
- package/dist/entries/lifecycle-dispatch.js +2 -1
- package/dist/entries/list.d.ts +4 -2
- package/dist/entries/list.js +4 -3
- package/dist/entries/repo.memory.d.ts +12 -10
- package/dist/entries/repo.memory.js +11 -10
- package/dist/entries/tool-registrations.d.ts +6 -8
- package/dist/entries/tool-registrations.js +42 -41
- package/dist/entries/types.d.ts +0 -7
- package/dist/entries/write-service.d.ts +28 -29
- package/dist/entries/write-service.js +114 -105
- package/dist/http/settings/cms-adapter.d.ts +20 -0
- package/dist/http/settings/cms-adapter.js +124 -0
- package/dist/http/settings/contracts.d.ts +135 -0
- package/dist/http/settings/contracts.js +2 -0
- package/dist/http/settings/http.d.ts +10 -0
- package/dist/http/settings/http.js +211 -0
- package/dist/http/settings/index.d.ts +5 -0
- package/dist/http/settings/index.js +4 -0
- package/dist/http/settings/shared.d.ts +68 -0
- package/dist/http/settings/shared.js +54 -0
- package/dist/http/settings/stream.d.ts +24 -0
- package/dist/http/settings/stream.js +147 -0
- package/dist/media/agent-tools.d.ts +1 -66
- package/dist/media/agent-tools.js +5 -1
- package/dist/media/blob-gc-lock.d.ts +6 -2
- package/dist/media/blob-gc-lock.js +4 -2
- package/dist/media/blob-gc.d.ts +64 -51
- package/dist/media/blob-gc.js +62 -52
- package/dist/media/blob-key.d.ts +1 -1
- package/dist/media/content-type-sniffer.d.ts +3 -1
- package/dist/media/content-type-sniffer.js +1 -1
- package/dist/media/html-attributes.d.ts +9 -5
- package/dist/media/html-attributes.js +8 -6
- package/dist/media/image-transformer.js +1 -1
- package/dist/media/image-transformer.sharp.d.ts +6 -0
- package/dist/media/image-transformer.sharp.js +12 -6
- package/dist/media/import/fetch-image.d.ts +24 -0
- package/dist/media/import/fetch-image.js +137 -0
- package/dist/media/import/index.d.ts +3 -0
- package/dist/media/import/index.js +3 -0
- package/dist/media/import/ports.d.ts +38 -0
- package/dist/media/index.d.ts +7 -1
- package/dist/media/index.js +1 -0
- package/dist/media/media-service.d.ts +14 -10
- package/dist/media/media-service.js +57 -52
- package/dist/media/ports.d.ts +3 -2
- package/dist/media/rendition-service.d.ts +3 -3
- package/dist/media/rendition-service.js +38 -37
- package/dist/media/repo.memory.d.ts +18 -7
- package/dist/media/repo.memory.js +12 -6
- package/dist/media/tool-registrations.d.ts +16 -15
- package/dist/media/tool-registrations.js +84 -72
- package/dist/media/transform-lock.d.ts +22 -12
- package/dist/media/transform-lock.js +14 -13
- package/dist/media/transform-registry.d.ts +3 -3
- package/dist/media/transform-registry.js +19 -18
- package/dist/media/transform-types.d.ts +8 -3
- package/dist/media/transform-types.js +10 -5
- package/dist/media/types.d.ts +21 -4
- package/dist/media/types.js +15 -2
- package/dist/navigation/agent-tools.d.ts +1 -80
- package/dist/navigation/agent-tools.js +15 -3
- package/dist/navigation/contracts.d.ts +1 -1
- package/dist/navigation/index.d.ts +2 -2
- package/dist/navigation/menu-service.d.ts +57 -40
- package/dist/navigation/menu-service.js +80 -69
- package/dist/navigation/ports.d.ts +1 -1
- package/dist/navigation/read-model.d.ts +3 -1
- package/dist/navigation/read-model.js +2 -2
- package/dist/navigation/reconcile.d.ts +2 -2
- package/dist/navigation/reconcile.js +2 -1
- package/dist/navigation/repo.memory.d.ts +7 -3
- package/dist/navigation/repo.memory.js +4 -2
- package/dist/navigation/resolver.d.ts +4 -1
- package/dist/navigation/resolver.js +1 -1
- package/dist/navigation/tool-registrations.d.ts +6 -8
- package/dist/navigation/tool-registrations.js +44 -42
- package/dist/navigation/types.d.ts +1 -1
- package/dist/presentation/presentation.d.ts +11 -3
- package/dist/presentation/presentation.js +13 -6
- package/dist/presentation/repo.memory.d.ts +6 -2
- package/dist/presentation/repo.memory.js +3 -2
- package/dist/settings/agent-tools.d.ts +2 -75
- package/dist/settings/agent-tools.js +49 -45
- package/dist/settings/agent-value-write-tools.d.ts +22 -0
- package/dist/settings/agent-value-write-tools.js +154 -0
- package/dist/settings/agent-writable-preferences.js +8 -20
- package/dist/settings/agent-write-denylist.d.ts +19 -0
- package/dist/settings/agent-write-denylist.js +15 -0
- package/dist/settings/change-feed.d.ts +11 -2
- package/dist/settings/change-feed.js +4 -4
- package/dist/settings/definitions-dispatch.d.ts +8 -3
- package/dist/settings/definitions-dispatch.js +5 -5
- package/dist/settings/dictionaries/index.d.ts +5 -2
- package/dist/settings/dictionaries/index.js +2 -2
- package/dist/settings/dictionaries/settings-dialog.ar.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.bn.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.de.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.es.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.fa.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.fr.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.hi.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.hu.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.id.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.it.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.ja.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.ko.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.pl.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.pt-BR.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.ru.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.th.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.tr.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.uk.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.ur.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.zh-CN.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.zh-TW.js +0 -1
- package/dist/settings/ensure-definitions.d.ts +5 -5
- package/dist/settings/errors.d.ts +7 -1
- package/dist/settings/errors.js +7 -1
- package/dist/settings/index.d.ts +4 -1
- package/dist/settings/index.js +1 -0
- package/dist/settings/ports.d.ts +6 -5
- package/dist/settings/principal-lookup.d.ts +9 -0
- package/dist/settings/principal-lookup.js +2 -0
- package/dist/settings/purge-service.d.ts +5 -4
- package/dist/settings/purge-service.js +3 -2
- package/dist/settings/settings.d.ts +22 -7
- package/dist/settings/settings.js +47 -26
- package/dist/settings/tool-registrations.d.ts +27 -32
- package/dist/settings/tool-registrations.js +66 -56
- package/dist/settings/types.d.ts +1 -1
- package/dist/settings/ui-tab-definitions.d.ts +1 -1
- package/dist/settings/write-service.d.ts +32 -26
- package/dist/settings/write-service.js +26 -20
- package/dist/taxonomy/agent-tools.d.ts +1 -66
- package/dist/taxonomy/agent-tools.js +25 -15
- package/dist/taxonomy/content-lookup.js +1 -1
- package/dist/taxonomy/index.d.ts +2 -2
- package/dist/taxonomy/merge-term.d.ts +7 -4
- package/dist/taxonomy/merge-term.js +7 -5
- package/dist/taxonomy/repo.memory.d.ts +42 -19
- package/dist/taxonomy/repo.memory.js +14 -12
- package/dist/taxonomy/validation-chain.d.ts +39 -18
- package/dist/taxonomy/validation-chain.js +35 -25
- package/dist/taxonomy/write-service.d.ts +103 -44
- package/dist/taxonomy/write-service.js +221 -179
- package/dist/trash/adapters/record-store.d.ts +52 -0
- package/dist/trash/adapters/record-store.js +36 -0
- package/dist/trash/cursor.d.ts +20 -0
- package/dist/trash/cursor.js +36 -0
- package/dist/trash/follow-ups.d.ts +76 -0
- package/dist/trash/follow-ups.js +46 -0
- package/dist/trash/index.d.ts +8 -0
- package/dist/trash/index.js +8 -0
- package/dist/trash/ports.d.ts +308 -0
- package/dist/trash/ports.js +2 -0
- package/dist/trash/repo.memory.d.ts +50 -0
- package/dist/trash/repo.memory.js +114 -0
- package/dist/trash/sweeper.d.ts +77 -0
- package/dist/trash/sweeper.js +127 -0
- package/dist/trash/write-service.d.ts +100 -0
- package/dist/trash/write-service.js +242 -0
- package/dist/workspace/agent-tools.d.ts +1 -59
- package/dist/workspace/agent-tools.js +27 -12
- package/dist/workspace/create.d.ts +31 -6
- package/dist/workspace/create.js +18 -5
- package/dist/workspace/delete.d.ts +18 -13
- package/dist/workspace/delete.js +20 -12
- package/dist/workspace/index.d.ts +1 -1
- package/dist/workspace/repo.memory.d.ts +19 -4
- package/dist/workspace/repo.memory.js +26 -4
- package/dist/workspace/tool-registrations.d.ts +2 -2
- package/dist/workspace/tool-registrations.js +13 -13
- package/dist/workspace/update.d.ts +6 -5
- package/dist/workspace/update.js +9 -8
- package/package.json +44 -38
- package/dist/core/tools/registration-kit.d.ts +0 -346
- package/dist/core/tools/registration-kit.js +0 -426
- package/dist/identity/admin-crud-service.d.ts +0 -280
- package/dist/identity/admin-crud-service.js +0 -468
- package/dist/identity/agent-tool-input.d.ts +0 -58
- package/dist/identity/agent-tool-input.js +0 -126
- package/dist/identity/agent-tools.d.ts +0 -101
- package/dist/identity/agent-tools.js +0 -290
- package/dist/identity/auth-service.d.ts +0 -118
- package/dist/identity/auth-service.js +0 -170
- package/dist/identity/authorize.d.ts +0 -90
- package/dist/identity/authorize.js +0 -94
- package/dist/identity/grant-service.d.ts +0 -198
- package/dist/identity/grant-service.js +0 -361
- package/dist/identity/hasher.d.ts +0 -39
- package/dist/identity/hasher.js +0 -39
- package/dist/identity/index.d.ts +0 -62
- package/dist/identity/index.js +0 -54
- package/dist/identity/password-policy.d.ts +0 -57
- package/dist/identity/password-policy.js +0 -66
- package/dist/identity/permission-migrations.d.ts +0 -86
- package/dist/identity/permission-migrations.js +0 -67
- package/dist/identity/permissions.d.ts +0 -35
- package/dist/identity/permissions.js +0 -603
- package/dist/identity/ports.d.ts +0 -201
- package/dist/identity/repo.memory.d.ts +0 -164
- package/dist/identity/repo.memory.js +0 -224
- package/dist/identity/seed.d.ts +0 -54
- package/dist/identity/seed.js +0 -429
- package/dist/identity/tool-registrations.d.ts +0 -50
- package/dist/identity/tool-registrations.js +0 -419
- package/dist/identity/types.d.ts +0 -185
- package/dist/identity/types.js +0 -64
- package/dist/identity/username.d.ts +0 -12
- package/dist/identity/username.js +0 -14
- package/dist/server/index.d.ts +0 -28
- package/dist/server/index.js +0 -28
- /package/dist/{identity → media/import}/ports.js +0 -0
|
@@ -30,22 +30,22 @@
|
|
|
30
30
|
*
|
|
31
31
|
* Deliberate absences (the point of a catalog, not an oversight):
|
|
32
32
|
* - There is no delete/purge tool: `write-service.ts` exposes no delete function at all (confirmed
|
|
33
|
-
*
|
|
33
|
+
* by reading the whole file) — there is nothing to wrap or exclude on that front.
|
|
34
34
|
* - `collections_entry_update`'s schema omits `bodyJson` even though `updateEntry` itself accepts an
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
35
|
+
* optional `bodyJson` (used internally by `widgets/embed-service.ts`'s own guardrailed
|
|
36
|
+
* mutation path). The generic Collections admin route (`entries/update.ts`) never forwards
|
|
37
|
+
* `body.bodyJson` at all — only `title`/`fieldsJson`/`expectedVersion` — so exposing it here would
|
|
38
|
+
* invent capability beyond what the human admin UI's own Collections editor exposes. Omitting it
|
|
39
|
+
* from the input is enough: `updateEntry` leaves `bodyJson` unchanged whenever the field is
|
|
40
|
+
* `undefined`, so this exclusion changes nothing about what a call can still do.
|
|
41
41
|
* - `collections_entry_list`'s schema omits `status`/`orderBy`/`limit` even though
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
42
|
+
* `EntryListPort.listByWorkspace` supports all three (added for `widgets/resolvers/recent-entries.ts`'s
|
|
43
|
+
* own bounded-query need) — `server/routes/admin/entries/list.ts` only ever forwards `type` from
|
|
44
|
+
* its query string, so the other three are not part of what the Collections admin list screen
|
|
45
|
+
* itself can do; adding them here would again exceed the human surface this catalog mirrors.
|
|
46
46
|
*
|
|
47
47
|
* What IS included, and why it is safe: all four write-service functions are `admin.collections.*`
|
|
48
|
-
* self-enforcing (each opens with its own `deps.authorize
|
|
48
|
+
* self-enforcing (each opens with its own `deps.authorize` call before any other side effect —
|
|
49
49
|
* confirmed by reading `write-service.ts` directly), and `publishEntry`/`unpublishEntry` are ordinary,
|
|
50
50
|
* fully reversible status flips with a full revision trail (`entryRepo.appendRevision`) — publishing
|
|
51
51
|
* and unpublishing are each other's own undo.
|
|
@@ -55,7 +55,13 @@
|
|
|
55
55
|
*
|
|
56
56
|
* Architectural role:
|
|
57
57
|
* `features/entries` domain declaration. No dependencies.
|
|
58
|
-
|
|
58
|
+
* See docs/decisions/DR-002-content-lifecycle-and-cleanup.md.
|
|
59
|
+
*
|
|
60
|
+
*
|
|
61
|
+
* JSON Schema for this tool's `input`, published to the model via `ToolDescriptor.inputSchema`
|
|
62
|
+
* (`@jini-ai/core`'s `registration-kit.ts`'s `buildDomainRegistrations`, which refuses to wire any
|
|
63
|
+
* tool lacking one).
|
|
64
|
+
*/
|
|
59
65
|
const ENTRY_ID_SCHEMA = {
|
|
60
66
|
type: "string",
|
|
61
67
|
minLength: 1,
|
package/dist/entries/errors.d.ts
CHANGED
|
@@ -9,35 +9,49 @@
|
|
|
9
9
|
* `features/entries` domain logic. No dependencies.
|
|
10
10
|
*/
|
|
11
11
|
export declare class ForbiddenError extends Error {
|
|
12
|
-
constructor(message:
|
|
12
|
+
constructor({ message }: {
|
|
13
|
+
message: string;
|
|
14
|
+
}, _optional?: Record<string, never>);
|
|
13
15
|
}
|
|
14
16
|
export declare class EntryNotFoundError extends Error {
|
|
15
|
-
constructor(
|
|
17
|
+
constructor(requiredArgs: {
|
|
18
|
+
message: string;
|
|
19
|
+
}, optionalArgs?: Record<string, never>);
|
|
16
20
|
}
|
|
17
|
-
/**
|
|
21
|
+
/** — the owning content type does not exist, or exists only in a different workspace. See docs/decisions/DR-002-content-lifecycle-and-cleanup.md. */
|
|
18
22
|
export declare class ContentTypeNotFoundError extends Error {
|
|
19
|
-
constructor(
|
|
23
|
+
constructor(requiredArgs: {
|
|
24
|
+
message: string;
|
|
25
|
+
}, optionalArgs?: Record<string, never>);
|
|
20
26
|
}
|
|
21
|
-
/**
|
|
27
|
+
/** (create) / (update/publish/unpublish) — the owning content type's status forbids this write. See docs/decisions/DR-002-content-lifecycle-and-cleanup.md. */
|
|
22
28
|
export declare class ContentTypeNotActiveError extends Error {
|
|
23
|
-
constructor(
|
|
29
|
+
constructor(requiredArgs: {
|
|
30
|
+
message: string;
|
|
31
|
+
}, optionalArgs?: Record<string, never>);
|
|
24
32
|
}
|
|
25
|
-
/**
|
|
33
|
+
/** — a second entry submitted with an identical `(workspaceId, type, slug)`. See docs/decisions/DR-002-content-lifecycle-and-cleanup.md. */
|
|
26
34
|
export declare class EntrySlugConflictError extends Error {
|
|
27
|
-
constructor(
|
|
35
|
+
constructor(requiredArgs: {
|
|
36
|
+
message: string;
|
|
37
|
+
}, optionalArgs?: Record<string, never>);
|
|
28
38
|
}
|
|
29
39
|
export declare class VersionConflictError extends Error {
|
|
30
|
-
constructor(
|
|
40
|
+
constructor(requiredArgs: {
|
|
41
|
+
message: string;
|
|
42
|
+
}, optionalArgs?: Record<string, never>);
|
|
31
43
|
}
|
|
32
|
-
/**
|
|
44
|
+
/** — `fieldsJson` failed `validateFieldsAgainstSchema` against the owning type's current schema. See docs/decisions/DR-002-content-lifecycle-and-cleanup.md. */
|
|
33
45
|
export declare class EntryFieldValidationError extends Error {
|
|
34
46
|
readonly fieldErrors: Array<{
|
|
35
47
|
field: string;
|
|
36
48
|
reason: string;
|
|
37
49
|
}>;
|
|
38
|
-
constructor(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
50
|
+
constructor(requiredArgs: {
|
|
51
|
+
fieldErrors: Array<{
|
|
52
|
+
field: string;
|
|
53
|
+
reason: string;
|
|
54
|
+
}>;
|
|
55
|
+
}, optionalArgs?: Record<string, never>);
|
|
42
56
|
}
|
|
43
57
|
//# sourceMappingURL=errors.d.ts.map
|
package/dist/entries/errors.js
CHANGED
|
@@ -9,48 +9,54 @@
|
|
|
9
9
|
* `features/entries` domain logic. No dependencies.
|
|
10
10
|
*/
|
|
11
11
|
export class ForbiddenError extends Error {
|
|
12
|
-
constructor(message) {
|
|
12
|
+
constructor({ message }, _optional = {}) {
|
|
13
13
|
super(message);
|
|
14
14
|
this.name = "ForbiddenError";
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
export class EntryNotFoundError extends Error {
|
|
18
|
-
constructor(
|
|
18
|
+
constructor(requiredArgs, optionalArgs = {}) {
|
|
19
|
+
const { message } = requiredArgs;
|
|
19
20
|
super(message);
|
|
20
21
|
this.name = "ENTRY_NOT_FOUND";
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
|
-
/**
|
|
24
|
+
/** — the owning content type does not exist, or exists only in a different workspace. See docs/decisions/DR-002-content-lifecycle-and-cleanup.md. */
|
|
24
25
|
export class ContentTypeNotFoundError extends Error {
|
|
25
|
-
constructor(
|
|
26
|
+
constructor(requiredArgs, optionalArgs = {}) {
|
|
27
|
+
const { message } = requiredArgs;
|
|
26
28
|
super(message);
|
|
27
29
|
this.name = "CONTENT_TYPE_NOT_FOUND";
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
|
-
/**
|
|
32
|
+
/** (create) / (update/publish/unpublish) — the owning content type's status forbids this write. See docs/decisions/DR-002-content-lifecycle-and-cleanup.md. */
|
|
31
33
|
export class ContentTypeNotActiveError extends Error {
|
|
32
|
-
constructor(
|
|
34
|
+
constructor(requiredArgs, optionalArgs = {}) {
|
|
35
|
+
const { message } = requiredArgs;
|
|
33
36
|
super(message);
|
|
34
37
|
this.name = "ContentTypeNotActiveError";
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
|
-
/**
|
|
40
|
+
/** — a second entry submitted with an identical `(workspaceId, type, slug)`. See docs/decisions/DR-002-content-lifecycle-and-cleanup.md. */
|
|
38
41
|
export class EntrySlugConflictError extends Error {
|
|
39
|
-
constructor(
|
|
42
|
+
constructor(requiredArgs, optionalArgs = {}) {
|
|
43
|
+
const { message } = requiredArgs;
|
|
40
44
|
super(message);
|
|
41
45
|
this.name = "ENTRY_SLUG_CONFLICT";
|
|
42
46
|
}
|
|
43
47
|
}
|
|
44
48
|
export class VersionConflictError extends Error {
|
|
45
|
-
constructor(
|
|
49
|
+
constructor(requiredArgs, optionalArgs = {}) {
|
|
50
|
+
const { message } = requiredArgs;
|
|
46
51
|
super(message);
|
|
47
52
|
this.name = "VersionConflictError";
|
|
48
53
|
}
|
|
49
54
|
}
|
|
50
|
-
/**
|
|
55
|
+
/** — `fieldsJson` failed `validateFieldsAgainstSchema` against the owning type's current schema. See docs/decisions/DR-002-content-lifecycle-and-cleanup.md. */
|
|
51
56
|
export class EntryFieldValidationError extends Error {
|
|
52
57
|
fieldErrors;
|
|
53
|
-
constructor(
|
|
58
|
+
constructor(requiredArgs, optionalArgs = {}) {
|
|
59
|
+
const { fieldErrors } = requiredArgs;
|
|
54
60
|
super(`fieldsJson failed schema validation: ${fieldErrors.map((e) => `${e.field}: ${e.reason}`).join("; ")}`);
|
|
55
61
|
this.name = "EntryFieldValidationError";
|
|
56
62
|
this.fieldErrors = fieldErrors;
|
|
@@ -37,16 +37,18 @@ export interface ValidateFieldsResult {
|
|
|
37
37
|
fieldErrors: FieldValidationError[];
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
41
|
-
* schema: envelope shape first
|
|
42
|
-
* kind-conformance
|
|
40
|
+
* — validates a candidate `fieldsJson` payload against a content type's current field
|
|
41
|
+
* schema: envelope shape first, then per-key unrecognized-field rejection and
|
|
42
|
+
* kind-conformance, then a required-field-missing pass.
|
|
43
43
|
*
|
|
44
44
|
* @complexity O(f) in the number of schema fields plus O(k) in the number of submitted keys.
|
|
45
45
|
* @overallScore 100
|
|
46
|
+
* See docs/decisions/DR-002-content-lifecycle-and-cleanup.md.
|
|
46
47
|
*/
|
|
47
48
|
export declare function validateFieldsAgainstSchema(required: {
|
|
48
49
|
schema: ContentTypeFieldDef[];
|
|
49
50
|
fieldsJson: unknown;
|
|
51
|
+
}, optional?: {
|
|
50
52
|
/** The `ext` sub-key this content type's fields live under. Defaults to `"site"` — every existing caller keeps identical behavior unless it opts into a different owner namespace. */
|
|
51
53
|
owner?: string | undefined;
|
|
52
54
|
}): ValidateFieldsResult;
|
|
@@ -120,15 +120,17 @@ function conformsToKind(value, kind) {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
/**
|
|
123
|
-
*
|
|
124
|
-
* schema: envelope shape first
|
|
125
|
-
* kind-conformance
|
|
123
|
+
* — validates a candidate `fieldsJson` payload against a content type's current field
|
|
124
|
+
* schema: envelope shape first, then per-key unrecognized-field rejection and
|
|
125
|
+
* kind-conformance, then a required-field-missing pass.
|
|
126
126
|
*
|
|
127
127
|
* @complexity O(f) in the number of schema fields plus O(k) in the number of submitted keys.
|
|
128
128
|
* @overallScore 100
|
|
129
|
+
* See docs/decisions/DR-002-content-lifecycle-and-cleanup.md.
|
|
129
130
|
*/
|
|
130
|
-
export function validateFieldsAgainstSchema(required) {
|
|
131
|
-
const { schema, fieldsJson
|
|
131
|
+
export function validateFieldsAgainstSchema(required, optional = {}) {
|
|
132
|
+
const { schema, fieldsJson } = required;
|
|
133
|
+
const { owner = "site" } = optional;
|
|
132
134
|
const ext = isPlainObject(fieldsJson) ? fieldsJson.ext : undefined;
|
|
133
135
|
const ownerBag = isPlainObject(ext) ? ext[owner] : undefined;
|
|
134
136
|
if (!isPlainObject(fieldsJson) || !isPlainObject(ext) || !isPlainObject(ownerBag)) {
|
package/dist/entries/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* them is type-only and one-directional, and keeping the entry points separate is what makes that
|
|
11
11
|
* checkable rather than merely intended.
|
|
12
12
|
*/
|
|
13
|
-
export type { EntryStatus, EntryFieldsJson, EntryRecord, OwningContentType, ActorIdentityInput,
|
|
13
|
+
export type { EntryStatus, EntryFieldsJson, EntryRecord, OwningContentType, ActorIdentityInput, } from "./types.js";
|
|
14
14
|
export type { EntryListPort } from "./list.js";
|
|
15
15
|
export { listEntries } from "./list.js";
|
|
16
16
|
export type { FieldValidationError, ValidateFieldsResult, } from "./field-validation.js";
|
|
@@ -37,7 +37,7 @@ export { createEntry, updateEntry, publishEntry, unpublishEntry, importEntry } f
|
|
|
37
37
|
*/
|
|
38
38
|
export { InMemoryEntryRepo, toEntryOutbox } from "./repo.memory.js";
|
|
39
39
|
/** The agent-tool surface for this domain (see `agent-tools.ts` for what is deliberately omitted). */
|
|
40
|
-
export { entriesAgentToolCatalog,
|
|
40
|
+
export { entriesAgentToolCatalog, } from "./agent-tools.js";
|
|
41
41
|
/**
|
|
42
42
|
* The agent-tool wiring for this domain.
|
|
43
43
|
*
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type PublishUnpublishEntryRequired } from "./write-service.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Result } from "@jini-ai/core/primitives";
|
|
3
|
+
import type { EntryRecord } from "./types.js";
|
|
3
4
|
/**
|
|
4
5
|
* @file Entry publish/unpublish `op` dispatch (the closed-union-dispatch convention, same
|
|
5
6
|
* shape as `features/content-types/lifecycle-dispatch.ts`).
|
|
@@ -7,7 +8,9 @@ import type { EntryRecord, Result } from "./types.js";
|
|
|
7
8
|
export declare const ENTRY_LIFECYCLE_OP_NAMES: readonly ["publish", "unpublish"];
|
|
8
9
|
export type EntryLifecycleOp = (typeof ENTRY_LIFECYCLE_OP_NAMES)[number];
|
|
9
10
|
/** Narrows an untrusted `op` string to {@link EntryLifecycleOp}, or `null` if it isn't one. */
|
|
10
|
-
export declare function parseEntryLifecycleOp(
|
|
11
|
+
export declare function parseEntryLifecycleOp(requiredArgs: {
|
|
12
|
+
op: unknown;
|
|
13
|
+
}, optionalArgs?: Record<string, never>): EntryLifecycleOp | null;
|
|
11
14
|
export type EntryLifecycleHandler = (required: PublishUnpublishEntryRequired) => Promise<Result<{
|
|
12
15
|
entry: EntryRecord;
|
|
13
16
|
}, Error>>;
|
|
@@ -5,7 +5,8 @@ import { publishEntry, unpublishEntry } from "./write-service.js";
|
|
|
5
5
|
*/
|
|
6
6
|
export const ENTRY_LIFECYCLE_OP_NAMES = ["publish", "unpublish"];
|
|
7
7
|
/** Narrows an untrusted `op` string to {@link EntryLifecycleOp}, or `null` if it isn't one. */
|
|
8
|
-
export function parseEntryLifecycleOp(
|
|
8
|
+
export function parseEntryLifecycleOp(requiredArgs, optionalArgs = {}) {
|
|
9
|
+
const { op } = requiredArgs;
|
|
9
10
|
return typeof op === "string" && ENTRY_LIFECYCLE_OP_NAMES.includes(op) ? op : null;
|
|
10
11
|
}
|
|
11
12
|
const entryLifecycleOps = {
|
package/dist/entries/list.d.ts
CHANGED
|
@@ -22,8 +22,9 @@ export interface EntryListPort {
|
|
|
22
22
|
* `limit` are pushed down into the query itself (not applied client-side after a full scan) by
|
|
23
23
|
* every real adapter — a caller needing a bounded, sorted read (e.g. a resolver's cost clamp)
|
|
24
24
|
* must supply them rather than fetching everything and truncating in memory. */
|
|
25
|
-
listByWorkspace(
|
|
25
|
+
listByWorkspace(required: {
|
|
26
26
|
workspaceId: string;
|
|
27
|
+
}, optional?: {
|
|
27
28
|
type?: string | undefined;
|
|
28
29
|
status?: EntryStatus | undefined;
|
|
29
30
|
orderBy?: "updatedAt" | undefined;
|
|
@@ -40,8 +41,9 @@ export interface EntryListPort {
|
|
|
40
41
|
export declare function listEntries(required: {
|
|
41
42
|
repo: EntryListPort;
|
|
42
43
|
workspaceId: string;
|
|
44
|
+
}, optional?: {
|
|
43
45
|
type?: string | undefined;
|
|
44
|
-
}
|
|
46
|
+
}): Promise<{
|
|
45
47
|
items: EntryRecord[];
|
|
46
48
|
}>;
|
|
47
49
|
//# sourceMappingURL=list.d.ts.map
|
package/dist/entries/list.js
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* @complexity O(1) plus one `EntryListPort.listByWorkspace()` call.
|
|
5
5
|
* @overallScore 100
|
|
6
6
|
*/
|
|
7
|
-
export async function listEntries(required,
|
|
8
|
-
const { repo, workspaceId
|
|
9
|
-
const
|
|
7
|
+
export async function listEntries(required, optional = {}) {
|
|
8
|
+
const { repo, workspaceId } = required;
|
|
9
|
+
const { type } = optional;
|
|
10
|
+
const items = await repo.listByWorkspace({ workspaceId }, { type });
|
|
10
11
|
return { items };
|
|
11
12
|
}
|
|
12
13
|
//# sourceMappingURL=list.js.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Clock } from "@jini-ai/core/primitives";
|
|
1
2
|
import type { EntryRepoPort, EntryRevisionInput, OutboxPort } from "./write-service.js";
|
|
2
3
|
import type { EntryListPort } from "./list.js";
|
|
3
4
|
import type { EntryRecord, EntryStatus } from "./types.js";
|
|
@@ -21,14 +22,17 @@ export declare class InMemoryEntryRepo implements EntryRepoPort, EntryListPort {
|
|
|
21
22
|
}): Promise<EntryRecord | null>;
|
|
22
23
|
save(row: EntryRecord): Promise<void>;
|
|
23
24
|
appendRevision(revision: EntryRevisionInput): Promise<void>;
|
|
24
|
-
transaction<T>(fn
|
|
25
|
-
|
|
25
|
+
transaction<T>({ fn }: {
|
|
26
|
+
fn: () => Promise<T>;
|
|
27
|
+
}): Promise<T>;
|
|
28
|
+
listByWorkspace(required: {
|
|
26
29
|
workspaceId: string;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
}, optional?: {
|
|
31
|
+
type?: string | undefined;
|
|
32
|
+
status?: EntryStatus | undefined;
|
|
33
|
+
orderBy?: "updatedAt" | undefined;
|
|
34
|
+
orderDirection?: "asc" | "desc" | undefined;
|
|
35
|
+
limit?: number | undefined;
|
|
32
36
|
}): Promise<EntryRecord[]>;
|
|
33
37
|
}
|
|
34
38
|
/** Adapts a real `core/ports` `OutboxPort` into the narrower `{enqueue({name,payload})}` shape
|
|
@@ -53,9 +57,7 @@ export declare function toEntryOutbox(deps: {
|
|
|
53
57
|
payload: Record<string, unknown>;
|
|
54
58
|
}): Promise<void>;
|
|
55
59
|
};
|
|
56
|
-
clock:
|
|
57
|
-
nowIso(): string;
|
|
58
|
-
};
|
|
60
|
+
clock: Clock;
|
|
59
61
|
idGen: {
|
|
60
62
|
newId(): string;
|
|
61
63
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { nowIso as kernelNowIso } from "@jini-ai/core/primitives";
|
|
1
2
|
/**
|
|
2
3
|
* @file In-memory `EntryRepoPort` + `EntryListPort` double (same disclosed rule-of-two-until-a-
|
|
3
4
|
* real-adapter-exists precedent as `features/content-types/repo.memory.ts` — see that file's
|
|
@@ -27,20 +28,20 @@ export class InMemoryEntryRepo {
|
|
|
27
28
|
async appendRevision(revision) {
|
|
28
29
|
this.revisions.push(revision);
|
|
29
30
|
}
|
|
30
|
-
async transaction(fn) {
|
|
31
|
+
async transaction({ fn }) {
|
|
31
32
|
return fn();
|
|
32
33
|
}
|
|
33
|
-
async listByWorkspace(
|
|
34
|
+
async listByWorkspace(required, optional = {}) {
|
|
34
35
|
let rows = [...this.byId.values()]
|
|
35
|
-
.filter((row) => row.workspaceId ===
|
|
36
|
-
.filter((row) => !
|
|
37
|
-
.filter((row) => !
|
|
38
|
-
if (
|
|
39
|
-
const dir =
|
|
36
|
+
.filter((row) => row.workspaceId === required.workspaceId)
|
|
37
|
+
.filter((row) => !optional.type || row.type === optional.type)
|
|
38
|
+
.filter((row) => !optional.status || row.status === optional.status);
|
|
39
|
+
if (optional.orderBy === "updatedAt") {
|
|
40
|
+
const dir = optional.orderDirection === "asc" ? 1 : -1;
|
|
40
41
|
rows = rows.sort((a, b) => (a.updatedAt < b.updatedAt ? -dir : a.updatedAt > b.updatedAt ? dir : 0));
|
|
41
42
|
}
|
|
42
|
-
if (typeof
|
|
43
|
-
rows = rows.slice(0,
|
|
43
|
+
if (typeof optional.limit === "number") {
|
|
44
|
+
rows = rows.slice(0, optional.limit);
|
|
44
45
|
}
|
|
45
46
|
return rows.map((row) => ({ ...row }));
|
|
46
47
|
}
|
|
@@ -64,7 +65,7 @@ export function toEntryOutbox(deps) {
|
|
|
64
65
|
id: deps.idGen.newId(),
|
|
65
66
|
workspaceId: deps.workspaceId,
|
|
66
67
|
name: event.name,
|
|
67
|
-
occurredAt: deps.clock
|
|
68
|
+
occurredAt: kernelNowIso({ clock: deps.clock }),
|
|
68
69
|
payload: event.payload,
|
|
69
70
|
});
|
|
70
71
|
},
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { IdGenerator } from "@jini-ai/core/primitives";
|
|
2
|
+
import type { Clock } from "@jini-ai/core/primitives";
|
|
1
3
|
/**
|
|
2
4
|
* @file Entries' half of the shared agent-tool-registration convention: maps `agent-tools.ts`'s 5
|
|
3
5
|
* catalog entries onto `write-service.ts`'s create/update/publish/unpublish and `list.ts`'s read, as
|
|
@@ -15,14 +17,14 @@
|
|
|
15
17
|
*/
|
|
16
18
|
import type { AuthorizeFn } from "../core/commands/command.js";
|
|
17
19
|
import type { OutboxPort } from "../core/ports.js";
|
|
18
|
-
import { type DerivedRiskByToolId, type ToolRegistration } from "
|
|
20
|
+
import { type DerivedRiskByToolId, type ToolRegistration } from "@jini-ai/core";
|
|
19
21
|
import { type EntryListPort } from "./list.js";
|
|
20
22
|
import { type ContentTypeLookupPort, type EntryRepoPort } from "./write-service.js";
|
|
21
23
|
/**
|
|
22
24
|
* The exact slice of the route-deps bag Entries' tool handlers read. Declared structurally (rather
|
|
23
25
|
* than importing `server/routes/types`'s `RouteDeps`) so this module carries no back-edge into the
|
|
24
26
|
* composition root. `server/routes/*` satisfies this structurally by passing its existing
|
|
25
|
-
* `RouteDeps` object
|
|
27
|
+
* `RouteDeps` object with the kernel clock/ID contracts.
|
|
26
28
|
*
|
|
27
29
|
* `contentTypeRepo` is typed as `write-service.ts`'s own `ContentTypeLookupPort` — the narrow
|
|
28
30
|
* lookup contract Entries itself declares, not content-types' full `ContentTypeRepoPort` — mirroring
|
|
@@ -32,12 +34,8 @@ import { type ContentTypeLookupPort, type EntryRepoPort } from "./write-service.
|
|
|
32
34
|
export interface EntriesToolDeps {
|
|
33
35
|
authorize: AuthorizeFn;
|
|
34
36
|
workspaceId: string;
|
|
35
|
-
clock:
|
|
36
|
-
|
|
37
|
-
};
|
|
38
|
-
idGen: {
|
|
39
|
-
newId(): string;
|
|
40
|
-
};
|
|
37
|
+
clock: Clock;
|
|
38
|
+
idGen: IdGenerator;
|
|
41
39
|
outbox: OutboxPort;
|
|
42
40
|
entryRepo: EntryRepoPort & EntryListPort;
|
|
43
41
|
contentTypeRepo: ContentTypeLookupPort;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { AGENT_TOOL_PRINCIPAL_KIND, buildDomainRegistrations, fromResult, indexCatalogById, optionalString, requireInputRecord, requireNumber, requireString,
|
|
1
|
+
import { AGENT_TOOL_PRINCIPAL_KIND, buildDomainRegistrations, fromResult, indexCatalogById, optionalString, requireInputRecord, requireNumber, requireString, withSchemaOnRejection } from "@jini-ai/core";
|
|
2
|
+
import { adaptLegacyAuthorize, requireToolPermission } from "../core/tools/index.js";
|
|
2
3
|
import { entriesAgentToolCatalog } from "./agent-tools.js";
|
|
3
4
|
import { EntryFieldValidationError } from "./errors.js";
|
|
4
5
|
import { listEntries } from "./list.js";
|
|
5
6
|
import { createEntry, publishEntry, unpublishEntry, updateEntry } from "./write-service.js";
|
|
6
7
|
import { toEntryOutbox } from "./repo.memory.js";
|
|
7
|
-
const CATALOG_BY_ID = indexCatalogById(entriesAgentToolCatalog);
|
|
8
|
+
const CATALOG_BY_ID = indexCatalogById({ catalog: entriesAgentToolCatalog });
|
|
8
9
|
/**
|
|
9
10
|
* This wiring layer's OWN risk classification, authored from what each handler below actually
|
|
10
11
|
* calls. See `DerivedRiskByToolId` in the kit for why it is independent of the catalog's own
|
|
@@ -27,7 +28,7 @@ export const entriesDerivedRisk = new Map([
|
|
|
27
28
|
* only. A not-found, a tombstoned-type rejection, or a version conflict is not a shape problem
|
|
28
29
|
* retrying the SAME input would ever resolve.
|
|
29
30
|
*/
|
|
30
|
-
function isEntriesShapeRejection(error) {
|
|
31
|
+
function isEntriesShapeRejection({ error }) {
|
|
31
32
|
return error instanceof EntryFieldValidationError;
|
|
32
33
|
}
|
|
33
34
|
/** Shared dependency bag for `write-service.ts` calls — every mutating handler here takes this
|
|
@@ -39,7 +40,7 @@ function entriesDeps(routeDeps) {
|
|
|
39
40
|
contentTypeRepo: routeDeps.contentTypeRepo,
|
|
40
41
|
clock: routeDeps.clock,
|
|
41
42
|
ids: routeDeps.idGen,
|
|
42
|
-
authorize: routeDeps.authorize,
|
|
43
|
+
authorize: adaptLegacyAuthorize({ authorize: routeDeps.authorize }),
|
|
43
44
|
outbox: toEntryOutbox(routeDeps),
|
|
44
45
|
};
|
|
45
46
|
}
|
|
@@ -61,70 +62,70 @@ function toEntryToolView(entry) {
|
|
|
61
62
|
};
|
|
62
63
|
}
|
|
63
64
|
function fromEntryResult(fn) {
|
|
64
|
-
return fromResult(fn).then(({ entry }) => ({ entry: toEntryToolView(entry) }));
|
|
65
|
+
return fromResult({ fn: fn }).then(({ entry }) => ({ entry: toEntryToolView(entry) }));
|
|
65
66
|
}
|
|
66
67
|
export function buildEntriesRegistrations(routeDeps) {
|
|
67
68
|
const handlers = {
|
|
68
69
|
collections_entry_list: async (ctx) => {
|
|
69
|
-
const input = ctx.input !== undefined ? requireInputRecord(ctx.input) : {};
|
|
70
|
-
await requireToolPermission(routeDeps,
|
|
71
|
-
const { items } = await listEntries({ repo: routeDeps.entryRepo, workspaceId: routeDeps.workspaceId, type: optionalString(input, "type") });
|
|
70
|
+
const input = ctx.input !== undefined ? requireInputRecord({ input: ctx.input }) : {};
|
|
71
|
+
await requireToolPermission({ authorize: adaptLegacyAuthorize({ authorize: routeDeps.authorize }), workspaceId: routeDeps.workspaceId, principalId: ctx.principal.id, permission: "admin.collections.read" }, { entityType: "entry" });
|
|
72
|
+
const { items } = await listEntries({ repo: routeDeps.entryRepo, workspaceId: routeDeps.workspaceId }, { type: optionalString({ input, key: "type" }) });
|
|
72
73
|
return { items: items.map(toEntryToolView) };
|
|
73
74
|
},
|
|
74
75
|
collections_entry_create: async (ctx) => {
|
|
75
|
-
const input = requireInputRecord(ctx.input);
|
|
76
|
-
return withSchemaOnRejection({ toolId: "collections_entry_create", catalog: CATALOG_BY_ID, isShapeRejection: isEntriesShapeRejection
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
76
|
+
const input = requireInputRecord({ input: ctx.input });
|
|
77
|
+
return withSchemaOnRejection({ toolId: "collections_entry_create", catalog: CATALOG_BY_ID, isShapeRejection: isEntriesShapeRejection, fn: () => fromEntryResult(() => createEntry({
|
|
78
|
+
deps: entriesDeps(routeDeps),
|
|
79
|
+
input: {
|
|
80
|
+
actorId: ctx.principal.id,
|
|
81
|
+
principalKind: AGENT_TOOL_PRINCIPAL_KIND,
|
|
82
|
+
workspaceId: routeDeps.workspaceId,
|
|
83
|
+
type: requireString({ input, key: "type" }),
|
|
84
|
+
slug: requireString({ input, key: "slug" }),
|
|
85
|
+
title: requireString({ input, key: "title" }),
|
|
86
|
+
fieldsJson: input.fieldsJson ?? { ext: { site: {} } },
|
|
87
|
+
bodyJson: input.bodyJson,
|
|
88
|
+
},
|
|
89
|
+
})) });
|
|
89
90
|
},
|
|
90
91
|
collections_entry_update: async (ctx) => {
|
|
91
|
-
const input = requireInputRecord(ctx.input);
|
|
92
|
-
return withSchemaOnRejection({ toolId: "collections_entry_update", catalog: CATALOG_BY_ID, isShapeRejection: isEntriesShapeRejection
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
92
|
+
const input = requireInputRecord({ input: ctx.input });
|
|
93
|
+
return withSchemaOnRejection({ toolId: "collections_entry_update", catalog: CATALOG_BY_ID, isShapeRejection: isEntriesShapeRejection, fn: () => fromEntryResult(() => updateEntry({
|
|
94
|
+
deps: entriesDeps(routeDeps),
|
|
95
|
+
input: {
|
|
96
|
+
actorId: ctx.principal.id,
|
|
97
|
+
principalKind: AGENT_TOOL_PRINCIPAL_KIND,
|
|
98
|
+
workspaceId: routeDeps.workspaceId,
|
|
99
|
+
id: requireString({ input, key: "id" }),
|
|
100
|
+
title: typeof input.title === "string" ? input.title : undefined,
|
|
101
|
+
fieldsJson: input.fieldsJson,
|
|
102
|
+
expectedVersion: requireNumber({ input, key: "expectedVersion" }),
|
|
103
|
+
},
|
|
104
|
+
})) });
|
|
104
105
|
},
|
|
105
106
|
collections_entry_publish: async (ctx) => {
|
|
106
|
-
const input = requireInputRecord(ctx.input);
|
|
107
|
+
const input = requireInputRecord({ input: ctx.input });
|
|
107
108
|
return fromEntryResult(() => publishEntry({
|
|
108
109
|
deps: entriesDeps(routeDeps),
|
|
109
110
|
input: {
|
|
110
111
|
actorId: ctx.principal.id,
|
|
111
112
|
principalKind: AGENT_TOOL_PRINCIPAL_KIND,
|
|
112
113
|
workspaceId: routeDeps.workspaceId,
|
|
113
|
-
id: requireString(input, "id"),
|
|
114
|
-
expectedVersion: requireNumber(input, "expectedVersion"),
|
|
114
|
+
id: requireString({ input, key: "id" }),
|
|
115
|
+
expectedVersion: requireNumber({ input, key: "expectedVersion" }),
|
|
115
116
|
},
|
|
116
117
|
}));
|
|
117
118
|
},
|
|
118
119
|
collections_entry_unpublish: async (ctx) => {
|
|
119
|
-
const input = requireInputRecord(ctx.input);
|
|
120
|
+
const input = requireInputRecord({ input: ctx.input });
|
|
120
121
|
return fromEntryResult(() => unpublishEntry({
|
|
121
122
|
deps: entriesDeps(routeDeps),
|
|
122
123
|
input: {
|
|
123
124
|
actorId: ctx.principal.id,
|
|
124
125
|
principalKind: AGENT_TOOL_PRINCIPAL_KIND,
|
|
125
126
|
workspaceId: routeDeps.workspaceId,
|
|
126
|
-
id: requireString(input, "id"),
|
|
127
|
-
expectedVersion: requireNumber(input, "expectedVersion"),
|
|
127
|
+
id: requireString({ input, key: "id" }),
|
|
128
|
+
expectedVersion: requireNumber({ input, key: "expectedVersion" }),
|
|
128
129
|
},
|
|
129
130
|
}));
|
|
130
131
|
},
|
package/dist/entries/types.d.ts
CHANGED
|
@@ -45,11 +45,4 @@ export interface ActorIdentityInput {
|
|
|
45
45
|
delegatedByWorkspaceId?: string | null;
|
|
46
46
|
delegatedById?: string | null;
|
|
47
47
|
}
|
|
48
|
-
export type Result<T, E> = {
|
|
49
|
-
ok: true;
|
|
50
|
-
value: T;
|
|
51
|
-
} | {
|
|
52
|
-
ok: false;
|
|
53
|
-
error: E;
|
|
54
|
-
};
|
|
55
48
|
//# sourceMappingURL=types.d.ts.map
|