@spotto/contract 1.0.70-alpha.9 → 1.0.70-y.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.
Files changed (285) 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 +42 -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 +74 -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/request.d.ts +3 -1
  48. package/dist/ai/index.d.ts +3 -0
  49. package/dist/ai/index.js +3 -0
  50. package/dist/ai/index.js.map +1 -1
  51. package/dist/ai/semantic-query/index.d.ts +2 -0
  52. package/dist/ai/semantic-query/index.js +19 -0
  53. package/dist/ai/semantic-query/index.js.map +1 -0
  54. package/dist/ai/semantic-query/request.d.ts +43 -0
  55. package/dist/ai/semantic-query/request.js +3 -0
  56. package/dist/ai/semantic-query/request.js.map +1 -0
  57. package/dist/ai/semantic-query/response.d.ts +40 -0
  58. package/dist/ai/semantic-query/response.js +3 -0
  59. package/dist/ai/semantic-query/response.js.map +1 -0
  60. package/dist/ai/shared.d.ts +22 -0
  61. package/dist/ai/shared.js +11 -0
  62. package/dist/ai/shared.js.map +1 -0
  63. package/dist/assets/[id]/get.d.ts +2 -1
  64. package/dist/assets/count/query.d.ts +16 -1
  65. package/dist/assets/download/query.d.ts +7 -0
  66. package/dist/assets/get/query.d.ts +11 -0
  67. package/dist/assets/location/request.d.ts +10 -1
  68. package/dist/events/constants.d.ts +16 -1
  69. package/dist/events/constants.js +21 -1
  70. package/dist/events/constants.js.map +1 -1
  71. package/dist/events/get/query.d.ts +25 -0
  72. package/dist/events/get/response.d.ts +17 -1
  73. package/dist/fields/[id]/get.d.ts +3 -0
  74. package/dist/fields/[id]/patch/request.d.ts +4 -0
  75. package/dist/forms/[id]/index.d.ts +1 -0
  76. package/dist/forms/[id]/index.js +18 -0
  77. package/dist/forms/[id]/index.js.map +1 -0
  78. package/dist/forms/[id]/patch/index.d.ts +2 -0
  79. package/dist/forms/[id]/patch/index.js +19 -0
  80. package/dist/forms/[id]/patch/index.js.map +1 -0
  81. package/dist/forms/[id]/patch/request.d.ts +14 -0
  82. package/dist/forms/[id]/patch/request.js +3 -0
  83. package/dist/forms/[id]/patch/request.js.map +1 -0
  84. package/dist/forms/[id]/patch/response.d.ts +1 -0
  85. package/dist/forms/[id]/patch/response.js +3 -0
  86. package/dist/forms/[id]/patch/response.js.map +1 -0
  87. package/dist/forms/constants.d.ts +19 -0
  88. package/dist/forms/constants.js +33 -0
  89. package/dist/forms/constants.js.map +1 -0
  90. package/dist/forms/get/index.d.ts +2 -0
  91. package/dist/forms/get/index.js +19 -0
  92. package/dist/forms/get/index.js.map +1 -0
  93. package/dist/forms/get/query.d.ts +18 -0
  94. package/dist/forms/get/query.js +3 -0
  95. package/dist/forms/get/query.js.map +1 -0
  96. package/dist/forms/get/response.d.ts +23 -0
  97. package/dist/forms/get/response.js +3 -0
  98. package/dist/forms/get/response.js.map +1 -0
  99. package/dist/forms/index.d.ts +6 -0
  100. package/dist/forms/index.js +23 -0
  101. package/dist/forms/index.js.map +1 -0
  102. package/dist/forms/post/index.d.ts +2 -0
  103. package/dist/forms/post/index.js +19 -0
  104. package/dist/forms/post/index.js.map +1 -0
  105. package/dist/forms/post/request.d.ts +9 -0
  106. package/dist/forms/post/request.js +3 -0
  107. package/dist/forms/post/request.js.map +1 -0
  108. package/dist/forms/post/response.d.ts +1 -0
  109. package/dist/forms/post/response.js +3 -0
  110. package/dist/forms/post/response.js.map +1 -0
  111. package/dist/forms/shared.d.ts +127 -0
  112. package/dist/forms/shared.js +3 -0
  113. package/dist/forms/shared.js.map +1 -0
  114. package/dist/forms/versions/index.d.ts +2 -0
  115. package/dist/forms/versions/index.js +19 -0
  116. package/dist/forms/versions/index.js.map +1 -0
  117. package/dist/forms/versions/path.d.ts +8 -0
  118. package/dist/forms/versions/path.js +3 -0
  119. package/dist/forms/versions/path.js.map +1 -0
  120. package/dist/forms/versions/response.d.ts +1 -0
  121. package/dist/forms/versions/response.js +3 -0
  122. package/dist/forms/versions/response.js.map +1 -0
  123. package/dist/index.d.ts +5 -0
  124. package/dist/index.js +5 -0
  125. package/dist/index.js.map +1 -1
  126. package/dist/locations/get/query.d.ts +14 -0
  127. package/dist/organisations/constants.d.ts +11 -0
  128. package/dist/organisations/sso/constants.d.ts +15 -0
  129. package/dist/organisations/sso/constants.js +16 -1
  130. package/dist/organisations/sso/constants.js.map +1 -1
  131. package/dist/organisations/sso/types.d.ts +48 -0
  132. package/dist/readers/get/query.d.ts +12 -0
  133. package/dist/semantic-queries/[id]/index.d.ts +1 -0
  134. package/dist/semantic-queries/[id]/index.js +18 -0
  135. package/dist/semantic-queries/[id]/index.js.map +1 -0
  136. package/dist/semantic-queries/[id]/patch/index.d.ts +2 -0
  137. package/dist/semantic-queries/[id]/patch/index.js +19 -0
  138. package/dist/semantic-queries/[id]/patch/index.js.map +1 -0
  139. package/dist/semantic-queries/[id]/patch/request.d.ts +20 -0
  140. package/dist/semantic-queries/[id]/patch/request.js +3 -0
  141. package/dist/semantic-queries/[id]/patch/request.js.map +1 -0
  142. package/dist/semantic-queries/[id]/patch/response.d.ts +1 -0
  143. package/dist/semantic-queries/[id]/patch/response.js +3 -0
  144. package/dist/semantic-queries/[id]/patch/response.js.map +1 -0
  145. package/dist/semantic-queries/get/index.d.ts +2 -0
  146. package/dist/semantic-queries/get/index.js +19 -0
  147. package/dist/semantic-queries/get/index.js.map +1 -0
  148. package/dist/semantic-queries/get/query.d.ts +18 -0
  149. package/dist/semantic-queries/get/query.js +3 -0
  150. package/dist/semantic-queries/get/query.js.map +1 -0
  151. package/dist/semantic-queries/get/response.d.ts +40 -0
  152. package/dist/semantic-queries/get/response.js +3 -0
  153. package/dist/semantic-queries/get/response.js.map +1 -0
  154. package/dist/semantic-queries/index.d.ts +4 -0
  155. package/dist/semantic-queries/index.js +21 -0
  156. package/dist/semantic-queries/index.js.map +1 -0
  157. package/dist/semantic-queries/post/index.d.ts +2 -0
  158. package/dist/semantic-queries/post/index.js +19 -0
  159. package/dist/semantic-queries/post/index.js.map +1 -0
  160. package/dist/semantic-queries/post/request.d.ts +56 -0
  161. package/dist/semantic-queries/post/request.js +3 -0
  162. package/dist/semantic-queries/post/request.js.map +1 -0
  163. package/dist/semantic-queries/post/response.d.ts +1 -0
  164. package/dist/semantic-queries/post/response.js +3 -0
  165. package/dist/semantic-queries/post/response.js.map +1 -0
  166. package/dist/semantic-queries/shared.d.ts +853 -0
  167. package/dist/semantic-queries/shared.js +318 -0
  168. package/dist/semantic-queries/shared.js.map +1 -0
  169. package/dist/shared/attachments.d.ts +29 -0
  170. package/dist/shared/attachments.js +11 -0
  171. package/dist/shared/attachments.js.map +1 -0
  172. package/dist/shared/embed.d.ts +14 -0
  173. package/dist/shared/index.d.ts +1 -0
  174. package/dist/shared/index.js +1 -0
  175. package/dist/shared/index.js.map +1 -1
  176. package/dist/shared/readiness.d.ts +23 -0
  177. package/dist/snapshots/[id]/get.d.ts +139 -11
  178. package/dist/snapshots/[id]/get.js.map +1 -1
  179. package/dist/snapshots/get/query.d.ts +39 -0
  180. package/dist/snapshots/get/query.js +23 -1
  181. package/dist/snapshots/get/query.js.map +1 -1
  182. package/dist/snapshots/post/request.d.ts +21 -0
  183. package/dist/snapshots/post/request.js.map +1 -1
  184. package/dist/sso/onboard/request.d.ts +12 -1
  185. package/dist/sso/sso-mappings/request.d.ts +10 -5
  186. package/dist/submissions/[id]/index.d.ts +1 -0
  187. package/dist/submissions/[id]/index.js +18 -0
  188. package/dist/submissions/[id]/index.js.map +1 -0
  189. package/dist/submissions/[id]/void/post.d.ts +6 -0
  190. package/dist/submissions/[id]/void/post.js +3 -0
  191. package/dist/submissions/[id]/void/post.js.map +1 -0
  192. package/dist/submissions/constants.d.ts +14 -0
  193. package/dist/submissions/constants.js +21 -0
  194. package/dist/submissions/constants.js.map +1 -0
  195. package/dist/submissions/get/index.d.ts +2 -0
  196. package/dist/submissions/get/index.js +19 -0
  197. package/dist/submissions/get/index.js.map +1 -0
  198. package/dist/submissions/get/query.d.ts +14 -0
  199. package/dist/submissions/get/query.js +3 -0
  200. package/dist/submissions/get/query.js.map +1 -0
  201. package/dist/submissions/get/response.d.ts +6 -0
  202. package/dist/submissions/get/response.js +3 -0
  203. package/dist/submissions/get/response.js.map +1 -0
  204. package/dist/submissions/index.d.ts +6 -0
  205. package/dist/submissions/index.js +23 -0
  206. package/dist/submissions/index.js.map +1 -0
  207. package/dist/submissions/post/index.d.ts +2 -0
  208. package/dist/submissions/post/index.js +19 -0
  209. package/dist/submissions/post/index.js.map +1 -0
  210. package/dist/submissions/post/request.d.ts +17 -0
  211. package/dist/submissions/post/request.js +3 -0
  212. package/dist/submissions/post/request.js.map +1 -0
  213. package/dist/submissions/post/response.d.ts +22 -0
  214. package/dist/submissions/post/response.js +3 -0
  215. package/dist/submissions/post/response.js.map +1 -0
  216. package/dist/submissions/shared.d.ts +133 -0
  217. package/dist/submissions/shared.js +3 -0
  218. package/dist/submissions/shared.js.map +1 -0
  219. package/dist/submissions/uploads/[fileId]/get.d.ts +11 -0
  220. package/dist/submissions/uploads/[fileId]/get.js +3 -0
  221. package/dist/submissions/uploads/[fileId]/get.js.map +1 -0
  222. package/dist/submissions/uploads/[fileId]/index.d.ts +1 -0
  223. package/dist/submissions/uploads/[fileId]/index.js +18 -0
  224. package/dist/submissions/uploads/[fileId]/index.js.map +1 -0
  225. package/dist/submissions/uploads/index.d.ts +2 -0
  226. package/dist/submissions/uploads/index.js +19 -0
  227. package/dist/submissions/uploads/index.js.map +1 -0
  228. package/dist/submissions/uploads/post/index.d.ts +2 -0
  229. package/dist/submissions/uploads/post/index.js +19 -0
  230. package/dist/submissions/uploads/post/index.js.map +1 -0
  231. package/dist/submissions/uploads/post/request.d.ts +9 -0
  232. package/dist/submissions/uploads/post/request.js +3 -0
  233. package/dist/submissions/uploads/post/request.js.map +1 -0
  234. package/dist/submissions/uploads/post/response.d.ts +18 -0
  235. package/dist/submissions/uploads/post/response.js +3 -0
  236. package/dist/submissions/uploads/post/response.js.map +1 -0
  237. package/dist/types/[id]/get.d.ts +3 -1
  238. package/dist/types/[id]/patch/request.d.ts +4 -1
  239. package/dist/types/post/request.d.ts +2 -1
  240. package/dist/types/post/request.js.map +1 -1
  241. package/dist/usergroups/[id]/index.d.ts +1 -0
  242. package/dist/usergroups/[id]/index.js +18 -0
  243. package/dist/usergroups/[id]/index.js.map +1 -0
  244. package/dist/usergroups/[id]/patch/index.d.ts +2 -0
  245. package/dist/usergroups/[id]/patch/index.js +19 -0
  246. package/dist/usergroups/[id]/patch/index.js.map +1 -0
  247. package/dist/usergroups/[id]/patch/request.d.ts +12 -0
  248. package/dist/usergroups/[id]/patch/request.js +3 -0
  249. package/dist/usergroups/[id]/patch/request.js.map +1 -0
  250. package/dist/usergroups/[id]/patch/response.d.ts +1 -0
  251. package/dist/usergroups/[id]/patch/response.js +3 -0
  252. package/dist/usergroups/[id]/patch/response.js.map +1 -0
  253. package/dist/usergroups/get/index.d.ts +2 -0
  254. package/dist/usergroups/get/index.js +19 -0
  255. package/dist/usergroups/get/index.js.map +1 -0
  256. package/dist/usergroups/get/query.d.ts +12 -0
  257. package/dist/usergroups/get/query.js +3 -0
  258. package/dist/usergroups/get/query.js.map +1 -0
  259. package/dist/usergroups/get/response.d.ts +35 -0
  260. package/dist/usergroups/get/response.js +3 -0
  261. package/dist/usergroups/get/response.js.map +1 -0
  262. package/dist/usergroups/index.d.ts +4 -0
  263. package/dist/usergroups/index.js +21 -0
  264. package/dist/usergroups/index.js.map +1 -0
  265. package/dist/usergroups/post/index.d.ts +2 -0
  266. package/dist/usergroups/post/index.js +19 -0
  267. package/dist/usergroups/post/index.js.map +1 -0
  268. package/dist/usergroups/post/request.d.ts +11 -0
  269. package/dist/usergroups/post/request.js +3 -0
  270. package/dist/usergroups/post/request.js.map +1 -0
  271. package/dist/usergroups/post/response.d.ts +1 -0
  272. package/dist/usergroups/post/response.js +3 -0
  273. package/dist/usergroups/post/response.js.map +1 -0
  274. package/dist/usergroups/shared.d.ts +25 -0
  275. package/dist/usergroups/shared.js +11 -0
  276. package/dist/usergroups/shared.js.map +1 -0
  277. package/dist/users/[id]/get/response.d.ts +0 -2
  278. package/dist/users/[id]/patch/request.d.ts +5 -1
  279. package/dist/users/current.d.ts +22 -4
  280. package/dist/users/get/query.d.ts +0 -2
  281. package/dist/users/home-layout/shared.d.ts +96 -21
  282. package/dist/users/home-layout/shared.js +11 -5
  283. package/dist/users/home-layout/shared.js.map +1 -1
  284. package/dist/users/post/request.d.ts +6 -1
  285. package/package.json +2 -2
