@fayz-ai/core 0.9.0 → 0.11.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.
Files changed (218) hide show
  1. package/README.md +2 -2
  2. package/dist/access/index.js.map +1 -1
  3. package/dist/chunk-BEGXYHS4.js +566 -0
  4. package/dist/chunk-BEGXYHS4.js.map +1 -0
  5. package/dist/chunk-ED6NBH6U.js +348 -0
  6. package/dist/chunk-ED6NBH6U.js.map +1 -0
  7. package/dist/chunk-EWKX4VUM.js +429 -0
  8. package/dist/chunk-EWKX4VUM.js.map +1 -0
  9. package/dist/chunk-LARZWDHA.js +319 -0
  10. package/dist/chunk-LARZWDHA.js.map +1 -0
  11. package/dist/chunk-OXQGRJZT.js +125 -0
  12. package/dist/chunk-OXQGRJZT.js.map +1 -0
  13. package/dist/chunk-RRYFXUQX.js +1247 -0
  14. package/dist/chunk-RRYFXUQX.js.map +1 -0
  15. package/dist/{chunk-5RJVUC6J.js → chunk-TDI6F6PT.js} +373 -25
  16. package/dist/chunk-TDI6F6PT.js.map +1 -0
  17. package/dist/{chunk-V2MSAUHO.js → chunk-UVKH6RDX.js} +211 -335
  18. package/dist/chunk-UVKH6RDX.js.map +1 -0
  19. package/dist/chunk-V53GR4UT.js +289 -0
  20. package/dist/chunk-V53GR4UT.js.map +1 -0
  21. package/dist/connector-runtime/index.d.ts +15 -0
  22. package/dist/connector-runtime/index.d.ts.map +1 -0
  23. package/dist/connector-runtime/index.js +3 -0
  24. package/dist/connector-runtime/index.js.map +1 -0
  25. package/dist/data/archetype.d.ts.map +1 -1
  26. package/dist/data/backend-env.d.ts +38 -0
  27. package/dist/data/backend-env.d.ts.map +1 -0
  28. package/dist/data/bulk.d.ts +24 -0
  29. package/dist/data/bulk.d.ts.map +1 -1
  30. package/dist/data/cached.d.ts.map +1 -1
  31. package/dist/data/custom-fields.d.ts +5 -0
  32. package/dist/data/custom-fields.d.ts.map +1 -0
  33. package/dist/data/index.d.ts +2 -1
  34. package/dist/data/index.d.ts.map +1 -1
  35. package/dist/data/index.js +3 -1
  36. package/dist/data/mock.d.ts.map +1 -1
  37. package/dist/data/platform-api.d.ts.map +1 -1
  38. package/dist/data/resolve.d.ts.map +1 -1
  39. package/dist/data/supabase.d.ts.map +1 -1
  40. package/dist/data/types.d.ts +8 -0
  41. package/dist/data/types.d.ts.map +1 -1
  42. package/dist/entity/events.d.ts +14 -0
  43. package/dist/entity/events.d.ts.map +1 -0
  44. package/dist/events/envelope.d.ts +31 -0
  45. package/dist/events/envelope.d.ts.map +1 -0
  46. package/dist/events/index.d.ts +4 -0
  47. package/dist/events/index.d.ts.map +1 -1
  48. package/dist/events/log.d.ts +44 -0
  49. package/dist/events/log.d.ts.map +1 -0
  50. package/dist/events/types.d.ts +40 -0
  51. package/dist/events/types.d.ts.map +1 -0
  52. package/dist/fields/store.d.ts +45 -0
  53. package/dist/fields/store.d.ts.map +1 -0
  54. package/dist/i18n/index.d.ts +10 -0
  55. package/dist/i18n/index.d.ts.map +1 -1
  56. package/dist/i18n/index.js +1 -1
  57. package/dist/i18n/shell-translations.en.d.ts.map +1 -1
  58. package/dist/i18n/shell-translations.pt-br.d.ts.map +1 -1
  59. package/dist/index.d.ts +45 -21
  60. package/dist/index.d.ts.map +1 -1
  61. package/dist/index.js +543 -56
  62. package/dist/index.js.map +1 -1
  63. package/dist/integrations/events.d.ts +7 -0
  64. package/dist/integrations/events.d.ts.map +1 -0
  65. package/dist/integrations/index.d.ts +533 -29
  66. package/dist/integrations/index.d.ts.map +1 -1
  67. package/dist/integrations/index.js +3 -1
  68. package/dist/integrations/permissions.d.ts +132 -0
  69. package/dist/integrations/permissions.d.ts.map +1 -0
  70. package/dist/integrations/request.d.ts +170 -0
  71. package/dist/integrations/request.d.ts.map +1 -0
  72. package/dist/integrations/runtime-token.d.ts +33 -0
  73. package/dist/integrations/runtime-token.d.ts.map +1 -0
  74. package/dist/integrations/runtime.d.ts +398 -0
  75. package/dist/integrations/runtime.d.ts.map +1 -0
  76. package/dist/integrations/settings.d.ts +102 -0
  77. package/dist/integrations/settings.d.ts.map +1 -0
  78. package/dist/integrations/store.d.ts +145 -0
  79. package/dist/integrations/store.d.ts.map +1 -0
  80. package/dist/{address/index.d.ts → lib/address.d.ts} +1 -1
  81. package/dist/{address/index.d.ts.map → lib/address.d.ts.map} +1 -1
  82. package/dist/{phone/index.d.ts → lib/phone.d.ts} +1 -1
  83. package/dist/lib/phone.d.ts.map +1 -0
  84. package/dist/{seo/index.d.ts → lib/seo.d.ts} +18 -1
  85. package/dist/lib/seo.d.ts.map +1 -0
  86. package/dist/{tenant/index.d.ts → lib/tenant.d.ts} +1 -1
  87. package/dist/lib/tenant.d.ts.map +1 -0
  88. package/dist/manifest/index.d.ts +1 -1
  89. package/dist/manifest/index.d.ts.map +1 -1
  90. package/dist/messaging/index.d.ts +3 -0
  91. package/dist/messaging/index.d.ts.map +1 -0
  92. package/dist/messaging/registry.d.ts +35 -0
  93. package/dist/messaging/registry.d.ts.map +1 -0
  94. package/dist/messaging/types.d.ts +67 -0
  95. package/dist/messaging/types.d.ts.map +1 -0
  96. package/dist/plugin/index.js +3 -1
  97. package/dist/plugin/runtime.d.ts +17 -0
  98. package/dist/plugin/runtime.d.ts.map +1 -1
  99. package/dist/registry/block-catalog.d.ts +78 -0
  100. package/dist/registry/block-catalog.d.ts.map +1 -0
  101. package/dist/registry/block-constraints.d.ts +64 -0
  102. package/dist/registry/block-constraints.d.ts.map +1 -0
  103. package/dist/registry/block-schema.d.ts +69 -0
  104. package/dist/registry/block-schema.d.ts.map +1 -0
  105. package/dist/registry/blocks.d.ts +84 -0
  106. package/dist/registry/blocks.d.ts.map +1 -0
  107. package/dist/registry/entities.d.ts +179 -0
  108. package/dist/registry/entities.d.ts.map +1 -0
  109. package/dist/registry/extension-points.d.ts +117 -0
  110. package/dist/registry/extension-points.d.ts.map +1 -0
  111. package/dist/registry/handles.d.ts +41 -0
  112. package/dist/registry/handles.d.ts.map +1 -0
  113. package/dist/registry/index.d.ts +41 -41
  114. package/dist/registry/index.d.ts.map +1 -1
  115. package/dist/registry/loaders.d.ts +55 -0
  116. package/dist/registry/loaders.d.ts.map +1 -0
  117. package/dist/registry/registry-class.d.ts +157 -0
  118. package/dist/registry/registry-class.d.ts.map +1 -0
  119. package/dist/registry/schema-check.d.ts +14 -0
  120. package/dist/registry/schema-check.d.ts.map +1 -0
  121. package/dist/router/index.d.ts +78 -1
  122. package/dist/router/index.d.ts.map +1 -1
  123. package/dist/router/index.js +1 -1
  124. package/dist/{shell-translations.pt-br-2GWRQRRP.js → shell-translations.pt-br-BM5ZFSKJ.js} +72 -3
  125. package/dist/shell-translations.pt-br-BM5ZFSKJ.js.map +1 -0
  126. package/dist/telemetry/errors.d.ts +87 -0
  127. package/dist/telemetry/errors.d.ts.map +1 -0
  128. package/dist/testing/index.js +4 -1
  129. package/dist/{testing/index.d.ts → testing.d.ts} +5 -3
  130. package/dist/testing.d.ts.map +1 -0
  131. package/dist/types/analytics.d.ts +213 -0
  132. package/dist/types/analytics.d.ts.map +1 -0
  133. package/dist/types/crud.d.ts +37 -3
  134. package/dist/types/crud.d.ts.map +1 -1
  135. package/dist/types/plugins.d.ts +138 -1
  136. package/dist/types/plugins.d.ts.map +1 -1
  137. package/package.json +9 -17
  138. package/dist/blocks/index.d.ts +0 -25
  139. package/dist/blocks/index.d.ts.map +0 -1
  140. package/dist/chunk-5RJVUC6J.js.map +0 -1
  141. package/dist/chunk-L4TLMYGC.js +0 -42
  142. package/dist/chunk-L4TLMYGC.js.map +0 -1
  143. package/dist/chunk-V2MSAUHO.js.map +0 -1
  144. package/dist/chunk-X5THHG6T.js +0 -77
  145. package/dist/chunk-X5THHG6T.js.map +0 -1
  146. package/dist/chunk-Y2C2FBQP.js +0 -35
  147. package/dist/chunk-Y2C2FBQP.js.map +0 -1
  148. package/dist/chunk-YH25Y4FW.js +0 -311
  149. package/dist/chunk-YH25Y4FW.js.map +0 -1
  150. package/dist/phone/index.d.ts.map +0 -1
  151. package/dist/seo/index.d.ts.map +0 -1
  152. package/dist/shell-translations.pt-br-2GWRQRRP.js.map +0 -1
  153. package/dist/tenant/index.d.ts.map +0 -1
  154. package/dist/testing/index.d.ts.map +0 -1
  155. package/src/access/denial.ts +0 -33
  156. package/src/access/engine.test.ts +0 -48
  157. package/src/access/engine.ts +0 -136
  158. package/src/access/index.ts +0 -14
  159. package/src/access/limits.ts +0 -18
  160. package/src/address/index.ts +0 -188
  161. package/src/app/render.tsx +0 -69
  162. package/src/blocks/index.tsx +0 -68
  163. package/src/data/archetype.ts +0 -255
  164. package/src/data/bulk.ts +0 -35
  165. package/src/data/cached.ts +0 -55
  166. package/src/data/count.test.ts +0 -152
  167. package/src/data/count.ts +0 -131
  168. package/src/data/filters.test.ts +0 -70
  169. package/src/data/filters.ts +0 -90
  170. package/src/data/index.ts +0 -11
  171. package/src/data/mock.ts +0 -90
  172. package/src/data/platform-api.ts +0 -209
  173. package/src/data/refresh.ts +0 -115
  174. package/src/data/resolve.ts +0 -126
  175. package/src/data/supabase.ts +0 -230
  176. package/src/data/types.ts +0 -50
  177. package/src/entity/index.ts +0 -2
  178. package/src/entity/registry.ts +0 -49
  179. package/src/events/index.tsx +0 -82
  180. package/src/i18n/index.ts +0 -476
  181. package/src/i18n/shell-translations.en.ts +0 -875
  182. package/src/i18n/shell-translations.pt-br.ts +0 -873
  183. package/src/index.ts +0 -217
  184. package/src/integrations/index.ts +0 -237
  185. package/src/lib/cache.ts +0 -118
  186. package/src/lib/csv.ts +0 -54
  187. package/src/lib/format.ts +0 -58
  188. package/src/manifest/app-manifest.schema.json +0 -676
  189. package/src/manifest/index.ts +0 -518
  190. package/src/manifest/serialize.ts +0 -52
  191. package/src/phone/index.ts +0 -85
  192. package/src/plugin/createSafeDataProvider.ts +0 -30
  193. package/src/plugin/index.ts +0 -1
  194. package/src/plugin/runtime.ts +0 -331
  195. package/src/registry/index.ts +0 -163
  196. package/src/router/history.ts +0 -86
  197. package/src/router/index.ts +0 -29
  198. package/src/runtime/index.ts +0 -15
  199. package/src/runtime/oauth.ts +0 -219
  200. package/src/search/engine.ts +0 -559
  201. package/src/search/index.ts +0 -25
  202. package/src/search/text.ts +0 -206
  203. package/src/search/types.ts +0 -75
  204. package/src/seo/index.ts +0 -128
  205. package/src/tenant/index.ts +0 -38
  206. package/src/testing/index.ts +0 -116
  207. package/src/types/auth.ts +0 -41
  208. package/src/types/billing.ts +0 -39
  209. package/src/types/crud.ts +0 -184
  210. package/src/types/entities.ts +0 -142
  211. package/src/types/entitlements.ts +0 -45
  212. package/src/types/i18n.ts +0 -7
  213. package/src/types/index.ts +0 -11
  214. package/src/types/org.ts +0 -137
  215. package/src/types/payment.ts +0 -44
  216. package/src/types/permissions.ts +0 -32
  217. package/src/types/plugins.ts +0 -480
  218. package/src/types/theme.ts +0 -8
