@colixsystems/widget-sdk 0.89.0 → 0.90.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 +39 -3
- package/dist/contract.js +39 -3
- package/dist/index.d.ts +11 -6
- package/dist/linter.cjs +6 -5
- package/dist/linter.js +6 -5
- package/dist/manifest.cjs +6 -5
- package/dist/manifest.js +6 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
|
|
|
61
61
|
|
|
62
62
|
## Status
|
|
63
63
|
|
|
64
|
-
`v0.
|
|
64
|
+
`v0.90.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**.
|
|
65
65
|
|
|
66
66
|
### What's new in 0.89.0 (contract unchanged)
|
|
67
67
|
|
|
@@ -172,6 +172,10 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
|
|
|
172
172
|
- **The colour maths ignores alpha, on purpose.** `hexChannels` reads the R/G/B pair and skips any alpha, so contrast, readable text and the derived accent tints reason about the opaque colour. None of them can composite without knowing the backdrop, which a token table does not have — so transparency lives in the VALUE your widget renders, not in the decision about whether that colour reads as light or dark.
|
|
173
173
|
- **`CONTRACT.version` → `1.61.0`** (additive: `themeTokens.spacingScale` + `widgetStyles` and their bounds, `themeComponents.card.universalFields`, and the `normaliseWidgetStyles` / `deriveSurfaceTokens` host exports). No author-facing export changed signature, and a theme that sets none of it resolves exactly as before.
|
|
174
174
|
|
|
175
|
+
### What's new in 0.90.0 (contract 1.63.0)
|
|
176
|
+
|
|
177
|
+
**A manifest action declares `triggerTypes` — a set — and the script learns which one fired (sc-4915).** An action could carry exactly one trigger, so a widget that needed the same work done on create *and* on delete had to ship the script twice: two `actions` entries, two operator bindings, two run histories, and the usual drift between the copies. `triggerTypes` replaces `triggerType`: a non-empty array of unique values from `schedule`, `record_created`, `record_updated`, `record_deleted`, freely combined (`scheduleCron` is required iff the array contains `schedule`). The pre-0.90.0 scalar `triggerType` is still read and normalised into the array, so a widget already published against it keeps validating and nothing needs republishing. What makes the combination useful is the other half: the script's `triggerType` global now names the trigger that **actually fired this run** — including `"manual"` (an operator's Run now) and `"app"` (a button press) — instead of echoing the row's configuration, so one script can branch on whether its record was created or deleted. `CONTRACT.version` → `1.63.0`. Additive for every existing manifest.
|
|
178
|
+
|
|
175
179
|
### What's new in 0.85.1 (contract 1.60.1)
|
|
176
180
|
|
|
177
181
|
**`useWidgetEvent(name)` returns the emitter FUNCTION — the declared contract said otherwise (sc-4753).** `CONTRACT.hooks`'s entry for the hook declared `returnShape: { emit }`, so every surface derived from it — chiefly the Widget Builder Agent's hooks table — told authors the hook resolves to an object. It never did: `useWidgetEvent("slotChosen")` hands back the callable you invoke directly (`emitSlot({ courtId })`), exactly as the typings and the Developer guide have always documented. A widget written against the declared shape destructured a function, got `undefined`, and threw the moment a user interacted — a cross-widget wire that rendered perfectly and only failed on click. The declaration is now a bare callable and the publish-time render harness models the same shape, so a wrong destructure is caught instead of waved through. `CONTRACT.version` → `1.60.1`. Documentation-only correction: no export, signature, or runtime behaviour changed — a widget already calling the result is unaffected.
|
|
@@ -619,7 +623,7 @@ Two additive features land in this version.
|
|
|
619
623
|
|
|
620
624
|
**A widget may declare server-side actions in its manifest.**
|
|
621
625
|
|
|
622
|
-
- **`WidgetManifest.actions` is now part of the public contract.** An optional array; each entry is `{ key, name, description?,
|
|
626
|
+
- **`WidgetManifest.actions` is now part of the public contract.** An optional array; each entry is `{ key, name, description?, triggerTypes, scheduleCron?, timeoutMs?, scriptSource }`. `triggerTypes` is a non-empty array of unique values from `schedule`, `record_created`, `record_updated`, `record_deleted` — combine them so one script serves several events; `scheduleCron` is required when it contains `schedule`. The `scriptSource` (≤ 200 KiB) runs in the **shared isolated-vm action runner** — against `datastore` / `fetch` / `connectors` / `console` / `record` / `tenantId` (the runner surface, **not** the React/SDK widget surface, so SDK imports and hooks are unavailable there and the component linter does not scan it). `connectors.call(slug, { method, path, query, body, headers })` resolves a tenant-configured REST connector by slug and returns `{ status, headers, body }` (auth + SSRF handled by the platform; an unknown slug / SSRF / timeout throws a catchable Error). Actions never run in the rendered app, so they have **no effect on Player ↔ export parity**.
|
|
623
627
|
- **Operators enable actions per tenant** from the Properties Panel. An enabled action materialises a tenant `Action` row **DISABLED** until the operator binds an integration API key (and, for `record_*` triggers, a target table) in the Actions admin page — those bindings are tenant-local, so `triggerTableId` / `apiKeyId` must **not** appear in the manifest (the validator and linter reject them).
|
|
624
628
|
- **New contract fields** `CONTRACT.actionTriggerTypes`, `CONTRACT.actionScriptGlobals`, `CONTRACT.actionScriptMaxBytes` expose the grammar so the Developer page, the AI agent prompt, and `validateManifest` derive it from one source. `validateManifest` now structurally validates `actions`; the marketplace linter rejects malformed / oversized declarations.
|
|
625
629
|
- **New manifest category `ADMINISTRATION`** for app-administration widgets such as User Management. Added to `CONTRACT.manifestCategories`, `validateManifest`, the `WidgetCategory` type, the marketplace category list, and the master-DB `WidgetCategory` enum.
|
package/dist/contract.cjs
CHANGED
|
@@ -1373,6 +1373,34 @@ const ACTION_SCRIPT_GLOBALS = [
|
|
|
1373
1373
|
// Mirrors action.service.js SCRIPT_MAX_BYTES.
|
|
1374
1374
|
const ACTION_SCRIPT_MAX_BYTES = 200 * 1024;
|
|
1375
1375
|
|
|
1376
|
+
/**
|
|
1377
|
+
* sc-4915 — the trigger set a manifest action declares, canonically ordered.
|
|
1378
|
+
*
|
|
1379
|
+
* `triggerTypes` is the current shape; the pre-sc-4915 scalar `triggerType` is
|
|
1380
|
+
* still read so a widget published before the change keeps validating. Returns
|
|
1381
|
+
* null when the declaration is empty, holds an unknown value, or repeats one —
|
|
1382
|
+
* every caller reports that as a manifest error. ONE reader, so the SDK
|
|
1383
|
+
* validator, the CLI linter and the backend cannot disagree about what a
|
|
1384
|
+
* manifest declared.
|
|
1385
|
+
*/
|
|
1386
|
+
function normaliseActionTriggerTypes(action) {
|
|
1387
|
+
const a = action !== null && typeof action === "object" ? action : {};
|
|
1388
|
+
const raw = Array.isArray(a.triggerTypes)
|
|
1389
|
+
? a.triggerTypes
|
|
1390
|
+
: a.triggerTypes === undefined && a.triggerType !== undefined
|
|
1391
|
+
? [a.triggerType]
|
|
1392
|
+
: null;
|
|
1393
|
+
if (raw === null || raw.length === 0) return null;
|
|
1394
|
+
const seen = new Set();
|
|
1395
|
+
for (const t of raw) {
|
|
1396
|
+
if (typeof t !== "string" || !ACTION_TRIGGER_TYPES.includes(t)) return null;
|
|
1397
|
+
if (seen.has(t)) return null;
|
|
1398
|
+
seen.add(t);
|
|
1399
|
+
}
|
|
1400
|
+
return ACTION_TRIGGER_TYPES.filter((t) => seen.has(t));
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
|
|
1376
1404
|
// Reverse-DNS-ish manifest id, e.g. "com.acme.charts.barchart". Two or
|
|
1377
1405
|
// more labels, lowercase alnum + hyphen, label starts with a letter. The
|
|
1378
1406
|
// analyzer + the SDK validator both read this from the contract so a
|
|
@@ -1501,9 +1529,9 @@ const MANIFEST_SCHEMA = {
|
|
|
1501
1529
|
type: "object[]",
|
|
1502
1530
|
required: false,
|
|
1503
1531
|
description:
|
|
1504
|
-
"Optional. Server-side actions the widget declares. Each runs in the shared isolated-vm action runner (cron- or record-triggered) — NEVER in the rendered app. Operators enable them per tenant from the Properties Panel; the action materialises DISABLED until they bind an integration API key (and, for record_* triggers, a target table) in the Actions admin page. Each entry: { key (stable, unique within the manifest), name, description?,
|
|
1532
|
+
"Optional. Server-side actions the widget declares. Each runs in the shared isolated-vm action runner (cron- or record-triggered) — NEVER in the rendered app. Operators enable them per tenant from the Properties Panel; the action materialises DISABLED until they bind an integration API key (and, for record_* triggers, a target table) in the Actions admin page. Each entry: { key (stable, unique within the manifest), name, description?, triggerTypes (a non-empty array of unique values from " +
|
|
1505
1533
|
ACTION_TRIGGER_TYPES.join(", ") +
|
|
1506
|
-
"), scheduleCron? (required iff
|
|
1534
|
+
"; combine them so one script serves several events — the script's `triggerType` global names the event that actually fired), scheduleCron? (required iff triggerTypes contains 'schedule'; node-cron syntax), timeoutMs? (100–300000), scriptSource (≤200 KiB; runs against " +
|
|
1507
1535
|
ACTION_SCRIPT_GLOBALS.join(", ") +
|
|
1508
1536
|
" — NOT the React surface, so SDK imports/hooks are unavailable) }. Do NOT include triggerTableId or apiKeyId — those are tenant-local and bound after install.",
|
|
1509
1537
|
default: [],
|
|
@@ -2787,7 +2815,14 @@ const CONTRACT = deepFreeze({
|
|
|
2787
2815
|
// Naming one widget is strictly more specific than restyling a scope, and
|
|
2788
2816
|
// the Properties Panel stays the final word. Additive throughout: a theme
|
|
2789
2817
|
// that sets none of it resolves exactly as before.
|
|
2790
|
-
|
|
2818
|
+
// 1.63.0: additive (sc-4915) — a manifest action declares `triggerTypes`, a
|
|
2819
|
+
// non-empty ARRAY, so one script can serve a create, an update and a
|
|
2820
|
+
// delete instead of being copied into three actions. The pre-sc-4915
|
|
2821
|
+
// scalar `triggerType` is still read and normalised, so an already
|
|
2822
|
+
// published widget keeps validating. The script's `triggerType` global
|
|
2823
|
+
// now names the trigger that actually FIRED the run ('manual' and 'app'
|
|
2824
|
+
// included), which is what makes a multi-trigger script able to branch.
|
|
2825
|
+
version: "1.63.0",
|
|
2791
2826
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
2792
2827
|
hooks: HOOKS,
|
|
2793
2828
|
primitives: PRIMITIVES,
|
|
@@ -3073,6 +3108,7 @@ module.exports = {
|
|
|
3073
3108
|
CONTRACT,
|
|
3074
3109
|
clampSpacingScale,
|
|
3075
3110
|
scaleSpacing,
|
|
3111
|
+
normaliseActionTriggerTypes,
|
|
3076
3112
|
isHookAllowed,
|
|
3077
3113
|
requiredContextKeys,
|
|
3078
3114
|
isHexColor,
|
package/dist/contract.js
CHANGED
|
@@ -1373,6 +1373,34 @@ const ACTION_SCRIPT_GLOBALS = [
|
|
|
1373
1373
|
// Mirrors action.service.js SCRIPT_MAX_BYTES.
|
|
1374
1374
|
const ACTION_SCRIPT_MAX_BYTES = 200 * 1024;
|
|
1375
1375
|
|
|
1376
|
+
/**
|
|
1377
|
+
* sc-4915 — the trigger set a manifest action declares, canonically ordered.
|
|
1378
|
+
*
|
|
1379
|
+
* `triggerTypes` is the current shape; the pre-sc-4915 scalar `triggerType` is
|
|
1380
|
+
* still read so a widget published before the change keeps validating. Returns
|
|
1381
|
+
* null when the declaration is empty, holds an unknown value, or repeats one —
|
|
1382
|
+
* every caller reports that as a manifest error. ONE reader, so the SDK
|
|
1383
|
+
* validator, the CLI linter and the backend cannot disagree about what a
|
|
1384
|
+
* manifest declared.
|
|
1385
|
+
*/
|
|
1386
|
+
function normaliseActionTriggerTypes(action) {
|
|
1387
|
+
const a = action !== null && typeof action === "object" ? action : {};
|
|
1388
|
+
const raw = Array.isArray(a.triggerTypes)
|
|
1389
|
+
? a.triggerTypes
|
|
1390
|
+
: a.triggerTypes === undefined && a.triggerType !== undefined
|
|
1391
|
+
? [a.triggerType]
|
|
1392
|
+
: null;
|
|
1393
|
+
if (raw === null || raw.length === 0) return null;
|
|
1394
|
+
const seen = new Set();
|
|
1395
|
+
for (const t of raw) {
|
|
1396
|
+
if (typeof t !== "string" || !ACTION_TRIGGER_TYPES.includes(t)) return null;
|
|
1397
|
+
if (seen.has(t)) return null;
|
|
1398
|
+
seen.add(t);
|
|
1399
|
+
}
|
|
1400
|
+
return ACTION_TRIGGER_TYPES.filter((t) => seen.has(t));
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
|
|
1376
1404
|
// Reverse-DNS-ish manifest id, e.g. "com.acme.charts.barchart". Two or
|
|
1377
1405
|
// more labels, lowercase alnum + hyphen, label starts with a letter. The
|
|
1378
1406
|
// analyzer + the SDK validator both read this from the contract so a
|
|
@@ -1501,9 +1529,9 @@ const MANIFEST_SCHEMA = {
|
|
|
1501
1529
|
type: "object[]",
|
|
1502
1530
|
required: false,
|
|
1503
1531
|
description:
|
|
1504
|
-
"Optional. Server-side actions the widget declares. Each runs in the shared isolated-vm action runner (cron- or record-triggered) — NEVER in the rendered app. Operators enable them per tenant from the Properties Panel; the action materialises DISABLED until they bind an integration API key (and, for record_* triggers, a target table) in the Actions admin page. Each entry: { key (stable, unique within the manifest), name, description?,
|
|
1532
|
+
"Optional. Server-side actions the widget declares. Each runs in the shared isolated-vm action runner (cron- or record-triggered) — NEVER in the rendered app. Operators enable them per tenant from the Properties Panel; the action materialises DISABLED until they bind an integration API key (and, for record_* triggers, a target table) in the Actions admin page. Each entry: { key (stable, unique within the manifest), name, description?, triggerTypes (a non-empty array of unique values from " +
|
|
1505
1533
|
ACTION_TRIGGER_TYPES.join(", ") +
|
|
1506
|
-
"), scheduleCron? (required iff
|
|
1534
|
+
"; combine them so one script serves several events — the script's `triggerType` global names the event that actually fired), scheduleCron? (required iff triggerTypes contains 'schedule'; node-cron syntax), timeoutMs? (100–300000), scriptSource (≤200 KiB; runs against " +
|
|
1507
1535
|
ACTION_SCRIPT_GLOBALS.join(", ") +
|
|
1508
1536
|
" — NOT the React surface, so SDK imports/hooks are unavailable) }. Do NOT include triggerTableId or apiKeyId — those are tenant-local and bound after install.",
|
|
1509
1537
|
default: [],
|
|
@@ -2787,7 +2815,14 @@ const CONTRACT = deepFreeze({
|
|
|
2787
2815
|
// Naming one widget is strictly more specific than restyling a scope, and
|
|
2788
2816
|
// the Properties Panel stays the final word. Additive throughout: a theme
|
|
2789
2817
|
// that sets none of it resolves exactly as before.
|
|
2790
|
-
|
|
2818
|
+
// 1.63.0: additive (sc-4915) — a manifest action declares `triggerTypes`, a
|
|
2819
|
+
// non-empty ARRAY, so one script can serve a create, an update and a
|
|
2820
|
+
// delete instead of being copied into three actions. The pre-sc-4915
|
|
2821
|
+
// scalar `triggerType` is still read and normalised, so an already
|
|
2822
|
+
// published widget keeps validating. The script's `triggerType` global
|
|
2823
|
+
// now names the trigger that actually FIRED the run ('manual' and 'app'
|
|
2824
|
+
// included), which is what makes a multi-trigger script able to branch.
|
|
2825
|
+
version: "1.63.0",
|
|
2791
2826
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
2792
2827
|
hooks: HOOKS,
|
|
2793
2828
|
primitives: PRIMITIVES,
|
|
@@ -3073,6 +3108,7 @@ export {
|
|
|
3073
3108
|
CONTRACT,
|
|
3074
3109
|
clampSpacingScale,
|
|
3075
3110
|
scaleSpacing,
|
|
3111
|
+
normaliseActionTriggerTypes,
|
|
3076
3112
|
isHookAllowed,
|
|
3077
3113
|
requiredContextKeys,
|
|
3078
3114
|
isHexColor,
|
package/dist/index.d.ts
CHANGED
|
@@ -223,18 +223,23 @@ export interface WidgetManifestAction {
|
|
|
223
223
|
key: string;
|
|
224
224
|
name: string;
|
|
225
225
|
description?: string;
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
226
|
+
/**
|
|
227
|
+
* sc-4915 — a non-empty set of unique triggers. Combine them so one script
|
|
228
|
+
* serves several events; the script's `triggerType` global names the one
|
|
229
|
+
* that actually fired.
|
|
230
|
+
*/
|
|
231
|
+
triggerTypes: Array<
|
|
232
|
+
"schedule" | "record_created" | "record_updated" | "record_deleted"
|
|
233
|
+
>;
|
|
234
|
+
/** Required iff `triggerTypes` contains `"schedule"`. node-cron syntax. */
|
|
232
235
|
scheduleCron?: string;
|
|
233
236
|
/** 100–300000. Defaults to 30000 on materialise. */
|
|
234
237
|
timeoutMs?: number;
|
|
235
238
|
/**
|
|
236
239
|
* Runs against `datastore`, `fetch`, `console`, `record`, `tenantId`,
|
|
237
240
|
* `triggerType`, `triggerTableId` — NOT the React/SDK surface. ≤ 200 KiB.
|
|
241
|
+
* `triggerType` is the trigger that fired THIS run — one of the declared
|
|
242
|
+
* `triggerTypes`, or `"manual"` / `"app"` for an operator or button run.
|
|
238
243
|
*/
|
|
239
244
|
scriptSource: string;
|
|
240
245
|
}
|
package/dist/linter.cjs
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
"use strict";
|
|
12
12
|
|
|
13
|
-
const { CONTRACT } = require("./contract.cjs");
|
|
13
|
+
const { CONTRACT, normaliseActionTriggerTypes } = require("./contract.cjs");
|
|
14
14
|
const { LUCIDE_ICON_NAMES, LUCIDE_VERSION } = require("./lucideIconNames.cjs");
|
|
15
15
|
|
|
16
16
|
function _ruleForIdentifier(identifier, reason) {
|
|
@@ -579,10 +579,11 @@ function _manifestActionRules(manifest) {
|
|
|
579
579
|
if (typeof a.name !== "string" || a.name.length === 0) {
|
|
580
580
|
push("manifest.actions[].name must be a non-empty string");
|
|
581
581
|
}
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
582
|
+
const triggerTypes = normaliseActionTriggerTypes(a);
|
|
583
|
+
if (triggerTypes === null) {
|
|
584
|
+
push(`manifest.actions[].triggerTypes must be a non-empty array of unique values from ${[...validTriggers].join(", ")}`);
|
|
585
|
+
} else if (triggerTypes.includes("schedule") && (typeof a.scheduleCron !== "string" || !a.scheduleCron)) {
|
|
586
|
+
push("manifest.actions[].scheduleCron is required when triggerTypes contains 'schedule'");
|
|
586
587
|
}
|
|
587
588
|
if (typeof a.scriptSource !== "string" || a.scriptSource.length === 0) {
|
|
588
589
|
push("manifest.actions[].scriptSource must be a non-empty string");
|
package/dist/linter.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// The banned-identifier list is derived from `CONTRACT.bannedApis` so the
|
|
7
7
|
// system prompt, the linter, and the runtime allowlist agree.
|
|
8
8
|
|
|
9
|
-
import { CONTRACT } from "./contract.js";
|
|
9
|
+
import { CONTRACT, normaliseActionTriggerTypes } from "./contract.js";
|
|
10
10
|
import { LUCIDE_ICON_NAMES, LUCIDE_VERSION } from "./lucideIconNames.js";
|
|
11
11
|
|
|
12
12
|
// Per-identifier match rule. Most banned identifiers compile to a
|
|
@@ -674,16 +674,17 @@ function _manifestActionRules(manifest) {
|
|
|
674
674
|
if (typeof a.name !== "string" || a.name.length === 0) {
|
|
675
675
|
push("manifest.actions[].name must be a non-empty string");
|
|
676
676
|
}
|
|
677
|
-
|
|
677
|
+
const triggerTypes = normaliseActionTriggerTypes(a);
|
|
678
|
+
if (triggerTypes === null) {
|
|
678
679
|
push(
|
|
679
|
-
`manifest.actions[].
|
|
680
|
+
`manifest.actions[].triggerTypes must be a non-empty array of unique values from ${[...validTriggers].join(", ")}`,
|
|
680
681
|
);
|
|
681
682
|
} else if (
|
|
682
|
-
|
|
683
|
+
triggerTypes.includes("schedule") &&
|
|
683
684
|
(typeof a.scheduleCron !== "string" || !a.scheduleCron)
|
|
684
685
|
) {
|
|
685
686
|
push(
|
|
686
|
-
"manifest.actions[].scheduleCron is required when
|
|
687
|
+
"manifest.actions[].scheduleCron is required when triggerTypes contains 'schedule'",
|
|
687
688
|
);
|
|
688
689
|
}
|
|
689
690
|
if (typeof a.scriptSource !== "string" || a.scriptSource.length === 0) {
|
package/dist/manifest.cjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// re-exports the same functions defined here so there is exactly one
|
|
5
5
|
// implementation.
|
|
6
6
|
|
|
7
|
-
const { CONTRACT } = require("./contract.cjs");
|
|
7
|
+
const { CONTRACT, normaliseActionTriggerTypes } = require("./contract.cjs");
|
|
8
8
|
|
|
9
9
|
const PAYLOAD_VALUE_TYPES = CONTRACT.payloadValueTypes;
|
|
10
10
|
|
|
@@ -152,15 +152,16 @@ function validateManifestActions(actions, errors) {
|
|
|
152
152
|
seenKeys.add(a.key);
|
|
153
153
|
}
|
|
154
154
|
pushIf(errors, isNonEmptyString(a.name), "manifest.actions[].name must be a non-empty string");
|
|
155
|
-
|
|
155
|
+
const triggerTypes = normaliseActionTriggerTypes(a);
|
|
156
|
+
if (triggerTypes === null) {
|
|
156
157
|
errors.push(
|
|
157
|
-
`manifest.actions[].
|
|
158
|
+
`manifest.actions[].triggerTypes must be a non-empty array of unique values from ${[...VALID_ACTION_TRIGGERS].join(", ")}`,
|
|
158
159
|
);
|
|
159
|
-
} else if (
|
|
160
|
+
} else if (triggerTypes.includes("schedule")) {
|
|
160
161
|
pushIf(
|
|
161
162
|
errors,
|
|
162
163
|
isNonEmptyString(a.scheduleCron),
|
|
163
|
-
"manifest.actions[].scheduleCron is required when
|
|
164
|
+
"manifest.actions[].scheduleCron is required when triggerTypes contains 'schedule'",
|
|
164
165
|
);
|
|
165
166
|
}
|
|
166
167
|
if (!isNonEmptyString(a.scriptSource)) {
|
package/dist/manifest.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// re-exports the same functions defined here so there is exactly one
|
|
5
5
|
// implementation.
|
|
6
6
|
|
|
7
|
-
import { CONTRACT } from "./contract.js";
|
|
7
|
+
import { CONTRACT, normaliseActionTriggerTypes } from "./contract.js";
|
|
8
8
|
|
|
9
9
|
const PAYLOAD_VALUE_TYPES = CONTRACT.payloadValueTypes;
|
|
10
10
|
|
|
@@ -152,15 +152,16 @@ function validateManifestActions(actions, errors) {
|
|
|
152
152
|
seenKeys.add(a.key);
|
|
153
153
|
}
|
|
154
154
|
pushIf(errors, isNonEmptyString(a.name), "manifest.actions[].name must be a non-empty string");
|
|
155
|
-
|
|
155
|
+
const triggerTypes = normaliseActionTriggerTypes(a);
|
|
156
|
+
if (triggerTypes === null) {
|
|
156
157
|
errors.push(
|
|
157
|
-
`manifest.actions[].
|
|
158
|
+
`manifest.actions[].triggerTypes must be a non-empty array of unique values from ${[...VALID_ACTION_TRIGGERS].join(", ")}`,
|
|
158
159
|
);
|
|
159
|
-
} else if (
|
|
160
|
+
} else if (triggerTypes.includes("schedule")) {
|
|
160
161
|
pushIf(
|
|
161
162
|
errors,
|
|
162
163
|
isNonEmptyString(a.scheduleCron),
|
|
163
|
-
"manifest.actions[].scheduleCron is required when
|
|
164
|
+
"manifest.actions[].scheduleCron is required when triggerTypes contains 'schedule'",
|
|
164
165
|
);
|
|
165
166
|
}
|
|
166
167
|
if (!isNonEmptyString(a.scriptSource)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colixsystems/widget-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.90.0",
|
|
4
4
|
"description": "Common widget interface for AppStudio. Implements WidgetManifest, WidgetContext, property schema, and helper hooks.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|