@lotics/app-sdk 0.31.0 → 0.32.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.
@@ -32,7 +32,7 @@ export { readSelect } from "./select.js";
32
32
  export type { ResolvedOption } from "./select.js";
33
33
  export type { AppFixture } from "./mock.js";
34
34
  export type { AppWorkflows, AppQueries } from "./types.js";
35
- export { row, readLinks, readFiles } from "./row.js";
35
+ export { row, readLinks, readFiles, readLocked } from "./row.js";
36
36
  export type { ResolvedLink, AppFile } from "./row.js";
37
37
  export { useOptimistic } from "./use_optimistic.js";
38
38
  export type { OptimisticApi } from "./use_optimistic.js";
package/dist/src/index.js CHANGED
@@ -23,6 +23,6 @@ export { rpc } from "./rpc.js";
23
23
  export { openExternal } from "./open_external.js";
24
24
  export { readMembers } from "./members.js";
25
25
  export { readSelect } from "./select.js";
26
- export { row, readLinks, readFiles } from "./row.js";
26
+ export { row, readLinks, readFiles, readLocked } from "./row.js";
27
27
  export { useOptimistic } from "./use_optimistic.js";
28
28
  export { useRecents } from "./use_recents.js";
package/dist/src/row.d.ts CHANGED
@@ -65,6 +65,15 @@ export interface AppFile {
65
65
  * an unservable file. Map to `@lotics/ui` `DisplayFile` for FileThumbnail/Gallery.
66
66
  */
67
67
  export declare function readFiles(v: unknown): AppFile[];
68
+ /**
69
+ * Record lock state for a `useQuery` row. The query layer emits a row-level
70
+ * `__source_locked` addressing column (alongside `__source_record_id`). A locked
71
+ * record rejects direct writes, so an app reads this to show a locked state and
72
+ * route edits through a `request_locked_field_change` workflow instead of an
73
+ * `update_records` save. Pass the whole row (not a cell). False for any
74
+ * non-object / absent flag.
75
+ */
76
+ export declare function readLocked(rowValue: unknown): boolean;
68
77
  export declare const row: {
69
78
  opt: typeof opt;
70
79
  text: typeof text;
package/dist/src/row.js CHANGED
@@ -118,4 +118,17 @@ export function readFiles(v) {
118
118
  }
119
119
  return out;
120
120
  }
121
+ /**
122
+ * Record lock state for a `useQuery` row. The query layer emits a row-level
123
+ * `__source_locked` addressing column (alongside `__source_record_id`). A locked
124
+ * record rejects direct writes, so an app reads this to show a locked state and
125
+ * route edits through a `request_locked_field_change` workflow instead of an
126
+ * `update_records` save. Pass the whole row (not a cell). False for any
127
+ * non-object / absent flag.
128
+ */
129
+ export function readLocked(rowValue) {
130
+ if (!rowValue || typeof rowValue !== "object")
131
+ return false;
132
+ return bool(rowValue["__source_locked"]);
133
+ }
121
134
  export const row = { opt, text, num, bool, date, link };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lotics/app-sdk",
3
- "version": "0.31.0",
3
+ "version": "0.32.0",
4
4
  "description": "Runtime SDK for Lotics custom-code apps — typed hooks, postMessage bridge, mount entry point",
5
5
  "type": "module",
6
6
  "exports": {
@@ -46,4 +46,4 @@
46
46
  "url": "https://github.com/lotics/lotics.git",
47
47
  "directory": "packages/app-sdk"
48
48
  }
49
- }
49
+ }