@@ -0,0 +1,179 @@
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' | 'date' | 'datetime' | 'select';
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
+ * It also mirrors the CHECK on plg_entity_fields.type (migration 035) — a type
9
+ * is a MODEL change, in both places at once, never an insert. */
10
+ export declare const ENTITY_FIELD_TYPES: readonly ["text", "richtext", "number", "boolean", "json", "image", "url", "ref", "point", "date", "datetime", "select"];
11
+ /**
12
+ * Bounds a value must respect beyond its type. Kept as data, not code, because
13
+ * a merchant defines these in the admin and they have to survive the round trip
14
+ * through plg_entity_fields.validation without anything being compiled.
15
+ */
16
+ export interface EntityFieldValidation {
17
+ /** Numbers: inclusive bounds. */
18
+ min?: number;
19
+ max?: number;
20
+ /** Strings: inclusive length bounds. */
21
+ minLength?: number;
22
+ maxLength?: number;
23
+ /** Strings: an anchored-as-written regular expression. */
24
+ pattern?: string;
25
+ }
26
+ /** One choice of a `select` field. The value is what lands in custom_fields. */
27
+ export interface EntityFieldOption {
28
+ value: string;
29
+ label?: string;
30
+ }
31
+ export interface EntityField {
32
+ type: EntityFieldType;
33
+ /** Human label — drives the admin form and the agent's understanding. */
34
+ label?: string;
35
+ help?: string;
36
+ required?: boolean;
37
+ default?: unknown;
38
+ /** `ref` only: the entity key this field points to (stores that entity's record id). */
39
+ entity?: string;
40
+ /** `select` only: the closed set of values. */
41
+ options?: readonly EntityFieldOption[];
42
+ validation?: EntityFieldValidation;
43
+ }
44
+ export type EntityReadAccess = 'public' | 'staff';
45
+ /**
46
+ * Who reads and who writes. `write` is 'staff' only on purpose: shopper-writable
47
+ * entities (reviews) need the action/rate-limit layer (M7), not an RLS grant.
48
+ */
49
+ export interface EntityAccess {
50
+ read: EntityReadAccess;
51
+ write: 'staff';
52
+ }
53
+ /** Where records live. Generic jsonb storage first (I5); promoting a hot entity
54
+ * to typed columns changes THIS value, and nothing else callers see. */
55
+ export interface EntityStorageDescriptor {
56
+ mode: 'generic' | 'dedicated';
57
+ /** Physical table. 'generic' mode shares it across entities. */
58
+ table: string;
59
+ }
60
+ export interface EntityDeclarationInput {
61
+ /** Human title (singular). Defaults to the key. */
62
+ title?: string;
63
+ description?: string;
64
+ fields: Record<string, EntityField>;
65
+ /** Only 'tenant' exists today: every record belongs to one store. */
66
+ scope?: 'tenant';
67
+ /** Default: staff-only both ways — public exposure is opt-in, never implied. */
68
+ access?: Partial<EntityAccess>;
69
+ /** Field-name tuples to index for querying/filtering. */
70
+ indexes?: readonly (readonly string[])[];
71
+ /** Field whose value titles a record in lists. Default: first text field. */
72
+ titleField?: string;
73
+ /** Fields blocks display by default (entityList). Default: every non-json field. */
74
+ displayFields?: readonly string[];
75
+ }
76
+ export interface EntityDeclaration {
77
+ key: string;
78
+ title: string;
79
+ description?: string;
80
+ fields: Record<string, EntityField>;
81
+ scope: 'tenant';
82
+ access: EntityAccess;
83
+ indexes: readonly (readonly string[])[];
84
+ titleField?: string;
85
+ displayFields: readonly string[];
86
+ storage: EntityStorageDescriptor;
87
+ }
88
+ /** The shared jsonb records table (see @fayz-ai/shop migrations 0030). */
89
+ export declare const GENERIC_ENTITY_TABLE = "plg_entity_records";
90
+ /** Structural record columns a declared field must not shadow. */
91
+ export declare const RESERVED_ENTITY_FIELDS: readonly ["id", "slug", "entity", "tenant_id", "created_at", "updated_at"];
92
+ export declare const entityDeclarationRegistry: Registry<EntityDeclaration>;
93
+ /**
94
+ * Declare an entity. One call → registry entry on the uniform meta envelope,
95
+ * with the record JSON Schema as `propsSchema` — the same emission discipline
96
+ * as `defineBlock` (I1), so every catalog consumer reads entities and blocks
97
+ * with one parser.
98
+ */
99
+ export declare function defineEntity(key: string, input: EntityDeclarationInput, meta?: {
100
+ source?: RegistrySource;
101
+ pluginId?: string;
102
+ since?: string;
103
+ }): EntityDeclaration;
104
+ /** Resolve a declaration or throw naming the valid set — the I2 contract. */
105
+ export declare function resolveEntityDeclaration(key: string): EntityDeclaration;
106
+ export declare function hasEntityDeclaration(key: string): boolean;
107
+ /** All declared entity keys, sorted. */
108
+ export declare function listEntityDeclarations(): string[];
109
+ /** Test seam — a suite that declares entities must not leak into the next. */
110
+ export declare function clearEntityDeclarations(): void;
111
+ /**
112
+ * The JSON Schema one record's `data` is validated against — on write, in the
113
+ * admin form, and as the agent's generation contract. `additionalProperties:
114
+ * false` is the schema-level I2: a field the declaration does not know is an
115
+ * error, not silently-unfilterable baggage (the Medusa `metadata` disease).
116
+ */
117
+ export declare function entityRecordSchema(declaration: Pick<EntityDeclaration, 'fields' | 'title' | 'description'>): JsonSchema;
118
+ export interface EntityRecordIssue {
119
+ /** Dotted path into the record data ('hours', 'geo.lat'). */
120
+ path: string;
121
+ code: 'unknown-field' | 'missing-field' | 'invalid-value';
122
+ message: string;
123
+ /** The valid set, on unknown-id errors — what the agent corrects on. */
124
+ valid?: string[];
125
+ }
126
+ /**
127
+ * Validate one record's `data` against a declaration — the write gate every
128
+ * EntityStore implementation runs. Pure and total: returns issues, never throws.
129
+ */
130
+ export declare function validateEntityRecordData(declaration: Pick<EntityDeclaration, 'fields'>, data: unknown): EntityRecordIssue[];
131
+ /** The uniform envelope plus the entity-specific fields the agent reads. */
132
+ export interface EntityDescriptor extends RegistryEntryDescriptor {
133
+ /** JSON Schema for a record's data (alias of `schema`, named for intent). */
134
+ recordSchema?: JsonSchema;
135
+ access: EntityAccess;
136
+ scope: 'tenant';
137
+ storage: EntityStorageDescriptor;
138
+ indexes: readonly (readonly string[])[];
139
+ titleField?: string;
140
+ displayFields: readonly string[];
141
+ }
142
+ /** Every declared entity reduced to its descriptor, sorted by key — what
143
+ * describeStore publishes and the agent generates against. */
144
+ export declare function describeEntities(): EntityDescriptor[];
145
+ export interface EntityAdminForm {
146
+ entity: string;
147
+ title: string;
148
+ fields: FieldDef[];
149
+ }
150
+ /**
151
+ * The admin CRUD form for an entity, emitted from the declaration as data.
152
+ * Field order is declaration order; labels default to the field name; `ref`
153
+ * fields become relation pickers over the generic records table filtered to
154
+ * the target entity.
155
+ */
156
+ export declare function entityAdminForm(declaration: EntityDeclaration): EntityAdminForm;
157
+ export interface CustomFieldsDeclaration {
158
+ reference: string;
159
+ fields: Record<string, EntityField>;
160
+ }
161
+ export declare const customFieldsRegistry: Registry<CustomFieldsDeclaration>;
162
+ /**
163
+ * Declare custom fields on a core record kind. One declaration per reference
164
+ * (re-declaring replaces — registry semantics, so an app's registry.tsx wins).
165
+ */
166
+ export declare function defineCustomFields(reference: string, fields: Record<string, EntityField>, meta?: {
167
+ source?: RegistrySource;
168
+ pluginId?: string;
169
+ }): CustomFieldsDeclaration;
170
+ /**
171
+ * The declared half for a record kind. Returns an empty set rather than
172
+ * throwing: a tenant whose only fields came from the admin is the normal case,
173
+ * and the merge in @fayz-ai/core/fields is what completes the picture.
174
+ */
175
+ export declare function declaredCustomFields(reference: string): Record<string, EntityField>;
176
+ export declare function hasCustomFieldsDeclaration(reference: string): boolean;
177
+ /** Test seam. */
178
+ export declare function clearCustomFieldsDeclarations(): void;
179
+ //# 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,GACT,MAAM,GACN,OAAO,GACP,KAAK,GACL,KAAK,GACL,OAAO,GACP,MAAM,GACN,UAAU,GACV,QAAQ,CAAA;AAEZ;;;kEAGkE;AAClE,eAAO,MAAM,kBAAkB,0HAagB,CAAA;AAK/C;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,iCAAiC;IACjC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,gFAAgF;AAChF,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,eAAe,CAAA;IACrB,yEAAyE;IACzE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,C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AAgB,0BAA0B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAErE;AAED,iBAAiB;AACjB,wBAAgB,6BAA6B,IAAI,IAAI,CAEpD"}
@@ -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,yB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MAAM,EAClD,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"}
@@ -1,40 +1,27 @@
1
1
  import type { ComponentType } from 'react';
