@kardalum/plugin-sdk 0.15.0 → 0.16.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 +11 -1
- package/README.md +10 -0
- package/dist/built-in-value-schemas.js +1 -1
- package/dist/built-ins.js +2 -2
- package/dist/capabilities.d.ts +8 -78
- package/dist/capabilities.js +23 -319
- package/dist/index.d.ts +4 -4
- package/dist/index.js +5 -4
- package/dist/license-verdict-keys.js +4 -0
- package/dist/manifest-entry.d.ts +2 -2
- package/dist/manifest-entry.js +1 -1
- package/dist/manifest-schema.d.ts +81 -13
- package/dist/manifest-schema.js +108 -59
- package/dist/manifest.d.ts +105 -40
- package/dist/media/media-picker.js +21 -12
- package/dist/media/upload-error.d.ts +1 -1
- package/dist/media/upload-error.js +1 -1
- package/dist/plugin-context.d.ts +7 -0
- package/dist/plugin-context.js +7 -0
- package/dist/plugin-screen-context.d.ts +33 -2
- package/dist/plugin-screen-context.js +27 -2
- package/dist/read-all-pages.d.ts +23 -0
- package/dist/read-all-pages.js +30 -0
- package/dist/richtext/block-panel.js +4 -4
- package/dist/richtext/insert-menu.js +3 -3
- package/dist/views/content-list-view.js +2 -2
- package/dist/views/image-view.js +24 -39
- package/dist/views/rich-text-view.js +2 -2
- package/node_modules/@kardalum/api-schemas/dist/api-error.schema.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/api-error.schema.js +19 -0
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +43 -25
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +60 -8
- package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +12 -8
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/content-path.js +11 -7
- package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +107 -57
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +96 -60
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/index.d.ts +39 -28
- package/node_modules/@kardalum/api-schemas/dist/index.js +19 -13
- package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.d.ts +73 -0
- package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.js +104 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +302 -1
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +78 -6
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +38 -30
- package/node_modules/@kardalum/api-schemas/dist/media-rendition.schema.js +2 -2
- package/node_modules/@kardalum/api-schemas/dist/media.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +82 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +88 -5
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +79 -17
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +69 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +59 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +585 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +536 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +75 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +213 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +25 -3
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +21 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +7 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +16 -3
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +44 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +162 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +8 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +11 -1
- package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +4 -4
- package/node_modules/@kardalum/api-schemas/dist/role.schema.d.ts +6 -0
- package/node_modules/@kardalum/api-schemas/dist/role.schema.js +6 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +35 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +79 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +36 -6
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +17 -5
- package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +8 -8
- package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +8 -8
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.js +2 -0
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +4 -4
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +11 -3
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +5 -0
- package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +111 -0
- package/node_modules/@kardalum/plugin-package/dist/build-reference.js +61 -0
- package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +103 -0
- package/node_modules/@kardalum/plugin-package/dist/capabilities.js +351 -0
- package/node_modules/@kardalum/plugin-package/dist/index.d.ts +3 -1
- package/node_modules/@kardalum/plugin-package/dist/index.js +2 -1
- package/node_modules/@kardalum/plugin-package/dist/reference-entry.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/reference-entry.js +6 -0
- package/node_modules/@kardalum/plugin-package/dist/sample-content.d.ts +20 -1
- package/node_modules/@kardalum/plugin-package/dist/sample-content.js +56 -16
- package/node_modules/@kardalum/plugin-package/dist/types.d.ts +4 -6
- package/node_modules/@kardalum/plugin-package/dist/types.js +15 -1
- package/node_modules/@kardalum/plugin-package/package.json +5 -0
- package/node_modules/@kardalum/ui/dist/components/checkbox.js +2 -2
- package/node_modules/@kardalum/ui/dist/components/property-field.js +4 -1
- package/package.json +2 -2
package/dist/manifest.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ComponentType } from "react";
|
|
2
|
-
import type { CreateDocumentTypeRequest, PluginDocsPage } from "@kardalum/api-schemas";
|
|
2
|
+
import type { CreateDocumentTypeRequest, PluginDocsPage, PluginInstallDeclaration, ResolvedInstallAnswers } from "@kardalum/api-schemas";
|
|
3
|
+
export type { InstallChoice, InstallOption, InstallStep, PluginInstallDeclaration, ResolvedInstallAnswers } from "@kardalum/api-schemas";
|
|
3
4
|
import type { ThemeTokenOverrides } from "@kardalum/design-tokens";
|
|
4
5
|
import type { ZodType } from "zod";
|
|
5
6
|
import type { DataTypePlugin } from "./data-type-plugin.js";
|
|
@@ -32,10 +33,11 @@ export interface DatabaseCompatibility {
|
|
|
32
33
|
/** 'simple' = JSON key-value SimpleStorageAPI (default, ~80% of
|
|
33
34
|
* plugins); 'structured' = relational StructuredStorageAPI. Declaring
|
|
34
35
|
* 'structured' IS the declaration that this plugin owns real tables:
|
|
35
|
-
* it derives the `storage.structured` capability, which
|
|
36
|
-
*
|
|
37
|
-
* boolean beside it, because a second place to
|
|
38
|
-
* second place for the manifest to disagree with
|
|
36
|
+
* it derives the `storage.structured` capability, which is a promised
|
|
37
|
+
* capability, so a reviewer reads it against your code (S267 section 6).
|
|
38
|
+
* There is deliberately no boolean beside it, because a second place to
|
|
39
|
+
* say the same thing is a second place for the manifest to disagree with
|
|
40
|
+
* itself. */
|
|
39
41
|
storageType: "simple" | "structured";
|
|
40
42
|
supported: DatabaseDialect[];
|
|
41
43
|
/** Optional human-readable reason per UNSUPPORTED dialect (shown on the
|
|
@@ -63,9 +65,10 @@ export interface PluginAssertion {
|
|
|
63
65
|
* be claimed falsely or held quietly.
|
|
64
66
|
*
|
|
65
67
|
* These two survive as explicit assertions precisely because no
|
|
66
|
-
* declaration can derive what a plugin's code does at runtime, and
|
|
67
|
-
*
|
|
68
|
-
* the manifest with nothing
|
|
68
|
+
* declaration can derive what a plugin's code does at runtime, and each
|
|
69
|
+
* is a promised capability, so a reviewer reads it against your code, for
|
|
70
|
+
* the same reason: they are the only claims in the manifest with nothing
|
|
71
|
+
* behind them.
|
|
69
72
|
*
|
|
70
73
|
* Presence is the claim. There is no `false`: a key that is absent is an
|
|
71
74
|
* assertion not made. The whole field is optional, so a plugin that
|
|
@@ -210,39 +213,60 @@ export interface DashboardWidgetContribution {
|
|
|
210
213
|
action: string;
|
|
211
214
|
}
|
|
212
215
|
/** Mounted under /api/plugins/:pluginId/… so two plugins can never
|
|
213
|
-
* collide on a path (api-design.md)
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
* boundary (same cross-boundary
|
|
217
|
-
*
|
|
218
|
-
* passes real FastifyRequest
|
|
216
|
+
* collide on a path (api-design.md). The host routes every declaration
|
|
217
|
+
* through Fastify's own router, rebuilt whenever a plugin is attached or
|
|
218
|
+
* detached (S295, 2026-10-14-s295-routes-fastify-knows-about-design.md).
|
|
219
|
+
* `handler` stays untyped at the SDK boundary (the same cross-boundary
|
|
220
|
+
* erasure as view ComponentType fields): the host casts to real Fastify
|
|
221
|
+
* types internally, since it always passes real FastifyRequest and
|
|
222
|
+
* FastifyReply instances. */
|
|
219
223
|
export interface ApiRouteContribution {
|
|
220
224
|
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
221
|
-
/** Relative to /api/plugins/:pluginId
|
|
225
|
+
/** Relative to /api/plugins/:pluginId/: starting with "/" and holding one or
|
|
226
|
+
* more segments, each letters, digits, "-" and "_", or a parameter ":name"
|
|
227
|
+
* (a letter, then letters, digits or "_") matching one segment of the
|
|
228
|
+
* request; at most 200 characters. Two routes of one method that the
|
|
229
|
+
* router would read as one, or that one request could match both of, are
|
|
230
|
+
* refused (api-schemas' checkApiRouteDeclarations). */
|
|
222
231
|
path: string;
|
|
223
232
|
/** Who may call this route.
|
|
224
|
-
* - "admin" (the default when omitted) requires a JWT
|
|
225
|
-
* for admin-facing plugin UIs like Commerce Orders or
|
|
226
|
-
* builder.
|
|
227
|
-
* - "apiKey" requires a
|
|
228
|
-
* headless callers like a
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
* Anything unrecognized falls back to "admin" — secure by default. */
|
|
233
|
+
* - "admin" (the default when omitted) requires a JWT session whose role
|
|
234
|
+
* holds `action`: for admin-facing plugin UIs like Commerce Orders or
|
|
235
|
+
* the Forms builder.
|
|
236
|
+
* - "apiKey" requires a live API key that holds `action`, for a read and a
|
|
237
|
+
* write alike (S299): for credentialed headless callers like a
|
|
238
|
+
* storefront checkout.
|
|
239
|
+
* - "public" requires NO credentials: for genuinely anonymous browser
|
|
240
|
+
* traffic such as a contact-form submission (Session 160's Forms plugin
|
|
241
|
+
* was the first consumer). A public route owns its own abuse controls
|
|
242
|
+
* (honeypot, per-IP bucket, body caps) and only reaches browsers
|
|
243
|
+
* cross-origin when the operator allowlists their origin in
|
|
244
|
+
* KARDALUM_CORS_ORIGINS.
|
|
245
|
+
* Anything unrecognized falls back to "admin": secure by default. */
|
|
238
246
|
access?: "admin" | "apiKey" | "public";
|
|
239
|
-
/** Optional
|
|
240
|
-
*
|
|
241
|
-
*
|
|
247
|
+
/** Optional validation, compiled with the host's validator compiler when the
|
|
248
|
+
* host routes the plugin (again on every attach or detach), never per
|
|
249
|
+
* request; the handler receives the parsed values. `response` is the other
|
|
250
|
+
* direction (S297): the success bodies the handler answers, which the host
|
|
251
|
+
* checks and documents. */
|
|
242
252
|
schema?: {
|
|
243
253
|
body?: ZodType;
|
|
244
254
|
querystring?: ZodType;
|
|
255
|
+
/** The path's parameters: a Zod object keyed by the names the path
|
|
256
|
+
* declares. Without it each parameter reaches request.params as a
|
|
257
|
+
* string. */
|
|
245
258
|
params?: ZodType;
|
|
259
|
+
/** The success responses, keyed by status code written as a string,
|
|
260
|
+
* "200" to "299", at most four. When the handler RETURNS a value (it does
|
|
261
|
+
* not send it with `reply.send`), the value is checked against the
|
|
262
|
+
* schema for the status the reply carries (200 unless the handler set
|
|
263
|
+
* another with `reply.code`), and the PARSED value is what is sent:
|
|
264
|
+
* unknown keys dropped, defaults and transforms applied. A value that
|
|
265
|
+
* does not match answers a 500 and is logged with the problems. A status
|
|
266
|
+
* with no entry is sent unchecked, and so is anything the handler sends
|
|
267
|
+
* through `reply.send`. The schemas also document the response in the
|
|
268
|
+
* server's OpenAPI documents. */
|
|
269
|
+
response?: Record<string, ZodType>;
|
|
246
270
|
};
|
|
247
271
|
/** Third argument added Month 8, Session 90 — the first server-side
|
|
248
272
|
* consumer needing privileged host access. Existing two-argument (or
|
|
@@ -250,9 +274,10 @@ export interface ApiRouteContribution {
|
|
|
250
274
|
* with fewer declared parameters to satisfy a type expecting more. */
|
|
251
275
|
handler: (request: unknown, reply: unknown, context: PluginApiRouteContext) => unknown;
|
|
252
276
|
/** The named permission action a caller must hold (S270, theme G1).
|
|
253
|
-
* Required
|
|
254
|
-
*
|
|
255
|
-
*
|
|
277
|
+
* Required unless `access` is "public": on an "admin" route (or one that
|
|
278
|
+
* omits `access`) the session's role must hold it, and on an "apiKey"
|
|
279
|
+
* route the key must hold it, for a read and a write alike (S299). Only a
|
|
280
|
+
* "public" route, which needs no credential, may omit it.
|
|
256
281
|
* `access` decides WHICH CREDENTIAL reaches the handler; this decides
|
|
257
282
|
* WHAT THAT SUBJECT MAY DO. They are orthogonal. */
|
|
258
283
|
action?: string;
|
|
@@ -461,6 +486,36 @@ export type ViewBearingContribution = (typeof VIEW_BEARING_CONTRIBUTIONS)[number
|
|
|
461
486
|
* compile error against the signature below.
|
|
462
487
|
*/
|
|
463
488
|
export declare function declaresClientBundle(contributions: PluginContributions | Record<string, unknown> | null | undefined): boolean;
|
|
489
|
+
/** S292: what onInstall is told. */
|
|
490
|
+
export interface PluginInstallContext {
|
|
491
|
+
/** The install's answers with every default filled: what the operator
|
|
492
|
+
* chose for the sample content, the offered roles and the plugin's own
|
|
493
|
+
* `install` options (resolveInstallAnswers in @kardalum/api-schemas). */
|
|
494
|
+
answers: ResolvedInstallAnswers;
|
|
495
|
+
/** S293: the plugin's own structured storage, for a manifest declaring
|
|
496
|
+
* `storageType: 'structured'`, scoped to this plugin as a route's is and
|
|
497
|
+
* usable before it is active (onInstall runs before its row exists). A
|
|
498
|
+
* table onInstall defines is dropped again if the install fails. The handle
|
|
499
|
+
* is for the hook alone: once onInstall returns or throws it refuses while
|
|
500
|
+
* the plugin is not active, like any plugin storage, so keeping it for later
|
|
501
|
+
* gains nothing. Absent for a simple-storage plugin. */
|
|
502
|
+
structuredStorage?: ScopedStructuredStorage;
|
|
503
|
+
}
|
|
504
|
+
/** S292: what onUpdate is told. */
|
|
505
|
+
export interface PluginUpdateContext {
|
|
506
|
+
/** The version that was installed before. */
|
|
507
|
+
fromVersion: string;
|
|
508
|
+
answers: ResolvedInstallAnswers;
|
|
509
|
+
/** S293: the plugin's own structured storage, for a manifest declaring
|
|
510
|
+
* `storageType: 'structured'`, scoped to this plugin as a route's is and
|
|
511
|
+
* usable while it is not active (an update may run while the plugin is
|
|
512
|
+
* off). A table onUpdate defines is kept if the update fails: storage only
|
|
513
|
+
* grows, and an uninstall snapshots and drops it. The handle is for the
|
|
514
|
+
* hook alone: once onUpdate returns or throws it refuses while the plugin
|
|
515
|
+
* is not active, like any plugin storage, so keeping it for later gains
|
|
516
|
+
* nothing. Absent for a simple-storage plugin. */
|
|
517
|
+
structuredStorage?: ScopedStructuredStorage;
|
|
518
|
+
}
|
|
464
519
|
/** Fields shared by every plugin type. */
|
|
465
520
|
export interface PluginManifestBase {
|
|
466
521
|
/** Reverse domain, e.g. 'com.yourname.googlemaps'. */
|
|
@@ -491,7 +546,7 @@ export interface PluginManifestBase {
|
|
|
491
546
|
/** DB changes applied on install (through plugin storage — never raw
|
|
492
547
|
* SQL). */
|
|
493
548
|
migrations?: PluginMigration[];
|
|
494
|
-
onInstall?: () => void | Promise<void>;
|
|
549
|
+
onInstall?: (ctx: PluginInstallContext) => void | Promise<void>;
|
|
495
550
|
onUninstall?: () => void | Promise<void>;
|
|
496
551
|
onActivate?: () => void | Promise<void>;
|
|
497
552
|
onDeactivate?: () => void | Promise<void>;
|
|
@@ -499,9 +554,7 @@ export interface PluginManifestBase {
|
|
|
499
554
|
* the new migrations and document types and before the new actions sync.
|
|
500
555
|
* A throw rolls the update back and the old version stays installed.
|
|
501
556
|
* `onInstall` never runs on an update. */
|
|
502
|
-
onUpdate?: (ctx:
|
|
503
|
-
fromVersion: string;
|
|
504
|
-
}) => void | Promise<void>;
|
|
557
|
+
onUpdate?: (ctx: PluginUpdateContext) => void | Promise<void>;
|
|
505
558
|
migrationHooks?: PluginMigrationHooks;
|
|
506
559
|
/**
|
|
507
560
|
* The actions this plugin brings (S273). Each gated contribution above
|
|
@@ -518,7 +571,9 @@ export interface PluginManifestBase {
|
|
|
518
571
|
* Roles this plugin offers (S273). An offer is never applied unasked: the
|
|
519
572
|
* operator accepts it on the install screen or from the installed-plugins
|
|
520
573
|
* view, and the result is an ordinary editable role holding exactly these
|
|
521
|
-
* actions,
|
|
574
|
+
* actions: the plugin's own and, beside them, only the built-in read rights
|
|
575
|
+
* an offer may grant (S293, OFFERABLE_BUILT_IN_ACTIONS in
|
|
576
|
+
* @kardalum/api-schemas).
|
|
522
577
|
*/
|
|
523
578
|
roles?: Array<{
|
|
524
579
|
id: string;
|
|
@@ -532,6 +587,16 @@ export interface PluginManifestBase {
|
|
|
532
587
|
* price or document types; a "configuration" page when it has settings
|
|
533
588
|
* pages. */
|
|
534
589
|
docs?: PluginDocsPage[];
|
|
590
|
+
/** S291: the language the docs pages are written in, as a language code
|
|
591
|
+
* such as "en", "de" or "pt-BR". Absent means English. The marketplace
|
|
592
|
+
* shows it on the listing and the docs index. One language per plugin
|
|
593
|
+
* before v1: translated docs pages are not supported yet. */
|
|
594
|
+
docsLanguage?: string;
|
|
595
|
+
/** S292: what the plugin's install asks, as plain data, so a person, a
|
|
596
|
+
* script and the CLI can answer it before any of the plugin's code runs.
|
|
597
|
+
* The built-in questions (the sample content, the offered roles) are never
|
|
598
|
+
* declared here: they follow from what the package ships. */
|
|
599
|
+
install?: PluginInstallDeclaration;
|
|
535
600
|
}
|
|
536
601
|
/**
|
|
537
602
|
* The full plugin manifest. One shape for every plugin: `type` is a
|
|
@@ -3,14 +3,18 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
|
3
3
|
import { ChevronRight, Folder as FolderIcon } from "lucide-react";
|
|
4
4
|
import { renditionShape, } from "@kardalum/api-schemas";
|
|
5
5
|
import { Button, cn, Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, } from "@kardalum/ui";
|
|
6
|
-
import { usePluginApi } from "../plugin-context.js";
|
|
6
|
+
import { MANAGE_API, usePluginApi } from "../plugin-context.js";
|
|
7
|
+
import { readAllPages } from "../read-all-pages.js";
|
|
7
8
|
import { isRenditionIneligible } from "../rendition-eligibility.js";
|
|
8
9
|
import { uploadFailureMessage } from "./upload-error.js";
|
|
9
|
-
// GET /api/media page size for the picker's grid (S197 Task 2). Additional
|
|
10
|
+
// GET /api/manage/v1/media page size for the picker's grid (S197 Task 2). Additional
|
|
10
11
|
// pages are fetched on demand via the "Load more" button below, following
|
|
11
12
|
// MediaListQuerySchema's cursor contract (media-api.schema.ts) rather than
|
|
12
13
|
// assuming a library's whole image set fits on one page.
|
|
13
14
|
const PAGE_LIMIT = 50;
|
|
15
|
+
// The folder list is paged by the server (S300b): read it to its end, 200 folders a page, at most 50 pages.
|
|
16
|
+
const FOLDER_PAGE_LIMIT = 200;
|
|
17
|
+
const FOLDER_PAGE_CAP = 50;
|
|
14
18
|
// What the picker offers when the caller names nothing. Rich text has no
|
|
15
19
|
// accepted-types setting of its own and has always shown images only, so
|
|
16
20
|
// this is that behaviour written down rather than a new default.
|
|
@@ -124,7 +128,7 @@ function folderPath(folderId, byId) {
|
|
|
124
128
|
// controlled-open pattern as IconPickerDialog
|
|
125
129
|
// (apps/admin-ui/src/icons/icon-picker-dialog.tsx).
|
|
126
130
|
//
|
|
127
|
-
// downloadUrl is resolved fresh from each GET /api/media response, never
|
|
131
|
+
// downloadUrl is resolved fresh from each GET /api/manage/v1/media response, never
|
|
128
132
|
// cached across renders: a private item's URL carries a short-lived
|
|
129
133
|
// token, so a stale one would go dead (image-view.tsx's useMediaPreview
|
|
130
134
|
// :21-24 doctrine, mirrored here for the same reason).
|
|
@@ -199,13 +203,18 @@ export function MediaPicker({ onPick, onClose, collectAlt, acceptedTypes, rendit
|
|
|
199
203
|
// banner, whichever fetch failed most recently.
|
|
200
204
|
useEffect(() => {
|
|
201
205
|
let cancelled = false;
|
|
202
|
-
fetchApi
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
206
|
+
readAllPages(fetchApi, `${MANAGE_API}/media/folders`, "media folders", {
|
|
207
|
+
itemKey: "folders",
|
|
208
|
+
limit: FOLDER_PAGE_LIMIT,
|
|
209
|
+
cap: FOLDER_PAGE_CAP,
|
|
210
|
+
})
|
|
211
|
+
.then(({ items, complete }) => {
|
|
212
|
+
if (cancelled)
|
|
213
|
+
return;
|
|
214
|
+
setFolders(items);
|
|
215
|
+
// A tree that was not read to its end is a subset of the folders: say so through the banner the list uses.
|
|
216
|
+
if (!complete)
|
|
217
|
+
setError(`Only the first ${FOLDER_PAGE_CAP * FOLDER_PAGE_LIMIT} media folders could be read`);
|
|
209
218
|
})
|
|
210
219
|
.catch((err) => {
|
|
211
220
|
if (!cancelled)
|
|
@@ -227,7 +236,7 @@ export function MediaPicker({ onPick, onClose, collectAlt, acceptedTypes, rendit
|
|
|
227
236
|
params.set("cursor", cursor);
|
|
228
237
|
if (rendition)
|
|
229
238
|
params.set("rendition", rendition);
|
|
230
|
-
return
|
|
239
|
+
return `${MANAGE_API}/media?${params.toString()}`;
|
|
231
240
|
}, [rendition]);
|
|
232
241
|
// A generation counter, bumped on every call. It guards against a stale
|
|
233
242
|
// response (e.g. two rapid folder switches) overwriting the newer one,
|
|
@@ -331,7 +340,7 @@ export function MediaPicker({ onPick, onClose, collectAlt, acceptedTypes, rendit
|
|
|
331
340
|
if (currentFolderId)
|
|
332
341
|
formData.append("folderId", currentFolderId);
|
|
333
342
|
formData.append("file", file);
|
|
334
|
-
const response = await fetchApi(
|
|
343
|
+
const response = await fetchApi(`${MANAGE_API}/media`, { method: "POST", body: formData });
|
|
335
344
|
// The server's own sentence, not a status code (S234d Task 8).
|
|
336
345
|
// This drawer has no size check of its own and cannot usefully have
|
|
337
346
|
// one: the ceiling belongs to the media document type the file will
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The sentence a failed `POST /api/media` should show. The server's own
|
|
2
|
+
* The sentence a failed `POST /api/manage/v1/media` should show. The server's own
|
|
3
3
|
* message when there is one (every refusal on that route answers with
|
|
4
4
|
* `ApiErrorSchema`, which is `{ message }`), and the status otherwise:
|
|
5
5
|
* a failure with nothing to say still has to say something, and the
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
// a person meeting two different sentences for one refusal would have no
|
|
13
13
|
// way to tell they are the same rule.
|
|
14
14
|
/**
|
|
15
|
-
* The sentence a failed `POST /api/media` should show. The server's own
|
|
15
|
+
* The sentence a failed `POST /api/manage/v1/media` should show. The server's own
|
|
16
16
|
* message when there is one (every refusal on that route answers with
|
|
17
17
|
* `ApiErrorSchema`, which is `{ message }`), and the status otherwise:
|
|
18
18
|
* a failure with nothing to say still has to say something, and the
|
package/dist/plugin-context.d.ts
CHANGED
|
@@ -21,6 +21,13 @@ export declare function usePluginSettingsValue<T extends Record<string, unknown>
|
|
|
21
21
|
onChange: (value: T) => void;
|
|
22
22
|
};
|
|
23
23
|
export type PluginFetch = (input: string, init?: RequestInit) => Promise<Response>;
|
|
24
|
+
/**
|
|
25
|
+
* The base of the management API (2026-10-17-s302-the-admin-moves-onto-the-management-api-design.md D1). The host's
|
|
26
|
+
* fetch is the admin's authFetch: it passes a path through unchanged and adds the session, so a view that calls one
|
|
27
|
+
* of the CMS's own families spells the path as `${MANAGE_API}/<family>/...`. A plugin's own routes stay under
|
|
28
|
+
* /api/plugins/:pluginId/.
|
|
29
|
+
*/
|
|
30
|
+
export declare const MANAGE_API = "/api/manage/v1";
|
|
24
31
|
interface PluginApiProviderProps {
|
|
25
32
|
fetch: PluginFetch;
|
|
26
33
|
children: ReactNode;
|
package/dist/plugin-context.js
CHANGED
|
@@ -45,6 +45,13 @@ export function usePluginSettingsValue() {
|
|
|
45
45
|
}
|
|
46
46
|
return { value: ctx.settings, onChange: ctx.onSettingsChange };
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* The base of the management API (2026-10-17-s302-the-admin-moves-onto-the-management-api-design.md D1). The host's
|
|
50
|
+
* fetch is the admin's authFetch: it passes a path through unchanged and adds the session, so a view that calls one
|
|
51
|
+
* of the CMS's own families spells the path as `${MANAGE_API}/<family>/...`. A plugin's own routes stay under
|
|
52
|
+
* /api/plugins/:pluginId/.
|
|
53
|
+
*/
|
|
54
|
+
export const MANAGE_API = "/api/manage/v1";
|
|
48
55
|
const PluginApiContext = createContext(null);
|
|
49
56
|
export function PluginApiProvider({ fetch, children }) {
|
|
50
57
|
return _jsx(PluginApiContext.Provider, { value: fetch, children: children });
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Translates one of the plugin's own strings (S290): a key from its
|
|
4
|
+
* locales/<language>.json, in the admin's language, falling back to the
|
|
5
|
+
* plugin's locales/en.json, then to the key itself. `{{name}}` in the text
|
|
6
|
+
* is replaced by `values.name`. The result is plain text: render it as a
|
|
7
|
+
* child. The host's own strings and other plugins' strings are never
|
|
8
|
+
* reachable through it.
|
|
9
|
+
*/
|
|
10
|
+
export type PluginTranslate = (key: string, values?: Record<string, string | number>) => string;
|
|
2
11
|
/**
|
|
3
12
|
* Where a plugin screen is being rendered (S280, spec D7). Every slot kind
|
|
4
13
|
* hands its view this one context instead of props, so a view keeps taking
|
|
@@ -20,8 +29,11 @@ export interface PluginScreenContext {
|
|
|
20
29
|
sectionId: string | null;
|
|
21
30
|
entryId: string | null;
|
|
22
31
|
};
|
|
23
|
-
/** The admin's active language, for
|
|
32
|
+
/** The admin's active language, for formatting dates and numbers. A
|
|
33
|
+
* screen's words come from `t`. */
|
|
24
34
|
locale: string;
|
|
35
|
+
/** The plugin's own strings in the admin's language (S290). */
|
|
36
|
+
t: PluginTranslate;
|
|
25
37
|
/**
|
|
26
38
|
* Navigates within the plugin's own section (kind section/sectionRail):
|
|
27
39
|
* pass the id of a rail entry that section declares, or null for the
|
|
@@ -32,9 +44,28 @@ export interface PluginScreenContext {
|
|
|
32
44
|
*/
|
|
33
45
|
navigate: (entryId: string | null) => void;
|
|
34
46
|
}
|
|
35
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Supplied by the host around any view that reads the plugin's own strings
|
|
49
|
+
* (S291): a plugin screen, where PluginScreenProvider renders it with the
|
|
50
|
+
* screen's `t`, and a data type's views, where the admin renders it with
|
|
51
|
+
* the owning plugin's translator. In a test, `(key) => key` prints the keys.
|
|
52
|
+
*/
|
|
53
|
+
export declare function PluginTranslateProvider({ t, children }: {
|
|
54
|
+
t: PluginTranslate;
|
|
55
|
+
children: ReactNode;
|
|
56
|
+
}): import("react").JSX.Element;
|
|
57
|
+
/** Supplied by the host around a plugin screen's view. It also supplies
|
|
58
|
+
* usePluginTranslate() with the screen's own `t` (S291), so in a screen the
|
|
59
|
+
* two are one function. */
|
|
36
60
|
export declare function PluginScreenProvider({ value, children }: {
|
|
37
61
|
value: PluginScreenContext;
|
|
38
62
|
children: ReactNode;
|
|
39
63
|
}): import("react").JSX.Element;
|
|
40
64
|
export declare function usePluginScreen(): PluginScreenContext;
|
|
65
|
+
/**
|
|
66
|
+
* The plugin's own strings in the admin's language (S291), for a view with
|
|
67
|
+
* no usePluginScreen(): a data type's views (input, readOnly, settings,
|
|
68
|
+
* preview). Inside a plugin screen it returns the screen's own `t`. Outside
|
|
69
|
+
* a PluginTranslateProvider it is a host wiring bug, so it throws.
|
|
70
|
+
*/
|
|
71
|
+
export declare function usePluginTranslate(): PluginTranslate;
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
const PluginScreenReactContext = createContext(null);
|
|
4
|
-
|
|
4
|
+
const PluginTranslateReactContext = createContext(null);
|
|
5
|
+
/**
|
|
6
|
+
* Supplied by the host around any view that reads the plugin's own strings
|
|
7
|
+
* (S291): a plugin screen, where PluginScreenProvider renders it with the
|
|
8
|
+
* screen's `t`, and a data type's views, where the admin renders it with
|
|
9
|
+
* the owning plugin's translator. In a test, `(key) => key` prints the keys.
|
|
10
|
+
*/
|
|
11
|
+
export function PluginTranslateProvider({ t, children }) {
|
|
12
|
+
return _jsx(PluginTranslateReactContext.Provider, { value: t, children: children });
|
|
13
|
+
}
|
|
14
|
+
/** Supplied by the host around a plugin screen's view. It also supplies
|
|
15
|
+
* usePluginTranslate() with the screen's own `t` (S291), so in a screen the
|
|
16
|
+
* two are one function. */
|
|
5
17
|
export function PluginScreenProvider({ value, children }) {
|
|
6
|
-
return _jsx(PluginScreenReactContext.Provider, { value: value, children: children });
|
|
18
|
+
return (_jsx(PluginScreenReactContext.Provider, { value: value, children: _jsx(PluginTranslateProvider, { t: value.t, children: children }) }));
|
|
7
19
|
}
|
|
8
20
|
// A screen calling this outside a host-rendered PluginScreenProvider is a
|
|
9
21
|
// host wiring bug, so it throws, the same as usePluginApi.
|
|
@@ -14,3 +26,16 @@ export function usePluginScreen() {
|
|
|
14
26
|
}
|
|
15
27
|
return ctx;
|
|
16
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* The plugin's own strings in the admin's language (S291), for a view with
|
|
31
|
+
* no usePluginScreen(): a data type's views (input, readOnly, settings,
|
|
32
|
+
* preview). Inside a plugin screen it returns the screen's own `t`. Outside
|
|
33
|
+
* a PluginTranslateProvider it is a host wiring bug, so it throws.
|
|
34
|
+
*/
|
|
35
|
+
export function usePluginTranslate() {
|
|
36
|
+
const t = useContext(PluginTranslateReactContext);
|
|
37
|
+
if (!t) {
|
|
38
|
+
throw new Error("usePluginTranslate must be called from a view rendered inside a PluginTranslateProvider");
|
|
39
|
+
}
|
|
40
|
+
return t;
|
|
41
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PluginFetch } from "./plugin-context.js";
|
|
2
|
+
/** A paged listing read to its end, or as far as the cap let it. */
|
|
3
|
+
export interface ListingPages<T> {
|
|
4
|
+
items: T[];
|
|
5
|
+
/** false when the page cap stopped the read with a cursor still pending: `items` is then a subset of the listing. */
|
|
6
|
+
complete: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface ReadAllPagesOptions {
|
|
9
|
+
/** The key of the page's array: "items" for most listings, "folders" for the media folder list. */
|
|
10
|
+
itemKey?: string;
|
|
11
|
+
/** The page size asked of the server (default 100). */
|
|
12
|
+
limit?: number;
|
|
13
|
+
/** The most pages read before the read stops incomplete (default 20). */
|
|
14
|
+
cap?: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Every page of a cursor-paginated listing, up to the cap. The listings a view reads this way are small, admin-only
|
|
18
|
+
* and read once when it mounts. They answer `{ <itemKey>: [...], nextCursor }` over the same `{ cursor, limit }` query.
|
|
19
|
+
* This is the helper image-view.tsx held privately since S234d, generalised to the page's item key
|
|
20
|
+
* (2026-10-17-s302-the-admin-moves-onto-the-management-api-design.md 3.8) so the media picker's folder list and the
|
|
21
|
+
* image view's rendition list follow nextCursor too.
|
|
22
|
+
*/
|
|
23
|
+
export declare function readAllPages<T>(fetchApi: PluginFetch, path: string, what: string, options?: ReadAllPagesOptions): Promise<ListingPages<T>>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every page of a cursor-paginated listing, up to the cap. The listings a view reads this way are small, admin-only
|
|
3
|
+
* and read once when it mounts. They answer `{ <itemKey>: [...], nextCursor }` over the same `{ cursor, limit }` query.
|
|
4
|
+
* This is the helper image-view.tsx held privately since S234d, generalised to the page's item key
|
|
5
|
+
* (2026-10-17-s302-the-admin-moves-onto-the-management-api-design.md 3.8) so the media picker's folder list and the
|
|
6
|
+
* image view's rendition list follow nextCursor too.
|
|
7
|
+
*/
|
|
8
|
+
export async function readAllPages(fetchApi, path, what, options = {}) {
|
|
9
|
+
const { itemKey = "items", limit = 100, cap = 20 } = options;
|
|
10
|
+
const all = [];
|
|
11
|
+
let cursor = null;
|
|
12
|
+
for (let page = 0; page < cap; page += 1) {
|
|
13
|
+
const params = new URLSearchParams();
|
|
14
|
+
params.set("limit", String(limit));
|
|
15
|
+
if (cursor)
|
|
16
|
+
params.set("cursor", cursor);
|
|
17
|
+
const response = await fetchApi(`${path}?${params.toString()}`);
|
|
18
|
+
if (!response.ok)
|
|
19
|
+
throw new Error(`Failed to load ${what} (${response.status})`);
|
|
20
|
+
const body = (await response.json());
|
|
21
|
+
const items = body[itemKey];
|
|
22
|
+
if (!Array.isArray(items))
|
|
23
|
+
throw new Error(`Failed to load ${what} (unexpected answer)`);
|
|
24
|
+
all.push(...items);
|
|
25
|
+
cursor = typeof body.nextCursor === "string" ? body.nextCursor : null;
|
|
26
|
+
if (cursor === null)
|
|
27
|
+
return { items: all, complete: true };
|
|
28
|
+
}
|
|
29
|
+
return { items: all, complete: false };
|
|
30
|
+
}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { useEffect, useRef, useState } from "react";
|
|
3
3
|
import { Selection } from "@tiptap/pm/state";
|
|
4
4
|
import { Button, Dialog, DialogCloseButton, DialogContent, DialogFooter, DialogHeader, DialogTitle, Input, PropertyField, Switch, } from "@kardalum/ui";
|
|
5
|
-
import { usePluginApi } from "../plugin-context.js";
|
|
5
|
+
import { MANAGE_API, usePluginApi } from "../plugin-context.js";
|
|
6
6
|
import { MediaPicker } from "../media/media-picker.js";
|
|
7
7
|
import { useBlockListings } from "./insert-menu.js";
|
|
8
8
|
function useMediaParamPreview(mediaId) {
|
|
@@ -16,7 +16,7 @@ function useMediaParamPreview(mediaId) {
|
|
|
16
16
|
}
|
|
17
17
|
let cancelled = false;
|
|
18
18
|
setLoading(true);
|
|
19
|
-
fetchApi(
|
|
19
|
+
fetchApi(`${MANAGE_API}/media/${mediaId}`)
|
|
20
20
|
.then(async (response) => {
|
|
21
21
|
if (!response.ok)
|
|
22
22
|
throw new Error(`Failed to load media (${response.status})`);
|
|
@@ -164,7 +164,7 @@ export function BlockPanel({ editor, pos, partial, params }) {
|
|
|
164
164
|
}, className: "flex max-h-[80vh] max-w-sm flex-col gap-0 p-0", children: [_jsxs(DialogHeader, { className: "border-b border-border-default px-4 py-3", children: [_jsxs("div", { className: "flex flex-col gap-0.5", children: [_jsx(DialogTitle, { children: listing?.name ?? partial }), _jsxs("span", { className: "font-mono text-xs text-text-tertiary", children: ["partial: ", partial, ".liquid"] })] }), _jsx(DialogCloseButton, { "aria-label": "Close" })] }), _jsxs("div", { className: "flex flex-1 flex-col gap-4 overflow-y-auto p-4", children: [_jsx(BlockParamFields, { listing: listing, listingsError: listingsError, params: params, onChange: updateParam }), _jsxs("p", { className: "rounded-md border border-border-default bg-background-subtle p-2 text-xs text-text-secondary", children: [_jsx("b", { className: "font-semibold text-text-primary", children: "Live preview." }), " This block is rendered by your own template on the server. What you see on the page is exactly what visitors will get."] })] }), _jsxs(DialogFooter, { className: "mt-0 justify-start border-t border-border-default p-4", children: [_jsx(Button, { type: "button", variant: "ghost", className: "text-danger-600 hover:text-danger-700", onClick: handleRemove, children: "Remove block" }), _jsx(Button, { type: "button", className: "ms-auto", onClick: moveSelectionPastBlock, children: "Done" })] })] }) }));
|
|
165
165
|
}
|
|
166
166
|
// The chip's "preview ⤢" affordance (S197 mockup screen 3): fetches
|
|
167
|
-
// POST /api/render/block for the block's CURRENT params and shows the
|
|
167
|
+
// POST /api/manage/v1/render/block for the block's CURRENT params and shows the
|
|
168
168
|
// returned HTML in a sandboxed iframe — sandbox="" (no tokens granted) so
|
|
169
169
|
// arbitrary template markup can never run script in the admin UI.
|
|
170
170
|
// Position is computed from a live viewport rect (getBoundingClientRect),
|
|
@@ -180,7 +180,7 @@ export function BlockPreviewPopover({ partial, params, anchorRect, onClose }) {
|
|
|
180
180
|
let cancelled = false;
|
|
181
181
|
setLoading(true);
|
|
182
182
|
setError(null);
|
|
183
|
-
fetchApi(
|
|
183
|
+
fetchApi(`${MANAGE_API}/render/block`, {
|
|
184
184
|
method: "POST",
|
|
185
185
|
headers: { "Content-Type": "application/json" },
|
|
186
186
|
body: JSON.stringify({ partial, params }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef, useState } from "react";
|
|
3
3
|
import { cn } from "@kardalum/ui";
|
|
4
|
-
import { usePluginApi } from "../plugin-context.js";
|
|
4
|
+
import { MANAGE_API, usePluginApi } from "../plugin-context.js";
|
|
5
5
|
// The value a freshly inserted block's params start with, before the user
|
|
6
6
|
// has touched anything in the param panel (S197 Task 3 brief, "Inserting a
|
|
7
7
|
// block": defaults: text/textarea "", number 0, boolean false, image
|
|
@@ -30,7 +30,7 @@ export function defaultBlockParams(params) {
|
|
|
30
30
|
}
|
|
31
31
|
return defaults;
|
|
32
32
|
}
|
|
33
|
-
// GET /api/render/blocks (S197 Task 6 ships this endpoint
|
|
33
|
+
// GET /api/manage/v1/render/blocks (S197 Task 6 ships this endpoint, until then
|
|
34
34
|
// every call 404s, and this hook surfaces that as `error`, same as
|
|
35
35
|
// MediaPicker's own fetch-failure handling, rather than swallowing it into
|
|
36
36
|
// a silent empty list). Shared between the insert menu (BlockInsertMenu,
|
|
@@ -46,7 +46,7 @@ export function useBlockListings() {
|
|
|
46
46
|
let cancelled = false;
|
|
47
47
|
setLoading(true);
|
|
48
48
|
setError(null);
|
|
49
|
-
fetchApi(
|
|
49
|
+
fetchApi(`${MANAGE_API}/render/blocks`)
|
|
50
50
|
.then(async (response) => {
|
|
51
51
|
if (!response.ok)
|
|
52
52
|
throw new Error(`Failed to load blocks (${response.status})`);
|
|
@@ -3,7 +3,7 @@ import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react"
|
|
|
3
3
|
import { CONTENT_LIST_DEFAULT_SETTINGS, } from "@kardalum/api-schemas";
|
|
4
4
|
import { Badge, Button, Input } from "@kardalum/ui";
|
|
5
5
|
import { Lock } from "lucide-react";
|
|
6
|
-
import { useContentHost, usePluginApi, usePluginSettings, } from "../plugin-context.js";
|
|
6
|
+
import { MANAGE_API, useContentHost, usePluginApi, usePluginSettings, } from "../plugin-context.js";
|
|
7
7
|
/** Column headers for the six built-in row properties. */
|
|
8
8
|
export const CONTENT_LIST_PROPERTY_LABELS = {
|
|
9
9
|
name: "Name",
|
|
@@ -160,7 +160,7 @@ function ContentListTable({ canCreate = false }) {
|
|
|
160
160
|
params.set("name", appliedSearch);
|
|
161
161
|
if (cursor)
|
|
162
162
|
params.set("cursor", cursor);
|
|
163
|
-
const response = await fetchApi(
|
|
163
|
+
const response = await fetchApi(`${MANAGE_API}/content/${nodeId}/list?${params.toString()}`);
|
|
164
164
|
if (!response.ok)
|
|
165
165
|
throw new Error(`Request failed (${response.status})`);
|
|
166
166
|
const body = (await response.json());
|