@cogenta/blocks 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action.d.ts +35 -0
- package/dist/action.d.ts.map +1 -0
- package/dist/action.js +24 -0
- package/dist/action.js.map +1 -0
- package/dist/define-block.d.ts +12 -0
- package/dist/define-block.d.ts.map +1 -0
- package/dist/define-block.js +59 -0
- package/dist/define-block.js.map +1 -0
- package/dist/errors.d.ts +14 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +52 -0
- package/dist/errors.js.map +1 -0
- package/dist/field.d.ts +165 -0
- package/dist/field.d.ts.map +1 -0
- package/dist/field.js +156 -0
- package/dist/field.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/migrate.d.ts +64 -0
- package/dist/migrate.d.ts.map +1 -0
- package/dist/migrate.js +113 -0
- package/dist/migrate.js.map +1 -0
- package/dist/plain-text.d.ts +13 -0
- package/dist/plain-text.d.ts.map +1 -0
- package/dist/plain-text.js +23 -0
- package/dist/plain-text.js.map +1 -0
- package/dist/registry.d.ts +33 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +73 -0
- package/dist/registry.js.map +1 -0
- package/dist/rich-text.d.ts +67 -0
- package/dist/rich-text.d.ts.map +1 -0
- package/dist/rich-text.js +60 -0
- package/dist/rich-text.js.map +1 -0
- package/dist/types.d.ts +75 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +13 -0
- package/dist/types.js.map +1 -0
- package/dist/validate.d.ts +40 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +108 -0
- package/dist/validate.js.map +1 -0
- package/dist/version.d.ts +11 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +23 -0
- package/dist/version.js.map +1 -0
- package/dist/vocabulary.d.ts +472 -0
- package/dist/vocabulary.d.ts.map +1 -0
- package/dist/vocabulary.js +309 -0
- package/dist/vocabulary.js.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type BlockRegistry } from './registry.js';
|
|
2
|
+
import type { UnknownPlacedBlock } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Block schema migration (contract B, "Versionnement"; spec L1, "Blocs").
|
|
5
|
+
*
|
|
6
|
+
* Changing the schema of an existing block is a major bump and forces an
|
|
7
|
+
* automatic migration of content already written. That migration runs **on
|
|
8
|
+
* load**, and the migrated version is written back — content never sits in an
|
|
9
|
+
* ambiguous state where nobody can tell which shape the data has.
|
|
10
|
+
*/
|
|
11
|
+
/** The data of a block, envelope aside. */
|
|
12
|
+
export type BlockFields = Record<string, unknown>;
|
|
13
|
+
/**
|
|
14
|
+
* One step, from one exact version to the next.
|
|
15
|
+
*
|
|
16
|
+
* Steps rather than a jump to the current version: a site that skips three
|
|
17
|
+
* releases replays three small, individually tested transforms instead of one
|
|
18
|
+
* combinatorial one nobody can reason about.
|
|
19
|
+
*/
|
|
20
|
+
export interface BlockMigration {
|
|
21
|
+
readonly block: string;
|
|
22
|
+
readonly from: string;
|
|
23
|
+
readonly to: string;
|
|
24
|
+
/**
|
|
25
|
+
* Receives the block's data only — never `_key`, `_type` or `_version`. That
|
|
26
|
+
* is what makes the key's survival structural rather than a convention a
|
|
27
|
+
* migration author has to remember.
|
|
28
|
+
*/
|
|
29
|
+
migrate(data: Readonly<BlockFields>): BlockFields;
|
|
30
|
+
}
|
|
31
|
+
export declare class BlockMigrationRegistry {
|
|
32
|
+
#private;
|
|
33
|
+
register(migration: BlockMigration): void;
|
|
34
|
+
registerAll(migrations: Iterable<BlockMigration>): void;
|
|
35
|
+
/** The steps that take `from` to `to`, in order. */
|
|
36
|
+
path(block: string, from: string, to: string): BlockMigration[];
|
|
37
|
+
}
|
|
38
|
+
/** The migrations shipped with the vocabulary. Empty: the twelve are still at 1.0.0. */
|
|
39
|
+
export declare const vocabularyMigrations: BlockMigrationRegistry;
|
|
40
|
+
export interface BlockLoadOptions {
|
|
41
|
+
readonly registry?: BlockRegistry;
|
|
42
|
+
readonly migrations?: BlockMigrationRegistry;
|
|
43
|
+
}
|
|
44
|
+
export interface LoadedBlock {
|
|
45
|
+
readonly block: UnknownPlacedBlock;
|
|
46
|
+
/** True when the stored form differed and must be written back. */
|
|
47
|
+
readonly migrated: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Reads one stored block, migrating it to the registered schema version if it
|
|
51
|
+
* lags behind.
|
|
52
|
+
*
|
|
53
|
+
* `migrated` tells the persistence layer to write the result back. Callers that
|
|
54
|
+
* ignore it re-run the migration on every read, which is slow but never wrong —
|
|
55
|
+
* the transform is applied to a copy and validated before it is returned.
|
|
56
|
+
*/
|
|
57
|
+
export declare function loadBlock(raw: unknown, options?: BlockLoadOptions): LoadedBlock;
|
|
58
|
+
export interface LoadedBlocks {
|
|
59
|
+
readonly blocks: UnknownPlacedBlock[];
|
|
60
|
+
/** True when at least one block moved, so the zone is worth rewriting. */
|
|
61
|
+
readonly migrated: boolean;
|
|
62
|
+
}
|
|
63
|
+
export declare function loadBlocks(raws: readonly unknown[], options?: BlockLoadOptions): LoadedBlocks;
|
|
64
|
+
//# sourceMappingURL=migrate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../src/migrate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAsB,MAAM,eAAe,CAAA;AACtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAIpD;;;;;;;GAOG;AAEH,2CAA2C;AAC3C,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAEjD;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAA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|
+
import { vocabularyRegistry } from './registry.js';
|
|
3
|
+
import { parseBlock } from './validate.js';
|
|
4
|
+
import { compareBlockVersions, isBlockVersion } from './version.js';
|
|
5
|
+
const ENVELOPE_FIELDS = ['_key', '_type', '_version'];
|
|
6
|
+
export class BlockMigrationRegistry {
|
|
7
|
+
/** block name → source version → step. One step per source version, at most. */
|
|
8
|
+
#steps = new Map();
|
|
9
|
+
register(migration) {
|
|
10
|
+
const { block, from, to } = migration;
|
|
11
|
+
if (!isBlockVersion(from) || !isBlockVersion(to)) {
|
|
12
|
+
throw invalidBlockDefinition(block, `migration ${from} → ${to} uses a non-semver version`);
|
|
13
|
+
}
|
|
14
|
+
if (compareBlockVersions(from, to) >= 0) {
|
|
15
|
+
throw invalidBlockDefinition(block, `migration ${from} → ${to} does not move forward`);
|
|
16
|
+
}
|
|
17
|
+
const forBlock = this.#steps.get(block) ?? new Map();
|
|
18
|
+
const existing = forBlock.get(from);
|
|
19
|
+
if (existing !== undefined && existing.to !== to) {
|
|
20
|
+
throw invalidBlockDefinition(block, `two migrations start from ${from} (${existing.to} and ${to}); the path must be unambiguous`);
|
|
21
|
+
}
|
|
22
|
+
forBlock.set(from, migration);
|
|
23
|
+
this.#steps.set(block, forBlock);
|
|
24
|
+
}
|
|
25
|
+
registerAll(migrations) {
|
|
26
|
+
for (const migration of migrations)
|
|
27
|
+
this.register(migration);
|
|
28
|
+
}
|
|
29
|
+
/** The steps that take `from` to `to`, in order. */
|
|
30
|
+
path(block, from, to) {
|
|
31
|
+
const forBlock = this.#steps.get(block);
|
|
32
|
+
const steps = [];
|
|
33
|
+
let current = from;
|
|
34
|
+
while (compareBlockVersions(current, to) < 0) {
|
|
35
|
+
const step = forBlock?.get(current);
|
|
36
|
+
if (step === undefined) {
|
|
37
|
+
throw blockMigrationFailed(block, from, to, `no migration registered from ${current}`);
|
|
38
|
+
}
|
|
39
|
+
if (compareBlockVersions(step.to, to) > 0) {
|
|
40
|
+
throw blockMigrationFailed(block, from, to, `the step from ${current} overshoots to ${step.to}`);
|
|
41
|
+
}
|
|
42
|
+
steps.push(step);
|
|
43
|
+
current = step.to;
|
|
44
|
+
}
|
|
45
|
+
return steps;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** The migrations shipped with the vocabulary. Empty: the twelve are still at 1.0.0. */
|
|
49
|
+
export const vocabularyMigrations = new BlockMigrationRegistry();
|
|
50
|
+
function splitEnvelope(raw) {
|
|
51
|
+
const data = {};
|
|
52
|
+
for (const [field, value] of Object.entries(raw)) {
|
|
53
|
+
if (!ENVELOPE_FIELDS.includes(field))
|
|
54
|
+
data[field] = value;
|
|
55
|
+
}
|
|
56
|
+
return data;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Reads one stored block, migrating it to the registered schema version if it
|
|
60
|
+
* lags behind.
|
|
61
|
+
*
|
|
62
|
+
* `migrated` tells the persistence layer to write the result back. Callers that
|
|
63
|
+
* ignore it re-run the migration on every read, which is slow but never wrong —
|
|
64
|
+
* the transform is applied to a copy and validated before it is returned.
|
|
65
|
+
*/
|
|
66
|
+
export function loadBlock(raw, options = {}) {
|
|
67
|
+
const registry = options.registry ?? vocabularyRegistry;
|
|
68
|
+
const migrations = options.migrations ?? vocabularyMigrations;
|
|
69
|
+
if (typeof raw !== 'object' || raw === null) {
|
|
70
|
+
return { block: parseBlock(raw, registry), migrated: false };
|
|
71
|
+
}
|
|
72
|
+
const stored = raw;
|
|
73
|
+
const type = typeof stored._type === 'string' ? stored._type : '';
|
|
74
|
+
const definition = registry.mustGet(type);
|
|
75
|
+
const from = typeof stored._version === 'string' ? stored._version : '';
|
|
76
|
+
if (!isBlockVersion(from)) {
|
|
77
|
+
throw blockMigrationFailed(type, from === '' ? '(missing)' : from, definition.version, 'the stored block carries no usable schema version');
|
|
78
|
+
}
|
|
79
|
+
const order = compareBlockVersions(from, definition.version);
|
|
80
|
+
if (order === 0)
|
|
81
|
+
return { block: parseBlock(stored, registry), migrated: false };
|
|
82
|
+
if (order > 0) {
|
|
83
|
+
// Refuse rather than guess: this is content written by a newer deployment,
|
|
84
|
+
// and dropping the fields it added would be a silent data loss.
|
|
85
|
+
throw blockMigrationFailed(type, from, definition.version, 'the stored block is newer than the registered schema');
|
|
86
|
+
}
|
|
87
|
+
let data = splitEnvelope(stored);
|
|
88
|
+
for (const step of migrations.path(type, from, definition.version)) {
|
|
89
|
+
try {
|
|
90
|
+
data = step.migrate(Object.freeze({ ...data }));
|
|
91
|
+
}
|
|
92
|
+
catch (cause) {
|
|
93
|
+
throw blockMigrationFailed(type, step.from, step.to, cause instanceof Error ? cause.message : 'the migration threw');
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// The key is re-attached from the stored block, never from the migration's
|
|
97
|
+
// output: a migration cannot change a block's identity even by accident.
|
|
98
|
+
const migratedBlock = {
|
|
99
|
+
...data,
|
|
100
|
+
_key: stored._key,
|
|
101
|
+
_type: type,
|
|
102
|
+
_version: definition.version,
|
|
103
|
+
};
|
|
104
|
+
return { block: parseBlock(migratedBlock, registry), migrated: true };
|
|
105
|
+
}
|
|
106
|
+
export function loadBlocks(raws, options = {}) {
|
|
107
|
+
const loaded = raws.map((raw) => loadBlock(raw, options));
|
|
108
|
+
return {
|
|
109
|
+
blocks: loaded.map((entry) => entry.block),
|
|
110
|
+
migrated: loaded.some((entry) => entry.migrated),
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=migrate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../src/migrate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAC1E,OAAO,EAAsB,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AA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,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC;QAC1C,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC;KACjD,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare function containsMarkup(value: string): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* A text value that may not carry markup.
|
|
5
|
+
*
|
|
6
|
+
* This is rule R3 enforced at the smallest possible scale. A block stores
|
|
7
|
+
* semantic data; the moment a `<span class="highlight">` survives a write, the
|
|
8
|
+
* theme stops owning presentation and every later skin change becomes a content
|
|
9
|
+
* migration. Refusing it at the field boundary is cheaper than detecting it at
|
|
10
|
+
* render time.
|
|
11
|
+
*/
|
|
12
|
+
export declare const plainTextSchema: z.ZodString;
|
|
13
|
+
//# sourceMappingURL=plain-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plain-text.d.ts","sourceRoot":"","sources":["../src/plain-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AASvB,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,aAE1B,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Matches an opening or closing HTML tag, and nothing that a human writes on
|
|
4
|
+
* purpose. `a < b` and `5 > 3` stay valid text; `<p>`, `</em>`, `<img src=…/>`
|
|
5
|
+
* and `<div class="hero">` do not.
|
|
6
|
+
*/
|
|
7
|
+
const HTML_TAG = /<\/?[a-zA-Z][\w:-]*(\s[^<>]*)?\/?>/;
|
|
8
|
+
export function containsMarkup(value) {
|
|
9
|
+
return HTML_TAG.test(value);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A text value that may not carry markup.
|
|
13
|
+
*
|
|
14
|
+
* This is rule R3 enforced at the smallest possible scale. A block stores
|
|
15
|
+
* semantic data; the moment a `<span class="highlight">` survives a write, the
|
|
16
|
+
* theme stops owning presentation and every later skin change becomes a content
|
|
17
|
+
* migration. Refusing it at the field boundary is cheaper than detecting it at
|
|
18
|
+
* render time.
|
|
19
|
+
*/
|
|
20
|
+
export const plainTextSchema = z.string().refine((value) => !containsMarkup(value), {
|
|
21
|
+
error: 'must be plain text: a block never stores HTML or CSS (rule R3)',
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=plain-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plain-text.js","sourceRoot":"","sources":["../src/plain-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;GAIG;AACH,MAAM,QAAQ,GAAG,oCAAoC,CAAA;AAErD,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AAC7B,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE;IAClF,KAAK,EAAE,gEAAgE;CACxE,CAAC,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { AnyBlockDefinition } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The blocks a site knows about: the twelve of the vocabulary, plus whatever a
|
|
4
|
+
* theme or a plugin adds.
|
|
5
|
+
*/
|
|
6
|
+
export declare class BlockRegistry {
|
|
7
|
+
#private;
|
|
8
|
+
register(definition: AnyBlockDefinition): void;
|
|
9
|
+
has(name: string): boolean;
|
|
10
|
+
get(name: string): AnyBlockDefinition | undefined;
|
|
11
|
+
/** Same as `get`, but says what went wrong instead of returning nothing. */
|
|
12
|
+
mustGet(name: string): AnyBlockDefinition;
|
|
13
|
+
names(): string[];
|
|
14
|
+
all(): AnyBlockDefinition[];
|
|
15
|
+
/**
|
|
16
|
+
* The block a theme should actually render for `name`, following `fallback`
|
|
17
|
+
* until it reaches something the theme implements.
|
|
18
|
+
*
|
|
19
|
+
* This is the anti-lock-in guarantee of contract B made concrete: content
|
|
20
|
+
* written against a theme's own block still renders after a theme change,
|
|
21
|
+
* degraded but never lost. Returns `undefined` when nothing in the chain is
|
|
22
|
+
* implemented, so the caller decides between skipping and failing the build.
|
|
23
|
+
*/
|
|
24
|
+
resolveRenderable(name: string, implemented: Iterable<string>): AnyBlockDefinition | undefined;
|
|
25
|
+
}
|
|
26
|
+
export declare function createBlockRegistry(definitions?: readonly AnyBlockDefinition[]): BlockRegistry;
|
|
27
|
+
/**
|
|
28
|
+
* The twelve, ready to use. A site that adds blocks builds its own registry
|
|
29
|
+
* rather than mutating this one: a shared mutable default is how one plugin's
|
|
30
|
+
* block ends up defined for everybody's tests.
|
|
31
|
+
*/
|
|
32
|
+
export declare const vocabularyRegistry: BlockRegistry;
|
|
33
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAGpD;;;GAGG;AACH,qBAAa,aAAa;;IAGxB,QAAQ,CAAC,UAAU,EAAE,kBAAkB,GAAG,IAAI,CAS7C;IAED,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEzB;IAED,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAEhD;IAED,4EAA4E;IAC5E,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAIxC;IAED,KAAK,IAAI,MAAM,EAAE,CAEhB;IAED,GAAG,IAAI,kBAAkB,EAAE,CAE1B;IAED;;;;;;;;OAQG;IACH,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,kBAAkB,GAAG,SAAS,CAe7F;CACF;AAED,wBAAgB,mBAAmB,CACjC,WAAW,GAAE,SAAS,kBAAkB,EAAe,GACtD,aAAa,CAIf;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,aAAqC,CAAA"}
|
package/dist/registry.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { invalidBlockDefinition, unknownBlock } from './errors.js';
|
|
2
|
+
import { VOCABULARY } from './vocabulary.js';
|
|
3
|
+
/**
|
|
4
|
+
* The blocks a site knows about: the twelve of the vocabulary, plus whatever a
|
|
5
|
+
* theme or a plugin adds.
|
|
6
|
+
*/
|
|
7
|
+
export class BlockRegistry {
|
|
8
|
+
#blocks = new Map();
|
|
9
|
+
register(definition) {
|
|
10
|
+
const existing = this.#blocks.get(definition.name);
|
|
11
|
+
if (existing !== undefined && existing !== definition) {
|
|
12
|
+
throw invalidBlockDefinition(definition.name, 'a different block is already registered under this name');
|
|
13
|
+
}
|
|
14
|
+
this.#blocks.set(definition.name, definition);
|
|
15
|
+
}
|
|
16
|
+
has(name) {
|
|
17
|
+
return this.#blocks.has(name);
|
|
18
|
+
}
|
|
19
|
+
get(name) {
|
|
20
|
+
return this.#blocks.get(name);
|
|
21
|
+
}
|
|
22
|
+
/** Same as `get`, but says what went wrong instead of returning nothing. */
|
|
23
|
+
mustGet(name) {
|
|
24
|
+
const definition = this.#blocks.get(name);
|
|
25
|
+
if (definition === undefined)
|
|
26
|
+
throw unknownBlock(name, this.names());
|
|
27
|
+
return definition;
|
|
28
|
+
}
|
|
29
|
+
names() {
|
|
30
|
+
return [...this.#blocks.keys()];
|
|
31
|
+
}
|
|
32
|
+
all() {
|
|
33
|
+
return [...this.#blocks.values()];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The block a theme should actually render for `name`, following `fallback`
|
|
37
|
+
* until it reaches something the theme implements.
|
|
38
|
+
*
|
|
39
|
+
* This is the anti-lock-in guarantee of contract B made concrete: content
|
|
40
|
+
* written against a theme's own block still renders after a theme change,
|
|
41
|
+
* degraded but never lost. Returns `undefined` when nothing in the chain is
|
|
42
|
+
* implemented, so the caller decides between skipping and failing the build.
|
|
43
|
+
*/
|
|
44
|
+
resolveRenderable(name, implemented) {
|
|
45
|
+
const available = new Set(implemented);
|
|
46
|
+
const seen = new Set();
|
|
47
|
+
let current = name;
|
|
48
|
+
while (current !== null) {
|
|
49
|
+
if (seen.has(current)) {
|
|
50
|
+
throw invalidBlockDefinition(name, 'its fallback chain loops back on itself');
|
|
51
|
+
}
|
|
52
|
+
seen.add(current);
|
|
53
|
+
const definition = this.mustGet(current);
|
|
54
|
+
if (available.has(current))
|
|
55
|
+
return definition;
|
|
56
|
+
current = definition.fallback;
|
|
57
|
+
}
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export function createBlockRegistry(definitions = VOCABULARY) {
|
|
62
|
+
const registry = new BlockRegistry();
|
|
63
|
+
for (const definition of definitions)
|
|
64
|
+
registry.register(definition);
|
|
65
|
+
return registry;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The twelve, ready to use. A site that adds blocks builds its own registry
|
|
69
|
+
* rather than mutating this one: a shared mutable default is how one plugin's
|
|
70
|
+
* block ends up defined for everybody's tests.
|
|
71
|
+
*/
|
|
72
|
+
export const vocabularyRegistry = createBlockRegistry();
|
|
73
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO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IAAY,EAAE,WAA6B;QAC3D,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAA;QACtC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAA;QAC9B,IAAI,OAAO,GAAkB,IAAI,CAAA;QAEjC,OAAO,OAAO,KAAK,IAAI,EAAE,CAAC;YACxB,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;gBACtB,MAAM,sBAAsB,CAAC,IAAI,EAAE,yCAAyC,CAAC,CAAA;YAC/E,CAAC;YACD,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;YACjB,MAAM,UAAU,GAAuB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;YAC5D,IAAI,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC;gBAAE,OAAO,UAAU,CAAA;YAC7C,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAA;QAC/B,CAAC;QACD,OAAO,SAAS,CAAA;IAClB,CAAC;CACF;AAED,MAAM,UAAU,mBAAmB,CACjC,WAAW,GAAkC,UAAU;IAEvD,MAAM,QAAQ,GAAG,IAAI,aAAa,EAAE,CAAA;IACpC,KAAK,MAAM,UAAU,IAAI,WAAW;QAAE,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;IACnE,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAkB,mBAAmB,EAAE,CAAA"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* A link points at an entity, not at an URL, whenever the target is internal:
|
|
4
|
+
* moving or renaming the target then cannot break the link, and deleting it is
|
|
5
|
+
* detectable.
|
|
6
|
+
*/
|
|
7
|
+
declare const markDefinitionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
8
|
+
_key: z.ZodString;
|
|
9
|
+
_type: z.ZodLiteral<"link">;
|
|
10
|
+
href: z.ZodString;
|
|
11
|
+
rel: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
13
|
+
_key: z.ZodString;
|
|
14
|
+
_type: z.ZodLiteral<"internalLink">;
|
|
15
|
+
collection: z.ZodString;
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
}, z.core.$strict>], "_type">;
|
|
18
|
+
declare const spanSchema: z.ZodObject<{
|
|
19
|
+
_key: z.ZodString;
|
|
20
|
+
_type: z.ZodLiteral<"span">;
|
|
21
|
+
text: z.ZodString;
|
|
22
|
+
marks: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
23
|
+
}, z.core.$strict>;
|
|
24
|
+
export declare const richTextDocumentSchema: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
25
|
+
_key: z.ZodString;
|
|
26
|
+
_type: z.ZodLiteral<"block">;
|
|
27
|
+
style: z.ZodEnum<{
|
|
28
|
+
blockquote: "blockquote";
|
|
29
|
+
h2: "h2";
|
|
30
|
+
h3: "h3";
|
|
31
|
+
h4: "h4";
|
|
32
|
+
normal: "normal";
|
|
33
|
+
}>;
|
|
34
|
+
listItem: z.ZodOptional<z.ZodEnum<{
|
|
35
|
+
bullet: "bullet";
|
|
36
|
+
number: "number";
|
|
37
|
+
}>>;
|
|
38
|
+
level: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
children: z.ZodArray<z.ZodObject<{
|
|
40
|
+
_key: z.ZodString;
|
|
41
|
+
_type: z.ZodLiteral<"span">;
|
|
42
|
+
text: z.ZodString;
|
|
43
|
+
marks: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
44
|
+
}, z.core.$strict>>;
|
|
45
|
+
markDefs: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
46
|
+
_key: z.ZodString;
|
|
47
|
+
_type: z.ZodLiteral<"link">;
|
|
48
|
+
href: z.ZodString;
|
|
49
|
+
rel: z.ZodOptional<z.ZodString>;
|
|
50
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
51
|
+
_key: z.ZodString;
|
|
52
|
+
_type: z.ZodLiteral<"internalLink">;
|
|
53
|
+
collection: z.ZodString;
|
|
54
|
+
id: z.ZodString;
|
|
55
|
+
}, z.core.$strict>], "_type">>>;
|
|
56
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
57
|
+
_key: z.ZodString;
|
|
58
|
+
_type: z.ZodLiteral<"media">;
|
|
59
|
+
id: z.ZodString;
|
|
60
|
+
caption: z.ZodOptional<z.ZodString>;
|
|
61
|
+
}, z.core.$strict>], "_type">>;
|
|
62
|
+
export type RichTextDocument = z.infer<typeof richTextDocumentSchema>;
|
|
63
|
+
export type RichTextNode = RichTextDocument[number];
|
|
64
|
+
export type Span = z.infer<typeof spanSchema>;
|
|
65
|
+
export type MarkDefinition = z.infer<typeof markDefinitionSchema>;
|
|
66
|
+
export {};
|
|
67
|
+
//# sourceMappingURL=rich-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rich-text.d.ts","sourceRoot":"","sources":["../src/rich-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAevB;;;;GAIG;AACH,QAAA,MAAM,oBAAoB;;;;;;;;;;6BAaxB,CAAA;AAEF,QAAA,MAAM,UAAU;;;;;kBAOd,CAAA;AAuBF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAElC,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AACrE,MAAM,MAAM,YAAY,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAA;AACnD,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAA;AAC7C,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { plainTextSchema } from './plain-text.js';
|
|
3
|
+
/**
|
|
4
|
+
* Contract A, "Texte riche": a rich text value is a structured JSON document,
|
|
5
|
+
* never HTML (ADR-0013).
|
|
6
|
+
*
|
|
7
|
+
* TEMPORARY HOME. These shapes belong to `@cogenta/schema`, which is being
|
|
8
|
+
* written in parallel. They live here so `@cogenta/blocks` can validate its
|
|
9
|
+
* `richText` fields today, and must be replaced by an import from
|
|
10
|
+
* `@cogenta/schema` at merge time — not duplicated.
|
|
11
|
+
*/
|
|
12
|
+
const keySchema = z.string().min(1);
|
|
13
|
+
/**
|
|
14
|
+
* A link points at an entity, not at an URL, whenever the target is internal:
|
|
15
|
+
* moving or renaming the target then cannot break the link, and deleting it is
|
|
16
|
+
* detectable.
|
|
17
|
+
*/
|
|
18
|
+
const markDefinitionSchema = z.discriminatedUnion('_type', [
|
|
19
|
+
z.strictObject({
|
|
20
|
+
_key: keySchema,
|
|
21
|
+
_type: z.literal('link'),
|
|
22
|
+
href: z.string().min(1),
|
|
23
|
+
rel: z.string().optional(),
|
|
24
|
+
}),
|
|
25
|
+
z.strictObject({
|
|
26
|
+
_key: keySchema,
|
|
27
|
+
_type: z.literal('internalLink'),
|
|
28
|
+
collection: z.string().min(1),
|
|
29
|
+
id: z.string().min(1),
|
|
30
|
+
}),
|
|
31
|
+
]);
|
|
32
|
+
const spanSchema = z.strictObject({
|
|
33
|
+
_key: keySchema,
|
|
34
|
+
_type: z.literal('span'),
|
|
35
|
+
text: plainTextSchema,
|
|
36
|
+
// 'strong' | 'em' | 'code', or a markDefs._key. Kept open on purpose: the
|
|
37
|
+
// annotation vocabulary grows without a schema change.
|
|
38
|
+
marks: z.array(z.string()).default([]),
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* `h1` is absent by design: the page title is the only `h1`. Leaving it
|
|
42
|
+
* available in the body breaks the heading outline and the accessibility tree.
|
|
43
|
+
*/
|
|
44
|
+
const textBlockSchema = z.strictObject({
|
|
45
|
+
_key: keySchema,
|
|
46
|
+
_type: z.literal('block'),
|
|
47
|
+
style: z.enum(['normal', 'h2', 'h3', 'h4', 'blockquote']),
|
|
48
|
+
listItem: z.enum(['bullet', 'number']).optional(),
|
|
49
|
+
level: z.number().int().min(1).optional(),
|
|
50
|
+
children: z.array(spanSchema),
|
|
51
|
+
markDefs: z.array(markDefinitionSchema).default([]),
|
|
52
|
+
});
|
|
53
|
+
const mediaNodeSchema = z.strictObject({
|
|
54
|
+
_key: keySchema,
|
|
55
|
+
_type: z.literal('media'),
|
|
56
|
+
id: z.string().min(1),
|
|
57
|
+
caption: plainTextSchema.optional(),
|
|
58
|
+
});
|
|
59
|
+
export const richTextDocumentSchema = z.array(z.discriminatedUnion('_type', [textBlockSchema, mediaNodeSchema]));
|
|
60
|
+
//# sourceMappingURL=rich-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rich-text.js","sourceRoot":"","sources":["../src/rich-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD;;;;;;;;GAQG;AAEH,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AAEnC;;;;GAIG;AACH,MAAM,oBAAoB,GAAG,CAAC,CAAC,kBAAkB,CAAC,OAAO,EAAE;IACzD,CAAC,CAAC,YAAY,CAAC;QACb,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;QACxB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACvB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,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AAM,eAAe,GAAG,CAAC,CAAC,YAAY,CAAC;IACrC,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACzB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACrB,OAAO,EAAE,eAAe,CAAC,QAAQ,EAAE;CACpC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC3C,CAAC,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC,CAClE,CAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { BlockData, BlockSchema } from './field.js';
|
|
3
|
+
/**
|
|
4
|
+
* Contract B, "Manifeste de bloc", frozen at `blocks@1.0` on 2026-08-13.
|
|
5
|
+
*/
|
|
6
|
+
/** Feeds the refusal to build statically. `server` and `edge` need a request. */
|
|
7
|
+
export declare const BLOCK_RUNTIMES: readonly ['static', 'server', 'edge'];
|
|
8
|
+
export type BlockRuntime = (typeof BLOCK_RUNTIMES)[number];
|
|
9
|
+
/**
|
|
10
|
+
* `'none'` is not in the contract's example; it is the honest answer for the
|
|
11
|
+
* blocks that carry no heading at all — `prose`, `gallery`, `quote`, `embed`.
|
|
12
|
+
* Leaving `headingLevel` merely absent would let a theme invent one and break
|
|
13
|
+
* the document outline.
|
|
14
|
+
*/
|
|
15
|
+
export declare const HEADING_LEVELS: readonly ['none', 'h1', 'h2', 'h3', 'h4'];
|
|
16
|
+
export type HeadingLevel = (typeof HEADING_LEVELS)[number];
|
|
17
|
+
export interface BlockA11y {
|
|
18
|
+
/** The level the block's own title is rendered at, if it has one. */
|
|
19
|
+
readonly headingLevel: HeadingLevel;
|
|
20
|
+
}
|
|
21
|
+
export interface BlockIdentity<N extends string = string> {
|
|
22
|
+
/**
|
|
23
|
+
* Stable for as long as the block exists. It survives a reorder, a
|
|
24
|
+
* translation and a version restore — which is what makes commenting on one
|
|
25
|
+
* block, diffing two versions readably, and reindexing only the blocks that
|
|
26
|
+
* actually changed possible.
|
|
27
|
+
*/
|
|
28
|
+
readonly _key: string;
|
|
29
|
+
/** The block's name in the vocabulary. Discriminates a mixed block list. */
|
|
30
|
+
readonly _type: N;
|
|
31
|
+
/**
|
|
32
|
+
* The schema version the stored data conforms to.
|
|
33
|
+
*
|
|
34
|
+
* Not spelled out in the contract, and unavoidable: "a block whose schema
|
|
35
|
+
* version has moved is migrated on load" needs to know where the data starts
|
|
36
|
+
* from. Without it, a migration is a guess.
|
|
37
|
+
*/
|
|
38
|
+
readonly _version: string;
|
|
39
|
+
}
|
|
40
|
+
/** A block as it is stored inside a content entry. */
|
|
41
|
+
export type PlacedBlock<N extends string = string, S extends BlockSchema = BlockSchema> = BlockIdentity<N> & BlockData<S>;
|
|
42
|
+
/** A block of unknown type, as read from storage before it is dispatched. */
|
|
43
|
+
export interface UnknownPlacedBlock extends BlockIdentity {
|
|
44
|
+
readonly [field: string]: unknown;
|
|
45
|
+
}
|
|
46
|
+
export interface BlockManifest<N extends string, S extends BlockSchema> {
|
|
47
|
+
readonly name: N;
|
|
48
|
+
/** Semver. Changing a block's schema is a major bump (contract B). */
|
|
49
|
+
readonly version: string;
|
|
50
|
+
readonly schema: S;
|
|
51
|
+
readonly runtime: BlockRuntime;
|
|
52
|
+
/**
|
|
53
|
+
* The vocabulary block to fall back on when the active theme does not
|
|
54
|
+
* implement this one. `null` for the twelve, required for anything a theme
|
|
55
|
+
* ships of its own — that requirement is what prevents lock-in.
|
|
56
|
+
*/
|
|
57
|
+
readonly fallback: string | null;
|
|
58
|
+
readonly a11y: BlockA11y;
|
|
59
|
+
}
|
|
60
|
+
export interface BlockDefinition<N extends string = string, S extends BlockSchema = BlockSchema> extends BlockManifest<N, S> {
|
|
61
|
+
/** Validator for a whole placed block, envelope included. */
|
|
62
|
+
readonly validator: z.ZodType<PlacedBlock<N, S>>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* A definition whose name and schema are not known to the caller — what a
|
|
66
|
+
* registry holds. The validator's output is erased to `unknown` on purpose:
|
|
67
|
+
* every concrete definition is assignable to it, which a precise-but-generic
|
|
68
|
+
* output type would not be.
|
|
69
|
+
*/
|
|
70
|
+
export interface AnyBlockDefinition extends BlockManifest<string, BlockSchema> {
|
|
71
|
+
readonly validator: z.ZodType<unknown>;
|
|
72
|
+
}
|
|
73
|
+
/** The stored shape of the blocks a definition describes. */
|
|
74
|
+
export type BlockValue<D> = D extends BlockDefinition<infer N, infer S> ? PlacedBlock<N, S> : never;
|
|
75
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExD;;GAEG;AAEH,iFAAiF;AACjF,eAAO,MAAM,cAAc,YAAI,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAA;AAEnE,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAA;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,cAAc,YAAI,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU,CAAA;AAEvE,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAA;AAE1D,MAAM,WAAW,SAAS;IACxB,qEAAqE;IACrE,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAA;CACpC;AAED,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACtD;;;;;OAKG;IACH,QAA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AC,OAAO,CAAC,OAAO,CAAC,CAAA;CACvC;AAED,6DAA6D;AAC7D,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,eAAe,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,CAAA"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract B, "Manifeste de bloc", frozen at `blocks@1.0` on 2026-08-13.
|
|
3
|
+
*/
|
|
4
|
+
/** Feeds the refusal to build statically. `server` and `edge` need a request. */
|
|
5
|
+
export const BLOCK_RUNTIMES = ['static', 'server', 'edge'];
|
|
6
|
+
/**
|
|
7
|
+
* `'none'` is not in the contract's example; it is the honest answer for the
|
|
8
|
+
* blocks that carry no heading at all — `prose`, `gallery`, `quote`, `embed`.
|
|
9
|
+
* Leaving `headingLevel` merely absent would let a theme invent one and break
|
|
10
|
+
* the document outline.
|
|
11
|
+
*/
|
|
12
|
+
export const HEADING_LEVELS = ['none', 'h1', 'h2', 'h3', 'h4'];
|
|
13
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA;;GAEG;AAEH,iFAAiF;AACjF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAA;AAInE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type CogentaError } from '@cogenta/core';
|
|
2
|
+
import type { BlockSchema } from './field.js';
|
|
3
|
+
import { type BlockRegistry } from './registry.js';
|
|
4
|
+
import type { BlockDefinition, PlacedBlock, UnknownPlacedBlock } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Validates against one known definition, keeping the block's precise type.
|
|
7
|
+
*
|
|
8
|
+
* The assertion is the counterpart of the one in `defineBlock`: the validator
|
|
9
|
+
* was built from `definition.schema`, so what it returns is exactly the data
|
|
10
|
+
* that schema describes — a fact the compiler cannot re-derive here.
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseBlockWith<N extends string, S extends BlockSchema>(definition: BlockDefinition<N, S>, input: unknown): PlacedBlock<N, S>;
|
|
13
|
+
/** Stamps the envelope on freshly authored data, so `_version` is never guessed. */
|
|
14
|
+
export declare function createBlock<N extends string, S extends BlockSchema>(definition: BlockDefinition<N, S>, key: string, data: Record<string, unknown>): PlacedBlock<N, S>;
|
|
15
|
+
/**
|
|
16
|
+
* Validates one block, looking its definition up by `_type`.
|
|
17
|
+
*
|
|
18
|
+
* Throws a `CogentaError` naming the block and the offending field. An unknown
|
|
19
|
+
* `_type` is a `BLOCK_UNKNOWN`, not a validation failure: the fix is to
|
|
20
|
+
* register the block, not to edit the content.
|
|
21
|
+
*/
|
|
22
|
+
export declare function parseBlock(input: unknown, registry?: BlockRegistry): UnknownPlacedBlock;
|
|
23
|
+
export type BlockParseOutcome = {
|
|
24
|
+
readonly ok: true;
|
|
25
|
+
readonly block: UnknownPlacedBlock;
|
|
26
|
+
} | {
|
|
27
|
+
readonly ok: false;
|
|
28
|
+
readonly error: CogentaError;
|
|
29
|
+
};
|
|
30
|
+
/** For an admin that would rather show the problem than crash on it. */
|
|
31
|
+
export declare function safeParseBlock(input: unknown, registry?: BlockRegistry): BlockParseOutcome;
|
|
32
|
+
/**
|
|
33
|
+
* Validates a whole block zone, and refuses duplicate `_key`s.
|
|
34
|
+
*
|
|
35
|
+
* A repeated key is not cosmetic: comments, diffs and the RAG index are all
|
|
36
|
+
* addressed by key, so two blocks sharing one silently merge in every one of
|
|
37
|
+
* those views.
|
|
38
|
+
*/
|
|
39
|
+
export declare function parseBlocks(inputs: readonly unknown[], registry?: BlockRegistry): UnknownPlacedBlock[];
|
|
40
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAkB,MAAM,eAAe,CAAA;AAGjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,EAAE,KAAK,aAAa,EAAsB,MAAM,eAAe,CAAA;AACtE,OAAO,KAAK,EAEV,eAAe,EACf,WAAW,EACX,kBAAkB,EACnB,MAAM,YAAY,CAAA;AAoCnB;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,WAAW,EACpE,UAAU,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,EACjC,KAAK,EAAE,OAAO,GACb,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAEnB;AAED,oFAAoF;AACpF,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,WAAW,EACjE,UAAU,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,EACjC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAOnB;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,OAAO,EACd,QAAQ,GAAE,aAAkC,GAC3C,kBAAkB,CAOpB;AAED,MAAM,MAAM,iBAAiB,GACzB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAA;CAAE,GACzD;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAA;CAAE,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