@spotto/contract 1.0.70-alpha.2 → 1.0.70-alpha.21

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.
Files changed (305) hide show
  1. package/README.md +33 -33
  2. package/dist/actions/[id]/index.d.ts +1 -0
  3. package/dist/actions/[id]/index.js +18 -0
  4. package/dist/actions/[id]/index.js.map +1 -0
  5. package/dist/actions/[id]/patch/index.d.ts +2 -0
  6. package/dist/actions/[id]/patch/index.js +19 -0
  7. package/dist/actions/[id]/patch/index.js.map +1 -0
  8. package/dist/actions/[id]/patch/request.d.ts +16 -0
  9. package/dist/actions/[id]/patch/request.js +3 -0
  10. package/dist/actions/[id]/patch/request.js.map +1 -0
  11. package/dist/actions/[id]/patch/response.d.ts +1 -0
  12. package/dist/actions/[id]/patch/response.js +3 -0
  13. package/dist/actions/[id]/patch/response.js.map +1 -0
  14. package/dist/actions/get/index.d.ts +2 -0
  15. package/dist/actions/get/index.js +19 -0
  16. package/dist/actions/get/index.js.map +1 -0
  17. package/dist/actions/get/query.d.ts +14 -0
  18. package/dist/actions/get/query.js +3 -0
  19. package/dist/actions/get/query.js.map +1 -0
  20. package/dist/actions/get/response.d.ts +29 -0
  21. package/dist/actions/get/response.js +3 -0
  22. package/dist/actions/get/response.js.map +1 -0
  23. package/dist/actions/index.d.ts +4 -0
  24. package/dist/actions/index.js +21 -0
  25. package/dist/actions/index.js.map +1 -0
  26. package/dist/actions/post/index.d.ts +2 -0
  27. package/dist/actions/post/index.js +19 -0
  28. package/dist/actions/post/index.js.map +1 -0
  29. package/dist/actions/post/request.d.ts +15 -0
  30. package/dist/actions/post/request.js +3 -0
  31. package/dist/actions/post/request.js.map +1 -0
  32. package/dist/actions/post/response.d.ts +1 -0
  33. package/dist/actions/post/response.js +3 -0
  34. package/dist/actions/post/response.js.map +1 -0
  35. package/dist/actions/shared.d.ts +51 -0
  36. package/dist/actions/shared.js +13 -0
  37. package/dist/actions/shared.js.map +1 -0
  38. package/dist/ai/chat/index.d.ts +2 -0
  39. package/dist/ai/chat/index.js +19 -0
  40. package/dist/ai/chat/index.js.map +1 -0
  41. package/dist/ai/chat/request.d.ts +27 -0
  42. package/dist/ai/chat/request.js +3 -0
  43. package/dist/ai/chat/request.js.map +1 -0
  44. package/dist/ai/chat/response.d.ts +57 -0
  45. package/dist/ai/chat/response.js +11 -0
  46. package/dist/ai/chat/response.js.map +1 -0
  47. package/dist/ai/expression/index.d.ts +2 -0
  48. package/dist/ai/expression/index.js +19 -0
  49. package/dist/ai/expression/index.js.map +1 -0
  50. package/dist/ai/expression/request.d.ts +29 -0
  51. package/dist/ai/expression/request.js +3 -0
  52. package/dist/ai/expression/request.js.map +1 -0
  53. package/dist/ai/expression/response.d.ts +23 -0
  54. package/dist/ai/expression/response.js +3 -0
  55. package/dist/ai/expression/response.js.map +1 -0
  56. package/dist/ai/index.d.ts +4 -0
  57. package/dist/ai/index.js +21 -0
  58. package/dist/ai/index.js.map +1 -0
  59. package/dist/ai/semantic-query/index.d.ts +2 -0
  60. package/dist/ai/semantic-query/index.js +19 -0
  61. package/dist/ai/semantic-query/index.js.map +1 -0
  62. package/dist/ai/semantic-query/request.d.ts +43 -0
  63. package/dist/ai/semantic-query/request.js +3 -0
  64. package/dist/ai/semantic-query/request.js.map +1 -0
  65. package/dist/ai/semantic-query/response.d.ts +40 -0
  66. package/dist/ai/semantic-query/response.js +3 -0
  67. package/dist/ai/semantic-query/response.js.map +1 -0
  68. package/dist/ai/shared.d.ts +22 -0
  69. package/dist/ai/shared.js +11 -0
  70. package/dist/ai/shared.js.map +1 -0
  71. package/dist/assets/[id]/get.d.ts +9 -1
  72. package/dist/assets/[id]/patch/request.d.ts +5 -0
  73. package/dist/assets/count/query.d.ts +16 -1
  74. package/dist/assets/download/query.d.ts +7 -0
  75. package/dist/assets/get/query.d.ts +22 -4
  76. package/dist/assets/post/request.d.ts +2 -0
  77. package/dist/assets/post/request.js.map +1 -1
  78. package/dist/events/constants.d.ts +2 -1
  79. package/dist/events/constants.js +2 -0
  80. package/dist/events/constants.js.map +1 -1
  81. package/dist/events/get/response.d.ts +17 -1
  82. package/dist/fields/[id]/get.d.ts +3 -0
  83. package/dist/fields/[id]/patch/request.d.ts +4 -0
  84. package/dist/fields/constants.d.ts +19 -0
  85. package/dist/fields/constants.js +15 -1
  86. package/dist/fields/constants.js.map +1 -1
  87. package/dist/forms/[id]/index.d.ts +1 -0
  88. package/dist/forms/[id]/index.js +18 -0
  89. package/dist/forms/[id]/index.js.map +1 -0
  90. package/dist/forms/[id]/patch/index.d.ts +2 -0
  91. package/dist/forms/[id]/patch/index.js +19 -0
  92. package/dist/forms/[id]/patch/index.js.map +1 -0
  93. package/dist/forms/[id]/patch/request.d.ts +14 -0
  94. package/dist/forms/[id]/patch/request.js +3 -0
  95. package/dist/forms/[id]/patch/request.js.map +1 -0
  96. package/dist/forms/[id]/patch/response.d.ts +1 -0
  97. package/dist/forms/[id]/patch/response.js +3 -0
  98. package/dist/forms/[id]/patch/response.js.map +1 -0
  99. package/dist/forms/constants.d.ts +19 -0
  100. package/dist/forms/constants.js +33 -0
  101. package/dist/forms/constants.js.map +1 -0
  102. package/dist/forms/get/index.d.ts +2 -0
  103. package/dist/forms/get/index.js +19 -0
  104. package/dist/forms/get/index.js.map +1 -0
  105. package/dist/forms/get/query.d.ts +18 -0
  106. package/dist/forms/get/query.js +3 -0
  107. package/dist/forms/get/query.js.map +1 -0
  108. package/dist/forms/get/response.d.ts +23 -0
  109. package/dist/forms/get/response.js +3 -0
  110. package/dist/forms/get/response.js.map +1 -0
  111. package/dist/forms/index.d.ts +6 -0
  112. package/dist/forms/index.js +23 -0
  113. package/dist/forms/index.js.map +1 -0
  114. package/dist/forms/post/index.d.ts +2 -0
  115. package/dist/forms/post/index.js +19 -0
  116. package/dist/forms/post/index.js.map +1 -0
  117. package/dist/forms/post/request.d.ts +9 -0
  118. package/dist/forms/post/request.js +3 -0
  119. package/dist/forms/post/request.js.map +1 -0
  120. package/dist/forms/post/response.d.ts +1 -0
  121. package/dist/forms/post/response.js +3 -0
  122. package/dist/forms/post/response.js.map +1 -0
  123. package/dist/forms/shared.d.ts +127 -0
  124. package/dist/forms/shared.js +3 -0
  125. package/dist/forms/shared.js.map +1 -0
  126. package/dist/forms/versions/index.d.ts +2 -0
  127. package/dist/forms/versions/index.js +19 -0
  128. package/dist/forms/versions/index.js.map +1 -0
  129. package/dist/forms/versions/path.d.ts +8 -0
  130. package/dist/forms/versions/path.js +3 -0
  131. package/dist/forms/versions/path.js.map +1 -0
  132. package/dist/forms/versions/response.d.ts +1 -0
  133. package/dist/forms/versions/response.js +3 -0
  134. package/dist/forms/versions/response.js.map +1 -0
  135. package/dist/index.d.ts +6 -0
  136. package/dist/index.js +6 -0
  137. package/dist/index.js.map +1 -1
  138. package/dist/integrations/oneblink/patch/request.d.ts +2 -2
  139. package/dist/integrations/oneblink/token.d.ts +2 -0
  140. package/dist/locations/get/query.d.ts +14 -0
  141. package/dist/organisations/constants.d.ts +11 -0
  142. package/dist/organisations/sso/constants.d.ts +15 -0
  143. package/dist/organisations/sso/constants.js +16 -1
  144. package/dist/organisations/sso/constants.js.map +1 -1
  145. package/dist/organisations/sso/types.d.ts +48 -0
  146. package/dist/semantic-queries/[id]/index.d.ts +1 -0
  147. package/dist/semantic-queries/[id]/index.js +18 -0
  148. package/dist/semantic-queries/[id]/index.js.map +1 -0
  149. package/dist/semantic-queries/[id]/patch/index.d.ts +2 -0
  150. package/dist/semantic-queries/[id]/patch/index.js +19 -0
  151. package/dist/semantic-queries/[id]/patch/index.js.map +1 -0
  152. package/dist/semantic-queries/[id]/patch/request.d.ts +20 -0
  153. package/dist/semantic-queries/[id]/patch/request.js +3 -0
  154. package/dist/semantic-queries/[id]/patch/request.js.map +1 -0
  155. package/dist/semantic-queries/[id]/patch/response.d.ts +1 -0
  156. package/dist/semantic-queries/[id]/patch/response.js +3 -0
  157. package/dist/semantic-queries/[id]/patch/response.js.map +1 -0
  158. package/dist/semantic-queries/get/index.d.ts +2 -0
  159. package/dist/semantic-queries/get/index.js +19 -0
  160. package/dist/semantic-queries/get/index.js.map +1 -0
  161. package/dist/semantic-queries/get/query.d.ts +18 -0
  162. package/dist/semantic-queries/get/query.js +3 -0
  163. package/dist/semantic-queries/get/query.js.map +1 -0
  164. package/dist/semantic-queries/get/response.d.ts +40 -0
  165. package/dist/semantic-queries/get/response.js +3 -0
  166. package/dist/semantic-queries/get/response.js.map +1 -0
  167. package/dist/semantic-queries/index.d.ts +4 -0
  168. package/dist/semantic-queries/index.js +21 -0
  169. package/dist/semantic-queries/index.js.map +1 -0
  170. package/dist/semantic-queries/post/index.d.ts +2 -0
  171. package/dist/semantic-queries/post/index.js +19 -0
  172. package/dist/semantic-queries/post/index.js.map +1 -0
  173. package/dist/semantic-queries/post/request.d.ts +56 -0
  174. package/dist/semantic-queries/post/request.js +3 -0
  175. package/dist/semantic-queries/post/request.js.map +1 -0
  176. package/dist/semantic-queries/post/response.d.ts +1 -0
  177. package/dist/semantic-queries/post/response.js +3 -0
  178. package/dist/semantic-queries/post/response.js.map +1 -0
  179. package/dist/semantic-queries/shared.d.ts +496 -0
  180. package/dist/semantic-queries/shared.js +224 -0
  181. package/dist/semantic-queries/shared.js.map +1 -0
  182. package/dist/shared/attachments.d.ts +29 -0
  183. package/dist/shared/attachments.js +11 -0
  184. package/dist/shared/attachments.js.map +1 -0
  185. package/dist/shared/embed.d.ts +14 -0
  186. package/dist/shared/index.d.ts +2 -0
  187. package/dist/shared/index.js +2 -0
  188. package/dist/shared/index.js.map +1 -1
  189. package/dist/shared/readiness.d.ts +81 -0
  190. package/dist/shared/readiness.js +11 -0
  191. package/dist/shared/readiness.js.map +1 -0
  192. package/dist/sso/onboard/request.d.ts +12 -1
  193. package/dist/sso/sso-mappings/request.d.ts +10 -5
  194. package/dist/submissions/[id]/index.d.ts +1 -0
  195. package/dist/submissions/[id]/index.js +18 -0
  196. package/dist/submissions/[id]/index.js.map +1 -0
  197. package/dist/submissions/[id]/void/post.d.ts +6 -0
  198. package/dist/submissions/[id]/void/post.js +3 -0
  199. package/dist/submissions/[id]/void/post.js.map +1 -0
  200. package/dist/submissions/constants.d.ts +14 -0
  201. package/dist/submissions/constants.js +21 -0
  202. package/dist/submissions/constants.js.map +1 -0
  203. package/dist/submissions/get/index.d.ts +2 -0
  204. package/dist/submissions/get/index.js +19 -0
  205. package/dist/submissions/get/index.js.map +1 -0
  206. package/dist/submissions/get/query.d.ts +14 -0
  207. package/dist/submissions/get/query.js +3 -0
  208. package/dist/submissions/get/query.js.map +1 -0
  209. package/dist/submissions/get/response.d.ts +6 -0
  210. package/dist/submissions/get/response.js +3 -0
  211. package/dist/submissions/get/response.js.map +1 -0
  212. package/dist/submissions/index.d.ts +6 -0
  213. package/dist/submissions/index.js +23 -0
  214. package/dist/submissions/index.js.map +1 -0
  215. package/dist/submissions/post/index.d.ts +2 -0
  216. package/dist/submissions/post/index.js +19 -0
  217. package/dist/submissions/post/index.js.map +1 -0
  218. package/dist/submissions/post/request.d.ts +17 -0
  219. package/dist/submissions/post/request.js +3 -0
  220. package/dist/submissions/post/request.js.map +1 -0
  221. package/dist/submissions/post/response.d.ts +22 -0
  222. package/dist/submissions/post/response.js +3 -0
  223. package/dist/submissions/post/response.js.map +1 -0
  224. package/dist/submissions/shared.d.ts +133 -0
  225. package/dist/submissions/shared.js +3 -0
  226. package/dist/submissions/shared.js.map +1 -0
  227. package/dist/submissions/uploads/[fileId]/get.d.ts +11 -0
  228. package/dist/submissions/uploads/[fileId]/get.js +3 -0
  229. package/dist/submissions/uploads/[fileId]/get.js.map +1 -0
  230. package/dist/submissions/uploads/[fileId]/index.d.ts +1 -0
  231. package/dist/submissions/uploads/[fileId]/index.js +18 -0
  232. package/dist/submissions/uploads/[fileId]/index.js.map +1 -0
  233. package/dist/submissions/uploads/index.d.ts +2 -0
  234. package/dist/submissions/uploads/index.js +19 -0
  235. package/dist/submissions/uploads/index.js.map +1 -0
  236. package/dist/submissions/uploads/post/index.d.ts +2 -0
  237. package/dist/submissions/uploads/post/index.js +19 -0
  238. package/dist/submissions/uploads/post/index.js.map +1 -0
  239. package/dist/submissions/uploads/post/request.d.ts +9 -0
  240. package/dist/submissions/uploads/post/request.js +3 -0
  241. package/dist/submissions/uploads/post/request.js.map +1 -0
  242. package/dist/submissions/uploads/post/response.d.ts +18 -0
  243. package/dist/submissions/uploads/post/response.js +3 -0
  244. package/dist/submissions/uploads/post/response.js.map +1 -0
  245. package/dist/types/[id]/get.d.ts +17 -2
  246. package/dist/types/[id]/patch/request.d.ts +16 -2
  247. package/dist/types/post/request.d.ts +16 -2
  248. package/dist/types/post/request.js.map +1 -1
  249. package/dist/usergroups/[id]/index.d.ts +1 -0
  250. package/dist/usergroups/[id]/index.js +18 -0
  251. package/dist/usergroups/[id]/index.js.map +1 -0
  252. package/dist/usergroups/[id]/patch/index.d.ts +2 -0
  253. package/dist/usergroups/[id]/patch/index.js +19 -0
  254. package/dist/usergroups/[id]/patch/index.js.map +1 -0
  255. package/dist/usergroups/[id]/patch/request.d.ts +12 -0
  256. package/dist/usergroups/[id]/patch/request.js +3 -0
  257. package/dist/usergroups/[id]/patch/request.js.map +1 -0
  258. package/dist/usergroups/[id]/patch/response.d.ts +1 -0
  259. package/dist/usergroups/[id]/patch/response.js +3 -0
  260. package/dist/usergroups/[id]/patch/response.js.map +1 -0
  261. package/dist/usergroups/get/index.d.ts +2 -0
  262. package/dist/usergroups/get/index.js +19 -0
  263. package/dist/usergroups/get/index.js.map +1 -0
  264. package/dist/usergroups/get/query.d.ts +12 -0
  265. package/dist/usergroups/get/query.js +3 -0
  266. package/dist/usergroups/get/query.js.map +1 -0
  267. package/dist/usergroups/get/response.d.ts +35 -0
  268. package/dist/usergroups/get/response.js +3 -0
  269. package/dist/usergroups/get/response.js.map +1 -0
  270. package/dist/usergroups/index.d.ts +4 -0
  271. package/dist/usergroups/index.js +21 -0
  272. package/dist/usergroups/index.js.map +1 -0
  273. package/dist/usergroups/post/index.d.ts +2 -0
  274. package/dist/usergroups/post/index.js +19 -0
  275. package/dist/usergroups/post/index.js.map +1 -0
  276. package/dist/usergroups/post/request.d.ts +11 -0
  277. package/dist/usergroups/post/request.js +3 -0
  278. package/dist/usergroups/post/request.js.map +1 -0
  279. package/dist/usergroups/post/response.d.ts +1 -0
  280. package/dist/usergroups/post/response.js +3 -0
  281. package/dist/usergroups/post/response.js.map +1 -0
  282. package/dist/usergroups/shared.d.ts +25 -0
  283. package/dist/usergroups/shared.js +11 -0
  284. package/dist/usergroups/shared.js.map +1 -0
  285. package/dist/users/[id]/get/response.d.ts +0 -2
  286. package/dist/users/[id]/patch/request.d.ts +5 -1
  287. package/dist/users/current.d.ts +29 -4
  288. package/dist/users/get/query.d.ts +0 -2
  289. package/dist/users/home-layout/index.d.ts +3 -0
  290. package/dist/users/home-layout/index.js +20 -0
  291. package/dist/users/home-layout/index.js.map +1 -0
  292. package/dist/users/home-layout/request.d.ts +5 -0
  293. package/dist/users/home-layout/request.js +3 -0
  294. package/dist/users/home-layout/request.js.map +1 -0
  295. package/dist/users/home-layout/response.d.ts +5 -0
  296. package/dist/users/home-layout/response.js +3 -0
  297. package/dist/users/home-layout/response.js.map +1 -0
  298. package/dist/users/home-layout/shared.d.ts +98 -0
  299. package/dist/users/home-layout/shared.js +21 -0
  300. package/dist/users/home-layout/shared.js.map +1 -0
  301. package/dist/users/index.d.ts +1 -0
  302. package/dist/users/index.js +1 -0
  303. package/dist/users/index.js.map +1 -1
  304. package/dist/users/post/request.d.ts +6 -1
  305. package/package.json +2 -2
