@segmentstream/ontology 0.0.0-stage → 0.92.1

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 (483) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +2 -0
  3. package/README.md +1655 -2
  4. package/dist/action.d.ts +193 -0
  5. package/dist/action.js +41 -0
  6. package/dist/agent-chat.d.ts +44 -0
  7. package/dist/agent-chat.js +91 -0
  8. package/dist/agent-task-contract.d.ts +64 -0
  9. package/dist/agent-task-contract.js +15 -0
  10. package/dist/agent-task.d.ts +39 -0
  11. package/dist/agent-task.js +112 -0
  12. package/dist/analyze.d.ts +215 -0
  13. package/dist/analyze.js +2438 -0
  14. package/dist/app-feedback.d.ts +167 -0
  15. package/dist/app-feedback.js +176 -0
  16. package/dist/authoring-input.d.ts +3 -0
  17. package/dist/authoring-input.js +107 -0
  18. package/dist/authoring-names.d.ts +4 -0
  19. package/dist/authoring-names.js +13 -0
  20. package/dist/authoring-records.d.ts +35 -0
  21. package/dist/authoring-records.js +264 -0
  22. package/dist/authoring.d.ts +15 -0
  23. package/dist/authoring.js +331 -0
  24. package/dist/bin/check.d.ts +30 -0
  25. package/dist/bin/check.js +99 -0
  26. package/dist/bin/load.d.ts +48 -0
  27. package/dist/bin/load.js +139 -0
  28. package/dist/bin/main.d.ts +31 -0
  29. package/dist/bin/main.js +121 -0
  30. package/dist/bin/migrate.d.ts +57 -0
  31. package/dist/bin/migrate.js +170 -0
  32. package/dist/bin/output.d.ts +31 -0
  33. package/dist/bin/output.js +84 -0
  34. package/dist/bin.d.ts +2 -0
  35. package/dist/bin.js +31 -0
  36. package/dist/blob.d.ts +52 -0
  37. package/dist/blob.js +87 -0
  38. package/dist/channel-session.d.ts +16 -0
  39. package/dist/channel-session.js +16 -0
  40. package/dist/chat.d.ts +43 -0
  41. package/dist/chat.js +34 -0
  42. package/dist/confirmation.d.ts +46 -0
  43. package/dist/confirmation.js +41 -0
  44. package/dist/connection.d.ts +213 -0
  45. package/dist/connection.js +289 -0
  46. package/dist/deployment.d.ts +35 -0
  47. package/dist/deployment.js +76 -0
  48. package/dist/diagnostics.d.ts +27 -0
  49. package/dist/diagnostics.js +106 -0
  50. package/dist/emails.d.ts +70 -0
  51. package/dist/emails.js +221 -0
  52. package/dist/entity.d.ts +331 -0
  53. package/dist/entity.js +153 -0
  54. package/dist/errors.d.ts +154 -0
  55. package/dist/errors.js +109 -0
  56. package/dist/feedback-config.d.ts +24 -0
  57. package/dist/feedback-config.js +126 -0
  58. package/dist/files.d.ts +39 -0
  59. package/dist/files.js +4 -0
  60. package/dist/groups.d.ts +95 -0
  61. package/dist/groups.js +280 -0
  62. package/dist/index.d.ts +109 -0
  63. package/dist/index.js +70 -0
  64. package/dist/internal/diagnostics.js +594 -0
  65. package/dist/legacy.d.ts +160 -0
  66. package/dist/legacy.js +270 -0
  67. package/dist/manifest-compatibility.d.ts +8 -0
  68. package/dist/manifest-compatibility.js +87 -0
  69. package/dist/manifest.d.ts +3329 -0
  70. package/dist/manifest.js +757 -0
  71. package/dist/me.d.ts +46 -0
  72. package/dist/me.js +109 -0
  73. package/dist/metric-filters.d.ts +48 -0
  74. package/dist/metric-filters.js +252 -0
  75. package/dist/metric-routes.d.ts +132 -0
  76. package/dist/metric-routes.js +498 -0
  77. package/dist/metric.d.ts +172 -0
  78. package/dist/metric.js +132 -0
  79. package/dist/migrate/apply.d.ts +94 -0
  80. package/dist/migrate/apply.js +526 -0
  81. package/dist/migrate/errors.d.ts +46 -0
  82. package/dist/migrate/errors.js +38 -0
  83. package/dist/migrate/index.d.ts +10 -0
  84. package/dist/migrate/index.js +7 -0
  85. package/dist/migrate/model.d.ts +2311 -0
  86. package/dist/migrate/model.js +148 -0
  87. package/dist/migrate/plan.d.ts +51 -0
  88. package/dist/migrate/plan.js +1856 -0
  89. package/dist/migrate/preview.d.ts +13 -0
  90. package/dist/migrate/preview.js +65 -0
  91. package/dist/migrate/storage.d.ts +226 -0
  92. package/dist/migrate/storage.js +774 -0
  93. package/dist/model-metrics.d.ts +22 -0
  94. package/dist/model-metrics.js +545 -0
  95. package/dist/names.d.ts +49 -0
  96. package/dist/names.js +110 -0
  97. package/dist/navigation-artifact.d.ts +13 -0
  98. package/dist/navigation-artifact.js +11 -0
  99. package/dist/navigation-catalog.d.ts +55 -0
  100. package/dist/navigation-catalog.js +297 -0
  101. package/dist/nitro-navigation.d.ts +3 -0
  102. package/dist/nitro-navigation.js +64 -0
  103. package/dist/nitro-workflows.d.ts +108 -0
  104. package/dist/nitro-workflows.js +286 -0
  105. package/dist/nitro.d.ts +40 -0
  106. package/dist/nitro.js +50 -0
  107. package/dist/ontology.d.ts +41 -0
  108. package/dist/ontology.js +46 -0
  109. package/dist/permissions.d.ts +198 -0
  110. package/dist/permissions.js +272 -0
  111. package/dist/property.d.ts +188 -0
  112. package/dist/property.js +301 -0
  113. package/dist/query.d.ts +245 -0
  114. package/dist/query.js +615 -0
  115. package/dist/relationship.d.ts +99 -0
  116. package/dist/relationship.js +33 -0
  117. package/dist/render.d.ts +81 -0
  118. package/dist/render.js +512 -0
  119. package/dist/replication/baseline.d.ts +51 -0
  120. package/dist/replication/baseline.js +215 -0
  121. package/dist/replication/bigquery.d.ts +37 -0
  122. package/dist/replication/bigquery.js +211 -0
  123. package/dist/replication/coverage.d.ts +14 -0
  124. package/dist/replication/coverage.js +53 -0
  125. package/dist/replication/evolution.d.ts +25 -0
  126. package/dist/replication/evolution.js +184 -0
  127. package/dist/replication/identities.d.ts +6 -0
  128. package/dist/replication/identities.js +47 -0
  129. package/dist/replication/legacy-baseline.d.ts +27 -0
  130. package/dist/replication/legacy-baseline.js +109 -0
  131. package/dist/replication/legacy-store.d.ts +19 -0
  132. package/dist/replication/legacy-store.js +63 -0
  133. package/dist/replication/lineage.d.ts +36 -0
  134. package/dist/replication/lineage.js +72 -0
  135. package/dist/replication/migrate.d.ts +21 -0
  136. package/dist/replication/migrate.js +84 -0
  137. package/dist/replication/model.d.ts +52 -0
  138. package/dist/replication/model.js +99 -0
  139. package/dist/replication/scans.d.ts +34 -0
  140. package/dist/replication/scans.js +158 -0
  141. package/dist/replication/schema.d.ts +11 -0
  142. package/dist/replication/schema.js +226 -0
  143. package/dist/replication/shadow-schema.d.ts +4 -0
  144. package/dist/replication/shadow-schema.js +61 -0
  145. package/dist/replication/shadow.d.ts +127 -0
  146. package/dist/replication/shadow.js +614 -0
  147. package/dist/replication/source-replacement.d.ts +33 -0
  148. package/dist/replication/source-replacement.js +76 -0
  149. package/dist/replication/store.d.ts +36 -0
  150. package/dist/replication/store.js +382 -0
  151. package/dist/replication/transaction.d.ts +23 -0
  152. package/dist/replication/transaction.js +88 -0
  153. package/dist/role.d.ts +61 -0
  154. package/dist/role.js +76 -0
  155. package/dist/runtime/action-deadlocks.d.ts +21 -0
  156. package/dist/runtime/action-deadlocks.js +130 -0
  157. package/dist/runtime/action-transactions.d.ts +35 -0
  158. package/dist/runtime/action-transactions.js +54 -0
  159. package/dist/runtime/agent-counters.d.ts +26 -0
  160. package/dist/runtime/agent-counters.js +98 -0
  161. package/dist/runtime/agent-tasks.d.ts +63 -0
  162. package/dist/runtime/agent-tasks.js +120 -0
  163. package/dist/runtime/agents.d.ts +15 -0
  164. package/dist/runtime/agents.js +457 -0
  165. package/dist/runtime/batch-diagnostics.d.ts +22 -0
  166. package/dist/runtime/batch-diagnostics.js +89 -0
  167. package/dist/runtime/batch.d.ts +52 -0
  168. package/dist/runtime/batch.js +534 -0
  169. package/dist/runtime/channel-session-revocation.d.ts +3 -0
  170. package/dist/runtime/channel-session-revocation.js +5 -0
  171. package/dist/runtime/channel-sessions.d.ts +4 -0
  172. package/dist/runtime/channel-sessions.js +61 -0
  173. package/dist/runtime/confirmations.d.ts +29 -0
  174. package/dist/runtime/confirmations.js +57 -0
  175. package/dist/runtime/cursor.d.ts +23 -0
  176. package/dist/runtime/cursor.js +100 -0
  177. package/dist/runtime/deployment.d.ts +7 -0
  178. package/dist/runtime/deployment.js +4 -0
  179. package/dist/runtime/errors.d.ts +118 -0
  180. package/dist/runtime/errors.js +109 -0
  181. package/dist/runtime/federation-tables.d.ts +2 -0
  182. package/dist/runtime/federation-tables.js +20 -0
  183. package/dist/runtime/federation.d.ts +42 -0
  184. package/dist/runtime/federation.js +222 -0
  185. package/dist/runtime/files.d.ts +39 -0
  186. package/dist/runtime/files.js +44 -0
  187. package/dist/runtime/generated-actions.d.ts +37 -0
  188. package/dist/runtime/generated-actions.js +307 -0
  189. package/dist/runtime/history.d.ts +91 -0
  190. package/dist/runtime/history.js +77 -0
  191. package/dist/runtime/ids.d.ts +6 -0
  192. package/dist/runtime/ids.js +39 -0
  193. package/dist/runtime/member-tables.d.ts +8 -0
  194. package/dist/runtime/member-tables.js +33 -0
  195. package/dist/runtime/member-writes.d.ts +78 -0
  196. package/dist/runtime/member-writes.js +202 -0
  197. package/dist/runtime/metric-query.d.ts +19 -0
  198. package/dist/runtime/metric-query.js +411 -0
  199. package/dist/runtime/model.d.ts +67 -0
  200. package/dist/runtime/model.js +150 -0
  201. package/dist/runtime/new-user-hook.d.ts +6 -0
  202. package/dist/runtime/new-user-hook.js +37 -0
  203. package/dist/runtime/oauth.d.ts +9 -0
  204. package/dist/runtime/oauth.js +299 -0
  205. package/dist/runtime/pipeline.d.ts +155 -0
  206. package/dist/runtime/pipeline.js +597 -0
  207. package/dist/runtime/postgres-tls.d.ts +10 -0
  208. package/dist/runtime/postgres-tls.js +14 -0
  209. package/dist/runtime/principals.d.ts +302 -0
  210. package/dist/runtime/principals.js +1307 -0
  211. package/dist/runtime/reads.d.ts +55 -0
  212. package/dist/runtime/reads.js +313 -0
  213. package/dist/runtime/records.d.ts +42 -0
  214. package/dist/runtime/records.js +245 -0
  215. package/dist/runtime/resolve-agent-identity.d.ts +6 -0
  216. package/dist/runtime/resolve-agent-identity.js +181 -0
  217. package/dist/runtime/service-binding.d.ts +18 -0
  218. package/dist/runtime/service-binding.js +266 -0
  219. package/dist/runtime/sign-in-links.d.ts +68 -0
  220. package/dist/runtime/sign-in-links.js +147 -0
  221. package/dist/runtime/sql-runtime.d.ts +131 -0
  222. package/dist/runtime/sql-runtime.js +362 -0
  223. package/dist/runtime/statement.d.ts +18 -0
  224. package/dist/runtime/statement.js +31 -0
  225. package/dist/runtime/user-identities.d.ts +66 -0
  226. package/dist/runtime/user-identities.js +106 -0
  227. package/dist/runtime/user-identity-sql.d.ts +86 -0
  228. package/dist/runtime/user-identity-sql.js +297 -0
  229. package/dist/runtime/user-roles.d.ts +16 -0
  230. package/dist/runtime/user-roles.js +32 -0
  231. package/dist/runtime/validation.d.ts +16 -0
  232. package/dist/runtime/validation.js +26 -0
  233. package/dist/runtime/where.d.ts +57 -0
  234. package/dist/runtime/where.js +404 -0
  235. package/dist/runtime/workflow-admission.d.ts +49 -0
  236. package/dist/runtime/workflow-admission.js +92 -0
  237. package/dist/runtime/workflow-argument-codec.d.ts +10 -0
  238. package/dist/runtime/workflow-argument-codec.js +120 -0
  239. package/dist/runtime/workflow-arguments.d.ts +17 -0
  240. package/dist/runtime/workflow-arguments.js +99 -0
  241. package/dist/runtime/workflow-starts.d.ts +203 -0
  242. package/dist/runtime/workflow-starts.js +493 -0
  243. package/dist/runtime/workflow-users.d.ts +9 -0
  244. package/dist/runtime/workflow-users.js +17 -0
  245. package/dist/runtime/workload.d.ts +25 -0
  246. package/dist/runtime/workload.js +24 -0
  247. package/dist/runtime/writes.d.ts +108 -0
  248. package/dist/runtime/writes.js +491 -0
  249. package/dist/runtime-source.d.ts +22 -0
  250. package/dist/runtime-source.js +28 -0
  251. package/dist/runtime.d.ts +310 -0
  252. package/dist/runtime.js +31 -0
  253. package/dist/server.d.ts +23 -0
  254. package/dist/server.js +107 -0
  255. package/dist/service/agent/attachments.d.ts +33 -0
  256. package/dist/service/agent/attachments.js +228 -0
  257. package/dist/service/agent/authentication.d.ts +22 -0
  258. package/dist/service/agent/authentication.js +58 -0
  259. package/dist/service/agent/confirmations.d.ts +5 -0
  260. package/dist/service/agent/confirmations.js +73 -0
  261. package/dist/service/agent/conversation-routes.d.ts +14 -0
  262. package/dist/service/agent/conversation-routes.js +45 -0
  263. package/dist/service/agent/conversations.d.ts +40 -0
  264. package/dist/service/agent/conversations.js +69 -0
  265. package/dist/service/agent/files.d.ts +12 -0
  266. package/dist/service/agent/files.js +69 -0
  267. package/dist/service/agent/protocol.d.ts +90 -0
  268. package/dist/service/agent/protocol.js +114 -0
  269. package/dist/service/agent/server.d.ts +28 -0
  270. package/dist/service/agent/server.js +374 -0
  271. package/dist/service/agent/task-caller.d.ts +21 -0
  272. package/dist/service/agent/task-caller.js +35 -0
  273. package/dist/service/agent/task-start.d.ts +53 -0
  274. package/dist/service/agent/task-start.js +161 -0
  275. package/dist/service/agent/tasks.d.ts +40 -0
  276. package/dist/service/agent/tasks.js +155 -0
  277. package/dist/service/api.d.ts +50 -0
  278. package/dist/service/api.js +288 -0
  279. package/dist/service/authentication.d.ts +227 -0
  280. package/dist/service/authentication.js +767 -0
  281. package/dist/service/caller-context.d.ts +24 -0
  282. package/dist/service/caller-context.js +6 -0
  283. package/dist/service/catalog.d.ts +42 -0
  284. package/dist/service/catalog.js +66 -0
  285. package/dist/service/channel/provider.d.ts +10 -0
  286. package/dist/service/channel/provider.js +1 -0
  287. package/dist/service/channel/providers/telegram.d.ts +18 -0
  288. package/dist/service/channel/providers/telegram.js +108 -0
  289. package/dist/service/channel/sessions.d.ts +5 -0
  290. package/dist/service/channel/sessions.js +53 -0
  291. package/dist/service/channel/sign-in.d.ts +7 -0
  292. package/dist/service/channel/sign-in.js +78 -0
  293. package/dist/service/chat/archive.d.ts +64 -0
  294. package/dist/service/chat/archive.js +62 -0
  295. package/dist/service/chat/attribution.d.ts +26 -0
  296. package/dist/service/chat/attribution.js +28 -0
  297. package/dist/service/chat/delivery.d.ts +18 -0
  298. package/dist/service/chat/delivery.js +251 -0
  299. package/dist/service/chat/diagnostics.d.ts +2 -0
  300. package/dist/service/chat/diagnostics.js +35 -0
  301. package/dist/service/chat/envelope.d.ts +96 -0
  302. package/dist/service/chat/envelope.js +39 -0
  303. package/dist/service/chat/idempotency.d.ts +19 -0
  304. package/dist/service/chat/idempotency.js +37 -0
  305. package/dist/service/chat/providers/telegram.d.ts +36 -0
  306. package/dist/service/chat/providers/telegram.js +133 -0
  307. package/dist/service/chat/reads.d.ts +25 -0
  308. package/dist/service/chat/reads.js +75 -0
  309. package/dist/service/chat/resolve.d.ts +34 -0
  310. package/dist/service/chat/resolve.js +150 -0
  311. package/dist/service/chat/routes.d.ts +23 -0
  312. package/dist/service/chat/routes.js +75 -0
  313. package/dist/service/chat/schemas.d.ts +43 -0
  314. package/dist/service/chat/schemas.js +31 -0
  315. package/dist/service/config.d.ts +218 -0
  316. package/dist/service/config.js +265 -0
  317. package/dist/service/connection-stream.d.ts +10 -0
  318. package/dist/service/connection-stream.js +191 -0
  319. package/dist/service/connections.d.ts +60 -0
  320. package/dist/service/connections.js +271 -0
  321. package/dist/service/decisions.d.ts +35 -0
  322. package/dist/service/decisions.js +63 -0
  323. package/dist/service/descriptions.d.ts +8 -0
  324. package/dist/service/descriptions.js +20 -0
  325. package/dist/service/discovery-schemas.d.ts +92 -0
  326. package/dist/service/discovery-schemas.js +59 -0
  327. package/dist/service/discovery-search.d.ts +30 -0
  328. package/dist/service/discovery-search.js +95 -0
  329. package/dist/service/discovery.d.ts +37 -0
  330. package/dist/service/discovery.js +436 -0
  331. package/dist/service/docs.d.ts +9 -0
  332. package/dist/service/docs.js +197 -0
  333. package/dist/service/errors.d.ts +145 -0
  334. package/dist/service/errors.js +704 -0
  335. package/dist/service/federation-provider.d.ts +36 -0
  336. package/dist/service/federation-provider.js +110 -0
  337. package/dist/service/federation-server.d.ts +20 -0
  338. package/dist/service/federation-server.js +249 -0
  339. package/dist/service/federation-status.d.ts +40 -0
  340. package/dist/service/federation-status.js +151 -0
  341. package/dist/service/handlers.d.ts +18 -0
  342. package/dist/service/handlers.js +287 -0
  343. package/dist/service/mcp/confirmation.d.ts +68 -0
  344. package/dist/service/mcp/confirmation.js +178 -0
  345. package/dist/service/mcp/find-input.d.ts +12 -0
  346. package/dist/service/mcp/find-input.js +122 -0
  347. package/dist/service/mcp/input-schema.d.ts +6 -0
  348. package/dist/service/mcp/input-schema.js +126 -0
  349. package/dist/service/mcp/listing.d.ts +26 -0
  350. package/dist/service/mcp/listing.js +92 -0
  351. package/dist/service/mcp/metric-tools.d.ts +85 -0
  352. package/dist/service/mcp/metric-tools.js +258 -0
  353. package/dist/service/mcp/request-log.d.ts +5 -0
  354. package/dist/service/mcp/request-log.js +53 -0
  355. package/dist/service/mcp/runtime-policy.d.ts +27 -0
  356. package/dist/service/mcp/runtime-policy.js +62 -0
  357. package/dist/service/mcp/server.d.ts +52 -0
  358. package/dist/service/mcp/server.js +861 -0
  359. package/dist/service/mcp/tools.d.ts +99 -0
  360. package/dist/service/mcp/tools.js +938 -0
  361. package/dist/service/member-file-routes.d.ts +22 -0
  362. package/dist/service/member-file-routes.js +52 -0
  363. package/dist/service/member-files.d.ts +245 -0
  364. package/dist/service/member-files.js +258 -0
  365. package/dist/service/metric-query-platform.d.ts +77 -0
  366. package/dist/service/metric-query-platform.js +198 -0
  367. package/dist/service/metric-query-scopes.d.ts +43 -0
  368. package/dist/service/metric-query-scopes.js +147 -0
  369. package/dist/service/metric-query.d.ts +48 -0
  370. package/dist/service/metric-query.js +200 -0
  371. package/dist/service/name-suggestions.d.ts +3 -0
  372. package/dist/service/name-suggestions.js +38 -0
  373. package/dist/service/navigation-schemas.d.ts +80 -0
  374. package/dist/service/navigation-schemas.js +49 -0
  375. package/dist/service/navigation.d.ts +20 -0
  376. package/dist/service/navigation.js +165 -0
  377. package/dist/service/oauth/protocol.d.ts +70 -0
  378. package/dist/service/oauth/protocol.js +157 -0
  379. package/dist/service/oauth/refresh-replay.d.ts +2 -0
  380. package/dist/service/oauth/refresh-replay.js +20 -0
  381. package/dist/service/oauth/server.d.ts +28 -0
  382. package/dist/service/oauth/server.js +769 -0
  383. package/dist/service/operations.d.ts +170 -0
  384. package/dist/service/operations.js +392 -0
  385. package/dist/service/plan.d.ts +57 -0
  386. package/dist/service/plan.js +96 -0
  387. package/dist/service/rate-limit.d.ts +22 -0
  388. package/dist/service/rate-limit.js +52 -0
  389. package/dist/service/record-reads.d.ts +21 -0
  390. package/dist/service/record-reads.js +155 -0
  391. package/dist/service/replication.d.ts +5 -0
  392. package/dist/service/replication.js +39 -0
  393. package/dist/service/runtime-contract.d.ts +508 -0
  394. package/dist/service/runtime-contract.js +18 -0
  395. package/dist/service/runtime-identity.d.ts +71 -0
  396. package/dist/service/runtime-identity.js +122 -0
  397. package/dist/service/schemas.d.ts +961 -0
  398. package/dist/service/schemas.js +639 -0
  399. package/dist/service/service.d.ts +21 -0
  400. package/dist/service/service.js +526 -0
  401. package/dist/service/warehouse-platform.d.ts +17 -0
  402. package/dist/service/warehouse-platform.js +122 -0
  403. package/dist/service/warehouse-query.d.ts +24 -0
  404. package/dist/service/warehouse-query.js +280 -0
  405. package/dist/service/webhooks.d.ts +106 -0
  406. package/dist/service/webhooks.js +233 -0
  407. package/dist/service/workflow-admission-provider.d.ts +31 -0
  408. package/dist/service/workflow-admission-provider.js +205 -0
  409. package/dist/service/workflow-argument-serialization.d.ts +2 -0
  410. package/dist/service/workflow-argument-serialization.js +14 -0
  411. package/dist/service/workflow-callback.d.ts +22 -0
  412. package/dist/service/workflow-callback.js +75 -0
  413. package/dist/service/workflow-deployment.d.ts +8 -0
  414. package/dist/service/workflow-deployment.js +131 -0
  415. package/dist/service/workflow-diagnostics.d.ts +23 -0
  416. package/dist/service/workflow-diagnostics.js +263 -0
  417. package/dist/service/workflow-errors.d.ts +26 -0
  418. package/dist/service/workflow-errors.js +181 -0
  419. package/dist/service/workflow-logging.d.ts +2 -0
  420. package/dist/service/workflow-logging.js +50 -0
  421. package/dist/service/workflow-queue-fence.d.ts +6 -0
  422. package/dist/service/workflow-queue-fence.js +66 -0
  423. package/dist/service/workflows.d.ts +200 -0
  424. package/dist/service/workflows.js +1549 -0
  425. package/dist/sign-in.d.ts +58 -0
  426. package/dist/sign-in.js +57 -0
  427. package/dist/source.d.ts +30 -0
  428. package/dist/source.js +107 -0
  429. package/dist/start-recovery-contract.d.ts +49 -0
  430. package/dist/start-recovery-contract.js +26 -0
  431. package/dist/start-recovery.d.ts +27 -0
  432. package/dist/start-recovery.js +81 -0
  433. package/dist/storage/api.d.ts +4 -0
  434. package/dist/storage/api.js +40 -0
  435. package/dist/storage/attachments.d.ts +146 -0
  436. package/dist/storage/attachments.js +733 -0
  437. package/dist/storage/authorization.d.ts +38 -0
  438. package/dist/storage/authorization.js +83 -0
  439. package/dist/storage/file-access.d.ts +17 -0
  440. package/dist/storage/file-access.js +8 -0
  441. package/dist/storage/limits.d.ts +12 -0
  442. package/dist/storage/limits.js +17 -0
  443. package/dist/storage/maintenance-auth.d.ts +20 -0
  444. package/dist/storage/maintenance-auth.js +24 -0
  445. package/dist/storage/maintenance.d.ts +11 -0
  446. package/dist/storage/maintenance.js +67 -0
  447. package/dist/storage/neon.d.ts +4 -0
  448. package/dist/storage/neon.js +318 -0
  449. package/dist/storage/operator.d.ts +11 -0
  450. package/dist/storage/operator.js +30 -0
  451. package/dist/storage/provider.d.ts +93 -0
  452. package/dist/storage/provider.js +36 -0
  453. package/dist/storage/sessions.d.ts +184 -0
  454. package/dist/storage/sessions.js +688 -0
  455. package/dist/storage/tables.d.ts +54 -0
  456. package/dist/storage/tables.js +205 -0
  457. package/dist/storage/transfers.d.ts +16 -0
  458. package/dist/storage/transfers.js +153 -0
  459. package/dist/storage/writes.d.ts +7 -0
  460. package/dist/storage/writes.js +88 -0
  461. package/dist/telegram.d.ts +35 -0
  462. package/dist/telegram.js +173 -0
  463. package/dist/user-identity.d.ts +28 -0
  464. package/dist/user-identity.js +106 -0
  465. package/dist/user.d.ts +75 -0
  466. package/dist/user.js +111 -0
  467. package/dist/warehouse-backed.d.ts +6 -0
  468. package/dist/warehouse-backed.js +495 -0
  469. package/dist/webhook-token.d.ts +11 -0
  470. package/dist/webhook-token.js +18 -0
  471. package/dist/webhooks.d.ts +40 -0
  472. package/dist/webhooks.js +55 -0
  473. package/dist/wire.d.ts +10 -0
  474. package/dist/wire.js +35 -0
  475. package/dist/workflow-runtime.d.ts +116 -0
  476. package/dist/workflow-runtime.js +109 -0
  477. package/dist/workflow-topics.d.ts +28 -0
  478. package/dist/workflow-topics.js +28 -0
  479. package/dist/workflow.d.ts +284 -0
  480. package/dist/workflow.js +259 -0
  481. package/dist/workflows.d.ts +24 -0
  482. package/dist/workflows.js +18 -0
  483. package/package.json +127 -4
