@fayz-ai/core 0.9.0 → 0.10.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/README.md +2 -2
- package/dist/access/index.js.map +1 -1
- package/dist/{chunk-L4TLMYGC.js → chunk-6RBW2Y5K.js} +3 -3
- package/dist/chunk-6RBW2Y5K.js.map +1 -0
- package/dist/chunk-732GZEUI.js +1592 -0
- package/dist/chunk-732GZEUI.js.map +1 -0
- package/dist/{chunk-X5THHG6T.js → chunk-CPMHCTX3.js} +3 -3
- package/dist/chunk-CPMHCTX3.js.map +1 -0
- package/dist/{chunk-V2MSAUHO.js → chunk-JO7Z2AOE.js} +2 -2
- package/dist/chunk-JO7Z2AOE.js.map +1 -0
- package/dist/{chunk-5RJVUC6J.js → chunk-M27JPX3K.js} +12 -3
- package/dist/chunk-M27JPX3K.js.map +1 -0
- package/dist/chunk-OXQGRJZT.js +125 -0
- package/dist/chunk-OXQGRJZT.js.map +1 -0
- package/dist/data/backend-env.d.ts +38 -0
- package/dist/data/backend-env.d.ts.map +1 -0
- package/dist/data/index.js +1 -1
- package/dist/entity/events.d.ts +14 -0
- package/dist/entity/events.d.ts.map +1 -0
- package/dist/events/envelope.d.ts +31 -0
- package/dist/events/envelope.d.ts.map +1 -0
- package/dist/events/index.d.ts +4 -0
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/log.d.ts +44 -0
- package/dist/events/log.d.ts.map +1 -0
- package/dist/events/types.d.ts +40 -0
- package/dist/events/types.d.ts.map +1 -0
- package/dist/i18n/index.d.ts +10 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/index.d.ts +27 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +388 -52
- package/dist/index.js.map +1 -1
- package/dist/integrations/index.js +1 -1
- package/dist/{integrations/index.d.ts → integrations.d.ts} +2 -2
- package/dist/integrations.d.ts.map +1 -0
- package/dist/{address/index.d.ts → lib/address.d.ts} +1 -1
- package/dist/{address/index.d.ts.map → lib/address.d.ts.map} +1 -1
- package/dist/{phone/index.d.ts → lib/phone.d.ts} +1 -1
- package/dist/lib/phone.d.ts.map +1 -0
- package/dist/{seo/index.d.ts → lib/seo.d.ts} +18 -1
- package/dist/lib/seo.d.ts.map +1 -0
- package/dist/{tenant/index.d.ts → lib/tenant.d.ts} +1 -1
- package/dist/lib/tenant.d.ts.map +1 -0
- package/dist/manifest/index.d.ts +1 -1
- package/dist/manifest/index.d.ts.map +1 -1
- package/dist/messaging/index.d.ts +3 -0
- package/dist/messaging/index.d.ts.map +1 -0
- package/dist/messaging/registry.d.ts +35 -0
- package/dist/messaging/registry.d.ts.map +1 -0
- package/dist/messaging/types.d.ts +67 -0
- package/dist/messaging/types.d.ts.map +1 -0
- package/dist/plugin/index.js +2 -1
- package/dist/plugin/runtime.d.ts +17 -0
- package/dist/plugin/runtime.d.ts.map +1 -1
- package/dist/registry/block-catalog.d.ts +78 -0
- package/dist/registry/block-catalog.d.ts.map +1 -0
- package/dist/registry/block-constraints.d.ts +64 -0
- package/dist/registry/block-constraints.d.ts.map +1 -0
- package/dist/registry/block-schema.d.ts +69 -0
- package/dist/registry/block-schema.d.ts.map +1 -0
- package/dist/registry/blocks.d.ts +84 -0
- package/dist/registry/blocks.d.ts.map +1 -0
- package/dist/registry/entities.d.ts +153 -0
- package/dist/registry/entities.d.ts.map +1 -0
- package/dist/registry/extension-points.d.ts +117 -0
- package/dist/registry/extension-points.d.ts.map +1 -0
- package/dist/registry/handles.d.ts +41 -0
- package/dist/registry/handles.d.ts.map +1 -0
- package/dist/registry/index.d.ts +41 -41
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/loaders.d.ts +55 -0
- package/dist/registry/loaders.d.ts.map +1 -0
- package/dist/registry/registry-class.d.ts +157 -0
- package/dist/registry/registry-class.d.ts.map +1 -0
- package/dist/registry/schema-check.d.ts +14 -0
- package/dist/registry/schema-check.d.ts.map +1 -0
- package/dist/router/index.d.ts +78 -1
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/index.js +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/{testing/index.d.ts → testing.d.ts} +3 -3
- package/dist/testing.d.ts.map +1 -0
- package/dist/types/analytics.d.ts +196 -0
- package/dist/types/analytics.d.ts.map +1 -0
- package/dist/types/crud.d.ts +22 -2
- package/dist/types/crud.d.ts.map +1 -1
- package/dist/types/plugins.d.ts +55 -1
- package/dist/types/plugins.d.ts.map +1 -1
- package/package.json +6 -18
- package/dist/blocks/index.d.ts +0 -25
- package/dist/blocks/index.d.ts.map +0 -1
- package/dist/chunk-5RJVUC6J.js.map +0 -1
- package/dist/chunk-L4TLMYGC.js.map +0 -1
- package/dist/chunk-V2MSAUHO.js.map +0 -1
- package/dist/chunk-X5THHG6T.js.map +0 -1
- package/dist/chunk-Y2C2FBQP.js +0 -35
- package/dist/chunk-Y2C2FBQP.js.map +0 -1
- package/dist/chunk-YH25Y4FW.js +0 -311
- package/dist/chunk-YH25Y4FW.js.map +0 -1
- package/dist/integrations/index.d.ts.map +0 -1
- package/dist/phone/index.d.ts.map +0 -1
- package/dist/seo/index.d.ts.map +0 -1
- package/dist/tenant/index.d.ts.map +0 -1
- package/dist/testing/index.d.ts.map +0 -1
- package/src/access/denial.ts +0 -33
- package/src/access/engine.test.ts +0 -48
- package/src/access/engine.ts +0 -136
- package/src/access/index.ts +0 -14
- package/src/access/limits.ts +0 -18
- package/src/address/index.ts +0 -188
- package/src/app/render.tsx +0 -69
- package/src/blocks/index.tsx +0 -68
- package/src/data/archetype.ts +0 -255
- package/src/data/bulk.ts +0 -35
- package/src/data/cached.ts +0 -55
- package/src/data/count.test.ts +0 -152
- package/src/data/count.ts +0 -131
- package/src/data/filters.test.ts +0 -70
- package/src/data/filters.ts +0 -90
- package/src/data/index.ts +0 -11
- package/src/data/mock.ts +0 -90
- package/src/data/platform-api.ts +0 -209
- package/src/data/refresh.ts +0 -115
- package/src/data/resolve.ts +0 -126
- package/src/data/supabase.ts +0 -230
- package/src/data/types.ts +0 -50
- package/src/entity/index.ts +0 -2
- package/src/entity/registry.ts +0 -49
- package/src/events/index.tsx +0 -82
- package/src/i18n/index.ts +0 -476
- package/src/i18n/shell-translations.en.ts +0 -875
- package/src/i18n/shell-translations.pt-br.ts +0 -873
- package/src/index.ts +0 -217
- package/src/integrations/index.ts +0 -237
- package/src/lib/cache.ts +0 -118
- package/src/lib/csv.ts +0 -54
- package/src/lib/format.ts +0 -58
- package/src/manifest/app-manifest.schema.json +0 -676
- package/src/manifest/index.ts +0 -518
- package/src/manifest/serialize.ts +0 -52
- package/src/phone/index.ts +0 -85
- package/src/plugin/createSafeDataProvider.ts +0 -30
- package/src/plugin/index.ts +0 -1
- package/src/plugin/runtime.ts +0 -331
- package/src/registry/index.ts +0 -163
- package/src/router/history.ts +0 -86
- package/src/router/index.ts +0 -29
- package/src/runtime/index.ts +0 -15
- package/src/runtime/oauth.ts +0 -219
- package/src/search/engine.ts +0 -559
- package/src/search/index.ts +0 -25
- package/src/search/text.ts +0 -206
- package/src/search/types.ts +0 -75
- package/src/seo/index.ts +0 -128
- package/src/tenant/index.ts +0 -38
- package/src/testing/index.ts +0 -116
- package/src/types/auth.ts +0 -41
- package/src/types/billing.ts +0 -39
- package/src/types/crud.ts +0 -184
- package/src/types/entities.ts +0 -142
- package/src/types/entitlements.ts +0 -45
- package/src/types/i18n.ts +0 -7
- package/src/types/index.ts +0 -11
- package/src/types/org.ts +0 -137
- package/src/types/payment.ts +0 -44
- package/src/types/permissions.ts +0 -32
- package/src/types/plugins.ts +0 -480
- package/src/types/theme.ts +0 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../src/registry/blocks.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAW7C,MAAM,WAAW,SAAS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wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,uBAAuB;IAItE,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI;IAI5D,MAAM,IAAI,KAAK,CAAC,SAAS;CAQ1B;AAiBD,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,KAAK,CAAC,YAAY,GAAG,IAAI,CAkD3G;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAmBnF;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG,KAAK,CAAC,SAAS,CAI7E"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { Registry } from './registry-class';
|
|
2
|
+
import type { JsonSchema, RegistryEntryDescriptor, RegistrySource } from './registry-class';
|
|
3
|
+
import type { FieldDef } from '../types/crud';
|
|
4
|
+
/** The field-type vocabulary an entity may declare. */
|
|
5
|
+
export type EntityFieldType = 'text' | 'richtext' | 'number' | 'boolean' | 'json' | 'image' | 'url' | 'ref' | 'point' | 'datetime';
|
|
6
|
+
/** The vocabulary as a runtime value, for catalogs and I2 error messages.
|
|
7
|
+
* `satisfies` + exhaustiveness keep the union and the list from drifting. */
|
|
8
|
+
export declare const ENTITY_FIELD_TYPES: readonly ["text", "richtext", "number", "boolean", "json", "image", "url", "ref", "point", "datetime"];
|
|
9
|
+
export interface EntityField {
|
|
10
|
+
type: EntityFieldType;
|
|
11
|
+
/** Human label — drives the admin form and the agent's understanding. */
|
|
12
|
+
label?: string;
|
|
13
|
+
help?: string;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
default?: unknown;
|
|
16
|
+
/** `ref` only: the entity key this field points to (stores that entity's record id). */
|
|
17
|
+
entity?: string;
|
|
18
|
+
}
|
|
19
|
+
export type EntityReadAccess = 'public' | 'staff';
|
|
20
|
+
/**
|
|
21
|
+
* Who reads and who writes. `write` is 'staff' only on purpose: shopper-writable
|
|
22
|
+
* entities (reviews) need the action/rate-limit layer (M7), not an RLS grant.
|
|
23
|
+
*/
|
|
24
|
+
export interface EntityAccess {
|
|
25
|
+
read: EntityReadAccess;
|
|
26
|
+
write: 'staff';
|
|
27
|
+
}
|
|
28
|
+
/** Where records live. Generic jsonb storage first (I5); promoting a hot entity
|
|
29
|
+
* to typed columns changes THIS value, and nothing else callers see. */
|
|
30
|
+
export interface EntityStorageDescriptor {
|
|
31
|
+
mode: 'generic' | 'dedicated';
|
|
32
|
+
/** Physical table. 'generic' mode shares it across entities. */
|
|
33
|
+
table: string;
|
|
34
|
+
}
|
|
35
|
+
export interface EntityDeclarationInput {
|
|
36
|
+
/** Human title (singular). Defaults to the key. */
|
|
37
|
+
title?: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
fields: Record<string, EntityField>;
|
|
40
|
+
/** Only 'tenant' exists today: every record belongs to one store. */
|
|
41
|
+
scope?: 'tenant';
|
|
42
|
+
/** Default: staff-only both ways — public exposure is opt-in, never implied. */
|
|
43
|
+
access?: Partial<EntityAccess>;
|
|
44
|
+
/** Field-name tuples to index for querying/filtering. */
|
|
45
|
+
indexes?: readonly (readonly string[])[];
|
|
46
|
+
/** Field whose value titles a record in lists. Default: first text field. */
|
|
47
|
+
titleField?: string;
|
|
48
|
+
/** Fields blocks display by default (entityList). Default: every non-json field. */
|
|
49
|
+
displayFields?: readonly string[];
|
|
50
|
+
}
|
|
51
|
+
export interface EntityDeclaration {
|
|
52
|
+
key: string;
|
|
53
|
+
title: string;
|
|
54
|
+
description?: string;
|
|
55
|
+
fields: Record<string, EntityField>;
|
|
56
|
+
scope: 'tenant';
|
|
57
|
+
access: EntityAccess;
|
|
58
|
+
indexes: readonly (readonly string[])[];
|
|
59
|
+
titleField?: string;
|
|
60
|
+
displayFields: readonly string[];
|
|
61
|
+
storage: EntityStorageDescriptor;
|
|
62
|
+
}
|
|
63
|
+
/** The shared jsonb records table (see @fayz-ai/shop migrations 0030). */
|
|
64
|
+
export declare const GENERIC_ENTITY_TABLE = "plg_entity_records";
|
|
65
|
+
/** Structural record columns a declared field must not shadow. */
|
|
66
|
+
export declare const RESERVED_ENTITY_FIELDS: readonly ["id", "slug", "entity", "tenant_id", "created_at", "updated_at"];
|
|
67
|
+
export declare const entityDeclarationRegistry: Registry<EntityDeclaration>;
|
|
68
|
+
/**
|
|
69
|
+
* Declare an entity. One call → registry entry on the uniform meta envelope,
|
|
70
|
+
* with the record JSON Schema as `propsSchema` — the same emission discipline
|
|
71
|
+
* as `defineBlock` (I1), so every catalog consumer reads entities and blocks
|
|
72
|
+
* with one parser.
|
|
73
|
+
*/
|
|
74
|
+
export declare function defineEntity(key: string, input: EntityDeclarationInput, meta?: {
|
|
75
|
+
source?: RegistrySource;
|
|
76
|
+
pluginId?: string;
|
|
77
|
+
since?: string;
|
|
78
|
+
}): EntityDeclaration;
|
|
79
|
+
/** Resolve a declaration or throw naming the valid set — the I2 contract. */
|
|
80
|
+
export declare function resolveEntityDeclaration(key: string): EntityDeclaration;
|
|
81
|
+
export declare function hasEntityDeclaration(key: string): boolean;
|
|
82
|
+
/** All declared entity keys, sorted. */
|
|
83
|
+
export declare function listEntityDeclarations(): string[];
|
|
84
|
+
/** Test seam — a suite that declares entities must not leak into the next. */
|
|
85
|
+
export declare function clearEntityDeclarations(): void;
|
|
86
|
+
/**
|
|
87
|
+
* The JSON Schema one record's `data` is validated against — on write, in the
|
|
88
|
+
* admin form, and as the agent's generation contract. `additionalProperties:
|
|
89
|
+
* false` is the schema-level I2: a field the declaration does not know is an
|
|
90
|
+
* error, not silently-unfilterable baggage (the Medusa `metadata` disease).
|
|
91
|
+
*/
|
|
92
|
+
export declare function entityRecordSchema(declaration: Pick<EntityDeclaration, 'fields' | 'title' | 'description'>): JsonSchema;
|
|
93
|
+
export interface EntityRecordIssue {
|
|
94
|
+
/** Dotted path into the record data ('hours', 'geo.lat'). */
|
|
95
|
+
path: string;
|
|
96
|
+
code: 'unknown-field' | 'missing-field' | 'invalid-value';
|
|
97
|
+
message: string;
|
|
98
|
+
/** The valid set, on unknown-id errors — what the agent corrects on. */
|
|
99
|
+
valid?: string[];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Validate one record's `data` against a declaration — the write gate every
|
|
103
|
+
* EntityStore implementation runs. Pure and total: returns issues, never throws.
|
|
104
|
+
*/
|
|
105
|
+
export declare function validateEntityRecordData(declaration: Pick<EntityDeclaration, 'fields'>, data: unknown): EntityRecordIssue[];
|
|
106
|
+
/** The uniform envelope plus the entity-specific fields the agent reads. */
|
|
107
|
+
export interface EntityDescriptor extends RegistryEntryDescriptor {
|
|
108
|
+
/** JSON Schema for a record's data (alias of `schema`, named for intent). */
|
|
109
|
+
recordSchema?: JsonSchema;
|
|
110
|
+
access: EntityAccess;
|
|
111
|
+
scope: 'tenant';
|
|
112
|
+
storage: EntityStorageDescriptor;
|
|
113
|
+
indexes: readonly (readonly string[])[];
|
|
114
|
+
titleField?: string;
|
|
115
|
+
displayFields: readonly string[];
|
|
116
|
+
}
|
|
117
|
+
/** Every declared entity reduced to its descriptor, sorted by key — what
|
|
118
|
+
* describeStore publishes and the agent generates against. */
|
|
119
|
+
export declare function describeEntities(): EntityDescriptor[];
|
|
120
|
+
export interface EntityAdminForm {
|
|
121
|
+
entity: string;
|
|
122
|
+
title: string;
|
|
123
|
+
fields: FieldDef[];
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The admin CRUD form for an entity, emitted from the declaration as data.
|
|
127
|
+
* Field order is declaration order; labels default to the field name; `ref`
|
|
128
|
+
* fields become relation pickers over the generic records table filtered to
|
|
129
|
+
* the target entity.
|
|
130
|
+
*/
|
|
131
|
+
export declare function entityAdminForm(declaration: EntityDeclaration): EntityAdminForm;
|
|
132
|
+
/** Core record kinds that accept sidecar fields. */
|
|
133
|
+
export declare const SIDECAR_REFERENCES: readonly ["product", "category"];
|
|
134
|
+
export type SidecarReference = (typeof SIDECAR_REFERENCES)[number];
|
|
135
|
+
export interface SidecarDeclaration {
|
|
136
|
+
reference: SidecarReference;
|
|
137
|
+
fields: Record<string, EntityField>;
|
|
138
|
+
}
|
|
139
|
+
export declare const sidecarDeclarationRegistry: Registry<SidecarDeclaration>;
|
|
140
|
+
/**
|
|
141
|
+
* Declare custom fields on a core record kind. One declaration per reference
|
|
142
|
+
* (re-declaring replaces — registry semantics, so an app's registry.tsx wins).
|
|
143
|
+
*/
|
|
144
|
+
export declare function defineSidecarFields(reference: SidecarReference, fields: Record<string, EntityField>, meta?: {
|
|
145
|
+
source?: RegistrySource;
|
|
146
|
+
pluginId?: string;
|
|
147
|
+
}): SidecarDeclaration;
|
|
148
|
+
/** Resolve a sidecar declaration or throw naming the valid set (I2). */
|
|
149
|
+
export declare function resolveSidecarDeclaration(reference: string): SidecarDeclaration;
|
|
150
|
+
export declare function hasSidecarDeclaration(reference: string): boolean;
|
|
151
|
+
/** Test seam. */
|
|
152
|
+
export declare function clearSidecarDeclarations(): void;
|
|
153
|
+
//# sourceMappingURL=entities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../src/registry/entities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAC3F,OAAO,KAAK,EAAE,QAAQ,EAAa,MAAM,eAAe,CAAA;AA6BxD,uDAAuD;AACvD,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,UAAU,GACV,QAAQ,GACR,SAAS,GAC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A0B,8BAA8C,CAAA;AAErF;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,gBAAgB,EAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EACnC,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GACxD,kBAAkB,CAoBpB;AAED,wEAAwE;AACxE,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,GAAG,kBAAkB,CAW/E;AAED,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAEhE;AAED,iBAAiB;AACjB,wBAAgB,wBAAwB,IAAI,IAAI,CAE/C"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Registry } from './registry-class';
|
|
2
|
+
import type { JsonSchema, RegistryEntryDescriptor, RegistrySource } from './registry-class';
|
|
3
|
+
export type ExtensionPointMode = 'many' | 'escape';
|
|
4
|
+
export interface ExtensionPointDeclaration {
|
|
5
|
+
/** Namespaced id: `namespace.point` (e.g. 'cart.lineAnnotation'). */
|
|
6
|
+
id: string;
|
|
7
|
+
description: string;
|
|
8
|
+
/** JSON Schema every invocation's input is checked against. */
|
|
9
|
+
input: JsonSchema;
|
|
10
|
+
/** JSON Schema every handler's (non-null) return is checked against. */
|
|
11
|
+
output: JsonSchema;
|
|
12
|
+
/**
|
|
13
|
+
* 'many' (default): any number of handlers, dependency-ordered, outputs
|
|
14
|
+
* collected. 'escape': at most ONE handler, `Output | null` return, non-null
|
|
15
|
+
* short-circuits the caller's default path (I4).
|
|
16
|
+
*/
|
|
17
|
+
mode?: ExtensionPointMode;
|
|
18
|
+
source?: RegistrySource;
|
|
19
|
+
since?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ExtensionHandlerOptions {
|
|
22
|
+
/** Handler ids that must run before this one (dependency ordering, I3). */
|
|
23
|
+
after?: readonly string[];
|
|
24
|
+
description?: string;
|
|
25
|
+
source?: RegistrySource;
|
|
26
|
+
pluginId?: string;
|
|
27
|
+
}
|
|
28
|
+
export type ExtensionHandler<I = unknown, O = unknown> = (input: I) => O | Promise<O>;
|
|
29
|
+
export declare const extensionPointRegistry: Registry<ExtensionPointDeclaration>;
|
|
30
|
+
/**
|
|
31
|
+
* Declare an extension point. Idempotent per id (a re-declaration replaces the
|
|
32
|
+
* spec but keeps registered handlers), so HMR and repeated register-all calls
|
|
33
|
+
* are safe. The id must be namespaced `namespace.point` — two generated
|
|
34
|
+
* extensions can then never collide on a bare name (I3).
|
|
35
|
+
*/
|
|
36
|
+
export declare function defineExtensionPoint(declaration: ExtensionPointDeclaration): void;
|
|
37
|
+
/**
|
|
38
|
+
* Register a handler at a point. Unknown point → hard error naming the valid
|
|
39
|
+
* set (I2). On an escape-valve point, a SECOND registration is a hard error
|
|
40
|
+
* naming who already holds it — the valve stays a valve, never a graph.
|
|
41
|
+
* Re-registering the SAME handler id replaces it (HMR safety), on any mode.
|
|
42
|
+
*/
|
|
43
|
+
export declare function registerExtensionHandler<I = unknown, O = unknown>(pointId: string, handlerId: string, handler: ExtensionHandler<I, O>, options?: ExtensionHandlerOptions): void;
|
|
44
|
+
/** Remove one handler (test seams, HMR teardown). Unknown ids are a no-op. */
|
|
45
|
+
export declare function unregisterExtensionHandler(pointId: string, handlerId: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* One collected result of a many-handler run: which handler said it, and what
|
|
48
|
+
* it said (already output-schema-checked).
|
|
49
|
+
*/
|
|
50
|
+
export interface ExtensionContribution<O = unknown> {
|
|
51
|
+
handlerId: string;
|
|
52
|
+
value: O;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Run a many-handler extension point: input checked once against the input
|
|
56
|
+
* schema, each handler's return checked against the output schema, results
|
|
57
|
+
* collected in dependency order. A handler returning `undefined`/`null`
|
|
58
|
+
* contributes nothing (that is how a handler declines) — anything else must
|
|
59
|
+
* satisfy the output schema.
|
|
60
|
+
*
|
|
61
|
+
* Failure semantics (M2): in dev every violation throws; in production a bad
|
|
62
|
+
* input logs and yields [] (the point is isolated), a bad output or a throwing
|
|
63
|
+
* handler logs and drops THAT handler's contribution only.
|
|
64
|
+
*/
|
|
65
|
+
export declare function runExtensionPoint<I = unknown, O = unknown>(pointId: string, input: I): Promise<ExtensionContribution<O>[]>;
|
|
66
|
+
/**
|
|
67
|
+
* Run an escape valve (I4): `Output | null`. Null (or no registrant) means
|
|
68
|
+
* "take the default path"; a non-null return is schema-checked and returned
|
|
69
|
+
* for the caller to short-circuit with. In production a schema-invalid return
|
|
70
|
+
* or a throw logs and behaves as null — a broken escape must degrade to the
|
|
71
|
+
* default order path, never to a broken checkout.
|
|
72
|
+
*/
|
|
73
|
+
export declare function runEscapeValve<I = unknown, O = unknown>(pointId: string, input: I): Promise<O | null>;
|
|
74
|
+
export interface ExtensionHandlerDescriptor {
|
|
75
|
+
id: string;
|
|
76
|
+
after: readonly string[];
|
|
77
|
+
description?: string;
|
|
78
|
+
source?: RegistrySource;
|
|
79
|
+
pluginId?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface ExtensionPointDescriptor extends RegistryEntryDescriptor {
|
|
82
|
+
mode: ExtensionPointMode;
|
|
83
|
+
/** JSON Schema for the invocation input. */
|
|
84
|
+
inputSchema: JsonSchema;
|
|
85
|
+
/** JSON Schema for a handler's (non-null) return. */
|
|
86
|
+
outputSchema: JsonSchema;
|
|
87
|
+
/** Registered handlers, in registration order with their dependencies. */
|
|
88
|
+
handlers: ExtensionHandlerDescriptor[];
|
|
89
|
+
}
|
|
90
|
+
/** Every declared point with its schemas AND its registered handlers, sorted
|
|
91
|
+
* by id — the enumerable surface an agent (and `fayz catalog`) reads. */
|
|
92
|
+
export declare function describeExtensionPoints(): ExtensionPointDescriptor[];
|
|
93
|
+
export declare function hasExtensionPoint(pointId: string): boolean;
|
|
94
|
+
export declare function listExtensionPoints(): string[];
|
|
95
|
+
/** Registered handler ids at a point, in registration order. Unknown point →
|
|
96
|
+
* the same I2 hard error as every other lookup. */
|
|
97
|
+
export declare function listExtensionHandlers(pointId: string): string[];
|
|
98
|
+
/** Test seam — clears declarations AND handlers. */
|
|
99
|
+
export declare function clearExtensionPoints(): void;
|
|
100
|
+
/**
|
|
101
|
+
* Build a `withAfterHooks` handler map whose hooks run an extension point.
|
|
102
|
+
*
|
|
103
|
+
* `withAfterHooks(provider, handlers)` (core/integrations, the CONNECTORS.md
|
|
104
|
+
* outbound-sync seam) stays THE mechanism for post-write hooks — fire-and-
|
|
105
|
+
* forget, failures never break the app call. What it lacked was schema
|
|
106
|
+
* enforcement and enumerability; this bridge adds both by making the hook body
|
|
107
|
+
* a `runExtensionPoint` invocation: the point declares the input shape
|
|
108
|
+
* (`{ method, args, result }`), registered handlers are dependency-ordered and
|
|
109
|
+
* output-checked, and describeExtensionPoints lists them. One mechanism, now
|
|
110
|
+
* introspectable — not a competing one.
|
|
111
|
+
*
|
|
112
|
+
* Usage:
|
|
113
|
+
* defineExtensionPoint({ id: 'shop.afterWrite', input: AFTER_WRITE_INPUT, … })
|
|
114
|
+
* const provider = withAfterHooks(base, extensionAfterHooks('shop.afterWrite', ['placeOrder']))
|
|
115
|
+
*/
|
|
116
|
+
export declare function extensionAfterHooks<T extends object>(pointId: string, methods: readonly (keyof T & string)[]): Partial<Record<keyof T, (args: unknown[], result: unknown) => Promise<void>>>;
|
|
117
|
+
//# sourceMappingURL=extension-points.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-points.d.ts","sourceRoot":"","sources":["../../src/registry/extension-points.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,uBAAuB,EAAgB,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAgCzG,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,QAAQ,CAAA;AAElD,MAAM,WAAW,yBAAyB;IACx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D,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,GACrC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAY/E"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Registry } from './registry-class';
|
|
2
|
+
import type { RegistryMeta } from './registry-class';
|
|
3
|
+
export declare const handleRegistry: Registry<unknown>;
|
|
4
|
+
export interface RegisterHandleOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Allow re-registering the name with a different value. Off by default:
|
|
7
|
+
* two modules silently fighting over one name is exactly the collision the
|
|
8
|
+
* namespace exists to prevent, so it throws unless the caller states the
|
|
9
|
+
* replacement is deliberate (config re-evaluation, HMR, tests).
|
|
10
|
+
*/
|
|
11
|
+
replace?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Register named code under a namespaced handle.
|
|
15
|
+
*
|
|
16
|
+
* Re-registering the SAME value under the same name is a no-op (idempotent, so
|
|
17
|
+
* a module evaluated twice does not fail). Re-registering a DIFFERENT value
|
|
18
|
+
* throws unless `replace: true` — see {@link RegisterHandleOptions}.
|
|
19
|
+
*/
|
|
20
|
+
export declare function registerHandle<T>(name: string, value: T, meta?: RegistryMeta, options?: RegisterHandleOptions): void;
|
|
21
|
+
/** The value behind a handle, or undefined. Prefer {@link resolveHandle} in
|
|
22
|
+
* hydration paths — an unknown handle there must be a hard error (I2). */
|
|
23
|
+
export declare function getHandle<T = unknown>(name: string): T | undefined;
|
|
24
|
+
export declare function hasHandle(name: string): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Resolve a handle or throw naming the valid set — the I2 contract. This is
|
|
27
|
+
* the only lookup a document hydrator may use: an unknown handle silently
|
|
28
|
+
* dropped would render a store that LOOKS restored and is missing code.
|
|
29
|
+
*/
|
|
30
|
+
export declare function resolveHandle<T = unknown>(name: string): T;
|
|
31
|
+
/** All registered handle names, sorted. */
|
|
32
|
+
export declare function listHandles(): string[];
|
|
33
|
+
/**
|
|
34
|
+
* Reverse lookup: the name a value was registered under, if any. Used by
|
|
35
|
+
* `exportStore` to serialize a code-valued config field as its handle name —
|
|
36
|
+
* which only works because handles hold the value by reference, not a copy.
|
|
37
|
+
*/
|
|
38
|
+
export declare function handleNameFor(value: unknown): string | undefined;
|
|
39
|
+
/** Test helper — a suite that registers handles must not leak into the next. */
|
|
40
|
+
export declare function clearHandles(): void;
|
|
41
|
+
//# sourceMappingURL=handles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handles.d.ts","sourceRoot":"","sources":["../../src/registry/handles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAqBpD,eAAO,MAAM,cAAc,mBAAkC,CAAA;AAE7D,MAAM,WAAW,qBAAqB;IACpC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AASD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,CAAC,EACR,IAAI,GAAE,YAAiB,EACvB,OAAO,GAAE,qBAA0B,GAClC,IAAI,CAqBN;AAED;2EAC2E;AAC3E,wBAAgB,SAAS,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAElE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAK1D;AAED,2CAA2C;AAC3C,wBAAgB,WAAW,IAAI,MAAM,EAAE,CAEtC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAKhE;AAED,gFAAgF;AAChF,wBAAgB,YAAY,IAAI,IAAI,CAEnC"}
|
package/dist/registry/index.d.ts
CHANGED
|
@@ -1,40 +1,27 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export
|
|
25
|
-
readonly kind: string;
|
|
26
|
-
private readonly entries;
|
|
27
|
-
constructor(kind: string);
|
|
28
|
-
register(id: string, value: T, meta?: RegistryMeta): void;
|
|
29
|
-
get(id: string): T | undefined;
|
|
30
|
-
getEntry(id: string): RegistryEntry<T> | undefined;
|
|
31
|
-
has(id: string): boolean;
|
|
32
|
-
list(): RegistryEntry<T>[];
|
|
33
|
-
ids(): string[];
|
|
34
|
-
clear(): void;
|
|
35
|
-
}
|
|
36
|
-
/** True for app-local custom artifacts (`custom:*`). */
|
|
37
|
-
export declare function isCustomId(id: string): boolean;
|
|
2
|
+
import { settingsToJsonSchema } from './block-schema';
|
|
3
|
+
import { Registry } from './registry-class';
|
|
4
|
+
import type { RegistryMeta } from './registry-class';
|
|
5
|
+
export { Registry, isCustomId } from './registry-class';
|
|
6
|
+
export type { JsonSchema, RegistrySource, RegistryMeta, RegistryEntry, RegistryEntryDescriptor, LoaderParamRef, LoaderPropRef, BlockDataNeed, BlockDataNeeds, } from './registry-class';
|
|
7
|
+
export { settingsToJsonSchema };
|
|
8
|
+
export { defaultPropsFromSettings, BLOCK_SETTING_TYPES } from './block-schema';
|
|
9
|
+
export { handleRegistry, registerHandle, getHandle, hasHandle, resolveHandle, listHandles, handleNameFor, clearHandles, } from './handles';
|
|
10
|
+
export type { RegisterHandleOptions } from './handles';
|
|
11
|
+
export { loaderRegistry, defineLoader, resolveLoader, hasLoader, listLoaders, clearLoaders, describeLoaders, isLoaderParamRef, isLoaderPropRef, dataNeedKey, } from './loaders';
|
|
12
|
+
export type { LoaderContext, LoaderImpl, LoaderDescriptor } from './loaders';
|
|
13
|
+
export { ENTITY_FIELD_TYPES, GENERIC_ENTITY_TABLE, RESERVED_ENTITY_FIELDS, SIDECAR_REFERENCES, entityDeclarationRegistry, defineEntity, resolveEntityDeclaration, hasEntityDeclaration, listEntityDeclarations, clearEntityDeclarations, entityRecordSchema, validateEntityRecordData, describeEntities, entityAdminForm, sidecarDeclarationRegistry, defineSidecarFields, resolveSidecarDeclaration, hasSidecarDeclaration, clearSidecarDeclarations, } from './entities';
|
|
14
|
+
export type { EntityFieldType, EntityField, EntityReadAccess, EntityAccess, EntityStorageDescriptor, EntityDeclarationInput, EntityDeclaration, EntityRecordIssue, EntityDescriptor, EntityAdminForm as EntityAdminFormDescriptor, SidecarReference, SidecarDeclaration, } from './entities';
|
|
15
|
+
export type { BlockSetting, BlockSettingType, BlockSettingOption, BlockPreset, BlockStability, } from './block-schema';
|
|
16
|
+
export { describeBlock, describeBlocks, isBlockEnabledOn, auditBlocks, summarizeBlockAudit, } from './block-catalog';
|
|
17
|
+
export type { BlockDescriptor, BlockCatalogOptions, BlockAudit, BlockAuditLevel, } from './block-catalog';
|
|
18
|
+
export type { RequiredBlockChild } from './registry-class';
|
|
19
|
+
export { checkBlockConstraints, checkNodePlacement, checkBlockContext, repairBlockTree, } from './block-constraints';
|
|
20
|
+
export type { BlockTreeNode, BlockConstraintRule, BlockConstraintViolation, BlockContextFinding, BlockTreeRepair, RepairBlockTreeResult, } from './block-constraints';
|
|
21
|
+
export { checkAgainstSchema, formatSchemaIssues } from './schema-check';
|
|
22
|
+
export type { SchemaIssue } from './schema-check';
|
|
23
|
+
export { extensionPointRegistry, defineExtensionPoint, registerExtensionHandler, unregisterExtensionHandler, runExtensionPoint, runEscapeValve, describeExtensionPoints, hasExtensionPoint, listExtensionPoints, listExtensionHandlers, clearExtensionPoints, extensionAfterHooks, } from './extension-points';
|
|
24
|
+
export type { ExtensionPointMode, ExtensionPointDeclaration, ExtensionHandlerOptions, ExtensionHandler, ExtensionContribution, ExtensionHandlerDescriptor, ExtensionPointDescriptor, } from './extension-points';
|
|
38
25
|
export type MetricFormat = 'number' | 'currency' | 'percent' | 'duration' | 'rating';
|
|
39
26
|
export interface MetricContext {
|
|
40
27
|
tenantId?: string;
|
|
@@ -68,21 +55,34 @@ export declare const registerComponent: (id: string, c: AnyComponent, meta?: Reg
|
|
|
68
55
|
export declare const getComponent: (id: string) => AnyComponent | undefined;
|
|
69
56
|
export declare const registerBlock: (id: string, c: AnyComponent, meta?: RegistryMeta) => void;
|
|
70
57
|
export declare const getBlock: (id: string) => AnyComponent | undefined;
|
|
71
|
-
export declare const listBlocks: () => RegistryEntry<AnyComponent>[];
|
|
58
|
+
export declare const listBlocks: () => import("./registry-class").RegistryEntry<AnyComponent>[];
|
|
59
|
+
export declare const getBlockMeta: (id: string) => RegistryMeta | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Register a block together with the schema that describes its props.
|
|
62
|
+
*
|
|
63
|
+
* The only thing this adds over {@link registerBlock} is compiling `settings`
|
|
64
|
+
* into `propsSchema` at registration, so the authored declaration and the
|
|
65
|
+
* machine contract cannot drift apart — which is exactly what happens whenever
|
|
66
|
+
* both are maintained by hand.
|
|
67
|
+
*
|
|
68
|
+
* Use this for any block a merchant, an editor or an agent is expected to
|
|
69
|
+
* configure. `registerBlock` stays for blocks that take no props, and for
|
|
70
|
+
* app-local code that has not been schematized yet.
|
|
71
|
+
*/
|
|
72
|
+
export declare const defineBlock: (id: string, component: AnyComponent, meta?: Omit<RegistryMeta, "propsSchema">) => void;
|
|
72
73
|
export declare const registerPage: (id: string, c: AnyComponent, meta?: RegistryMeta) => void;
|
|
73
74
|
export declare const getPage: (id: string) => AnyComponent | undefined;
|
|
74
75
|
export declare const registerScaffold: (id: string, c: AnyComponent, meta?: RegistryMeta) => void;
|
|
75
76
|
export declare const getScaffold: (id: string) => AnyComponent | undefined;
|
|
76
77
|
export declare const registerMetric: (def: MetricDefinition, meta?: RegistryMeta) => void;
|
|
77
78
|
export declare const getMetric: (id: string) => MetricDefinition | undefined;
|
|
78
|
-
export declare const listMetrics: () => RegistryEntry<MetricDefinition>[];
|
|
79
|
+
export declare const listMetrics: () => import("./registry-class").RegistryEntry<MetricDefinition>[];
|
|
79
80
|
export declare const registerPlugin: (id: string, manifest: any, meta?: RegistryMeta) => void;
|
|
80
81
|
export declare const getPlugin: (id: string) => any;
|
|
81
|
-
export declare const listPlugins: () => RegistryEntry<any>[];
|
|
82
|
+
export declare const listPlugins: () => import("./registry-class").RegistryEntry<any>[];
|
|
82
83
|
export type PluginFactory = (config?: Record<string, unknown>) => any;
|
|
83
84
|
export declare const pluginFactoryRegistry: Registry<PluginFactory>;
|
|
84
85
|
export declare const registerPluginFactory: (id: string, factory: PluginFactory, meta?: RegistryMeta) => void;
|
|
85
86
|
export declare const getPluginFactory: (id: string) => PluginFactory | undefined;
|
|
86
|
-
export declare const listPluginFactories: () => RegistryEntry<PluginFactory>[];
|
|
87
|
-
export {};
|
|
87
|
+
export declare const listPluginFactories: () => import("./registry-class").RegistryEntry<PluginFactory>[];
|
|
88
88
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,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eAAO,MAAM,gBAAgB,GAAI,IAAI,MAAM,8BAAkC,CAAA;AAC7E,eAAO,MAAM,mBAAmB,iEAAqC,CAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Registry } from './registry-class';
|
|
2
|
+
import type { JsonSchema, RegistryMeta, RegistryEntryDescriptor, LoaderParamRef, LoaderPropRef } from './registry-class';
|
|
3
|
+
import type { BlockSetting } from './block-schema';
|
|
4
|
+
/**
|
|
5
|
+
* What a loader gets to read from. `shop` is the ShopProvider port — typed as
|
|
6
|
+
* `unknown` here because core is backend-agnostic; the storefront layer pins
|
|
7
|
+
* it to its ShopProvider interface. Nothing else is provided on purpose:
|
|
8
|
+
* a loader that needs more than the port and its params is a loader that has
|
|
9
|
+
* smuggled in a dependency the resolver cannot see.
|
|
10
|
+
*/
|
|
11
|
+
export interface LoaderContext<TShop = unknown> {
|
|
12
|
+
shop: TShop;
|
|
13
|
+
}
|
|
14
|
+
/** A loader implementation: pure function of (params, ctx). */
|
|
15
|
+
export type LoaderImpl<P extends Record<string, unknown> = Record<string, unknown>, R = unknown, TShop = unknown> = (params: P, ctx: LoaderContext<TShop>) => Promise<R> | R;
|
|
16
|
+
export declare const loaderRegistry: Registry<LoaderImpl<Record<string, unknown>, unknown, unknown>>;
|
|
17
|
+
/**
|
|
18
|
+
* Register a loader with its meta envelope. `settings` declare the params and
|
|
19
|
+
* compile to the params JSON Schema exactly as block settings compile to
|
|
20
|
+
* propsSchema — one declaration, no drift (I1).
|
|
21
|
+
*/
|
|
22
|
+
export declare function defineLoader<P extends Record<string, unknown>, R, TShop = unknown>(id: string, impl: LoaderImpl<P, R, TShop>, meta?: Omit<RegistryMeta, 'propsSchema'>): void;
|
|
23
|
+
/**
|
|
24
|
+
* Resolve a loader or throw naming the valid set — the I2 contract. This is
|
|
25
|
+
* the only lookup a resolver may use: a data need whose loader silently
|
|
26
|
+
* resolved to nothing would render a page that LOOKS complete and is missing
|
|
27
|
+
* data.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveLoader<P extends Record<string, unknown> = Record<string, unknown>, R = unknown, TShop = unknown>(id: string): LoaderImpl<P, R, TShop>;
|
|
30
|
+
export declare function hasLoader(id: string): boolean;
|
|
31
|
+
/** All registered loader ids, sorted. */
|
|
32
|
+
export declare function listLoaders(): string[];
|
|
33
|
+
/** Test seam — a suite that registers loaders must not leak into the next. */
|
|
34
|
+
export declare function clearLoaders(): void;
|
|
35
|
+
/** The uniform envelope plus the loader-specific fields the agent reads. */
|
|
36
|
+
export interface LoaderDescriptor extends RegistryEntryDescriptor {
|
|
37
|
+
/** JSON Schema for the loader's params (alias of `schema`, named for intent). */
|
|
38
|
+
paramsSchema?: JsonSchema;
|
|
39
|
+
/** The authored param declarations, for editors that render pickers. */
|
|
40
|
+
params: readonly BlockSetting[];
|
|
41
|
+
/** One-line description of what the loader resolves to. */
|
|
42
|
+
output?: string;
|
|
43
|
+
}
|
|
44
|
+
/** Every loader reduced to its descriptor, sorted by id — what describeStore
|
|
45
|
+
* publishes and the agent generates against. */
|
|
46
|
+
export declare function describeLoaders(): LoaderDescriptor[];
|
|
47
|
+
export declare function isLoaderParamRef(value: unknown): value is LoaderParamRef;
|
|
48
|
+
export declare function isLoaderPropRef(value: unknown): value is LoaderPropRef;
|
|
49
|
+
/**
|
|
50
|
+
* Canonical identity of one (loader, params) pair — the dedupe unit. Key-order
|
|
51
|
+
* insensitive and `undefined`-dropping, so two blocks declaring the same need
|
|
52
|
+
* in different spellings still resolve it once per page.
|
|
53
|
+
*/
|
|
54
|
+
export declare function dataNeedKey(loader: string, params?: Record<string, unknown>): string;
|
|
55
|
+
//# sourceMappingURL=loaders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loaders.d.ts","sourceRoot":"","sources":["../../src/registry/loaders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,Y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