@@ -0,0 +1,318 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.semanticQuerySortFields = exports.semanticQueryViewTypes = exports.SEMANTIC_QUERY_VERSION = exports.SEMANTIC_QUERY_LIMITS = exports.semanticConditionTypes = exports.semanticConditionTypesByEntity = exports.semanticReaderConditionTypes = exports.semanticSnapshotConditionTypes = exports.semanticEventConditionTypes = exports.semanticLocationConditionTypes = exports.semanticAssetConditionTypes = exports.semanticGroupConditionTypes = exports.semanticReadinessLevels = exports.semanticTelemetryFields = exports.semanticSetOperators = exports.semanticComparisonOperators = exports.semanticTimestampOperators = exports.semanticFieldOperators = exports.semanticRelativeDatePositions = exports.semanticRelativeDateBases = exports.semanticQueryVisibilities = exports.semanticQueryKinds = exports.semanticQueryEntityTypes = void 0;
4
+ /**
5
+ * SEMANTIC QUERIES — the portable query language.
6
+ *
7
+ * A semantic query is a JSON list of typed conditions (ANDed together, nestable
8
+ * with and/or groups) over one entity type. Three parties speak this contract —
9
+ * the client filter UI that builds conditions, the LLM that generates them, and
10
+ * the server compiler that executes them — so this file is the single
11
+ * vocabulary all three encode.
12
+ *
13
+ * THE CLOSED-VOCABULARY RULE. Condition types, operators AND property names are
14
+ * closed sets: validation rejects an unknown property rather than ignoring it,
15
+ * at every level. This is not defensive tidiness — an LLM once invented a
16
+ * `"negate": true` property; ignoring it compiled NOT(X) as X, a query that ran
17
+ * successfully and returned exactly the complement of what was asked. Every
18
+ * defect class this design guards against fails SILENTLY (valid query, wrong
19
+ * rows), which is why an honest rejection always beats a plausible guess.
20
+ *
21
+ * There is deliberately NO general negation (no `not` group, no invertible
22
+ * flag). Expressible negatively: `notExists`, `ne`, `geolocation.exists:false`,
23
+ * `kit.isMember:false`. Anything else must surface as a validation issue,
24
+ * never an approximation.
25
+ *
26
+ * Descends from the G2G Chat prototype (see g2g-client
27
+ * `docs/semantic-query-decisions.md` while it lives, folding into
28
+ * TECHNICAL_DECISIONS.md) and the semantic-query specification errata.
29
+ */
30
+ // --- Entity + record kind -------------------------------------------------
31
+ /**
32
+ * What a semantic query targets. All but `manifest` execute; it is recorded so
33
+ * the classifier can name what it is declining, and so a stored query would
34
+ * never need retrofitting if it ever learns to speak.
35
+ */
36
+ exports.semanticQueryEntityTypes = [
37
+ 'asset',
38
+ 'location',
39
+ 'event',
40
+ 'reader',
41
+ 'snapshot',
42
+ 'manifest',
43
+ ];
44
+ /**
45
+ * What a stored record IS, as opposed to what it targets.
46
+ * - `query` — a selector. Executing it returns rows.
47
+ * - `operation` — a selector PLUS verbs ("move everything matching this to
48
+ * Southport"). Only the DEFINITION is stored; execution belongs
49
+ * to the bulk-operations API when it exists.
50
+ */
51
+ exports.semanticQueryKinds = ['query', 'operation'];
52
+ exports.semanticQueryVisibilities = ['private', 'organisation'];
53
+ // --- Relative dates -------------------------------------------------------
54
+ exports.semanticRelativeDateBases = [
55
+ 'day',
56
+ 'week',
57
+ 'month',
58
+ 'quarter',
59
+ 'year',
60
+ ];
61
+ exports.semanticRelativeDatePositions = ['start', 'end', 'same'];
62
+ // --- Operators ------------------------------------------------------------
63
+ exports.semanticFieldOperators = [
64
+ 'eq',
65
+ 'ne',
66
+ 'gt',
67
+ 'gte',
68
+ 'lt',
69
+ 'lte',
70
+ 'contains',
71
+ 'exists',
72
+ 'notExists',
73
+ ];
74
+ exports.semanticTimestampOperators = ['gt', 'gte', 'lt', 'lte'];
75
+ exports.semanticComparisonOperators = [
76
+ 'eq',
77
+ 'ne',
78
+ 'gt',
79
+ 'gte',
80
+ 'lt',
81
+ 'lte',
82
+ ];
83
+ exports.semanticSetOperators = ['any', 'all'];
84
+ exports.semanticTelemetryFields = [
85
+ 'battery',
86
+ 'temperature',
87
+ 'voltage',
88
+ ];
89
+ /** Readiness severity scale (contract shared/readiness.ts): 0 green, 1 amber, 2 red. */
90
+ exports.semanticReadinessLevels = [0, 1, 2];
91
+ /**
92
+ * Grouping — valid in every entity's vocabulary, because nesting is structure
93
+ * rather than subject matter.
94
+ */
95
+ exports.semanticGroupConditionTypes = ['and', 'or'];
96
+ /**
97
+ * The ASSET vocabulary. Over a third of it is asset-only by nature —
98
+ * `readiness`, `kit`, `withAsset`, `telemetry`, `locationStatus` mean nothing
99
+ * for a reader or a snapshot.
100
+ */
101
+ exports.semanticAssetConditionTypes = [
102
+ ...exports.semanticGroupConditionTypes,
103
+ 'assetType',
104
+ 'location',
105
+ 'homeLocation',
106
+ 'withAsset',
107
+ 'customField',
108
+ 'createdDate',
109
+ 'lastUpdated',
110
+ 'lastChanged',
111
+ 'lastSeen',
112
+ 'firstSeen',
113
+ 'geolocation',
114
+ 'tags',
115
+ 'telemetry',
116
+ 'readiness',
117
+ 'kit',
118
+ 'locationStatus',
119
+ ];
120
+ /**
121
+ * The LOCATION vocabulary.
122
+ *
123
+ * Where a fact is genuinely the same as an asset's, it keeps the same word AND
124
+ * the same meaning — `tags`, `createdDate`, `lastUpdated`, `lastChanged`. That
125
+ * is the naming rule working: one fact stored the same way, sharing one
126
+ * emitter, not two coincidences that agree today.
127
+ *
128
+ * `geolocation` is the exception that proves it needs care. The word means the
129
+ * same thing — "has map coordinates" — but a location has TWO: the coordinates
130
+ * it was configured with, and the ones a moving location last reported
131
+ * (`state.geolocation`, which is what the asset condition reads). This
132
+ * condition means the CONFIGURED position; the observed one belongs to a
133
+ * separate condition if it is ever wanted, rather than being silently folded
134
+ * in here.
135
+ *
136
+ * DELIBERATELY ABSENT: `lastSeen`, `firstSeen` and `telemetry`. The location
137
+ * document declares all three and the parser exposes them, so they were easy
138
+ * to add — but nothing in this repo writes them (the reader/MQTT ingestion
139
+ * does, if anything does), no legacy filter or prototype condition ever
140
+ * offered them, and they could only ever apply to MOVING locations carrying a
141
+ * tracker. A condition over a field that may never be populated is one that
142
+ * runs and confidently returns nothing. They come back the day the ingestion
143
+ * is confirmed to populate them — the emitters are already shared, so it is a
144
+ * list entry and two switch arms.
145
+ *
146
+ * Also absent, and for a different reason: free text. There is no
147
+ * `nameContains` (the prototype had one) because search is a view option
148
+ * platform-wide, not a condition.
149
+ */
150
+ exports.semanticLocationConditionTypes = [
151
+ ...exports.semanticGroupConditionTypes,
152
+ 'path',
153
+ 'locationType',
154
+ 'hasReaders',
155
+ 'geofence',
156
+ 'manifest',
157
+ 'tags',
158
+ 'geolocation',
159
+ 'createdDate',
160
+ 'lastUpdated',
161
+ 'lastChanged',
162
+ ];
163
+ /**
164
+ * The EVENT vocabulary.
165
+ *
166
+ * `location` borrows its WORD from the asset vocabulary but not its meaning:
167
+ * an asset's `location` is where the asset is now, an event's is where the
168
+ * event happened. Same name for the same kind of question, different subject —
169
+ * which is why each entity compiles it against its own field.
170
+ * `occurred` is its own word rather than reusing a timestamp
171
+ * name, because an event has exactly ONE time and calling it `createdDate`
172
+ * would invite the reading that events have several dates the way assets do.
173
+ */
174
+ exports.semanticEventConditionTypes = [
175
+ ...exports.semanticGroupConditionTypes,
176
+ 'occurred',
177
+ 'eventType',
178
+ 'assetType',
179
+ 'location',
180
+ 'reader',
181
+ 'user',
182
+ 'action',
183
+ ];
184
+ /**
185
+ * The SNAPSHOT vocabulary.
186
+ *
187
+ * Full parity with the prototype's six words, plus `assetType` and `reader`,
188
+ * which its descriptor lacked and the platform's flat filters already support.
189
+ *
190
+ * Nothing is withheld here, and that is worth contrasting with events. The
191
+ * prototype matched `asset`, `user` and `manifest` by case-insensitive regex
192
+ * over a denormalised name — the failure the asset vocabulary refuses, three
193
+ * times over. It survives translation intact only because this entity stores
194
+ * real ids for all three, so the honest form costs no capability. Where it
195
+ * could not (a name for `user`), the event ladder already solved it.
196
+ *
197
+ * Absent for the standing reason: free text. No `nameContains` — search is a
198
+ * view option platform-wide, never a stored condition.
199
+ */
200
+ exports.semanticSnapshotConditionTypes = [
201
+ ...exports.semanticGroupConditionTypes,
202
+ 'occurred',
203
+ 'snapshotType',
204
+ 'asset',
205
+ 'assetType',
206
+ 'location',
207
+ 'manifest',
208
+ 'user',
209
+ 'reader',
210
+ ];
211
+ /**
212
+ * The READER vocabulary.
213
+ *
214
+ * Five of the prototype's six words, plus `hasReported` and `hasGeolocation`
215
+ * that it had no form for. The sixth (`nameContains`) is refused above.
216
+ *
217
+ * Note what is NOT here: readers carry no user-group scope, and this
218
+ * vocabulary does not add one. `usergroups/scope.ts` lists them among the
219
+ * surfaces deliberately unscoped in v1, and filtering a set the caller can
220
+ * already read in full reveals nothing new.
221
+ */
222
+ exports.semanticReaderConditionTypes = [
223
+ ...exports.semanticGroupConditionTypes,
224
+ 'deviceType',
225
+ 'readerType',
226
+ 'location',
227
+ 'attachedAsset',
228
+ 'online',
229
+ 'hasReported',
230
+ 'hasGeolocation',
231
+ ];
232
+ /**
233
+ * WHICH WORDS EACH ENTITY KNOWS — the closed vocabulary, per entity.
234
+ *
235
+ * The rule only has teeth if "unknown" is decidable for the entity being
236
+ * queried. In one flat list `{type:'readiness'}` on a location query is a
237
+ * VALID word, so rejecting it would demote to a hand-maintained compatibility
238
+ * table — a second gate that can drift from the first, which is the
239
+ * runs-cleanly-returns-wrong-rows failure this design exists to prevent.
240
+ *
241
+ * It also scopes what the generator is shown: composing a location query, the
242
+ * model never sees `readiness` at all. The prototype's prompt listed
243
+ * conditions it could not supply and the model duly emitted them (finding 12);
244
+ * a shared vocabulary hands that failure to every entity at once.
245
+ *
246
+ * An entity with an EMPTY vocabulary is one the language does not speak yet —
247
+ * every condition is rejected, which is the honest answer while only assets
248
+ * execute. Entities are listed from day one so a stored record never needs
249
+ * retrofitting.
250
+ *
251
+ * Where a concept genuinely coincides across entities it keeps the SAME word
252
+ * (`createdDate` is the same fact everywhere). A domain word is only earned
253
+ * where the meaning differs.
254
+ */
255
+ exports.semanticConditionTypesByEntity = {
256
+ asset: exports.semanticAssetConditionTypes,
257
+ location: exports.semanticLocationConditionTypes,
258
+ event: exports.semanticEventConditionTypes,
259
+ snapshot: exports.semanticSnapshotConditionTypes,
260
+ reader: exports.semanticReaderConditionTypes,
261
+ manifest: [],
262
+ };
263
+ /**
264
+ * Every condition type the language knows, across all entities.
265
+ *
266
+ * This is the BOUNDARY's list — the wire schema checks that a condition names
267
+ * a real word at all, and leaves which-entity-may-use-it to the shared
268
+ * validator, which knows the entity and can say "'readiness' is an asset
269
+ * condition" instead of "not allowed".
270
+ */
271
+ exports.semanticConditionTypes = [
272
+ ...new Set([
273
+ ...exports.semanticAssetConditionTypes,
274
+ ...exports.semanticLocationConditionTypes,
275
+ ...exports.semanticEventConditionTypes,
276
+ ...exports.semanticSnapshotConditionTypes,
277
+ ...exports.semanticReaderConditionTypes,
278
+ ]),
279
+ ];
280
+ /**
281
+ * Query size bounds, shared by the boundary schema (which refuses an oversized
282
+ * query before parsing it) and the compiler (which counts every branch as it
283
+ * walks). Both halves are load-bearing: without the compiler's counting a
284
+ * single `or` could carry thousands of arms, and without the boundary's cap
285
+ * the parse itself is the cost.
286
+ */
287
+ exports.SEMANTIC_QUERY_LIMITS = {
288
+ maxConditions: 50,
289
+ maxDepth: 5,
290
+ };
291
+ // --- The envelope ---------------------------------------------------------
292
+ /** Current wire version of the condition vocabulary. */
293
+ exports.SEMANTIC_QUERY_VERSION = 2;
294
+ // --- Stored-record display config -----------------------------------------
295
+ /** Which rendering of the asset list a saved query opens in. */
296
+ exports.semanticQueryViewTypes = ['table', 'map', 'tree'];
297
+ /**
298
+ * The same list as VALUES, for the boundary schema.
299
+ *
300
+ * Keyed as a Record so the compiler enforces it BOTH ways: a field missing
301
+ * here is a build error, and one that is not a real sort field is too. The
302
+ * validator hand-wrote `searchableSortFields, 'battery', 'ready'` — which was
303
+ * correct when assets were the only entity and became a rejection of every
304
+ * location view the moment they were not. A hand-kept copy of a type is a copy
305
+ * that drifts; this one cannot.
306
+ */
307
+ const SEMANTIC_QUERY_SORT_FIELD_SET = {
308
+ name: true,
309
+ updated: true,
310
+ created: true,
311
+ relevancy: true,
312
+ battery: true,
313
+ ready: true,
314
+ path: true,
315
+ submitted: true,
316
+ };
317
+ exports.semanticQuerySortFields = Object.keys(SEMANTIC_QUERY_SORT_FIELD_SET);
318
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/semantic-queries/shared.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Good-to-Go action attachments — shared API contract shapes.
3
+ *
4
+ * A type offers actions to its assets by attaching them, inherited with
5
+ * field-binding mechanics (a keyed nearest-wins merge — FORMS.md §6): an
6
+ * authored row attaches an action, re-configures an inherited attachment, or
7
+ * detaches it for this type and its descendants.
8
+ */
9
+ /** An authored attachment row on a type (a delta, keyed by action name). */
10
+ export interface IActionAttachment {
11
+ /** Immutable handle of the action being attached, configured or detached. */
12
+ actionName: string;
13
+ /**
14
+ * Offer the action only while this expression is TRUE for the asset.
15
+ * Presentation, not authorization — submit does not re-check it.
16
+ */
17
+ visibleWhen?: string;
18
+ /** Suppress the inherited attachment from this type down. */
19
+ detach?: boolean;
20
+ }
21
+ /** A resolved attachment (own + inherited), on a type's `actionsAll`. */
22
+ export interface IActionAttachmentAll {
23
+ actionName: string;
24
+ /** The action's display label, denormalised at resolve (refreshed on rename). */
25
+ label: string;
26
+ visibleWhen?: string;
27
+ /** Path of the type whose row attached it (provenance, like `fieldsAll`). */
28
+ typePath: string;
29
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /**
3
+ * Good-to-Go action attachments — shared API contract shapes.
4
+ *
5
+ * A type offers actions to its assets by attaching them, inherited with
6
+ * field-binding mechanics (a keyed nearest-wins merge — FORMS.md §6): an
7
+ * authored row attaches an action, re-configures an inherited attachment, or
8
+ * detaches it for this type and its descendants.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ //# sourceMappingURL=attachments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachments.js","sourceRoot":"","sources":["../../src/shared/attachments.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG"}
@@ -1,6 +1,20 @@
1
1
  export interface IEntityMeta {
2
2
  created: number;
3
+ /** The record itself was edited through the APIs. */
3
4
  updated?: number;
5
+ /**
6
+ * ANY system touched the record, including location and telemetry updates —
7
+ * the stamp `?updatedAfter` delta reads filter on.
8
+ *
9
+ * Exposed because a client that cannot SEE it cannot answer with it. The
10
+ * semantic query language has a `lastChanged` condition and the AI is taught
11
+ * to reach for it on "moved / touched / any activity"; the server compiled
12
+ * and ran those queries correctly while the offline client returned zero
13
+ * rows for every one of them, because the field stopped at the response
14
+ * boundary and never reached the cache. Valid query, right answer on one
15
+ * side, silently empty on the other.
16
+ */
17
+ changed?: number;
4
18
  }
