@heyo-sh/heyo-cms 0.1.0 → 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/dist/adapters/astro.d.ts +12 -5
- package/dist/adapters/astro.d.ts.map +1 -1
- package/dist/adapters/astro.js +1 -1
- package/dist/adapters/deliver.d.ts +26 -0
- package/dist/adapters/deliver.d.ts.map +1 -0
- package/dist/adapters/next.d.ts +26 -12
- package/dist/adapters/next.d.ts.map +1 -1
- package/dist/adapters/next.js +1 -1
- package/dist/adapters/nuxt.d.ts +10 -6
- package/dist/adapters/nuxt.d.ts.map +1 -1
- package/dist/adapters/nuxt.js +1 -1
- package/dist/adapters/react-router.d.ts +12 -5
- package/dist/adapters/react-router.d.ts.map +1 -1
- package/dist/adapters/react-router.js +1 -1
- package/dist/adapters/sveltekit.d.ts +9 -5
- package/dist/adapters/sveltekit.d.ts.map +1 -1
- package/dist/adapters/sveltekit.js +1 -1
- package/dist/ai.js +1 -1
- package/dist/auth.js +1 -1
- package/dist/cli.js +2 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/types.d.ts +24 -1
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client.js +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/content.js +1 -1
- package/dist/db/d1.js +1 -1
- package/dist/db/mongodb.js +2 -2
- package/dist/db/postgres.js +1 -1
- package/dist/db/sql/dialect.d.ts +2 -0
- package/dist/db/sql/dialect.d.ts.map +1 -1
- package/dist/db/sqlite.d.ts +13 -2
- package/dist/db/sqlite.d.ts.map +1 -1
- package/dist/db/sqlite.js +1 -1
- package/dist/editor/builtin.d.ts.map +1 -1
- package/dist/editor/serialize.d.ts.map +1 -1
- package/dist/editor.d.ts +1 -1
- package/dist/editor.d.ts.map +1 -1
- package/dist/editor.js +1 -1
- package/dist/engine/engine.d.ts +19 -0
- package/dist/engine/engine.d.ts.map +1 -1
- package/dist/engine/slugs.d.ts +124 -0
- package/dist/engine/slugs.d.ts.map +1 -0
- package/dist/fields/builtin.d.ts +42 -15
- package/dist/fields/builtin.d.ts.map +1 -1
- package/dist/fields.d.ts +1 -0
- package/dist/fields.d.ts.map +1 -1
- package/dist/fields.js +1 -1
- package/dist/http/handler.d.ts.map +1 -1
- package/dist/http/rich-text.d.ts +12 -1
- package/dist/http/rich-text.d.ts.map +1 -1
- package/dist/http/routes/documents.d.ts.map +1 -1
- package/dist/http/routes/media.d.ts +30 -0
- package/dist/http/routes/media.d.ts.map +1 -1
- package/dist/http.js +1 -1
- package/dist/index-2ddk43me.js +2 -0
- package/dist/index-2prbs05k.js +2 -0
- package/dist/index-385ggnge.js +2 -0
- package/dist/{index-7k091gpe.js → index-466cwb0b.js} +2 -2
- package/dist/{index-b2ecggck.js → index-4qrep5f0.js} +6 -6
- package/dist/{index-k8wbg1dw.js → index-67e458ws.js} +2 -2
- package/dist/index-6m1kjq9g.js +2 -0
- package/dist/index-6w10rch0.js +3 -0
- package/dist/index-761dec5z.js +2 -0
- package/dist/{index-2kb5nbxx.js → index-8nzmqy0f.js} +2 -2
- package/dist/{index-vq2978e7.js → index-8x2em6c8.js} +8 -8
- package/dist/index-91fa1gzf.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-g041kfa5.js +18 -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-cbwwtcm4.js → index-rw0hze6x.js} +2 -2
- package/dist/index-s9x07zb3.js +2 -0
- package/dist/index-sgdnp83t.js +2 -0
- package/dist/{index-34s342fz.js → index-szaq03qq.js} +2 -2
- package/dist/{index-9x1z3b85.js → index-vkwzdfte.js} +4 -4
- package/dist/{index-gpwcmmvr.js → index-vzhxn50e.js} +2 -2
- package/dist/index-y8kzzn94.js +2 -0
- package/dist/{index-7a231xfp.js → index-ypcmns0v.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/jobs.js +1 -1
- package/dist/media/cloudflare.d.ts +58 -0
- package/dist/media/cloudflare.d.ts.map +1 -0
- package/dist/media/document.d.ts +7 -6
- package/dist/media/document.d.ts.map +1 -1
- package/dist/media/gc.d.ts.map +1 -1
- package/dist/media/pipeline.d.ts +19 -0
- package/dist/media/pipeline.d.ts.map +1 -1
- package/dist/media/service.d.ts.map +1 -1
- package/dist/media/urls.d.ts +77 -0
- package/dist/media/urls.d.ts.map +1 -0
- package/dist/media/usages.d.ts +9 -1
- package/dist/media/usages.d.ts.map +1 -1
- package/dist/media/variants.d.ts +11 -0
- package/dist/media/variants.d.ts.map +1 -1
- package/dist/migrations.js +1 -1
- 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.js +1 -1
- package/dist/{run-3r72dwhs.js → run-bjge3v8e.js} +4 -4
- package/dist/schema/snapshot.d.ts +2 -0
- package/dist/schema/snapshot.d.ts.map +1 -1
- package/dist/schema/system.d.ts +9 -0
- package/dist/schema/system.d.ts.map +1 -1
- package/dist/schema.js +1 -1
- package/dist/slugify.d.ts +31 -0
- package/dist/slugify.d.ts.map +1 -0
- package/dist/telemetry.js +1 -1
- package/dist/types/api.d.ts +56 -0
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/config.d.ts +15 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/editor.d.ts +26 -0
- package/dist/types/editor.d.ts.map +1 -1
- package/dist/types/media.d.ts +97 -0
- package/dist/types/media.d.ts.map +1 -1
- package/dist/types/plugin.d.ts +23 -1
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/uploads.d.ts +1 -0
- package/dist/uploads.d.ts.map +1 -1
- package/dist/uploads.js +4 -4
- package/dist/webhooks.js +1 -1
- package/package.json +9 -5
- package/dist/index-2757kej5.js +0 -2
- package/dist/index-2z1qe5mw.js +0 -2
- package/dist/index-5ngtc7gy.js +0 -2
- package/dist/index-9zqnf6gx.js +0 -23
- package/dist/index-hq05mc1n.js +0 -3
- package/dist/index-hy1x46nf.js +0 -2
- package/dist/index-kbsgt44t.js +0 -2
- package/dist/index-m82a0shw.js +0 -2
- package/dist/index-md79xr6h.js +0 -5
- package/dist/index-nvgwyykk.js +0 -40
- package/dist/index-ty698y02.js +0 -2
- package/dist/index-vxw0a03g.js +0 -2
- package/dist/index-wj8y1xcj.js +0 -2
- package/dist/index-y5mwknr9.js +0 -2
- package/dist/index-ymq6jsar.js +0 -2
package/dist/db/sql/dialect.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export interface SqlDialect {
|
|
|
22
22
|
decode(value: unknown, type: ColumnType): ColumnValue;
|
|
23
23
|
/** True when `ALTER TABLE ... ALTER COLUMN` exists. */
|
|
24
24
|
readonly supportsAlterColumn: boolean;
|
|
25
|
+
/** The statement that opens a transaction; `BEGIN` when absent. */
|
|
26
|
+
readonly beginTransaction?: string;
|
|
25
27
|
}
|
|
26
28
|
export declare const postgresDialect: SqlDialect;
|
|
27
29
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialect.d.ts","sourceRoot":"","sources":["../../../src/db/sql/dialect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErE;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,EAAE,UAAU,GAAG,QAAQ,CAAC;IACnC,uCAAuC;IACvC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACnC,KAAK,CAAC,UAAU,EAAE,MAAM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AM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CAAC;IACtE,gEAAgE;IAChE,mBAAmB,CACjB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EAAE,EACd,WAAW,EAAE,MAAM,GAClB,MAAM,CAAC;IACV,oEAAoE;IACpE,YAAY,CAAC,eAAe,EAAE,OAAO,GAAG,MAAM,CAAC;IAC/C,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC;IAClE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,GAAG,WAAW,CAAC;IACtD,uDAAuD;IACvD,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACtC,mEAAmE;IACnE,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACpC;AAiCD,eAAO,MAAM,eAAe,EAAE,UAgD7B,CAAC;AAyBF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,EAAE,UAwD3B,CAAC"}
|
package/dist/db/sqlite.d.ts
CHANGED
|
@@ -19,6 +19,15 @@ export interface SqliteStatement {
|
|
|
19
19
|
}
|
|
20
20
|
export interface SqliteOptions {
|
|
21
21
|
id?: string;
|
|
22
|
+
/**
|
|
23
|
+
* How long a write waits for another connection's lock, in milliseconds,
|
|
24
|
+
* before it fails with "database is locked". Defaults to 5000, the value
|
|
25
|
+
* `better-sqlite3` uses; `bun:sqlite` and `node:sqlite` start at 0, which
|
|
26
|
+
* fails the moment a second process — the CLI next to a dev server — is
|
|
27
|
+
* writing. A timeout the database was already given is kept unless this
|
|
28
|
+
* is set.
|
|
29
|
+
*/
|
|
30
|
+
busyTimeout?: number;
|
|
22
31
|
}
|
|
23
32
|
export interface SqliteFileOptions extends SqliteOptions {
|
|
24
33
|
/** Path on disk. `:memory:` is accepted and is what the tests use. */
|
|
@@ -27,8 +36,10 @@ export interface SqliteFileOptions extends SqliteOptions {
|
|
|
27
36
|
/**
|
|
28
37
|
* Creates the SQLite adapter.
|
|
29
38
|
*
|
|
30
|
-
* Transactions use the generic `BEGIN`/`COMMIT` path in the adapter
|
|
31
|
-
*
|
|
39
|
+
* Transactions use the generic `BEGIN`/`COMMIT` path in the adapter, opened
|
|
40
|
+
* as `BEGIN IMMEDIATE` (see `sqliteDialect`): SQLite has exactly one writer,
|
|
41
|
+
* so there is no pool to pin a transaction to, and the write lock is better
|
|
42
|
+
* taken up front, where the busy timeout below can wait for it.
|
|
32
43
|
*
|
|
33
44
|
* Passing `{ file }` opens the database on first use through whichever SQLite
|
|
34
45
|
* the runtime provides — `bun:sqlite` or `node:sqlite` — so a configuration
|
package/dist/db/sqlite.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/db/sqlite.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAK3B;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAAC;IACtC,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,CAAC,IAAI,IAAI,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;IACrC,GAAG,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG;QAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CAC1D;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/db/sqlite.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAK3B;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAAC;IACtC,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,CAAC,IAAI,IAAI,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;IACrC,GAAG,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG;QAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CAC1D;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;CACd;AAoCD;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,sBAAsB,CAAC;AAC3E,wBAAgB,MAAM,CACpB,QAAQ,EAAE,cAAc,EACxB,OAAO,CAAC,EAAE,aAAa,GACtB,eAAe,CAAC"}
|
package/dist/db/sqlite.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ce,st}from"../index-4qrep5f0.js";import{n}from"../index-x72d1hzh.js";var r=5000;class s{database;id;constructor(e,t="sqlite"){this.database=e;this.id=t}async all(e,t){return this.database.prepare(e).all(...t)}async run(e,t){let a=this.database.prepare(e).run(...t);return{rowsAffected:Number(a.changes??0)}}async exec(e){this.database.exec(e)}async close(){this.database.close?.()}}function o(e,t={}){if("file"in e&&typeof e.file==="string")return async()=>o(await u(e.file),e);let a=e;return l(a,t.busyTimeout),new ce(new s(a,t.id??"sqlite"),st)}function l(e,t){if(t===void 0){let[a]=e.prepare("PRAGMA busy_timeout").all();if(Number(a?.timeout??0)>0)return}else if(!Number.isFinite(t)||t<0)throw new n("database","busyTimeout must be a number of milliseconds, 0 or more");e.exec(`PRAGMA busy_timeout = ${Math.trunc(t??r)}`)}async function u(e){for(let t of["bun:sqlite","node:sqlite"])try{let a=await import(t),i=a.Database??a.DatabaseSync;if(i)return new i(e)}catch{}throw new n("database","no SQLite is available in this runtime; pass a database instance instead")}export{o as sqlite};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin.d.ts","sourceRoot":"","sources":["../../src/editor/builtin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"builtin.d.ts","sourceRoot":"","sources":["../../src/editor/builtin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EAErB,MAAM,iBAAiB,CAAC;AASzB;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,OAAO,EAAE,oBAKpB,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,oBAQ1B,CAAC;AAEH,eAAO,MAAM,WAAW,EAAE,oBAWxB,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,oBAU3B,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,oBAO3B,CAAC;AAEH,eAAO,MAAM,eAAe,EAAE,oBAkB5B,CAAC;AAEH,eAAO,MAAM,YAAY,EAAE,oBAKzB,CAAC;AAEH,eAAO,MAAM,YAAY,EAAE,oBAMzB,CAAC;AAEH,eAAO,MAAM,YAAY,EAAE,oBAQzB,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,oBAyB1B,CAAC;AAEH,eAAO,MAAM,kBAAkB,EAAE,oBAO/B,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,oBAQ1B,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,EAAE,oBAqCtB,CAAC;AAEH,eAAO,MAAM,SAAS,EAAE,oBAsBtB,CAAC;AAEH,eAAO,MAAM,YAAY,EAAE,oBAMzB,CAAC;AAEH,eAAO,MAAM,eAAe,EAAE,oBAU5B,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,oBAU1B,CAAC;AAMH,eAAO,MAAM,QAAQ,EAAE,oBAIrB,CAAC;AAEH,eAAO,MAAM,UAAU,EAAE,oBAIvB,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,oBAM1B,CAAC;AAEH,eAAO,MAAM,UAAU,EAAE,oBAIvB,CAAC;AAEH,eAAO,MAAM,QAAQ,EAAE,oBAIrB,CAAC;AAEH,eAAO,MAAM,QAAQ,EAAE,oBAWrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/editor/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,
|
|
1
|
+
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/editor/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EAMrB,YAAY,EACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG/C;;;;;;;;;;;;GAYG;AAEH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,qBAAqB,GAC7B,MAAM,CAaR;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAM,GAClD,MAAM,CAER;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAM,GAClD,MAAM,CAER;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAM,GAClD,MAAM,CAER;AA2GD,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMhD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,6DAA6D;AAC7D,wBAAgB,cAAc,CAC5B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC,GAChD,MAAM,CAWR;AAED,2EAA2E;AAC3E,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAGxE;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAE5E;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,SAAS,CAGpB"}
|
package/dist/editor.d.ts
CHANGED
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
* HTML, Markdown or plain text without a browser.
|
|
7
7
|
*/
|
|
8
8
|
export * from "./editor/index";
|
|
9
|
-
export type { EditorMarkDefinition, EditorNodeDefinition, EditorSchemaDescription, MarkSerializer, MarkSerializerContext, NodeSerializer, NodeSerializerContext, RenderRichTextOptions, RichTextDocument, RichTextFormat, RichTextMark, RichTextNode, } from "./types/editor";
|
|
9
|
+
export type { EditorMarkDefinition, EditorNodeDefinition, EditorSchemaDescription, MarkSerializer, MarkSerializerContext, NodeSerializer, NodeSerializerContext, RenderRichTextOptions, RichTextDocument, RichTextFormat, RichTextImageOptions, RichTextMark, RichTextMediaImage, RichTextNode, } from "./types/editor";
|
|
10
10
|
//# sourceMappingURL=editor.d.ts.map
|
package/dist/editor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,gBAAgB,CAAC;AAC/B,YAAY,EACV,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,YAAY,GACb,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,gBAAgB,CAAC;AAC/B,YAAY,EACV,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,YAAY,EACZ,kBAAkB,EAClB,YAAY,GACb,MAAM,gBAAgB,CAAC"}
|
package/dist/editor.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{So,To,Co,Oo,Po,_o,$o,Io,jo,Eo,Mo,Do,qo,Lo,Fo,No,Uo,Jo,Wo,zo,Ho,Bo,Vo,he,En}from"./index-g041kfa5.js";import{k,Z,Ot,rn,ao,lo,Te,Q,co,X,uo,Fe,Go,Ne,Xe,ee}from"./index-hbx67b20.js";export{Oo as blockquoteNode,Jo as boldMark,Po as bulletListNode,Eo as codeBlockNode,Bo as codeMark,Z as defineEditorMark,k as defineEditorNode,Te as describeEditorSchema,So as docNode,Fe as escapeHtml,Go as escapeMarkdown,rn as getEditorMark,Ot as getEditorNode,Do as hardBreakNode,Co as headingNode,Mo as horizontalRuleNode,Ne as htmlAttributes,qo as imageNode,Xe as indentContinuation,Wo as italicMark,Vo as linkMark,$o as listItemNode,_o as orderedListNode,To as paragraphNode,lo as registeredEditorMarks,ao as registeredEditorNodes,Q as renderRichText,he as richTextFromMarkdown,En as richTextFromText,co as richTextToHtml,X as richTextToMarkdown,uo as richTextToPlainText,Ho as strikeMark,ee as stringAttr,Uo as tableCellNode,No as tableHeaderNode,Lo as tableNode,Fo as tableRowNode,jo as taskItemNode,Io as taskListNode,zo as underlineMark};
|
package/dist/engine/engine.d.ts
CHANGED
|
@@ -90,6 +90,19 @@ export declare class CmsEngine {
|
|
|
90
90
|
/** Delivers what the last committed transaction queued, in the background. */
|
|
91
91
|
deliverSoon(): void;
|
|
92
92
|
private collectionApi;
|
|
93
|
+
/**
|
|
94
|
+
* The slug field a slug operation is about: the one named, or the
|
|
95
|
+
* collection's first — with `history`, when the operation needs one.
|
|
96
|
+
*/
|
|
97
|
+
private slugField;
|
|
98
|
+
private resolveSlug;
|
|
99
|
+
private previousSlugs;
|
|
100
|
+
/**
|
|
101
|
+
* Adds or removes one previous address, under the rules of an update to
|
|
102
|
+
* the slug field: the actor must be allowed to update the document and to
|
|
103
|
+
* write that field.
|
|
104
|
+
*/
|
|
105
|
+
private changePreviousSlug;
|
|
93
106
|
private find;
|
|
94
107
|
private findOne;
|
|
95
108
|
private findById;
|
|
@@ -212,6 +225,12 @@ export declare class CmsEngine {
|
|
|
212
225
|
* once, and `media-gc` only ever acts on what it says.
|
|
213
226
|
*/
|
|
214
227
|
private syncMedia;
|
|
228
|
+
/**
|
|
229
|
+
* Keeps `slug_history` in step with the write, in its transaction: a
|
|
230
|
+
* rolled back rename must not leave its old address behind as a redirect.
|
|
231
|
+
*/
|
|
232
|
+
private syncSlugs;
|
|
233
|
+
private keepsSlugHistory;
|
|
215
234
|
private referencesMedia;
|
|
216
235
|
/**
|
|
217
236
|
* The activity log, written by the engine inside the transaction.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/engine/engine.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,aAAa,EAOb,SAAS,
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/engine/engine.ts"],"names":[],"mappings":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AAc;IA2BtB;;;;;;;OAOG;YACW,cAAc;IAiD5B,6EAA6E;YAC/D,YAAY;YAqBZ,aAAa;IAa3B;;;;;;OAMG;YACW,aAAa;IA2C3B;;;;;;;OAOG;YACW,QAAQ;IAyEtB;;;;;;;;OAQG;YACW,MAAM;YAiBN,iBAAiB;YAkBjB,QAAQ;IAsBtB;;;;;;OAMG;IACH,OAAO,CAAC,kBAAkB;IAmF1B;;;;;;OAMG;YACW,SAAS;IA2CvB;;;OAGG;YACW,SAAS;IAiBvB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,eAAe;IAQvB;;;;;;OAMG;YACW,aAAa;IAiC3B,yEAAyE;IACzE,OAAO,CAAC,KAAK;YAaC,IAAI;IAqClB;;;;;;;;;;;;OAYG;YACW,KAAK;YA6BL,aAAa;IAwB3B,OAAO,CAAC,iBAAiB;IAQzB,wEAAwE;IACxE,OAAO,CAAC,OAAO;YAMD,MAAM;IAwBpB;;;;;;OAMG;IACH,OAAO,CAAC,MAAM;IAYd,OAAO,CAAC,QAAQ;IAQhB,OAAO,CAAC,UAAU;YAWJ,YAAY;IAO1B;;;;;;;OAOG;IACH,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,QAAQ;CASjB;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAE9D"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { ResolvedCollection } from "../types/config";
|
|
2
|
+
import type { FieldDefinition } from "../types/fields";
|
|
3
|
+
import type { ScopedDb } from "../types/hooks";
|
|
4
|
+
import type { JsonObject } from "../types/json";
|
|
5
|
+
/**
|
|
6
|
+
* The `slug` field's behaviour: made from another field when empty, cleaned
|
|
7
|
+
* when typed, unique where it has to be, and remembered when it changes.
|
|
8
|
+
*
|
|
9
|
+
* Here rather than in a hook because every one of those has to happen on
|
|
10
|
+
* every write path — the panel, the REST API, an import, a scheduled change,
|
|
11
|
+
* a script — and a hook is something a project can forget to register.
|
|
12
|
+
*
|
|
13
|
+
* The history lives in its own table, `slug_history`, one row per previous
|
|
14
|
+
* address: a real column with a unique index answers "who owned this URL"
|
|
15
|
+
* in one lookup on every engine, where a list inside the document body would
|
|
16
|
+
* be a `LIKE` over every row of the collection.
|
|
17
|
+
*/
|
|
18
|
+
export declare const slugHistoryTable = "slug_history";
|
|
19
|
+
export interface SlugFieldOptions {
|
|
20
|
+
from?: string;
|
|
21
|
+
history?: boolean;
|
|
22
|
+
unique?: boolean;
|
|
23
|
+
maxLength?: number;
|
|
24
|
+
slugify?: (text: string) => string;
|
|
25
|
+
}
|
|
26
|
+
/** The field's own `slugify`, or the built-in one at its `maxLength`. */
|
|
27
|
+
export declare function slugCleaner(field: FieldDefinition): (text: string) => string;
|
|
28
|
+
export declare function slugFields(collection: ResolvedCollection): [string, FieldDefinition][];
|
|
29
|
+
export declare function slugOptions(field: FieldDefinition): SlugFieldOptions;
|
|
30
|
+
/** One slug that stopped being a document's address in a write. */
|
|
31
|
+
export interface SlugMove {
|
|
32
|
+
field: string;
|
|
33
|
+
/** Empty for a field that is not localized, like `media_usages`. */
|
|
34
|
+
locale: string;
|
|
35
|
+
from: string;
|
|
36
|
+
to: string;
|
|
37
|
+
}
|
|
38
|
+
export interface PrepareSlugsOptions {
|
|
39
|
+
db: ScopedDb;
|
|
40
|
+
collection: ResolvedCollection;
|
|
41
|
+
/** What the write asks for, after the `before` hooks. */
|
|
42
|
+
input: JsonObject;
|
|
43
|
+
/** The stored body before this write; null for a create. */
|
|
44
|
+
stored: JsonObject | null;
|
|
45
|
+
locale: string;
|
|
46
|
+
/** Null for a create whose id is not known to the caller yet. */
|
|
47
|
+
documentId: string | null;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Fills in, cleans and checks every slug field a write touches.
|
|
51
|
+
*
|
|
52
|
+
* Returns the input with the slugs settled and the moves the write implies,
|
|
53
|
+
* which `recordSlugMoves` writes once the document row exists.
|
|
54
|
+
*/
|
|
55
|
+
export declare function prepareSlugs(options: PrepareSlugsOptions): Promise<{
|
|
56
|
+
input: JsonObject;
|
|
57
|
+
moves: SlugMove[];
|
|
58
|
+
}>;
|
|
59
|
+
/**
|
|
60
|
+
* Writes what `prepareSlugs` decided, inside the same transaction.
|
|
61
|
+
*
|
|
62
|
+
* The old slug becomes a previous address of the document; a slug the
|
|
63
|
+
* document moves back to stops being one, so an address is never both.
|
|
64
|
+
*/
|
|
65
|
+
export declare function recordSlugMoves(db: ScopedDb, collection: ResolvedCollection, documentId: string, moves: SlugMove[], now: Date): Promise<void>;
|
|
66
|
+
export declare function removePreviousSlugRow(db: ScopedDb, collection: ResolvedCollection, documentId: string, field: string, locale: string, slug: string): Promise<void>;
|
|
67
|
+
/** Every previous address of one document goes when the document does. */
|
|
68
|
+
export declare function releaseSlugs(db: ScopedDb, collection: ResolvedCollection, documentId: string): Promise<void>;
|
|
69
|
+
interface SlugScope {
|
|
70
|
+
db: ScopedDb;
|
|
71
|
+
collection: ResolvedCollection;
|
|
72
|
+
documentId: string | null;
|
|
73
|
+
field: string;
|
|
74
|
+
/** Empty for a field that is not localized. */
|
|
75
|
+
locale: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Refuses a slug another document uses, as its address or as a previous one.
|
|
79
|
+
*
|
|
80
|
+
* Trashed documents count: restoring a page must never bring back a URL
|
|
81
|
+
* somebody else has taken since. A previous address is not taken over
|
|
82
|
+
* silently either — it is a redirect somebody relies on — so the message
|
|
83
|
+
* says where it leads and how to free it.
|
|
84
|
+
*/
|
|
85
|
+
export declare function assertFree(scope: SlugScope & {
|
|
86
|
+
slug: string;
|
|
87
|
+
}): Promise<void>;
|
|
88
|
+
export interface SlugCandidate {
|
|
89
|
+
id: string;
|
|
90
|
+
/** The locale the slug matched in; null for a field that is not localized. */
|
|
91
|
+
locale: string | null;
|
|
92
|
+
current: boolean;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Every document a slug points at, best match first: a current address in
|
|
96
|
+
* the requested locale, then in another locale, then a previous address in
|
|
97
|
+
* the requested locale, then in another.
|
|
98
|
+
*
|
|
99
|
+
* Trashed documents are left out — a trashed page has no address — and so
|
|
100
|
+
* is anything that is not a slug at all, before a query is spent on it.
|
|
101
|
+
*/
|
|
102
|
+
export declare function slugCandidates(options: {
|
|
103
|
+
db: ScopedDb;
|
|
104
|
+
collection: ResolvedCollection;
|
|
105
|
+
field: string;
|
|
106
|
+
slug: string;
|
|
107
|
+
locale: string | null;
|
|
108
|
+
locales: string[];
|
|
109
|
+
}): Promise<SlugCandidate[]>;
|
|
110
|
+
export interface PreviousSlugRow {
|
|
111
|
+
slug: string;
|
|
112
|
+
field: string;
|
|
113
|
+
locale: string | null;
|
|
114
|
+
createdAt: string | null;
|
|
115
|
+
}
|
|
116
|
+
export declare function previousSlugRows(options: {
|
|
117
|
+
db: ScopedDb;
|
|
118
|
+
collection: ResolvedCollection;
|
|
119
|
+
documentId: string;
|
|
120
|
+
field?: string;
|
|
121
|
+
locale?: string | null;
|
|
122
|
+
}): Promise<PreviousSlugRow[]>;
|
|
123
|
+
export {};
|
|
124
|
+
//# sourceMappingURL=slugs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slugs.d.ts","sourceRoot":"","sources":["../../src/engine/slugs.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAIhD;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,gBAAgB,iBAAiB,CAAC;AAK/C,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAA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;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,wBAAsB,gBAAgB,CAAC,OAAO,EAAE;IAC9C,EAAE,EAAE,QAAQ,CAAC;IACb,UAAU,EAAE,kBAAkB,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAsB7B"}
|
package/dist/fields/builtin.d.ts
CHANGED
|
@@ -103,27 +103,54 @@ export interface RelationOptions extends FieldOptions {
|
|
|
103
103
|
* that Payload users hit with `depth` (section 12).
|
|
104
104
|
*/
|
|
105
105
|
export declare function relation<const TOptions extends RelationOptions>(to: string, options?: TOptions): FieldDefinition<FieldValue<string, TOptions>>;
|
|
106
|
+
export interface SlugOptions extends FieldOptions {
|
|
107
|
+
/**
|
|
108
|
+
* The field a slug is made from while it is empty: `"title"`.
|
|
109
|
+
*
|
|
110
|
+
* Made once, on the write that first has a value for it, and then left
|
|
111
|
+
* alone: retitling a page must not move its URL. Clearing the slug makes
|
|
112
|
+
* it again. The same function is the panel's "Generate" button.
|
|
113
|
+
*/
|
|
114
|
+
from?: string;
|
|
115
|
+
/**
|
|
116
|
+
* Keep every slug a document stops using as a previous address of it.
|
|
117
|
+
*
|
|
118
|
+
* `cms.api.<collection>.resolveSlug()` finds a document by a previous
|
|
119
|
+
* address too, which is what a 301 from an old URL is built on; a new
|
|
120
|
+
* document cannot take an address an old one still redirects from. Needs
|
|
121
|
+
* the `slug_history` table, which `heyo-cms generate` adds.
|
|
122
|
+
*/
|
|
123
|
+
history?: boolean;
|
|
124
|
+
/** The longest slug produced; longer input is cut at a hyphen. 96 by default. */
|
|
125
|
+
maxLength?: number;
|
|
126
|
+
/**
|
|
127
|
+
* Your own transliteration, when the built-in one is not the house style:
|
|
128
|
+
* `&` as `and`, a language's own rules. Used everywhere a slug is made or
|
|
129
|
+
* cleaned — writes, the Generate button, previous slugs. Its output must
|
|
130
|
+
* still match `slugPattern`; `maxLength` is then yours to apply.
|
|
131
|
+
*/
|
|
132
|
+
slugify?: (text: string) => string;
|
|
133
|
+
default?: string;
|
|
134
|
+
}
|
|
106
135
|
/**
|
|
107
|
-
*
|
|
136
|
+
* A URL slug: `"lodz-in-autumn"`.
|
|
108
137
|
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
138
|
+
* What makes it more than `text` with a pattern is the engine, on every
|
|
139
|
+
* write path — the panel, the REST API, an import, a scheduled change:
|
|
140
|
+
*
|
|
141
|
+
* - a typed slug is cleaned (`"Łódź in Autumn!"` becomes `lodz-in-autumn`);
|
|
142
|
+
* - an empty one is made `from` another field, with `-2`, `-3`… until free;
|
|
143
|
+
* - it is unique within the collection — per language when localized, which
|
|
144
|
+
* a database index cannot express, so the engine checks it, trashed
|
|
145
|
+
* documents included;
|
|
146
|
+
* - with `history`, a changed slug stays a previous address of the document,
|
|
147
|
+
* which `resolveSlug()` finds and nobody else may take.
|
|
115
148
|
*
|
|
116
149
|
* ```ts
|
|
117
|
-
*
|
|
118
|
-
* unique: true,
|
|
119
|
-
* index: true,
|
|
120
|
-
* pattern: "^[a-z0-9]+(?:-[a-z0-9]+)*$",
|
|
121
|
-
* })
|
|
150
|
+
* slug: slug({ from: "title", localized: true, history: true })
|
|
122
151
|
* ```
|
|
123
|
-
*
|
|
124
|
-
* and generating it from the title is a `create.before` hook, which runs
|
|
125
|
-
* before validation precisely so that it can fill a required field.
|
|
126
152
|
*/
|
|
153
|
+
export declare function slug<const TOptions extends SlugOptions>(options?: TOptions): FieldDefinition<FieldValue<string, TOptions>>;
|
|
127
154
|
export declare const email: import("./registry").FieldBuilder<string, TextOptions>;
|
|
128
155
|
export declare const url: import("./registry").FieldBuilder<string, TextOptions>;
|
|
129
156
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin.d.ts","sourceRoot":"","sources":["../../src/fields/builtin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"builtin.d.ts","sourceRoot":"","sources":["../../src/fields/builtin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAsC1D,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,IAAI,wDAsBf,CAAC;AAEH,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,QAAQ,4DAanB,CAAC;AAMH,yEAAyE;AACzE,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC;AAEvC,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACnD,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,eAAO,MAAM,QAAQ,gEASnB,CAAC;AAMH,MAAM,WAAW,aAAc,SAAQ,YAAY;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,G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CAAC,EAAE,MAAM,CAAC;CAClB;AAsBD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,IAAI,CAAC,KAAK,CAAC,QAAQ,SAAS,WAAW,EACrD,OAAO,CAAC,EAAE,QAAQ,GACjB,eAAe,CAAC,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CA0B/C;AAED,eAAO,MAAM,KAAK,wDAKhB,CAAC;AAEH,eAAO,MAAM,GAAG,wDAKd,CAAC;AAMH;;;;;;GAMG;AACH,wBAAgB,SAAS,IAAI;IAC3B,QAAQ,EAAE,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,cAAc,EAAE,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC/C,OAAO,EAAE,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACxC,SAAS,EAAE,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC3C,CAuBA"}
|
package/dist/fields.d.ts
CHANGED
package/dist/fields.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../src/fields.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../src/fields.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/fields.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Mn,sn,ye}from"./index-abfzb1ve.js";import{po,Ko,Yo,O}from"./index-67e458ws.js";import{z as e}from"zod";var i=e.looseObject({label:e.string().optional(),description:e.string().optional(),localized:e.boolean().optional(),required:e.boolean().optional(),unique:e.boolean().optional(),index:e.boolean().optional(),readOnly:e.boolean().optional()}),a=e.lazy(()=>e.union([e.string(),e.number(),e.boolean(),e.null(),e.array(a),e.record(e.string(),a)])),g=O({name:"text",optionsSchema:i.extend({default:e.string().optional(),minLength:e.number().int().nonnegative().optional(),maxLength:e.number().int().positive().optional(),pattern:e.string().optional()}),schema:(n)=>{let t=e.string();if(n.minLength!==void 0)t=t.min(n.minLength);if(n.maxLength!==void 0)t=t.max(n.maxLength);if(n.pattern!==void 0)t=t.regex(new RegExp(n.pattern));return t},column:(n)=>({type:"text",...n.default===void 0?{}:{default:n.default}}),aiActions:["generate","improve","summarize","translate"]}),x=O({name:"textarea",optionsSchema:i.extend({default:e.string().optional(),maxLength:e.number().int().positive().optional(),rows:e.number().int().positive().optional()}),schema:(n)=>n.maxLength===void 0?e.string():e.string().max(n.maxLength),column:()=>({type:"text"}),aiActions:["generate","improve","summarize","translate"]}),w=O({name:"richText",optionsSchema:i.extend({nodes:e.array(e.string()).optional()}),schema:()=>e.looseObject({type:e.string()}),column:()=>({type:"json"}),aiActions:["generate","improve","summarize","translate"]}),k=O({name:"number",optionsSchema:i.extend({default:e.number().optional(),min:e.number().optional(),max:e.number().optional(),integer:e.boolean().optional()}),schema:(n)=>{let t=n.integer===!0?e.number().int():e.number();if(n.min!==void 0)t=t.min(n.min);if(n.max!==void 0)t=t.max(n.max);return t},column:(n)=>({type:n.integer===!0?"integer":"real",...n.default===void 0?{}:{default:n.default}})}),D=O({name:"boolean",optionsSchema:i.extend({default:e.boolean().optional()}),schema:()=>e.boolean(),column:(n)=>({type:"boolean",...n.default===void 0?{}:{default:n.default}})}),L=O({name:"date",optionsSchema:i.extend({default:e.string().optional(),mode:e.enum(["date","datetime"]).optional()}),schema:()=>e.string().refine((n)=>!Number.isNaN(Date.parse(n)),"must be an ISO 8601 date"),column:()=>({type:"timestamp"})}),d=(n)=>n.map((t)=>typeof t==="string"?t:t.value),m=i.extend({options:e.array(e.union([e.string(),e.strictObject({label:e.string(),value:e.string()})])).min(1),default:e.string().optional()}),f=O({name:"select",optionsSchema:m,schema:(n)=>e.enum(d(n.options)),column:(n)=>({type:"text",...n.default===void 0?{}:{default:n.default}})});function v(n){return f(n)}var h=O({name:"multiselect",optionsSchema:m.extend({default:e.array(e.string()).optional(),minItems:e.number().int().nonnegative().optional(),maxItems:e.number().int().positive().optional()}),schema:(n)=>{let t=e.array(e.enum(d(n.options)));if(n.minItems!==void 0)t=t.min(n.minItems);if(n.maxItems!==void 0)t=t.max(n.maxItems);return t},column:()=>({type:"json",array:!0}),aiActions:["tags"]});function Z(n){return h(n)}var j=O({name:"json",optionsSchema:i,schema:()=>a,column:()=>({type:"json"})}),y=O({name:"media",optionsSchema:i.extend({accept:e.string().optional()}),schema:()=>e.string().min(1),column:()=>({type:"text"}),aiActions:["alt"]}),T=O({name:"relation",optionsSchema:i.extend({relationTo:e.string().min(1),many:e.boolean().optional()}),schema:()=>e.string().min(1),column:(n)=>({type:"text",...n.many===!0?{type:"json",array:!0}:{}}),aiActions:["tags"]});function R(n,t){return T({...t??{},relationTo:n})}var b=O({name:"slug",optionsSchema:i.extend({from:e.string().min(1).optional(),history:e.boolean().optional(),maxLength:e.number().int().min(8).max(512).optional(),slugify:e.function().optional(),default:e.string().optional()}),schema:(n)=>e.string().max(n.maxLength??96).regex(new RegExp(Mn),"lowercase letters, digits and single hyphens only"),column:(n)=>({type:"text",...n.default===void 0?{}:{default:n.default}})});function I(n){let t={...n??{}},s=t.localized===!0,{maxLength:l,from:r}=t,c=t.slugify??((o)=>ye(o,l===void 0?{}:{maxLength:l}));return b({...t,unique:s?t.unique===!1?!1:void 0:t.unique??!0,index:s?void 0:t.index??!0,...t.generate===void 0&&r!==void 0?{generate:({fields:o})=>{let p=o[r],u=typeof p==="string"?c(p):"";return u===""?null:u}}:{}})}var C=O({name:"email",optionsSchema:i,schema:()=>e.string().email(),column:()=>({type:"text"})}),F=O({name:"url",optionsSchema:i,schema:()=>e.string().url(),column:()=>({type:"text"})});function J(){return{seoTitle:g({label:"SEO title",localized:!0,maxLength:70,aiGenerate:{label:"Suggest an SEO title",prompt:"Write a search-friendly title under 60 characters."}}),seoDescription:x({label:"SEO description",localized:!0,maxLength:160,aiGenerate:{label:"Suggest an SEO description",prompt:"Summarise the article in one sentence under 155 characters."}}),ogImage:y({label:"Social image",accept:"image/*"}),canonical:F({label:"Canonical URL"})}}export{D as boolean,L as date,O as defineField,C as email,Ko as getFieldType,sn as isSlug,j as json,y as media,Z as multiselect,k as number,po as registerFieldType,Yo as registeredFieldTypes,R as relation,w as richText,v as select,J as seoFields,I as slug,Mn as slugPattern,ye as slugify,g as text,x as textarea,F as url};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/http/handler.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/http/handler.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA0BhD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,UAAU,CAAC;IACpB,0CAA0C;IAC1C,MAAM,IAAI,eAAe,EAAE,CAAC;IAC5B,wCAAwC;IACxC,OAAO,IAAI,UAAU,CAAC;CACvB;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAkHvD"}
|
package/dist/http/rich-text.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ResolvedCollection } from "../types/config";
|
|
2
|
-
import type { RichTextFormat } from "../types/editor";
|
|
2
|
+
import type { RichTextFormat, RichTextMediaImage } from "../types/editor";
|
|
3
|
+
import type { CmsInstance } from "../types/instance";
|
|
3
4
|
import type { JsonObject } from "../types/json";
|
|
4
5
|
/**
|
|
5
6
|
* `?richText=html` on a read.
|
|
@@ -21,10 +22,20 @@ export interface RenderOptions {
|
|
|
21
22
|
format: RichTextFormat;
|
|
22
23
|
/** Resolves a `mediaId` on an image node to a URL this deployment serves. */
|
|
23
24
|
mediaUrl: (id: string) => string;
|
|
25
|
+
/** Resolves a `mediaId` to a whole `<img>`: dimensions, `srcset`, alt. */
|
|
26
|
+
mediaImage?: (id: string) => RichTextMediaImage | null;
|
|
24
27
|
}
|
|
25
28
|
/** Renders every rich-text field of one document, in place. */
|
|
26
29
|
export declare function renderDocumentRichText(document: JsonObject, options: RenderOptions): JsonObject;
|
|
27
30
|
export declare function renderPageRichText(documents: JsonObject[], options: RenderOptions): void;
|
|
28
31
|
/** The URL the CMS itself serves a file from, for an image inside prose. */
|
|
29
32
|
export declare function mediaUrlResolver(basePath: string): (id: string) => string;
|
|
33
|
+
/**
|
|
34
|
+
* Every library image the rich-text fields of these documents show, loaded
|
|
35
|
+
* in one query and described for an `<img>`.
|
|
36
|
+
*
|
|
37
|
+
* Undefined without `uploads`: there is no library to look in, and the
|
|
38
|
+
* serialiser's plain `mediaUrl` fallback is the whole answer.
|
|
39
|
+
*/
|
|
40
|
+
export declare function richTextMediaResolver(cms: CmsInstance, documents: JsonObject[], collection: ResolvedCollection, locale: string | null): Promise<((id: string) => RichTextMediaImage | null) | undefined>;
|
|
30
41
|
//# sourceMappingURL=rich-text.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rich-text.d.ts","sourceRoot":"","sources":["../../src/http/rich-text.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rich-text.d.ts","sourceRoot":"","sources":["../../src/http/rich-text.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAA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":"","sources":["../../../src/http/routes/documents.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../../src/http/routes/documents.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAkBxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAkE7C;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,WAAW,GAAG,WAAW,EAAE,CA0T9D;AA6KD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,WAAW,EAAE,CA8I5D;AAED,wBAAgB,UAAU,CAAC,UAAU,EAAE,kBAAkB,GAAG,MAAM,CAEjE;AAED,wBAAgB,SAAS,CAAC,UAAU,EAAE,kBAAkB,GAAG,MAAM,CAEhE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CmsInstance } from "../../types/instance";
|
|
2
|
+
import type { MediaVariantResult } from "../../types/media";
|
|
2
3
|
import type { RouteRecord } from "../router";
|
|
3
4
|
/**
|
|
4
5
|
* The media library over HTTP.
|
|
@@ -14,6 +15,35 @@ import type { RouteRecord } from "../router";
|
|
|
14
15
|
* protect (stage 6).
|
|
15
16
|
*/
|
|
16
17
|
export declare function mediaRoutes(cms: CmsInstance): RouteRecord[];
|
|
18
|
+
/**
|
|
19
|
+
* One file, as an HTTP response: the API route and the public route share it.
|
|
20
|
+
*
|
|
21
|
+
* The tag is the checksum of the original plus the variant name: two
|
|
22
|
+
* deployments of the same bytes produce the same tag, and a re-render of the
|
|
23
|
+
* same size does not invalidate a cache that is already correct. A variant is
|
|
24
|
+
* addressed by a name whose meaning is fixed by the configuration, so the
|
|
25
|
+
* bytes behind one URL only change when an editor re-crops — which changes
|
|
26
|
+
* the checksum and the tag — and the answer may be kept for a year.
|
|
27
|
+
*
|
|
28
|
+
* Except when the size could not be rendered and the original stands in for
|
|
29
|
+
* it: that answer is right for now and wrong once the processor recovers, so
|
|
30
|
+
* it carries its own tag and is cached for minutes, not for a year.
|
|
31
|
+
*/
|
|
32
|
+
export declare function mediaResponse(request: Request, result: MediaVariantResult, extraHeaders?: Record<string, string>): Promise<Response>;
|
|
33
|
+
/**
|
|
34
|
+
* The files themselves, at addresses made for the web:
|
|
35
|
+
*
|
|
36
|
+
* /media/med_0mv…/condition-report.png
|
|
37
|
+
* /media/med_0mv…/card/condition-report.webp
|
|
38
|
+
*
|
|
39
|
+
* Registered only with `uploads.publicPath`, outside `basePath`, on the root
|
|
40
|
+
* router: the application mounts the CMS handler on this path as well. The
|
|
41
|
+
* id says which file and the optional middle segment which size; the name is
|
|
42
|
+
* for people and image search, and is otherwise ignored, so a renamed file
|
|
43
|
+
* keeps every link it ever had. No actor, no hooks, no RBAC — a file on a
|
|
44
|
+
* page is public, which is what this route exists to say.
|
|
45
|
+
*/
|
|
46
|
+
export declare function publicMediaRoutes(cms: CmsInstance): RouteRecord[];
|
|
17
47
|
/**
|
|
18
48
|
* The orphan sweep, as an endpoint.
|
|
19
49
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/http/routes/media.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/http/routes/media.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EAKV,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAW7C;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,WAAW,GAAG,WAAW,EAAE,CA6R3D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,kBAAkB,EAC1B,YAAY,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACxC,OAAO,CAAC,QAAQ,CAAC,CAwBnB;AAYD;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,WAAW,GAAG,WAAW,EAAE,CA2CjE;AAcD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,WAAW,GAAG,WAAW,EAAE,CAsCjE;AAED,yEAAyE;AACzE,eAAO,MAAM,sBAAsB,UAA0C,CAAC"}
|
package/dist/http.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./index-
|
|
1
|
+
import"./index-6m1kjq9g.js";import"./index-sgdnp83t.js";import"./index-g041kfa5.js";import{Ye,g,Ze,y,j,On,Xn,eo,P,G,i,Pn,oe,K,St,Xt,f,De,v,W,Re,o,c,a,q,_n,h,r,N,Tt,$n,In,Se,qe}from"./index-hpast878.js";import"./index-8x2em6c8.js";import"./index-91fa1gzf.js";import"./index-2prbs05k.js";export{Se as Router,G as booleanParam,$n as buildOpenApi,qe as createCmsHttp,St as errorResponse,On as findArgs,P as integerParam,i as json,h as jsonBody,_n as listParams,q as localeParams,oe as noContent,r as okJson,W as optionalString,Re as optionalStringArray,eo as parseSort,Xn as parseWhere,c as pathParam,a as queryParam,j as readArgs,Xt as readJson,f as readJsonObject,Tt as readResponses,o as ref,In as requestDb,y as requestSource,Ye as requireActor,De as requireData,g as requirePermission,Ze as requireSession,v as requireString,K as stopped,Pn as text,N as writeResponses};
|