@heyo-sh/heyo-cms 0.0.0-stage → 0.2.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 +45 -0
- package/dist/adapters/astro.d.ts.map +1 -0
- package/dist/adapters/astro.js +1 -0
- package/dist/adapters/deliver.d.ts +26 -0
- package/dist/adapters/deliver.d.ts.map +1 -0
- package/dist/adapters/next.d.ts +45 -0
- package/dist/adapters/next.d.ts.map +1 -0
- package/dist/adapters/next.js +1 -0
- package/dist/adapters/nuxt.d.ts +51 -0
- package/dist/adapters/nuxt.d.ts.map +1 -0
- package/dist/adapters/nuxt.js +1 -0
- package/dist/adapters/react-router.d.ts +36 -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 +41 -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 +363 -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 +37 -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 +50 -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 +295 -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/slugs.d.ts +124 -0
- package/dist/engine/slugs.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 +169 -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 +9 -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 +41 -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 +58 -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-2ddk43me.js +2 -0
- package/dist/index-2prbs05k.js +2 -0
- package/dist/index-385ggnge.js +2 -0
- package/dist/index-466cwb0b.js +2 -0
- package/dist/index-4qrep5f0.js +26 -0
- package/dist/index-67e458ws.js +2 -0
- package/dist/index-6m1kjq9g.js +2 -0
- package/dist/index-6w10rch0.js +3 -0
- package/dist/index-761dec5z.js +2 -0
- package/dist/index-8nzmqy0f.js +2 -0
- package/dist/index-8x2em6c8.js +14 -0
- package/dist/index-91fa1gzf.js +2 -0
- package/dist/index-9g2n7xa6.js +2 -0
- package/dist/index-a8jcwqsf.js +2 -0
- package/dist/index-abfzb1ve.js +2 -0
- package/dist/index-cv0hpz3d.js +2 -0
- package/dist/index-ebtj6ebd.js +0 -0
- package/dist/index-g041kfa5.js +18 -0
- package/dist/index-g4crf47y.js +0 -0
- package/dist/index-hbx67b20.js +7 -0
- package/dist/index-hpast878.js +40 -0
- package/dist/index-kc1j3h6z.js +2 -0
- package/dist/index-p2cqsmvw.js +2 -0
- package/dist/index-rg9tpg3p.js +5 -0
- package/dist/index-rw0hze6x.js +2 -0
- package/dist/index-s9x07zb3.js +2 -0
- package/dist/index-sgdnp83t.js +2 -0
- package/dist/index-szaq03qq.js +2 -0
- package/dist/index-vkwzdfte.js +5 -0
- package/dist/index-vzhxn50e.js +2 -0
- package/dist/index-x72d1hzh.js +2 -0
- package/dist/index-y8kzzn94.js +2 -0
- package/dist/index-ypcmns0v.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/cloudflare.d.ts +58 -0
- package/dist/media/cloudflare.d.ts.map +1 -0
- package/dist/media/document.d.ts +29 -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 +55 -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/urls.d.ts +77 -0
- package/dist/media/urls.d.ts.map +1 -0
- package/dist/media/usages.d.ts +77 -0
- package/dist/media/usages.d.ts.map +1 -0
- package/dist/media/variants.d.ts +61 -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/plugins/indexnow.d.ts +82 -0
- package/dist/plugins/indexnow.d.ts.map +1 -0
- package/dist/plugins.d.ts +9 -0
- package/dist/plugins.d.ts.map +1 -0
- package/dist/plugins.js +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-bjge3v8e.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 +24 -0
- package/dist/schema/snapshot.d.ts.map +1 -0
- package/dist/schema/system.d.ts +31 -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/slugify.d.ts +31 -0
- package/dist/slugify.d.ts.map +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 +268 -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 +647 -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 +166 -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 +342 -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 +194 -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 +22 -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 +187 -4
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ResolvedCollection } from "../types/config";
|
|
2
|
+
import type { SchemaSnapshot, TableSnapshot } from "../types/schema";
|
|
3
|
+
/** The table every user-declared collection and global is stored in. */
|
|
4
|
+
export declare const documentsTableName = "documents";
|
|
5
|
+
export declare const documentsDataColumn = "data";
|
|
6
|
+
export interface SnapshotInput {
|
|
7
|
+
collections: Record<string, ResolvedCollection>;
|
|
8
|
+
globals: Record<string, ResolvedCollection>;
|
|
9
|
+
/** Tables contributed by plugins (`CmsPlugin.schema.tables`). */
|
|
10
|
+
pluginTables?: TableSnapshot[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Builds the schema a configuration implies.
|
|
14
|
+
*
|
|
15
|
+
* Pure: the same configuration always produces the same snapshot, down to the
|
|
16
|
+
* ordering of columns and indexes. `generate` diffs two of these and nothing
|
|
17
|
+
* else, which is what makes a migration reviewable before any database is
|
|
18
|
+
* involved.
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildSchemaSnapshot(input: SnapshotInput): SchemaSnapshot;
|
|
21
|
+
/** Whether any collection keeps previous slugs, and so needs `slug_history`. */
|
|
22
|
+
export declare function keepsSlugHistory(collections: Iterable<ResolvedCollection>): boolean;
|
|
23
|
+
export declare function emptySnapshot(): SchemaSnapshot;
|
|
24
|
+
//# sourceMappingURL=snapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../src/schema/snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAG1D,OAAO,KAAK,EAIV,cAAc,EACd,aAAa,EACd,MAAM,iBAAiB,CAAC;AAGzB,wEAAwE;AACxE,eAAO,MAAM,kBAAkB,cAAc,CAAC;AAC9C,eAAO,MAAM,mBAAmB,SAAS,CAAC;AAE1C,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAChD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAC5C,iEAAiE;IACjE,YAAY,CAAC,EAAE,aAAa,EAAE,CAAC;CAChC;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,aAAa,GAAG,cAAc,CA0BxE;AAED,gFAAgF;AAChF,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,QAAQ,CAAC,kBAAkB,CAAC,GACxC,OAAO,CAOT;AAED,wBAAgB,aAAa,IAAI,cAAc,CAE9C"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { TableSnapshot } from "../types/schema";
|
|
2
|
+
/**
|
|
3
|
+
* The journal.
|
|
4
|
+
*
|
|
5
|
+
* Owned by the adapter rather than by the schema: it has to exist before the
|
|
6
|
+
* first migration runs, so it can never be the product of one. `introspect()`
|
|
7
|
+
* ignores it for the same reason.
|
|
8
|
+
*/
|
|
9
|
+
export declare const migrationsTable = "cms_migrations";
|
|
10
|
+
/**
|
|
11
|
+
* Every table the engine owns.
|
|
12
|
+
*
|
|
13
|
+
* One `documents` table holds all content: a table per collection would turn
|
|
14
|
+
* "add a field" into DDL and "add a locale" into a migration, which is exactly
|
|
15
|
+
* what the document model avoids (section 12). Everything else here is
|
|
16
|
+
* machinery — auth, media, delivery, scheduling — and is queried by the engine
|
|
17
|
+
* itself, so it gets real columns.
|
|
18
|
+
*/
|
|
19
|
+
export declare function systemTables(): TableSnapshot[];
|
|
20
|
+
/** Names the engine reserves; a collection cannot take one of them. */
|
|
21
|
+
export declare function systemTableNames(): string[];
|
|
22
|
+
/**
|
|
23
|
+
* Previous addresses of documents, for `slug({ history: true })`.
|
|
24
|
+
*
|
|
25
|
+
* Not in `systemTables()`: only a configuration that keeps slug history gets
|
|
26
|
+
* it, so every other project's next migration stays empty. One row per
|
|
27
|
+
* address a document used to have; the unique index is the rule that an
|
|
28
|
+
* address leads to one place.
|
|
29
|
+
*/
|
|
30
|
+
export declare function slugHistoryTableSnapshot(): TableSnapshot;
|
|
31
|
+
//# sourceMappingURL=system.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../src/schema/system.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAMV,aAAa,EACd,MAAM,iBAAiB,CAAC;AAGzB;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,mBAAmB,CAAC;AA0EhD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,IAAI,aAAa,EAAE,CAoB9C;AAED,uEAAuE;AACvE,wBAAgB,gBAAgB,IAAI,MAAM,EAAE,CAQ3C;AAID;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,IAAI,aAAa,CAsBxD"}
|
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The schema layer: system tables, the snapshot a configuration implies, and
|
|
3
|
+
* the deterministic diff between two snapshots. No SQL lives here — steps are
|
|
4
|
+
* neutral and every engine renders them itself (section 12).
|
|
5
|
+
*/
|
|
6
|
+
export * from "./schema/index";
|
|
7
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,gBAAgB,CAAC"}
|
package/dist/schema.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ce,Ue,Oe,Fn}from"./index-vzhxn50e.js";import{p,ln,Pt,_t}from"./index-s9x07zb3.js";import{z,nt,ot}from"./index-761dec5z.js";export{Pt as buildSchemaSnapshot,Oe as describeStep,ln as documentsDataColumn,p as documentsTableName,_t as emptySnapshot,Fn as migrationName,z as migrationsTable,Ce as planMigration,Ue as stableStringify,ot as systemTableNames,nt as systemTables};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URL slugs, in every script a CMS is likely to be written in.
|
|
3
|
+
*
|
|
4
|
+
* ASCII on purpose: an ASCII slug survives being pasted into a chat or an
|
|
5
|
+
* e-mail, never turns into `%D0%B1…` in a link, and reads the same in every
|
|
6
|
+
* browser. Unicode normalisation takes care of the accents it can decompose
|
|
7
|
+
* (é, ü, ç, ą…); the letters it cannot (ł, ß, ø…) and the Cyrillic and Greek
|
|
8
|
+
* alphabets are transliterated from the tables below. A character with no
|
|
9
|
+
* transliteration is dropped rather than percent-encoded, which is why a
|
|
10
|
+
* title written entirely in such a script produces an empty slug — the
|
|
11
|
+
* caller decides what to do then, usually by falling back to the id.
|
|
12
|
+
*/
|
|
13
|
+
/** What a slug looks like: lowercase ASCII words joined by single hyphens. */
|
|
14
|
+
export declare const slugPattern = "^[a-z0-9]+(?:-[a-z0-9]+)*$";
|
|
15
|
+
export declare function isSlug(value: string): boolean;
|
|
16
|
+
export interface SlugifyOptions {
|
|
17
|
+
/**
|
|
18
|
+
* The longest slug produced. Longer input is cut at the last hyphen that
|
|
19
|
+
* keeps at least half of it, so a slug never ends in the middle of a word.
|
|
20
|
+
*/
|
|
21
|
+
maxLength?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Turns any text into a slug: `"Łódź & Kraków — 2024"` → `"lodz-krakow-2024"`.
|
|
25
|
+
*
|
|
26
|
+
* Idempotent: a slug passed through it comes back unchanged, which is what
|
|
27
|
+
* lets the engine run every incoming slug through it without second-guessing
|
|
28
|
+
* one an editor typed on purpose.
|
|
29
|
+
*/
|
|
30
|
+
export declare function slugify(input: string, options?: SlugifyOptions): string;
|
|
31
|
+
//# sourceMappingURL=slugify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slugify.d.ts","sourceRoot":"","sources":["../src/slugify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA6FH,8EAA8E;AAC9E,eAAO,MAAM,WAAW,+BAA+B,CAAC;AAIxD,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE7C;AAED,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,MAAM,CA2B3E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Byte plumbing shared by every storage adapter.
|
|
3
|
+
*
|
|
4
|
+
* Kept in one place because the conversions are exactly the kind of thing that
|
|
5
|
+
* grows a subtly different copy in each adapter — one that forgets a chunk
|
|
6
|
+
* boundary, or that assumes `Buffer` and therefore excludes Workers.
|
|
7
|
+
*/
|
|
8
|
+
/** Collects whatever a caller handed us into one contiguous buffer. */
|
|
9
|
+
export declare function toBytes(body: ReadableStream | Uint8Array | ArrayBuffer | Blob): Promise<Uint8Array>;
|
|
10
|
+
export declare function concat(chunks: Uint8Array[]): Uint8Array;
|
|
11
|
+
/** A one-shot stream over bytes already in memory. */
|
|
12
|
+
export declare function streamOf(bytes: Uint8Array): ReadableStream<Uint8Array>;
|
|
13
|
+
export declare function hex(bytes: Uint8Array): string;
|
|
14
|
+
/** base64 without `Buffer`, because the core also runs on Workers. */
|
|
15
|
+
export declare function base64(bytes: Uint8Array): string;
|
|
16
|
+
export declare function sha256(data: Uint8Array | string): Promise<Uint8Array>;
|
|
17
|
+
//# sourceMappingURL=bytes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../../src/storage/bytes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,uEAAuE;AACvE,wBAAsB,OAAO,CAC3B,IAAI,EAAE,cAAc,GAAG,UAAU,GAAG,WAAW,GAAG,IAAI,GACrD,OAAO,CAAC,UAAU,CAAC,CAerB;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAUvD;AAED,sDAAsD;AACtD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC,CAOtE;AAED,wBAAgB,GAAG,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAI7C;AAED,sEAAsE;AACtE,wBAAgB,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAIhD;AAED,wBAAsB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAO3E"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { SignedUrlOptions, StorageAdapter } from "../types/storage";
|
|
2
|
+
/**
|
|
3
|
+
* The shape of every object store we reach over HTTP.
|
|
4
|
+
*
|
|
5
|
+
* S3, R2, GCS and Azure differ in how a request is signed and in where the
|
|
6
|
+
* bucket name goes. They do not differ in what PUT, GET, DELETE and HEAD mean,
|
|
7
|
+
* so that part is written once here and each adapter supplies the two
|
|
8
|
+
* functions that are actually its own.
|
|
9
|
+
*/
|
|
10
|
+
export type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
11
|
+
export interface SignableRequest {
|
|
12
|
+
method: string;
|
|
13
|
+
url: URL;
|
|
14
|
+
headers: Record<string, string>;
|
|
15
|
+
payload: Uint8Array | "UNSIGNED-PAYLOAD";
|
|
16
|
+
contentLength: number;
|
|
17
|
+
}
|
|
18
|
+
export interface HttpStorageOptions {
|
|
19
|
+
id: string;
|
|
20
|
+
/** Where the bytes actually live, including credentials-bearing hosts. */
|
|
21
|
+
endpoint(key: string): URL;
|
|
22
|
+
sign(request: SignableRequest): Promise<Record<string, string>>;
|
|
23
|
+
/** What a browser should be given; a CDN domain when one is configured. */
|
|
24
|
+
publicUrl(key: string): string;
|
|
25
|
+
/** Produces a time-limited URL. Absent when the adapter cannot sign one. */
|
|
26
|
+
signedUrl?(key: string, options: SignedUrlOptions | undefined): Promise<string>;
|
|
27
|
+
prefix?: (file: {
|
|
28
|
+
id: string;
|
|
29
|
+
filename: string;
|
|
30
|
+
}) => string;
|
|
31
|
+
fetch?: FetchLike;
|
|
32
|
+
/** Headers every request carries, such as a storage class or an ACL. */
|
|
33
|
+
defaultHeaders?: Record<string, string>;
|
|
34
|
+
}
|
|
35
|
+
export declare function httpStorage(options: HttpStorageOptions): StorageAdapter;
|
|
36
|
+
/**
|
|
37
|
+
* Every segment encoded, slashes kept.
|
|
38
|
+
*
|
|
39
|
+
* Object keys are not URL paths: `a b/c.png` is one perfectly ordinary key and
|
|
40
|
+
* has to survive the round trip to the same bytes it went in as.
|
|
41
|
+
*/
|
|
42
|
+
export declare function encodeKey(key: string): string;
|
|
43
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/storage/http.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,gBAAgB,EAChB,cAAc,EAEf,MAAM,kBAAkB,CAAC;AAG1B;;;;;;;GAOG;AAEH,MAAM,MAAM,SAAS,GAAG,CACtB,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAC7B,IAAI,CAAC,EAAE,WAAW,KACf,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEvB,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,GAAG,CAAC;IACT,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,OAAO,EAAE,UAAU,GAAG,kBAAkB,CAAC;IACzC,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,0EAA0E;IAC1E,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAC3B,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAChE,2EAA2E;IAC3E,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,4EAA4E;IAC5E,SAAS,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAChF,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAC;IAC5D,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,wEAAwE;IACxE,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,cAAc,CAsGvE;AAiBD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK7C"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { StorageAdapter } from "../types/storage";
|
|
2
|
+
export interface MemoryStorageOptions {
|
|
3
|
+
baseUrl?: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* In-process storage.
|
|
7
|
+
*
|
|
8
|
+
* Exported rather than kept in the test folder on purpose: the storage
|
|
9
|
+
* contract suite has to run against something, and an example that boots
|
|
10
|
+
* without a bucket is worth more than a mock nobody else can use.
|
|
11
|
+
*/
|
|
12
|
+
export declare function memory(options?: MemoryStorageOptions): StorageAdapter;
|
|
13
|
+
export interface LocalStorageOptions {
|
|
14
|
+
/** Directory on disk. Created on first write. */
|
|
15
|
+
directory: string;
|
|
16
|
+
/** Public prefix the files are served from. */
|
|
17
|
+
baseUrl?: string;
|
|
18
|
+
prefix?: (file: {
|
|
19
|
+
id: string;
|
|
20
|
+
filename: string;
|
|
21
|
+
}) => string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Local disk.
|
|
25
|
+
*
|
|
26
|
+
* `node:fs` is imported inside the methods, not at the top of the module: a
|
|
27
|
+
* Worker bundle that merely configures storage must not drag a filesystem
|
|
28
|
+
* into a runtime that has none.
|
|
29
|
+
*/
|
|
30
|
+
export declare function local(options: LocalStorageOptions): StorageAdapter;
|
|
31
|
+
//# sourceMappingURL=local.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../src/storage/local.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,cAAc,EAEf,MAAM,kBAAkB,CAAC;AAiB1B,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,OAAO,GAAE,oBAAyB,GAAG,cAAc,CAmCzE;AAED,MAAM,WAAW,mBAAmB;IAClC,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAC;CAC7D;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,mBAAmB,GAAG,cAAc,CA6DlE"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { StorageAdapterFactory } from "../types/storage";
|
|
2
|
+
import { type FetchLike } from "./http";
|
|
3
|
+
export interface S3StorageOptions {
|
|
4
|
+
bucket: string;
|
|
5
|
+
region?: string;
|
|
6
|
+
/** Set for an S3-compatible service: MinIO, Tigris, Wasabi, Ceph. */
|
|
7
|
+
endpoint?: string;
|
|
8
|
+
accessKeyId?: string;
|
|
9
|
+
secretAccessKey?: string;
|
|
10
|
+
sessionToken?: string;
|
|
11
|
+
acl?: "private" | "public-read";
|
|
12
|
+
signedUrls?: {
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
expiresIn?: string;
|
|
15
|
+
};
|
|
16
|
+
/** Serve from a CDN while writing straight to the bucket. */
|
|
17
|
+
publicUrl?: string;
|
|
18
|
+
/** Where new objects go, given the file. Defaults to `{year}/{id}`. */
|
|
19
|
+
prefix?: (file: {
|
|
20
|
+
id: string;
|
|
21
|
+
filename: string;
|
|
22
|
+
}) => string;
|
|
23
|
+
/** Path-style addressing. Forced on when an `endpoint` is given. */
|
|
24
|
+
forcePathStyle?: boolean;
|
|
25
|
+
fetch?: FetchLike;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* S3 and everything that speaks its API.
|
|
29
|
+
*
|
|
30
|
+
* Credentials are read from the environment when they are not given, which is
|
|
31
|
+
* what makes an IAM role or a `~/.aws` profile work without naming a secret in
|
|
32
|
+
* a file that is checked in.
|
|
33
|
+
*/
|
|
34
|
+
export declare function s3(options: S3StorageOptions): StorageAdapterFactory;
|
|
35
|
+
export interface R2StorageOptions extends Omit<S3StorageOptions, "region" | "endpoint"> {
|
|
36
|
+
/** From the Cloudflare dashboard. Not needed when a binding is passed. */
|
|
37
|
+
accountId?: string;
|
|
38
|
+
}
|
|
39
|
+
/** A Workers R2 binding, structurally. Typing it avoids depending on the types. */
|
|
40
|
+
export interface R2Binding {
|
|
41
|
+
put(key: string, value: unknown, options?: unknown): Promise<unknown>;
|
|
42
|
+
get(key: string): Promise<R2ObjectBody | null>;
|
|
43
|
+
delete(keys: string | string[]): Promise<void>;
|
|
44
|
+
head(key: string): Promise<R2ObjectLike | null>;
|
|
45
|
+
}
|
|
46
|
+
interface R2ObjectLike {
|
|
47
|
+
size: number;
|
|
48
|
+
uploaded?: Date;
|
|
49
|
+
httpMetadata?: {
|
|
50
|
+
contentType?: string;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
interface R2ObjectBody extends R2ObjectLike {
|
|
54
|
+
body: ReadableStream;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Cloudflare R2, either way round.
|
|
58
|
+
*
|
|
59
|
+
* Given a binding it uses the binding, which costs nothing and leaves the
|
|
60
|
+
* Worker's own network. Given credentials it speaks S3 over HTTPS, which is
|
|
61
|
+
* what a Node process or a build script has to do.
|
|
62
|
+
*/
|
|
63
|
+
export declare function r2(binding: R2Binding | (R2StorageOptions & {
|
|
64
|
+
bucket: string;
|
|
65
|
+
})): StorageAdapterFactory;
|
|
66
|
+
export interface GcsStorageOptions extends Omit<S3StorageOptions, "endpoint" | "forcePathStyle"> {
|
|
67
|
+
/** An HMAC key from Cloud Storage interoperability settings. */
|
|
68
|
+
accessKeyId?: string;
|
|
69
|
+
secretAccessKey?: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Google Cloud Storage, through its S3-compatible XML endpoint.
|
|
73
|
+
*
|
|
74
|
+
* Interoperability mode rather than the JSON API because it needs an HMAC key
|
|
75
|
+
* pair and nothing else: the JSON API wants a service-account JWT, which means
|
|
76
|
+
* RSA signing, key rotation and a JSON file on disk, for the same four verbs.
|
|
77
|
+
*/
|
|
78
|
+
export declare function gcs(options: GcsStorageOptions): StorageAdapterFactory;
|
|
79
|
+
export interface AzureStorageOptions {
|
|
80
|
+
/** The storage account name, not its URL. */
|
|
81
|
+
account: string;
|
|
82
|
+
container: string;
|
|
83
|
+
/** The account key. Falls back to `AZURE_STORAGE_KEY`. */
|
|
84
|
+
accountKey?: string;
|
|
85
|
+
publicUrl?: string;
|
|
86
|
+
prefix?: (file: {
|
|
87
|
+
id: string;
|
|
88
|
+
filename: string;
|
|
89
|
+
}) => string;
|
|
90
|
+
fetch?: FetchLike;
|
|
91
|
+
}
|
|
92
|
+
/** Azure Blob Storage, signed with a shared key. */
|
|
93
|
+
export declare function azure(options: AzureStorageOptions): StorageAdapterFactory;
|
|
94
|
+
export {};
|
|
95
|
+
//# sourceMappingURL=providers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/storage/providers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,qBAAqB,EAEtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAA0B,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAchE,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;IAChC,UAAU,CAAC,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtD,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uEAAuE;IACvE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAC;IAC5D,oEAAoE;IACpE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED;;;;;;GAMG;AACH,wBAAgB,EAAE,CAAC,OAAO,EAAE,gBAAgB,GAAG,qBAAqB,CAenE;AAED,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAC5C,gBAAgB,EAChB,QAAQ,GAAG,UAAU,CACtB;IACC,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,mFAAmF;AACnF,MAAM,WAAW,SAAS;IACxB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACtE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAC/C,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;CACjD;AAED,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,IAAI,CAAC;IAChB,YAAY,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACzC;AAED,UAAU,YAAa,SAAQ,YAAY;IACzC,IAAI,EAAE,cAAc,CAAC;CACtB;AAED;;;;;;GAMG;AACH,wBAAgB,EAAE,CAChB,OAAO,EAAE,SAAS,GAAG,CAAC,gBAAgB,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,GAC3D,qBAAqB,CAuBvB;AAED,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAC7C,gBAAgB,EAChB,UAAU,GAAG,gBAAgB,CAC9B;IACC,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,wBAAgB,GAAG,CAAC,OAAO,EAAE,iBAAiB,GAAG,qBAAqB,CAerE;AAED,MAAM,WAAW,mBAAmB;IAClC,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAC;IAC5D,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,oDAAoD;AACpD,wBAAgB,KAAK,CAAC,OAAO,EAAE,mBAAmB,GAAG,qBAAqB,CAsCzE"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request signing for the object stores we speak to over HTTP.
|
|
3
|
+
*
|
|
4
|
+
* Written out rather than taken from an SDK on purpose. `@aws-sdk/client-s3`
|
|
5
|
+
* is roughly twenty megabytes of dependency for four HTTP verbs, which is the
|
|
6
|
+
* entire installation budget this project set itself (section 0), and it does
|
|
7
|
+
* not run unchanged on every runtime we target. Signing is about ninety lines
|
|
8
|
+
* when the only operations are PUT, GET, DELETE and HEAD.
|
|
9
|
+
*/
|
|
10
|
+
export interface AwsCredentials {
|
|
11
|
+
accessKeyId: string;
|
|
12
|
+
secretAccessKey: string;
|
|
13
|
+
/** Set when the credentials come from an assumed role. */
|
|
14
|
+
sessionToken?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface AwsSignRequest {
|
|
17
|
+
method: string;
|
|
18
|
+
url: URL;
|
|
19
|
+
headers: Record<string, string>;
|
|
20
|
+
/** `UNSIGNED-PAYLOAD` is legal over TLS and avoids buffering a stream. */
|
|
21
|
+
payload: Uint8Array | "UNSIGNED-PAYLOAD";
|
|
22
|
+
region: string;
|
|
23
|
+
service: string;
|
|
24
|
+
credentials: AwsCredentials;
|
|
25
|
+
now?: Date;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* AWS Signature Version 4.
|
|
29
|
+
*
|
|
30
|
+
* Used for S3, for R2 (which speaks the S3 API) and for Google Cloud Storage
|
|
31
|
+
* through its S3-compatible XML endpoint, so one implementation covers three
|
|
32
|
+
* of the five adapters.
|
|
33
|
+
*/
|
|
34
|
+
export declare function signAwsV4(request: AwsSignRequest): Promise<Record<string, string>>;
|
|
35
|
+
export interface AzureSignRequest {
|
|
36
|
+
method: string;
|
|
37
|
+
url: URL;
|
|
38
|
+
headers: Record<string, string>;
|
|
39
|
+
account: string;
|
|
40
|
+
/** The base64 account key from the portal. */
|
|
41
|
+
key: string;
|
|
42
|
+
contentLength?: number;
|
|
43
|
+
now?: Date;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Azure Blob Storage shared key.
|
|
47
|
+
*
|
|
48
|
+
* A different scheme from SigV4 and not reducible to it: the string to sign is
|
|
49
|
+
* a fixed list of positional headers, most of which we never send and all of
|
|
50
|
+
* which still have to be there as empty lines.
|
|
51
|
+
*/
|
|
52
|
+
export declare function signAzure(request: AzureSignRequest): Promise<Record<string, string>>;
|
|
53
|
+
//# sourceMappingURL=sign.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../../src/storage/sign.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,0DAA0D;IAC1D,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,GAAG,CAAC;IACT,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,0EAA0E;IAC1E,OAAO,EAAE,UAAU,GAAG,kBAAkB,CAAC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,cAAc,CAAC;IAC5B,GAAG,CAAC,EAAE,IAAI,CAAC;CACZ;AAID;;;;;;GAMG;AACH,wBAAsB,SAAS,CAC7B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CA8DjC;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,GAAG,CAAC;IACT,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,GAAG,CAAC,EAAE,IAAI,CAAC;CACZ;AAED;;;;;;GAMG;AACH,wBAAsB,SAAS,CAC7B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAsDjC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* String helpers shared across modules.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Remove trailing slashes without a regex.
|
|
6
|
+
*
|
|
7
|
+
* The obvious `replace(/\/+$/, "")` backtracks quadratically on a string
|
|
8
|
+
* built out of slashes (CodeQL `js/polynomial-redos`). The values trimmed
|
|
9
|
+
* here are configuration most of the time, but a loop from the end is linear
|
|
10
|
+
* no matter what arrives, so every caller uses it.
|
|
11
|
+
*/
|
|
12
|
+
export declare function trimTrailingSlashes(value: string): string;
|
|
13
|
+
//# sourceMappingURL=strings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../src/strings.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIzD"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import type { CmsInstance } from "./types/instance";
|
|
2
|
+
import type { TelemetryConfig } from "./types/telemetry";
|
|
3
|
+
export type { TelemetryConfig };
|
|
4
|
+
/**
|
|
5
|
+
* Adoption telemetry — what it is, and what it refuses to be.
|
|
6
|
+
*
|
|
7
|
+
* The CMS has no analytics on the deployments it runs in: a server built from
|
|
8
|
+
* this package never phones home, in any environment, for any reason. What
|
|
9
|
+
* does report is the **command line**: `heyo-cms generate`, `migrate`,
|
|
10
|
+
* `seed`, `create-admin`, `import`, `export`, and the project generator. Those
|
|
11
|
+
* run on a developer's machine, once in a while, and answer the only question
|
|
12
|
+
* the project actually needs answered — is anybody using this, and with which
|
|
13
|
+
* database and framework.
|
|
14
|
+
*
|
|
15
|
+
* What is sent is in `TelemetryPayload` below and nowhere else. It is a fixed
|
|
16
|
+
* set of counts and identifiers: no content, no field names, no connection
|
|
17
|
+
* strings, no file paths, no addresses, no keys. `heyo-cms telemetry` prints
|
|
18
|
+
* the exact body that would be sent, so the claim is checkable rather than
|
|
19
|
+
* promised.
|
|
20
|
+
*
|
|
21
|
+
* Opting out, any one of which is enough:
|
|
22
|
+
*
|
|
23
|
+
* HEYO_TELEMETRY_DISABLED=1 the project's own switch
|
|
24
|
+
* DO_NOT_TRACK=1 the cross-tool convention, honoured
|
|
25
|
+
* telemetry: { enabled: false } in heyo-cms.config.ts
|
|
26
|
+
*
|
|
27
|
+
* It is also off, without being asked, on CI and under a test runner: a build
|
|
28
|
+
* agent is not a user, and counting one as a user would make the number this
|
|
29
|
+
* exists to produce worthless.
|
|
30
|
+
*/
|
|
31
|
+
export declare const telemetryEndpoint = "https://telemetry.heyo.sh/v1/cms";
|
|
32
|
+
export interface TelemetryDecision {
|
|
33
|
+
enabled: boolean;
|
|
34
|
+
/** Why, in words, so `heyo-cms telemetry` can print it. */
|
|
35
|
+
reason: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The whole payload. Adding a field here is a documentation change too.
|
|
39
|
+
*/
|
|
40
|
+
export interface TelemetryPayload {
|
|
41
|
+
/** The command that ran: `generate`, `migrate`, `create`, ... */
|
|
42
|
+
event: string;
|
|
43
|
+
/** The version of `@heyo-sh/heyo-cms` that sent it. */
|
|
44
|
+
version: string;
|
|
45
|
+
/**
|
|
46
|
+
* A project identifier that is not a project.
|
|
47
|
+
*
|
|
48
|
+
* The SHA-256 of the configuration's shape — collection names, the database
|
|
49
|
+
* id, the base path — truncated to 16 hex characters. Two runs from the
|
|
50
|
+
* same shape agree. This is not a unique installation id: projects with
|
|
51
|
+
* the same shape collide, and low-entropy inputs can be guessed. It must
|
|
52
|
+
* not be treated as a count of distinct users or as encryption.
|
|
53
|
+
*/
|
|
54
|
+
project: string;
|
|
55
|
+
runtime: {
|
|
56
|
+
name: string;
|
|
57
|
+
version: string;
|
|
58
|
+
};
|
|
59
|
+
system: {
|
|
60
|
+
platform: string;
|
|
61
|
+
arch: string;
|
|
62
|
+
release: string;
|
|
63
|
+
};
|
|
64
|
+
/** The adapter id: `postgres`, `sqlite`, `d1`, `mongodb`. */
|
|
65
|
+
database: string;
|
|
66
|
+
/** Counts, never names. */
|
|
67
|
+
usage: {
|
|
68
|
+
collections: number;
|
|
69
|
+
globals: number;
|
|
70
|
+
fields: number;
|
|
71
|
+
plugins: number;
|
|
72
|
+
locales: number;
|
|
73
|
+
};
|
|
74
|
+
/** Which optional sections exist. Booleans, never their configuration. */
|
|
75
|
+
features: {
|
|
76
|
+
/** The panel bundle is mounted. */
|
|
77
|
+
panel: boolean;
|
|
78
|
+
/** Editor authentication is configured. */
|
|
79
|
+
auth: boolean;
|
|
80
|
+
/** The storage adapter id, or `null` when the CMS stores no files. */
|
|
81
|
+
uploads: string | null;
|
|
82
|
+
ai: boolean;
|
|
83
|
+
webhooks: boolean;
|
|
84
|
+
trash: boolean;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export interface TelemetryEnvironment {
|
|
88
|
+
[key: string]: string | undefined;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Decides whether anything may be sent, and says why.
|
|
92
|
+
*
|
|
93
|
+
* Every branch returns a sentence rather than a boolean alone, because the
|
|
94
|
+
* question a person asks is never "is it on" — it is "why is it on".
|
|
95
|
+
*/
|
|
96
|
+
export declare function telemetryDecision(config: TelemetryConfig | undefined, environment?: TelemetryEnvironment): TelemetryDecision;
|
|
97
|
+
/**
|
|
98
|
+
* Builds the body from the configuration.
|
|
99
|
+
*
|
|
100
|
+
* Deliberately total: it never reads a file, never resolves a database and
|
|
101
|
+
* never touches the network, so printing it costs nothing and cannot fail in
|
|
102
|
+
* a way that breaks the command it was attached to.
|
|
103
|
+
*/
|
|
104
|
+
export declare function telemetryPayload(event: string, cms: CmsInstance, version: string): TelemetryPayload;
|
|
105
|
+
export interface SendOptions {
|
|
106
|
+
endpoint?: string;
|
|
107
|
+
/** Injected by the tests; nothing else should pass it. */
|
|
108
|
+
fetch?: typeof fetch;
|
|
109
|
+
/** Milliseconds before the attempt is abandoned. */
|
|
110
|
+
timeout?: number;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Sends one payload, and never matters.
|
|
114
|
+
*
|
|
115
|
+
* Failure is not reported and not retried: a CLI that took longer, printed a
|
|
116
|
+
* warning or exited non-zero because a telemetry endpoint was down would be a
|
|
117
|
+
* worse tool than one with no telemetry at all.
|
|
118
|
+
*/
|
|
119
|
+
export declare function sendTelemetry(payload: TelemetryPayload, options?: SendOptions): Promise<"sent" | "failed">;
|
|
120
|
+
/**
|
|
121
|
+
* The one call a command makes: decide, build, send, forget.
|
|
122
|
+
*
|
|
123
|
+
* Returns what happened so `heyo-cms telemetry` can print it; every caller
|
|
124
|
+
* except that command ignores the result.
|
|
125
|
+
*/
|
|
126
|
+
export declare function reportTelemetry(args: {
|
|
127
|
+
event: string;
|
|
128
|
+
cms: CmsInstance;
|
|
129
|
+
version: string;
|
|
130
|
+
config?: TelemetryConfig;
|
|
131
|
+
environment?: TelemetryEnvironment;
|
|
132
|
+
send?: SendOptions;
|
|
133
|
+
}): Promise<{
|
|
134
|
+
decision: TelemetryDecision;
|
|
135
|
+
result: "sent" | "failed" | "skipped";
|
|
136
|
+
}>;
|
|
137
|
+
//# sourceMappingURL=telemetry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../src/telemetry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,YAAY,EAAE,eAAe,EAAE,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,eAAO,MAAM,iBAAiB,qCAAqC,CAAC;AAEpE,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;;;OAQG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5D,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,2BAA2B;IAC3B,KAAK,EAAE;QACL,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,0EAA0E;IAC1E,QAAQ,EAAE;QACR,mCAAmC;QACnC,KAAK,EAAE,OAAO,CAAC;QACf,2CAA2C;QAC3C,IAAI,EAAE,OAAO,CAAC;QACd,sEAAsE;QACtE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,EAAE,EAAE,OAAO,CAAC;QACZ,QAAQ,EAAE,OAAO,CAAC;QAClB,KAAK,EAAE,OAAO,CAAC;KAChB,CAAC;CACH;AAED,MAAM,WAAW,oBAAoB;IACnC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACnC;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,eAAe,GAAG,SAAS,EACnC,WAAW,GAAE,oBAAkC,GAC9C,iBAAiB,CAiBnB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,WAAW,EAChB,OAAO,EAAE,MAAM,GACd,gBAAgB,CAuClB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,gBAAgB,EACzB,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC,CAa5B;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,WAAW,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB,GAAG,OAAO,CAAC;IACV,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;CACvC,CAAC,CASD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{wo,Ut,Jt,vo,yn}from"./index-szaq03qq.js";export{yn as reportTelemetry,vo as sendTelemetry,Ut as telemetryDecision,wo as telemetryEndpoint,Jt as telemetryPayload};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { ActorSource, OperationSource } from "./actor";
|
|
2
|
+
import type { JsonObject } from "./json";
|
|
3
|
+
/**
|
|
4
|
+
* One line of the audit trail.
|
|
5
|
+
*
|
|
6
|
+
* Written by the engine inside the transaction that caused it, which is the
|
|
7
|
+
* difference between an audit trail and a log: a change that committed is in
|
|
8
|
+
* here, and a change that rolled back is not (section 11).
|
|
9
|
+
*/
|
|
10
|
+
export interface ActivityEntry {
|
|
11
|
+
id: string;
|
|
12
|
+
/** `document.created`, `document.trashed`, … — the event vocabulary. */
|
|
13
|
+
action: string;
|
|
14
|
+
actorId: string | null;
|
|
15
|
+
actorSource: ActorSource | null;
|
|
16
|
+
/**
|
|
17
|
+
* Where the write came from: `admin`, `rest`, `job`, `ai`, …
|
|
18
|
+
*
|
|
19
|
+
* Distinct from `actorSource`, which says how the actor authenticated. An AI
|
|
20
|
+
* write has a human actor with a session and `source: "ai"`, and a trail
|
|
21
|
+
* that could only report one of those could not answer "what did the
|
|
22
|
+
* assistant change today".
|
|
23
|
+
*/
|
|
24
|
+
source: OperationSource | null;
|
|
25
|
+
collection: string | null;
|
|
26
|
+
documentId: string | null;
|
|
27
|
+
locale: string | null;
|
|
28
|
+
/**
|
|
29
|
+
* `{ fields: [...] }` for a write: what actually changed.
|
|
30
|
+
*
|
|
31
|
+
* Carries `runId` as well when the assistant made the change, which is what
|
|
32
|
+
* ties a row back to the conversation that caused it.
|
|
33
|
+
*/
|
|
34
|
+
changes: JsonObject | null;
|
|
35
|
+
ip: string | null;
|
|
36
|
+
createdAt: string | null;
|
|
37
|
+
}
|
|
38
|
+
export interface ActivityListArgs {
|
|
39
|
+
collection?: string;
|
|
40
|
+
documentId?: string;
|
|
41
|
+
actorId?: string;
|
|
42
|
+
action?: string;
|
|
43
|
+
/** `"ai"` answers "what did the assistant change" without a scan. */
|
|
44
|
+
source?: OperationSource;
|
|
45
|
+
limit?: number;
|
|
46
|
+
/** Keyset, over the ordered id. Pass back `cursor` from the last page. */
|
|
47
|
+
cursor?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface ActivityPage {
|
|
50
|
+
entries: ActivityEntry[];
|
|
51
|
+
limit: number;
|
|
52
|
+
hasNextPage: boolean;
|
|
53
|
+
cursor: string | null;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* `cms.activity`.
|
|
57
|
+
*
|
|
58
|
+
* Read-only on purpose: there is no `write` and no `delete`. The engine is the
|
|
59
|
+
* only writer, and an audit trail with a delete method is a list of the
|
|
60
|
+
* changes somebody was willing to leave behind.
|
|
61
|
+
*
|
|
62
|
+
* Paged by the row id rather than by `created_at`, because the ids are ordered
|
|
63
|
+
* and two writes to the same document routinely land in the same millisecond.
|
|
64
|
+
*/
|
|
65
|
+
export interface CmsActivity {
|
|
66
|
+
list(args?: ActivityListArgs): Promise<ActivityPage>;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=activity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../../src/types/activity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC;;;;;;;OAOG;IACH,MAAM,EAAE,eAAe,GAAG,IAAI,CAAC;IAC/B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB;;;;;OAKG;IACH,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;IAC3B,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CACtD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Who is performing an operation.
|
|
3
|
+
*
|
|
4
|
+
* Both authentication methods (editor session, machine API key) collapse into
|
|
5
|
+
* the same shape on purpose: every access rule, hook and activity-log entry
|
|
6
|
+
* then has one thing to read, and a rule written against sessions cannot
|
|
7
|
+
* silently stop applying to API keys.
|
|
8
|
+
*/
|
|
9
|
+
export interface Actor {
|
|
10
|
+
id: string;
|
|
11
|
+
source: ActorSource;
|
|
12
|
+
roles: string[];
|
|
13
|
+
/** Flattened `collection:action` grants, wildcards already expanded. */
|
|
14
|
+
permissions: string[];
|
|
15
|
+
}
|
|
16
|
+
export type ActorSource = "session" | "api-key";
|
|
17
|
+
/**
|
|
18
|
+
* Where an operation entered the engine. Carried through to hooks and events.
|
|
19
|
+
*
|
|
20
|
+
* `ai` is the global assistant writing on an editor's behalf. It is a source
|
|
21
|
+
* and not an actor: the person who asked for the change is still the actor,
|
|
22
|
+
* because "who is accountable" and "what typed it" are different questions and
|
|
23
|
+
* an audit trail that confuses them cannot answer either.
|
|
24
|
+
*/
|
|
25
|
+
export type OperationSource = "rest" | "admin" | "local" | "cli" | "job" | "ai";
|
|
26
|
+
//# sourceMappingURL=actor.d.ts.map
|