@@ -0,0 +1,301 @@
1
+ import { Schema } from "effect";
2
+ import { humanize } from "./names.js";
3
+ import { BlobValue, MAX_BLOB_BYTES } from "./blob.js";
4
+ import { nameToWire } from "./authoring-names.js";
5
+ /** The closed set of storage types. Each has a known column, JSON Schema, filters and rendering. */
6
+ export const PROPERTY_TYPES = [
7
+ "text",
8
+ "email",
9
+ "url",
10
+ "integer",
11
+ "number",
12
+ "boolean",
13
+ "date",
14
+ "timestamp",
15
+ "select",
16
+ "json",
17
+ "blob",
18
+ "list",
19
+ ];
20
+ /** Schema annotation that carries a property's storage metadata. */
21
+ export const PROPERTY_ANNOTATION = "segmentstream/ontology/property";
22
+ /**
23
+ * Schema annotation that marks a record reference in an action input. It is emitted into the input's
24
+ * JSON Schema so that consumers can offer a record picker.
25
+ */
26
+ export const REFERENCE_ANNOTATION = "x-ontology-ref";
27
+ /**
28
+ * An email address: a local part, one `@`, and a domain of dot-separated labels. The labels exclude
29
+ * the dot that separates them, so no two parts of the pattern can match the same characters and it
30
+ * runs in linear time on any input.
31
+ */
32
+ export const EMAIL_PATTERN = /^[^\s@]+@[^\s@.]+(?:\.[^\s@.]+)+$/;
33
+ const URL_PATTERN = /^https?:\/\/\S+$/;
34
+ const DATE = /^\d{4}-\d{2}-\d{2}$/;
35
+ const TIMESTAMP = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/;
36
+ const UUID = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
37
+ /** The options every property constructor takes. */
38
+ const COMMON_OPTIONS = [
39
+ "column",
40
+ "scope",
41
+ "optional",
42
+ "default",
43
+ "unique",
44
+ "label",
45
+ "description",
46
+ "renamedFrom",
47
+ "managed",
48
+ "display",
49
+ ];
50
+ /** The options a constructor takes beyond {@link COMMON_OPTIONS}, by property type. */
51
+ const TYPE_OPTIONS = {
52
+ text: ["maxLength"],
53
+ integer: ["min", "max"],
54
+ number: ["min", "max"],
55
+ blob: ["accept", "maxBytes"],
56
+ };
57
+ const unknownOptions = new WeakMap();
58
+ /**
59
+ * The options a property was given that its constructor does not take, such as `minimum` for
60
+ * `p.integer`, which takes `min`. TypeScript refuses them in a literal; `check` reports them for
61
+ * code that is evaluated without type checking.
62
+ */
63
+ export function unknownPropertyOptions(value) {
64
+ return (typeof value === "object" || typeof value === "function") && value !== null
65
+ ? (unknownOptions.get(value) ?? [])
66
+ : [];
67
+ }
68
+ /** Keeps the unknown options of a property on the schema the SDK rebuilt it as. */
69
+ export function inheritUnknownOptions(from, to) {
70
+ const unknown = unknownPropertyOptions(from);
71
+ if (unknown.length > 0 && (typeof to === "object" || typeof to === "function") && to !== null) {
72
+ unknownOptions.set(to, unknown);
73
+ }
74
+ }
75
+ /** What a constructor takes, for the message that names an unknown option. */
76
+ export function propertyOptionNames(type) {
77
+ return [...COMMON_OPTIONS, ...(TYPE_OPTIONS[type] ?? [])];
78
+ }
79
+ function construct({ type, base, options, checks = [], format, selectOptions, items, }) {
80
+ const definition = {
81
+ type,
82
+ ...(options.column !== undefined ? { column: options.column } : {}),
83
+ ...(options.scope !== undefined ? { scope: options.scope } : {}),
84
+ optional: options.optional === true,
85
+ unique: options.unique === true,
86
+ managed: options.managed === true,
87
+ ...(options.default !== undefined ? { default: options.default } : {}),
88
+ ...(options.label !== undefined ? { label: options.label } : {}),
89
+ ...(options.description !== undefined ? { description: options.description } : {}),
90
+ ...(options.renamedFrom !== undefined ? { renamedFrom: options.renamedFrom } : {}),
91
+ ...(options.display !== undefined ? { display: options.display } : {}),
92
+ ...(options.min !== undefined ? { min: options.min } : {}),
93
+ ...(options.max !== undefined ? { max: options.max } : {}),
94
+ ...(options.maxLength !== undefined ? { maxLength: options.maxLength } : {}),
95
+ ...(options.accept !== undefined ? { accept: options.accept } : {}),
96
+ ...(options.maxBytes !== undefined ? { maxBytes: options.maxBytes } : {}),
97
+ ...(selectOptions !== undefined ? { options: selectOptions } : {}),
98
+ ...(items !== undefined ? { items } : {}),
99
+ };
100
+ // Annotations go on the base node, before the checks, so that the JSON Schema keeps them at the top
101
+ // level and readers find the definition in `ast.annotations`.
102
+ const annotated = base.annotate({
103
+ ...(options.label !== undefined ? { title: options.label } : {}),
104
+ ...(options.description !== undefined ? { description: options.description } : {}),
105
+ ...(format !== undefined ? { format } : {}),
106
+ [PROPERTY_ANNOTATION]: definition,
107
+ });
108
+ const [firstCheck, ...otherChecks] = checks;
109
+ const checked = firstCheck === undefined ? annotated : annotated.check(firstCheck, ...otherChecks);
110
+ const result = definition.optional ? Schema.optionalKey(checked) : checked;
111
+ const allowed = new Set(propertyOptionNames(type));
112
+ const unknown = Object.keys(options).filter((key) => !allowed.has(key));
113
+ if (unknown.length > 0) {
114
+ unknownOptions.set(result, unknown);
115
+ unknownOptions.set(checked, unknown);
116
+ }
117
+ return result;
118
+ }
119
+ function rangeChecks(options) {
120
+ return [
121
+ ...(options.min !== undefined ? [Schema.isGreaterThanOrEqualTo(options.min)] : []),
122
+ ...(options.max !== undefined ? [Schema.isLessThanOrEqualTo(options.max)] : []),
123
+ ];
124
+ }
125
+ function text(options) {
126
+ const settings = options ?? {};
127
+ const checks = settings.maxLength !== undefined ? [Schema.isMaxLength(settings.maxLength)] : [];
128
+ return construct({ type: "text", base: Schema.String, options: settings, checks });
129
+ }
130
+ function email(options) {
131
+ return construct({
132
+ type: "email",
133
+ base: Schema.String,
134
+ options: options ?? {},
135
+ checks: [Schema.isPattern(EMAIL_PATTERN)],
136
+ format: "email",
137
+ });
138
+ }
139
+ function url(options) {
140
+ return construct({
141
+ type: "url",
142
+ base: Schema.String,
143
+ options: options ?? {},
144
+ checks: [Schema.isPattern(URL_PATTERN)],
145
+ format: "uri",
146
+ });
147
+ }
148
+ function integer(options) {
149
+ const settings = options ?? {};
150
+ return construct({
151
+ type: "integer",
152
+ base: Schema.Int,
153
+ options: settings,
154
+ checks: rangeChecks(settings),
155
+ });
156
+ }
157
+ function number(options) {
158
+ const settings = options ?? {};
159
+ return construct({
160
+ type: "number",
161
+ base: Schema.Finite,
162
+ options: settings,
163
+ checks: rangeChecks(settings),
164
+ });
165
+ }
166
+ function boolean(options) {
167
+ return construct({ type: "boolean", base: Schema.Boolean, options: options ?? {} });
168
+ }
169
+ /** A calendar date as `YYYY-MM-DD`. */
170
+ function date(options) {
171
+ return construct({
172
+ type: "date",
173
+ base: Schema.String,
174
+ options: options ?? {},
175
+ checks: [Schema.isPattern(DATE)],
176
+ format: "date",
177
+ });
178
+ }
179
+ /** An instant as an ISO 8601 string with a time zone, for example `2026-10-04T09:30:00Z`. */
180
+ function timestamp(options) {
181
+ return construct({
182
+ type: "timestamp",
183
+ base: Schema.String,
184
+ options: options ?? {},
185
+ checks: [Schema.isPattern(TIMESTAMP)],
186
+ format: "date-time",
187
+ });
188
+ }
189
+ /**
190
+ * One of a closed set of described values. Each option becomes its own JSON Schema branch with its
191
+ * label as `title` and its description, so that agents see what every value means.
192
+ */
193
+ function select(options, settings) {
194
+ const selectOptions = options.map((option) => {
195
+ if (typeof option === "string") {
196
+ return { value: option, label: humanize(option) };
197
+ }
198
+ return {
199
+ value: option.value,
200
+ label: option.label ?? humanize(option.value),
201
+ description: option.description,
202
+ };
203
+ });
204
+ const members = selectOptions.map((option) => Schema.Literal(option.value).annotate({
205
+ title: option.label,
206
+ ...(option.description !== undefined ? { description: option.description } : {}),
207
+ }));
208
+ return construct({
209
+ type: "select",
210
+ base: Schema.Union(members),
211
+ options: settings ?? {},
212
+ selectOptions,
213
+ });
214
+ }
215
+ /** Any JSON value. */
216
+ function json(options) {
217
+ return construct({ type: "json", base: Schema.Json, options: options ?? {} });
218
+ }
219
+ /**
220
+ * A reference to a record of an entity, by id, for action inputs. Relationships between entities
221
+ * are declared with `rel.one` and `rel.many`, not with references.
222
+ */
223
+ function ref(target, options) {
224
+ const entityName = typeof target === "string" ? target : target.name;
225
+ const settings = options ?? {};
226
+ const schema = Schema.String.annotate({
227
+ ...(settings.label !== undefined ? { title: settings.label } : {}),
228
+ description: settings.description ?? `The id of a ${entityName} record.`,
229
+ format: "uuid",
230
+ [REFERENCE_ANNOTATION]: nameToWire(entityName),
231
+ }).check(Schema.isPattern(UUID));
232
+ return (settings.optional === true ? Schema.optionalKey(schema) : schema);
233
+ }
234
+ function blob(options) {
235
+ const settings = options ?? {};
236
+ return construct({
237
+ type: "blob",
238
+ base: BlobValue,
239
+ options: {
240
+ ...settings,
241
+ accept: settings.accept ?? ["*/*"],
242
+ maxBytes: settings.maxBytes ?? MAX_BLOB_BYTES,
243
+ },
244
+ });
245
+ }
246
+ /**
247
+ * A list of values of one property type, read-only and kept by the platform. Only the built-in
248
+ * `User` has one, `roles`, which the runtime reads from the role assignments beside the table:
249
+ * `check` refuses a list on any other entity, so no table has an array column and no action
250
+ * writes one. Filters take `has` and `hasAny`; a list cannot be sorted on.
251
+ */
252
+ function list(item, options) {
253
+ const itemType = propertyDefinition(item)?.type ?? "text";
254
+ return construct({
255
+ type: "list",
256
+ base: Schema.Array(item),
257
+ options,
258
+ items: itemType,
259
+ });
260
+ }
261
+ export const p = {
262
+ text,
263
+ email,
264
+ url,
265
+ integer,
266
+ number,
267
+ boolean,
268
+ date,
269
+ timestamp,
270
+ select,
271
+ json,
272
+ blob,
273
+ list,
274
+ ref,
275
+ };
276
+ function findAnnotation(ast, key) {
277
+ if (ast.annotations !== undefined && key in ast.annotations) {
278
+ return ast.annotations[key];
279
+ }
280
+ for (const check of ast.checks ?? []) {
281
+ if (check.annotations !== undefined && key in check.annotations) {
282
+ return check.annotations[key];
283
+ }
284
+ }
285
+ return undefined;
286
+ }
287
+ /** The storage metadata of a schema built with a `p.*` constructor, or `undefined` for any other value. */
288
+ export function propertyDefinition(value) {
289
+ if (!Schema.isSchema(value)) {
290
+ return undefined;
291
+ }
292
+ return findAnnotation(value.ast, PROPERTY_ANNOTATION);
293
+ }
294
+ /** The entity a `p.ref` schema points at, or `undefined` for any other value. */
295
+ export function referenceTarget(value) {
296
+ if (!Schema.isSchema(value)) {
297
+ return undefined;
298
+ }
299
+ const target = findAnnotation(value.ast, REFERENCE_ANNOTATION);
300
+ return typeof target === "string" ? target : undefined;
301
+ }
@@ -0,0 +1,245 @@
1
+ import { Schema } from "effect";
2
+ import type { JsonSchemaObject } from "./analyze.js";
3
+ import { type EntityManifest, type OntologyManifest } from "./manifest.js";
4
+ import type { PropertyType } from "./property.js";
5
+ /** How a record field is stored: a property type, or a UUID for ids and `<relationship>_id` keys. */
6
+ export type StorageType = PropertyType | "uuid";
7
+ /**
8
+ * The query language of `find` and of the HTTP API's list and query endpoints.
9
+ *
10
+ * ```json
11
+ * {
12
+ * "where": {
13
+ * "status": { "in": ["new", "contacted"] },
14
+ * "owner": { "email": { "eq": "ada@example.com" } },
15
+ * "tags": { "some": { "name": { "eq": "priority" } } },
16
+ * "or": [{ "fitScore": { "gte": 80 } }, { "source": "pilot_request" }]
17
+ * },
18
+ * "orderBy": [{ "field": "created_at", "direction": "desc" }],
19
+ * "include": ["owner"],
20
+ * "limit": 50
21
+ * }
22
+ * ```
23
+ *
24
+ * {@link Query} checks the structure for any entity; {@link entityQuerySchema} builds the precise
25
+ * schema of one entity from the manifest, with its fields, their operators and its relationships.
26
+ * The runtime validates every query with the precise schema. `include` also takes the object form
27
+ * `{ "owner": true }`, which a list of names decodes into.
28
+ */
29
+ export declare const DEFAULT_QUERY_LIMIT = 50;
30
+ export declare const MAX_QUERY_LIMIT = 200;
31
+ /** The most values an `in` filter takes. */
32
+ export declare const MAX_IN_VALUES = 1000;
33
+ /** Filter operators. A field's type decides which apply; see {@link entityQuerySchema}. */
34
+ export declare const FILTER_OPERATORS: readonly ["eq", "ne", "in", "isNull", "contains", "startsWith", "gt", "gte", "lt", "lte", "between"];
35
+ export type FilterOperator = (typeof FILTER_OPERATORS)[number];
36
+ /** Filter operators of a list field: it holds the value, or any of the values. */
37
+ export declare const LIST_FILTER_OPERATORS: readonly ["has", "hasAny"];
38
+ export type ListFilterOperator = (typeof LIST_FILTER_OPERATORS)[number];
39
+ /** Combinators of a `where`. They take the place of field names. */
40
+ export declare const WHERE_COMBINATORS: readonly ["and", "or", "not"];
41
+ /** Quantifiers of a filter on a to-many relationship. */
42
+ export declare const MANY_QUANTIFIERS: readonly ["some", "none", "every"];
43
+ /**
44
+ * Conditions on one field; all of them must hold. `ne` matches records where the field is empty;
45
+ * `contains` and `startsWith` ignore case; `between` includes both ends. In a `where`, a bare value
46
+ * stands for `{ eq: value }` and `null` for `{ isNull: true }`. A list field takes only `has` and
47
+ * `hasAny`.
48
+ */
49
+ export interface FieldFilter {
50
+ readonly eq?: Schema.Json;
51
+ readonly ne?: Schema.Json;
52
+ readonly in?: ReadonlyArray<Schema.Json>;
53
+ readonly isNull?: boolean;
54
+ readonly contains?: string;
55
+ readonly startsWith?: string;
56
+ readonly gt?: number | string;
57
+ readonly gte?: number | string;
58
+ readonly lt?: number | string;
59
+ readonly lte?: number | string;
60
+ readonly between?: readonly [number | string, number | string];
61
+ /** A list field holds the value. */
62
+ readonly has?: string;
63
+ /** A list field holds at least one of the values; none matches nothing. */
64
+ readonly hasAny?: ReadonlyArray<string>;
65
+ }
66
+ /** A filter on a to-many relationship: some, none or every related record matches. */
67
+ export interface ManyFilter {
68
+ readonly some?: Where;
69
+ readonly none?: Where;
70
+ readonly every?: Where;
71
+ }
72
+ /**
73
+ * Conditions on a record, all of which must hold: field filters by field name, relationship
74
+ * filters by relationship name (a `where` on the target for to-one, a {@link ManyFilter} for
75
+ * to-many), and the `and`, `or` and `not` combinators.
76
+ */
77
+ export interface Where {
78
+ readonly and?: ReadonlyArray<Where>;
79
+ readonly or?: ReadonlyArray<Where>;
80
+ readonly not?: Where;
81
+ readonly [field: string]: FieldFilter | ManyFilter | Where | ReadonlyArray<Where> | Schema.Json | undefined;
82
+ }
83
+ export declare const SortDirection: Schema.Literals<readonly ["asc", "desc"]>;
84
+ export type SortDirection = typeof SortDirection.Type;
85
+ export declare const OrderBy: Schema.Struct<{
86
+ readonly field: Schema.String;
87
+ readonly direction: Schema.optionalKey<Schema.Literals<readonly ["asc", "desc"]>>;
88
+ }>;
89
+ export type OrderBy = typeof OrderBy.Type;
90
+ /** The relationships to include, once decoded: `{ owner: true, tags: true }`. */
91
+ export type Included = {
92
+ readonly [relationship: string]: true;
93
+ };
94
+ /** Whether an `include` is the list form, `["owner", "tags"]`. */
95
+ export declare function isIncludeList<L extends string>(include: ReadonlyArray<L> | object): include is ReadonlyArray<L>;
96
+ /** The relationship names an `include` lists, in either form. */
97
+ export declare function includedRelationships(include: Query["include"]): ReadonlyArray<string>;
98
+ /** A query on any entity. The runtime checks the fields against the entity. */
99
+ export declare const Query: Schema.Struct<{
100
+ readonly where: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
101
+ readonly orderBy: Schema.optionalKey<Schema.$Array<Schema.Struct<{
102
+ readonly field: Schema.String;
103
+ readonly direction: Schema.optionalKey<Schema.Literals<readonly ["asc", "desc"]>>;
104
+ }>>>;
105
+ readonly select: Schema.optionalKey<Schema.$Array<Schema.String>>;
106
+ readonly include: Schema.optionalKey<Schema.Codec<Included, readonly string[] | Included, never, never>>;
107
+ readonly after: Schema.optionalKey<Schema.String>;
108
+ readonly limit: Schema.optionalKey<Schema.Int>;
109
+ }>;
110
+ /**
111
+ * A query. `where` follows {@link Where}; `include` adds related records by relationship name, as a
112
+ * list, `["owner", "tags"]`, or as an object, `{ owner: true, tags: true }`.
113
+ */
114
+ export interface Query {
115
+ readonly where?: Where;
116
+ readonly orderBy?: ReadonlyArray<OrderBy>;
117
+ /** Base-record fields to return. The id is always returned; includes remain separate. */
118
+ readonly select?: ReadonlyArray<string>;
119
+ readonly include?: ReadonlyArray<string> | Included;
120
+ readonly after?: string;
121
+ readonly limit?: number;
122
+ }
123
+ /** A page of records. `nextCursor` is `null` on the last page. */
124
+ export interface QueryResult<R> {
125
+ readonly items: ReadonlyArray<R>;
126
+ readonly nextCursor: string | null;
127
+ /** Present only for an explicitly projected record query. */
128
+ readonly projected?: true;
129
+ }
130
+ /** A page of records of any entity. */
131
+ export declare const QueryResult: Schema.Struct<{
132
+ readonly items: Schema.$Array<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
133
+ readonly nextCursor: Schema.NullOr<Schema.String>;
134
+ readonly projected: Schema.optionalKey<Schema.Literal<true>>;
135
+ }>;
136
+ /** A page of records described by `record`. */
137
+ export declare function queryResultSchema<S extends Schema.Top>(record: S): Schema.Struct<{
138
+ readonly items: Schema.$Array<S>;
139
+ readonly nextCursor: Schema.NullOr<Schema.String>;
140
+ }>;
141
+ /** Full pages keep their complete record contract; projections carry an explicit marker. */
142
+ export declare function projectedQueryResultSchema(record: Schema.Top, projection: Schema.Top, wire?: boolean): Schema.Union<readonly [Schema.encodeKeys<Schema.Struct<{
143
+ readonly items: Schema.$Array<Schema.Top>;
144
+ readonly nextCursor: Schema.NullOr<Schema.String>;
145
+ readonly projected: Schema.optionalKey<Schema.Never>;
146
+ }>, {
147
+ readonly nextCursor: "next_cursor";
148
+ }>, Schema.encodeKeys<Schema.Struct<{
149
+ readonly items: Schema.$Array<Schema.Top>;
150
+ readonly nextCursor: Schema.NullOr<Schema.String>;
151
+ readonly projected: Schema.Literal<true>;
152
+ }>, {
153
+ readonly nextCursor: "next_cursor";
154
+ }>] | readonly [Schema.Struct<{
155
+ readonly items: Schema.$Array<Schema.Top>;
156
+ readonly nextCursor: Schema.NullOr<Schema.String>;
157
+ readonly projected: Schema.optionalKey<Schema.Never>;
158
+ }>, Schema.Struct<{
159
+ readonly items: Schema.$Array<Schema.Top>;
160
+ readonly nextCursor: Schema.NullOr<Schema.String>;
161
+ readonly projected: Schema.Literal<true>;
162
+ }>]>;
163
+ /** A field a query can filter and sort on: a system field, a property, or a `<relationship>_id`. */
164
+ export interface QueryField {
165
+ readonly name: string;
166
+ readonly storage: StorageType;
167
+ readonly nullable: boolean;
168
+ /** The values of a `select` property. */
169
+ readonly options?: ReadonlyArray<string>;
170
+ }
171
+ /**
172
+ * A relationship as seen from one entity: declared on it, or the inverse of a relationship another
173
+ * entity declares. `rel.one` is to-one from its declaring side; every inverse and `rel.many` is
174
+ * to-many.
175
+ */
176
+ export interface QueryLink {
177
+ /** The name on this entity: `owner`, `tags`, or an inverse such as `notes`. */
178
+ readonly name: string;
179
+ readonly target: string;
180
+ readonly cardinality: "one" | "many";
181
+ /** The entity that declares the relationship, and its name there. */
182
+ readonly declaredBy: string;
183
+ readonly relationship: string;
184
+ /** Whether the declaration is `rel.one` or `rel.many`. */
185
+ readonly declared: "one" | "many";
186
+ readonly inverse: boolean;
187
+ }
188
+ /**
189
+ * The fields of an entity's records, in record order. A value-matched relationship has no
190
+ * `<relationship>_id`: its reference is the property named in `on`.
191
+ */
192
+ export declare function queryFields(entity: EntityManifest): ReadonlyArray<QueryField>;
193
+ /** The relationships of an entity, declared ones first, then the inverses landing on it. */
194
+ export declare function queryLinks(manifest: OntologyManifest, entityName: string, warehouseRecords?: boolean): ReadonlyArray<QueryLink>;
195
+ export declare function findEntityManifest(manifest: OntologyManifest, entityName: string): EntityManifest | undefined;
196
+ /** `YYYY-MM-DD` naming a day that exists. */
197
+ export declare function isCalendarDate(value: string): boolean;
198
+ /** An ISO 8601 instant with a time zone, on a day that exists. PostgreSQL keeps microseconds. */
199
+ export declare function isInstant(value: string): boolean;
200
+ export declare function isUuid(value: string): boolean;
201
+ /** The schema of one value of a field, as filters and cursors carry it. */
202
+ export declare function fieldValueSchema(field: QueryField): Schema.Top;
203
+ /** Fields a query can sort on: every field but `json`, `blob` and `list` properties. */
204
+ export declare function isOrderable(field: QueryField): boolean;
205
+ /**
206
+ * Whether a value is a filter the field takes, as a query's `where` would accept it: operators by
207
+ * their query names, each with an operand of the field's type, or a bare value or `null`.
208
+ */
209
+ export declare function isFieldFilterOf(field: QueryField, value: unknown): boolean;
210
+ /** The parts of an entity's query, for APIs that take them apart, such as URL parameters. */
211
+ export interface EntityQuerySchemas {
212
+ readonly where: Schema.Codec<Where>;
213
+ readonly orderBy: Schema.Codec<ReadonlyArray<OrderBy>>;
214
+ readonly select: Schema.Codec<ReadonlyArray<string>>;
215
+ readonly include: Schema.Codec<Included, ReadonlyArray<string> | Included>;
216
+ readonly limit: Schema.Codec<number>;
217
+ readonly after: Schema.Codec<string>;
218
+ readonly query: Schema.Codec<Query>;
219
+ }
220
+ /**
221
+ * The precise query schemas of one entity: its fields with the operators of their types, its
222
+ * relationships (declared and inverse), the fields it can sort on and the relationships it can
223
+ * include. Every struct is closed: an unknown field, operator or key is an issue whatever the parse
224
+ * options, never a silently ignored filter.
225
+ */
226
+ export declare function entityQuerySchemas(manifest: OntologyManifest, entityName: string, wire?: boolean, warehouseRecords?: boolean): EntityQuerySchemas;
227
+ /** The query schema of one entity; see {@link entityQuerySchemas}. */
228
+ export declare function entityQuerySchema(manifest: OntologyManifest, entityName: string, warehouseRecords?: boolean): Schema.Codec<Query>;
229
+ /**
230
+ * The record of an entity as the runtime returns it: system fields, properties (`null` when empty;
231
+ * dates as `YYYY-MM-DD`, timestamps as ISO 8601 in UTC) and a `<relationship>_id` per `rel.one`. It
232
+ * checks the shape of stored values, not the refinements of the definition (`maxLength`, `min`,
233
+ * patterns), so that tightening a refinement never makes existing records unreadable.
234
+ */
235
+ export declare function entityRecordSchema(entity: EntityManifest): Schema.Codec<JsonRecord>;
236
+ /** A record as JSON, as the runtime returns it and the HTTP API sends it. */
237
+ export type JsonRecord = {
238
+ readonly [field: string]: Schema.Json;
239
+ };
240
+ /** A page of an entity's records, with the relationships a query may include. */
241
+ export declare function entityQueryResultSchema(manifest: OntologyManifest, entityName: string, wire?: boolean, warehouseRecords?: boolean): Schema.Codec<QueryResult<JsonRecord>, unknown>;
242
+ /** The JSON Schema (draft 2020-12) of an entity's queries, for MCP tools, OpenAPI and the console. */
243
+ export declare function queryJsonSchema(manifest: OntologyManifest, entityName: string, warehouseRecords?: boolean): JsonSchemaObject;
244
+ /** The JSON Schema (draft 2020-12) of a page of an entity's records. */
245
+ export declare function queryResultJsonSchema(manifest: OntologyManifest, entityName: string): JsonSchemaObject;