@colixsystems/widget-sdk 0.54.0 → 0.55.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 CHANGED
@@ -52,7 +52,11 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
52
52
 
53
53
  ## Status
54
54
 
55
- `v0.54.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**.
55
+ `v0.55.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**.
56
+
57
+ ### What's new in 0.55.0
58
+
59
+ **Dynamic record selection for `valueRef` (sc-2327).** The `valueRef` binding gains an optional `mode` field: `"static"` (the default — pin a specific `recordId`, the only prior behaviour) or `"latest"` (resolve the most recently created row live, sorting on the host-managed `created_at` descending with `limit: 1`; `recordId` is ignored). The built-in Field Value widget reads it to offer a "Latest entry" that updates as records are added, with no per-host code — the same baked widget source and the same injected `@colixsystems/datastore-client` run on the web Player and the native Expo export. The `ValueRefBinding` type adds `mode?: "static" | "latest"`. Existing bindings carry no `mode` and read as static. `CONTRACT.version` → `1.39.0`. Additive — no existing field changed shape.
56
60
 
57
61
  ### What's new in 0.54.0
58
62
 
package/dist/contract.cjs CHANGED
@@ -1858,7 +1858,13 @@ const CONTRACT = deepFreeze({
1858
1858
  // Player and the native export, so no browser-only PDF library is added
1859
1859
  // to the vetted set. No existing hook, primitive, manifest field, or
1860
1860
  // token changed shape — minor bump.
1861
- version: "1.38.0",
1861
+ // 1.39.0: additive (sc-2327) — the `valueRef` propertySchema binding gains
1862
+ // an optional `mode` field: "static" (a pinned recordId, the default and
1863
+ // the only prior behaviour) or "latest" (the most recently created row,
1864
+ // resolved live by `created_at` desc with limit 1; recordId ignored). The
1865
+ // Field Value widget reads it to show a live "latest entry". Existing
1866
+ // bindings have no `mode` and read as static — additive, minor bump.
1867
+ version: "1.39.0",
1862
1868
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
1863
1869
  hooks: HOOKS,
1864
1870
  primitives: PRIMITIVES,
package/dist/contract.js CHANGED
@@ -1858,7 +1858,13 @@ const CONTRACT = deepFreeze({
1858
1858
  // Player and the native export, so no browser-only PDF library is added
1859
1859
  // to the vetted set. No existing hook, primitive, manifest field, or
1860
1860
  // token changed shape — minor bump.
1861
- version: "1.38.0",
1861
+ // 1.39.0: additive (sc-2327) — the `valueRef` propertySchema binding gains
1862
+ // an optional `mode` field: "static" (a pinned recordId, the default and
1863
+ // the only prior behaviour) or "latest" (the most recently created row,
1864
+ // resolved live by `created_at` desc with limit 1; recordId ignored). The
1865
+ // Field Value widget reads it to show a live "latest entry". Existing
1866
+ // bindings have no `mode` and read as static — additive, minor bump.
1867
+ version: "1.39.0",
1862
1868
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
1863
1869
  hooks: HOOKS,
1864
1870
  primitives: PRIMITIVES,
package/dist/index.d.ts CHANGED
@@ -101,6 +101,12 @@ export interface ValueRefBinding {
101
101
  tableId?: string;
102
102
  recordId?: string;
103
103
  column?: string;
104
+ /**
105
+ * How the record is chosen. "static" (default, may be omitted) pins
106
+ * `recordId`; "latest" resolves the most recently created row live and
107
+ * ignores `recordId`.
108
+ */
109
+ mode?: "static" | "latest";
104
110
  }
105
111
 
106
112
  export interface WidgetEventDescriptor {
@@ -183,10 +183,12 @@ function coerceLeaf(def, value, path, errors) {
183
183
  }
184
184
  return value.map((item, i) => coerceLeaf(def.items, item, `${path}[${i}]`, errors));
185
185
  case "valueRef": {
186
- // REQ-WDG-VALUEREF: a `{ tableId, recordId, column }` binding. Each
187
- // sub-field is an optional string (a half-configured binding is valid
186
+ // REQ-WDG-VALUEREF: a `{ tableId, recordId, column, mode }` binding.
187
+ // Each string sub-field is optional (a half-configured binding is valid
188
188
  // while the author is still picking); the bound widget treats any
189
- // missing piece as "no value" and shows its fallback.
189
+ // missing piece as "no value" and shows its fallback. sc-2327: `mode`
190
+ // selects how the record is chosen — "static" (a pinned recordId, the
191
+ // default) or "latest" (the newest row, resolved live; recordId ignored).
190
192
  if (!isPlainObject(value)) {
191
193
  errors.push(`${path}: expected object`);
192
194
  return value;
@@ -197,6 +199,14 @@ function coerceLeaf(def, value, path, errors) {
197
199
  errors.push(`${path}.${sub}: expected string`);
198
200
  }
199
201
  }
202
+ if (
203
+ value.mode !== undefined &&
204
+ value.mode !== null &&
205
+ value.mode !== "static" &&
206
+ value.mode !== "latest"
207
+ ) {
208
+ errors.push(`${path}.mode: expected "static" or "latest"`);
209
+ }
200
210
  return value;
201
211
  }
202
212
  case "object": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colixsystems/widget-sdk",
3
- "version": "0.54.0",
3
+ "version": "0.55.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",