@beechcms/core 0.4.3 → 0.6.0-preview.1
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/auth/hash-provider.d.ts.map +1 -1
- package/dist/auth/hash-provider.js +2 -0
- package/dist/auth/password-reset-token.repository.d.ts.map +1 -1
- package/dist/auth/password-reset-token.repository.js +2 -0
- package/dist/auth/session.repository.d.ts.map +1 -1
- package/dist/auth/session.repository.js +2 -0
- package/dist/auth/token-service.d.ts +2 -0
- package/dist/auth/token-service.d.ts.map +1 -1
- package/dist/auth/token-service.js +2 -0
- package/dist/auth/user.repository.d.ts +4 -1
- package/dist/auth/user.repository.d.ts.map +1 -1
- package/dist/auth/user.repository.js +2 -0
- package/dist/automations-grammar-words.d.ts.map +1 -1
- package/dist/automations-grammar-words.js +2 -0
- package/dist/automations.repository.interface.d.ts.map +1 -1
- package/dist/automations.repository.interface.js +2 -0
- package/dist/automations.runner.interface.d.ts.map +1 -1
- package/dist/automations.runner.interface.js +2 -0
- package/dist/automations.runner.stub.d.ts.map +1 -1
- package/dist/automations.runner.stub.js +2 -0
- package/dist/automations.types.d.ts +2 -0
- package/dist/automations.types.d.ts.map +1 -1
- package/dist/automations.types.js +2 -0
- package/dist/clock.d.ts.map +1 -1
- package/dist/clock.js +2 -0
- package/dist/content-scan.repository.d.ts.map +1 -1
- package/dist/content-scan.repository.js +2 -0
- package/dist/content.repository.d.ts +62 -0
- package/dist/content.repository.d.ts.map +1 -1
- package/dist/content.repository.js +18 -0
- package/dist/define-seed.d.ts.map +1 -1
- package/dist/define-seed.js +2 -0
- package/dist/demo-data.repository.d.ts +5 -0
- package/dist/demo-data.repository.d.ts.map +1 -0
- package/dist/demo-data.repository.js +3 -0
- package/dist/engine.d.ts +76 -0
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +253 -8
- package/dist/file-types.d.ts +13 -0
- package/dist/file-types.d.ts.map +1 -0
- package/dist/file-types.js +85 -0
- package/dist/id-generator.d.ts +7 -0
- package/dist/id-generator.d.ts.map +1 -1
- package/dist/id-generator.js +5 -0
- package/dist/idempotency.repository.d.ts.map +1 -1
- package/dist/idempotency.repository.js +2 -0
- package/dist/index.d.ts +12 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -1
- package/dist/layout-permissions.d.ts +3 -0
- package/dist/layout-permissions.d.ts.map +1 -0
- package/dist/layout-permissions.js +11 -0
- package/dist/media.repository.d.ts.map +1 -1
- package/dist/media.repository.js +2 -0
- package/dist/notifications/notification-service.d.ts.map +1 -1
- package/dist/notifications/notification-service.js +2 -0
- package/dist/notifications/notification.repository.d.ts.map +1 -1
- package/dist/notifications/notification.repository.js +2 -9
- package/dist/observability/activity-log.repository.d.ts.map +1 -1
- package/dist/observability/activity-log.repository.js +2 -0
- package/dist/observability/activity-logger.d.ts +2 -2
- package/dist/observability/activity-logger.d.ts.map +1 -1
- package/dist/observability/activity-logger.js +2 -11
- package/dist/observability/analytics.repository.d.ts.map +1 -1
- package/dist/observability/analytics.repository.js +2 -0
- package/dist/policies.d.ts.map +1 -1
- package/dist/policies.js +2 -0
- package/dist/rate-limit/rate-limiter.d.ts.map +1 -1
- package/dist/rate-limit/rate-limiter.js +2 -0
- package/dist/relations.d.ts +28 -0
- package/dist/relations.d.ts.map +1 -0
- package/dist/relations.js +25 -0
- package/dist/richtext-render.d.ts.map +1 -1
- package/dist/richtext-render.js +2 -0
- package/dist/richtext.d.ts.map +1 -1
- package/dist/richtext.js +2 -0
- package/dist/scheduler.interface.d.ts.map +1 -1
- package/dist/scheduler.interface.js +2 -0
- package/dist/scheduler.stub.d.ts.map +1 -1
- package/dist/scheduler.stub.js +2 -0
- package/dist/schema-mutator.d.ts +22 -0
- package/dist/schema-mutator.d.ts.map +1 -0
- package/dist/schema-mutator.js +3 -0
- package/dist/search/search.repository.d.ts.map +1 -1
- package/dist/search/search.repository.js +2 -0
- package/dist/seed-ddl.d.ts +40 -0
- package/dist/seed-ddl.d.ts.map +1 -0
- package/dist/seed-ddl.js +100 -0
- package/dist/seed-layout.d.ts +117 -0
- package/dist/seed-layout.d.ts.map +1 -0
- package/dist/seed-layout.js +169 -0
- package/dist/seed-layout.repository.d.ts +18 -0
- package/dist/seed-layout.repository.d.ts.map +1 -0
- package/dist/seed-layout.repository.js +3 -0
- package/dist/seed-registry.d.ts +23 -1
- package/dist/seed-registry.d.ts.map +1 -1
- package/dist/seed-registry.js +105 -0
- package/dist/seed-validation.d.ts +23 -0
- package/dist/seed-validation.d.ts.map +1 -0
- package/dist/seed-validation.js +156 -0
- package/dist/seed.repository.d.ts +37 -0
- package/dist/seed.repository.d.ts.map +1 -0
- package/dist/seed.repository.js +3 -0
- package/dist/seeds.d.ts.map +1 -1
- package/dist/seeds.js +2 -0
- package/dist/site-settings.repository.d.ts +16 -0
- package/dist/site-settings.repository.d.ts.map +1 -0
- package/dist/site-settings.repository.js +3 -0
- package/dist/slug-utils.d.ts.map +1 -1
- package/dist/slug-utils.js +2 -0
- package/dist/storage.d.ts +12 -38
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +2 -0
- package/dist/types.d.ts +80 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -0
- package/dist/validation.d.ts +23 -17
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +495 -393
- package/dist/webhook-validation.d.ts +3 -0
- package/dist/webhook-validation.d.ts.map +1 -0
- package/dist/webhook-validation.js +6 -0
- package/dist/widget/widget.repository.d.ts.map +1 -1
- package/dist/widget/widget.repository.js +2 -0
- package/package.json +5 -4
package/dist/storage.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* BeechBucket - S3-like interface for object storage in BeechCMS.
|
|
3
|
-
*
|
|
4
|
-
* This interface abstracts the underlying storage provider (R2, S3, or Local)
|
|
5
|
-
* allowing the application to scale without being tied to a specific vendor.
|
|
6
|
-
*/
|
|
7
1
|
export interface PutBucketOptions {
|
|
8
2
|
contentType?: string;
|
|
9
3
|
metadata?: Record<string, string>;
|
|
@@ -14,49 +8,25 @@ export interface GetBucketResult {
|
|
|
14
8
|
size: number;
|
|
15
9
|
metadata?: Record<string, string>;
|
|
16
10
|
}
|
|
11
|
+
export interface PresignOptions {
|
|
12
|
+
/** Duration of the signed URL in seconds. */
|
|
13
|
+
expiresIn: number;
|
|
14
|
+
/** Content-Type bound in the signature (PUT). */
|
|
15
|
+
contentType?: string;
|
|
16
|
+
/** Expected Content-Length in bytes (PUT). */
|
|
17
|
+
contentLength?: number;
|
|
18
|
+
}
|
|
17
19
|
export interface BeechBucket {
|
|
18
|
-
/**
|
|
19
|
-
* Uploads an object to the bucket.
|
|
20
|
-
* @param key The unique key (path) for the object.
|
|
21
|
-
* @param body The data to store.
|
|
22
|
-
* @param options Optional metadata like content type.
|
|
23
|
-
*/
|
|
24
20
|
put(key: string, body: ArrayBuffer | Uint8Array | ReadableStream, options?: PutBucketOptions): Promise<void>;
|
|
25
|
-
/**
|
|
26
|
-
* Retrieves an object from the bucket.
|
|
27
|
-
* @param key The unique key for the object.
|
|
28
|
-
* @returns The object data and metadata, or null if not found.
|
|
29
|
-
*/
|
|
30
21
|
get(key: string): Promise<GetBucketResult | null>;
|
|
31
|
-
/**
|
|
32
|
-
* Deletes an object from the bucket.
|
|
33
|
-
* @param key The unique key for the object.
|
|
34
|
-
*/
|
|
35
22
|
delete(key: string): Promise<void>;
|
|
36
|
-
/**
|
|
37
|
-
* Retrieves metadata for an object without downloading its content.
|
|
38
|
-
* @param key The unique key for the object.
|
|
39
|
-
*/
|
|
40
23
|
head(key: string): Promise<{
|
|
41
24
|
size: number;
|
|
42
25
|
contentType?: string;
|
|
43
26
|
metadata?: Record<string, string>;
|
|
44
27
|
} | null>;
|
|
45
|
-
/**
|
|
46
|
-
* Returns a publicly accessible URL for the given key.
|
|
47
|
-
* The implementation decides if this is a direct vendor URL (CDN)
|
|
48
|
-
* or a proxied URL through the Beech API.
|
|
49
|
-
* @param key The unique key for the object.
|
|
50
|
-
*/
|
|
51
28
|
getUrl(key: string): string;
|
|
52
|
-
/**
|
|
53
|
-
* Calculates the total size of all objects in the bucket.
|
|
54
|
-
* Warning: This may be an expensive operation on some providers.
|
|
55
|
-
*/
|
|
56
29
|
getTotalSize(): Promise<number>;
|
|
57
|
-
/**
|
|
58
|
-
* Lists objects in the bucket.
|
|
59
|
-
*/
|
|
60
30
|
list(options?: {
|
|
61
31
|
prefix?: string;
|
|
62
32
|
limit?: number;
|
|
@@ -68,5 +38,9 @@ export interface BeechBucket {
|
|
|
68
38
|
}>;
|
|
69
39
|
cursor?: string;
|
|
70
40
|
}>;
|
|
41
|
+
/** Generates a signed URL for direct upload (PUT). */
|
|
42
|
+
presignPut(key: string, options: PresignOptions): Promise<string>;
|
|
43
|
+
/** Generates a signed URL for direct read (GET). */
|
|
44
|
+
presignGet(key: string, options: PresignOptions): Promise<string>;
|
|
71
45
|
}
|
|
72
46
|
//# sourceMappingURL=storage.d.ts.map
|
package/dist/storage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,gBAAgB;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,cAAc,GAAG,WAAW,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,cAAc;IAC7B,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,iDA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AAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACnE"}
|
package/dist/storage.js
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -1,10 +1,64 @@
|
|
|
1
|
-
|
|
1
|
+
import type { FileAccept } from './file-types.js';
|
|
2
|
+
export type BranchType = 'text' | 'number' | 'boolean' | 'json' | 'date' | 'richtext' | 'file' | 'tags' | 'relation';
|
|
3
|
+
/** Configurazioni specializzate per il tipo di branch 'number' */
|
|
4
|
+
export interface NumberFieldOptions {
|
|
5
|
+
/** Stile di presentazione visiva. Default: 'decimal' */
|
|
6
|
+
format?: 'decimal' | 'currency' | 'percentage' | 'compact';
|
|
7
|
+
/** Codice valuta ISO 4217 (obbligatorio se format === 'currency'). Es. 'EUR', 'USD' */
|
|
8
|
+
currency?: string;
|
|
9
|
+
/** Testo personalizzato da anteporre al valore formattato */
|
|
10
|
+
prefix?: string;
|
|
11
|
+
/** Unità di misura personalizzata da appendere al valore formattato (es. 'kg', 'm²') */
|
|
12
|
+
suffix?: string;
|
|
13
|
+
/** Numero esplicito di cifre decimali da visualizzare e imporre */
|
|
14
|
+
decimals?: number;
|
|
15
|
+
/** Abilita/disabilita il separatore delle migliaia. Default: true */
|
|
16
|
+
grouping?: boolean;
|
|
17
|
+
/** Meccanismo di input alternativo per l'editor delle entità. Default: 'input' */
|
|
18
|
+
control?: 'input' | 'slider' | 'rating' | 'stepper';
|
|
19
|
+
/** Valore minimo consentito */
|
|
20
|
+
min?: number;
|
|
21
|
+
/** Valore massimo consentito */
|
|
22
|
+
max?: number;
|
|
23
|
+
/** Incremento del valore (es. 1 per interi stretti, 0.5 per mezzi passi) */
|
|
24
|
+
step?: number;
|
|
25
|
+
}
|
|
26
|
+
/** Configurazioni specializzate per il tipo di branch 'file' */
|
|
27
|
+
export interface FileFieldOptions {
|
|
28
|
+
/**
|
|
29
|
+
* Tipo semantico di file accettato.
|
|
30
|
+
* - 'image': immagini renderizzabili come anteprima
|
|
31
|
+
* - 'document': PDF/Office/text
|
|
32
|
+
* - 'any': qualsiasi file (default — UI mostra icona generica, nessun tentativo di render immagine)
|
|
33
|
+
* Default: 'any'.
|
|
34
|
+
*/
|
|
35
|
+
accept?: FileAccept;
|
|
36
|
+
/**
|
|
37
|
+
* Dimensione massima del singolo file in byte.
|
|
38
|
+
* NOTA: il backend /upload applica MAX_FILE_SIZE_BYTES (5MB) globale —
|
|
39
|
+
* questo campo è informativo per la UI; non viene enforced in upload.
|
|
40
|
+
* Default: 5_242_880.
|
|
41
|
+
*/
|
|
42
|
+
maxSize?: number;
|
|
43
|
+
}
|
|
2
44
|
/** Branch: definizione di una proprietà. alias = nome colonna SQL. */
|
|
3
45
|
export interface Branch {
|
|
46
|
+
/**
|
|
47
|
+
* Stable logical id of this branch, e.g. 'br_01', 'br_title'.
|
|
48
|
+
* Format: ^br_[A-Za-z0-9]+$ — enforced by SeedRegistry at boot (sprint 04-pre).
|
|
49
|
+
*
|
|
50
|
+
* Used by every persistence layer that needs a reference that survives alias renames
|
|
51
|
+
* (FTS triggers, draft indexing, layout JSON, automations). NEVER use alias for that purpose.
|
|
52
|
+
*
|
|
53
|
+
* The Botanical Engine still emits alias as the SQL column name; id is a logical handle.
|
|
54
|
+
*/
|
|
55
|
+
id: string;
|
|
4
56
|
/** Alias human-readable, usato nel payload API e come nome colonna SQL nella tabella dedicata */
|
|
5
57
|
alias: string;
|
|
6
58
|
/** Etichetta per la UI */
|
|
7
59
|
label: string;
|
|
60
|
+
/** Testo di aiuto opzionale mostrato come tooltip accanto al label nella form. UI-only, ignorato dall'engine. */
|
|
61
|
+
hint?: string;
|
|
8
62
|
/** Tipo del valore */
|
|
9
63
|
type: BranchType;
|
|
10
64
|
/**
|
|
@@ -45,6 +99,27 @@ export interface Branch {
|
|
|
45
99
|
/** Il campo è incluso nelle risposte della Public API. Default: true */
|
|
46
100
|
public?: boolean;
|
|
47
101
|
};
|
|
102
|
+
/** Opzioni avanzate per i campi numerici. Ignorato se type !== 'number' */
|
|
103
|
+
numberOptions?: NumberFieldOptions;
|
|
104
|
+
/** Opzioni avanzate per i campi file. Ignorato se type !== 'file' */
|
|
105
|
+
fileOptions?: FileFieldOptions;
|
|
106
|
+
/**
|
|
107
|
+
* Slug of the referenced Seed (without the `content_` prefix).
|
|
108
|
+
* REQUIRED when `type === 'relation'`. Ignored otherwise.
|
|
109
|
+
* Example: 'team' → references table `content_team(id)`.
|
|
110
|
+
*/
|
|
111
|
+
targetSeed?: string;
|
|
112
|
+
/**
|
|
113
|
+
* SQLite ON DELETE rule applied to the foreign-key constraint.
|
|
114
|
+
* Defaults to 'SET NULL' when `type === 'relation'` and no value is provided.
|
|
115
|
+
* - CASCADE : delete dependent rows when the parent is deleted.
|
|
116
|
+
* - SET NULL : null out the column when the parent is deleted (default).
|
|
117
|
+
* - RESTRICT : block parent deletion while dependent rows exist.
|
|
118
|
+
*
|
|
119
|
+
* NOTE: When `multiple: true` (introduced in Sprint 5 for many-to-many), this
|
|
120
|
+
* rule applies to the FK from the junction table to the target table.
|
|
121
|
+
*/
|
|
122
|
+
onDelete?: 'CASCADE' | 'SET NULL' | 'RESTRICT';
|
|
48
123
|
}
|
|
49
124
|
/** Dashboard-specific config embedded in a Seed. All fields optional — defaults applied by the dashboard. */
|
|
50
125
|
export interface DashboardSeedConfig {
|
|
@@ -95,6 +170,10 @@ export interface Seed {
|
|
|
95
170
|
branches: Branch[];
|
|
96
171
|
/** Optional dashboard-specific UI config. Ignored by the Botanical Engine. */
|
|
97
172
|
dashboard?: DashboardSeedConfig;
|
|
173
|
+
/** Custom editor form layout. Absent when no override is stored.
|
|
174
|
+
* Populated server-side by GET /api/schema. Ignored by the Botanical Engine.
|
|
175
|
+
* Type matches FormLayout from seed-layout.ts — kept as unknown here to avoid circular imports. */
|
|
176
|
+
layout?: unknown;
|
|
98
177
|
}
|
|
99
178
|
export type FilterOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'contains' | 'not_contains' | 'starts_with' | 'ends_with' | 'is_empty' | 'is_not_empty' | 'in' | 'not_in' | 'has_tag' | 'has_any_tag' | 'has_all_tags';
|
|
100
179
|
export type FilterType = 'text' | 'number' | 'date' | 'boolean' | 'tags' | 'select' | 'system' | 'json';
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAA;AAEpH,kEAAkE;AAClE,MAAM,WAAW,kBAAkB;IAEjC,wDAAwD;IACxD,MAAM,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,YAAY,GAAG,SAAS,CAAA;IAC1D,uFAAuF;IACvF,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,wFAAwF;IACxF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAGlB,kFAAkF;IAClF,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAA;IAGnD,+BAA+B;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,gCAAgC;IAChC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,4EAA4E;IAC5E,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,gEAAgE;AAChE,MAAM,WAAW,gB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C/C"}
|
package/dist/types.js
CHANGED
package/dist/validation.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type { Seed } from './types.js';
|
|
1
|
+
import type { Branch, Seed } from './types.js';
|
|
2
|
+
import type { FileAccept } from './file-types.js';
|
|
3
|
+
import type { IIdGenerator } from './id-generator.js';
|
|
2
4
|
export interface ValidationDetail {
|
|
3
5
|
field: string;
|
|
4
6
|
expected: string;
|
|
@@ -11,6 +13,13 @@ export interface ValidateSeedPayloadOptions {
|
|
|
11
13
|
requireAtLeastOneValidField?: boolean;
|
|
12
14
|
enforceRequiredFields?: boolean;
|
|
13
15
|
maxTextLength?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Required when the seed has branches of type `'relation'`.
|
|
18
|
+
* Must be the same IIdGenerator instance used for id generation so that
|
|
19
|
+
* swapping implementations (e.g. ULIDs) automatically updates validation.
|
|
20
|
+
* Do NOT pass a concrete class — inject via the middleware / factory.
|
|
21
|
+
*/
|
|
22
|
+
idGenerator?: IIdGenerator;
|
|
14
23
|
}
|
|
15
24
|
export interface ValidateSeedPayloadResult {
|
|
16
25
|
data: Record<string, unknown>;
|
|
@@ -20,25 +29,22 @@ export interface ValidateSeedPayloadResult {
|
|
|
20
29
|
requiredFieldsMissing: string[];
|
|
21
30
|
hasAnyValidField: boolean;
|
|
22
31
|
}
|
|
32
|
+
declare const STATUS_VALUES: readonly ["draft", "review", "published"];
|
|
33
|
+
export declare function resolveFileOptions(branch: Branch): {
|
|
34
|
+
accept: FileAccept;
|
|
35
|
+
maxSize: number;
|
|
36
|
+
};
|
|
23
37
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* Hashing occurs AFTER validation, not before.
|
|
30
|
-
* This ensures that the validated value is the original raw value,
|
|
31
|
-
* not the digest — avoiding false failures on fields with formats (e.g., email).
|
|
38
|
+
* Schema-driven validation and sanitization of a seed payload.
|
|
39
|
+
* - Drops unknown aliases (reports them as details).
|
|
40
|
+
* - Runs branch-specific schemas to coerce / sanitize known values.
|
|
41
|
+
* - Optionally enforces required-on-create / required-on-update branches.
|
|
42
|
+
* - Never throws on malformed input — returns a structured result.
|
|
32
43
|
*/
|
|
33
44
|
export declare function validateAndSanitizeSeedPayload(seed: Seed, payload: Record<string, unknown>, options?: ValidateSeedPayloadOptions): ValidateSeedPayloadResult;
|
|
34
45
|
/**
|
|
35
|
-
*
|
|
36
|
-
*/
|
|
37
|
-
export declare function isValidContentStatus(value: unknown): value is 'draft' | 'review' | 'published';
|
|
38
|
-
/**
|
|
39
|
-
* Full Zod runtime compiler:
|
|
40
|
-
* - compile per-seed/per-operation with cache
|
|
41
|
-
* - strict unknown aliases
|
|
42
|
-
* - required fields by operation
|
|
46
|
+
* Type-guard for the content status enum.
|
|
43
47
|
*/
|
|
48
|
+
export declare function isValidContentStatus(value: unknown): value is (typeof STATUS_VALUES)[number];
|
|
49
|
+
export {};
|
|
44
50
|
//# sourceMappingURL=validation.d.ts.map
|
package/dist/validation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,0BAA0B;IACzC,SAAS,CAAC,EAAE,OAA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