5
19
  export interface IEmbeddedEntity {
6
20
  id: string;
@@ -10,3 +10,4 @@ export * from './timezone';
10
10
  export * from './timestamp';
11
11
  export * from './relative-date';
12
12
  export * from './readiness';
13
+ export * from './attachments';
@@ -26,4 +26,5 @@ __exportStar(require("./timezone"), exports);
26
26
  __exportStar(require("./timestamp"), exports);
27
27
  __exportStar(require("./relative-date"), exports);
28
28
  __exportStar(require("./readiness"), exports);
29
+ __exportStar(require("./attachments"), exports);
29
30
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAsB;AACtB,2CAAwB;AACxB,0CAAuB;AACvB,2CAAwB;AACxB,4CAAyB;AACzB,yCAAsB;AACtB,0CAAuB;AACvB,yCAAsB;AACtB,6CAA0B;AAC1B,8CAA2B;AAC3B,kDAA+B;AAC/B,8CAA2B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAsB;AACtB,2CAAwB;AACxB,0CAAuB;AACvB,2CAAwB;AACxB,4CAAyB;AACzB,yCAAsB;AACtB,0CAAuB;AACvB,yCAAsB;AACtB,6CAA0B;AAC1B,8CAA2B;AAC3B,kDAA+B;AAC/B,8CAA2B;AAC3B,gDAA6B"}
@@ -10,6 +10,18 @@
10
10
  export declare type ReadinessLevel = 1 | 2;
11
11
  /** Overall readiness: 0 = ready (green), else the worst issue level. */
12
12
  export declare type ReadinessState = 0 | ReadinessLevel;
13
+ /**
14
+ * A rule's optional remediation tie to an action attached to the same type
15
+ * (FORMS.md §7): when the issue is shown, the UI offers `cta` → runs the
16
+ * action's form against the asset. Discoverable remediation, nothing more —
17
+ * the rule clears identically however the field changes.
18
+ */
19
+ export interface IReadinessRuleAction {
20
+ /** Immutable handle of the linked action (must be in the type's `actionsAll`). */
21
+ actionName: string;
22
+ /** Button label the UI offers on the fired issue. */
23
+ cta: string;
24
+ }
13
25
  /**
14
26
  * An authored readiness rule on a type. `expression` is an excelexp boolean;
15
27
  * when it evaluates TRUE the issue fires at `level` with `message` rendered as
@@ -19,6 +31,7 @@ export interface IReadinessRule {
19
31
  level: ReadinessLevel;
20
32
  expression: string;
21
33
  message: string;
34
+ action?: IReadinessRuleAction;
22
35
  }
23
36
  /**
24
37
  * A resolved rule (own + inherited), carrying the path of the type that
@@ -29,6 +42,11 @@ export interface IReadinessRuleAll extends IReadinessRule {
29
42
  typeId: string;
30
43
  typePath: string;
31
44
  }
45
+ /** The remediation link resolved onto a fired issue at evaluation time. */
46
+ export interface IReadinessIssueAction extends IReadinessRuleAction {
47
+ /** The linked action's display label at evaluation time. */
48
+ label: string;
49
+ }
32
50
  /** A fired readiness issue on an asset. */
33
51
  export interface IReadinessIssue {
34
52
  /** The type that authored the fired rule. */
@@ -47,6 +65,11 @@ export interface IReadinessIssue {
47
65
  * fail closed. Present only when the issue fired on missing data.
48
66
  */
49
67
  missingFields?: string[];
68
+ /**
69
+ * The fired rule's remediation link, stamped at evaluation only while the
70
+ * action is still attached to the asset's type — so it can never dangle.
71
+ */
72
+ action?: IReadinessIssueAction;
50
73
  }
51
74
  /** Stored/returned readiness for an asset. */
52
75
  export interface IReadiness {
@@ -1,4 +1,4 @@
1
- import { IEmbeddedEntity, IEntityMeta } from '../../shared';
1
+ import { IEmbeddedEntity, IEntityMeta, IReadiness } from '../../shared';
2
2
  import { GetManifestResponse, IManifestAsset, IManifestType } from '../../manifests';
3
3
  import { Point } from 'geojson';
4
4
  import { GetTypeResponse, IFieldValue } from '../../types';
@@ -22,18 +22,40 @@ export interface ISnapshotType {
22
22
  typeName?: string;
23
23
  typePath: string;
24
24
  }
25
+ /** A scan recorded as supporting evidence for an inferred parent kit — the
26
+ * child asset whose tag read proved the kit was present. */
27
+ export interface ISnapshotEvidenceAsset {
28
+ assetId: string;
29
+ assetName?: string;
30
+ tagId?: string;
31
+ }
25
32
  export interface ISnapshotDetectedAsset extends ISnapshotType {
26
33
  assetId: string;
27
34
  assetName?: string;
28
35
  section?: string;
29
36
  c_additional?: boolean;
30
37
  fieldValues?: IFieldValue[];
38
+ /** When this entry is a kit inferred from scans of its members rather than
39
+ * a direct tag read, the member scans that evidenced it. */
40
+ evidenceAssets?: ISnapshotEvidenceAsset[];
41
+ /** The user explicitly confirmed this asset has left its current group — a
42
+ * location or Dispatch check honouring `updateGroupMembership` severs it
43
+ * from its parent kit (it becomes a root asset). */
44
+ unGroup?: boolean;
45
+ /** The asset's readiness as it stood on the device at check time — frozen
46
+ * testimony from the submitting client. Absent on snapshots recorded
47
+ * before clients embedded readiness. */
48
+ readiness?: IReadiness;
31
49
  }
32
50
  export interface ISnapshotUndetectedAsset extends ISnapshotType {
33
51
  assetId: string;
34
52
  assetName?: string;
35
53
  section?: string;
36
54
  fieldValues?: IFieldValue[];
55
+ /** The asset's readiness as it stood on the device at check time — frozen
56
+ * testimony from the submitting client. Absent on snapshots recorded
57
+ * before clients embedded readiness. */
58
+ readiness?: IReadiness;
37
59
  }
38
60
  export interface ISnapshotSightedType extends ISnapshotType {
39
61
  section?: string;
@@ -46,12 +68,24 @@ export interface ISnapshotSightedAsset extends ISnapshotType {
46
68
  section?: string;
47
69
  c_ignored?: boolean;
48
70
  fieldValues?: IFieldValue[];
49
- }
50
- export interface ISnapshotUndetectedAsset extends ISnapshotType {
51
- assetId: string;
52
- assetName?: string;
53
- section?: string;
54
- fieldValues?: IFieldValue[];
71
+ /**
72
+ * The user explicitly associated this asset with its manifest item (the
73
+ * spec's "otherwise explicitly associated" act) — authorises the
74
+ * kit-membership sync to move it here out of another kit. Without it a
75
+ * manual confirmation adds the asset only when it is ungrouped.
76
+ */
77
+ selected?: boolean;
78
+ /** When this entry is a kit inferred from scans of its members rather than
79
+ * a direct tag read, the member scans that evidenced it. */
80
+ evidenceAssets?: ISnapshotEvidenceAsset[];
81
+ /** The user explicitly confirmed this asset has left its current group — a
82
+ * location or Dispatch check honouring `updateGroupMembership` severs it
83
+ * from its parent kit (it becomes a root asset). */
84
+ unGroup?: boolean;
85
+ /** The asset's readiness as it stood on the device at check time — frozen
86
+ * testimony from the submitting client. Absent on snapshots recorded
87
+ * before clients embedded readiness. */
88
+ readiness?: IReadiness;
55
89
  }
56
90
  export interface ISnapshotComputed {
57
91
  missingTotal: number;
@@ -76,14 +110,81 @@ export interface ISnapshotComputed {
76
110
  export interface ISnapshotFields {
77
111
  notes?: string;
78
112
  }
113
+ /** One asset touched (or deliberately left alone) by the kit-membership sync. */
114
+ export interface ISnapshotMembershipAsset {
115
+ assetId: string;
116
+ assetName?: string;
117
+ /** For retained entries: the manifest type entry the retention satisfied. */
118
+ typeId?: string;
119
+ section?: string;
120
+ /** For added entries: the membership came from a manual confirmation, not a
121
+ * scan — the tag was never read, so it joins the inspection follow-up list. */
122
+ manuallyConfirmed?: boolean;
123
+ /** For severed entries, and added entries that moved in from another kit:
124
+ * ID of the parent kit the asset left. */
125
+ fromKitId?: string;
126
+ /** For severed entries, and added entries that moved in from another kit:
127
+ * name of the parent kit the asset left. */
128
+ fromKitName?: string;
129
+ /** For severed entries: the sever was honoured although an ancestor of the
130
+ * asset was also seen in the check — an explicit `unGroup` outranks the
131
+ * ancestor guard; flagged so the receipt tells the whole story. */
132
+ ancestorPresent?: boolean;
133
+ }
134
+ export declare type SnapshotMembershipSkipReason = 'NOT_INVENTORY' | 'TARGET_NOT_FOUND' | 'TARGET_NOT_KIT' | 'ASSET_NOT_FOUND' | 'ALREADY_NESTED' | 'WOULD_CYCLE' | 'SIGHTED_IN_OTHER_KIT' | 'SIGHTED_UNRESOLVED' | 'ANCESTOR_SEEN';
135
+ export interface ISnapshotMembershipNotApplied {
136
+ reason: SnapshotMembershipSkipReason;
137
+ assetId?: string;
138
+ assetName?: string;
139
+ typeId?: string;
140
+ typePath?: string;
141
+ section?: string;
142
+ /** SIGHTED_UNRESOLVED: how many manually confirmed instances had no member to retain. */
143
+ count?: number;
144
+ }
145
+ /**
146
+ * Result of synchronising the target kit's direct membership with the
147
+ * submitted manifest (present only when the snapshot requested
148
+ * `syncGroupMembership` — the audit record of what the sync did).
149
+ */
150
+ export interface ISnapshotMembershipSync {
151
+ /** Assets that became direct members (joined or moved in) — by scan, or by
152
+ * manual confirmation of their named line (`manuallyConfirmed: true`). */
153
+ added: ISnapshotMembershipAsset[];
154
+ /** Direct members removed because nothing in the manifest represented them. */
155
+ removed: ISnapshotMembershipAsset[];
156
+ /** Existing members kept without a scan under the manual-confirmation
157
+ * retention rule — the tag-inspection follow-up list. */
158
+ retained: ISnapshotMembershipAsset[];
159
+ /** Membership actions the sync declined, with reasons. */
160
+ notApplied: ISnapshotMembershipNotApplied[];
161
+ /** Assets un-grouped from their previous parent by a location or Dispatch
162
+ * check (`fromKitId`/`fromKitName` record what they left). Absent on
163
+ * snapshots recorded before the generalised sync existed. */
164
+ severed?: ISnapshotMembershipAsset[];
165
+ /** Assets now travelling with the target asset of a carrier check — one
166
+ * whose target is not a kit but is stocktakable. Present (possibly empty)
167
+ * only for that path: a carrier holds no members, so what a check of it
168
+ * states is company, not containment. */
169
+ carried?: ISnapshotMembershipAsset[];
170
+ }
79
171
  export interface GetSnapshotResponse {
80
172
  id: string;
81
- user?: IEmbeddedEntity;
173
+ /** Submitting user; `type` is the account kind (e.g. `INTERNAL`). */
174
+ user?: IEmbeddedEntity & {
175
+ type?: string;
176
+ };
82
177
  reader?: IEmbeddedEntity;
83
178
  location?: IEmbeddedEntity & {
84
179
  path?: string;
85
180
  };
86
- asset?: IEmbeddedEntity & ISnapshotType;
181
+ asset?: IEmbeddedEntity & ISnapshotType & {
182
+ /** The target asset's readiness as the server computed it AFTER
183
+ * processing this snapshot (post membership-sync and manifest-status
184
+ * recompute) — a frozen server annotation, never accepted from
185
+ * clients. */
186
+ c_readiness?: IReadiness;
187
+ };
87
188
  manifest?: GetManifestResponseExtended;
88
189
  detectedAssets?: ISnapshotDetectedAsset[];
89
190
  undetectedAssets?: ISnapshotUndetectedAsset[];
@@ -94,6 +195,20 @@ export interface GetSnapshotResponse {
94
195
  submitted?: number;
95
196
  created: number;
96
197
  meta?: IEntityMeta;
198
+ /** Whether this snapshot asked the server to sync the target kit's direct
199
+ * membership with the manifest result. */
200
+ syncGroupMembership?: boolean;
201
+ /** Whether this snapshot asked the server to update group membership from
202
+ * its evidence (the generalised `updateGroupMembership` flag). */
203
+ updateGroupMembership?: boolean;
204
+ /** What the kit-membership sync did — see `ISnapshotMembershipSync`. */
205
+ membershipSync?: ISnapshotMembershipSync;
206
+ /** The manifest-check verdict this snapshot stamped — three-state: absent
207
+ * means this snapshot never stamped a verdict (it was not a qualifying
208
+ * manifest check); true means it stamped satisfied (0); false means it
209
+ * stamped not satisfied (2). Frozen history: the asset's live status may
210
+ * later change, this flag never does. Server-owned. */
211
+ c_satisfiesManifest?: boolean;
97
212
  geolocation?: Point;
98
213
  timezone?: string;
99
214
  types?: Omit<GetTypeResponse & {
@@ -106,17 +221,30 @@ export interface GetSnapshotResponse {
106
221
  }
107
222
  export interface GetSnapshotsItem {
108
223
  id: string;
109
- user?: IEmbeddedEntity;
224
+ /** Submitting user; `type` is the account kind (e.g. `INTERNAL`). */
225
+ user?: IEmbeddedEntity & {
226
+ type?: string;
227
+ };
110
228
  reader?: IEmbeddedEntity;
111
229
  location?: IEmbeddedEntity & {
112
230
  path?: string;
113
231
  };
114
- asset?: IEmbeddedEntity & ISnapshotType;
232
+ asset?: IEmbeddedEntity & ISnapshotType & {
233
+ /** The target asset's readiness as the server computed it AFTER
234
+ * processing this snapshot — see `GetSnapshotResponse['asset']`.
235
+ * Stored on every annotated snapshot; list rows omit it (detail
236
+ * carries it). */
237
+ c_readiness?: IReadiness;
238
+ };
115
239
  manifest?: IEmbeddedEntity;
116
240
  computed?: ISnapshotComputed;
117
241
  fields?: ISnapshotFields;
118
242
  submitted?: number;
119
243
  created: number;
244
+ /** The manifest-check verdict this snapshot stamped — three-state, see
245
+ * `GetSnapshotResponse['c_satisfiesManifest']`. Present on list rows so
246
+ * the snapshot filters can ask it. */
247
+ c_satisfiesManifest?: boolean;
120
248
  geolocation?: Point;
121
249
  timezone?: string;
122
250
  type: SnapshotTypeEnum;