@vtex/faststore 0.0.6 → 0.0.7

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 (132) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/dist/catalog.json +161 -20
  3. package/dist/cli/UnreachableCaseError-Crd168Vu.js +10 -0
  4. package/dist/cli/UnreachableCaseError-Crd168Vu.js.map +1 -0
  5. package/dist/cli/cacheControl-CEojH_TM.js +158 -0
  6. package/dist/cli/cacheControl-CEojH_TM.js.map +1 -0
  7. package/dist/cli/cachePolicy-m2vASMRW.js +26 -0
  8. package/dist/cli/cachePolicy-m2vASMRW.js.map +1 -0
  9. package/dist/cli/computeCoreSchemaHash-DPJZj-qJ.js +10 -0
  10. package/dist/cli/computeCoreSchemaHash-DPJZj-qJ.js.map +1 -0
  11. package/dist/cli/default-BCQHcwbL.js +253 -0
  12. package/dist/cli/default-BCQHcwbL.js.map +1 -0
  13. package/dist/cli/disableSuggestions-yO9UqiWn.js +21 -0
  14. package/dist/cli/disableSuggestions-yO9UqiWn.js.map +1 -0
  15. package/dist/cli/dist-C1JhdHfo.js +2001 -0
  16. package/dist/cli/dist-C1JhdHfo.js.map +1 -0
  17. package/dist/cli/graphql-DG9thCDG.js +14589 -0
  18. package/dist/cli/graphql-DG9thCDG.js.map +1 -0
  19. package/dist/cli/index.d.ts +350 -0
  20. package/dist/cli/index.js +35047 -0
  21. package/dist/cli/index.js.map +1 -0
  22. package/dist/cli/index.min-BsIHDfFK.js +613 -0
  23. package/dist/cli/index.min-BsIHDfFK.js.map +1 -0
  24. package/dist/cli/inlineTrace-uLgOJ3TH.js +52 -0
  25. package/dist/cli/inlineTrace-uLgOJ3TH.js.map +1 -0
  26. package/dist/cli/internalPlugin-DnuwN4_4.js +11 -0
  27. package/dist/cli/internalPlugin-DnuwN4_4.js.map +1 -0
  28. package/dist/cli/packageVersion-DQAnIEil.js +6 -0
  29. package/dist/cli/packageVersion-DQAnIEil.js.map +1 -0
  30. package/dist/cli/rolldown-runtime-BMI-E3GI.js +44 -0
  31. package/dist/cli/schemaIsSubgraph-DoGh3OYj.js +17 -0
  32. package/dist/cli/schemaIsSubgraph-DoGh3OYj.js.map +1 -0
  33. package/dist/cli/schemaReporting-K-me-3-v.js +199 -0
  34. package/dist/cli/schemaReporting-K-me-3-v.js.map +1 -0
  35. package/dist/cli/server-runtime.js +49859 -0
  36. package/dist/cli/server-runtime.js.map +1 -0
  37. package/dist/cli/traceTreeBuilder-BIcV2U7b.js +9118 -0
  38. package/dist/cli/traceTreeBuilder-BIcV2U7b.js.map +1 -0
  39. package/dist/cli/usageReporting-Bpl8vSZX.js +10201 -0
  40. package/dist/cli/usageReporting-Bpl8vSZX.js.map +1 -0
  41. package/dist/cli/v4-CBhFvC49.js +42 -0
  42. package/dist/cli/v4-CBhFvC49.js.map +1 -0
  43. package/dist/components.d.ts +5 -3
  44. package/dist/components.js +5 -3
  45. package/dist/content-types.json +93 -0
  46. package/dist/core/dist/define-component.d.ts +37 -0
  47. package/dist/core/dist/index.d.ts +2 -2
  48. package/dist/docs/account-entry-point.md +1 -1
  49. package/dist/docs/account-menu-identity.md +160 -0
  50. package/dist/docs/account-menu.md +106 -23
  51. package/dist/docs/avatar.md +103 -0
  52. package/dist/docs/my-account-profile.md +1 -1
  53. package/dist/docs/product-shelf.md +20 -13
  54. package/dist/index.d.ts +2 -2
  55. package/dist/internal/client.js +1 -1
  56. package/dist/internal/content.d.ts +2 -2
  57. package/dist/internal/server.d.ts +4 -1
  58. package/dist/internal/server.js +4 -1
  59. package/dist/matter/account-access-gate/account-access-gate.js.map +1 -1
  60. package/dist/matter/account-entry-point/account-entry-point.js +1 -1
  61. package/dist/matter/account-entry-point/account-entry-point.js.map +1 -1
  62. package/dist/matter/account-menu/account-menu.d.ts +70 -0
  63. package/dist/matter/account-menu/account-menu.js +201 -9
  64. package/dist/matter/account-menu/account-menu.js.map +1 -1
  65. package/dist/matter/account-menu/sign-out-failure.js +50 -0
  66. package/dist/matter/account-menu/sign-out-failure.js.map +1 -0
  67. package/dist/matter/account-menu-identity/account-menu-identity.d.ts +21 -0
  68. package/dist/matter/account-menu-identity/account-menu-identity.js +88 -0
  69. package/dist/matter/account-menu-identity/account-menu-identity.js.map +1 -0
  70. package/dist/matter/card-entry/card-entry.js +1 -0
  71. package/dist/matter/card-entry/card-entry.js.map +1 -1
  72. package/dist/matter/cart/cart.js +1 -1
  73. package/dist/matter/client-preferences/client-preferences-fieldset.js +2 -2
  74. package/dist/matter/client-profile-form/client-profile-fieldset.js +2 -2
  75. package/dist/matter/identity-summary/identity-summary.js +2 -1
  76. package/dist/matter/identity-summary/identity-summary.js.map +1 -1
  77. package/dist/matter/my-account-profile/my-account-profile.d.ts +3 -0
  78. package/dist/matter/my-account-profile/my-account-profile.js +2 -1
  79. package/dist/matter/my-account-profile/my-account-profile.js.map +1 -1
  80. package/dist/matter/payment/payment-controller.js +1 -0
  81. package/dist/matter/payment/payment-controller.js.map +1 -1
  82. package/dist/matter/payment/payment.js +1 -0
  83. package/dist/matter/payment/payment.js.map +1 -1
  84. package/dist/matter/product-shelf/product-shelf.d.ts +61 -31
  85. package/dist/matter/product-shelf/product-shelf.js +157 -57
  86. package/dist/matter/product-shelf/product-shelf.js.map +1 -1
  87. package/dist/matter/saved-cards/saved-cards.js +1 -0
  88. package/dist/matter/saved-cards/saved-cards.js.map +1 -1
  89. package/dist/matter/shipping-address/shipping-address.js +2 -2
  90. package/dist/particles/avatar/avatar.d.ts +17 -0
  91. package/dist/particles/avatar/avatar.js +65 -0
  92. package/dist/particles/avatar/avatar.js.map +1 -0
  93. package/dist/schema.graphql +65 -26
  94. package/dist/sdk/analytics/use-analytics-actions.js +2 -1
  95. package/dist/sdk/analytics/use-analytics-actions.js.map +1 -1
  96. package/dist/sdk/cart/use-cart-actions.js +9 -8
  97. package/dist/sdk/cart/use-cart-actions.js.map +1 -1
  98. package/dist/sdk/cart/use-cart-validate-on-open.js +2 -1
  99. package/dist/sdk/cart/use-cart-validate-on-open.js.map +1 -1
  100. package/dist/sdk/content/create-content-runtime.d.ts +22 -1
  101. package/dist/sdk/content/create-content-runtime.js +89 -1
  102. package/dist/sdk/content/create-content-runtime.js.map +1 -1
  103. package/dist/sdk/data/empty-content-value.js +16 -0
  104. package/dist/sdk/data/empty-content-value.js.map +1 -0
  105. package/dist/sdk/data/hot-data-provider.js +2 -1
  106. package/dist/sdk/data/hot-data-provider.js.map +1 -1
  107. package/dist/sdk/data/index.js +2 -2
  108. package/dist/sdk/data/reactive-list-item-data-provider.js +2 -2
  109. package/dist/sdk/data/variables-from-content.d.ts +43 -0
  110. package/dist/sdk/data/variables-from-content.js +57 -0
  111. package/dist/sdk/data/variables-from-content.js.map +1 -0
  112. package/dist/sdk/generated/gql.js +2 -1
  113. package/dist/sdk/generated/gql.js.map +1 -1
  114. package/dist/sdk/generated/graphql.js +85 -1
  115. package/dist/sdk/generated/graphql.js.map +1 -1
  116. package/dist/sdk/identity/use-identity-actions.js +5 -4
  117. package/dist/sdk/identity/use-identity-actions.js.map +1 -1
  118. package/dist/sdk/payment/use-payment-actions.js +1 -1
  119. package/dist/sdk/payment/use-place-order.js +1 -1
  120. package/dist/sdk/region/use-region-actions.js +2 -1
  121. package/dist/sdk/region/use-region-actions.js.map +1 -1
  122. package/dist/sdk/session/read-server-session.d.ts +21 -0
  123. package/dist/sdk/session/read-server-session.js +61 -0
  124. package/dist/sdk/session/read-server-session.js.map +1 -0
  125. package/dist/sdk/session/use-session-actions.js +5 -4
  126. package/dist/sdk/session/use-session-actions.js.map +1 -1
  127. package/dist/sdk/session/use-session-revalidation.js +2 -1
  128. package/dist/sdk/session/use-session-revalidation.js.map +1 -1
  129. package/dist/sdk/shipping/use-shipping-actions.js +3 -2
  130. package/dist/sdk/shipping/use-shipping-actions.js.map +1 -1
  131. package/dist/utils/safe-href.d.ts +11 -0
  132. package/package.json +13 -2