@@ -0,0 +1,496 @@
1
+ import { SortOrders } from '../shared';
2
+ import { AssetSortField } from '../assets/get/query';
3
+ import { LocationStatus, LocationType } from '../locations/constants';
4
+ import { FieldDataType } from '../fields/constants';
5
+ /**
6
+ * SEMANTIC QUERIES — the portable query language.
7
+ *
8
+ * A semantic query is a JSON list of typed conditions (ANDed together, nestable
9
+ * with and/or groups) over one entity type. Three parties speak this contract —
10
+ * the client filter UI that builds conditions, the LLM that generates them, and
11
+ * the server compiler that executes them — so this file is the single
12
+ * vocabulary all three encode.
13
+ *
14
+ * THE CLOSED-VOCABULARY RULE. Condition types, operators AND property names are
15
+ * closed sets: validation rejects an unknown property rather than ignoring it,
16
+ * at every level. This is not defensive tidiness — an LLM once invented a
17
+ * `"negate": true` property; ignoring it compiled NOT(X) as X, a query that ran
18
+ * successfully and returned exactly the complement of what was asked. Every
19
+ * defect class this design guards against fails SILENTLY (valid query, wrong
20
+ * rows), which is why an honest rejection always beats a plausible guess.
21
+ *
22
+ * There is deliberately NO general negation (no `not` group, no invertible
23
+ * flag). Expressible negatively: `notExists`, `ne`, `geolocation.exists:false`,
24
+ * `kit.isMember:false`. Anything else must surface as a validation issue,
25
+ * never an approximation.
26
+ *
27
+ * Descends from the G2G Chat prototype (see g2g-client
28
+ * `docs/semantic-query-decisions.md` while it lives, folding into
29
+ * TECHNICAL_DECISIONS.md) and the semantic-query specification errata.
30
+ */
31
+ /**
32
+ * What a semantic query targets. Only `asset` executes today; recorded on
33
+ * every stored query from day one so saved records never need retrofitting.
34
+ */
35
+ export declare const semanticQueryEntityTypes: readonly ["asset", "location", "event", "reader", "snapshot", "manifest"];
36
+ export declare type SemanticQueryEntityType = (typeof semanticQueryEntityTypes)[number];
37
+ /**
38
+ * What a stored record IS, as opposed to what it targets.
39
+ * - `query` — a selector. Executing it returns rows.
40
+ * - `operation` — a selector PLUS verbs ("move everything matching this to
41
+ * Southport"). Only the DEFINITION is stored; execution belongs
42
+ * to the bulk-operations API when it exists.
43
+ */
44
+ export declare const semanticQueryKinds: readonly ["query", "operation"];
45
+ export declare type SemanticQueryKind = (typeof semanticQueryKinds)[number];
46
+ export declare const semanticQueryVisibilities: readonly ["private", "organisation"];
47
+ export declare type SemanticQueryVisibility = (typeof semanticQueryVisibilities)[number];
48
+ export declare const semanticRelativeDateBases: readonly ["day", "week", "month", "quarter", "year"];
49
+ export declare type SemanticRelativeDateBase = (typeof semanticRelativeDateBases)[number];
50
+ export declare const semanticRelativeDatePositions: readonly ["start", "end", "same"];
51
+ export declare type SemanticRelativeDatePosition = (typeof semanticRelativeDatePositions)[number];
52
+ /**
53
+ * A relative date, stored UNRESOLVED — that is the point. A saved query whose
54
+ * date resolved at save time silently means the wrong period forever; leaving
55
+ * it symbolic means "last 30 days" re-run next month means next month.
56
+ * Resolution happens at execution, against an explicit timezone.
57
+ *
58
+ * `offset`: 0 = this period, 1 = next, -1 = last, -30 = thirty periods ago.
59
+ *
60
+ * `position`:
61
+ * - `start` / `end` snap to the boundaries of the named period (calendar
62
+ * semantics — "start of last month").
63
+ * - `same` is the same day-of-month, `offset` periods away, clamped for short
64
+ * months (31 Jan + 1 month = 28/29 Feb). Without it "one month from today"
65
+ * is inexpressible — `{base:'month', offset:1, position:'start'}` is the 1st
66
+ * of next month and `{base:'day', offset:30}` drifts. Service and inspection
67
+ * intervals are quoted in months, so for date-setting operations `same` is
68
+ * the common case, not an edge case. Meaningless for `day` (the offset is
69
+ * already in days).
70
+ *
71
+ * Sibling of the platform's `DateCondition`/`DateOffset` (shared/relative-date
72
+ * .ts), which derives period boundaries from the comparison operator instead.
73
+ * This shape exists separately because it is what the LLM emits and what
74
+ * stored queries carry, and because `position: 'same'` has no `DateCondition`
75
+ * encoding. One resolver serves both (assets resolve-date).
76
+ */
77
+ export interface SemanticRelativeDate {
78
+ relative: true;
79
+ base: SemanticRelativeDateBase;
80
+ offset: number;
81
+ /** Required for week/month/quarter/year; optional for day. */
82
+ position?: SemanticRelativeDatePosition;
83
+ }
84
+ /** An absolute `"YYYY-MM-DD"` date, or a relative one. A range is always two conditions (gte + lt). */
85
+ export declare type SemanticDateValue = string | SemanticRelativeDate;
86
+ export declare const semanticFieldOperators: readonly ["eq", "ne", "gt", "gte", "lt", "lte", "contains", "exists", "notExists"];
87
+ export declare type SemanticFieldOperator = (typeof semanticFieldOperators)[number];
88
+ export declare const semanticTimestampOperators: readonly ["gt", "gte", "lt", "lte"];
89
+ export declare type SemanticTimestampOperator = (typeof semanticTimestampOperators)[number];
90
+ export declare const semanticComparisonOperators: readonly ["eq", "ne", "gt", "gte", "lt", "lte"];
91
+ export declare type SemanticComparisonOperator = (typeof semanticComparisonOperators)[number];
92
+ export declare const semanticSetOperators: readonly ["any", "all"];
93
+ export declare type SemanticSetOperator = (typeof semanticSetOperators)[number];
94
+ /**
95
+ * Grouping. Two interfaces rather than one with `type: 'and' | 'or'` so that
96
+ * `Extract<SemanticQueryCondition, { type: 'or' }>` narrows — with a shared
97
+ * interface it collapses to `never`.
98
+ */
99
+ export interface SemanticAndCondition {
100
+ type: 'and';
101
+ conditions: SemanticQueryCondition[];
102
+ }
103
+ export interface SemanticOrCondition {
104
+ type: 'or';
105
+ conditions: SemanticQueryCondition[];
106
+ }
107
+ /** Matches a type subtree by pipe-delimited path ("Vehicle|Forklift|"). */
108
+ export interface SemanticAssetTypeCondition {
109
+ type: 'assetType';
110
+ path: string;
111
+ /** Default true — the type and everything under it. False = exact type only. */
112
+ includeSubtypes?: boolean;
113
+ }
114
+ /**
115
+ * Matches a location subtree by pipe-delimited path. `location` is where the
116
+ * asset currently IS; `homeLocation` is where it BELONGS — a fixed, often
117
+ * high-level node. Conflating them fails silently, so they are distinct types.
118
+ */
119
+ export interface SemanticAssetLocationCondition {
120
+ type: 'location' | 'homeLocation';
121
+ path: string;
122
+ /** Default true. */
123
+ includeSublocations?: boolean;
124
+ }
125
+ /**
126
+ * Assets currently travelling with another asset — the defibrillator in the
127
+ * ambulance. (The carrier side — "can hold other assets" — is deliberately not
128
+ * in the language: ruled out 2026-07-31.)
129
+ *
130
+ * NOTE the producer gap (prototype finding #12): nothing can currently supply
131
+ * an `assetId` — the AI is never asked for an id (models invent them, and a
132
+ * fabricated id runs and matches nothing) and the client UI has no
133
+ * asset-picking filter. PARKED by ruling (Aaron, 2026-08-03): a peer solution
134
+ * is incoming; until then the AI declines "what's in <asset>" honestly and
135
+ * only `hasAny` is produced.
136
+ */
137
+ export interface SemanticWithAssetCondition {
138
+ type: 'withAsset';
139
+ /** With one specific asset. */
140
+ assetId?: string;
141
+ /** With any asset at all (or none, when false). */
142
+ hasAny?: boolean;
143
+ }
144
+ /**
145
+ * A custom-field condition.
146
+ *
147
+ * `ne` INCLUDES UNSET by default: "Ownership ≠ QH" counts assets where the
148
+ * field is absent, because that is how the English reads. On a sparse field
149
+ * the two readings differ by orders of magnitude (2 rows vs 785 measured).
150
+ * `includeUnset: false` opts into the strict has-the-field-and-differs
151
+ * reading.
152
+ *
153
+ * Fields whose values live on the asset TYPE (inherited down the type
154
+ * hierarchy) are the compiler's problem, not the caller's: the condition shape
155
+ * is identical and the compiler resolves type-level values itself. Without
156
+ * that, the flagship "assets by Manufacturer" query matches nothing.
157
+ */
158
+ export interface SemanticCustomFieldCondition {
159
+ type: 'customField';
160
+ fieldName: string;
161
+ /** Advisory only — the authoritative dataType comes from the field catalogue. */
162
+ dataType?: FieldDataType;
163
+ operator: SemanticFieldOperator;
164
+ value?: string | number | boolean | SemanticRelativeDate;
165
+ /** For `ne` only. Default true. */
166
+ includeUnset?: boolean;
167
+ }
168
+ /**
169
+ * The timestamp family:
170
+ * - `createdDate` — when the asset was created
171
+ * - `lastUpdated` — the asset's own record edited through the APIs
172
+ * - `lastChanged` — ANY system touched the asset, including location /
173
+ * telemetry updates (drives offline-sync deltas)
174
+ * - `lastSeen` / `firstSeen` — detection timestamps
175
+ *
176
+ * "Edited / record changed" wording maps to `lastUpdated`; "moved / touched /
177
+ * anything happened" maps to `lastChanged` — genuinely different questions
178
+ * with substantially different answers.
179
+ *
180
+ * `lt`/`lte` INCLUDE NEVER-SET by default: none of these fields exist on an
181
+ * asset that has never been modified/seen, so a naive "not updated since
182
+ * March" excludes exactly the assets the user is usually looking for.
183
+ * `includeNeverSet: false` opts out.
184
+ *
185
+ * Comparison operators only — bare timestamp existence was ruled out of the
186
+ * language (gap #6, 2026-07-31); "never seen" is `locationStatus: NEVERSEEN`.
187
+ */
188
+ export interface SemanticTimestampCondition {
189
+ type: 'createdDate' | 'lastUpdated' | 'lastChanged' | 'lastSeen' | 'firstSeen';
190
+ operator: SemanticTimestampOperator;
191
+ /** Required for comparisons; forbidden for exists/notExists. */
192
+ value?: SemanticDateValue;
193
+ /** For `lt`/`lte` only. Default true. */
194
+ includeNeverSet?: boolean;
195
+ }
196
+ /** Whether the asset has map coordinates. Nothing more — "online" is not a concept assets have. */
197
+ export interface SemanticGeolocationCondition {
198
+ type: 'geolocation';
199
+ exists: boolean;
200
+ }
201
+ /** Tag conditions take tag IDS, not display names. `any` (default) or `all`. */
202
+ export interface SemanticTagsCondition {
203
+ type: 'tags';
204
+ operator?: SemanticSetOperator;
205
+ values: string[];
206
+ }
207
+ export declare const semanticTelemetryFields: readonly ["battery", "temperature", "voltage"];
208
+ export declare type SemanticTelemetryField = (typeof semanticTelemetryFields)[number];
209
+ export interface SemanticTelemetryCondition {
210
+ type: 'telemetry';
211
+ field: SemanticTelemetryField;
212
+ operator: SemanticComparisonOperator;
213
+ value: number;
214
+ }
215
+ /** Readiness severity scale (contract shared/readiness.ts): 0 green, 1 amber, 2 red. */
216
+ export declare const semanticReadinessLevels: readonly [0, 1, 2];
217
+ export declare type SemanticReadinessLevel = (typeof semanticReadinessLevels)[number];
218
+ /**
219
+ * Readiness. Missing `readiness` on an asset means green — a query including
220
+ * level 0 must also match never-evaluated assets (the compiler owns that).
221
+ * `level` and `levels` are mutually exclusive.
222
+ */
223
+ export interface SemanticReadinessCondition {
224
+ type: 'readiness';
225
+ level?: SemanticReadinessLevel;
226
+ /** Any of several levels — e.g. [1, 2] for "not fully ready". */
227
+ levels?: SemanticReadinessLevel[];
228
+ }
229
+ /**
230
+ * Kits / grouping. Exactly one property may be set. The negative forms match
231
+ * assets where the flag is absent as well as false (the flags are stored
232
+ * true-or-absent).
233
+ *
234
+ * `parentAssetId` shares the withAsset producer gap above — parked the same
235
+ * way; the AI declines "members of kit <name>" until the incoming solution.
236
+ */
237
+ export interface SemanticKitCondition {
238
+ type: 'kit';
239
+ /** The asset is itself a kit. */
240
+ isKit?: boolean;
241
+ /** The asset belongs to a kit. */
242
+ isMember?: boolean;
243
+ /** The kit's membership requirements are met. */
244
+ satisfied?: boolean;
245
+ /** Members of one specific kit. */
246
+ parentAssetId?: string;
247
+ }
248
+ /**
249
+ * Location status ("currently dispatched", "never seen", …). `NEVERSEEN`
250
+ * matches assets with no state at all as well as the explicit status — the
251
+ * compiler owns that missing-state semantic.
252
+ */
253
+ export interface SemanticLocationStatusCondition {
254
+ type: 'locationStatus';
255
+ values: LocationStatus[];
256
+ }
257
+ /**
258
+ * Grouping — valid in every entity's vocabulary, because nesting is structure
259
+ * rather than subject matter.
260
+ */
261
+ export declare const semanticGroupConditionTypes: readonly ["and", "or"];
262
+ /**
263
+ * The ASSET vocabulary. Over a third of it is asset-only by nature —
264
+ * `readiness`, `kit`, `withAsset`, `telemetry`, `locationStatus` mean nothing
265
+ * for a reader or a snapshot.
266
+ */
267
+ export declare const semanticAssetConditionTypes: readonly ["and", "or", "assetType", "location", "homeLocation", "withAsset", "customField", "createdDate", "lastUpdated", "lastChanged", "lastSeen", "firstSeen", "geolocation", "tags", "telemetry", "readiness", "kit", "locationStatus"];
268
+ /**
269
+ * A location subtree, by pipe-delimited path.
270
+ *
271
+ * `path` rather than reusing the asset vocabulary's `location`, deliberately.
272
+ * They are not the same fact: an asset's `location` is a RELATIONSHIP to
273
+ * another record, while a location's path is its own identity — and
274
+ * "location" as a condition on a location query reads as self-reference.
275
+ * (Storage note for implementors: the Mongo document keeps this pipe path in
276
+ * `name`, not in a `path` field.)
277
+ */
278
+ export interface SemanticLocationPathCondition {
279
+ type: 'path';
280
+ path: string;
281
+ /** Default true — this location and everything under it. */
282
+ includeSublocations?: boolean;
283
+ }
284
+ /** A location is FIXED (a room, a bay) or MOVING (a vehicle). */
285
+ export interface SemanticLocationTypeCondition {
286
+ type: 'locationType';
287
+ values: LocationType[];
288
+ }
289
+ /** Whether any reader is installed at the location. */
290
+ export interface SemanticLocationHasReadersCondition {
291
+ type: 'hasReaders';
292
+ value: boolean;
293
+ }
294
+ /** Whether a geofence polygon has been drawn for the location. */
295
+ export interface SemanticLocationGeofenceCondition {
296
+ type: 'geofence';
297
+ exists: boolean;
298
+ }
299
+ /** Locations carrying one specific manifest. Ids point; paths match. */
300
+ export interface SemanticLocationManifestCondition {
301
+ type: 'manifest';
302
+ manifestId: string;
303
+ }
304
+ /**
305
+ * The LOCATION vocabulary.
306
+ *
307
+ * Where a fact is genuinely the same as an asset's, it keeps the same word AND
308
+ * the same meaning — `tags`, `createdDate`, `lastUpdated`, `lastChanged`. That
309
+ * is the naming rule working: one fact stored the same way, sharing one
310
+ * emitter, not two coincidences that agree today.
311
+ *
312
+ * `geolocation` is the exception that proves it needs care. The word means the
313
+ * same thing — "has map coordinates" — but a location has TWO: the coordinates
314
+ * it was configured with, and the ones a moving location last reported
315
+ * (`state.geolocation`, which is what the asset condition reads). This
316
+ * condition means the CONFIGURED position; the observed one belongs to a
317
+ * separate condition if it is ever wanted, rather than being silently folded
318
+ * in here.
319
+ *
320
+ * DELIBERATELY ABSENT: `lastSeen`, `firstSeen` and `telemetry`. The location
321
+ * document declares all three and the parser exposes them, so they were easy
322
+ * to add — but nothing in this repo writes them (the reader/MQTT ingestion
323
+ * does, if anything does), no legacy filter or prototype condition ever
324
+ * offered them, and they could only ever apply to MOVING locations carrying a
325
+ * tracker. A condition over a field that may never be populated is one that
326
+ * runs and confidently returns nothing. They come back the day the ingestion
327
+ * is confirmed to populate them — the emitters are already shared, so it is a
328
+ * list entry and two switch arms.
329
+ *
330
+ * Also absent, and for a different reason: free text. There is no
331
+ * `nameContains` (the prototype had one) because search is a view option
332
+ * platform-wide, not a condition.
333
+ */
334
+ export declare const semanticLocationConditionTypes: readonly ["and", "or", "path", "locationType", "hasReaders", "geofence", "manifest", "tags", "geolocation", "createdDate", "lastUpdated", "lastChanged"];
335
+ /**
336
+ * The three timestamps a location answers for. Narrowed rather than reusing
337
+ * `SemanticTimestampCondition` whole: that interface covers all five, and
338
+ * leaving it wide would let `lastSeen` typecheck on a location query and rely
339
+ * on the runtime vocabulary alone to catch it — the type should say the same
340
+ * thing the gate does.
341
+ */
342
+ export declare type SemanticLocationTimestampCondition = Omit<SemanticTimestampCondition, 'type'> & {
343
+ type: 'createdDate' | 'lastUpdated' | 'lastChanged';
344
+ };
345
+ export declare type SemanticLocationCondition = SemanticAndCondition | SemanticOrCondition | SemanticLocationPathCondition | SemanticLocationTypeCondition | SemanticLocationHasReadersCondition | SemanticLocationGeofenceCondition | SemanticLocationManifestCondition | SemanticTagsCondition | SemanticGeolocationCondition | SemanticLocationTimestampCondition;
346
+ /**
347
+ * WHICH WORDS EACH ENTITY KNOWS — the closed vocabulary, per entity.
348
+ *
349
+ * The rule only has teeth if "unknown" is decidable for the entity being
350
+ * queried. In one flat list `{type:'readiness'}` on a location query is a
351
+ * VALID word, so rejecting it would demote to a hand-maintained compatibility
352
+ * table — a second gate that can drift from the first, which is the
353
+ * runs-cleanly-returns-wrong-rows failure this design exists to prevent.
354
+ *
355
+ * It also scopes what the generator is shown: composing a location query, the
356
+ * model never sees `readiness` at all. The prototype's prompt listed
357
+ * conditions it could not supply and the model duly emitted them (finding 12);
358
+ * a shared vocabulary hands that failure to every entity at once.
359
+ *
360
+ * An entity with an EMPTY vocabulary is one the language does not speak yet —
361
+ * every condition is rejected, which is the honest answer while only assets
362
+ * execute. Entities are listed from day one so a stored record never needs
363
+ * retrofitting.
364
+ *
365
+ * Where a concept genuinely coincides across entities it keeps the SAME word
366
+ * (`createdDate` is the same fact everywhere). A domain word is only earned
367
+ * where the meaning differs.
368
+ */
369
+ export declare const semanticConditionTypesByEntity: Record<SemanticQueryEntityType, readonly string[]>;
370
+ /**
371
+ * Every condition type the language knows, across all entities.
372
+ *
373
+ * This is the BOUNDARY's list — the wire schema checks that a condition names
374
+ * a real word at all, and leaves which-entity-may-use-it to the shared
375
+ * validator, which knows the entity and can say "'readiness' is an asset
376
+ * condition" instead of "not allowed".
377
+ */
378
+ export declare const semanticConditionTypes: readonly ("telemetry" | "readiness" | "location" | "manifest" | "and" | "or" | "assetType" | "homeLocation" | "withAsset" | "customField" | "createdDate" | "lastUpdated" | "lastChanged" | "lastSeen" | "firstSeen" | "geolocation" | "tags" | "kit" | "locationStatus" | "path" | "locationType" | "hasReaders" | "geofence")[];
379
+ export declare type SemanticConditionType = (typeof semanticConditionTypes)[number];
380
+ /**
381
+ * Query size bounds, shared by the boundary schema (which refuses an oversized
382
+ * query before parsing it) and the compiler (which counts every branch as it
383
+ * walks). Both halves are load-bearing: without the compiler's counting a
384
+ * single `or` could carry thousands of arms, and without the boundary's cap
385
+ * the parse itself is the cost.
386
+ */
387
+ export declare const SEMANTIC_QUERY_LIMITS: {
388
+ readonly maxConditions: 50;
389
+ readonly maxDepth: 5;
390
+ };
391
+ /**
392
+ * The ASSET condition union. Per-entity rather than one shared union on
393
+ * purpose: an entity's compiler takes its own union, so a condition it has not
394
+ * handled is a COMPILE error rather than a runtime fall-through. The prototype
395
+ * kept its vocabularies as `string[]` allowlists and lost exactly that.
396
+ */
397
+ export declare type SemanticAssetCondition = SemanticAndCondition | SemanticOrCondition | SemanticAssetTypeCondition | SemanticAssetLocationCondition | SemanticWithAssetCondition | SemanticCustomFieldCondition | SemanticTimestampCondition | SemanticGeolocationCondition | SemanticTagsCondition | SemanticTelemetryCondition | SemanticReadinessCondition | SemanticKitCondition | SemanticLocationStatusCondition;
398
+ /**
399
+ * Any condition, whatever the entity. Widens as entities are added; the
400
+ * envelope and everything generic over it stay unchanged when they are.
401
+ */
402
+ export declare type SemanticQueryCondition = SemanticAssetCondition | SemanticLocationCondition;
403
+ /** Current wire version of the condition vocabulary. */
404
+ export declare const SEMANTIC_QUERY_VERSION = 2;
405
+ export interface SemanticQuery {
406
+ /** Defaults to the current version when absent. */
407
+ version?: number;
408
+ /** ANDed together. Empty is valid — "everything" (entity defaults may bound it). */
409
+ conditions: SemanticQueryCondition[];
410
+ }
411
+ /**
412
+ * PATHS MATCH, IDS POINT. A hierarchical path is for MATCHING a subtree; an id
413
+ * is for pointing at ONE specific record. Setting an asset's location is
414
+ * unambiguous by definition, so it always takes `locationId` — `locationPath`
415
+ * rides along only as a display label. Field names are unique, so `fieldName`
416
+ * needs no resolution step.
417
+ */
418
+ export declare type SemanticAssetOperation =
419
+ /**
420
+ * A DATE field's value may be a SemanticRelativeDate, left UNRESOLVED
421
+ * exactly as in a query — otherwise "set expiry to 12 months from today"
422
+ * freezes the date it was authored on, and re-running it next year is wrong.
423
+ */
424
+ {
425
+ op: 'setField';
426
+ fieldName: string;
427
+ value: string | number | boolean | SemanticRelativeDate;
428
+ } | {
429
+ op: 'clearField';
430
+ fieldName: string;
431
+ } | {
432
+ op: 'setLocation';
433
+ locationId: string;
434
+ locationPath?: string;
435
+ }
436
+ /** Where the asset BELONGS — a different property from where it IS. */
437
+ | {
438
+ op: 'setHomeLocation';
439
+ locationId: string;
440
+ locationPath?: string;
441
+ }
442
+ /**
443
+ * Stored but NOT executable, and deliberately not translated to a sentinel
444
+ * id: asset location state has many permutations (current, home,
445
+ * with-another-asset, pending dispatch), so "clear the location" is not one
446
+ * well-defined write. Captured so the intent is not lost; a no-op until the
447
+ * semantics are decided.
448
+ */
449
+ | {
450
+ op: 'clearLocation';
451
+ }
452
+ /**
453
+ * Captured but PENDING: clearing a home location means setting it to the
454
+ * organisation's root location. Whether that is expressed as the root id or
455
+ * resolved server-side is an open question with the API team — this op
456
+ * deliberately carries no id until settled.
457
+ */
458
+ | {
459
+ op: 'clearHomeLocation';
460
+ }
461
+ /** Irreversible — requires explicit confirmation at execution time. */
462
+ | {
463
+ op: 'delete';
464
+ };
465
+ export interface SemanticOperationPayload {
466
+ operations: SemanticAssetOperation[];
467
+ /** Human-readable restatement, shown on the confirmation card. */
468
+ description: string;
469
+ }
470
+ /** Which rendering of the asset list a saved query opens in. */
471
+ export declare const semanticQueryViewTypes: readonly ["table", "map", "tree"];
472
+ export declare type SemanticQueryViewType = (typeof semanticQueryViewTypes)[number];
473
+ /**
474
+ * Everything a saved list REMEMBERS that is not the query itself — columns,
475
+ * sort, and which rendering it opens in. Populated on save; absent on drafts.
476
+ *
477
+ * This is the home for every property the superseded saved VIEW carried
478
+ * outside its `filters` (contract views/shared.ts): each of `columnVisibility`,
479
+ * `columnOrder`, `sort` and `sortOrder` is here under its own name, so a view
480
+ * converts without losing anything it displayed.
481
+ *
482
+ * Free-text search is deliberately absent, from here and from the conditions
483
+ * alike (ruling, 2026-08-05). It is not a filter over a property and the closed
484
+ * vocabulary has no term for it; it is a live narrowing of whatever is already
485
+ * on screen, and it belongs to the session rather than to the saved query. The
486
+ * legacy view persisted it on `filters.search` — the one member of that object
487
+ * that was never really a filter — and that is the behaviour being dropped.
488
+ */
489
+ export interface SemanticQueryDisplay {
490
+ columnVisibility?: Record<string, boolean>;
491
+ columnOrder?: string[];
492
+ sort?: AssetSortField;
493
+ sortOrder?: SortOrders;
494
+ /** Absent means the client's default rendering. */
495
+ viewType?: SemanticQueryViewType;
496
+ }