@colixsystems/widget-sdk 0.291.0 → 0.292.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/README.md +6 -2
- package/dist/contract.cjs +10 -1
- package/dist/contract.js +10 -1
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/contract.js +10 -1
package/README.md
CHANGED
|
@@ -90,7 +90,11 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
|
|
|
90
90
|
|
|
91
91
|
## Status
|
|
92
92
|
|
|
93
|
-
`v0.
|
|
93
|
+
`v0.292.0` — pre-publish. The package surface (types, function names, export paths) is the v1 contract; runtime behaviour for some hooks is stubbed (each hook documents what's wired and what isn't). It is **not yet published to npm**.
|
|
94
|
+
|
|
95
|
+
### What's new in 0.292.0 (contract 1.239.0)
|
|
96
|
+
|
|
97
|
+
**An Action a widget runs must be done 250 ms after the press.** The time counts from when the press reaches the server, so waiting for a free sandbox and setting the run up spend from it too. A run started by `useAction()` (or a Button's Run action) that is still going then is stopped, and `run()` rejects with `ACTION_TIMEOUT` (504). Its outcome is unknown: open requests and connector calls are cut and no new work starts, but a write that had already finished stays, and a notification already sent can't be recalled. So an Action the app waits on must do its writes as one call (a bulk write) or be safe to repeat, and never tell the user it did nothing. Move slow or multi-step work to an Action triggered by a record the widget writes. Scheduled, record-triggered and Run now runs keep their own limits.
|
|
94
98
|
|
|
95
99
|
### What's new in 0.291.0 (contract 1.238.0)
|
|
96
100
|
|
|
@@ -299,7 +303,7 @@ const { available, run, running, result, error } = useAction(props.actionId);
|
|
|
299
303
|
|
|
300
304
|
**Bind it with an `actionRef` property.** Declare `{ type: "actionRef" }` in your `propertySchema` and the Studio renders an Action picker that warns when the chosen Action lacks the app trigger. The value is a bare Action id, so Copy Workspace remaps it like `pageRef`.
|
|
301
305
|
|
|
302
|
-
When nothing is bound, or the host brokers no actions client, `available` is `false` and `run()` rejects `UNAVAILABLE`: render a visible "pick an action" state, never a blank box. A changed binding clears `result` and `error`, and a run that settles after the binding changed or the widget unmounted writes nothing. When runs overlap, `result` and `error` follow the newest one. Branch on `error.code`: `ACTION_NOT_APP_INVOKABLE` and `ACTION_NOT_FOUND` will not clear on a retry, `RATE_LIMITED` will, `INVALID_ACTION_INPUT` means the input was refused, `AUTH_REQUIRED`, `TOKEN_EXPIRED` and `TOKEN_INVALID` mean the app user must sign in,
|
|
306
|
+
When nothing is bound, or the host brokers no actions client, `available` is `false` and `run()` rejects `UNAVAILABLE`: render a visible "pick an action" state, never a blank box. A changed binding clears `result` and `error`, and a run that settles after the binding changed or the widget unmounted writes nothing. When runs overlap, `result` and `error` follow the newest one. Branch on `error.code`: `ACTION_NOT_APP_INVOKABLE` and `ACTION_NOT_FOUND` will not clear on a retry, `RATE_LIMITED` will, `INVALID_ACTION_INPUT` means the input was refused, `AUTH_REQUIRED`, `TOKEN_EXPIRED` and `TOKEN_INVALID` mean the app user must sign in, `ACTION_FAILED` means the Action ran and failed, and `ACTION_TIMEOUT` means it was still running 250 ms after the press and was stopped, so its outcome is unknown: some of its writes may have happened. Never show an app user the raw message. A text answer from a bot is often markdown, so render it with `<RichText>`.
|
|
303
307
|
|
|
304
308
|
The linter rejects `useAction()` unless your manifest declares `actions.run:*` in `requestedScopes`.
|
|
305
309
|
|
package/dist/contract.cjs
CHANGED
|
@@ -2285,6 +2285,12 @@ const HOOKS = [
|
|
|
2285
2285
|
"INVALID_ACTION_INPUT (400) — the input was refused; " +
|
|
2286
2286
|
"ACTION_NOT_APP_INVOKABLE (403) and ACTION_NOT_FOUND (404) will NOT " +
|
|
2287
2287
|
"clear on a retry, so hide the affordance; RATE_LIMITED (429) will; " +
|
|
2288
|
+
"ACTION_TIMEOUT (504) — the run was still going 250 ms after the press " +
|
|
2289
|
+
"and was stopped, so its OUTCOME IS UNKNOWN: some of its writes may " +
|
|
2290
|
+
"have happened. Never retry it blindly and never tell the user it did " +
|
|
2291
|
+
"nothing; an Action a widget runs must do its writes as one call or be " +
|
|
2292
|
+
"safe to repeat, and slow or multi-step work belongs in a " +
|
|
2293
|
+
"record-triggered Action; " +
|
|
2288
2294
|
"ACTION_FAILED — the Action ran and failed, or no answer arrived. NEVER " +
|
|
2289
2295
|
"show an app user a raw error. A text answer from a bot is often " +
|
|
2290
2296
|
"MARKDOWN, so render it with <RichText value={result} />, not <Text>. " +
|
|
@@ -6805,7 +6811,10 @@ const CONTRACT = deepFreeze({
|
|
|
6805
6811
|
// 1.238.0: additive (sc-15659) — `useConnector(connectorRef)` + the
|
|
6806
6812
|
// `connectors` host client + the `connectorRef` propertySchema type + the
|
|
6807
6813
|
// `connectors.call:*` scope. A widget calls a REST connector's listed operations.
|
|
6808
|
-
|
|
6814
|
+
// 1.239.0: additive (sc-15658) — an app-triggered run must finish within 250 ms
|
|
6815
|
+
// of the press; `useAction` errors carry the new code ACTION_TIMEOUT
|
|
6816
|
+
// (504), whose outcome is unknown.
|
|
6817
|
+
version: "1.239.0",
|
|
6809
6818
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
6810
6819
|
hooks: HOOKS,
|
|
6811
6820
|
primitives: PRIMITIVES,
|
package/dist/contract.js
CHANGED
|
@@ -2281,6 +2281,12 @@ const HOOKS = [
|
|
|
2281
2281
|
"INVALID_ACTION_INPUT (400) — the input was refused; " +
|
|
2282
2282
|
"ACTION_NOT_APP_INVOKABLE (403) and ACTION_NOT_FOUND (404) will NOT " +
|
|
2283
2283
|
"clear on a retry, so hide the affordance; RATE_LIMITED (429) will; " +
|
|
2284
|
+
"ACTION_TIMEOUT (504) — the run was still going 250 ms after the press " +
|
|
2285
|
+
"and was stopped, so its OUTCOME IS UNKNOWN: some of its writes may " +
|
|
2286
|
+
"have happened. Never retry it blindly and never tell the user it did " +
|
|
2287
|
+
"nothing; an Action a widget runs must do its writes as one call or be " +
|
|
2288
|
+
"safe to repeat, and slow or multi-step work belongs in a " +
|
|
2289
|
+
"record-triggered Action; " +
|
|
2284
2290
|
"ACTION_FAILED — the Action ran and failed, or no answer arrived. NEVER " +
|
|
2285
2291
|
"show an app user a raw error. A text answer from a bot is often " +
|
|
2286
2292
|
"MARKDOWN, so render it with <RichText value={result} />, not <Text>. " +
|
|
@@ -6801,7 +6807,10 @@ const CONTRACT = deepFreeze({
|
|
|
6801
6807
|
// 1.238.0: additive (sc-15659) — `useConnector(connectorRef)` + the
|
|
6802
6808
|
// `connectors` host client + the `connectorRef` propertySchema type + the
|
|
6803
6809
|
// `connectors.call:*` scope. A widget calls a REST connector's listed operations.
|
|
6804
|
-
|
|
6810
|
+
// 1.239.0: additive (sc-15658) — an app-triggered run must finish within 250 ms
|
|
6811
|
+
// of the press; `useAction` errors carry the new code ACTION_TIMEOUT
|
|
6812
|
+
// (504), whose outcome is unknown.
|
|
6813
|
+
version: "1.239.0",
|
|
6805
6814
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
6806
6815
|
hooks: HOOKS,
|
|
6807
6816
|
primitives: PRIMITIVES,
|
package/dist/index.d.ts
CHANGED
|
@@ -3513,6 +3513,7 @@ export class ActionError extends Error {
|
|
|
3513
3513
|
| "AUTH_REQUIRED"
|
|
3514
3514
|
| "TOKEN_EXPIRED"
|
|
3515
3515
|
| "TOKEN_INVALID"
|
|
3516
|
+
| "ACTION_TIMEOUT"
|
|
3516
3517
|
| "ACTION_FAILED"
|
|
3517
3518
|
| (string & {});
|
|
3518
3519
|
constructor(code: string, message: string, opts?: { cause?: unknown });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colixsystems/widget-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.292.0",
|
|
4
4
|
"description": "Common widget interface for AppStudio. Implements WidgetManifest, WidgetContext, property schema, and helper hooks.",
|
|
5
5
|
"homepage": "https://github.com/Colix-AB/AppStudio",
|
|
6
6
|
"type": "module",
|
package/src/contract.js
CHANGED
|
@@ -2281,6 +2281,12 @@ const HOOKS = [
|
|
|
2281
2281
|
"INVALID_ACTION_INPUT (400) — the input was refused; " +
|
|
2282
2282
|
"ACTION_NOT_APP_INVOKABLE (403) and ACTION_NOT_FOUND (404) will NOT " +
|
|
2283
2283
|
"clear on a retry, so hide the affordance; RATE_LIMITED (429) will; " +
|
|
2284
|
+
"ACTION_TIMEOUT (504) — the run was still going 250 ms after the press " +
|
|
2285
|
+
"and was stopped, so its OUTCOME IS UNKNOWN: some of its writes may " +
|
|
2286
|
+
"have happened. Never retry it blindly and never tell the user it did " +
|
|
2287
|
+
"nothing; an Action a widget runs must do its writes as one call or be " +
|
|
2288
|
+
"safe to repeat, and slow or multi-step work belongs in a " +
|
|
2289
|
+
"record-triggered Action; " +
|
|
2284
2290
|
"ACTION_FAILED — the Action ran and failed, or no answer arrived. NEVER " +
|
|
2285
2291
|
"show an app user a raw error. A text answer from a bot is often " +
|
|
2286
2292
|
"MARKDOWN, so render it with <RichText value={result} />, not <Text>. " +
|
|
@@ -6801,7 +6807,10 @@ const CONTRACT = deepFreeze({
|
|
|
6801
6807
|
// 1.238.0: additive (sc-15659) — `useConnector(connectorRef)` + the
|
|
6802
6808
|
// `connectors` host client + the `connectorRef` propertySchema type + the
|
|
6803
6809
|
// `connectors.call:*` scope. A widget calls a REST connector's listed operations.
|
|
6804
|
-
|
|
6810
|
+
// 1.239.0: additive (sc-15658) — an app-triggered run must finish within 250 ms
|
|
6811
|
+
// of the press; `useAction` errors carry the new code ACTION_TIMEOUT
|
|
6812
|
+
// (504), whose outcome is unknown.
|
|
6813
|
+
version: "1.239.0",
|
|
6805
6814
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
6806
6815
|
hooks: HOOKS,
|
|
6807
6816
|
primitives: PRIMITIVES,
|