@@ -0,0 +1,350 @@
1
+ import { GraphQLFieldResolver, GraphQLScalarType, GraphQLSchema } from "graphql";
2
+ import * as esbuild from "esbuild";
3
+ //#region ../graphql-compose/dist/subgraph-names.d.ts
4
+ /**
5
+ * Subgraph name the bundled core SDL is composed under. Shared by the composer
6
+ * (which labels core's `join__Graph` value with it) and the dev router config
7
+ * (which keys core's header rules and TLS escape hatch off it), so the name a
8
+ * schema composes under is the name the router shapes headers for.
9
+ */
10
+ export declare const CORE_SUBGRAPH_NAME = "storefront-api-core";
11
+ //#endregion
12
+ //#region src/cli/host.d.ts
13
+ /**
14
+ * What a host hands the runner. The runner bundles with the host's esbuild twice: to load an
15
+ * author's TypeScript declaration (`validate`, `build`, `dev`) and to emit `server.mjs` (`build`).
16
+ * esbuild ships a native binary that cannot be bundled, so it is the host's dependency, not the
17
+ * SDK's (ADR-00020).
18
+ */
19
+ type RunnerHost = {
20
+ esbuild: typeof esbuild;
21
+ };
22
+ //#endregion
23
+ //#region src/cli/build.d.ts
24
+ /**
25
+ * The result of a successful build: the emitted `dist/`, the server and the
26
+ * SDL slice inside it, and the composed artifacts — which live in scratch,
27
+ * never in `dist/`.
28
+ */
29
+ type BuildResult = {
30
+ distDir: string;
31
+ serverFile: string;
32
+ sdlPath: string;
33
+ supergraphFile: string;
34
+ publicSchemaFile: string;
35
+ };
36
+ /** Raised when `validate` fails as `build`'s fail-closed gate — carries the aggregated report lines. */
37
+ export declare class ValidationGateError extends Error {
38
+ readonly reportLines: string[];
39
+ constructor(reportLines: string[]);
40
+ }
41
+ /** Raised when the TypeScript compiler reports diagnostics — carries them formatted for verbatim output. */
42
+ export declare class CompileError extends Error {
43
+ constructor(message: string);
44
+ }
45
+ /**
46
+ * Produces the deployable artifact for an extension: runs `validate` first as a
47
+ * fail-closed gate (any failure emits nothing and throws `ValidationGateError`),
48
+ * type-checks the extension, loads the declaration through the host's esbuild,
49
+ * writes `extension.graphql` from `printSubgraphSdl` of that declaration and
50
+ * bundles `server.mjs` into a staging dir under the `.vtex/storefront/` scratch
51
+ * dir, and only then swaps the assembled staging dir into `dist/`. `dist/` is
52
+ * therefore only ever absent, the previous complete artifact, or the new
53
+ * complete artifact — a failed build never leaves partial output or keeps
54
+ * stale files from an earlier build. Output is `server.mjs` + the SDL slice
55
+ * only — no `router.json`, and no composed artifact (Decision 1). Throws on
56
+ * any failure so the caller can surface it and exit non-zero.
57
+ *
58
+ * The composed artifacts go to `.vtex/storefront/` scratch instead, so a
59
+ * store's CI compile has a fresh client schema without a running `dev` loop.
60
+ * They are composed from the same slice `server.mjs` serves and written only
61
+ * after `dist/` is in place, so an emitted artifact always describes emitted
62
+ * output.
63
+ */
64
+ export declare function buildExtension(extensionRoot: string, host: RunnerHost): Promise<BuildResult>;
65
+ //#endregion
66
+ //#region src/cli/capability-lint.d.ts
67
+ /** The three forbidden reaches the capability lint enforces on first-party source. */
68
+ type CapabilityRule = 'process-env' | 'fs-import' | 'child-process-import';
69
+ /** One violation found in the author's first-party source. */
70
+ type CapabilityFinding = {
71
+ file: string;
72
+ rule: CapabilityRule;
73
+ line: number;
74
+ column: number;
75
+ };
76
+ /**
77
+ * Walks the extension's first-party import graph from `entry` — following
78
+ * relative specifiers transitively, stopping at bare specifiers
79
+ * (`node_modules`) — and returns every capability violation (`process.env`
80
+ * access, `fs`/`child_process` imports). Throws when `entry` does not exist:
81
+ * this check is the authoritative gate (ADR-0002), so a misconfigured entry
82
+ * must fail closed, never pass as "no findings". Pure over the filesystem it
83
+ * reads: no `process.env` access, no mutation, no exit. The TypeScript
84
+ * compiler is loaded on first call, never at module load (see `typescript.ts`).
85
+ */
86
+ export declare function lintExtension(entry: string): Promise<CapabilityFinding[]>;
87
+ /** Formats a finding as a single `file:line:col — rule` line for humans. */
88
+ export declare function formatFinding(finding: CapabilityFinding): string;
89
+ //#endregion
90
+ //#region src/cli/runner-env.d.ts
91
+ type RunnerEnv = {
92
+ account?: string;
93
+ workspace: string;
94
+ token?: string;
95
+ coreUrl?: string;
96
+ subgraphPort: number;
97
+ routerPort: number;
98
+ insecureSkipTlsVerify: boolean;
99
+ };
100
+ //#endregion
101
+ //#region src/cli/dev.d.ts
102
+ type DevRunHandle = {
103
+ routerUrl: string;
104
+ stop: () => Promise<void>;
105
+ /**
106
+ * Watch-mode reload: restart the subgraph and recompose `supergraph.graphql`
107
+ * in place. The router hot-swaps the rewritten file (never restarted). The
108
+ * declaration is re-bundled, so an edit anywhere in its first-party module
109
+ * graph lands on a new bundle and is evaluated afresh. Concurrent calls run
110
+ * one after another, and `stop` waits for the one in flight.
111
+ */
112
+ reload: () => Promise<void>;
113
+ };
114
+ type RunDevOptions = {
115
+ /**
116
+ * Register process SIGINT/SIGTERM handlers that tear the run down and exit.
117
+ * True for a standalone `dev`; watch mode passes false and owns a single
118
+ * handler set across reloads (see `runDevWatch`).
119
+ */
120
+ registerSignals?: boolean;
121
+ /**
122
+ * When set, generate the router config with a supergraph poll interval (in
123
+ * seconds). Watch mode sets it so the router hot-swaps a recomposed
124
+ * `supergraph.graphql` without a restart.
125
+ */
126
+ watchSupergraphSeconds?: number;
127
+ };
128
+ /**
129
+ * Orchestrates the full `runDev` loop: loads the declaration, starts
130
+ * the subgraph server, composes it offline with the embedded core SDL, resolves
131
+ * the pinned Hive Router binary, and launches the router against the composed
132
+ * supergraph. Returns a handle so callers (the host, or tests) can await
133
+ * readiness and tear the loop down. `env` defaults to the extension's `.env` +
134
+ * `process.env`; tests inject one directly to skip file I/O.
135
+ *
136
+ * `watchSupergraphSeconds` writes the router config with a supergraph poll
137
+ * interval, so a subsequently recomposed `supergraph.graphql` is hot-swapped in
138
+ * place (watch mode uses this instead of restarting the router).
139
+ */
140
+ export declare function runDev(extensionRoot: string, host: RunnerHost, env?: RunnerEnv, { registerSignals, watchSupergraphSeconds }?: RunDevOptions): Promise<DevRunHandle>;
141
+ type DevWatchHandle = {
142
+ routerUrl: string;
143
+ stop: () => Promise<void>;
144
+ };
145
+ /**
146
+ * Runs the dev loop under a file watcher rooted at the declaration entry's
147
+ * directory. On save it restarts the subgraph (new resolvers/schema) and
148
+ * recomposes `supergraph.graphql`; the router is launched with a supergraph
149
+ * poll interval, so it picks that file up and hot-swaps the graph in place —
150
+ * gracefully, in-flight requests drain, no restart, no port re-bind. This is
151
+ * why reload never touches the router child.
152
+ *
153
+ * `fs.watch` has no ignore option, so generated paths are filtered in the
154
+ * change callback — otherwise the run's own writes into `.vtex/storefront/`
155
+ * would feed the loop back into itself.
156
+ *
157
+ * Owns a single SIGINT/SIGTERM handler set across reloads (`runDev` is started
158
+ * with `registerSignals: false`).
159
+ */
160
+ export declare function runDevWatch(extensionRoot: string, host: RunnerHost, env?: RunnerEnv): Promise<DevWatchHandle>;
161
+ //#endregion
162
+ //#region src/graphql/types.d.ts
163
+ /**
164
+ * The extension's entire resolver security surface — exactly five keys, and
165
+ * nothing more (see ADR-0003). `buildContext` assembles it from the inbound
166
+ * subgraph request plus the declared secrets; the Seam A key-set test pins
167
+ * that a resolver sees these five keys and no raw request state.
168
+ */
169
+ type SubgraphContext = {
170
+ /** Canonical `x-vtex-account`, verbatim; `''` when absent (router-bypass). */
171
+ account: string;
172
+ /** Canonical `x-vtex-workspace`, verbatim; `''` when absent. */
173
+ workspace: string;
174
+ /**
175
+ * The curated allow-list of forwarded `x-vtex-*` headers (locale, segment,
176
+ * session) — never `authorization` (that is `token`) or the tenant pair
177
+ * (that is `account`/`workspace`). Values keep Node's `string | string[]`
178
+ * shape; absent allow-listed headers are omitted.
179
+ */
180
+ headers: Record<string, string | string[]>;
181
+ /** Forwarded `authorization` header, verbatim (no `Bearer`-stripping); `''` when absent. */
182
+ token: string;
183
+ /**
184
+ * The declared secret names present in the environment, mapped to their
185
+ * values. Undeclared and declared-but-unset names are both absent (open
186
+ * record — declared-names typing holds at runtime, not in TS generics).
187
+ */
188
+ secrets: Record<string, string | undefined>;
189
+ };
190
+ /**
191
+ * The same resolver map shape `buildSubgraphSchema` accepts, with the context an author's
192
+ * resolver actually receives as the default.
193
+ *
194
+ * `TContext` defaults to `SubgraphContext` rather than being fixed to `unknown`, because under
195
+ * `strictFunctionTypes` an `unknown` context makes the third argument contravariant, and that
196
+ * rejects the very annotation this type is meant to support:
197
+ * `(_parent, _args, ctx: SubgraphContext) => …` did not compile. Naming it also lets an
198
+ * unannotated `ctx` infer instead of widening to `unknown`.
199
+ *
200
+ * The runner passes `SubgraphResolvers<unknown>` where it hands the map to
201
+ * `buildSubgraphSchema`, whose own signature is context-agnostic (`GraphQLResolverMap<any>`).
202
+ *
203
+ * Restated locally, rather than imported from `@apollo/subgraph`'s `GraphQLResolverMap<unknown>`,
204
+ * so `./graphql` stays a zero-import island with no `@apollo/subgraph` dependency.
205
+ */
206
+ type SubgraphResolvers<TContext = SubgraphContext> = {
207
+ [typeName: string]: {
208
+ [fieldName: string]: GraphQLFieldResolver<any, TContext> | {
209
+ requires?: string;
210
+ resolve?: GraphQLFieldResolver<any, TContext>;
211
+ subscribe?: GraphQLFieldResolver<any, TContext>;
212
+ };
213
+ } | GraphQLScalarType | {
214
+ [enumValue: string]: string | number;
215
+ };
216
+ };
217
+ /**
218
+ * The single primitive an extension author calls. `typeDefs` is plain SDL:
219
+ * the author writes `@key`/`@external` on entities they extend; the SDK
220
+ * injects the federation `@link` preamble, generates each entity's
221
+ * `__resolveReference`, and prefixes every name the extension contributes
222
+ * with `vendor_` (see `applyVendorPrefix` in `./vendor-prefix`).
223
+ */
224
+ type SubgraphDefinition = {
225
+ /**
226
+ * Required. The publisher's VTEX vendor; validated `^[a-z][a-z0-9]*$`.
227
+ * Prefixes every name this subgraph contributes (entity-extension fields,
228
+ * root fields, and declared types) — applied by the SDK, never typed by
229
+ * the author. See ADR-0001.
230
+ */
231
+ vendor: string;
232
+ /** Defaults to the package name; the subgraph name used at compose time. */
233
+ name?: string;
234
+ /** Plain SDL, authored with bare names. The SDK applies the vendor prefix. */
235
+ typeDefs: string;
236
+ /** Core entities this subgraph extends (e.g. `['Product']`); must be on the bundled allow-list. */
237
+ extends: string[];
238
+ /** Author resolvers keyed by bare names; the SDK remaps keys to the prefixed names and merges __resolveReference. */
239
+ resolvers: SubgraphResolvers;
240
+ /**
241
+ * Env-var names this extension declares it needs. Their values populate
242
+ * `ctx.secrets` (read from `process.env`); undeclared names never reach a
243
+ * resolver. Optional — an extension with no secrets omits it. See ADR-0003.
244
+ */
245
+ secrets?: string[];
246
+ };
247
+ //#endregion
248
+ //#region src/cli/load-declaration.d.ts
249
+ /**
250
+ * Resolves the extension's declaration entry point: `src/index.ts` by
251
+ * convention, overridable via the extension package.json's `main` field.
252
+ */
253
+ export declare function resolveDeclarationEntry(extensionRoot: string): string;
254
+ //#endregion
255
+ //#region src/cli/subgraph/build-subgraph.d.ts
256
+ /**
257
+ * Turns a `SubgraphDefinition` into an executable Federation v2 subgraph
258
+ * schema: validates `vendor` and the `extends` allow-list, applies the
259
+ * vendor-prefix pass over `typeDefs`, injects the `@link` preamble when
260
+ * absent, generates an identity `__resolveReference` for each entity in
261
+ * `extends`, merges the author's resolvers (remapped to the prefixed field
262
+ * names), and hands the result to `buildSubgraphSchema`. Throws descriptive
263
+ * errors for the declared edge scenarios instead of letting a cryptic
264
+ * graphql-js error surface.
265
+ *
266
+ * Extension-contributed mutations execute independently of core mutations:
267
+ * federation gives no distributed-transaction guarantee across subgraphs, so
268
+ * a document mixing an extension mutation with a core mutation runs both
269
+ * non-atomically. Authors own idempotency/compensation for their own
270
+ * mutations (see the RFC's "Resolved v1 decisions").
271
+ */
272
+ export declare function buildSubgraph(definition: SubgraphDefinition): GraphQLSchema;
273
+ //#endregion
274
+ //#region src/cli/subgraph/print-subgraph-sdl.d.ts
275
+ /**
276
+ * The federation-form SDL slice: the author's `typeDefs` with the vendor
277
+ * prefix applied and the `@link` preamble applied (injected, unless already
278
+ * present) — the exact input handed to `composeSupergraph`, whether the caller
279
+ * is `validate`, `build` or the `dev` loop. Routes through the same prefix pass
280
+ * `buildSubgraph` uses so the compose-facing SDL matches the built schema
281
+ * byte-for-byte. Round-trips through `parse`/`print` so formatting is
282
+ * normalized.
283
+ */
284
+ export declare function printSubgraphSdl(definition: SubgraphDefinition): string;
285
+ //#endregion
286
+ //#region src/cli/templates.d.ts
287
+ /**
288
+ * A scaffold for a storefront extension. `files` renders every file of the
289
+ * scaffold, keyed by its path relative to the extension root; nothing here
290
+ * writes to disk — the host (`vtex extensions add`) decides where the files go
291
+ * and what to do when one already exists.
292
+ */
293
+ type StorefrontTemplate = {
294
+ name: string;
295
+ description: string;
296
+ files(options: {
297
+ name: string;
298
+ vendor: string;
299
+ }): Record<string, string>;
300
+ };
301
+ /**
302
+ * The scaffolds `@vtex/faststore/cli` ships. One today, `default`: the
303
+ * `Product.reviews` sample every reference extension in this repository
304
+ * started from. A `vendor` that violates the vendor grammar is rejected up
305
+ * front, so a template never renders a declaration that would fail `validate`.
306
+ */
307
+ export declare const templates: StorefrontTemplate[];
308
+ //#endregion
309
+ //#region src/cli/validate.d.ts
310
+ /**
311
+ * The aggregated "am I shippable?" report: every capability finding, every
312
+ * composition error, and — when `buildSubgraph` itself rejects the
313
+ * declaration (allow-list, `vendor`, malformed typeDefs) — the build error.
314
+ * `ok` is true only when all three are clean.
315
+ */
316
+ type ValidationReport = {
317
+ capability: CapabilityFinding[];
318
+ composition: Error[];
319
+ buildError?: Error;
320
+ ok: boolean;
321
+ };
322
+ /**
323
+ * Runs the full offline validation of an extension and returns the aggregated
324
+ * report — the shared core behind the host's `validate` verb and `build`'s
325
+ * fail-closed gate. It:
326
+ *
327
+ * 1. loads the declaration through the host's esbuild (the same
328
+ * `loadDeclaration` `dev` uses),
329
+ * 2. builds the subgraph (allow-list rejection and `vendor` validation surface
330
+ * here as a thrown error, captured into `buildError`),
331
+ * 3. runs the capability `lintExtension` over first-party source, and
332
+ * 4. runs the in-process `composeCheck` of the emitted SDL slice against the
333
+ * embedded core SDL.
334
+ *
335
+ * It never short-circuits: a build error still lets the capability lint run,
336
+ * and both are reported together. No network I/O, no router binary — the
337
+ * composition check is `@theguild/federation-composition` in-process, the same
338
+ * composer `dev` and the core SDL CI gate call (ADR-0004, D1).
339
+ */
340
+ export declare function validateExtension(extensionRoot: string, host: RunnerHost): Promise<ValidationReport>;
341
+ /**
342
+ * Renders a `ValidationReport`'s failures as human-readable lines, grouped by
343
+ * category (build/allow-list, capability, composition) — every failure in one
344
+ * pass, never short-circuited at the first. Returns an empty array for a clean
345
+ * report so the caller prints its own success line.
346
+ */
347
+ export declare function formatValidationReport(report: ValidationReport): string[];
348
+ //#endregion
349
+ export type { BuildResult, CapabilityFinding, CapabilityRule, DevRunHandle, DevWatchHandle, RunnerHost, StorefrontTemplate, ValidationReport };
350
+ //# sourceMappingURL=index.d.ts.map