@pwfabric/core 1.0.0-rc.0 → 1.0.0-rc.2
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 +28 -5
- package/dist/blocks/host-imports.d.ts +27 -7
- package/dist/blocks/host-imports.js +58 -1
- package/dist/blocks/host-imports.js.map +1 -1
- package/dist/blocks/index.d.ts +1 -2
- package/dist/blocks/index.js +1 -1
- package/dist/blocks/index.js.map +1 -1
- package/dist/blocks/layout-schema.d.ts +0 -1
- package/dist/blocks/layout-schema.js.map +1 -1
- package/dist/blocks/types.d.ts +0 -1
- package/dist/blocks/types.js.map +1 -1
- package/dist/capability-builder.d.ts +0 -1
- package/dist/capability-builder.js.map +1 -1
- package/dist/config-schema-builder.d.ts +0 -1
- package/dist/config-schema-builder.js.map +1 -1
- package/dist/contract-builder.d.ts +0 -1
- package/dist/contract-builder.js.map +1 -1
- package/dist/contracts/passthrough.d.ts +0 -1
- package/dist/contracts/passthrough.js.map +1 -1
- package/dist/errors/AppError.d.ts +0 -1
- package/dist/errors/AppError.js.map +1 -1
- package/dist/errors/ErrorCode.d.ts +0 -1
- package/dist/errors/ErrorCode.js.map +1 -1
- package/dist/errors/index.d.ts +0 -1
- package/dist/errors/index.js.map +1 -1
- package/dist/errors.d.ts +0 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +0 -1
- package/dist/logger.js.map +1 -1
- package/dist/monitoring/index.d.ts +0 -1
- package/dist/monitoring/index.js.map +1 -1
- package/dist/monitoring/metrics.d.ts +0 -1
- package/dist/monitoring/metrics.js.map +1 -1
- package/dist/monitoring/web-vitals.d.ts +0 -1
- package/dist/monitoring/web-vitals.js.map +1 -1
- package/dist/oauth-scopes.d.ts +0 -1
- package/dist/oauth-scopes.js.map +1 -1
- package/dist/observability/index.d.ts +0 -1
- package/dist/observability/index.js.map +1 -1
- package/dist/observability/logger.d.ts +0 -1
- package/dist/observability/logger.js.map +1 -1
- package/dist/observability/tracer.d.ts +0 -1
- package/dist/observability/tracer.js.map +1 -1
- package/dist/state.d.ts +0 -1
- package/dist/state.js.map +1 -1
- package/dist/utils.d.ts +0 -1
- package/dist/utils.js.map +1 -1
- package/package.json +24 -17
- package/dist/blocks/host-imports.d.ts.map +0 -1
- package/dist/blocks/index.d.ts.map +0 -1
- package/dist/blocks/layout-schema.d.ts.map +0 -1
- package/dist/blocks/types.d.ts.map +0 -1
- package/dist/capability-builder.d.ts.map +0 -1
- package/dist/config-schema-builder.d.ts.map +0 -1
- package/dist/contract-builder.d.ts.map +0 -1
- package/dist/contracts/passthrough.d.ts.map +0 -1
- package/dist/errors/AppError.d.ts.map +0 -1
- package/dist/errors/ErrorCode.d.ts.map +0 -1
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/logger.d.ts.map +0 -1
- package/dist/monitoring/index.d.ts.map +0 -1
- package/dist/monitoring/metrics.d.ts.map +0 -1
- package/dist/monitoring/web-vitals.d.ts.map +0 -1
- package/dist/oauth-scopes.d.ts.map +0 -1
- package/dist/observability/index.d.ts.map +0 -1
- package/dist/observability/logger.d.ts.map +0 -1
- package/dist/observability/tracer.d.ts.map +0 -1
- package/dist/state.d.ts.map +0 -1
- package/dist/utils.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,14 +1,37 @@
|
|
|
1
1
|
# @pwfabric/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The primitives the rest of the engine is built from: errors, logging, metrics,
|
|
4
|
+
tracing, contract and capability builders, retry and id helpers. It re-exports
|
|
5
|
+
`@pwfabric/contracts`, so one import gives you both.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
4
8
|
|
|
5
9
|
```bash
|
|
6
|
-
pnpm add @pwfabric/core
|
|
10
|
+
pnpm add @pwfabric/core@rc zod@3
|
|
7
11
|
```
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
ESM only: import it from an ES module (`"type": "module"` or `.mjs`). Node 22+.
|
|
14
|
+
|
|
15
|
+
## Main exports
|
|
16
|
+
|
|
17
|
+
| Export | What it is |
|
|
18
|
+
|--------|------------|
|
|
19
|
+
| everything from `@pwfabric/contracts` | Re-exported |
|
|
20
|
+
| `PWFabricError`, `NotFoundError`, `UnauthorizedError`, `ForbiddenError`, `AppError`, `ErrorCode`, `getHttpStatus`, `isRetryable` | Errors and their HTTP mapping |
|
|
21
|
+
| `Logger`, `createLogger`, `ConsoleLogger`, `createObservabilityLogger` | Logging |
|
|
22
|
+
| `createTraceContext`, `createSpan`, `extractTraceId`, `injectTraceId` | Tracing |
|
|
23
|
+
| `observeAllWebVitals`, `observeLCP`, `observeINP`, …, `DEFAULT_BUDGET` | Web-vitals metrics |
|
|
24
|
+
| `defineContract`, `ContractBuilder`, `defineCapability`, `CapabilityBuilder` | Builders |
|
|
25
|
+
| `sleep`, `retry`, `generateId` | Utilities |
|
|
26
|
+
|
|
27
|
+
## Entry points
|
|
28
|
+
|
|
29
|
+
| Import | Contents |
|
|
30
|
+
|--------|----------|
|
|
31
|
+
| `@pwfabric/core` | Everything above (the only entry point) |
|
|
11
32
|
|
|
12
33
|
## Licence
|
|
13
34
|
|
|
14
|
-
Business Source License 1.1 — see `LICENSE`. Use it, change it, host what you build with it; do not offer PWFabric itself as a service.
|
|
35
|
+
Business Source License 1.1 — see `LICENSE`. Use it, change it, and host what you build with it, for yourself or your own customers; do not offer PWFabric itself as a service. Each version becomes Apache-2.0 on the Change Date in `LICENSE`. See [licensing](https://pwfabric.com/licence).
|
|
36
|
+
|
|
37
|
+
Part of [PWFabric](https://pwfabric.com) — the engine that renders an app. Source: [github.com/pwfabric/pwfabric](https://github.com/pwfabric/pwfabric).
|
|
@@ -48,12 +48,12 @@ export type HostImportKind = 'global';
|
|
|
48
48
|
* `every-host` — both the app host and the standalone export's IIFE
|
|
49
49
|
* (`@pwfabric/embed`'s `embed-global.ts`) must seed it.
|
|
50
50
|
* `app-host` — the app host seeds it; the standalone export deliberately
|
|
51
|
-
* does NOT.
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
51
|
+
* does NOT. No entry is in this class today. The sdk global
|
|
52
|
+
* was, until 1.0.0-rc.2: a block written the documented way
|
|
53
|
+
* calls `defineBlock()` when its bundle loads, so a shipped
|
|
54
|
+
* app whose page did not seed the sdk rendered none of them.
|
|
55
|
+
* The renderer bundle carries the authoring kit anyway, so it
|
|
56
|
+
* now seeds it like the rest.
|
|
57
57
|
* `unseeded` — nothing seeds it yet. The specifier resolves (the shim is
|
|
58
58
|
* served) but its named exports come back `undefined`. That is
|
|
59
59
|
* strictly better than an unresolved bare specifier, which
|
|
@@ -125,4 +125,24 @@ export declare function unseededHostGlobals(): readonly HostImport[];
|
|
|
125
125
|
* so it must export the union of what those specifiers' consumers import.
|
|
126
126
|
*/
|
|
127
127
|
export declare function specifiersForShim(shim: string): readonly string[];
|
|
128
|
-
|
|
128
|
+
/** Whether `name` can be an `export const { name }` binding in a shim module. */
|
|
129
|
+
export declare function isExportableName(name: string): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Source of one shim module: it re-exports the instance a host seeded on
|
|
132
|
+
* `globalThis[global]`, as a default export and as one named export per entry
|
|
133
|
+
* of `names` that can be a binding (see {@link isExportableName}), deduplicated
|
|
134
|
+
* and sorted. `shim` is a file from {@link blockShimFiles}; the header comment
|
|
135
|
+
* lists the specifiers that resolve to it.
|
|
136
|
+
*
|
|
137
|
+
* Every host serving block bundles writes these files; the names are the
|
|
138
|
+
* host's to supply (an ESM import of a name the shim does not export fails the
|
|
139
|
+
* whole block at link time, so they should be read off the very object the host
|
|
140
|
+
* seeds).
|
|
141
|
+
*
|
|
142
|
+
* A shim whose global every host must seed (`seeding: 'every-host'`) throws a
|
|
143
|
+
* readable error when the global is missing, naming the global and the
|
|
144
|
+
* specifiers: the alternative is a destructuring `TypeError` inside a blob
|
|
145
|
+
* module, which says nothing about the host that forgot to seed it. A shim for
|
|
146
|
+
* an `unseeded` global keeps degrading to `undefined` exports instead.
|
|
147
|
+
*/
|
|
148
|
+
export declare function shimSource(shim: string, global: string, names: readonly string[]): string;
|
|
@@ -108,7 +108,7 @@ export const BLOCK_HOST_IMPORTS = [
|
|
|
108
108
|
specifier: '@pwfabric/authoring',
|
|
109
109
|
kind: 'global',
|
|
110
110
|
global: '__pwfabric_sdk',
|
|
111
|
-
seeding: '
|
|
111
|
+
seeding: 'every-host',
|
|
112
112
|
shim: 'sdk@v1.mjs',
|
|
113
113
|
reason: 'What the scaffolding emits and a third-party author reads first. A host that does not map it breaks every block that follows the documented path.',
|
|
114
114
|
},
|
|
@@ -180,4 +180,61 @@ export function unseededHostGlobals() {
|
|
|
180
180
|
export function specifiersForShim(shim) {
|
|
181
181
|
return BLOCK_HOST_IMPORTS.filter((i) => i.shim === shim).map((i) => i.specifier);
|
|
182
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* Names a shim must not bind even though they parse as identifiers.
|
|
185
|
+
*
|
|
186
|
+
* Reserved words fail the parse outright. `undefined`, `NaN` and `Infinity`
|
|
187
|
+
* are global value properties: `export const { undefined } = m` parses, but
|
|
188
|
+
* it shadows a restricted name (lint refuses it, and some toolchains refuse to
|
|
189
|
+
* parse it), and no block imports them by name. zod exports `undefined` (its
|
|
190
|
+
* `z.undefined()` schema), so a shim built from zod's keys would carry it.
|
|
191
|
+
*/
|
|
192
|
+
const NON_BINDABLE_NAMES = new Set(('break case catch class const continue debugger default delete do else enum export extends false finally for ' +
|
|
193
|
+
'function if import in instanceof new null return super switch this throw true try typeof var void while with ' +
|
|
194
|
+
'yield let static implements interface package private protected public await arguments eval ' +
|
|
195
|
+
'undefined NaN Infinity').split(' '));
|
|
196
|
+
/** Whether `name` can be an `export const { name }` binding in a shim module. */
|
|
197
|
+
export function isExportableName(name) {
|
|
198
|
+
return /^[A-Za-z_$][\w$]*$/.test(name) && !NON_BINDABLE_NAMES.has(name);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Source of one shim module: it re-exports the instance a host seeded on
|
|
202
|
+
* `globalThis[global]`, as a default export and as one named export per entry
|
|
203
|
+
* of `names` that can be a binding (see {@link isExportableName}), deduplicated
|
|
204
|
+
* and sorted. `shim` is a file from {@link blockShimFiles}; the header comment
|
|
205
|
+
* lists the specifiers that resolve to it.
|
|
206
|
+
*
|
|
207
|
+
* Every host serving block bundles writes these files; the names are the
|
|
208
|
+
* host's to supply (an ESM import of a name the shim does not export fails the
|
|
209
|
+
* whole block at link time, so they should be read off the very object the host
|
|
210
|
+
* seeds).
|
|
211
|
+
*
|
|
212
|
+
* A shim whose global every host must seed (`seeding: 'every-host'`) throws a
|
|
213
|
+
* readable error when the global is missing, naming the global and the
|
|
214
|
+
* specifiers: the alternative is a destructuring `TypeError` inside a blob
|
|
215
|
+
* module, which says nothing about the host that forgot to seed it. A shim for
|
|
216
|
+
* an `unseeded` global keeps degrading to `undefined` exports instead.
|
|
217
|
+
*/
|
|
218
|
+
export function shimSource(shim, global, names) {
|
|
219
|
+
const exported = [...new Set(names)].filter(isExportableName).sort();
|
|
220
|
+
const specifiers = specifiersForShim(shim);
|
|
221
|
+
const required = BLOCK_HOST_IMPORTS.some((i) => i.shim === shim && i.seeding === 'every-host');
|
|
222
|
+
const served = specifiers.map((s) => `'${s}'`).join(', ');
|
|
223
|
+
const lines = [
|
|
224
|
+
`// Generated by pwf. Serves ${served} to compiled blocks:`,
|
|
225
|
+
`// re-exports the instance the page seeded on globalThis.${global}.`,
|
|
226
|
+
];
|
|
227
|
+
if (required) {
|
|
228
|
+
const message = `[pwfabric] globalThis.${global} is not seeded, so ${specifiers.join(', ') || shim} cannot be imported by a block. The host page must seed it before loading block bundles (@pwfabric/embed's embed.js does).`;
|
|
229
|
+
lines.push(`const m = globalThis.${global}`, `if (m == null) throw new Error(${JSON.stringify(message)})`);
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
lines.push(`const m = globalThis.${global} ?? {}`);
|
|
233
|
+
}
|
|
234
|
+
lines.push('export default m');
|
|
235
|
+
if (exported.length > 0) {
|
|
236
|
+
lines.push(`export const {\n${exported.map((n) => ` ${n},`).join('\n')}\n} = m`);
|
|
237
|
+
}
|
|
238
|
+
return `${lines.join('\n')}\n`;
|
|
239
|
+
}
|
|
183
240
|
//# sourceMappingURL=host-imports.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-imports.js","sourceRoot":"","sources":["../../src/blocks/host-imports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAoEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAA0B;IACvD;QACE,SAAS,EAAE,OAAO;QAClB,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,kBAAkB;QAC1B,OAAO,EAAE,YAAY;QACrB,IAAI,EAAE,WAAW;QACjB,MAAM,EACJ,oIAAoI;KACvI;IACD;QACE,SAAS,EAAE,mBAAmB;QAC9B,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,wBAAwB;QAChC,OAAO,EAAE,YAAY;QACrB,IAAI,EAAE,uBAAuB;QAC7B,MAAM,EACJ,kMAAkM;KACrM;IACD;QACE,SAAS,EAAE,WAAW;QACtB,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,sBAAsB;QAC9B,OAAO,EAAE,UAAU;QACnB,IAAI,EAAE,eAAe;QACrB,MAAM,EAAE,iFAAiF;KAC1F;IACD;QACE,SAAS,EAAE,mBAAmB;QAC9B,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,oBAAoB;QAC5B,OAAO,EAAE,YAAY;QACrB,IAAI,EAAE,aAAa;QACnB,MAAM,EACJ,8GAA8G;KACjH;IACD;QACE,SAAS,EAAE,wBAAwB;QACnC,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,oBAAo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KAAK,GAAG;QACZ,+BAA+B,MAAM,sBAAsB;QAC3D,4DAA4D,MAAM,GAAG;KACtE,CAAA;IACD,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,OAAO,GAAG,yBAAyB,MAAM,sBAAsB,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,4HAA4H,CAAA;QAC9N,KAAK,CAAC,IAAI,CACR,wBAAwB,MAAM,EAAE,EAChC,kCAAkC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAC7D,CAAA;IACH,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,IAAI,CAAC,wBAAwB,MAAM,QAAQ,CAAC,CAAA;IACpD,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;IAC9B,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,KAAK,CAAC,IAAI,CAAC,mBAAmB,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACnF,CAAC;IACD,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAA;AAChC,CAAC","sourcesContent":["/**\n * Block Host Imports — what a dynamically loaded block may import, and what the\n * host must therefore provide.\n *\n * WHY THIS EXISTS. A published block is bundled per atom with esbuild and\n * loaded in the browser through `<script type=\"importmap\">` + `import(blob:…)`.\n * Two kinds of import survive that: relative paths to files inside the block's\n * own pack, and a short list of BARE specifiers that are left unbundled for the\n * host to supply. That list appears in three places — the bundler's externals,\n * the host's import map and the shim files the host serves — and a specifier\n * missing from any one of them fails at load time (\"Failed to resolve module\n * specifier\" inside the blob module).\n *\n * This module is that contract, in one place, so the bundler's allowlist, the\n * host's import map and the shim files are all DERIVED and can be checked\n * against each other instead of drifting in silence.\n *\n * WHY NOT IN `@pwfabric/contracts`, where `dynamic-artifact.ts` already lives.\n * The contracts package is treated as immutable after release: every change to\n * its surface, even an additive one, goes through a stricter review. This list has to\n * change whenever a package joins or leaves the allowlist; putting it behind a\n * ceremony is what would recreate the drift it exists to prevent. It lives here,\n * where an additive export is an ordinary minor.\n *\n * @module @pwfabric/core/blocks/host-imports\n */\n\n// ============================================================\n// THE CONTRACT\n// ============================================================\n\n/**\n * How the host hands a shared module to a dynamically loaded block.\n *\n * `global` — the shim re-exports from `globalThis[global]`, which the host seeds\n * from its OWN bundled import. This is the mechanism for anything whose IDENTITY\n * must be shared: one React dispatcher, one event bus, one set of contract\n * values. Two instances of these is not \"slightly wasteful\", it is broken —\n * `useSurfaceEvents` reading a second context makes `emit()` a silent no-op.\n *\n * It is the only kind: every specifier on this list is resolved by the host\n * through a shim reading a global. `zod` included — blocks share the host's\n * single zod instance, because introspection needs the real zod for\n * `instanceof` while walking a schema. A specifier a bundler inlines is simply\n * not external, and so never reaches this list.\n */\nexport type HostImportKind = 'global'\n\n/**\n * WHICH hosts seed a `global` entry. There are two of them and they are not\n * obliged to agree — recording that here keeps a derived gate from calling a\n * deliberate decision a gap.\n *\n * `every-host` — both the app host and the standalone export's IIFE\n * (`@pwfabric/embed`'s `embed-global.ts`) must seed it.\n * `app-host` — the app host seeds it; the standalone export deliberately\n * does NOT. No entry is in this class today. The sdk global\n * was, until 1.0.0-rc.2: a block written the documented way\n * calls `defineBlock()` when its bundle loads, so a shipped\n * app whose page did not seed the sdk rendered none of them.\n * The renderer bundle carries the authoring kit anyway, so it\n * now seeds it like the rest.\n * `unseeded` — nothing seeds it yet. The specifier resolves (the shim is\n * served) but its named exports come back `undefined`. That is\n * strictly better than an unresolved bare specifier, which\n * fails the whole module at link time — but it is a gap, and\n * naming it here keeps it visible.\n */\nexport type HostSeeding = 'every-host' | 'app-host' | 'unseeded'\n\n/** One specifier a block may import, and how the host satisfies it. */\nexport interface HostImport {\n /** The bare specifier as it appears in block source and in the bundle. */\n readonly specifier: string\n readonly kind: HostImportKind\n /**\n * The `globalThis` key the shim reads. Present for `kind: 'global'` only.\n * The host seeds it from its own bundled import of the same package.\n */\n readonly global?: string\n /** Which hosts seed {@link HostImport.global}. Present for `kind: 'global'` only. */\n readonly seeding?: HostSeeding\n /**\n * Shim file this specifier resolves to, relative to the host's shim directory.\n * SEVERAL SPECIFIERS MAY SHARE ONE FILE — `@pwfabric/runtime` and its\n * subpaths all resolve to the runtime shim, because what a block imports is\n * a runtime contract, not a package name.\n */\n readonly shim: string\n /** Why this specifier is on the list. Read by humans, not by code. */\n readonly reason: string\n}\n\n/**\n * THE LIST. Order is not significant; every consumer derives from the whole set.\n *\n * Adding an entry is the ONLY supported way to let blocks import something new.\n * The derivation helpers below mean a new entry reaches the bundler's allowlist,\n * every host's import map and every shim file together.\n */\nexport const BLOCK_HOST_IMPORTS: readonly HostImport[] = [\n {\n specifier: 'react',\n kind: 'global',\n global: '__pwfabric_react',\n seeding: 'every-host',\n shim: 'react.mjs',\n reason:\n 'One dispatcher. A second React instance makes every hook in a block throw \"Cannot read properties of null (reading \\'useState\\')\".',\n },\n {\n specifier: 'react/jsx-runtime',\n kind: 'global',\n global: '__pwfabric_jsx_runtime',\n seeding: 'every-host',\n shim: 'react-jsx-runtime.mjs',\n reason:\n 'The automatic JSX transform emits imports from here; it must be the same React. NOTE the global is `__pwfabric_jsx_runtime`, not `…_react_jsx_runtime`; the shim and the seeders read this name.',\n },\n {\n specifier: 'react-dom',\n kind: 'global',\n global: '__pwfabric_react_dom',\n seeding: 'unseeded',\n shim: 'react-dom.mjs',\n reason: 'Blocks that portal or measure reach for react-dom; same-instance rule as React.',\n },\n {\n specifier: '@pwfabric/runtime',\n kind: 'global',\n global: '__pwfabric_runtime',\n seeding: 'every-host',\n shim: 'runtime.mjs',\n reason:\n 'Surface event bus, surface id and connections contexts. A block reading a second context emits into nothing.',\n },\n {\n specifier: '@pwfabric/runtime/data',\n kind: 'global',\n global: '__pwfabric_runtime',\n seeding: 'every-host',\n shim: 'runtime.mjs',\n reason:\n 'A runtime subpath the package root re-exports WHOLESALE, so the root shim serves it exactly — the foundation pack persistence capability imports `createDataService` from here. An import map resolves exact specifiers only: without this entry the import would compile with a HOST_SUBPATH_IMPORT warning and then fail to resolve in the browser. Only subpaths whose every export the root also exports may join; the runtime package has a test that says so.',\n },\n {\n specifier: '@pwfabric/runtime/capability',\n kind: 'global',\n global: '__pwfabric_runtime',\n seeding: 'every-host',\n shim: 'runtime.mjs',\n reason:\n 'A runtime subpath the package root re-exports WHOLESALE, so the root shim serves it exactly — capability atoms import their definition helpers from here. An import map resolves exact specifiers only: without this entry the import would compile with a HOST_SUBPATH_IMPORT warning and then fail to resolve in the browser. Only subpaths whose every export the root also exports may join; the runtime package has a test that says so.',\n },\n {\n specifier: '@pwfabric/runtime/adapters',\n kind: 'global',\n global: '__pwfabric_runtime',\n seeding: 'every-host',\n shim: 'runtime.mjs',\n reason:\n 'A runtime subpath the package root re-exports WHOLESALE, so the root shim serves it exactly — image adapters; a block that renders a responsive image reaches for them here. An import map resolves exact specifiers only: without this entry the import would compile with a HOST_SUBPATH_IMPORT warning and then fail to resolve in the browser. Only subpaths whose every export the root also exports may join; the runtime package has a test that says so.',\n },\n {\n specifier: '@pwfabric/contracts',\n kind: 'global',\n global: '__pwfabric_contracts',\n seeding: 'every-host',\n shim: 'contracts.mjs',\n reason: 'Contract VALUES (enums, constants) must be the host’s, not a second copy.',\n },\n {\n specifier: '@pwfabric/core',\n kind: 'global',\n global: '__pwfabric_core',\n seeding: 'unseeded',\n shim: 'core.mjs',\n reason: 'Block layout helpers and breakpoint constants blocks resolve at render time.',\n },\n {\n specifier: '@pwfabric/authoring',\n kind: 'global',\n global: '__pwfabric_sdk',\n seeding: 'every-host',\n shim: 'sdk@v1.mjs',\n reason:\n 'What the scaffolding emits and a third-party author reads first. A host that does not map it breaks every block that follows the documented path.',\n },\n {\n specifier: 'zod',\n kind: 'global',\n global: '__pwfabric_zod',\n seeding: 'every-host',\n shim: 'zod.mjs',\n reason:\n 'Every block with a prop schema imports it as a value — 81 pack source files take `z`. Shared, not inlined: `zod.mjs` re-exports the host instance, and introspection depends on it being the real zod so `instanceof` holds while walking a schema.',\n },\n] as const\n\n// ============================================================\n// DERIVATIONS — every consumer reads the list through one of these\n// ============================================================\n\n/**\n * The specifiers esbuild must leave bare when bundling an atom.\n *\n * A bundling service's externals list is exactly this: the bundler leaves each\n * specifier bare, and the host's import map resolves it to the shared instance.\n */\nexport function blockBundleExternals(): readonly string[] {\n return BLOCK_HOST_IMPORTS.map((i) => i.specifier)\n}\n\n/**\n * The host's `<script type=\"importmap\">` payload.\n *\n * @param shimBase - URL prefix the shim files are served from, no trailing\n * slash (for example `/_pwfabric/shims`).\n */\nexport function blockImportMap(shimBase: string): { readonly imports: Record<string, string> } {\n const imports: Record<string, string> = {}\n for (const entry of BLOCK_HOST_IMPORTS) {\n imports[entry.specifier] = `${shimBase}/${entry.shim}`\n }\n return { imports }\n}\n\n/** Every distinct shim file the import map can point at. */\nexport function blockShimFiles(): readonly string[] {\n return [...new Set(BLOCK_HOST_IMPORTS.map((i) => i.shim))].sort()\n}\n\n/**\n * The `globalThis` keys a host must seed before any block bundle is imported.\n *\n * A host that renders published blocks assigns each of these from its own\n * bundled import. Missing one does not throw where it is missing — it throws\n * inside a block, later, as an undefined named import.\n */\nexport function blockHostGlobals(host: 'app-host' | 'standalone' = 'app-host'): readonly string[] {\n // The standalone export is NOT the app host with fewer features — it seeds a\n // deliberately smaller set, and asking it for the app host's list would make a\n // gate demand the sdk global it deliberately leaves out. `unseeded`\n // entries belong to neither list: nothing seeds them today, and pretending\n // otherwise would turn a recorded gap into a failing gate nobody can satisfy.\n const wanted: readonly HostSeeding[] =\n host === 'standalone' ? ['every-host'] : ['every-host', 'app-host']\n return [\n ...new Set(\n BLOCK_HOST_IMPORTS.flatMap((i) =>\n i.global && i.seeding && wanted.includes(i.seeding) ? [i.global] : []\n )\n ),\n ].sort()\n}\n\n/** Entries whose global nothing seeds yet — a gap this list refuses to hide. */\nexport function unseededHostGlobals(): readonly HostImport[] {\n return BLOCK_HOST_IMPORTS.filter((i) => i.seeding === 'unseeded')\n}\n\n/**\n * Which specifiers resolve to a given shim file — the reverse of `shim`.\n * A shim generator needs this: one file serves every specifier aliased to it,\n * so it must export the union of what those specifiers' consumers import.\n */\nexport function specifiersForShim(shim: string): readonly string[] {\n return BLOCK_HOST_IMPORTS.filter((i) => i.shim === shim).map((i) => i.specifier)\n}\n\n/**\n * Names a shim must not bind even though they parse as identifiers.\n *\n * Reserved words fail the parse outright. `undefined`, `NaN` and `Infinity`\n * are global value properties: `export const { undefined } = m` parses, but\n * it shadows a restricted name (lint refuses it, and some toolchains refuse to\n * parse it), and no block imports them by name. zod exports `undefined` (its\n * `z.undefined()` schema), so a shim built from zod's keys would carry it.\n */\nconst NON_BINDABLE_NAMES = new Set(\n (\n 'break case catch class const continue debugger default delete do else enum export extends false finally for ' +\n 'function if import in instanceof new null return super switch this throw true try typeof var void while with ' +\n 'yield let static implements interface package private protected public await arguments eval ' +\n 'undefined NaN Infinity'\n ).split(' ')\n)\n\n/** Whether `name` can be an `export const { name }` binding in a shim module. */\nexport function isExportableName(name: string): boolean {\n return /^[A-Za-z_$][\\w$]*$/.test(name) && !NON_BINDABLE_NAMES.has(name)\n}\n\n/**\n * Source of one shim module: it re-exports the instance a host seeded on\n * `globalThis[global]`, as a default export and as one named export per entry\n * of `names` that can be a binding (see {@link isExportableName}), deduplicated\n * and sorted. `shim` is a file from {@link blockShimFiles}; the header comment\n * lists the specifiers that resolve to it.\n *\n * Every host serving block bundles writes these files; the names are the\n * host's to supply (an ESM import of a name the shim does not export fails the\n * whole block at link time, so they should be read off the very object the host\n * seeds).\n *\n * A shim whose global every host must seed (`seeding: 'every-host'`) throws a\n * readable error when the global is missing, naming the global and the\n * specifiers: the alternative is a destructuring `TypeError` inside a blob\n * module, which says nothing about the host that forgot to seed it. A shim for\n * an `unseeded` global keeps degrading to `undefined` exports instead.\n */\nexport function shimSource(shim: string, global: string, names: readonly string[]): string {\n const exported = [...new Set(names)].filter(isExportableName).sort()\n const specifiers = specifiersForShim(shim)\n const required = BLOCK_HOST_IMPORTS.some((i) => i.shim === shim && i.seeding === 'every-host')\n const served = specifiers.map((s) => `'${s}'`).join(', ')\n const lines = [\n `// Generated by pwf. Serves ${served} to compiled blocks:`,\n `// re-exports the instance the page seeded on globalThis.${global}.`,\n ]\n if (required) {\n const message = `[pwfabric] globalThis.${global} is not seeded, so ${specifiers.join(', ') || shim} cannot be imported by a block. The host page must seed it before loading block bundles (@pwfabric/embed's embed.js does).`\n lines.push(\n `const m = globalThis.${global}`,\n `if (m == null) throw new Error(${JSON.stringify(message)})`\n )\n } else {\n lines.push(`const m = globalThis.${global} ?? {}`)\n }\n lines.push('export default m')\n if (exported.length > 0) {\n lines.push(`export const {\\n${exported.map((n) => ` ${n},`).join('\\n')}\\n} = m`)\n }\n return `${lines.join('\\n')}\\n`\n}\n"]}
|
package/dist/blocks/index.d.ts
CHANGED
|
@@ -9,5 +9,4 @@
|
|
|
9
9
|
export type { BlockCategory, BlockDefinition, Block, ValidationError, ValidationResult, CompositionRuleType, CompositionRule, } from './types.js';
|
|
10
10
|
export { MAX_NESTING_DEPTH, BLOCK_CATEGORIES } from './types.js';
|
|
11
11
|
export { type BreakpointName, type BreakpointDefinition, type ResponsiveValue, type BlockLayout, type PreviewViewport, BREAKPOINTS, BREAKPOINT_ORDER, DEFAULT_BLOCK_LAYOUT, VIEWPORT_PRESETS, responsiveNumberSchema, responsiveBooleanSchema, responsiveWidthScopeSchema, widthScopeSchema, type WidthScope, blockLayoutSchema, resolveResponsiveValue, resolveSpanAtBreakpoint, getColumnsAtBreakpoint, getBreakpointForWidth, } from './layout-schema.js';
|
|
12
|
-
export { BLOCK_HOST_IMPORTS, blockBundleExternals, blockImportMap, blockShimFiles, blockHostGlobals, unseededHostGlobals, specifiersForShim, type HostImport, type HostImportKind, type HostSeeding, } from './host-imports.js';
|
|
13
|
-
//# sourceMappingURL=index.d.ts.map
|
|
12
|
+
export { BLOCK_HOST_IMPORTS, blockBundleExternals, blockImportMap, blockShimFiles, blockHostGlobals, unseededHostGlobals, specifiersForShim, isExportableName, shimSource, type HostImport, type HostImportKind, type HostSeeding, } from './host-imports.js';
|
package/dist/blocks/index.js
CHANGED
|
@@ -13,6 +13,6 @@ export { BREAKPOINTS, BREAKPOINT_ORDER, DEFAULT_BLOCK_LAYOUT, VIEWPORT_PRESETS,
|
|
|
13
13
|
// One list; the bundler's allowlist, every host import map and every shim file
|
|
14
14
|
// are derived from it rather than hand-copied — see the module header for the
|
|
15
15
|
// three-way drift this replaces.
|
|
16
|
-
export { BLOCK_HOST_IMPORTS, blockBundleExternals, blockImportMap, blockShimFiles, blockHostGlobals, unseededHostGlobals, specifiersForShim, } from './host-imports.js';
|
|
16
|
+
export { BLOCK_HOST_IMPORTS, blockBundleExternals, blockImportMap, blockShimFiles, blockHostGlobals, unseededHostGlobals, specifiersForShim, isExportableName, shimSource, } from './host-imports.js';
|
|
17
17
|
// NOTE: CompositionRuleEngine has moved to @pwfabric/runtime/blocks
|
|
18
18
|
//# sourceMappingURL=index.js.map
|
package/dist/blocks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/blocks/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAaH,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAEhE,gBAAgB;AAChB,OAAO,EAML,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,EAC1B,gBAAgB,EAEhB,iBAAiB,EACjB,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,oBAAoB,CAAA;AAE3B,8EAA8E;AAC9E,+EAA+E;AAC/E,8EAA8E;AAC9E,iCAAiC;AACjC,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/blocks/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAaH,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAEhE,gBAAgB;AAChB,OAAO,EAML,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,EAC1B,gBAAgB,EAEhB,iBAAiB,EACjB,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,oBAAoB,CAAA;AAE3B,8EAA8E;AAC9E,+EAA+E;AAC/E,8EAA8E;AAC9E,iCAAiC;AACjC,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,GAIX,MAAM,mBAAmB,CAAA;AAE1B,oEAAoE","sourcesContent":["/**\n * Block Ecosystem\n *\n * Block type definitions, layout schema, and composition rule engine.\n * Block schemas, definitions, and components are in @pwfabric/runtime/blocks.\n *\n * @module @pwfabric/core/blocks\n */\n\n// Types (remain in core — used by @pwfabric/runtime/blocks as peer types)\nexport type {\n BlockCategory,\n BlockDefinition,\n Block,\n ValidationError,\n ValidationResult,\n CompositionRuleType,\n CompositionRule,\n} from './types.js'\n\nexport { MAX_NESTING_DEPTH, BLOCK_CATEGORIES } from './types.js'\n\n// Layout Schema\nexport {\n type BreakpointName,\n type BreakpointDefinition,\n type ResponsiveValue,\n type BlockLayout,\n type PreviewViewport,\n BREAKPOINTS,\n BREAKPOINT_ORDER,\n DEFAULT_BLOCK_LAYOUT,\n VIEWPORT_PRESETS,\n responsiveNumberSchema,\n responsiveBooleanSchema,\n responsiveWidthScopeSchema,\n widthScopeSchema,\n type WidthScope,\n blockLayoutSchema,\n resolveResponsiveValue,\n resolveSpanAtBreakpoint,\n getColumnsAtBreakpoint,\n getBreakpointForWidth,\n} from './layout-schema.js'\n\n// What a dynamically loaded block may import, and what the host must provide.\n// One list; the bundler's allowlist, every host import map and every shim file\n// are derived from it rather than hand-copied — see the module header for the\n// three-way drift this replaces.\nexport {\n BLOCK_HOST_IMPORTS,\n blockBundleExternals,\n blockImportMap,\n blockShimFiles,\n blockHostGlobals,\n unseededHostGlobals,\n specifiersForShim,\n isExportableName,\n shimSource,\n type HostImport,\n type HostImportKind,\n type HostSeeding,\n} from './host-imports.js'\n\n// NOTE: CompositionRuleEngine has moved to @pwfabric/runtime/blocks\n"]}
|
|
@@ -351,4 +351,3 @@ export declare function resolveResponsiveValue<T>(responsive: ResponsiveValue<T>
|
|
|
351
351
|
export declare function resolveSpanAtBreakpoint(layout: BlockLayout, breakpoint: BreakpointName): number;
|
|
352
352
|
export declare function getColumnsAtBreakpoint(breakpoint: BreakpointName): number;
|
|
353
353
|
export declare function getBreakpointForWidth(width: number): BreakpointName;
|
|
354
|
-
//# sourceMappingURL=layout-schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-schema.js","sourceRoot":"","sources":["../../src/blocks/layout-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAqBvB;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAoC;IAC1D,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE;IACxD,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,EAAE;IACpE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EA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AAK,SAAS;QAAE,OAAO,IAAI,CAAA;IACnC,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,UAAU,CAAC,CAAA;IAC9D,OAAO,KAAK,EAAE,OAAO,IAAI,EAAE,CAAA;AAC7B,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,UAA0B;IAC/D,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,UAAU,CAAC,CAAA;IAC9D,OAAO,KAAK,EAAE,OAAO,IAAI,EAAE,CAAA;AAC7B,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,KAAa;IACjD,KAAK,IAAI,CAAC,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACjD,MAAM,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;QACzB,IAAI,EAAE,IAAI,KAAK,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC;YAC/B,OAAO,EAAE,CAAC,IAAI,CAAA;QAChB,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC","sourcesContent":["/**\n * Block Layout Schema\n *\n * Zod schemas for layout validation, per-type default spans,\n * and mobile-first cascade resolution.\n *\n * @module @pwfabric/core/blocks/layout-schema\n */\n\nimport { z } from 'zod'\n\n// ============================================================\n// BREAKPOINT DEFINITIONS\n// ============================================================\n\n/**\n * Named breakpoints aligned with Tailwind CSS conventions\n */\nexport type BreakpointName = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n\n/**\n * Breakpoint definition with min-width and column count\n */\nexport interface BreakpointDefinition {\n readonly name: BreakpointName\n readonly minWidth: number\n readonly columns: number\n readonly label: string\n}\n\n/**\n * Ordered breakpoint definitions (smallest to largest)\n */\nexport const BREAKPOINTS: readonly BreakpointDefinition[] = [\n { name: 'xs', minWidth: 0, columns: 4, label: 'Mobile' },\n { name: 'sm', minWidth: 640, columns: 8, label: 'Mobile Landscape' },\n { name: 'md', minWidth: 768, columns: 8, label: 'Tablet' },\n { name: 'lg', minWidth: 1024, columns: 12, label: 'Desktop' },\n { name: 'xl', minWidth: 1280, columns: 12, label: 'Large Desktop' },\n { name: '2xl', minWidth: 1536, columns: 12, label: 'Extra Large' },\n] as const\n\n/**\n * Ordered breakpoint names for iteration and cascade resolution\n */\nexport const BREAKPOINT_ORDER: readonly BreakpointName[] = [\n 'xs',\n 'sm',\n 'md',\n 'lg',\n 'xl',\n '2xl',\n] as const\n\n// ============================================================\n// RESPONSIVE VALUE TYPE\n// ============================================================\n\n/**\n * A value that can vary per breakpoint.\n */\nexport type ResponsiveValue<T> = Readonly<Partial<Record<BreakpointName, T>>>\n\n// ============================================================\n// BLOCK LAYOUT\n// ============================================================\n\n/**\n * Layout metadata for a block instance.\n */\nexport interface BlockLayout {\n readonly span: ResponsiveValue<number>\n readonly offset?: ResponsiveValue<number>\n readonly order?: ResponsiveValue<number>\n readonly hidden?: ResponsiveValue<boolean>\n /**\n * Per-breakpoint visibility (the `hidden md:flex` equivalent).\n * `hideOn` = breakpoints where the block is hidden; `showOn` = the only\n * breakpoints where it is visible. CSS/media-query driven (see runtime\n * renderer), using the same pixel thresholds as the span system.\n */\n readonly hideOn?: readonly BreakpointName[]\n readonly showOn?: readonly BreakpointName[]\n /**\n * What this block's width belongs to: the surface's measured container, or\n * the screen itself.\n *\n * `container` (default) — respects `--pw-layout-container-max-width`.\n * `viewport` — LEAVES that container and reaches the edge of the screen.\n *\n * Breakpoint-aware, because \"change shape on a narrow screen\" is exactly\n * this: `{ xs: 'viewport', lg: 'container' }`.\n *\n * The engine knows NO words beyond these two. Which region of which shell\n * has which scope is the pack's vocabulary; if the engine memorised it, a\n * second pack could not express itself.\n */\n readonly widthScope?: ResponsiveValue<WidthScope>\n}\n\nexport const DEFAULT_BLOCK_LAYOUT: BlockLayout = {\n span: { xs: 4, sm: 8, md: 8, lg: 12 },\n} as const\n\n// ============================================================\n// VIEWPORT PRESETS\n// ============================================================\n\nexport type PreviewViewport = BreakpointName | 'responsive'\n\nexport const VIEWPORT_PRESETS: Record<\n BreakpointName,\n { readonly width: number; readonly height: 'auto' }\n> = {\n xs: { width: 375, height: 'auto' },\n sm: { width: 640, height: 'auto' },\n md: { width: 768, height: 'auto' },\n lg: { width: 1024, height: 'auto' },\n xl: { width: 1280, height: 'auto' },\n '2xl': { width: 1536, height: 'auto' },\n} as const\n\n// ============================================================\n// ZOD SCHEMAS\n// ============================================================\n\nexport const responsiveNumberSchema = z\n .object({\n xs: z.number().int().min(0).optional(),\n sm: z.number().int().min(0).optional(),\n md: z.number().int().min(0).optional(),\n lg: z.number().int().min(0).optional(),\n xl: z.number().int().min(0).optional(),\n '2xl': z.number().int().min(0).optional(),\n })\n .strict()\n\nexport const responsiveBooleanSchema = z\n .object({\n xs: z.boolean().optional(),\n sm: z.boolean().optional(),\n md: z.boolean().optional(),\n lg: z.boolean().optional(),\n xl: z.boolean().optional(),\n '2xl': z.boolean().optional(),\n })\n .strict()\n\nexport const breakpointNameSchema = z.enum(['xs', 'sm', 'md', 'lg', 'xl', '2xl'])\n\n/**\n * Width scope — the ONLY vocabulary the engine knows on this axis.\n *\n * `container` fits the measured container, `viewport` leaves it. There is no\n * third value: in-between words such as \"half\", \"wide\" or \"full\" belong to a\n * shell's vocabulary and live in the pack. The engine applies only the\n * difference between \"fit the container\" and \"leave the container\".\n */\nexport const widthScopeSchema = z.enum(['container', 'viewport'])\nexport type WidthScope = z.infer<typeof widthScopeSchema>\n\nexport const responsiveWidthScopeSchema = z\n .object({\n xs: widthScopeSchema.optional(),\n sm: widthScopeSchema.optional(),\n md: widthScopeSchema.optional(),\n lg: widthScopeSchema.optional(),\n xl: widthScopeSchema.optional(),\n '2xl': widthScopeSchema.optional(),\n })\n .strict()\n\nexport const blockLayoutSchema = z.object({\n span: responsiveNumberSchema,\n offset: responsiveNumberSchema.optional(),\n order: responsiveNumberSchema.optional(),\n hidden: responsiveBooleanSchema.optional(),\n hideOn: z.array(breakpointNameSchema).optional(),\n showOn: z.array(breakpointNameSchema).optional(),\n widthScope: responsiveWidthScopeSchema.optional(),\n})\n\n// ============================================================\n// CASCADE RESOLUTION\n// ============================================================\n\nexport function resolveResponsiveValue<T>(\n responsive: ResponsiveValue<T> | undefined,\n breakpoint: BreakpointName\n): T | undefined {\n if (!responsive) return undefined\n const targetIndex = BREAKPOINT_ORDER.indexOf(breakpoint)\n for (let i = targetIndex; i >= 0; i--) {\n const bp = BREAKPOINT_ORDER[i]\n if (!bp) continue\n if (responsive[bp] !== undefined) {\n return responsive[bp]\n }\n }\n return undefined\n}\n\nexport function resolveSpanAtBreakpoint(layout: BlockLayout, breakpoint: BreakpointName): number {\n const span = resolveResponsiveValue(layout.span, breakpoint)\n if (span !== undefined) return span\n const bpDef = BREAKPOINTS.find((bp) => bp.name === breakpoint)\n return bpDef?.columns ?? 12\n}\n\nexport function getColumnsAtBreakpoint(breakpoint: BreakpointName): number {\n const bpDef = BREAKPOINTS.find((bp) => bp.name === breakpoint)\n return bpDef?.columns ?? 12\n}\n\nexport function getBreakpointForWidth(width: number): BreakpointName {\n for (let i = BREAKPOINTS.length - 1; i >= 0; i--) {\n const bp = BREAKPOINTS[i]\n if (bp && width >= bp.minWidth) {\n return bp.name\n }\n }\n return 'xs'\n}\n"]}
|
package/dist/blocks/types.d.ts
CHANGED
package/dist/blocks/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/blocks/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAmKH,+DAA+D;AAC/D,YAAY;AACZ,+DAA+D;AAE/D;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAA;AAEnC;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA6B;IACxD,QAAQ;IACR,OAAO;IACP,MAAM;IACN,MAAM;IACN,SAAS;IACT,OAAO;IACP,MAAM;IACN,sEAAsE;IACtE,UAAU;CACF,CAAA"}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/blocks/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAmKH,+DAA+D;AAC/D,YAAY;AACZ,+DAA+D;AAE/D;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAA;AAEnC;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA6B;IACxD,QAAQ;IACR,OAAO;IACP,MAAM;IACN,MAAM;IACN,SAAS;IACT,OAAO;IACP,MAAM;IACN,sEAAsE;IACtE,UAAU;CACF,CAAA","sourcesContent":["/**\n * Block Type Definitions\n *\n * Core type definitions for the block ecosystem\n *\n * @module @pwfabric/core/blocks/types\n */\n\nimport type { ZodSchema } from 'zod'\nimport type { BlockLayout } from './layout-schema.js'\n\n// The block instance type is defined in @pwfabric/contracts; re-exported here.\nexport type { Block } from '@pwfabric/contracts'\n\n// ============================================================\n// BLOCK CATEGORIES\n// ============================================================\n\n/**\n * Block category classification.\n *\n * `feedback` is the family of toast, spinner and radial-progress blocks. A\n * block's atom id comes from its directory, and a pack's integrity check\n * requires the category and the directory to agree, so these blocks carry\n * `feedback` rather than being filed under `control`.\n */\nexport type BlockCategory =\n | 'layout'\n | 'panel'\n | 'text'\n | 'data'\n | 'control'\n | 'media'\n | 'form'\n | 'feedback'\n // Categories by SHAPE: `overlay` (modal, drawer, popover, tooltip,\n // command-palette), `container` (card, accordion, tabs, tree-view) and\n // `integration` (app views that own a connection to an outside service:\n // calendar, chat, files…). `panel` remains for packs that still use it.\n | 'overlay'\n | 'container'\n | 'integration'\n\n// ============================================================\n// BLOCK DEFINITION\n// ============================================================\n\n/**\n * Block definition interface\n *\n * Defines the structure and constraints of a block type.\n */\nexport interface BlockDefinition {\n /** Unique block type identifier */\n readonly type: string\n\n /** Human-readable display name */\n readonly name: string\n\n /** Block category for grouping */\n readonly category: BlockCategory\n\n /** Icon character or identifier */\n readonly icon: string\n\n /** Zod schema for props validation */\n readonly schema: ZodSchema\n\n /** Default props for new instances */\n readonly defaultProps: Record<string, unknown>\n\n /** Default layout for new instances (span/offset/order/hidden per breakpoint) */\n readonly defaultLayout?: BlockLayout\n\n /** Whether this block can contain children */\n readonly canHaveChildren: boolean\n\n /**\n * Optional: which child block types this block accepts. The runtime's\n * composition rules enforce it. `allowedChildTraits` is the trait-based\n * alternative, for a block that accepts any child with a given trait.\n */\n readonly allowedChildren?: readonly string[]\n\n /** Optional: Restrict which block types can be parents */\n readonly allowedParents?: readonly string[]\n\n /** open trait vocabulary this block carries (kebab-case). */\n readonly traits?: readonly string[]\n\n /**\n * a child block passes if it carries ANY of these traits.\n * Only meaningful when `canHaveChildren` is true.\n */\n readonly allowedChildTraits?: readonly string[]\n\n /** Optional: Maximum instances allowed in a surface */\n readonly maxInstances?: number\n}\n\n// ============================================================\n// BLOCK INSTANCE\n// ============================================================\n// Block is re-exported from @pwfabric/contracts above.\n\n// ============================================================\n// VALIDATION\n// ============================================================\n\n/**\n * Validation error interface\n */\nexport interface ValidationError {\n /** Error code for programmatic handling */\n readonly code: string\n\n /** Human-readable error message */\n readonly message: string\n\n /** Optional: Associated block ID */\n readonly blockId?: string\n\n /** Optional: Suggestion for fixing the error */\n readonly suggestion?: string\n}\n\n/**\n * Validation result interface\n */\nexport interface ValidationResult {\n /** Whether validation passed */\n readonly valid: boolean\n\n /** List of validation errors */\n readonly errors: readonly ValidationError[]\n}\n\n// ============================================================\n// COMPOSITION RULES\n// ============================================================\n\n/**\n * Composition rule type\n */\nexport type CompositionRuleType =\n | 'max_depth'\n | 'allowed_children'\n | 'allowed_parents'\n | 'required_parent'\n | 'no_children'\n | 'no_self_nesting'\n\n/**\n * Composition rule interface\n */\nexport interface CompositionRule {\n /** Rule type */\n readonly type: CompositionRuleType\n\n /** Rule description */\n readonly description: string\n\n /** Block type this rule applies to (or '*' for all) */\n readonly appliesTo: string | '*'\n\n /** Rule-specific configuration */\n readonly config: Record<string, unknown>\n}\n\n// ============================================================\n// CONSTANTS\n// ============================================================\n\n/**\n * Maximum block nesting depth. SINGLE SOURCE OF TRUTH — every validator and the\n * composer prompt derive from this constant.\n *\n * Canonical rule (enforced identically everywhere): root blocks are at depth 0,\n * and a block is INVALID when its depth `>= MAX_NESTING_DEPTH`. So the deepest\n * legal block sits at depth `MAX_NESTING_DEPTH - 1`, i.e. up to `MAX_NESTING_DEPTH`\n * levels of nesting (root included).\n *\n * Consumers: the runtime rule engine and composition-rules prose\n * (@pwfabric/runtime), and a host's surface validation (MAX_NESTING_EXCEEDED)\n * and composer instructions (\"Max nesting depth: N levels\").\n */\nexport const MAX_NESTING_DEPTH = 10\n\n/**\n * Block categories ordered for display\n */\nexport const BLOCK_CATEGORIES: readonly BlockCategory[] = [\n 'layout',\n 'panel',\n 'text',\n 'data',\n 'control',\n 'media',\n 'form',\n // Last in display order: status and notification chrome, not content.\n 'feedback',\n] as const\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capability-builder.js","sourceRoot":"","sources":["../src/capability-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA"}
|
|
1
|
+
{"version":3,"file":"capability-builder.js","sourceRoot":"","sources":["../src/capability-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA","sourcesContent":["/**\n * Capability Builder\n *\n * PHASE0-WS3: Fluent API for building capabilities\n *\n * The implementation lives in `@pwfabric/contracts`\n * (Apache-2.0) so capability authors do not need this package. This module\n * re-exports the same class and function so existing imports — including\n * deep imports of this file — keep working unchanged.\n *\n * @module @pwfabric/core/capability-builder\n */\n\nexport { CapabilityBuilder, defineCapability } from '@pwfabric/contracts'\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-schema-builder.js","sourceRoot":"","sources":["../src/config-schema-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAElF,+DAA+D;AAC/D,gBAAgB;AAChB,+DAA+D;AAE/D,MAAM,OAAO,YAAY;IACf,KAAK,GAAoB,QAAQ,CAAA;IACjC,SAAS,GAAG,KAAK,CAAA;IACjB,aAAa,CAAU;IACvB,MAAM,GAAG,EAAE,CAAA;IACX,YAAY,CAAS;IACrB,UAAU,CAAU;IACpB,QAAQ,CAAsB;IAC9B,YAAY,CAAyB;IAE7C,MAAM;QACJ,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAA;QACrB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAA;QACrB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO;QACL,IAAI,CAAC,KAAK,GAAG,SAAS,CAAA;QACtB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM,CAAC,OAAgD;QACrD,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAA;QACrB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QACxF,OAAO,IAAI,CAAA;IACb,CAAC;IAED,WAAW,CAAC,OAAgD;QAC1D,IAAI,CAAC,KAAK,GAAG,cAAc,CAAA;QAC3B,IAAI,CAAC,QAAQ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AAK,sCAAsC,CAAA;YACjF,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAED,+DAA+D;AAC/D,cAAc;AACd,+DAA+D;AAE/D,MAAM,UAAU,kBAAkB;IAGhC,OAAO,IAAI,mBAAmB,EAAW,CAAA;AAC3C,CAAC","sourcesContent":["/**\n * ConfigSchema Builder\n *\n * Fluent API for building typed configuration schemas.\n *\n * Usage:\n * ```ts\n * const schema = defineConfigSchema<MyConfig>()\n * .field('trackingId', f => f.string().required().label('Tracking ID'))\n * .field('anonymize', f => f.boolean().default(false).label('Anonymize IPs'))\n * .build()\n * ```\n *\n * @module @pwfabric/core/config-schema-builder\n */\n\nimport type {\n ConfigFieldConstraints,\n ConfigFieldDefinition,\n ConfigFieldOption,\n ConfigFieldType,\n ConfigSchema,\n ValidationResult,\n} from '@pwfabric/contracts'\nimport { validationOk, validationErr, validationError } from '@pwfabric/contracts'\n\n// ============================================================\n// FIELD BUILDER\n// ============================================================\n\nexport class FieldBuilder {\n private _type: ConfigFieldType = 'string'\n private _required = false\n private _defaultValue?: unknown\n private _label = ''\n private _description?: string\n private _sensitive?: boolean\n private _options?: ConfigFieldOption[]\n private _constraints?: ConfigFieldConstraints\n\n string(): this {\n this._type = 'string'\n return this\n }\n\n number(): this {\n this._type = 'number'\n return this\n }\n\n boolean(): this {\n this._type = 'boolean'\n return this\n }\n\n select(options: readonly (string | ConfigFieldOption)[]): this {\n this._type = 'select'\n this._options = options.map((o) => (typeof o === 'string' ? { value: o, label: o } : o))\n return this\n }\n\n multiSelect(options: readonly (string | ConfigFieldOption)[]): this {\n this._type = 'multi-select'\n this._options = options.map((o) => (typeof o === 'string' ? { value: o, label: o } : o))\n return this\n }\n\n url(): this {\n this._type = 'url'\n return this\n }\n\n email(): this {\n this._type = 'email'\n return this\n }\n\n json(): this {\n this._type = 'json'\n return this\n }\n\n required(): this {\n this._required = true\n return this\n }\n\n default(value: unknown): this {\n this._defaultValue = value\n return this\n }\n\n label(s: string): this {\n this._label = s\n return this\n }\n\n description(s: string): this {\n this._description = s\n return this\n }\n\n sensitive(): this {\n this._sensitive = true\n return this\n }\n\n min(n: number): this {\n this._constraints = { ...this._constraints, min: n }\n return this\n }\n\n max(n: number): this {\n this._constraints = { ...this._constraints, max: n }\n return this\n }\n\n pattern(s: string, msg?: string): this {\n this._constraints = { ...this._constraints, pattern: s }\n if (msg) {\n this._constraints = { ...this._constraints, patternMessage: msg }\n }\n return this\n }\n\n /** @internal */\n _build(key: string, group: string | undefined, order: number): ConfigFieldDefinition {\n const def: ConfigFieldDefinition = {\n key,\n type: this._type,\n required: this._required,\n label: this._label || key,\n ...(this._defaultValue !== undefined ? { defaultValue: this._defaultValue } : {}),\n ...(this._description !== undefined ? { description: this._description } : {}),\n ...(group !== undefined ? { group } : {}),\n ...(order !== 0 ? { order } : {}),\n ...(this._sensitive === true ? { sensitive: true } : {}),\n ...(this._options !== undefined ? { options: this._options } : {}),\n ...(this._constraints !== undefined ? { constraints: this._constraints } : {}),\n }\n return def\n }\n}\n\n// ============================================================\n// SCHEMA BUILDER\n// ============================================================\n\ninterface PendingField {\n key: string\n factory: (f: FieldBuilder) => FieldBuilder\n group?: string\n}\n\nexport class ConfigSchemaBuilder<TConfig = Record<string, unknown>> {\n private _fields: PendingField[] = []\n\n field(key: string, factory: (f: FieldBuilder) => FieldBuilder): this {\n this._fields.push({ key, factory })\n return this\n }\n\n group(name: string, groupFn: (g: ConfigSchemaGroupBuilder) => void): this {\n const gb = new ConfigSchemaGroupBuilder(name)\n groupFn(gb)\n this._fields.push(...gb._getFields())\n return this\n }\n\n build(): ConfigSchema<TConfig> {\n const fields: ConfigFieldDefinition[] = this._fields.map((pf, idx) => {\n const fb = new FieldBuilder()\n pf.factory(fb)\n return fb._build(pf.key, pf.group, idx)\n })\n return new SimpleConfigSchema<TConfig>(fields)\n }\n}\n\nclass ConfigSchemaGroupBuilder {\n private _fields: PendingField[] = []\n private readonly _name: string\n\n constructor(name: string) {\n this._name = name\n }\n\n field(key: string, factory: (f: FieldBuilder) => FieldBuilder): this {\n this._fields.push({ key, factory, group: this._name })\n return this\n }\n\n /** @internal */\n _getFields(): PendingField[] {\n return this._fields\n }\n}\n\n// ============================================================\n// SIMPLE CONFIG SCHEMA IMPLEMENTATION\n// ============================================================\n\nexport class SimpleConfigSchema<\n TConfig = Record<string, unknown>,\n> implements ConfigSchema<TConfig> {\n readonly fields: readonly ConfigFieldDefinition[]\n\n constructor(fields: ConfigFieldDefinition[]) {\n this.fields = fields\n }\n\n validate(data: unknown): ValidationResult<TConfig> {\n const errors: { path: string[]; message: string; code: string }[] = []\n const record = (typeof data === 'object' && data !== null ? data : {}) as Record<\n string,\n unknown\n >\n\n for (const field of this.fields) {\n const value = record[field.key]\n\n if (value === undefined || value === null || value === '') {\n if (field.required && field.defaultValue === undefined) {\n errors.push(validationError([field.key], `${field.label} is required`, 'required'))\n }\n continue\n }\n\n // Type validation\n const typeError = this.validateType(field, value)\n if (typeError) {\n errors.push(validationError([field.key], typeError, 'type'))\n continue\n }\n\n // Constraint validation\n if (field.constraints) {\n const constraintError = this.validateConstraints(field, value)\n if (constraintError) {\n errors.push(validationError([field.key], constraintError, 'constraint'))\n }\n }\n }\n\n if (errors.length > 0) {\n return validationErr(errors)\n }\n return validationOk(record as TConfig)\n }\n\n applyDefaults(partial: Partial<TConfig>): TConfig {\n const result = { ...partial } as Record<string, unknown>\n for (const field of this.fields) {\n if (result[field.key] === undefined && field.defaultValue !== undefined) {\n result[field.key] = field.defaultValue\n }\n }\n return result as TConfig\n }\n\n private validateType(field: ConfigFieldDefinition, value: unknown): string | null {\n switch (field.type) {\n case 'string':\n case 'url':\n case 'email':\n case 'json':\n if (typeof value !== 'string') {\n return `${field.label} must be a string`\n }\n break\n case 'number':\n if (typeof value !== 'number') {\n return `${field.label} must be a number`\n }\n break\n case 'boolean':\n if (typeof value !== 'boolean') {\n return `${field.label} must be a boolean`\n }\n break\n case 'select':\n if (typeof value !== 'string') {\n return `${field.label} must be a string`\n }\n if (field.options && !field.options.some((o) => o.value === value)) {\n return `${field.label} must be one of: ${field.options.map((o) => o.value).join(', ')}`\n }\n break\n case 'multi-select':\n if (!Array.isArray(value)) {\n return `${field.label} must be an array`\n }\n if (field.options) {\n const valid = new Set(field.options.map((o) => o.value))\n for (const v of value) {\n if (typeof v !== 'string' || !valid.has(v)) {\n return `${field.label} contains invalid option: ${String(v)}`\n }\n }\n }\n break\n }\n return null\n }\n\n private validateConstraints(field: ConfigFieldDefinition, value: unknown): string | null {\n const c = field.constraints\n if (!c) return null\n\n if (typeof value === 'number') {\n if (c.min !== undefined && value < c.min) {\n return `${field.label} must be at least ${String(c.min)}`\n }\n if (c.max !== undefined && value > c.max) {\n return `${field.label} must be at most ${String(c.max)}`\n }\n }\n\n if (typeof value === 'string' && c.pattern) {\n if (!new RegExp(c.pattern).test(value)) {\n return c.patternMessage ?? `${field.label} does not match the required pattern`\n }\n }\n\n return null\n }\n}\n\n// ============================================================\n// ENTRY POINT\n// ============================================================\n\nexport function defineConfigSchema<\n TConfig = Record<string, unknown>,\n>(): ConfigSchemaBuilder<TConfig> {\n return new ConfigSchemaBuilder<TConfig>()\n}\n"]}
|
|
@@ -67,4 +67,3 @@ export declare class ContractBuilder<TInput = unknown, TOutput = unknown> {
|
|
|
67
67
|
* Create a new contract builder
|
|
68
68
|
*/
|
|
69
69
|
export declare function defineContract<TInput = unknown, TOutput = unknown>(): ContractBuilder<TInput, TOutput>;
|
|
70
|
-
//# sourceMappingURL=contract-builder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-builder.js","sourceRoot":"","sources":["../src/contract-builder.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH,OAAO,EACL,UAAU,EACV,YAAY,EACZ,eAAe,EACf,EAAE,EACF,GAAG,EACH,eAAe,GAChB,MAAM,qBAAqB,CAAA;AAE5B,+DAA+D;AAC/D,+BAA+B;AAC/B,+DAA+D;AAE/D;;GAE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AAI,CAAC,QAAQ,CAAC,IAAI,eAAe;YACvD,QAAQ;YACR,KAAK,EAAE,IAAI,CAAC,YAAY;YACxB,MAAM,EAAE,IAAI,CAAC,aAAa;SAC3B,CAAC,CAAA;IACJ,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,cAAc;IAI5B,OAAO,IAAI,eAAe,EAAmB,CAAA;AAC/C,CAAC","sourcesContent":["/**\n * Contract Builder\n *\n * PHASE0-WS3: Fluent API for building contracts\n *\n * @module @pwfabric/core/contract-builder\n */\n\nimport type {\n Contract,\n ContractId,\n ContractMetadata,\n ContractState,\n ContractError,\n Schema,\n ValidationResult,\n SerializedContract,\n SemanticVersion,\n} from '@pwfabric/contracts'\nimport {\n contractId,\n parseVersion,\n INITIAL_VERSION,\n ok,\n err,\n validationError,\n} from '@pwfabric/contracts'\n\n// ============================================================\n// SIMPLE SCHEMA IMPLEMENTATION\n// ============================================================\n\n/**\n * Minimal schema implementation backed by a validator function.\n */\nclass SimpleSchema<T> implements Schema<T> {\n readonly definition\n private readonly validator: (data: unknown) => ValidationResult<T>\n\n constructor(\n definition: Schema<T>['definition'],\n validator: (data: unknown) => ValidationResult<T>\n ) {\n this.definition = definition\n this.validator = validator\n }\n\n validate(data: unknown): ValidationResult<T> {\n return this.validator(data)\n }\n\n parse(data: unknown): T {\n const result = this.validate(data)\n if (result.success) {\n return result.data\n }\n throw new Error(`Validation failed: ${JSON.stringify(result.error)}`)\n }\n\n safeParse(data: unknown): ValidationResult<T> {\n return this.validate(data)\n }\n\n toJsonSchema(): Record<string, unknown> {\n return { type: 'object' }\n }\n}\n\n/**\n * Create a schema that accepts any value\n */\nexport function anySchema<T = unknown>(): Schema<T> {\n return new SimpleSchema<T>({ type: 'unknown' }, (data) => ok(data as T))\n}\n\n/**\n * Create a schema that validates an object\n */\nexport function objectSchema<T extends Record<string, unknown>>(): Schema<T> {\n return new SimpleSchema<T>({ type: 'object', properties: {}, required: [] }, (data) => {\n if (typeof data !== 'object' || data === null) {\n return err([validationError([], 'Expected object', 'type_error')])\n }\n return ok(data as T)\n })\n}\n\n// ============================================================\n// CONTRACT IMPLEMENTATION\n// ============================================================\n\n/**\n * Simple contract implementation\n */\nclass SimpleContract<TInput, TOutput, TError = ContractError> implements Contract<\n TInput,\n TOutput,\n TError\n> {\n readonly id: ContractId\n readonly version: SemanticVersion\n readonly metadata: ContractMetadata\n readonly input: Schema<TInput>\n readonly output: Schema<TOutput>\n readonly errors: readonly Schema<TError>[]\n\n constructor(config: {\n id: ContractId\n version: SemanticVersion\n metadata: ContractMetadata\n input: Schema<TInput>\n output: Schema<TOutput>\n errors?: readonly Schema<TError>[]\n }) {\n this.id = config.id\n this.version = config.version\n this.metadata = config.metadata\n this.input = config.input\n this.output = config.output\n this.errors = config.errors ?? []\n }\n\n validateInput(data: unknown): ValidationResult<TInput> {\n return this.input.validate(data)\n }\n\n validateOutput(data: unknown): ValidationResult<TOutput> {\n return this.output.validate(data)\n }\n\n validateError(data: unknown): ValidationResult<TError> {\n for (const schema of this.errors) {\n const result = schema.validate(data)\n if (result.success) {\n return result\n }\n }\n return err([validationError([], 'Unknown error type', 'unknown_error')])\n }\n\n serialize(): SerializedContract {\n return {\n id: this.id,\n version: `${this.version.major}.${this.version.minor}.${this.version.patch}`,\n metadata: this.metadata,\n input: {\n version: '1.0.0',\n definition: this.input.definition,\n jsonSchema: this.input.toJsonSchema(),\n },\n output: {\n version: '1.0.0',\n definition: this.output.definition,\n jsonSchema: this.output.toJsonSchema(),\n },\n errors: this.errors.map((e) => ({\n version: '1.0.0',\n definition: e.definition,\n jsonSchema: e.toJsonSchema(),\n })),\n }\n }\n}\n\n// ============================================================\n// CONTRACT BUILDER\n// ============================================================\n\n/**\n * Contract builder for fluent API\n */\nexport class ContractBuilder<TInput = unknown, TOutput = unknown> {\n private _id = ''\n private _version = '0.1.0'\n private _name = ''\n private _description?: string\n private _state: ContractState = 'draft'\n private _tags?: readonly string[]\n private _inputSchema: Schema<TInput> = anySchema<TInput>()\n private _outputSchema: Schema<TOutput> = anySchema<TOutput>()\n\n /**\n * Set the contract ID\n */\n id(id: string): this {\n this._id = id\n return this\n }\n\n /**\n * Set the contract version\n */\n version(version: string): this {\n this._version = version\n return this\n }\n\n /**\n * Set the contract name\n */\n name(name: string): this {\n this._name = name\n return this\n }\n\n /**\n * Set the contract description\n */\n description(description: string): this {\n this._description = description\n return this\n }\n\n /**\n * Set the contract state\n */\n state(state: ContractState): this {\n this._state = state\n return this\n }\n\n /**\n * Set the contract tags\n */\n tags(tags: readonly string[]): this {\n this._tags = tags\n return this\n }\n\n /**\n * Set the input schema\n */\n input<T>(schema: Schema<T>): ContractBuilder<T, TOutput> {\n const builder = this as unknown as ContractBuilder<T, TOutput>\n builder._inputSchema = schema as unknown as Schema<T>\n return builder\n }\n\n /**\n * Set the output schema\n */\n output<T>(schema: Schema<T>): ContractBuilder<TInput, T> {\n const builder = this as unknown as ContractBuilder<TInput, T>\n builder._outputSchema = schema as unknown as Schema<T>\n return builder\n }\n\n /**\n * Build the contract\n */\n build(): Contract<TInput, TOutput> {\n if (!this._id) {\n throw new Error('Contract ID is required')\n }\n if (!this._name) {\n throw new Error('Contract name is required')\n }\n\n const metadata: ContractMetadata = {\n name: this._name,\n state: this._state,\n }\n if (this._description !== undefined) {\n ;(metadata as { description?: string }).description = this._description\n }\n if (this._tags !== undefined) {\n ;(metadata as { tags?: readonly string[] }).tags = this._tags\n }\n\n return new SimpleContract<TInput, TOutput>({\n id: contractId(this._id),\n version: parseVersion(this._version) ?? INITIAL_VERSION,\n metadata,\n input: this._inputSchema,\n output: this._outputSchema,\n })\n }\n}\n\n/**\n * Create a new contract builder\n */\nexport function defineContract<TInput = unknown, TOutput = unknown>(): ContractBuilder<\n TInput,\n TOutput\n> {\n return new ContractBuilder<TInput, TOutput>()\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passthrough.js","sourceRoot":"","sources":["../../src/contracts/passthrough.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAElE,MAAM,CAAC,MAAM,mBAAmB,GAAG,cAAc,EAAE;KAChD,EAAE,CAAC,sBAAsB,CAAC;KAC1B,IAAI,CAAC,sBAAsB,CAAC;KAC5B,WAAW,CAAC,2DAA2D,CAAC;KACxE,KAAK,CAAC,QAAQ,CAAC;KACf,KAAK,CAAC,SAAS,EAAE,CAAC;KAClB,MAAM,CAAC,SAAS,EAAE,CAAC;KACnB,KAAK,EAAE,CAAA"}
|
|
1
|
+
{"version":3,"file":"passthrough.js","sourceRoot":"","sources":["../../src/contracts/passthrough.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAElE,MAAM,CAAC,MAAM,mBAAmB,GAAG,cAAc,EAAE;KAChD,EAAE,CAAC,sBAAsB,CAAC;KAC1B,IAAI,CAAC,sBAAsB,CAAC;KAC5B,WAAW,CAAC,2DAA2D,CAAC;KACxE,KAAK,CAAC,QAAQ,CAAC;KACf,KAAK,CAAC,SAAS,EAAE,CAAC;KAClB,MAAM,CAAC,SAAS,EAAE,CAAC;KACnB,KAAK,EAAE,CAAA","sourcesContent":["/**\n * Passthrough Contract\n *\n * A canonical declaration-only contract used by platform capabilities\n * (persistence, navigation, interaction, entities) that accept any input\n * and produce any output with no schema validation.\n *\n * Moved from `@pwfabric/runtime/capability/platform-capabilities.ts` to\n * `@pwfabric/core/contracts/passthrough` so pwpack-authored capabilities\n * can import it without a runtime dependency.\n *\n * @module @pwfabric/core/contracts/passthrough\n */\n\nimport { defineContract, anySchema } from '../contract-builder.js'\n\nexport const passthroughContract = defineContract()\n .id('platform/passthrough')\n .name('Platform Passthrough')\n .description('Passthrough contract for platform capability declarations')\n .state('stable')\n .input(anySchema())\n .output(anySchema())\n .build()\n"]}
|
|
@@ -1 +1 @@
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nB,GAAG,EAAE,OAAO,EAAE,GAAG;gBACjB,UAAU,EAAE,OAAO,EAAE,UAAU;aAChC,CAAA;QACH,CAAC;QACD,KAAK,CAAC,eAAe,EAAE,OAAO,EAAE,WAAW,CAAC,CAAA;QAC5C,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAA;QAC7B,IAAI,CAAC,GAAG,GAAG,OAAO,EAAE,GAAG,CAAA;QACvB,IAAI,CAAC,UAAU,GAAG,OAAO,EAAE,UAAU,CAAA;IACvC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,QAAQ;IAC1B,OAAO,CAAoB;IAC3B,SAAS,CAAoB;IAE7C,YACE,OAAe,EACf,OAMC;QAED,MAAM,WAAW,GAA8C,EAAE,CAAA;QACjE,IAAI,OAAO,EAAE,KAAK,EAAE,CAAC;YACnB,WAAW,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;QACnC,CAAC;QACD,IAAI,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,SAAS,EAAE,CAAC;YAC/D,WAAW,CAAC,OAAO,GAAG;gBACpB,GAAG,OAAO,EAAE,OAAO;gBACnB,OAAO,EAAE,OAAO,EAAE,OAAO;gBACzB,SAAS,EAAE,OAAO,EAAE,SAAS;aAC9B,CAAA;QACH,CAAC;QACD,KAAK,CAAC,OAAO,EAAE,IAAI,IAAI,cAAc,EAAE,OAAO,EAAE,WAAW,CAAC,CAAA;QAC5D,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,EAAE,OAAO,CAAA;QAC/B,IAAI,CAAC,SAAS,GAAG,OAAO,EAAE,SAAS,CAAA;IACrC,CAAC;CACF","sourcesContent":["/**\n * Application Error Classes\n *\n * Custom error class hierarchy with code, message, context, and cause\n *\n * @module @pwfabric/core/errors/AppError\n */\n\nimport { type ErrorCode, getHttpStatus, isRetryable } from './ErrorCode.js'\n\n/**\n * Error context for additional debugging information\n */\nexport type ErrorContext = Readonly<Record<string, unknown>>\n\n/**\n * Serialized error format for API responses\n */\nexport interface SerializedError {\n readonly code: ErrorCode\n readonly message: string\n readonly timestamp: string\n readonly traceId?: string\n readonly context?: ErrorContext\n}\n\n/**\n * Base application error class\n *\n * All application errors should extend this class\n */\nexport class AppError extends Error {\n public readonly code: ErrorCode\n public readonly timestamp: Date\n public readonly context: ErrorContext | undefined\n public readonly isRetryable: boolean\n public readonly httpStatus: number\n\n constructor(\n code: ErrorCode,\n message: string,\n options?: {\n cause?: Error\n context?: ErrorContext\n }\n ) {\n super(message, { cause: options?.cause })\n this.name = 'AppError'\n this.code = code\n this.timestamp = new Date()\n this.context = options?.context\n this.isRetryable = isRetryable(code)\n this.httpStatus = getHttpStatus(code)\n }\n\n /**\n * Serialize error for API response\n */\n toJSON(traceId?: string): SerializedError {\n return {\n code: this.code,\n message: this.message,\n timestamp: this.timestamp.toISOString(),\n ...(traceId && { traceId }),\n ...(this.context && { context: this.context }),\n }\n }\n\n /**\n * Create error from unknown value\n */\n static from(error: unknown, code: ErrorCode = 'RUNTIME_ERROR'): AppError {\n if (error instanceof AppError) {\n return error\n }\n\n if (error instanceof Error) {\n return new AppError(code, error.message, { cause: error })\n }\n\n return new AppError(code, String(error))\n }\n}\n\n/**\n * Validation error for input validation failures\n */\nexport class ValidationAppError extends AppError {\n public readonly field: string | undefined\n\n constructor(\n message: string,\n options?: {\n field?: string\n cause?: Error\n context?: ErrorContext\n }\n ) {\n const baseOptions: { cause?: Error; context?: ErrorContext } = {}\n if (options?.cause) {\n baseOptions.cause = options.cause\n }\n if (options?.context || options?.field) {\n baseOptions.context = { ...options?.context, field: options?.field }\n }\n super('VALIDATION_FAILED', message, baseOptions)\n this.name = 'ValidationAppError'\n this.field = options?.field\n }\n}\n\n/**\n * Network error for connectivity issues\n */\nexport class NetworkAppError extends AppError {\n public readonly url: string | undefined\n public readonly statusCode: number | undefined\n\n constructor(\n message: string,\n options?: {\n url?: string\n statusCode?: number\n cause?: Error\n context?: ErrorContext\n }\n ) {\n const baseOptions: { cause?: Error; context?: ErrorContext } = {}\n if (options?.cause) {\n baseOptions.cause = options.cause\n }\n if (options?.context || options?.url || options?.statusCode) {\n baseOptions.context = {\n ...options?.context,\n url: options?.url,\n statusCode: options?.statusCode,\n }\n }\n super('NETWORK_ERROR', message, baseOptions)\n this.name = 'NetworkAppError'\n this.url = options?.url\n this.statusCode = options?.statusCode\n }\n}\n\n/**\n * Editor error for studio/editor operations\n */\nexport class EditorAppError extends AppError {\n public readonly blockId: string | undefined\n public readonly operation: string | undefined\n\n constructor(\n message: string,\n options?: {\n code?: ErrorCode\n blockId?: string\n operation?: string\n cause?: Error\n context?: ErrorContext\n }\n ) {\n const baseOptions: { cause?: Error; context?: ErrorContext } = {}\n if (options?.cause) {\n baseOptions.cause = options.cause\n }\n if (options?.context || options?.blockId || options?.operation) {\n baseOptions.context = {\n ...options?.context,\n blockId: options?.blockId,\n operation: options?.operation,\n }\n }\n super(options?.code ?? 'EDITOR_ERROR', message, baseOptions)\n this.name = 'EditorAppError'\n this.blockId = options?.blockId\n this.operation = options?.operation\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorCode.js","sourceRoot":"","sources":["../../src/errors/ErrorCode.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,2BAA2B;IAC3B,iBAAiB,EAAE,mBAAmB;IACtC,aAAa,EAAE,eAAe;IAC9B,gBAAgB,EAAE,kBAAkB;IACpC,cAAc,EAAE,gBAAgB;IAEhC,wBAAwB;IACxB,aAAa,EAAE,eAAe;IAC9B,OAAO,EAAE,SAAS;IAClB,iBAAiB,EAAE,mBAAmB;IACtC,cAAc,EAAE,gBAAgB;IAEhC,+BAA+B;IAC/B,YAAY,EAAE,cAAc;IAC5B,SAAS,EAAE,WAAW;IACtB,aAAa,EAA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aAAa,CAAC,IAAe;IAC3C,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,SAAS,CAAC,iBAAiB,CAAC;QACjC,KAAK,SAAS,CAAC,aAAa,CAAC;QAC7B,KAAK,SAAS,CAAC,gBAAgB,CAAC;QAChC,KAAK,SAAS,CAAC,cAAc;YAC3B,OAAO,GAAG,CAAA;QAEZ,KAAK,SAAS,CAAC,YAAY,CAAC;QAC5B,KAAK,SAAS,CAAC,aAAa,CAAC;QAC7B,KAAK,SAAS,CAAC,mBAAmB;YAChC,OAAO,GAAG,CAAA;QAEZ,KAAK,SAAS,CAAC,SAAS;YACtB,OAAO,GAAG,CAAA;QAEZ,KAAK,SAAS,CAAC,SAAS,CAAC;QACzB,KAAK,SAAS,CAAC,eAAe,CAAC;QAC/B,KAAK,SAAS,CAAC,IAAI;YACjB,OAAO,GAAG,CAAA;QAEZ,KAAK,SAAS,CAAC,QAAQ,CAAC;QACxB,KAAK,SAAS,CAAC,cAAc;YAC3B,OAAO,GAAG,CAAA;QAEZ,KAAK,SAAS,CAAC,OAAO;YACpB,OAAO,GAAG,CAAA;QAEZ,KAAK,SAAS,CAAC,mBAAmB;YAChC,OAAO,GAAG,CAAA;QAEZ,KAAK,SAAS,CAAC,eAAe;YAC5B,OAAO,GAAG,CAAA;QAEZ;YACE,OAAO,GAAG,CAAA;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,IAAe;IACzC,MAAM,cAAc,GAAgB;QAClC,SAAS,CAAC,aAAa;QACvB,SAAS,CAAC,OAAO;QACjB,SAAS,CAAC,iBAAiB;QAC3B,SAAS,CAAC,mBAAmB;KAC9B,CAAA;IACD,OAAO,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;AACtC,CAAC","sourcesContent":["/**\n * Error Codes\n *\n * Standardized error codes for PWFabric platform\n *\n * @module @pwfabric/core/errors/ErrorCode\n */\n\n/**\n * Error code categories\n */\nexport const ErrorCode = {\n // Validation errors (1xxx)\n VALIDATION_FAILED: 'VALIDATION_FAILED',\n INVALID_INPUT: 'INVALID_INPUT',\n MISSING_REQUIRED: 'MISSING_REQUIRED',\n INVALID_FORMAT: 'INVALID_FORMAT',\n\n // Network errors (2xxx)\n NETWORK_ERROR: 'NETWORK_ERROR',\n TIMEOUT: 'TIMEOUT',\n CONNECTION_FAILED: 'CONNECTION_FAILED',\n REQUEST_FAILED: 'REQUEST_FAILED',\n\n // Authentication errors (3xxx)\n UNAUTHORIZED: 'UNAUTHORIZED',\n FORBIDDEN: 'FORBIDDEN',\n TOKEN_EXPIRED: 'TOKEN_EXPIRED',\n INVALID_CREDENTIALS: 'INVALID_CREDENTIALS',\n\n // Resource errors (4xxx)\n NOT_FOUND: 'NOT_FOUND',\n ALREADY_EXISTS: 'ALREADY_EXISTS',\n CONFLICT: 'CONFLICT',\n GONE: 'GONE',\n\n // Runtime errors (5xxx)\n RUNTIME_ERROR: 'RUNTIME_ERROR',\n INTERNAL_ERROR: 'INTERNAL_ERROR',\n SERVICE_UNAVAILABLE: 'SERVICE_UNAVAILABLE',\n NOT_IMPLEMENTED: 'NOT_IMPLEMENTED',\n\n // Editor errors (6xxx)\n EDITOR_ERROR: 'EDITOR_ERROR',\n BLOCK_NOT_FOUND: 'BLOCK_NOT_FOUND',\n INVALID_OPERATION: 'INVALID_OPERATION',\n RENDER_ERROR: 'RENDER_ERROR',\n} as const\n\nexport type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode]\n\n/**\n * Get HTTP status code for an error code\n */\nexport function getHttpStatus(code: ErrorCode): number {\n switch (code) {\n case ErrorCode.VALIDATION_FAILED:\n case ErrorCode.INVALID_INPUT:\n case ErrorCode.MISSING_REQUIRED:\n case ErrorCode.INVALID_FORMAT:\n return 400\n\n case ErrorCode.UNAUTHORIZED:\n case ErrorCode.TOKEN_EXPIRED:\n case ErrorCode.INVALID_CREDENTIALS:\n return 401\n\n case ErrorCode.FORBIDDEN:\n return 403\n\n case ErrorCode.NOT_FOUND:\n case ErrorCode.BLOCK_NOT_FOUND:\n case ErrorCode.GONE:\n return 404\n\n case ErrorCode.CONFLICT:\n case ErrorCode.ALREADY_EXISTS:\n return 409\n\n case ErrorCode.TIMEOUT:\n return 408\n\n case ErrorCode.SERVICE_UNAVAILABLE:\n return 503\n\n case ErrorCode.NOT_IMPLEMENTED:\n return 501\n\n default:\n return 500\n }\n}\n\n/**\n * Check if error code is retryable\n */\nexport function isRetryable(code: ErrorCode): boolean {\n const retryableCodes: ErrorCode[] = [\n ErrorCode.NETWORK_ERROR,\n ErrorCode.TIMEOUT,\n ErrorCode.CONNECTION_FAILED,\n ErrorCode.SERVICE_UNAVAILABLE,\n ]\n return retryableCodes.includes(code)\n}\n"]}
|
package/dist/errors/index.d.ts
CHANGED
|
@@ -7,4 +7,3 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { ErrorCode, getHttpStatus, isRetryable, type ErrorCode as ErrorCodeType, } from './ErrorCode.js';
|
|
9
9
|
export { AppError, ValidationAppError, NetworkAppError, EditorAppError, type ErrorContext, type SerializedError, } from './AppError.js';
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/errors/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,SAAS,EACT,aAAa,EACb,WAAW,GAEZ,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,cAAc,GAGf,MAAM,eAAe,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,SAAS,EACT,aAAa,EACb,WAAW,GAEZ,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,cAAc,GAGf,MAAM,eAAe,CAAA","sourcesContent":["/**\n * Error Module\n *\n * Exports for error infrastructure\n *\n * @module @pwfabric/core/errors\n */\n\nexport {\n ErrorCode,\n getHttpStatus,\n isRetryable,\n type ErrorCode as ErrorCodeType,\n} from './ErrorCode.js'\nexport {\n AppError,\n ValidationAppError,\n NetworkAppError,\n EditorAppError,\n type ErrorContext,\n type SerializedError,\n} from './AppError.js'\n"]}
|
package/dist/errors.d.ts
CHANGED
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtB,IAAI,CAAQ;IACZ,SAAS,CAAM;IAE/B,YAAY,OAAe,EAAE,IAAY,EAAE,OAAsB;QAC/D,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACvB,IAAI,CAAC,IAAI,GAAG,eAAe,CAAA;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAA;IAC7B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,aAAa;IAChC,KAAK,CAAoB;IAEzC,YAAY,OAAe,EAAE,KAAc,EAAE,OAAsB;QACjE,KAAK,CAAC,OAAO,EAAE,kBAAkB,EAAE,OAAO,CAAC,CAAA;QAC3C,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAA;QAC7B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,aAAa;IAC9B,QAAQ,CAAQ;IAEhC,YAAY,QAAgB,EAAE,OAAsB;QAClD,KAAK,CAAC,GAAG,QAAQ,YAAY,EAAE,WAAW,EAAE,OAAO,CAAC,CAAA;QACpD,IAAI,CAAC,IAAI,G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ACH,MAAM,OAAO,aAAc,SAAQ,aAAa;IAC9B,QAAQ,CAAQ;IAEhC,YAAY,QAAgB,EAAE,OAAsB;QAClD,KAAK,CAAC,GAAG,QAAQ,YAAY,EAAE,WAAW,EAAE,OAAO,CAAC,CAAA;QACpD,IAAI,CAAC,IAAI,GAAG,eAAe,CAAA;QAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,aAAa;IAClD,YAAY,OAAO,GAAG,cAAc,EAAE,OAAsB;QAC1D,KAAK,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,CAAA;QACvC,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAA;IACjC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,aAAa;IAC/C,YAAY,OAAO,GAAG,WAAW,EAAE,OAAsB;QACvD,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,CAAA;QACpC,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAA;IAC9B,CAAC;CACF","sourcesContent":["/**\n * Custom error classes for PWFabric\n */\n\n/**\n * Base error class for all PWFabric errors\n */\nexport class PWFabricError extends Error {\n public readonly code: string\n public readonly timestamp: Date\n\n constructor(message: string, code: string, options?: ErrorOptions) {\n super(message, options)\n this.name = 'PWFabricError'\n this.code = code\n this.timestamp = new Date()\n }\n}\n\n/**\n * Validation error\n */\nexport class ValidationError extends PWFabricError {\n public readonly field: string | undefined\n\n constructor(message: string, field?: string, options?: ErrorOptions) {\n super(message, 'VALIDATION_ERROR', options)\n this.name = 'ValidationError'\n this.field = field\n }\n}\n\n/**\n * Not found error\n */\nexport class NotFoundError extends PWFabricError {\n public readonly resource: string\n\n constructor(resource: string, options?: ErrorOptions) {\n super(`${resource} not found`, 'NOT_FOUND', options)\n this.name = 'NotFoundError'\n this.resource = resource\n }\n}\n\n/**\n * Unauthorized error\n */\nexport class UnauthorizedError extends PWFabricError {\n constructor(message = 'Unauthorized', options?: ErrorOptions) {\n super(message, 'UNAUTHORIZED', options)\n this.name = 'UnauthorizedError'\n }\n}\n\n/**\n * Forbidden error\n */\nexport class ForbiddenError extends PWFabricError {\n constructor(message = 'Forbidden', options?: ErrorOptions) {\n super(message, 'FORBIDDEN', options)\n this.name = 'ForbiddenError'\n }\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -21,5 +21,4 @@ export { isScopeToken, readScopeList, type ScopeListReading } from './oauth-scop
|
|
|
21
21
|
export { CapabilityBuilder, defineCapability } from './capability-builder.js';
|
|
22
22
|
export { FieldBuilder, ConfigSchemaBuilder, SimpleConfigSchema, defineConfigSchema, } from './config-schema-builder.js';
|
|
23
23
|
export { type StateStore, type StateListener, type StateSnapshot, type Selector, type Transition, type StateMachineConfig, type StateMachine, SimpleStateStore, SimpleStateMachine, createStateStore, computed, subscribeToSlice, createStateMachine, } from './state.js';
|
|
24
|
-
export { type BlockCategory, type BlockDefinition, type Block, type ValidationError as BlockValidationError, type ValidationResult as BlockValidationResult, type CompositionRuleType, type CompositionRule, MAX_NESTING_DEPTH, BLOCK_CATEGORIES, type BreakpointName, type BreakpointDefinition, type ResponsiveValue, type BlockLayout, type PreviewViewport, BREAKPOINTS, BREAKPOINT_ORDER, DEFAULT_BLOCK_LAYOUT, VIEWPORT_PRESETS, responsiveNumberSchema, responsiveBooleanSchema, blockLayoutSchema, resolveResponsiveValue, resolveSpanAtBreakpoint, getColumnsAtBreakpoint, getBreakpointForWidth, BLOCK_HOST_IMPORTS, blockBundleExternals, blockImportMap, blockShimFiles, blockHostGlobals, unseededHostGlobals, specifiersForShim, type HostImport, type HostImportKind, type HostSeeding, } from './blocks/index.js';
|
|
25
|
-
//# sourceMappingURL=index.d.ts.map
|
|
24
|
+
export { type BlockCategory, type BlockDefinition, type Block, type ValidationError as BlockValidationError, type ValidationResult as BlockValidationResult, type CompositionRuleType, type CompositionRule, MAX_NESTING_DEPTH, BLOCK_CATEGORIES, type BreakpointName, type BreakpointDefinition, type ResponsiveValue, type BlockLayout, type PreviewViewport, BREAKPOINTS, BREAKPOINT_ORDER, DEFAULT_BLOCK_LAYOUT, VIEWPORT_PRESETS, responsiveNumberSchema, responsiveBooleanSchema, blockLayoutSchema, resolveResponsiveValue, resolveSpanAtBreakpoint, getColumnsAtBreakpoint, getBreakpointForWidth, BLOCK_HOST_IMPORTS, blockBundleExternals, blockImportMap, blockShimFiles, blockHostGlobals, unseededHostGlobals, specifiersForShim, isExportableName, shimSource, type HostImport, type HostImportKind, type HostSeeding, } from './blocks/index.js';
|