@civitai/blocks-react 0.43.0 → 0.43.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
|
@@ -216,6 +216,15 @@ const body: WorkflowBody = {
|
|
|
216
216
|
modelVersionId,
|
|
217
217
|
params: { prompt: userPrompt },
|
|
218
218
|
};
|
|
219
|
+
// The viewer-facing copy is a string YOUR APP owns, chosen by `err.code`.
|
|
220
|
+
// Nothing on the error may be rendered: `err.message` is developer-facing and
|
|
221
|
+
// its wording is not a contract; `err.snapshot.error` is server-authored and
|
|
222
|
+
// unsanitised.
|
|
223
|
+
const estimateFailureMessage = (err: WorkflowEstimateError) =>
|
|
224
|
+
err.code === 'no-cost'
|
|
225
|
+
? 'We could not get a price for this configuration. Try adjusting it.'
|
|
226
|
+
: 'Pricing is unavailable right now. Please try again shortly.';
|
|
227
|
+
|
|
219
228
|
// 🔴 estimate() REJECTS when the reply carries no usable price. ALWAYS catch it.
|
|
220
229
|
let priced = false;
|
|
221
230
|
try {
|
|
@@ -223,12 +232,9 @@ try {
|
|
|
223
232
|
priced = true;
|
|
224
233
|
} catch (err) {
|
|
225
234
|
if (!(err instanceof WorkflowEstimateError)) throw err;
|
|
226
|
-
// status is now 'error'.
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
// err.message is a generic summary safe to print.
|
|
230
|
-
logForDebugging(err.snapshot.error);
|
|
231
|
-
showError('This configuration cannot be priced right now.');
|
|
235
|
+
// status is now 'error'. Log both for the developer; render neither.
|
|
236
|
+
logForDebugging(err.message, err.snapshot.error);
|
|
237
|
+
showError(estimateFailureMessage(err));
|
|
232
238
|
}
|
|
233
239
|
if (priced) {
|
|
234
240
|
const snap = await submit(body); // status 'submitting' → 'polling'; returns a workflowId
|
|
@@ -263,16 +269,23 @@ if (priced) {
|
|
|
263
269
|
`catch`, a reviewer's first click becomes an unhandled rejection.
|
|
264
270
|
To exercise your `catch` locally, set the mock host's
|
|
265
271
|
`generation.failEstimate: 'failed' | 'no-cost'`.
|
|
266
|
-
- **
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
`err.
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
`err.
|
|
272
|
+
- **Three fields, three audiences — and none of them is viewer-facing copy.**
|
|
273
|
+
The string a viewer sees is one **your app owns**; nothing on this error may
|
|
274
|
+
be rendered as-is.
|
|
275
|
+
- `err.code` (`'failed' | 'no-cost'`) — **the branch target**, and the only
|
|
276
|
+
stable one. Switch on it to pick your own localised message.
|
|
277
|
+
- `err.snapshot.error` — **the diagnostic read**, and recovering it is the
|
|
278
|
+
whole point of the fix. **Server-authored and unsanitised** (raw upstream
|
|
279
|
+
text, including database constraint names, can reach it): log it or show it
|
|
280
|
+
in a developer-facing surface, and **never render it verbatim into markup**.
|
|
281
|
+
- `err.message` — **developer-facing**. A generic constant naming only the code
|
|
282
|
+
(`estimate did not return a usable price (no-cost) — reason on .snapshot.error`),
|
|
283
|
+
because `message` is what an uncaught rejection prints and what an error
|
|
284
|
+
reporter ships by default. Safe to log and to let a stack trace print;
|
|
285
|
+
**not intended for display to viewers** — it names an internal field path,
|
|
286
|
+
it is not localised, and **its exact wording is not a contract**, so a UI
|
|
287
|
+
built on it silently rots. Two apps migrating to `0.43.0` piped it into
|
|
288
|
+
rendered UI and would have shipped that sentence to end users.
|
|
276
289
|
- A cost of **`0` is a real price**, not a missing one (the orchestrator whatif
|
|
277
290
|
prices a cache hit at 0). `estimate` resolves it; only a non-numeric
|
|
278
291
|
`cost.total` rejects.
|
|
@@ -111,18 +111,32 @@ export interface WatchWorkflowOptions {
|
|
|
111
111
|
* reproduces the bug one layer down: a caller who logs `message` expecting the
|
|
112
112
|
* server's words gets a constant and is exactly as stuck as before.
|
|
113
113
|
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
114
|
+
* 🔴 THREE FIELDS, THREE AUDIENCES — AND **NONE OF THEM IS VIEWER-FACING COPY**.
|
|
115
|
+
* The viewer-facing string is one the APP owns; this error carries nothing you
|
|
116
|
+
* may render as-is. Two apps migrating to `0.43.0` each had a `catch` that piped
|
|
117
|
+
* `err.message` straight into rendered UI, and each would have shipped
|
|
118
|
+
* `estimate did not return a usable price (failed) — reason on .snapshot.error`
|
|
119
|
+
* to end users; both were caught only by a test asserting that exact string.
|
|
120
|
+
*
|
|
121
|
+
* - {@link WorkflowEstimateError.snapshot}`.error` — **the DIAGNOSTIC read.**
|
|
122
|
+
* The server's own words, verbatim. **Server-authored and UNSANITISED**:
|
|
123
|
+
* civitai's `errorHandling.ts` documents that raw upstream text —
|
|
124
|
+
* Prisma/`pg` column and constraint names among it — can reach this field.
|
|
125
|
+
* Log it, or show it in a developer-facing error surface. **NEVER render it
|
|
126
|
+
* verbatim into markup**, and think before shipping it to a third-party
|
|
127
|
+
* error tracker.
|
|
128
|
+
* - {@link WorkflowEstimateError.message} — **DEVELOPER-FACING.** A CONSTANT
|
|
129
|
+
* template with only `code` interpolated. It contains no server text and
|
|
130
|
+
* nothing to sanitise, so it is safe to LOG and safe to let a stack trace
|
|
131
|
+
* print — that is deliberate, because `message` is what an uncaught
|
|
122
132
|
* rejection prints and what a third-party block's error reporter ships
|
|
123
133
|
* upstream by default, and this is a package consumed by third-party code.
|
|
124
|
-
*
|
|
125
|
-
*
|
|
134
|
+
* **It is NOT intended for display to viewers**: it names an internal field
|
|
135
|
+
* path, it is not localised, and **its exact wording is NOT a contract** —
|
|
136
|
+
* it can change in any release, so a UI built on it silently rots.
|
|
137
|
+
* - {@link WorkflowEstimateError.code} — **the BRANCH TARGET**, and the only
|
|
138
|
+
* stable one. Switch on it to pick a viewer-facing string YOUR APP owns
|
|
139
|
+
* (see the mapper in the `@example` on {@link useBuzzWorkflow}).
|
|
126
140
|
*
|
|
127
141
|
* 🔴 DO NOT "SIMPLIFY" THIS BY PUTTING `snapshot.error` BACK ON `message`. The
|
|
128
142
|
* two fields are split on purpose and the split is what keeps database internals
|
|
@@ -149,8 +163,12 @@ export declare class WorkflowEstimateError extends Error {
|
|
|
149
163
|
* WHICH PRODUCER this was, structurally — so a caller branches on an enum
|
|
150
164
|
* rather than on prose. It is the ONLY stable branch target here:
|
|
151
165
|
* `snapshot.error` is server-authored and can change without notice, and
|
|
152
|
-
* {@link WorkflowEstimateError.message} is a generic summary
|
|
153
|
-
* wording is not a contract either.
|
|
166
|
+
* {@link WorkflowEstimateError.message} is a generic developer-facing summary
|
|
167
|
+
* whose exact wording is not a contract either.
|
|
168
|
+
*
|
|
169
|
+
* 🔴 THIS IS WHAT A VIEWER-FACING MESSAGE MUST BE DERIVED FROM. Branch on
|
|
170
|
+
* `code` and return a string your app owns and localises; never render
|
|
171
|
+
* `message` or `snapshot.error` to a viewer.
|
|
154
172
|
*
|
|
155
173
|
* - `'failed'` — the reply's `status` is `'failed'`. USUALLY that means
|
|
156
174
|
* `blocks.estimateWorkflow` threw server-side and the host posted its
|
|
@@ -175,8 +193,8 @@ export declare class WorkflowEstimateError extends Error {
|
|
|
175
193
|
* will not price — the whole point of civitai/civitai#4159), but civitai's
|
|
176
194
|
* `errorHandling.ts` documents that raw upstream text — Prisma/`pg` column and
|
|
177
195
|
* constraint names among it — can reach that field. Log it, show it in a
|
|
178
|
-
* developer-facing error surface,
|
|
179
|
-
* ship it to a third-party error tracker without thinking about it.
|
|
196
|
+
* developer-facing error surface, **NEVER render it verbatim into markup**,
|
|
197
|
+
* and do not ship it to a third-party error tracker without thinking about it.
|
|
180
198
|
*/
|
|
181
199
|
readonly snapshot: BlockWorkflowSnapshot;
|
|
182
200
|
constructor(snapshot: BlockWorkflowSnapshot, code: 'failed' | 'no-cost');
|
|
@@ -310,18 +328,24 @@ interface UseBuzzWorkflowReturn {
|
|
|
310
328
|
* modelVersionId,
|
|
311
329
|
* params: { prompt: 'a cat' },
|
|
312
330
|
* };
|
|
331
|
+
* // A viewer-facing string YOUR APP owns, chosen by `code`. Neither
|
|
332
|
+
* // `err.message` (developer-facing, wording not a contract) nor
|
|
333
|
+
* // `err.snapshot.error` (server-authored, unsanitised) may be rendered.
|
|
334
|
+
* const estimateFailureMessage = (err: WorkflowEstimateError) =>
|
|
335
|
+
* err.code === 'no-cost'
|
|
336
|
+
* ? 'We could not get a price for this configuration. Try adjusting it.'
|
|
337
|
+
* : 'Pricing is unavailable right now. Please try again shortly.';
|
|
338
|
+
*
|
|
313
339
|
* // 🔴 estimate() REJECTS when the reply carries no usable price — an errored
|
|
314
340
|
* // estimate, or one that came back with no numeric cost. ALWAYS catch it.
|
|
315
341
|
* try {
|
|
316
342
|
* await estimate(body); // status 'estimating' → 'confirming' (cost in result.cost.total)
|
|
317
343
|
* } catch (err) {
|
|
318
344
|
* // status is now 'error'; `result` holds the unusable snapshot, never a
|
|
319
|
-
* // STALE priced one.
|
|
320
|
-
* // reason is on err.snapshot.error (unsanitised — log it, don't render it as
|
|
321
|
-
* // trusted copy). See WorkflowEstimateError.
|
|
345
|
+
* // STALE priced one. See WorkflowEstimateError for the three-audience split.
|
|
322
346
|
* if (!(err instanceof WorkflowEstimateError)) throw err;
|
|
323
|
-
* logForDebugging(err.snapshot.error);
|
|
324
|
-
* showError(
|
|
347
|
+
* logForDebugging(err.message, err.snapshot.error); // developer-facing: LOG only
|
|
348
|
+
* showError(estimateFailureMessage(err)); // viewer-facing: app-owned
|
|
325
349
|
* }
|
|
326
350
|
* const snap = await submit(body); // status 'submitting' → 'polling'; returns a workflowId
|
|
327
351
|
* const done = await watch(snap.workflowId, { onUpdate: render }); // → terminal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBuzzWorkflow.d.ts","sourceRoot":"","sources":["../../src/hooks/useBuzzWorkflow.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,yBAAyB,C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H,wBAAgB,eAAe,IAAI,qBAAqB,CAkPvD"}
|
|
@@ -112,18 +112,32 @@ function sleep(ms, signal) {
|
|
|
112
112
|
* reproduces the bug one layer down: a caller who logs `message` expecting the
|
|
113
113
|
* server's words gets a constant and is exactly as stuck as before.
|
|
114
114
|
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
115
|
+
* 🔴 THREE FIELDS, THREE AUDIENCES — AND **NONE OF THEM IS VIEWER-FACING COPY**.
|
|
116
|
+
* The viewer-facing string is one the APP owns; this error carries nothing you
|
|
117
|
+
* may render as-is. Two apps migrating to `0.43.0` each had a `catch` that piped
|
|
118
|
+
* `err.message` straight into rendered UI, and each would have shipped
|
|
119
|
+
* `estimate did not return a usable price (failed) — reason on .snapshot.error`
|
|
120
|
+
* to end users; both were caught only by a test asserting that exact string.
|
|
121
|
+
*
|
|
122
|
+
* - {@link WorkflowEstimateError.snapshot}`.error` — **the DIAGNOSTIC read.**
|
|
123
|
+
* The server's own words, verbatim. **Server-authored and UNSANITISED**:
|
|
124
|
+
* civitai's `errorHandling.ts` documents that raw upstream text —
|
|
125
|
+
* Prisma/`pg` column and constraint names among it — can reach this field.
|
|
126
|
+
* Log it, or show it in a developer-facing error surface. **NEVER render it
|
|
127
|
+
* verbatim into markup**, and think before shipping it to a third-party
|
|
128
|
+
* error tracker.
|
|
129
|
+
* - {@link WorkflowEstimateError.message} — **DEVELOPER-FACING.** A CONSTANT
|
|
130
|
+
* template with only `code` interpolated. It contains no server text and
|
|
131
|
+
* nothing to sanitise, so it is safe to LOG and safe to let a stack trace
|
|
132
|
+
* print — that is deliberate, because `message` is what an uncaught
|
|
123
133
|
* rejection prints and what a third-party block's error reporter ships
|
|
124
134
|
* upstream by default, and this is a package consumed by third-party code.
|
|
125
|
-
*
|
|
126
|
-
*
|
|
135
|
+
* **It is NOT intended for display to viewers**: it names an internal field
|
|
136
|
+
* path, it is not localised, and **its exact wording is NOT a contract** —
|
|
137
|
+
* it can change in any release, so a UI built on it silently rots.
|
|
138
|
+
* - {@link WorkflowEstimateError.code} — **the BRANCH TARGET**, and the only
|
|
139
|
+
* stable one. Switch on it to pick a viewer-facing string YOUR APP owns
|
|
140
|
+
* (see the mapper in the `@example` on {@link useBuzzWorkflow}).
|
|
127
141
|
*
|
|
128
142
|
* 🔴 DO NOT "SIMPLIFY" THIS BY PUTTING `snapshot.error` BACK ON `message`. The
|
|
129
143
|
* two fields are split on purpose and the split is what keeps database internals
|
|
@@ -150,8 +164,12 @@ export class WorkflowEstimateError extends Error {
|
|
|
150
164
|
* WHICH PRODUCER this was, structurally — so a caller branches on an enum
|
|
151
165
|
* rather than on prose. It is the ONLY stable branch target here:
|
|
152
166
|
* `snapshot.error` is server-authored and can change without notice, and
|
|
153
|
-
* {@link WorkflowEstimateError.message} is a generic summary
|
|
154
|
-
* wording is not a contract either.
|
|
167
|
+
* {@link WorkflowEstimateError.message} is a generic developer-facing summary
|
|
168
|
+
* whose exact wording is not a contract either.
|
|
169
|
+
*
|
|
170
|
+
* 🔴 THIS IS WHAT A VIEWER-FACING MESSAGE MUST BE DERIVED FROM. Branch on
|
|
171
|
+
* `code` and return a string your app owns and localises; never render
|
|
172
|
+
* `message` or `snapshot.error` to a viewer.
|
|
155
173
|
*
|
|
156
174
|
* - `'failed'` — the reply's `status` is `'failed'`. USUALLY that means
|
|
157
175
|
* `blocks.estimateWorkflow` threw server-side and the host posted its
|
|
@@ -176,8 +194,8 @@ export class WorkflowEstimateError extends Error {
|
|
|
176
194
|
* will not price — the whole point of civitai/civitai#4159), but civitai's
|
|
177
195
|
* `errorHandling.ts` documents that raw upstream text — Prisma/`pg` column and
|
|
178
196
|
* constraint names among it — can reach that field. Log it, show it in a
|
|
179
|
-
* developer-facing error surface,
|
|
180
|
-
* ship it to a third-party error tracker without thinking about it.
|
|
197
|
+
* developer-facing error surface, **NEVER render it verbatim into markup**,
|
|
198
|
+
* and do not ship it to a third-party error tracker without thinking about it.
|
|
181
199
|
*/
|
|
182
200
|
snapshot;
|
|
183
201
|
constructor(snapshot, code) {
|
|
@@ -190,6 +208,11 @@ export class WorkflowEstimateError extends Error {
|
|
|
190
208
|
// wire), so routing the raw text to `.snapshot.error` alone costs a
|
|
191
209
|
// deliberate debugger nothing and changes only the DISPOSITION. `code` is
|
|
192
210
|
// carried IN the message so an uncaught rejection is still self-describing.
|
|
211
|
+
//
|
|
212
|
+
// 🔴 IT IS DEVELOPER-FACING, NOT VIEWER-FACING — it names an internal field
|
|
213
|
+
// path and is not localised, so it must not reach rendered UI. Its exact
|
|
214
|
+
// wording is NOT a contract: it may change in any release. A viewer-facing
|
|
215
|
+
// string is derived from `code` by the app (see the class docs).
|
|
193
216
|
super(`estimate did not return a usable price (${code}) — reason on .snapshot.error`);
|
|
194
217
|
this.name = 'WorkflowEstimateError';
|
|
195
218
|
this.code = code;
|
|
@@ -246,18 +269,24 @@ export class WorkflowEstimateError extends Error {
|
|
|
246
269
|
* modelVersionId,
|
|
247
270
|
* params: { prompt: 'a cat' },
|
|
248
271
|
* };
|
|
272
|
+
* // A viewer-facing string YOUR APP owns, chosen by `code`. Neither
|
|
273
|
+
* // `err.message` (developer-facing, wording not a contract) nor
|
|
274
|
+
* // `err.snapshot.error` (server-authored, unsanitised) may be rendered.
|
|
275
|
+
* const estimateFailureMessage = (err: WorkflowEstimateError) =>
|
|
276
|
+
* err.code === 'no-cost'
|
|
277
|
+
* ? 'We could not get a price for this configuration. Try adjusting it.'
|
|
278
|
+
* : 'Pricing is unavailable right now. Please try again shortly.';
|
|
279
|
+
*
|
|
249
280
|
* // 🔴 estimate() REJECTS when the reply carries no usable price — an errored
|
|
250
281
|
* // estimate, or one that came back with no numeric cost. ALWAYS catch it.
|
|
251
282
|
* try {
|
|
252
283
|
* await estimate(body); // status 'estimating' → 'confirming' (cost in result.cost.total)
|
|
253
284
|
* } catch (err) {
|
|
254
285
|
* // status is now 'error'; `result` holds the unusable snapshot, never a
|
|
255
|
-
* // STALE priced one.
|
|
256
|
-
* // reason is on err.snapshot.error (unsanitised — log it, don't render it as
|
|
257
|
-
* // trusted copy). See WorkflowEstimateError.
|
|
286
|
+
* // STALE priced one. See WorkflowEstimateError for the three-audience split.
|
|
258
287
|
* if (!(err instanceof WorkflowEstimateError)) throw err;
|
|
259
|
-
* logForDebugging(err.snapshot.error);
|
|
260
|
-
* showError(
|
|
288
|
+
* logForDebugging(err.message, err.snapshot.error); // developer-facing: LOG only
|
|
289
|
+
* showError(estimateFailureMessage(err)); // viewer-facing: app-owned
|
|
261
290
|
* }
|
|
262
291
|
* const snap = await submit(body); // status 'submitting' → 'polling'; returns a workflowId
|
|
263
292
|
* const done = await watch(snap.workflowId, { onUpdate: render }); // → terminal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBuzzWorkflow.js","sourceRoot":"","sources":["../../src/hooks/useBuzzWorkflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAI9C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEpF;;;;GAIG;AACH,MAAM,iBAAiB,GAAiD,IAAI,GAAG,CAAC;IAC9E,WAAW;IACX,QAAQ;IACR,UAAU;IACV,SAAS;CACV,CAAC,CAAC;AAEH;;;;;;;;;;GAUG;AACH,MAAM,2BAA2B,GAAG,OAAO,CAAC;AAE5C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAE7C,qFAAqF;AACrF,MAAM,yBAAyB,GAAG,KAAK,CAAC;AAExC,6EAA6E;AAC7E,MAAM,wBAAwB,GAAG,EAAE,GAAG,MAAM,CAAC;AAE7C,gFAAgF;AAChF,MAAM,yBAAyB,GAA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