@8ux-co/eelzap 0.0.0-stage → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,145 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.10.0] - Unreleased
9
+
10
+ The first release as **`@8ux-co/eelzap`**, which replaces
11
+ `@8ux-co/eelzap-api-sdk-ts` (its last release, 0.9.1, points here). One
12
+ package for the delivery client and the preview client, with subpaths. The
13
+ version continues the old line.
14
+
15
+ ### Added
16
+
17
+ - `EelZapError.details`: a validation refusal from the API lists each problem as `{ path, message, code }` (`ApiErrorDetail`); empty for other errors.
18
+ - **Retries of `429`, and of `503` with `Retry-After`.** On by default: the
19
+ client honours `Retry-After` (seconds or an HTTP date, plus jitter), backs
20
+ off exponentially without it, and gives up after `retries` (default 3) or
21
+ when `Retry-After` exceeds `maxDelayMs` (default 60 s). Only reads and writes
22
+ that carry an `Idempotency-Key` are retried; no other write is ever
23
+ repeated. `createClient({ retry: false | { retries, maxDelayMs, baseDelayMs,
24
+ onRetry } })`; `RetryOptions` and `RetryEvent` are exported. `timeout` is per
25
+ attempt.
26
+ - **Subpaths.** `.` (the client), `./fields`, `./next`, `./react` and
27
+ `./preview`; `./analytics` is reserved. Zero runtime dependencies, React and
28
+ Next optional peers, ES2020, `sideEffects: false`, ESM and CJS for `.` and
29
+ `./fields`, ESM for the browser subpaths, with a gzip budget per subpath
30
+ checked in CI (`.` under 6 KB for a delivery-only import, `./fields` 1 KB,
31
+ `./next` 2 KB, `./react` about 2.2 KB, the boot about 1.2 KB, `./preview`
32
+ about 13.25 KB).
33
+ - **The preview boot.** `<ZapPreview />` (`./next`, `./react`) and a script
34
+ tag: under 1 KB, no request outside a preview session (framed by Zap,
35
+ `?zap`, the suggestion shortcut, a draft-mode session); in one, it loads the
36
+ overlay with an SRI hash compiled into the package, from the Zap that framed
37
+ the page, else `zapOrigin`, else `https://zap.eel.software`. A local Zap
38
+ counts only from a local page: `localhost`, `127.0.0.1`, `[::1]` or
39
+ `*.localhost`, over http or https, so local preview needs no shim. One
40
+ script and one overlay per page, under React StrictMode and remounts too.
41
+ - **The overlay** (`./preview`), formerly the unpublished
42
+ `@8ux-co/eelzap-preview`: the editor bridge, tag index, outlines, value
43
+ substitution, select mode and the suggestion chunks. `zap:ready` announces
44
+ the site's draft-mode route as a path; `zap:tags` says whether each field was
45
+ found by a tag or by stega. A URL or EMAIL value (`{ url }`, `{ email }`,
46
+ for a client advertising `links`) updates a tagged link's `href`
47
+ (`mailto:` for an email) and never its label. «Editar o comentar» sits at
48
+ the bottom centre, clear of a site's own corner buttons. Zap's editor frames the site by its real URL:
49
+ its side of the bridge accepts messages only from the site's own preview
50
+ origins and posts only to the exact origin that said `zap:ready`, never to
51
+ `'*'`.
52
+ - **Stega.** Preview reads carry invisible markers on TEXT, LONG_TEXT and
53
+ RICH_TEXT values, and the overlay finds the elements that render them with
54
+ no tag. `cleanStega(value)` and `hasStega(value)` in `.`; a `stega: false`
55
+ read option sends `stega=0`.
56
+ - **`fields(record)`** (`./fields`): typed pick helpers (`text`, `value`,
57
+ `attrs`, `image`, `list`) whose keys come from generated types; plain values
58
+ outside preview, `data-zap` attributes in preview. `list(prefix, n)` returns
59
+ `FieldSlot`s with the same helpers scoped to each slot, for `prefix_{i}`
60
+ (`s.text()`) and for slots of several fields `prefix_{i}_{suffix}`
61
+ (`nav.text('texto')`, `nav.value('url')`), suffixes typed; each has `key`,
62
+ `index` and `empty`.
63
+ - **`./next`:** `isZapPreview(request)`, `<ZapPreview />` announcing
64
+ `/api/zap-preview` by default, beside `createDraftModeRoute`,
65
+ `createDraftModeExitRoute`, `getPreviewToken` and `getValidPreviewToken`.
66
+ - **`./react`:** `onValues(entry, handler)` and `useZapLiveUpdates(entry)`
67
+ without the overlay in your bundle (they listen to the overlay's
68
+ `eelzap:values` event).
69
+ - **The public routes the client did not reach:** `sites.list`,
70
+ `previewTokens.validate`, `media.fromUrl`, and `listDeleted` and `restore`
71
+ on collection and document fields. `media.fromUrl` sends an
72
+ `Idempotency-Key`.
73
+ - **`comments`** («Comentarios»): `list`, `get`, `create`, `update`, `reply`,
74
+ `apply`, `saveToDraft` and `onPage` over the public `/comments` routes,
75
+ typed from the routes' schemas (`CommentThread`, `ThreadComment`,
76
+ `CreateCommentInput`, …). A thread is a plain comment or, with
77
+ `isChangeRequest`, a change request with an assignee, proposed values and a
78
+ resolution. `create`, `reply` and `saveToDraft` send an `Idempotency-Key`.
79
+ - From the 0.8.0 to 0.9.0 line, now in this package: `cachedFetch` with
80
+ `network-first` and `cache-first`, `itemVersions` and `documentVersions`,
81
+ `verifyWebhookSignature` (WebCrypto, so edge runtimes and workers too) and
82
+ `webhookChanges`, `getMediaUrl`, and the `preview` read option with `zpt_`
83
+ preview tokens as the API key.
84
+ - **Webhook test vectors** in the repository: a fixed secret, timestamp, body
85
+ and signature from Zap's signer, with tests of `verifyWebhookSignature` over
86
+ them in Node and in an edge-like runtime.
87
+
88
+ ### Changed
89
+
90
+ - **The CLI and codegen moved to `@8ux-co/eelzap-cli`** (bin `eelzap`,
91
+ `eelzap codegen`; `@8ux-co/eelzap-cli/codegen` for the programmatic API).
92
+ Generated code imports its types from `@8ux-co/eelzap`. This package no
93
+ longer depends on `@inquirer/prompts` or `dotenv`.
94
+ - `verifyWebhookSignature(payload, headers, secret, options?)` takes the
95
+ request headers and checks the signed timestamp; `WebhookPayload` is the
96
+ suite event envelope.
97
+ - The cache strategies never store a preview response.
98
+ - **`FieldType` is the API's**: `TEXT`, not `SHORT_TEXT`, which the field
99
+ routes refuse with a 400. Field creates, the field routes' answers and the
100
+ delivery schema reads (`collections.list`, `collections.get`,
101
+ `documents.list`) all use it: the delivery API publishes a text field as
102
+ `TEXT` too, no longer `SHORT_TEXT`.
103
+ - **Every create sends an `Idempotency-Key`**, which suite bearers must send:
104
+ `collections.create`, `collections.fields.create`,
105
+ `collections.sections.create`, `items.create`, `documents.create`,
106
+ `documents.fields.create` and `documents.sections.create` now do, as
107
+ `media.fromUrl` and the comment writes already did. A fresh key per call;
108
+ each takes a last `{ idempotencyKey }` argument to reuse a key on your own
109
+ retry. Make these writes from server code (the API's CORS does not allow the
110
+ header from a browser).
111
+ - **Comment webhook events.** The `zap.change_request.*` events are now
112
+ `zap.comment.created`, `zap.comment.replied`, `zap.comment.resolved`,
113
+ `zap.comment.reopened` and `zap.comment.updated`, with typed `data`
114
+ (`WebhookCommentCreatedData`, …), for plain comments and change requests
115
+ alike.
116
+ - **The live-site suggestion client calls `/comments`** instead of
117
+ `/change-requests`: it sends `isChangeRequest` (true when there is a
118
+ proposed value) and one top-level `pageUrl` in place of a per-anchor one, and
119
+ reads `liveEditing` and `comments` from `on-page`. New CDN release
120
+ (`boot.v1.a86632b937c1e248.js`).
121
+ - **`CurrencyValue` is `{ amountMinor, currency }`**, the name a write takes:
122
+ the delivery API answered `amount` while every write took `amountMinor`,
123
+ both in minor units. A currency value read can be written back unchanged.
124
+ - **`site.update({ url, previewOrigins })`** (`PATCH /site`) sets the site's
125
+ address and the extra origins drafts may be shown on, under the settings
126
+ page's rules, and `site.get()` reads both. `collections.update()` and
127
+ `documents.update()` take `previewPath`. Server code, with a `secret_` key
128
+ or an ADMIN suite credential.
129
+ - **A refused body says what was wrong.** The `400` message names each problem
130
+ (`Invalid input: key: …; type: …`) instead of a bare `Invalid input`, and the
131
+ body lists them in `error.details` (`path`, `message`, `code`).
132
+
133
+ ## [0.2.0] - 2026-03-14
134
+
135
+ ### Added
136
+
137
+ - Write operations for collections, items, documents, media, and site introspection.
138
+ - Nested resource clients for fields, sections, document values, and SEO.
139
+ - Configurable `pathPrefix` support for production rewrites and local `next-app` development.
140
+
141
+ ## [0.1.0] - 2026-03-11
142
+
143
+ ### Added
144
+
145
+ - Initial standalone SDK implementation for the EelZap Content Delivery API.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 EelZap
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.