2
- /** A JSON Schema object (loosely typed; validated by tooling, not at runtime). */
3
- export type JsonSchema = Record<string, unknown>;
4
- export type RegistrySource = 'sdk' | 'plugin' | 'app';
5
- export interface RegistryMeta {
6
- /** Human label for the platform editor. */
7
- label?: string;
8
- description?: string;
9
- /** Where this artifact came from (for introspection / conflict reporting). */
10
- source?: RegistrySource;
11
- /** Owning plugin id, when source is 'plugin'. */
12
- pluginId?: string;
13
- /** JSON Schema for this artifact's props/config drives the visual editor
14
- * and constrains AI generation. Optional but strongly encouraged. */
15
- propsSchema?: JsonSchema;
16
- }
17
- export interface RegistryEntry<T> {
18
- id: string;
19
- value: T;
20
- meta: RegistryMeta;
21
- }
22
- /** A typed, introspectable id→value map. Last registration wins (so an app's
23
- * registry.tsx can override an SDK artifact by re-registering its id). */
24
- export declare class Registry<T> {
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, entityDeclarationRegistry, defineEntity, resolveEntityDeclaration, hasEntityDeclaration, listEntityDeclarations, clearEntityDeclarations, entityRecordSchema, validateEntityRecordData, describeEntities, entityAdminForm, customFieldsRegistry, defineCustomFields, declaredCustomFields, hasCustomFieldsDeclaration, clearCustomFieldsDeclarations, } from './entities';
14
+ export type { EntityFieldType, EntityField, EntityReadAccess, EntityAccess, EntityStorageDescriptor, EntityDeclarationInput, EntityDeclaration, EntityRecordIssue, EntityDescriptor, EntityAdminForm as EntityAdminFormDescriptor, EntityFieldValidation, EntityFieldOption, CustomFieldsDeclaration, } 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;AAa1C,kFAAkF;AAClF,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAEhD,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,CAAA;AAErD,MAAM,WAAW,YAAY;IAC3B,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,8EAA8E;IAC9E,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;0EACsE;IACtE,WAAW,CAAC,EAAE,UAAU,CAAA;CACzB;AAED,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,CAAC,CAAA;IACR,IAAI,EAAE,YAAY,CAAA;CACnB;AAED;2EAC2E;AAC3E,qBAAa,QAAQ,CAAC,CAAC;IAGT,QAAQ,CAAC,IAAI,EAAE,MAAM;IAFjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsC;gBAEzC,IAAI,EAAE,MAAM;IAEjC,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,GAAE,YAAiB,GAAG,IAAI;I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,EAAE,OAAO,YAAY,SAChC,CAAA;AAC7C,eAAO,MAAM,SAAS,GAAI,IAAI,MAAM,QAA2B,CAAA;AAC/D,eAAO,MAAM,WAAW,uDAA8B,CAAA;AAOtD,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,GAAG,CAAA;AACrE,eAAO,MAAM,qBAAqB,yBAAgD,CAAA;AAClF,eAAO,MAAM,qBAAqB,GAAI,IAAI,MAAM,EAAE,SAAS,aAAa,EAAE,OAAO,YAAY,SAC1C,CAAA;AACnD,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,YAAY,EAAE,uBAAuB,EAAE,cAAc,EAAE,aAAa,EA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