@heyo-sh/heyo-cms 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +44 -2
- package/dist/access/index.d.ts +9 -0
- package/dist/access/index.d.ts.map +1 -0
- package/dist/access/permissions.d.ts +54 -0
- package/dist/access/permissions.d.ts.map +1 -0
- package/dist/adapters/astro.d.ts +38 -0
- package/dist/adapters/astro.d.ts.map +1 -0
- package/dist/adapters/astro.js +1 -0
- package/dist/adapters/next.d.ts +31 -0
- package/dist/adapters/next.d.ts.map +1 -0
- package/dist/adapters/next.js +1 -0
- package/dist/adapters/nuxt.d.ts +47 -0
- package/dist/adapters/nuxt.d.ts.map +1 -0
- package/dist/adapters/nuxt.js +1 -0
- package/dist/adapters/react-router.d.ts +29 -0
- package/dist/adapters/react-router.d.ts.map +1 -0
- package/dist/adapters/react-router.js +1 -0
- package/dist/adapters/sveltekit.d.ts +37 -0
- package/dist/adapters/sveltekit.d.ts.map +1 -0
- package/dist/adapters/sveltekit.js +1 -0
- package/dist/ai/assistant/context.d.ts +64 -0
- package/dist/ai/assistant/context.d.ts.map +1 -0
- package/dist/ai/assistant/limits.d.ts +10 -0
- package/dist/ai/assistant/limits.d.ts.map +1 -0
- package/dist/ai/assistant/plans.d.ts +83 -0
- package/dist/ai/assistant/plans.d.ts.map +1 -0
- package/dist/ai/assistant/prompt.d.ts +22 -0
- package/dist/ai/assistant/prompt.d.ts.map +1 -0
- package/dist/ai/assistant/run.d.ts +59 -0
- package/dist/ai/assistant/run.d.ts.map +1 -0
- package/dist/ai/assistant/runtime.d.ts +35 -0
- package/dist/ai/assistant/runtime.d.ts.map +1 -0
- package/dist/ai/assistant/schema.d.ts +66 -0
- package/dist/ai/assistant/schema.d.ts.map +1 -0
- package/dist/ai/assistant/tools.d.ts +41 -0
- package/dist/ai/assistant/tools.d.ts.map +1 -0
- package/dist/ai/assistant/values.d.ts +33 -0
- package/dist/ai/assistant/values.d.ts.map +1 -0
- package/dist/ai/crypto.d.ts +12 -0
- package/dist/ai/crypto.d.ts.map +1 -0
- package/dist/ai/index.d.ts +19 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/pi.d.ts +89 -0
- package/dist/ai/pi.d.ts.map +1 -0
- package/dist/ai/registry.d.ts +66 -0
- package/dist/ai/registry.d.ts.map +1 -0
- package/dist/ai/service.d.ts +31 -0
- package/dist/ai/service.d.ts.map +1 -0
- package/dist/ai/variant-translation.d.ts +6 -0
- package/dist/ai/variant-translation.d.ts.map +1 -0
- package/dist/ai.d.ts +12 -0
- package/dist/ai.d.ts.map +1 -0
- package/dist/ai.js +1 -0
- package/dist/auth/config.d.ts +65 -0
- package/dist/auth/config.d.ts.map +1 -0
- package/dist/auth/crypto.d.ts +44 -0
- package/dist/auth/crypto.d.ts.map +1 -0
- package/dist/auth/index.d.ts +15 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/oauth.d.ts +93 -0
- package/dist/auth/oauth.d.ts.map +1 -0
- package/dist/auth/service.d.ts +38 -0
- package/dist/auth/service.d.ts.map +1 -0
- package/dist/auth/totp.d.ts +34 -0
- package/dist/auth/totp.d.ts.map +1 -0
- package/dist/auth.d.ts +9 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +30 -0
- package/dist/client/index.d.ts +51 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/types.d.ts +340 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client.d.ts +46 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +1 -0
- package/dist/config.d.ts +31 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +1 -0
- package/dist/content/export.d.ts +28 -0
- package/dist/content/export.d.ts.map +1 -0
- package/dist/content/import.d.ts +65 -0
- package/dist/content/import.d.ts.map +1 -0
- package/dist/content/records.d.ts +73 -0
- package/dist/content/records.d.ts.map +1 -0
- package/dist/content.d.ts +12 -0
- package/dist/content.d.ts.map +1 -0
- package/dist/content.js +1 -0
- package/dist/db/d1.d.ts +29 -0
- package/dist/db/d1.d.ts.map +1 -0
- package/dist/db/d1.js +1 -0
- package/dist/db/mongodb.d.ts +128 -0
- package/dist/db/mongodb.d.ts.map +1 -0
- package/dist/db/mongodb.js +2 -0
- package/dist/db/postgres.d.ts +37 -0
- package/dist/db/postgres.d.ts.map +1 -0
- package/dist/db/postgres.js +1 -0
- package/dist/db/sql/adapter.d.ts +57 -0
- package/dist/db/sql/adapter.d.ts.map +1 -0
- package/dist/db/sql/compile.d.ts +50 -0
- package/dist/db/sql/compile.d.ts.map +1 -0
- package/dist/db/sql/ddl.d.ts +34 -0
- package/dist/db/sql/ddl.d.ts.map +1 -0
- package/dist/db/sql/dialect.d.ts +35 -0
- package/dist/db/sql/dialect.d.ts.map +1 -0
- package/dist/db/sql/driver.d.ts +34 -0
- package/dist/db/sql/driver.d.ts.map +1 -0
- package/dist/db/sql/introspect.d.ts +15 -0
- package/dist/db/sql/introspect.d.ts.map +1 -0
- package/dist/db/sqlite.d.ts +39 -0
- package/dist/db/sqlite.d.ts.map +1 -0
- package/dist/db/sqlite.js +1 -0
- package/dist/defaults.d.ts +5 -0
- package/dist/defaults.d.ts.map +1 -0
- package/dist/duration.d.ts +12 -0
- package/dist/duration.d.ts.map +1 -0
- package/dist/editor/builtin.d.ts +45 -0
- package/dist/editor/builtin.d.ts.map +1 -0
- package/dist/editor/index.d.ts +14 -0
- package/dist/editor/index.d.ts.map +1 -0
- package/dist/editor/markdown.d.ts +19 -0
- package/dist/editor/markdown.d.ts.map +1 -0
- package/dist/editor/registry.d.ts +30 -0
- package/dist/editor/registry.d.ts.map +1 -0
- package/dist/editor/serialize.d.ts +41 -0
- package/dist/editor/serialize.d.ts.map +1 -0
- package/dist/editor.d.ts +10 -0
- package/dist/editor.d.ts.map +1 -0
- package/dist/editor.js +1 -0
- package/dist/engine/access.d.ts +33 -0
- package/dist/engine/access.d.ts.map +1 -0
- package/dist/engine/activity.d.ts +16 -0
- package/dist/engine/activity.d.ts.map +1 -0
- package/dist/engine/cursor.d.ts +19 -0
- package/dist/engine/cursor.d.ts.map +1 -0
- package/dist/engine/documents.d.ts +81 -0
- package/dist/engine/documents.d.ts.map +1 -0
- package/dist/engine/engine.d.ts +276 -0
- package/dist/engine/engine.d.ts.map +1 -0
- package/dist/engine/field-access.d.ts +21 -0
- package/dist/engine/field-access.d.ts.map +1 -0
- package/dist/engine/hooks.d.ts +58 -0
- package/dist/engine/hooks.d.ts.map +1 -0
- package/dist/engine/index.d.ts +20 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/jobs.d.ts +63 -0
- package/dist/engine/jobs.d.ts.map +1 -0
- package/dist/engine/locales.d.ts +40 -0
- package/dist/engine/locales.d.ts.map +1 -0
- package/dist/engine/outbox.d.ts +81 -0
- package/dist/engine/outbox.d.ts.map +1 -0
- package/dist/engine/relations.d.ts +60 -0
- package/dist/engine/relations.d.ts.map +1 -0
- package/dist/engine/scoped-db.d.ts +13 -0
- package/dist/engine/scoped-db.d.ts.map +1 -0
- package/dist/engine/trash.d.ts +25 -0
- package/dist/engine/trash.d.ts.map +1 -0
- package/dist/errors.d.ts +42 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/fields/builtin.d.ts +142 -0
- package/dist/fields/builtin.d.ts.map +1 -0
- package/dist/fields/index.d.ts +3 -0
- package/dist/fields/index.d.ts.map +1 -0
- package/dist/fields/registry.d.ts +35 -0
- package/dist/fields/registry.d.ts.map +1 -0
- package/dist/fields.d.ts +8 -0
- package/dist/fields.d.ts.map +1 -0
- package/dist/fields.js +1 -0
- package/dist/http/guard.d.ts +45 -0
- package/dist/http/guard.d.ts.map +1 -0
- package/dist/http/handler.d.ts +31 -0
- package/dist/http/handler.d.ts.map +1 -0
- package/dist/http/index.d.ts +13 -0
- package/dist/http/index.d.ts.map +1 -0
- package/dist/http/openapi.d.ts +5 -0
- package/dist/http/openapi.d.ts.map +1 -0
- package/dist/http/params.d.ts +32 -0
- package/dist/http/params.d.ts.map +1 -0
- package/dist/http/request-db.d.ts +19 -0
- package/dist/http/request-db.d.ts.map +1 -0
- package/dist/http/respond.d.ts +48 -0
- package/dist/http/respond.d.ts.map +1 -0
- package/dist/http/rich-text.d.ts +30 -0
- package/dist/http/rich-text.d.ts.map +1 -0
- package/dist/http/router.d.ts +55 -0
- package/dist/http/router.d.ts.map +1 -0
- package/dist/http/routes/access.d.ts +13 -0
- package/dist/http/routes/access.d.ts.map +1 -0
- package/dist/http/routes/admin.d.ts +28 -0
- package/dist/http/routes/admin.d.ts.map +1 -0
- package/dist/http/routes/ai.d.ts +26 -0
- package/dist/http/routes/ai.d.ts.map +1 -0
- package/dist/http/routes/auth.d.ts +13 -0
- package/dist/http/routes/auth.d.ts.map +1 -0
- package/dist/http/routes/documents.d.ts +24 -0
- package/dist/http/routes/documents.d.ts.map +1 -0
- package/dist/http/routes/generate.d.ts +5 -0
- package/dist/http/routes/generate.d.ts.map +1 -0
- package/dist/http/routes/media.d.ts +28 -0
- package/dist/http/routes/media.d.ts.map +1 -0
- package/dist/http/routes/panel.d.ts +20 -0
- package/dist/http/routes/panel.d.ts.map +1 -0
- package/dist/http/routes/system.d.ts +25 -0
- package/dist/http/routes/system.d.ts.map +1 -0
- package/dist/http/routes/webhooks.d.ts +17 -0
- package/dist/http/routes/webhooks.d.ts.map +1 -0
- package/dist/http/spec.d.ts +28 -0
- package/dist/http/spec.d.ts.map +1 -0
- package/dist/http.d.ts +17 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +1 -0
- package/dist/i18n/index.d.ts +12 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/names.d.ts +25 -0
- package/dist/i18n/names.d.ts.map +1 -0
- package/dist/ids.d.ts +28 -0
- package/dist/ids.d.ts.map +1 -0
- package/dist/index-2757kej5.js +2 -0
- package/dist/index-2kb5nbxx.js +2 -0
- package/dist/index-2z1qe5mw.js +2 -0
- package/dist/index-34s342fz.js +2 -0
- package/dist/index-5ngtc7gy.js +2 -0
- package/dist/index-7a231xfp.js +2 -0
- package/dist/index-7k091gpe.js +2 -0
- package/dist/index-9g2n7xa6.js +2 -0
- package/dist/index-9x1z3b85.js +5 -0
- package/dist/index-9zqnf6gx.js +23 -0
- package/dist/index-b2ecggck.js +26 -0
- package/dist/index-cbwwtcm4.js +2 -0
- package/dist/index-ebtj6ebd.js +0 -0
- package/dist/index-g4crf47y.js +0 -0
- package/dist/index-gpwcmmvr.js +2 -0
- package/dist/index-hq05mc1n.js +3 -0
- package/dist/index-hy1x46nf.js +2 -0
- package/dist/index-k8wbg1dw.js +2 -0
- package/dist/index-kbsgt44t.js +2 -0
- package/dist/index-m82a0shw.js +2 -0
- package/dist/index-md79xr6h.js +5 -0
- package/dist/index-nvgwyykk.js +40 -0
- package/dist/index-ty698y02.js +2 -0
- package/dist/index-vq2978e7.js +14 -0
- package/dist/index-vxw0a03g.js +2 -0
- package/dist/index-wj8y1xcj.js +2 -0
- package/dist/index-x72d1hzh.js +2 -0
- package/dist/index-y5mwknr9.js +2 -0
- package/dist/index-ymq6jsar.js +2 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/jobs/runner.d.ts +77 -0
- package/dist/jobs/runner.d.ts.map +1 -0
- package/dist/jobs.d.ts +11 -0
- package/dist/jobs.d.ts.map +1 -0
- package/dist/jobs.js +1 -0
- package/dist/media/document.d.ts +28 -0
- package/dist/media/document.d.ts.map +1 -0
- package/dist/media/gc.d.ts +46 -0
- package/dist/media/gc.d.ts.map +1 -0
- package/dist/media/index.d.ts +20 -0
- package/dist/media/index.d.ts.map +1 -0
- package/dist/media/pipeline.d.ts +36 -0
- package/dist/media/pipeline.d.ts.map +1 -0
- package/dist/media/probe.d.ts +6 -0
- package/dist/media/probe.d.ts.map +1 -0
- package/dist/media/service.d.ts +26 -0
- package/dist/media/service.d.ts.map +1 -0
- package/dist/media/sharp.d.ts +28 -0
- package/dist/media/sharp.d.ts.map +1 -0
- package/dist/media/strip.d.ts +16 -0
- package/dist/media/strip.d.ts.map +1 -0
- package/dist/media/usages.d.ts +69 -0
- package/dist/media/usages.d.ts.map +1 -0
- package/dist/media/variants.d.ts +50 -0
- package/dist/media/variants.d.ts.map +1 -0
- package/dist/migrations.d.ts +115 -0
- package/dist/migrations.d.ts.map +1 -0
- package/dist/migrations.js +1 -0
- package/dist/panel.d.ts +31 -0
- package/dist/panel.d.ts.map +1 -0
- package/dist/query.d.ts +40 -0
- package/dist/query.d.ts.map +1 -0
- package/dist/query.js +1 -0
- package/dist/run-3r72dwhs.js +6 -0
- package/dist/schema/describe.d.ts +19 -0
- package/dist/schema/describe.d.ts.map +1 -0
- package/dist/schema/index.d.ts +5 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/plan.d.ts +20 -0
- package/dist/schema/plan.d.ts.map +1 -0
- package/dist/schema/snapshot.d.ts +22 -0
- package/dist/schema/snapshot.d.ts.map +1 -0
- package/dist/schema/system.d.ts +22 -0
- package/dist/schema/system.d.ts.map +1 -0
- package/dist/schema.d.ts +7 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +1 -0
- package/dist/storage/bytes.d.ts +17 -0
- package/dist/storage/bytes.d.ts.map +1 -0
- package/dist/storage/http.d.ts +43 -0
- package/dist/storage/http.d.ts.map +1 -0
- package/dist/storage/local.d.ts +31 -0
- package/dist/storage/local.d.ts.map +1 -0
- package/dist/storage/providers.d.ts +95 -0
- package/dist/storage/providers.d.ts.map +1 -0
- package/dist/storage/sign.d.ts +53 -0
- package/dist/storage/sign.d.ts.map +1 -0
- package/dist/strings.d.ts +13 -0
- package/dist/strings.d.ts.map +1 -0
- package/dist/telemetry.d.ts +137 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +1 -0
- package/dist/types/activity.d.ts +68 -0
- package/dist/types/activity.d.ts.map +1 -0
- package/dist/types/actor.d.ts +26 -0
- package/dist/types/actor.d.ts.map +1 -0
- package/dist/types/ai.d.ts +357 -0
- package/dist/types/ai.d.ts.map +1 -0
- package/dist/types/api.d.ts +212 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/auth.d.ts +310 -0
- package/dist/types/auth.d.ts.map +1 -0
- package/dist/types/config.d.ts +632 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/database.d.ts +75 -0
- package/dist/types/database.d.ts.map +1 -0
- package/dist/types/editor.d.ts +140 -0
- package/dist/types/editor.d.ts.map +1 -0
- package/dist/types/events.d.ts +72 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/fields.d.ts +142 -0
- package/dist/types/fields.d.ts.map +1 -0
- package/dist/types/hooks.d.ts +142 -0
- package/dist/types/hooks.d.ts.map +1 -0
- package/dist/types/index.d.ts +25 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/instance.d.ts +263 -0
- package/dist/types/instance.d.ts.map +1 -0
- package/dist/types/jobs.d.ts +78 -0
- package/dist/types/jobs.d.ts.map +1 -0
- package/dist/types/json.d.ts +24 -0
- package/dist/types/json.d.ts.map +1 -0
- package/dist/types/locales.d.ts +30 -0
- package/dist/types/locales.d.ts.map +1 -0
- package/dist/types/media.d.ts +245 -0
- package/dist/types/media.d.ts.map +1 -0
- package/dist/types/panel.d.ts +249 -0
- package/dist/types/panel.d.ts.map +1 -0
- package/dist/types/plugin.d.ts +172 -0
- package/dist/types/plugin.d.ts.map +1 -0
- package/dist/types/query.d.ts +101 -0
- package/dist/types/query.d.ts.map +1 -0
- package/dist/types/schema.d.ts +203 -0
- package/dist/types/schema.d.ts.map +1 -0
- package/dist/types/storage.d.ts +61 -0
- package/dist/types/storage.d.ts.map +1 -0
- package/dist/types/telemetry.d.ts +14 -0
- package/dist/types/telemetry.d.ts.map +1 -0
- package/dist/types/trash.d.ts +42 -0
- package/dist/types/trash.d.ts.map +1 -0
- package/dist/types/webhooks.d.ts +133 -0
- package/dist/types/webhooks.d.ts.map +1 -0
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/uploads.d.ts +21 -0
- package/dist/uploads.d.ts.map +1 -0
- package/dist/uploads.js +9 -0
- package/dist/webhooks/index.d.ts +10 -0
- package/dist/webhooks/index.d.ts.map +1 -0
- package/dist/webhooks/job.d.ts +17 -0
- package/dist/webhooks/job.d.ts.map +1 -0
- package/dist/webhooks/service.d.ts +53 -0
- package/dist/webhooks/service.d.ts.map +1 -0
- package/dist/webhooks/sign.d.ts +26 -0
- package/dist/webhooks/sign.d.ts.map +1 -0
- package/dist/webhooks.d.ts +10 -0
- package/dist/webhooks.d.ts.map +1 -0
- package/dist/webhooks.js +1 -0
- package/package.json +183 -4
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import type { EditorSchemaDescription } from "./editor";
|
|
2
|
+
import type { JsonValue } from "./json";
|
|
3
|
+
/**
|
|
4
|
+
* What the panel is told about this deployment (stage 8).
|
|
5
|
+
*
|
|
6
|
+
* The panel is one static bundle serving every configuration, so everything
|
|
7
|
+
* it renders — which collections exist, which fields they carry, which
|
|
8
|
+
* languages are registered, whether there is a trash — has to arrive as data.
|
|
9
|
+
* `GET /panel` is that payload, and this file is its type.
|
|
10
|
+
*
|
|
11
|
+
* Two rules decide what may appear here:
|
|
12
|
+
*
|
|
13
|
+
* 1. **Only what survives JSON.** An access rule, a `condition` and a hook
|
|
14
|
+
* are functions; they stay on the server and the panel is told *that they
|
|
15
|
+
* exist* instead of being handed something it cannot run.
|
|
16
|
+
* 2. **Resolved, not raw.** `purgeAfter: "30d"` is also given in milliseconds
|
|
17
|
+
* because a countdown should not re-implement the duration grammar, and a
|
|
18
|
+
* locale arrives with the name of its language, because `pl` is not a
|
|
19
|
+
* label a switcher can show.
|
|
20
|
+
*/
|
|
21
|
+
/** One entry in the AI menu next to a field. Keys come from `field.ai`. */
|
|
22
|
+
export interface PanelFieldAiAction {
|
|
23
|
+
key: string;
|
|
24
|
+
label: string;
|
|
25
|
+
/** Present when the action overrides `ai.defaultModel`. */
|
|
26
|
+
model?: {
|
|
27
|
+
provider: string;
|
|
28
|
+
model: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Whether the caller may see and write a field.
|
|
33
|
+
*
|
|
34
|
+
* Evaluated with the actor but **without a record**, because the panel asks
|
|
35
|
+
* before a document is chosen — so a rule that reads `record` answers for the
|
|
36
|
+
* generic case and the engine remains the authority on the specific one. A
|
|
37
|
+
* rule that throws without a record counts as permitted here and is still
|
|
38
|
+
* enforced on the write.
|
|
39
|
+
*/
|
|
40
|
+
export interface PanelAccessFlags {
|
|
41
|
+
read: boolean;
|
|
42
|
+
update: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface PanelField {
|
|
45
|
+
name: string;
|
|
46
|
+
type: string;
|
|
47
|
+
label: string;
|
|
48
|
+
description?: string;
|
|
49
|
+
required: boolean;
|
|
50
|
+
localized: boolean;
|
|
51
|
+
readOnly: boolean;
|
|
52
|
+
unique: boolean;
|
|
53
|
+
/** Server-side deterministic generator is available for this field. */
|
|
54
|
+
generate: boolean;
|
|
55
|
+
defaultValue?: JsonValue;
|
|
56
|
+
/**
|
|
57
|
+
* The field type's own options, minus everything that is a function.
|
|
58
|
+
*
|
|
59
|
+
* `select` carries its choices here, `relation` its target, `media` its
|
|
60
|
+
* accept list — the panel reads them by field type, exactly as the field
|
|
61
|
+
* type's `Input` would.
|
|
62
|
+
*/
|
|
63
|
+
options: Record<string, JsonValue>;
|
|
64
|
+
admin: {
|
|
65
|
+
placeholder?: string;
|
|
66
|
+
hidden: boolean;
|
|
67
|
+
};
|
|
68
|
+
ai: PanelFieldAiAction[];
|
|
69
|
+
access: PanelAccessFlags;
|
|
70
|
+
}
|
|
71
|
+
export interface PanelCollection {
|
|
72
|
+
name: string;
|
|
73
|
+
slug: string;
|
|
74
|
+
label: string;
|
|
75
|
+
kind: "collection" | "global";
|
|
76
|
+
group?: string;
|
|
77
|
+
description?: string;
|
|
78
|
+
/** Field used as the row title. Resolved here so the panel never guesses. */
|
|
79
|
+
useAsTitle: string | null;
|
|
80
|
+
defaultColumns: string[];
|
|
81
|
+
fields: PanelField[];
|
|
82
|
+
/**
|
|
83
|
+
* What this actor may do, evaluated without a record.
|
|
84
|
+
*
|
|
85
|
+
* Drives whether the panel offers a "New" button, not whether the write
|
|
86
|
+
* succeeds: a rule that depends on the document is answered properly by the
|
|
87
|
+
* engine when the document exists.
|
|
88
|
+
*/
|
|
89
|
+
can: {
|
|
90
|
+
read: boolean;
|
|
91
|
+
create: boolean;
|
|
92
|
+
update: boolean;
|
|
93
|
+
delete: boolean;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
export interface PanelLocale {
|
|
97
|
+
code: string;
|
|
98
|
+
/** The English name of the language, looked up from the code. */
|
|
99
|
+
name: string;
|
|
100
|
+
rtl: boolean;
|
|
101
|
+
isDefault: boolean;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The languages, as the switcher needs them.
|
|
105
|
+
*
|
|
106
|
+
* Configuration, not a registry: `i18n.locales` is a list of codes, so the
|
|
107
|
+
* panel renders it and never offers to edit it.
|
|
108
|
+
*/
|
|
109
|
+
export interface PanelI18n {
|
|
110
|
+
locales: PanelLocale[];
|
|
111
|
+
defaultLocale: string;
|
|
112
|
+
}
|
|
113
|
+
export interface PanelMedia {
|
|
114
|
+
enabled: boolean;
|
|
115
|
+
/** Declared sizes. Nothing else may be requested from a URL. */
|
|
116
|
+
variants: string[];
|
|
117
|
+
variantMode: "on-demand" | "pregenerate" | null;
|
|
118
|
+
focalPoint: boolean;
|
|
119
|
+
crop: boolean;
|
|
120
|
+
accept: string[];
|
|
121
|
+
maxFileSize: string | null;
|
|
122
|
+
maxFileSizeBytes: number | null;
|
|
123
|
+
/** How long an unused file keeps serving, for the countdown. */
|
|
124
|
+
purgeAfter: string | null;
|
|
125
|
+
purgeAfterMs: number | null;
|
|
126
|
+
}
|
|
127
|
+
export interface PanelTrash {
|
|
128
|
+
enabled: boolean;
|
|
129
|
+
purgeAfter: string | null;
|
|
130
|
+
purgeAfterMs: number | null;
|
|
131
|
+
}
|
|
132
|
+
export interface PanelAuth {
|
|
133
|
+
methods: string[];
|
|
134
|
+
twoFactor: boolean;
|
|
135
|
+
apiKeys: boolean;
|
|
136
|
+
sso: string | null;
|
|
137
|
+
/**
|
|
138
|
+
* Whether the magic-link and password-reset routes exist at all.
|
|
139
|
+
*
|
|
140
|
+
* They are registered only when `admin.auth.deliverToken` is configured, so
|
|
141
|
+
* a sign-in screen that offered them unconditionally would offer a 404.
|
|
142
|
+
*/
|
|
143
|
+
magicLink: boolean;
|
|
144
|
+
passwordReset: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Whether this deployment has no account yet.
|
|
147
|
+
*
|
|
148
|
+
* `true` turns the sign-in screen into a "claim this CMS" screen: there is
|
|
149
|
+
* nobody to sign in as, and `POST /auth/setup` is open for exactly as long
|
|
150
|
+
* as that sentence stays true.
|
|
151
|
+
*/
|
|
152
|
+
setupRequired: boolean;
|
|
153
|
+
}
|
|
154
|
+
export interface PanelRbac {
|
|
155
|
+
enabled: boolean;
|
|
156
|
+
roles: string[];
|
|
157
|
+
customRoles: boolean;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* AI, as the panel sees it.
|
|
161
|
+
*
|
|
162
|
+
* `configured` is "there is an `ai` section"; `runtime` is "something answers
|
|
163
|
+
* the AI routes". They are still two flags rather than one because they fail
|
|
164
|
+
* for different reasons — no section, or no credentials for the provider the
|
|
165
|
+
* default model names — and a greyed-out button with no explanation is a bug
|
|
166
|
+
* report.
|
|
167
|
+
*/
|
|
168
|
+
export interface PanelAi {
|
|
169
|
+
configured: boolean;
|
|
170
|
+
runtime: boolean;
|
|
171
|
+
defaultModel: {
|
|
172
|
+
provider: string;
|
|
173
|
+
model: string;
|
|
174
|
+
} | null;
|
|
175
|
+
/**
|
|
176
|
+
* Whether the panel-wide assistant is switched on for this deployment.
|
|
177
|
+
*
|
|
178
|
+
* The composer is rendered either way. A disabled composer that names its
|
|
179
|
+
* reason is a feature somebody can fix; a composer that is simply not there
|
|
180
|
+
* is a feature nobody reports as missing.
|
|
181
|
+
*/
|
|
182
|
+
assistant: boolean;
|
|
183
|
+
/** Effective assistant settings. Instructions themselves never leave the server. */
|
|
184
|
+
assistantSettings: {
|
|
185
|
+
model: {
|
|
186
|
+
provider: string;
|
|
187
|
+
model: string;
|
|
188
|
+
};
|
|
189
|
+
maxTurns: number;
|
|
190
|
+
maxToolCalls: number;
|
|
191
|
+
timeoutMs: number;
|
|
192
|
+
customInstructions: boolean;
|
|
193
|
+
} | null;
|
|
194
|
+
/** Every registered action id, including the ones plugins added. */
|
|
195
|
+
actions: string[];
|
|
196
|
+
/** Whether provider keys can be managed from the settings screen. */
|
|
197
|
+
managedKeys: boolean;
|
|
198
|
+
}
|
|
199
|
+
export interface PanelWebhooks {
|
|
200
|
+
enabled: boolean;
|
|
201
|
+
managedInAdmin: boolean;
|
|
202
|
+
/** Whether the delivery endpoints answer. */
|
|
203
|
+
runtime: boolean;
|
|
204
|
+
/** The event catalogue, so the subscription form is a picker. */
|
|
205
|
+
events: string[];
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* A plugin, as the panel can act on it.
|
|
209
|
+
*
|
|
210
|
+
* `scripts` is the whole of the client extension story: the panel is one
|
|
211
|
+
* static bundle compiled before any plugin existed, so a plugin that wants
|
|
212
|
+
* to render something ships a script the panel loads at boot, and that
|
|
213
|
+
* script registers a field control or a view against the global the panel
|
|
214
|
+
* exposes. The alternative — shipping React components through JSON — is not
|
|
215
|
+
* a thing that can work.
|
|
216
|
+
*/
|
|
217
|
+
export interface PanelPlugin {
|
|
218
|
+
id: string;
|
|
219
|
+
navItems: {
|
|
220
|
+
label: string;
|
|
221
|
+
path: string;
|
|
222
|
+
icon?: string;
|
|
223
|
+
}[];
|
|
224
|
+
/** URLs, relative to `basePath` unless absolute. Loaded in order. */
|
|
225
|
+
scripts: string[];
|
|
226
|
+
/** Field types the plugin says it renders, for a diagnostic when it fails. */
|
|
227
|
+
fields: string[];
|
|
228
|
+
}
|
|
229
|
+
export interface PanelConfig {
|
|
230
|
+
title: string;
|
|
231
|
+
/** Where the API is mounted, absolute: every request the panel makes. */
|
|
232
|
+
basePath: string;
|
|
233
|
+
/** Where the panel itself is mounted, absolute: its router's prefix. */
|
|
234
|
+
panelPath: string;
|
|
235
|
+
collections: PanelCollection[];
|
|
236
|
+
globals: PanelCollection[];
|
|
237
|
+
i18n: PanelI18n;
|
|
238
|
+
media: PanelMedia;
|
|
239
|
+
trash: PanelTrash;
|
|
240
|
+
auth: PanelAuth;
|
|
241
|
+
rbac: PanelRbac;
|
|
242
|
+
ai: PanelAi;
|
|
243
|
+
webhooks: PanelWebhooks;
|
|
244
|
+
/** Rich-text nodes and marks, including the ones plugins registered. */
|
|
245
|
+
editor: EditorSchemaDescription;
|
|
246
|
+
/** Installed plugins and what they contribute to this screen. */
|
|
247
|
+
plugins: PanelPlugin[];
|
|
248
|
+
}
|
|
249
|
+
//# sourceMappingURL=panel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel.d.ts","sourceRoot":"","sources":["../../src/types/panel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC;;;;;;;;;;;;;;;;;GAiBG;AAEH,2EAA2E;AAC3E,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,KAAK,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KA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C1B,KAAK,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,QAAQ,EAAE,MAAM,CAAC;IACjB,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,SAAS,CAAC;IAChB,EAAE,EAAE,OAAO,CAAC;IACZ,QAAQ,EAAE,aAAa,CAAC;IACxB,wEAAwE;IACxE,MAAM,EAAE,uBAAuB,CAAC;IAChC,iEAAiE;IACjE,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import type { Actor } from "./actor";
|
|
2
|
+
import type { CollectionDefinition } from "./config";
|
|
3
|
+
import type { DatabaseAdapter } from "./database";
|
|
4
|
+
import type { FieldsConfig } from "./fields";
|
|
5
|
+
import type { CollectionDatabaseHooks, HookContext, HookOperation, HookResult, MaybePromise, ScopedDb } from "./hooks";
|
|
6
|
+
import type { CmsInstance } from "./instance";
|
|
7
|
+
import type { ComponentType, JsonObject } from "./json";
|
|
8
|
+
import type { MigrationStep, TableSnapshot } from "./schema";
|
|
9
|
+
/**
|
|
10
|
+
* What a route handler receives.
|
|
11
|
+
*
|
|
12
|
+
* Deliberately not a third-party router's context. The router inside the core
|
|
13
|
+
* is the core's own (section 10): a plugin contract typed against a specific
|
|
14
|
+
* router version is a lock-in the plan's "zero framework coupling" promise
|
|
15
|
+
* cannot afford, and a route that only ever needs `Request` and the matched
|
|
16
|
+
* parameters has no business importing one.
|
|
17
|
+
*
|
|
18
|
+
* The pair `db`/`cms` is the same distinction hooks make, by name rather than
|
|
19
|
+
* by a flag: `db` bypasses access control, `cms` enforces it.
|
|
20
|
+
*/
|
|
21
|
+
export interface RouteContext {
|
|
22
|
+
request: Request;
|
|
23
|
+
/** Path parameters, e.g. `{ id: "doc_1" }` for `/posts/:id`. */
|
|
24
|
+
params: Record<string, string>;
|
|
25
|
+
query: URLSearchParams;
|
|
26
|
+
actor: Actor | null;
|
|
27
|
+
/** Access control enforced; the object hooks receive as `ctx.cms`. */
|
|
28
|
+
cms: CmsInstance;
|
|
29
|
+
/**
|
|
30
|
+
* Access-control-bypassing database handle, outside any transaction.
|
|
31
|
+
*
|
|
32
|
+
* Every call opens its own short transaction, because a route is not an
|
|
33
|
+
* operation: there is nothing for a second statement to be atomic with.
|
|
34
|
+
* A route that needs atomicity calls `cms.api`, or opens one itself through
|
|
35
|
+
* `database()`.
|
|
36
|
+
*/
|
|
37
|
+
db: ScopedDb;
|
|
38
|
+
/**
|
|
39
|
+
* The adapter, built on first use.
|
|
40
|
+
*
|
|
41
|
+
* A function rather than a resolved value: a route that serves a bundled
|
|
42
|
+
* asset or the OpenAPI document must not open a connection pool, and a D1
|
|
43
|
+
* binding only exists inside a request in the first place.
|
|
44
|
+
*/
|
|
45
|
+
database(): Promise<DatabaseAdapter>;
|
|
46
|
+
/** The parsed JSON body. Throws a 400 `CmsError` when it is not JSON. */
|
|
47
|
+
body(): Promise<unknown>;
|
|
48
|
+
/** Shared with the HTTP hooks that run around this request. */
|
|
49
|
+
meta: Record<string, unknown>;
|
|
50
|
+
json(body: unknown, status?: number): Response;
|
|
51
|
+
text(body: string, status?: number): Response;
|
|
52
|
+
}
|
|
53
|
+
export type RouteMethod = "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
|
|
54
|
+
/**
|
|
55
|
+
* An OpenAPI fragment carried by a route into the generated document.
|
|
56
|
+
*
|
|
57
|
+
* Attached to the route rather than written in a separate file, which is what
|
|
58
|
+
* makes an undocumented endpoint impossible: the generator reads the router,
|
|
59
|
+
* so a route that forgot its fragment shows up as one in the document.
|
|
60
|
+
*/
|
|
61
|
+
export interface OpenApiRouteSpec {
|
|
62
|
+
summary?: string;
|
|
63
|
+
description?: string;
|
|
64
|
+
tags?: string[];
|
|
65
|
+
/** Query and path parameters, as OpenAPI parameter objects. */
|
|
66
|
+
parameters?: JsonObject[];
|
|
67
|
+
requestBody?: JsonObject;
|
|
68
|
+
responses?: JsonObject;
|
|
69
|
+
/** `false` marks a route that needs no credentials, e.g. a sign-in. */
|
|
70
|
+
security?: boolean;
|
|
71
|
+
}
|
|
72
|
+
export interface RouteDefinition {
|
|
73
|
+
method: RouteMethod;
|
|
74
|
+
/** Relative to `basePath`, e.g. `/analytics/pageviews`. */
|
|
75
|
+
path: string;
|
|
76
|
+
handler: (context: RouteContext) => Response | Promise<Response>;
|
|
77
|
+
middleware?: ((context: RouteContext, next: () => Promise<Response>) => Promise<Response>)[];
|
|
78
|
+
openapi?: OpenApiRouteSpec;
|
|
79
|
+
}
|
|
80
|
+
/** Tables and collections a plugin brings with it. */
|
|
81
|
+
export interface PluginSchema {
|
|
82
|
+
collections?: Record<string, CollectionDefinition>;
|
|
83
|
+
tables?: TableSnapshot[];
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* A plugin migration.
|
|
87
|
+
*
|
|
88
|
+
* Steps, not SQL: a plugin that shipped Postgres DDL would be unusable on
|
|
89
|
+
* MongoDB, and the whole point of the neutral step list is that the adapter
|
|
90
|
+
* decides how a change is expressed.
|
|
91
|
+
*/
|
|
92
|
+
export interface PluginMigration {
|
|
93
|
+
id: string;
|
|
94
|
+
steps: MigrationStep[];
|
|
95
|
+
}
|
|
96
|
+
/** Changes a plugin makes to collections the user declared. */
|
|
97
|
+
export interface CollectionPatch {
|
|
98
|
+
collection: string;
|
|
99
|
+
fields?: FieldsConfig;
|
|
100
|
+
hooks?: CollectionDatabaseHooks;
|
|
101
|
+
}
|
|
102
|
+
export interface PluginContext {
|
|
103
|
+
collections: Record<string, CollectionDefinition>;
|
|
104
|
+
basePath: string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* A hook a plugin installs on a collection it does not own.
|
|
108
|
+
*
|
|
109
|
+
* Ordering is explicit rather than registration-dependent: plugin hooks run
|
|
110
|
+
* in `priority` order and the configuration's own hooks always run last, so a
|
|
111
|
+
* user can always override what a plugin decided (section 5).
|
|
112
|
+
*/
|
|
113
|
+
export interface HookRegistration {
|
|
114
|
+
collection: string;
|
|
115
|
+
operation: HookOperation;
|
|
116
|
+
timing: "before" | "after";
|
|
117
|
+
/** Lower runs first. Plugin hooks default to 0, user hooks always run last. */
|
|
118
|
+
priority?: number;
|
|
119
|
+
handler: (input: JsonObject, context: HookContext) => MaybePromise<HookResult<JsonObject>>;
|
|
120
|
+
}
|
|
121
|
+
/** Extra methods a plugin adds to the typed client. */
|
|
122
|
+
export type ClientExtension<Ext> = (base: {
|
|
123
|
+
baseUrl: string;
|
|
124
|
+
request: (path: string, init?: RequestInit & {
|
|
125
|
+
query?: Record<string, string>;
|
|
126
|
+
}) => Promise<unknown>;
|
|
127
|
+
}) => Ext;
|
|
128
|
+
/**
|
|
129
|
+
* Panel surfaces a plugin can extend. Rendered by `@heyo-sh/heyo-cms-admin`.
|
|
130
|
+
*
|
|
131
|
+
* `views` and `fields` are components, and a component cannot cross HTTP —
|
|
132
|
+
* the panel is one static bundle, compiled before this plugin existed. They
|
|
133
|
+
* are useful to a deployment that builds its own panel bundle. For the
|
|
134
|
+
* shipped one, `scripts` is the mechanism: the panel loads each URL at boot
|
|
135
|
+
* and the script registers its controls against `window.heyoCmsPanel`.
|
|
136
|
+
*/
|
|
137
|
+
export interface AdminExtension {
|
|
138
|
+
navItems?: {
|
|
139
|
+
label: string;
|
|
140
|
+
path: string;
|
|
141
|
+
icon?: string;
|
|
142
|
+
}[];
|
|
143
|
+
views?: Record<string, ComponentType<Record<string, unknown>>>;
|
|
144
|
+
fields?: Record<string, ComponentType<Record<string, unknown>>>;
|
|
145
|
+
/**
|
|
146
|
+
* Scripts the panel loads before it renders.
|
|
147
|
+
*
|
|
148
|
+
* Relative URLs are resolved against `basePath`, so the usual arrangement
|
|
149
|
+
* is a plugin route serving its own bundle: `/analytics/panel.js`.
|
|
150
|
+
*/
|
|
151
|
+
scripts?: string[];
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* A plugin.
|
|
155
|
+
*
|
|
156
|
+
* `Ext` is what the plugin adds to the typed client, and it is only ever in a
|
|
157
|
+
* return position — which is what lets a configuration hold
|
|
158
|
+
* `CmsPlugin<unknown>[]` while `heyoCmsClient({ plugins: [...] })` still
|
|
159
|
+
* recovers the concrete extension types from the tuple it is handed.
|
|
160
|
+
*/
|
|
161
|
+
export interface CmsPlugin<Ext = Record<string, never>> {
|
|
162
|
+
id: string;
|
|
163
|
+
schema?: PluginSchema;
|
|
164
|
+
migrations?: PluginMigration[];
|
|
165
|
+
extendCollections?: (context: PluginContext) => CollectionPatch[];
|
|
166
|
+
hooks?: HookRegistration[];
|
|
167
|
+
/** Registered under `basePath` automatically, exactly like core routes. */
|
|
168
|
+
routes?: RouteDefinition[];
|
|
169
|
+
client?: ClientExtension<Ext>;
|
|
170
|
+
admin?: AdminExtension;
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/types/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EACV,uBAAuB,EACvB,WAAW,EACX,aAAa,EACb,UAAU,EACV,YAAY,EACZ,QAAQ,EACT,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EA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3B,MAAM,CAAC,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC;IAC9B,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { JsonValue } from "./json";
|
|
2
|
+
/**
|
|
3
|
+
* A value as it crosses the adapter boundary.
|
|
4
|
+
*
|
|
5
|
+
* `Date` is kept distinct from its serialisation: Postgres wants a timestamp,
|
|
6
|
+
* SQLite wants an integer, MongoDB wants a `Date`. Deciding that inside the
|
|
7
|
+
* adapter is the only way the engine can stay engine-agnostic.
|
|
8
|
+
*/
|
|
9
|
+
export type ColumnValue = JsonValue | Date | Uint8Array;
|
|
10
|
+
export type Row = Record<string, ColumnValue>;
|
|
11
|
+
/**
|
|
12
|
+
* A dotted path into a row: `id`, `created_at`, `data.title`, `data.title.pl`.
|
|
13
|
+
*
|
|
14
|
+
* Field names are validated to exclude dots, so splitting on `.` is lossless.
|
|
15
|
+
* The first segment names a column; the rest, when present, address a path
|
|
16
|
+
* inside that column's JSON document.
|
|
17
|
+
*/
|
|
18
|
+
export type FieldPath = string;
|
|
19
|
+
export type Comparator = "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "in" | "nin" | "like" | "ilike" | "contains" | "exists";
|
|
20
|
+
/**
|
|
21
|
+
* The filter AST.
|
|
22
|
+
*
|
|
23
|
+
* This is the hard boundary from section 12: the engine builds `Where`, the
|
|
24
|
+
* adapter turns it into SQL or into a MongoDB filter document. If a feature
|
|
25
|
+
* cannot be expressed here, it cannot be expressed in the engine either —
|
|
26
|
+
* which is the constraint that keeps a third database adapter cheap.
|
|
27
|
+
*/
|
|
28
|
+
export type Where = {
|
|
29
|
+
kind: "and";
|
|
30
|
+
conditions: Where[];
|
|
31
|
+
} | {
|
|
32
|
+
kind: "or";
|
|
33
|
+
conditions: Where[];
|
|
34
|
+
} | {
|
|
35
|
+
kind: "not";
|
|
36
|
+
condition: Where;
|
|
37
|
+
} | {
|
|
38
|
+
kind: "compare";
|
|
39
|
+
path: FieldPath;
|
|
40
|
+
operator: Comparator;
|
|
41
|
+
value: ColumnValue | ColumnValue[];
|
|
42
|
+
};
|
|
43
|
+
export interface OrderBy {
|
|
44
|
+
path: FieldPath;
|
|
45
|
+
direction: "asc" | "desc";
|
|
46
|
+
}
|
|
47
|
+
export interface Query {
|
|
48
|
+
table: string;
|
|
49
|
+
/** Omitted means every column. Paths may reach into the document body. */
|
|
50
|
+
select?: FieldPath[];
|
|
51
|
+
where?: Where;
|
|
52
|
+
orderBy?: OrderBy[];
|
|
53
|
+
limit?: number;
|
|
54
|
+
offset?: number;
|
|
55
|
+
/**
|
|
56
|
+
* Returns a single row `{ count }` instead of the matching rows. Counting
|
|
57
|
+
* belongs in the AST rather than in a second adapter method, so pagination
|
|
58
|
+
* never needs a code path the adapter contract does not cover.
|
|
59
|
+
*/
|
|
60
|
+
count?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export type Mutation = {
|
|
63
|
+
kind: "insert";
|
|
64
|
+
table: string;
|
|
65
|
+
values: Row;
|
|
66
|
+
returning?: boolean;
|
|
67
|
+
} | {
|
|
68
|
+
kind: "update";
|
|
69
|
+
table: string;
|
|
70
|
+
where: Where;
|
|
71
|
+
set: Row;
|
|
72
|
+
returning?: boolean;
|
|
73
|
+
} | {
|
|
74
|
+
kind: "delete";
|
|
75
|
+
table: string;
|
|
76
|
+
where: Where;
|
|
77
|
+
returning?: boolean;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* What a mutation reports back.
|
|
81
|
+
*
|
|
82
|
+
* The plan sketched `Promise<Row>`, which cannot describe a delete or a
|
|
83
|
+
* multi-row update. `count` is always meaningful; `rows` is populated when the
|
|
84
|
+
* mutation asked for `returning`.
|
|
85
|
+
*/
|
|
86
|
+
export interface MutationResult {
|
|
87
|
+
rows: Row[];
|
|
88
|
+
count: number;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* A transaction handle.
|
|
92
|
+
*
|
|
93
|
+
* `real` is false when the engine could not start a true transaction — MongoDB
|
|
94
|
+
* without a replica set. Hooks and the outbox read it to switch to the
|
|
95
|
+
* compensating path instead of silently losing atomicity (section 12).
|
|
96
|
+
*/
|
|
97
|
+
export interface Tx {
|
|
98
|
+
readonly id: string;
|
|
99
|
+
readonly real: boolean;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/types/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,IAAI,GAAG,UAAU,CAAC;AAExD,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B,MAAM,MAAM,UAAU,GAClB,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,KAAK,GACL,MAAM,GACN,OAAO,GACP,UAAU,GACV,QAAQ,CAAC;AAEb;;;;;;;GAOG;AACH,MAAM,MAAM,KAAK,GACb;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,UAAU,EAAE,KAAK,EAAE,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,KAAK,EAAE,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,SAAS,EAAE,KAAK,CAAA;CAAE,GACjC;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,UAAU,CAAC;IACrB,KAAK,EAAE,WAAW,GAAG,WAAW,EAAE,CAAC;CACpC,CAAC;AAEN,MAAM,WAAW,OAA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