@lessly/sdk-app 60.0.0 → 61.0.1

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 CHANGED
@@ -26,6 +26,28 @@ await sdk.organization.product.create({ name: 'Acme' });
26
26
  The available namespaces track the live catalog and grow as platform extensions migrate; check
27
27
  `package.json` `exports` (or `src/gen/manifest.gen.ts`) for what a given version exposes.
28
28
 
29
+ ### Operation identity on every method
30
+
31
+ Every generated REST method is a callable that also carries its own catalog identity, typed as
32
+ `((input: X) => Promise<Y>) & Operation`:
33
+
34
+ ```ts
35
+ sdk.mail.domain.create.operationKey; // 'mail_domain_create' — the catalog tool name
36
+ sdk.mail.domain.create.level; // 'admin' — one of 'read' | 'write' | 'admin'
37
+ ```
38
+
39
+ `level` comes verbatim from the platform catalog — the SDK transports it and never infers it from
40
+ `readOnly` or the HTTP method. Read both off the method rather than rebuilding a tool name from the
41
+ accessor path: a hyphenated resource (`sdk.tracking['event-names'].list`) joins several id
42
+ segments, so the path is a lossy view of the name. The properties are own properties of the
43
+ function, so they survive destructuring (`const { list } = sdk.organization.connectors`).
44
+
45
+ `src/gen/manifest.gen.ts` additionally exports `operations`, the whole tool-name -> level table,
46
+ for callers that need a level without holding a client.
47
+
48
+ Streaming (`<tool>Connect`) factories carry neither field: a socket is neither a read nor a write,
49
+ and the catalog declares no level for a ws-only tool.
50
+
29
51
  Errors are surfaced as a typed `LesslyApiError` (`status`, `code`, `body`). Mutating calls
30
52
  without the `lessly_csrf` cookie fail before the network with `status: 0` and
31
53
  `code: 'csrf_cookie_missing'` — no retry, no hidden refresh.
@@ -137,12 +159,41 @@ would otherwise outrank it and silently resolve the lookup against GAR — which
137
159
  early run read GAR's `0.1.x` line instead of the empty npmjs registry and skipped the `0.2.0`
138
160
  floor. This requires no change to the CLI's `--channel`/`--catalog-url`/`--baseline` contract.
139
161
 
162
+ ### Runtime changes: `runtime-bump.json`
163
+
164
+ The catalog diff only classifies **generated** code. The hand-written runtime (`src/runtime`, plus
165
+ `src/react` when present) is gated separately: the pipeline content-hashes those trees into
166
+ `runtimeHash` and stores it in the snapshot, so a runtime-only change publishes on its own instead
167
+ of waiting for an unrelated catalog change.
168
+
169
+ A runtime change ships at least a **PATCH**. To publish it at a higher level, commit the marker at
170
+ the repo root:
171
+
172
+ ```json
173
+ { "level": "minor" }
174
+ ```
175
+
176
+ - `runtime-bump.json` — `{ "level": "none" | "patch" | "minor" | "major" }`; a missing file reads as
177
+ `none`. Any other value fails the run.
178
+ - The marker applies **only while `runtimeHash` differs from the snapshot's**. The pipeline never
179
+ commits, so it is not reset after use — it simply goes inert once that publish is snapshotted and
180
+ the hashes match again. Set it in the same commit as the runtime change and leave it at that
181
+ value; set it back to `"none"` whenever you like.
182
+ - The published level is the **highest** of: the catalog diff (only when the generated output
183
+ changed), the runtime level (`max(marker, patch)` when the runtime changed), and `patch` when the
184
+ shipped docs changed. A `major` catalog diff therefore outranks a `minor` marker, and vice versa.
185
+ - A legacy snapshot with no `runtimeHash` publishes **one seeding PATCH** (when a runtime is
186
+ present) to record the hash, after which detection is fully hash-based — the same two-mode shape
187
+ as `docsHash`.
188
+
140
189
  ### Snapshot shape
141
190
 
142
- `out/new-snapshot.json` is now a wrapper, `{ catalog, docsHash }`, rather than a bare catalog —
191
+ `out/new-snapshot.json` is now a wrapper, `{ catalog, docsHash, runtimeHash }`, rather than a bare
192
+ catalog —
143
193
  `docsHash` is the content hash of the **shipped** guide (the `docs/*.md` + `docs/recipes` files,
144
194
  matching the `files` globs; internal `docs/superpowers/` is excluded), added so a docs-only change
145
- (no catalog diff) still triggers a PATCH publish. The file remains an **opaque blob** to Cloud
195
+ (no catalog diff) still triggers a PATCH publish; `runtimeHash` covers `src/runtime` + `src/react`
196
+ (see "Runtime changes" above). The file remains an **opaque blob** to Cloud
146
197
  Build: store it in GCS exactly as written and pass it back verbatim as `--baseline` on the next
147
198
  run. Older, bare-catalog baselines from before this change are still accepted: because such a
148
199
  baseline predates in-package docs, the first run against it publishes a **one-time migration