@innovatorstack/harness 0.0.0-stage → 0.1.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 (1060) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +59 -2
  3. package/assets/brand/icon-on-dark.png +0 -0
  4. package/assets/brand/icon.png +0 -0
  5. package/assets/brand/mark-on-dark.svg +6 -0
  6. package/assets/brand/mark.svg +6 -0
  7. package/assets/brand/social-preview.png +0 -0
  8. package/assets/brand/social-preview.svg +13 -0
  9. package/dist/baseline/catalog.d.ts +5 -0
  10. package/dist/baseline/catalog.d.ts.map +1 -0
  11. package/dist/baseline/catalog.js +32 -0
  12. package/dist/baseline/catalog.js.map +1 -0
  13. package/dist/baseline/data/item-types.json +1062 -0
  14. package/dist/baseline/data/properties.json +31286 -0
  15. package/dist/baseline/data/records.json +6666 -0
  16. package/dist/baseline/data/relationships.json +393 -0
  17. package/dist/baseline/database.bin +0 -0
  18. package/dist/baseline/database.d.ts +4 -0
  19. package/dist/baseline/database.d.ts.map +1 -0
  20. package/dist/baseline/database.js +33 -0
  21. package/dist/baseline/database.js.map +1 -0
  22. package/dist/baseline/source.d.ts +5 -0
  23. package/dist/baseline/source.d.ts.map +1 -0
  24. package/dist/baseline/source.js +13 -0
  25. package/dist/baseline/source.js.map +1 -0
  26. package/dist/compatibility/capabilities.d.ts +49 -0
  27. package/dist/compatibility/capabilities.d.ts.map +1 -0
  28. package/dist/compatibility/capabilities.js +605 -0
  29. package/dist/compatibility/capabilities.js.map +1 -0
  30. package/dist/compatibility/check.d.ts +5 -0
  31. package/dist/compatibility/check.d.ts.map +1 -0
  32. package/dist/compatibility/check.js +332 -0
  33. package/dist/compatibility/check.js.map +1 -0
  34. package/dist/compatibility/executions.d.ts +11 -0
  35. package/dist/compatibility/executions.d.ts.map +1 -0
  36. package/dist/compatibility/executions.js +79 -0
  37. package/dist/compatibility/executions.js.map +1 -0
  38. package/dist/compatibility/executors.d.ts +21 -0
  39. package/dist/compatibility/executors.d.ts.map +1 -0
  40. package/dist/compatibility/executors.js +151 -0
  41. package/dist/compatibility/executors.js.map +1 -0
  42. package/dist/compatibility/index.d.ts +6 -0
  43. package/dist/compatibility/index.d.ts.map +1 -0
  44. package/dist/compatibility/index.js +4 -0
  45. package/dist/compatibility/index.js.map +1 -0
  46. package/dist/compatibility/metadata.d.ts +6 -0
  47. package/dist/compatibility/metadata.d.ts.map +1 -0
  48. package/dist/compatibility/metadata.js +137 -0
  49. package/dist/compatibility/metadata.js.map +1 -0
  50. package/dist/compatibility/mocks.d.ts +4 -0
  51. package/dist/compatibility/mocks.d.ts.map +1 -0
  52. package/dist/compatibility/mocks.js +22 -0
  53. package/dist/compatibility/mocks.js.map +1 -0
  54. package/dist/compatibility/revisions.d.ts +5 -0
  55. package/dist/compatibility/revisions.d.ts.map +1 -0
  56. package/dist/compatibility/revisions.js +34 -0
  57. package/dist/compatibility/revisions.js.map +1 -0
  58. package/dist/compatibility/security.d.ts +6 -0
  59. package/dist/compatibility/security.d.ts.map +1 -0
  60. package/dist/compatibility/security.js +74 -0
  61. package/dist/compatibility/security.js.map +1 -0
  62. package/dist/compatibility/sources.d.ts +6 -0
  63. package/dist/compatibility/sources.d.ts.map +1 -0
  64. package/dist/compatibility/sources.js +20 -0
  65. package/dist/compatibility/sources.js.map +1 -0
  66. package/dist/compatibility/types.d.ts +130 -0
  67. package/dist/compatibility/types.d.ts.map +1 -0
  68. package/dist/compatibility/types.js +48 -0
  69. package/dist/compatibility/types.js.map +1 -0
  70. package/dist/controls/clock.d.ts +23 -0
  71. package/dist/controls/clock.d.ts.map +1 -0
  72. package/dist/controls/clock.js +74 -0
  73. package/dist/controls/clock.js.map +1 -0
  74. package/dist/controls/execution.d.ts +8 -0
  75. package/dist/controls/execution.d.ts.map +1 -0
  76. package/dist/controls/execution.js +36 -0
  77. package/dist/controls/execution.js.map +1 -0
  78. package/dist/controls/failure-types.d.ts +52 -0
  79. package/dist/controls/failure-types.d.ts.map +1 -0
  80. package/dist/controls/failure-types.js +15 -0
  81. package/dist/controls/failure-types.js.map +1 -0
  82. package/dist/controls/failure-validation.d.ts +17 -0
  83. package/dist/controls/failure-validation.d.ts.map +1 -0
  84. package/dist/controls/failure-validation.js +63 -0
  85. package/dist/controls/failure-validation.js.map +1 -0
  86. package/dist/controls/failures.d.ts +20 -0
  87. package/dist/controls/failures.d.ts.map +1 -0
  88. package/dist/controls/failures.js +128 -0
  89. package/dist/controls/failures.js.map +1 -0
  90. package/dist/controls/ids.d.ts +24 -0
  91. package/dist/controls/ids.d.ts.map +1 -0
  92. package/dist/controls/ids.js +63 -0
  93. package/dist/controls/ids.js.map +1 -0
  94. package/dist/controls/observers.d.ts +20 -0
  95. package/dist/controls/observers.d.ts.map +1 -0
  96. package/dist/controls/observers.js +80 -0
  97. package/dist/controls/observers.js.map +1 -0
  98. package/dist/controls/state.d.ts +10 -0
  99. package/dist/controls/state.d.ts.map +1 -0
  100. package/dist/controls/state.js +50 -0
  101. package/dist/controls/state.js.map +1 -0
  102. package/dist/controls/targets.d.ts +19 -0
  103. package/dist/controls/targets.d.ts.map +1 -0
  104. package/dist/controls/targets.js +82 -0
  105. package/dist/controls/targets.js.map +1 -0
  106. package/dist/controls/values.d.ts +23 -0
  107. package/dist/controls/values.d.ts.map +1 -0
  108. package/dist/controls/values.js +27 -0
  109. package/dist/controls/values.js.map +1 -0
  110. package/dist/controls/world.d.ts +18 -0
  111. package/dist/controls/world.d.ts.map +1 -0
  112. package/dist/controls/world.js +26 -0
  113. package/dist/controls/world.js.map +1 -0
  114. package/dist/core/budget.d.ts +9 -0
  115. package/dist/core/budget.d.ts.map +1 -0
  116. package/dist/core/budget.js +23 -0
  117. package/dist/core/budget.js.map +1 -0
  118. package/dist/core/context.d.ts +8 -0
  119. package/dist/core/context.d.ts.map +1 -0
  120. package/dist/core/context.js +38 -0
  121. package/dist/core/context.js.map +1 -0
  122. package/dist/core/data.d.ts +16 -0
  123. package/dist/core/data.d.ts.map +1 -0
  124. package/dist/core/data.js +197 -0
  125. package/dist/core/data.js.map +1 -0
  126. package/dist/core/deadline.d.ts +12 -0
  127. package/dist/core/deadline.d.ts.map +1 -0
  128. package/dist/core/deadline.js +38 -0
  129. package/dist/core/deadline.js.map +1 -0
  130. package/dist/core/errors.d.ts +7 -0
  131. package/dist/core/errors.d.ts.map +1 -0
  132. package/dist/core/errors.js +15 -0
  133. package/dist/core/errors.js.map +1 -0
  134. package/dist/core/files.d.ts +8 -0
  135. package/dist/core/files.d.ts.map +1 -0
  136. package/dist/core/files.js +98 -0
  137. package/dist/core/files.js.map +1 -0
  138. package/dist/core/index.d.ts +7 -0
  139. package/dist/core/index.d.ts.map +1 -0
  140. package/dist/core/index.js +4 -0
  141. package/dist/core/index.js.map +1 -0
  142. package/dist/core/limits.d.ts +15 -0
  143. package/dist/core/limits.d.ts.map +1 -0
  144. package/dist/core/limits.js +15 -0
  145. package/dist/core/limits.js.map +1 -0
  146. package/dist/core/modules.d.ts +3 -0
  147. package/dist/core/modules.d.ts.map +1 -0
  148. package/dist/core/modules.js +68 -0
  149. package/dist/core/modules.js.map +1 -0
  150. package/dist/core/operation.d.ts +18 -0
  151. package/dist/core/operation.d.ts.map +1 -0
  152. package/dist/core/operation.js +21 -0
  153. package/dist/core/operation.js.map +1 -0
  154. package/dist/core/process.d.ts +3 -0
  155. package/dist/core/process.d.ts.map +1 -0
  156. package/dist/core/process.js +44 -0
  157. package/dist/core/process.js.map +1 -0
  158. package/dist/core/resources.d.ts +3 -0
  159. package/dist/core/resources.d.ts.map +1 -0
  160. package/dist/core/resources.js +28 -0
  161. package/dist/core/resources.js.map +1 -0
  162. package/dist/core/runtime.d.ts +54 -0
  163. package/dist/core/runtime.d.ts.map +1 -0
  164. package/dist/core/runtime.js +565 -0
  165. package/dist/core/runtime.js.map +1 -0
  166. package/dist/core/types.d.ts +61 -0
  167. package/dist/core/types.d.ts.map +1 -0
  168. package/dist/core/types.js +1 -0
  169. package/dist/core/types.js.map +1 -0
  170. package/dist/diagnostics/source-location.d.ts +7 -0
  171. package/dist/diagnostics/source-location.d.ts.map +1 -0
  172. package/dist/diagnostics/source-location.js +1 -0
  173. package/dist/diagnostics/source-location.js.map +1 -0
  174. package/dist/engine/instance.d.ts +57 -0
  175. package/dist/engine/instance.d.ts.map +1 -0
  176. package/dist/engine/instance.js +281 -0
  177. package/dist/engine/instance.js.map +1 -0
  178. package/dist/engine.d.ts +5 -0
  179. package/dist/engine.d.ts.map +1 -0
  180. package/dist/engine.js +6 -0
  181. package/dist/engine.js.map +1 -0
  182. package/dist/fixtures/module.d.ts +5 -0
  183. package/dist/fixtures/module.d.ts.map +1 -0
  184. package/dist/fixtures/module.js +112 -0
  185. package/dist/fixtures/module.js.map +1 -0
  186. package/dist/fixtures/types.d.ts +7 -0
  187. package/dist/fixtures/types.d.ts.map +1 -0
  188. package/dist/fixtures/types.js +1 -0
  189. package/dist/fixtures/types.js.map +1 -0
  190. package/dist/harness/configuration.d.ts +53 -0
  191. package/dist/harness/configuration.d.ts.map +1 -0
  192. package/dist/harness/configuration.js +279 -0
  193. package/dist/harness/configuration.js.map +1 -0
  194. package/dist/harness/create.d.ts +5 -0
  195. package/dist/harness/create.d.ts.map +1 -0
  196. package/dist/harness/create.js +156 -0
  197. package/dist/harness/create.js.map +1 -0
  198. package/dist/harness/extensions.d.ts +8 -0
  199. package/dist/harness/extensions.d.ts.map +1 -0
  200. package/dist/harness/extensions.js +58 -0
  201. package/dist/harness/extensions.js.map +1 -0
  202. package/dist/harness/fixtures.d.ts +9 -0
  203. package/dist/harness/fixtures.d.ts.map +1 -0
  204. package/dist/harness/fixtures.js +130 -0
  205. package/dist/harness/fixtures.js.map +1 -0
  206. package/dist/harness/runtime-identity.d.ts +3 -0
  207. package/dist/harness/runtime-identity.d.ts.map +1 -0
  208. package/dist/harness/runtime-identity.js +30 -0
  209. package/dist/harness/runtime-identity.js.map +1 -0
  210. package/dist/harness/setup-cache.d.ts +11 -0
  211. package/dist/harness/setup-cache.d.ts.map +1 -0
  212. package/dist/harness/setup-cache.js +40 -0
  213. package/dist/harness/setup-cache.js.map +1 -0
  214. package/dist/harness/setup-image.d.ts +5 -0
  215. package/dist/harness/setup-image.d.ts.map +1 -0
  216. package/dist/harness/setup-image.js +118 -0
  217. package/dist/harness/setup-image.js.map +1 -0
  218. package/dist/harness/setup-imports.d.ts +3 -0
  219. package/dist/harness/setup-imports.d.ts.map +1 -0
  220. package/dist/harness/setup-imports.js +30 -0
  221. package/dist/harness/setup-imports.js.map +1 -0
  222. package/dist/harness/setup-inputs.d.ts +12 -0
  223. package/dist/harness/setup-inputs.d.ts.map +1 -0
  224. package/dist/harness/setup-inputs.js +47 -0
  225. package/dist/harness/setup-inputs.js.map +1 -0
  226. package/dist/harness/setup-module.d.ts +3 -0
  227. package/dist/harness/setup-module.d.ts.map +1 -0
  228. package/dist/harness/setup-module.js +150 -0
  229. package/dist/harness/setup-module.js.map +1 -0
  230. package/dist/harness/world.d.ts +36 -0
  231. package/dist/harness/world.d.ts.map +1 -0
  232. package/dist/harness/world.js +171 -0
  233. package/dist/harness/world.js.map +1 -0
  234. package/dist/index.d.ts +30 -0
  235. package/dist/index.d.ts.map +1 -0
  236. package/dist/index.js +13 -0
  237. package/dist/index.js.map +1 -0
  238. package/dist/instrumentation/failures.d.ts +5 -0
  239. package/dist/instrumentation/failures.d.ts.map +1 -0
  240. package/dist/instrumentation/failures.js +94 -0
  241. package/dist/instrumentation/failures.js.map +1 -0
  242. package/dist/instrumentation/recorder.d.ts +38 -0
  243. package/dist/instrumentation/recorder.d.ts.map +1 -0
  244. package/dist/instrumentation/recorder.js +372 -0
  245. package/dist/instrumentation/recorder.js.map +1 -0
  246. package/dist/instrumentation/snapshots.d.ts +20 -0
  247. package/dist/instrumentation/snapshots.d.ts.map +1 -0
  248. package/dist/instrumentation/snapshots.js +177 -0
  249. package/dist/instrumentation/snapshots.js.map +1 -0
  250. package/dist/instrumentation/types.d.ts +107 -0
  251. package/dist/instrumentation/types.d.ts.map +1 -0
  252. package/dist/instrumentation/types.js +25 -0
  253. package/dist/instrumentation/types.js.map +1 -0
  254. package/dist/items/codec.d.ts +4 -0
  255. package/dist/items/codec.d.ts.map +1 -0
  256. package/dist/items/codec.js +137 -0
  257. package/dist/items/codec.js.map +1 -0
  258. package/dist/items/item.d.ts +58 -0
  259. package/dist/items/item.d.ts.map +1 -0
  260. package/dist/items/item.js +145 -0
  261. package/dist/items/item.js.map +1 -0
  262. package/dist/items/logical.d.ts +23 -0
  263. package/dist/items/logical.d.ts.map +1 -0
  264. package/dist/items/logical.js +92 -0
  265. package/dist/items/logical.js.map +1 -0
  266. package/dist/items/origins.d.ts +7 -0
  267. package/dist/items/origins.d.ts.map +1 -0
  268. package/dist/items/origins.js +102 -0
  269. package/dist/items/origins.js.map +1 -0
  270. package/dist/items/xml.d.ts +7 -0
  271. package/dist/items/xml.d.ts.map +1 -0
  272. package/dist/items/xml.js +134 -0
  273. package/dist/items/xml.js.map +1 -0
  274. package/dist/methods/csharp/base-input.d.ts +30 -0
  275. package/dist/methods/csharp/base-input.d.ts.map +1 -0
  276. package/dist/methods/csharp/base-input.js +140 -0
  277. package/dist/methods/csharp/base-input.js.map +1 -0
  278. package/dist/methods/csharp/cache.d.ts +3 -0
  279. package/dist/methods/csharp/cache.d.ts.map +1 -0
  280. package/dist/methods/csharp/cache.js +52 -0
  281. package/dist/methods/csharp/cache.js.map +1 -0
  282. package/dist/methods/csharp/callbacks.d.ts +12 -0
  283. package/dist/methods/csharp/callbacks.d.ts.map +1 -0
  284. package/dist/methods/csharp/callbacks.js +75 -0
  285. package/dist/methods/csharp/callbacks.js.map +1 -0
  286. package/dist/methods/csharp/compiler.d.ts +26 -0
  287. package/dist/methods/csharp/compiler.d.ts.map +1 -0
  288. package/dist/methods/csharp/compiler.js +253 -0
  289. package/dist/methods/csharp/compiler.js.map +1 -0
  290. package/dist/methods/csharp/context.d.ts +17 -0
  291. package/dist/methods/csharp/context.d.ts.map +1 -0
  292. package/dist/methods/csharp/context.js +65 -0
  293. package/dist/methods/csharp/context.js.map +1 -0
  294. package/dist/methods/csharp/documents.d.ts +13 -0
  295. package/dist/methods/csharp/documents.d.ts.map +1 -0
  296. package/dist/methods/csharp/documents.js +128 -0
  297. package/dist/methods/csharp/documents.js.map +1 -0
  298. package/dist/methods/csharp/executor.d.ts +35 -0
  299. package/dist/methods/csharp/executor.d.ts.map +1 -0
  300. package/dist/methods/csharp/executor.js +363 -0
  301. package/dist/methods/csharp/executor.js.map +1 -0
  302. package/dist/methods/csharp/index.d.ts +4 -0
  303. package/dist/methods/csharp/index.d.ts.map +1 -0
  304. package/dist/methods/csharp/index.js +3 -0
  305. package/dist/methods/csharp/index.js.map +1 -0
  306. package/dist/methods/csharp/managed/CallContext.cs +21 -0
  307. package/dist/methods/csharp/managed/Connections.cs +27 -0
  308. package/dist/methods/csharp/managed/ContextSafety.cs +219 -0
  309. package/dist/methods/csharp/managed/DomChanges.cs +39 -0
  310. package/dist/methods/csharp/managed/ErrorLookup.cs +28 -0
  311. package/dist/methods/csharp/managed/EventMetadata.cs +45 -0
  312. package/dist/methods/csharp/managed/GlobalUsings.cs.template +9 -0
  313. package/dist/methods/csharp/managed/Identity.cs +30 -0
  314. package/dist/methods/csharp/managed/InOut.cs.template +42 -0
  315. package/dist/methods/csharp/managed/InOutInvocation.cs +41 -0
  316. package/dist/methods/csharp/managed/Innovator.cs +106 -0
  317. package/dist/methods/csharp/managed/Item.cs +515 -0
  318. package/dist/methods/csharp/managed/ItemDocuments.cs +62 -0
  319. package/dist/methods/csharp/managed/ItemXml.cs +465 -0
  320. package/dist/methods/csharp/managed/LogicalData.cs +20 -0
  321. package/dist/methods/csharp/managed/LogicalXml.cs +181 -0
  322. package/dist/methods/csharp/managed/ManagedDocuments.cs +48 -0
  323. package/dist/methods/csharp/managed/Method.cs.template +30 -0
  324. package/dist/methods/csharp/managed/MethodAssemblies.cs +83 -0
  325. package/dist/methods/csharp/managed/MethodContext.cs +44 -0
  326. package/dist/methods/csharp/managed/MethodEventArgs.cs +64 -0
  327. package/dist/methods/csharp/managed/MethodInvocation.cs +201 -0
  328. package/dist/methods/csharp/managed/NuGet.Config +6 -0
  329. package/dist/methods/csharp/managed/PayloadXml.cs +38 -0
  330. package/dist/methods/csharp/managed/Permissions.cs +47 -0
  331. package/dist/methods/csharp/managed/Program.cs +83 -0
  332. package/dist/methods/csharp/managed/PropertyItems.cs +46 -0
  333. package/dist/methods/csharp/managed/Protocol.cs +204 -0
  334. package/dist/methods/csharp/managed/ProtocolInput.cs +67 -0
  335. package/dist/methods/csharp/managed/ProtocolJson.cs +13 -0
  336. package/dist/methods/csharp/managed/RemoteContext.cs +33 -0
  337. package/dist/methods/csharp/managed/RequestOrigins.cs +207 -0
  338. package/dist/methods/csharp/managed/RequestRelationships.cs +129 -0
  339. package/dist/methods/csharp/managed/RequestXml.cs +237 -0
  340. package/dist/methods/csharp/managed/ResponseXml.cs +114 -0
  341. package/dist/methods/csharp/managed/ServerEventArgs.cs +223 -0
  342. package/dist/methods/csharp/managed/WorkLimits.cs +11 -0
  343. package/dist/methods/csharp/managed/Worker.csproj +23 -0
  344. package/dist/methods/csharp/managed/XmlProperties.cs +32 -0
  345. package/dist/methods/csharp/managed/XmlTraversal.cs +138 -0
  346. package/dist/methods/csharp/method-build.d.ts +11 -0
  347. package/dist/methods/csharp/method-build.d.ts.map +1 -0
  348. package/dist/methods/csharp/method-build.js +96 -0
  349. package/dist/methods/csharp/method-build.js.map +1 -0
  350. package/dist/methods/csharp/origins.d.ts +17 -0
  351. package/dist/methods/csharp/origins.d.ts.map +1 -0
  352. package/dist/methods/csharp/origins.js +78 -0
  353. package/dist/methods/csharp/origins.js.map +1 -0
  354. package/dist/methods/csharp/protocol.d.ts +6 -0
  355. package/dist/methods/csharp/protocol.d.ts.map +1 -0
  356. package/dist/methods/csharp/protocol.js +78 -0
  357. package/dist/methods/csharp/protocol.js.map +1 -0
  358. package/dist/methods/csharp/relationship-order.d.ts +8 -0
  359. package/dist/methods/csharp/relationship-order.d.ts.map +1 -0
  360. package/dist/methods/csharp/relationship-order.js +51 -0
  361. package/dist/methods/csharp/relationship-order.js.map +1 -0
  362. package/dist/methods/csharp/request-change.d.ts +27 -0
  363. package/dist/methods/csharp/request-change.d.ts.map +1 -0
  364. package/dist/methods/csharp/request-change.js +238 -0
  365. package/dist/methods/csharp/request-change.js.map +1 -0
  366. package/dist/methods/csharp/retained-items.d.ts +9 -0
  367. package/dist/methods/csharp/retained-items.d.ts.map +1 -0
  368. package/dist/methods/csharp/retained-items.js +95 -0
  369. package/dist/methods/csharp/retained-items.js.map +1 -0
  370. package/dist/methods/csharp/security.d.ts +13 -0
  371. package/dist/methods/csharp/security.d.ts.map +1 -0
  372. package/dist/methods/csharp/security.js +82 -0
  373. package/dist/methods/csharp/security.js.map +1 -0
  374. package/dist/methods/csharp/templates.d.ts +5 -0
  375. package/dist/methods/csharp/templates.d.ts.map +1 -0
  376. package/dist/methods/csharp/templates.js +66 -0
  377. package/dist/methods/csharp/templates.js.map +1 -0
  378. package/dist/methods/csharp/worker.d.ts +31 -0
  379. package/dist/methods/csharp/worker.d.ts.map +1 -0
  380. package/dist/methods/csharp/worker.js +172 -0
  381. package/dist/methods/csharp/worker.js.map +1 -0
  382. package/dist/methods/event-data.d.ts +31 -0
  383. package/dist/methods/event-data.d.ts.map +1 -0
  384. package/dist/methods/event-data.js +8 -0
  385. package/dist/methods/event-data.js.map +1 -0
  386. package/dist/methods/types.d.ts +47 -0
  387. package/dist/methods/types.d.ts.map +1 -0
  388. package/dist/methods/types.js +2 -0
  389. package/dist/methods/types.js.map +1 -0
  390. package/dist/mocks/configuration.d.ts +5 -0
  391. package/dist/mocks/configuration.d.ts.map +1 -0
  392. package/dist/mocks/configuration.js +102 -0
  393. package/dist/mocks/configuration.js.map +1 -0
  394. package/dist/mocks/parameters.d.ts +3 -0
  395. package/dist/mocks/parameters.d.ts.map +1 -0
  396. package/dist/mocks/parameters.js +16 -0
  397. package/dist/mocks/parameters.js.map +1 -0
  398. package/dist/mocks/registry.d.ts +39 -0
  399. package/dist/mocks/registry.d.ts.map +1 -0
  400. package/dist/mocks/registry.js +129 -0
  401. package/dist/mocks/registry.js.map +1 -0
  402. package/dist/mocks/response.d.ts +10 -0
  403. package/dist/mocks/response.d.ts.map +1 -0
  404. package/dist/mocks/response.js +94 -0
  405. package/dist/mocks/response.js.map +1 -0
  406. package/dist/mocks/types.d.ts +34 -0
  407. package/dist/mocks/types.d.ts.map +1 -0
  408. package/dist/mocks/types.js +1 -0
  409. package/dist/mocks/types.js.map +1 -0
  410. package/dist/packages/bootstrap.d.ts +10 -0
  411. package/dist/packages/bootstrap.d.ts.map +1 -0
  412. package/dist/packages/bootstrap.js +66 -0
  413. package/dist/packages/bootstrap.js.map +1 -0
  414. package/dist/packages/candidates.d.ts +13 -0
  415. package/dist/packages/candidates.d.ts.map +1 -0
  416. package/dist/packages/candidates.js +43 -0
  417. package/dist/packages/candidates.js.map +1 -0
  418. package/dist/packages/defaults.d.ts +11 -0
  419. package/dist/packages/defaults.d.ts.map +1 -0
  420. package/dist/packages/defaults.js +104 -0
  421. package/dist/packages/defaults.js.map +1 -0
  422. package/dist/packages/diagnostics.d.ts +22 -0
  423. package/dist/packages/diagnostics.d.ts.map +1 -0
  424. package/dist/packages/diagnostics.js +25 -0
  425. package/dist/packages/diagnostics.js.map +1 -0
  426. package/dist/packages/draft.d.ts +66 -0
  427. package/dist/packages/draft.d.ts.map +1 -0
  428. package/dist/packages/draft.js +186 -0
  429. package/dist/packages/draft.js.map +1 -0
  430. package/dist/packages/elements.d.ts +11 -0
  431. package/dist/packages/elements.d.ts.map +1 -0
  432. package/dist/packages/elements.js +58 -0
  433. package/dist/packages/elements.js.map +1 -0
  434. package/dist/packages/evaluation.d.ts +16 -0
  435. package/dist/packages/evaluation.d.ts.map +1 -0
  436. package/dist/packages/evaluation.js +71 -0
  437. package/dist/packages/evaluation.js.map +1 -0
  438. package/dist/packages/files.d.ts +21 -0
  439. package/dist/packages/files.d.ts.map +1 -0
  440. package/dist/packages/files.js +214 -0
  441. package/dist/packages/files.js.map +1 -0
  442. package/dist/packages/importer.d.ts +23 -0
  443. package/dist/packages/importer.d.ts.map +1 -0
  444. package/dist/packages/importer.js +791 -0
  445. package/dist/packages/importer.js.map +1 -0
  446. package/dist/packages/index.d.ts +8 -0
  447. package/dist/packages/index.d.ts.map +1 -0
  448. package/dist/packages/index.js +6 -0
  449. package/dist/packages/index.js.map +1 -0
  450. package/dist/packages/manifest.d.ts +3 -0
  451. package/dist/packages/manifest.d.ts.map +1 -0
  452. package/dist/packages/manifest.js +84 -0
  453. package/dist/packages/manifest.js.map +1 -0
  454. package/dist/packages/module.d.ts +11 -0
  455. package/dist/packages/module.d.ts.map +1 -0
  456. package/dist/packages/module.js +14 -0
  457. package/dist/packages/module.js.map +1 -0
  458. package/dist/packages/parser.d.ts +12 -0
  459. package/dist/packages/parser.d.ts.map +1 -0
  460. package/dist/packages/parser.js +258 -0
  461. package/dist/packages/parser.js.map +1 -0
  462. package/dist/packages/plan.d.ts +55 -0
  463. package/dist/packages/plan.d.ts.map +1 -0
  464. package/dist/packages/plan.js +542 -0
  465. package/dist/packages/plan.js.map +1 -0
  466. package/dist/packages/schema.d.ts +9 -0
  467. package/dist/packages/schema.d.ts.map +1 -0
  468. package/dist/packages/schema.js +347 -0
  469. package/dist/packages/schema.js.map +1 -0
  470. package/dist/packages/selector.d.ts +9 -0
  471. package/dist/packages/selector.d.ts.map +1 -0
  472. package/dist/packages/selector.js +61 -0
  473. package/dist/packages/selector.js.map +1 -0
  474. package/dist/packages/state.d.ts +6 -0
  475. package/dist/packages/state.d.ts.map +1 -0
  476. package/dist/packages/state.js +62 -0
  477. package/dist/packages/state.js.map +1 -0
  478. package/dist/packages/types.d.ts +22 -0
  479. package/dist/packages/types.d.ts.map +1 -0
  480. package/dist/packages/types.js +1 -0
  481. package/dist/packages/types.js.map +1 -0
  482. package/dist/platform/action-responses.d.ts +14 -0
  483. package/dist/platform/action-responses.d.ts.map +1 -0
  484. package/dist/platform/action-responses.js +85 -0
  485. package/dist/platform/action-responses.js.map +1 -0
  486. package/dist/platform/actions.d.ts +12 -0
  487. package/dist/platform/actions.d.ts.map +1 -0
  488. package/dist/platform/actions.js +13 -0
  489. package/dist/platform/actions.js.map +1 -0
  490. package/dist/platform/catalog.d.ts +20 -0
  491. package/dist/platform/catalog.d.ts.map +1 -0
  492. package/dist/platform/catalog.js +155 -0
  493. package/dist/platform/catalog.js.map +1 -0
  494. package/dist/platform/classifications.d.ts +14 -0
  495. package/dist/platform/classifications.d.ts.map +1 -0
  496. package/dist/platform/classifications.js +100 -0
  497. package/dist/platform/classifications.js.map +1 -0
  498. package/dist/platform/creation.d.ts +4 -0
  499. package/dist/platform/creation.d.ts.map +1 -0
  500. package/dist/platform/creation.js +23 -0
  501. package/dist/platform/creation.js.map +1 -0
  502. package/dist/platform/engine.d.ts +127 -0
  503. package/dist/platform/engine.d.ts.map +1 -0
  504. package/dist/platform/engine.js +1210 -0
  505. package/dist/platform/engine.js.map +1 -0
  506. package/dist/platform/errors.d.ts +20 -0
  507. package/dist/platform/errors.d.ts.map +1 -0
  508. package/dist/platform/errors.js +28 -0
  509. package/dist/platform/errors.js.map +1 -0
  510. package/dist/platform/events/after.d.ts +22 -0
  511. package/dist/platform/events/after.d.ts.map +1 -0
  512. package/dist/platform/events/after.js +86 -0
  513. package/dist/platform/events/after.js.map +1 -0
  514. package/dist/platform/events/base-updates.d.ts +11 -0
  515. package/dist/platform/events/base-updates.d.ts.map +1 -0
  516. package/dist/platform/events/base-updates.js +43 -0
  517. package/dist/platform/events/base-updates.js.map +1 -0
  518. package/dist/platform/events/bindings.d.ts +13 -0
  519. package/dist/platform/events/bindings.d.ts.map +1 -0
  520. package/dist/platform/events/bindings.js +76 -0
  521. package/dist/platform/events/bindings.js.map +1 -0
  522. package/dist/platform/events/data.d.ts +5 -0
  523. package/dist/platform/events/data.d.ts.map +1 -0
  524. package/dist/platform/events/data.js +17 -0
  525. package/dist/platform/events/data.js.map +1 -0
  526. package/dist/platform/events/inheritance.d.ts +4 -0
  527. package/dist/platform/events/inheritance.d.ts.map +1 -0
  528. package/dist/platform/events/inheritance.js +56 -0
  529. package/dist/platform/events/inheritance.js.map +1 -0
  530. package/dist/platform/events/input.d.ts +5 -0
  531. package/dist/platform/events/input.d.ts.map +1 -0
  532. package/dist/platform/events/input.js +9 -0
  533. package/dist/platform/events/input.js.map +1 -0
  534. package/dist/platform/events/replacement.d.ts +14 -0
  535. package/dist/platform/events/replacement.d.ts.map +1 -0
  536. package/dist/platform/events/replacement.js +60 -0
  537. package/dist/platform/events/replacement.js.map +1 -0
  538. package/dist/platform/events/types.d.ts +31 -0
  539. package/dist/platform/events/types.d.ts.map +1 -0
  540. package/dist/platform/events/types.js +6 -0
  541. package/dist/platform/events/types.js.map +1 -0
  542. package/dist/platform/events/version.d.ts +5 -0
  543. package/dist/platform/events/version.d.ts.map +1 -0
  544. package/dist/platform/events/version.js +22 -0
  545. package/dist/platform/events/version.js.map +1 -0
  546. package/dist/platform/graph-actions.d.ts +18 -0
  547. package/dist/platform/graph-actions.d.ts.map +1 -0
  548. package/dist/platform/graph-actions.js +109 -0
  549. package/dist/platform/graph-actions.js.map +1 -0
  550. package/dist/platform/lifecycle.d.ts +40 -0
  551. package/dist/platform/lifecycle.d.ts.map +1 -0
  552. package/dist/platform/lifecycle.js +309 -0
  553. package/dist/platform/lifecycle.js.map +1 -0
  554. package/dist/platform/locks.d.ts +29 -0
  555. package/dist/platform/locks.d.ts.map +1 -0
  556. package/dist/platform/locks.js +150 -0
  557. package/dist/platform/locks.js.map +1 -0
  558. package/dist/platform/projection.d.ts +8 -0
  559. package/dist/platform/projection.d.ts.map +1 -0
  560. package/dist/platform/projection.js +165 -0
  561. package/dist/platform/projection.js.map +1 -0
  562. package/dist/platform/queries/conditions.d.ts +4 -0
  563. package/dist/platform/queries/conditions.d.ts.map +1 -0
  564. package/dist/platform/queries/conditions.js +48 -0
  565. package/dist/platform/queries/conditions.js.map +1 -0
  566. package/dist/platform/queries/engine.d.ts +16 -0
  567. package/dist/platform/queries/engine.d.ts.map +1 -0
  568. package/dist/platform/queries/engine.js +41 -0
  569. package/dist/platform/queries/engine.js.map +1 -0
  570. package/dist/platform/queries/fields.d.ts +7 -0
  571. package/dist/platform/queries/fields.d.ts.map +1 -0
  572. package/dist/platform/queries/fields.js +88 -0
  573. package/dist/platform/queries/fields.js.map +1 -0
  574. package/dist/platform/queries/order.d.ts +5 -0
  575. package/dist/platform/queries/order.d.ts.map +1 -0
  576. package/dist/platform/queries/order.js +69 -0
  577. package/dist/platform/queries/order.js.map +1 -0
  578. package/dist/platform/queries/paging.d.ts +9 -0
  579. package/dist/platform/queries/paging.d.ts.map +1 -0
  580. package/dist/platform/queries/paging.js +39 -0
  581. package/dist/platform/queries/paging.js.map +1 -0
  582. package/dist/platform/queries/planner.d.ts +8 -0
  583. package/dist/platform/queries/planner.d.ts.map +1 -0
  584. package/dist/platform/queries/planner.js +145 -0
  585. package/dist/platform/queries/planner.js.map +1 -0
  586. package/dist/platform/queries/relationships.d.ts +16 -0
  587. package/dist/platform/queries/relationships.d.ts.map +1 -0
  588. package/dist/platform/queries/relationships.js +84 -0
  589. package/dist/platform/queries/relationships.js.map +1 -0
  590. package/dist/platform/queries/validation.d.ts +5 -0
  591. package/dist/platform/queries/validation.d.ts.map +1 -0
  592. package/dist/platform/queries/validation.js +79 -0
  593. package/dist/platform/queries/validation.js.map +1 -0
  594. package/dist/platform/query.d.ts +10 -0
  595. package/dist/platform/query.d.ts.map +1 -0
  596. package/dist/platform/query.js +93 -0
  597. package/dist/platform/query.js.map +1 -0
  598. package/dist/platform/references/behavior.d.ts +11 -0
  599. package/dist/platform/references/behavior.d.ts.map +1 -0
  600. package/dist/platform/references/behavior.js +25 -0
  601. package/dist/platform/references/behavior.js.map +1 -0
  602. package/dist/platform/references/catalog.d.ts +23 -0
  603. package/dist/platform/references/catalog.d.ts.map +1 -0
  604. package/dist/platform/references/catalog.js +153 -0
  605. package/dist/platform/references/catalog.js.map +1 -0
  606. package/dist/platform/references/deletion.d.ts +20 -0
  607. package/dist/platform/references/deletion.d.ts.map +1 -0
  608. package/dist/platform/references/deletion.js +86 -0
  609. package/dist/platform/references/deletion.js.map +1 -0
  610. package/dist/platform/references/maintenance.d.ts +22 -0
  611. package/dist/platform/references/maintenance.d.ts.map +1 -0
  612. package/dist/platform/references/maintenance.js +113 -0
  613. package/dist/platform/references/maintenance.js.map +1 -0
  614. package/dist/platform/references/policy.d.ts +14 -0
  615. package/dist/platform/references/policy.d.ts.map +1 -0
  616. package/dist/platform/references/policy.js +76 -0
  617. package/dist/platform/references/policy.js.map +1 -0
  618. package/dist/platform/references/sessions.d.ts +20 -0
  619. package/dist/platform/references/sessions.d.ts.map +1 -0
  620. package/dist/platform/references/sessions.js +98 -0
  621. package/dist/platform/references/sessions.js.map +1 -0
  622. package/dist/platform/relationship-copy-policy.d.ts +10 -0
  623. package/dist/platform/relationship-copy-policy.d.ts.map +1 -0
  624. package/dist/platform/relationship-copy-policy.js +41 -0
  625. package/dist/platform/relationship-copy-policy.js.map +1 -0
  626. package/dist/platform/relationship-copy.d.ts +21 -0
  627. package/dist/platform/relationship-copy.d.ts.map +1 -0
  628. package/dist/platform/relationship-copy.js +146 -0
  629. package/dist/platform/relationship-copy.js.map +1 -0
  630. package/dist/platform/relationship-type.d.ts +3 -0
  631. package/dist/platform/relationship-type.d.ts.map +1 -0
  632. package/dist/platform/relationship-type.js +11 -0
  633. package/dist/platform/relationship-type.js.map +1 -0
  634. package/dist/platform/request.d.ts +7 -0
  635. package/dist/platform/request.d.ts.map +1 -0
  636. package/dist/platform/request.js +86 -0
  637. package/dist/platform/request.js.map +1 -0
  638. package/dist/platform/revisions/policy.d.ts +13 -0
  639. package/dist/platform/revisions/policy.d.ts.map +1 -0
  640. package/dist/platform/revisions/policy.js +69 -0
  641. package/dist/platform/revisions/policy.js.map +1 -0
  642. package/dist/platform/revisions/sequences.d.ts +12 -0
  643. package/dist/platform/revisions/sequences.d.ts.map +1 -0
  644. package/dist/platform/revisions/sequences.js +38 -0
  645. package/dist/platform/revisions/sequences.js.map +1 -0
  646. package/dist/platform/security/grants.d.ts +14 -0
  647. package/dist/platform/security/grants.d.ts.map +1 -0
  648. package/dist/platform/security/grants.js +83 -0
  649. package/dist/platform/security/grants.js.map +1 -0
  650. package/dist/platform/security/identities.d.ts +16 -0
  651. package/dist/platform/security/identities.d.ts.map +1 -0
  652. package/dist/platform/security/identities.js +99 -0
  653. package/dist/platform/security/identities.js.map +1 -0
  654. package/dist/platform/security/inherited-relationships.d.ts +15 -0
  655. package/dist/platform/security/inherited-relationships.d.ts.map +1 -0
  656. package/dist/platform/security/inherited-relationships.js +70 -0
  657. package/dist/platform/security/inherited-relationships.js.map +1 -0
  658. package/dist/platform/security/method-execution.d.ts +12 -0
  659. package/dist/platform/security/method-execution.d.ts.map +1 -0
  660. package/dist/platform/security/method-execution.js +24 -0
  661. package/dist/platform/security/method-execution.js.map +1 -0
  662. package/dist/platform/security/permissions.d.ts +34 -0
  663. package/dist/platform/security/permissions.d.ts.map +1 -0
  664. package/dist/platform/security/permissions.js +188 -0
  665. package/dist/platform/security/permissions.js.map +1 -0
  666. package/dist/platform/security/policy.d.ts +39 -0
  667. package/dist/platform/security/policy.d.ts.map +1 -0
  668. package/dist/platform/security/policy.js +168 -0
  669. package/dist/platform/security/policy.js.map +1 -0
  670. package/dist/platform/security/source-access.d.ts +19 -0
  671. package/dist/platform/security/source-access.d.ts.map +1 -0
  672. package/dist/platform/security/source-access.js +72 -0
  673. package/dist/platform/security/source-access.js.map +1 -0
  674. package/dist/platform/security/source-inheritance.d.ts +19 -0
  675. package/dist/platform/security/source-inheritance.d.ts.map +1 -0
  676. package/dist/platform/security/source-inheritance.js +87 -0
  677. package/dist/platform/security/source-inheritance.js.map +1 -0
  678. package/dist/platform/security/system-identities.d.ts +4 -0
  679. package/dist/platform/security/system-identities.d.ts.map +1 -0
  680. package/dist/platform/security/system-identities.js +12 -0
  681. package/dist/platform/security/system-identities.js.map +1 -0
  682. package/dist/platform/security/teams.d.ts +15 -0
  683. package/dist/platform/security/teams.d.ts.map +1 -0
  684. package/dist/platform/security/teams.js +68 -0
  685. package/dist/platform/security/teams.js.map +1 -0
  686. package/dist/platform/security/time.d.ts +4 -0
  687. package/dist/platform/security/time.d.ts.map +1 -0
  688. package/dist/platform/security/time.js +26 -0
  689. package/dist/platform/security/time.js.map +1 -0
  690. package/dist/platform/security/types.d.ts +12 -0
  691. package/dist/platform/security/types.d.ts.map +1 -0
  692. package/dist/platform/security/types.js +6 -0
  693. package/dist/platform/security/types.js.map +1 -0
  694. package/dist/platform/trace.d.ts +41 -0
  695. package/dist/platform/trace.d.ts.map +1 -0
  696. package/dist/platform/trace.js +46 -0
  697. package/dist/platform/trace.js.map +1 -0
  698. package/dist/platform/unlocking.d.ts +27 -0
  699. package/dist/platform/unlocking.d.ts.map +1 -0
  700. package/dist/platform/unlocking.js +192 -0
  701. package/dist/platform/unlocking.js.map +1 -0
  702. package/dist/platform/values.d.ts +17 -0
  703. package/dist/platform/values.d.ts.map +1 -0
  704. package/dist/platform/values.js +105 -0
  705. package/dist/platform/values.js.map +1 -0
  706. package/dist/platform/version-policy.d.ts +4 -0
  707. package/dist/platform/version-policy.d.ts.map +1 -0
  708. package/dist/platform/version-policy.js +11 -0
  709. package/dist/platform/version-policy.js.map +1 -0
  710. package/dist/platform/versioned-request.d.ts +18 -0
  711. package/dist/platform/versioned-request.d.ts.map +1 -0
  712. package/dist/platform/versioned-request.js +95 -0
  713. package/dist/platform/versioned-request.js.map +1 -0
  714. package/dist/platform/versioning.d.ts +57 -0
  715. package/dist/platform/versioning.d.ts.map +1 -0
  716. package/dist/platform/versioning.js +441 -0
  717. package/dist/platform/versioning.js.map +1 -0
  718. package/dist/queries/date.d.ts +3 -0
  719. package/dist/queries/date.d.ts.map +1 -0
  720. package/dist/queries/date.js +20 -0
  721. package/dist/queries/date.js.map +1 -0
  722. package/dist/queries/decimal.d.ts +9 -0
  723. package/dist/queries/decimal.d.ts.map +1 -0
  724. package/dist/queries/decimal.js +42 -0
  725. package/dist/queries/decimal.js.map +1 -0
  726. package/dist/queries/evaluate.d.ts +9 -0
  727. package/dist/queries/evaluate.d.ts.map +1 -0
  728. package/dist/queries/evaluate.js +122 -0
  729. package/dist/queries/evaluate.js.map +1 -0
  730. package/dist/queries/lexer.d.ts +14 -0
  731. package/dist/queries/lexer.d.ts.map +1 -0
  732. package/dist/queries/lexer.js +87 -0
  733. package/dist/queries/lexer.js.map +1 -0
  734. package/dist/queries/like.d.ts +3 -0
  735. package/dist/queries/like.d.ts.map +1 -0
  736. package/dist/queries/like.js +35 -0
  737. package/dist/queries/like.js.map +1 -0
  738. package/dist/queries/parser.d.ts +28 -0
  739. package/dist/queries/parser.d.ts.map +1 -0
  740. package/dist/queries/parser.js +271 -0
  741. package/dist/queries/parser.js.map +1 -0
  742. package/dist/queries/predicates.d.ts +7 -0
  743. package/dist/queries/predicates.d.ts.map +1 -0
  744. package/dist/queries/predicates.js +62 -0
  745. package/dist/queries/predicates.js.map +1 -0
  746. package/dist/queries/types.d.ts +65 -0
  747. package/dist/queries/types.d.ts.map +1 -0
  748. package/dist/queries/types.js +25 -0
  749. package/dist/queries/types.js.map +1 -0
  750. package/dist/queries/values.d.ts +5 -0
  751. package/dist/queries/values.d.ts.map +1 -0
  752. package/dist/queries/values.js +77 -0
  753. package/dist/queries/values.js.map +1 -0
  754. package/dist/storage/documents.d.ts +5 -0
  755. package/dist/storage/documents.d.ts.map +1 -0
  756. package/dist/storage/documents.js +12 -0
  757. package/dist/storage/documents.js.map +1 -0
  758. package/dist/storage/metadata-epoch.d.ts +6 -0
  759. package/dist/storage/metadata-epoch.d.ts.map +1 -0
  760. package/dist/storage/metadata-epoch.js +15 -0
  761. package/dist/storage/metadata-epoch.js.map +1 -0
  762. package/dist/storage/package-transaction.d.ts +5 -0
  763. package/dist/storage/package-transaction.d.ts.map +1 -0
  764. package/dist/storage/package-transaction.js +12 -0
  765. package/dist/storage/package-transaction.js.map +1 -0
  766. package/dist/storage/properties.d.ts +4 -0
  767. package/dist/storage/properties.d.ts.map +1 -0
  768. package/dist/storage/properties.js +21 -0
  769. package/dist/storage/properties.js.map +1 -0
  770. package/dist/storage/sqlite/catalog.d.ts +19 -0
  771. package/dist/storage/sqlite/catalog.d.ts.map +1 -0
  772. package/dist/storage/sqlite/catalog.js +62 -0
  773. package/dist/storage/sqlite/catalog.js.map +1 -0
  774. package/dist/storage/sqlite/connections.d.ts +5 -0
  775. package/dist/storage/sqlite/connections.d.ts.map +1 -0
  776. package/dist/storage/sqlite/connections.js +36 -0
  777. package/dist/storage/sqlite/connections.js.map +1 -0
  778. package/dist/storage/sqlite/errors.d.ts +7 -0
  779. package/dist/storage/sqlite/errors.d.ts.map +1 -0
  780. package/dist/storage/sqlite/errors.js +9 -0
  781. package/dist/storage/sqlite/errors.js.map +1 -0
  782. package/dist/storage/sqlite/index.d.ts +5 -0
  783. package/dist/storage/sqlite/index.d.ts.map +1 -0
  784. package/dist/storage/sqlite/index.js +3 -0
  785. package/dist/storage/sqlite/index.js.map +1 -0
  786. package/dist/storage/sqlite/metadata.d.ts +8 -0
  787. package/dist/storage/sqlite/metadata.d.ts.map +1 -0
  788. package/dist/storage/sqlite/metadata.js +157 -0
  789. package/dist/storage/sqlite/metadata.js.map +1 -0
  790. package/dist/storage/sqlite/predicate.d.ts +9 -0
  791. package/dist/storage/sqlite/predicate.d.ts.map +1 -0
  792. package/dist/storage/sqlite/predicate.js +214 -0
  793. package/dist/storage/sqlite/predicate.js.map +1 -0
  794. package/dist/storage/sqlite/queries.d.ts +12 -0
  795. package/dist/storage/sqlite/queries.d.ts.map +1 -0
  796. package/dist/storage/sqlite/queries.js +30 -0
  797. package/dist/storage/sqlite/queries.js.map +1 -0
  798. package/dist/storage/sqlite/schema.d.ts +16 -0
  799. package/dist/storage/sqlite/schema.d.ts.map +1 -0
  800. package/dist/storage/sqlite/schema.js +197 -0
  801. package/dist/storage/sqlite/schema.js.map +1 -0
  802. package/dist/storage/sqlite/statements.d.ts +13 -0
  803. package/dist/storage/sqlite/statements.d.ts.map +1 -0
  804. package/dist/storage/sqlite/statements.js +35 -0
  805. package/dist/storage/sqlite/statements.js.map +1 -0
  806. package/dist/storage/sqlite/storage.d.ts +61 -0
  807. package/dist/storage/sqlite/storage.d.ts.map +1 -0
  808. package/dist/storage/sqlite/storage.js +644 -0
  809. package/dist/storage/sqlite/storage.js.map +1 -0
  810. package/dist/storage/sqlite/transactions.d.ts +23 -0
  811. package/dist/storage/sqlite/transactions.d.ts.map +1 -0
  812. package/dist/storage/sqlite/transactions.js +84 -0
  813. package/dist/storage/sqlite/transactions.js.map +1 -0
  814. package/dist/storage/types.d.ts +62 -0
  815. package/dist/storage/types.d.ts.map +1 -0
  816. package/dist/storage/types.js +1 -0
  817. package/dist/storage/types.js.map +1 -0
  818. package/dist/verification/diagnostics.d.ts +4 -0
  819. package/dist/verification/diagnostics.d.ts.map +1 -0
  820. package/dist/verification/diagnostics.js +106 -0
  821. package/dist/verification/diagnostics.js.map +1 -0
  822. package/dist/verification/index.d.ts +4 -0
  823. package/dist/verification/index.d.ts.map +1 -0
  824. package/dist/verification/index.js +3 -0
  825. package/dist/verification/index.js.map +1 -0
  826. package/dist/verification/inspection.d.ts +13 -0
  827. package/dist/verification/inspection.d.ts.map +1 -0
  828. package/dist/verification/inspection.js +87 -0
  829. package/dist/verification/inspection.js.map +1 -0
  830. package/dist/verification/inventory.d.ts +7 -0
  831. package/dist/verification/inventory.d.ts.map +1 -0
  832. package/dist/verification/inventory.js +55 -0
  833. package/dist/verification/inventory.js.map +1 -0
  834. package/dist/verification/types.d.ts +53 -0
  835. package/dist/verification/types.d.ts.map +1 -0
  836. package/dist/verification/types.js +12 -0
  837. package/dist/verification/types.js.map +1 -0
  838. package/dist/verification/verify.d.ts +4 -0
  839. package/dist/verification/verify.d.ts.map +1 -0
  840. package/dist/verification/verify.js +69 -0
  841. package/dist/verification/verify.js.map +1 -0
  842. package/examples/basic/.harness/fixtures.ts +5 -0
  843. package/examples/basic/.harness/packages/documents.xml +16 -0
  844. package/examples/basic/README.md +13 -0
  845. package/examples/basic/package.json +12 -0
  846. package/examples/basic/tests/documents.test.ts +19 -0
  847. package/examples/basic/tsconfig.json +15 -0
  848. package/examples/server-methods/.harness/fixtures.ts +18 -0
  849. package/examples/server-methods/.harness/mocks.json +6 -0
  850. package/examples/server-methods/.harness/packages/review.xml +69 -0
  851. package/examples/server-methods/README.md +14 -0
  852. package/examples/server-methods/package.json +12 -0
  853. package/examples/server-methods/tests/submission.test.ts +60 -0
  854. package/examples/server-methods/tsconfig.json +15 -0
  855. package/package.json +90 -5
  856. package/skills/innovator-harness/SKILL.md +109 -0
  857. package/skills/innovator-harness/agents/openai.yaml +7 -0
  858. package/skills/innovator-harness/assets/icon-small.png +0 -0
  859. package/skills/innovator-harness/assets/icon.png +0 -0
  860. package/src/baseline/catalog.ts +42 -0
  861. package/src/baseline/data/item-types.json +1062 -0
  862. package/src/baseline/data/properties.json +31286 -0
  863. package/src/baseline/data/records.json +6666 -0
  864. package/src/baseline/data/relationships.json +393 -0
  865. package/src/baseline/database.ts +39 -0
  866. package/src/baseline/source.ts +16 -0
  867. package/src/compatibility/capabilities.ts +626 -0
  868. package/src/compatibility/check.ts +483 -0
  869. package/src/compatibility/executions.ts +120 -0
  870. package/src/compatibility/executors.ts +180 -0
  871. package/src/compatibility/index.ts +22 -0
  872. package/src/compatibility/metadata.ts +219 -0
  873. package/src/compatibility/mocks.ts +32 -0
  874. package/src/compatibility/revisions.ts +45 -0
  875. package/src/compatibility/security.ts +102 -0
  876. package/src/compatibility/sources.ts +38 -0
  877. package/src/compatibility/types.ts +153 -0
  878. package/src/controls/clock.ts +108 -0
  879. package/src/controls/execution.ts +53 -0
  880. package/src/controls/failure-types.ts +61 -0
  881. package/src/controls/failure-validation.ts +99 -0
  882. package/src/controls/failures.ts +192 -0
  883. package/src/controls/ids.ts +87 -0
  884. package/src/controls/observers.ts +107 -0
  885. package/src/controls/state.ts +91 -0
  886. package/src/controls/targets.ts +123 -0
  887. package/src/controls/values.ts +44 -0
  888. package/src/controls/world.ts +31 -0
  889. package/src/core/budget.ts +25 -0
  890. package/src/core/context.ts +68 -0
  891. package/src/core/data.ts +273 -0
  892. package/src/core/deadline.ts +47 -0
  893. package/src/core/errors.ts +32 -0
  894. package/src/core/files.ts +45 -0
  895. package/src/core/index.ts +17 -0
  896. package/src/core/limits.ts +14 -0
  897. package/src/core/modules.ts +102 -0
  898. package/src/core/operation.ts +43 -0
  899. package/src/core/process.ts +55 -0
  900. package/src/core/resources.ts +34 -0
  901. package/src/core/runtime.ts +883 -0
  902. package/src/core/types.ts +80 -0
  903. package/src/diagnostics/source-location.ts +6 -0
  904. package/src/engine/instance.ts +428 -0
  905. package/src/engine.ts +9 -0
  906. package/src/fixtures/module.ts +182 -0
  907. package/src/fixtures/types.ts +9 -0
  908. package/src/harness/configuration.ts +426 -0
  909. package/src/harness/create.ts +214 -0
  910. package/src/harness/extensions.ts +86 -0
  911. package/src/harness/fixtures.ts +186 -0
  912. package/src/harness/runtime-identity.ts +41 -0
  913. package/src/harness/setup-cache.ts +56 -0
  914. package/src/harness/setup-image.ts +155 -0
  915. package/src/harness/setup-imports.ts +40 -0
  916. package/src/harness/setup-inputs.ts +80 -0
  917. package/src/harness/setup-module.ts +118 -0
  918. package/src/harness/world.ts +248 -0
  919. package/src/index.ts +84 -0
  920. package/src/instrumentation/failures.ts +148 -0
  921. package/src/instrumentation/recorder.ts +547 -0
  922. package/src/instrumentation/snapshots.ts +247 -0
  923. package/src/instrumentation/types.ts +126 -0
  924. package/src/items/codec.ts +198 -0
  925. package/src/items/item.ts +218 -0
  926. package/src/items/logical.ts +145 -0
  927. package/src/items/origins.ts +139 -0
  928. package/src/items/xml.ts +187 -0
  929. package/src/methods/csharp/base-input.ts +215 -0
  930. package/src/methods/csharp/cache.ts +67 -0
  931. package/src/methods/csharp/callbacks.ts +121 -0
  932. package/src/methods/csharp/compiler.ts +284 -0
  933. package/src/methods/csharp/context.ts +88 -0
  934. package/src/methods/csharp/documents.ts +186 -0
  935. package/src/methods/csharp/executor.ts +504 -0
  936. package/src/methods/csharp/index.ts +3 -0
  937. package/src/methods/csharp/method-build.ts +141 -0
  938. package/src/methods/csharp/origins.ts +126 -0
  939. package/src/methods/csharp/protocol.ts +104 -0
  940. package/src/methods/csharp/relationship-order.ts +76 -0
  941. package/src/methods/csharp/request-change.ts +349 -0
  942. package/src/methods/csharp/retained-items.ts +128 -0
  943. package/src/methods/csharp/security.ts +121 -0
  944. package/src/methods/csharp/templates.ts +92 -0
  945. package/src/methods/csharp/worker.ts +234 -0
  946. package/src/methods/event-data.ts +39 -0
  947. package/src/methods/types.ts +59 -0
  948. package/src/mocks/configuration.ts +158 -0
  949. package/src/mocks/parameters.ts +20 -0
  950. package/src/mocks/registry.ts +214 -0
  951. package/src/mocks/response.ts +128 -0
  952. package/src/mocks/types.ts +56 -0
  953. package/src/packages/bootstrap.ts +73 -0
  954. package/src/packages/candidates.ts +55 -0
  955. package/src/packages/defaults.ts +145 -0
  956. package/src/packages/diagnostics.ts +47 -0
  957. package/src/packages/draft.ts +280 -0
  958. package/src/packages/elements.ts +88 -0
  959. package/src/packages/evaluation.ts +89 -0
  960. package/src/packages/files.ts +332 -0
  961. package/src/packages/importer.ts +1257 -0
  962. package/src/packages/index.ts +7 -0
  963. package/src/packages/manifest.ts +158 -0
  964. package/src/packages/module.ts +36 -0
  965. package/src/packages/parser.ts +367 -0
  966. package/src/packages/plan.ts +872 -0
  967. package/src/packages/schema.ts +617 -0
  968. package/src/packages/selector.ts +104 -0
  969. package/src/packages/state.ts +82 -0
  970. package/src/packages/types.ts +25 -0
  971. package/src/platform/action-responses.ts +127 -0
  972. package/src/platform/actions.ts +11 -0
  973. package/src/platform/catalog.ts +220 -0
  974. package/src/platform/classifications.ts +165 -0
  975. package/src/platform/creation.ts +37 -0
  976. package/src/platform/engine.ts +2055 -0
  977. package/src/platform/errors.ts +39 -0
  978. package/src/platform/events/after.ts +149 -0
  979. package/src/platform/events/base-updates.ts +68 -0
  980. package/src/platform/events/bindings.ts +129 -0
  981. package/src/platform/events/data.ts +26 -0
  982. package/src/platform/events/inheritance.ts +98 -0
  983. package/src/platform/events/input.ts +12 -0
  984. package/src/platform/events/replacement.ts +109 -0
  985. package/src/platform/events/types.ts +56 -0
  986. package/src/platform/events/version.ts +38 -0
  987. package/src/platform/graph-actions.ts +198 -0
  988. package/src/platform/lifecycle.ts +549 -0
  989. package/src/platform/locks.ts +251 -0
  990. package/src/platform/projection.ts +262 -0
  991. package/src/platform/queries/conditions.ts +69 -0
  992. package/src/platform/queries/engine.ts +69 -0
  993. package/src/platform/queries/fields.ts +160 -0
  994. package/src/platform/queries/order.ts +105 -0
  995. package/src/platform/queries/paging.ts +66 -0
  996. package/src/platform/queries/planner.ts +244 -0
  997. package/src/platform/queries/relationships.ts +130 -0
  998. package/src/platform/queries/validation.ts +105 -0
  999. package/src/platform/query.ts +178 -0
  1000. package/src/platform/references/behavior.ts +36 -0
  1001. package/src/platform/references/catalog.ts +256 -0
  1002. package/src/platform/references/deletion.ts +130 -0
  1003. package/src/platform/references/maintenance.ts +175 -0
  1004. package/src/platform/references/policy.ts +115 -0
  1005. package/src/platform/references/sessions.ts +148 -0
  1006. package/src/platform/relationship-copy-policy.ts +66 -0
  1007. package/src/platform/relationship-copy.ts +218 -0
  1008. package/src/platform/relationship-type.ts +23 -0
  1009. package/src/platform/request.ts +139 -0
  1010. package/src/platform/revisions/policy.ts +126 -0
  1011. package/src/platform/revisions/sequences.ts +67 -0
  1012. package/src/platform/security/grants.ts +116 -0
  1013. package/src/platform/security/identities.ts +136 -0
  1014. package/src/platform/security/inherited-relationships.ts +103 -0
  1015. package/src/platform/security/method-execution.ts +34 -0
  1016. package/src/platform/security/permissions.ts +337 -0
  1017. package/src/platform/security/policy.ts +286 -0
  1018. package/src/platform/security/source-access.ts +148 -0
  1019. package/src/platform/security/source-inheritance.ts +134 -0
  1020. package/src/platform/security/system-identities.ts +16 -0
  1021. package/src/platform/security/teams.ts +100 -0
  1022. package/src/platform/security/time.ts +30 -0
  1023. package/src/platform/security/types.ts +17 -0
  1024. package/src/platform/trace.ts +111 -0
  1025. package/src/platform/unlocking.ts +295 -0
  1026. package/src/platform/values.ts +217 -0
  1027. package/src/platform/version-policy.ts +17 -0
  1028. package/src/platform/versioned-request.ts +154 -0
  1029. package/src/platform/versioning.ts +798 -0
  1030. package/src/queries/date.ts +28 -0
  1031. package/src/queries/decimal.ts +59 -0
  1032. package/src/queries/evaluate.ts +168 -0
  1033. package/src/queries/lexer.ts +109 -0
  1034. package/src/queries/like.ts +47 -0
  1035. package/src/queries/parser.ts +352 -0
  1036. package/src/queries/predicates.ts +85 -0
  1037. package/src/queries/types.ts +82 -0
  1038. package/src/queries/values.ts +104 -0
  1039. package/src/storage/documents.ts +20 -0
  1040. package/src/storage/metadata-epoch.ts +20 -0
  1041. package/src/storage/package-transaction.ts +25 -0
  1042. package/src/storage/properties.ts +31 -0
  1043. package/src/storage/sqlite/catalog.ts +89 -0
  1044. package/src/storage/sqlite/connections.ts +49 -0
  1045. package/src/storage/sqlite/errors.ts +23 -0
  1046. package/src/storage/sqlite/index.ts +13 -0
  1047. package/src/storage/sqlite/metadata.ts +216 -0
  1048. package/src/storage/sqlite/predicate.ts +301 -0
  1049. package/src/storage/sqlite/queries.ts +48 -0
  1050. package/src/storage/sqlite/schema.ts +288 -0
  1051. package/src/storage/sqlite/statements.ts +51 -0
  1052. package/src/storage/sqlite/storage.ts +949 -0
  1053. package/src/storage/sqlite/transactions.ts +108 -0
  1054. package/src/storage/types.ts +69 -0
  1055. package/src/verification/diagnostics.ts +124 -0
  1056. package/src/verification/index.ts +10 -0
  1057. package/src/verification/inspection.ts +108 -0
  1058. package/src/verification/inventory.ts +76 -0
  1059. package/src/verification/types.ts +61 -0
  1060. package/src/verification/verify.ts +11 -0
@@ -0,0 +1,1257 @@
1
+ import { baselineTypeNames } from "../baseline/catalog.js";
2
+ import { isBaselineSource } from "../baseline/source.js";
3
+ import { getOwn, setOwn } from "../core/data.js";
4
+ import { errorMessage } from "../core/errors.js";
5
+ import type { SourceLocation } from "../diagnostics/source-location.js";
6
+ import { withPackageTransaction } from "../storage/package-transaction.js";
7
+ import type {
8
+ CatalogEntry,
9
+ HarnessStorage,
10
+ StorageValue,
11
+ ItemTypeDefinition,
12
+ } from "../storage/types.js";
13
+ import {
14
+ bootstrapSource,
15
+ presentationTypes,
16
+ relationshipProperties,
17
+ stableId,
18
+ systemProperties,
19
+ versionableProperties,
20
+ } from "./bootstrap.js";
21
+ import { PackageDefaults } from "./defaults.js";
22
+ import { PackageImportError, throwImportErrors } from "./diagnostics.js";
23
+ import { ImportDraft, entryKey } from "./draft.js";
24
+ import type { DraftEntry, PendingValue } from "./draft.js";
25
+ import { childElements, itemProperties, itemType, textContent, walkElements } from "./elements.js";
26
+ import { evaluateImport, ImportTask } from "./evaluation.js";
27
+ import type { ImportWork } from "./evaluation.js";
28
+ import { ImportPlan } from "./plan.js";
29
+ import type { ImportAction, ImportAttempt, ImportRead } from "./plan.js";
30
+ import {
31
+ compileItemTypes,
32
+ convertProperties,
33
+ reusableItemTypes,
34
+ validateReferences,
35
+ } from "./schema.js";
36
+ import { matchesImportValue, parseWhere } from "./selector.js";
37
+ import { readImportState } from "./state.js";
38
+ import type { AmlDocument, AmlElement } from "./types.js";
39
+
40
+ export interface PackageLoadReport {
41
+ readonly documents: readonly {
42
+ readonly path: string;
43
+ readonly sha256: string;
44
+ }[];
45
+ readonly added: number;
46
+ readonly updated: number;
47
+ readonly deleted: number;
48
+ readonly itemTypes: readonly string[];
49
+ readonly generatedIds: readonly {
50
+ readonly id: string;
51
+ readonly source: SourceLocation;
52
+ }[];
53
+ }
54
+
55
+ export class PackageImporter {
56
+ constructor(private readonly storage: HarnessStorage) {}
57
+
58
+ import(
59
+ documents: readonly AmlDocument[],
60
+ fixtureFiles: ReadonlySet<string> = new Set(),
61
+ ): PackageLoadReport {
62
+ return withPackageTransaction(this.storage, () =>
63
+ new ImportSession(this.storage).import(documents, fixtureFiles),
64
+ );
65
+ }
66
+ }
67
+
68
+ /** All planning state belongs to one import and is read inside its write boundary. */
69
+ class ImportSession {
70
+ private readonly draft: ImportDraft;
71
+ private readonly defaults: PackageDefaults;
72
+ private readonly generatedIds: { id: string; source: SourceLocation }[] = [];
73
+ private readonly resolving = new Set<AmlElement>();
74
+ private readonly documentHashes = new Map<string, string>();
75
+ private addedCount = 0;
76
+ private updatedCount = 0;
77
+ private fixtureFiles: ReadonlySet<string> = new Set();
78
+ private reads: ImportRead[] | undefined;
79
+ private sharedAdditions: ReadonlySet<string> = new Set();
80
+
81
+ constructor(private readonly storage: HarnessStorage) {
82
+ this.draft = new ImportDraft(readImportState(storage));
83
+ this.defaults = new PackageDefaults(this.draft);
84
+ }
85
+
86
+ import(
87
+ documents: readonly AmlDocument[],
88
+ fixtureFiles: ReadonlySet<string>,
89
+ ): PackageLoadReport {
90
+ this.fixtureFiles = fixtureFiles;
91
+ this.defaults.initialize();
92
+
93
+ for (const document of documents) {
94
+ this.documentHashes.set(document.file, document.sha256);
95
+ }
96
+
97
+ const initial = this.draft.checkpoint();
98
+ const plan = new ImportPlan(documents, fixtureFiles, initial.entries);
99
+ this.sharedAdditions = plan.sharedAdditions;
100
+ const errors = [
101
+ ...plan.execute({
102
+ reset: () => {
103
+ this.draft.restore(initial);
104
+ this.addedCount = 0;
105
+ this.updatedCount = 0;
106
+ this.generatedIds.length = 0;
107
+ },
108
+
109
+ attempt: (action) => this.attemptAction(action),
110
+
111
+ equal: (left, right) => {
112
+ if (left === undefined || right === undefined) {
113
+ return left === right;
114
+ }
115
+
116
+ try {
117
+ return this.resolveValue(left) === this.resolveValue(right);
118
+ } catch (error) {
119
+ if (!(error instanceof PackageImportError)) {
120
+ throw error;
121
+ }
122
+
123
+ return false;
124
+ }
125
+ },
126
+ }),
127
+ ];
128
+ const catalog = this.resolveCatalog(errors);
129
+ throwImportErrors(errors);
130
+ this.reconcileSystemProperties(catalog);
131
+ this.completeSystemReferences(catalog);
132
+ const definitions = this.defineItemTypes(catalog);
133
+
134
+ this.persistCatalog(catalog);
135
+ validateReferences(catalog, definitions, this.storage);
136
+
137
+ return this.loadReport(documents, definitions);
138
+ }
139
+
140
+ private defineItemTypes(
141
+ catalog: ReadonlyMap<string, CatalogEntry>,
142
+ ): readonly ItemTypeDefinition[] {
143
+ const reused = reusableItemTypes(
144
+ catalog,
145
+ this.draft.changed,
146
+ this.draft.deleted.values(),
147
+ this.storage,
148
+ );
149
+
150
+ if (reused) {
151
+ return reused;
152
+ }
153
+
154
+ const definitions = compileItemTypes(catalog, this.storage);
155
+
156
+ for (const definition of definitions) {
157
+ this.withSource(definition.source ?? bootstrapSource("/"), () =>
158
+ this.storage.defineItemType(definition),
159
+ );
160
+ }
161
+
162
+ return definitions;
163
+ }
164
+
165
+ private loadReport(
166
+ documents: readonly AmlDocument[],
167
+ definitions: readonly ItemTypeDefinition[],
168
+ ): PackageLoadReport {
169
+ for (const document of documents) {
170
+ this.storage.putDocument({
171
+ path: document.file,
172
+ sha256: document.sha256,
173
+ xml: document.xml,
174
+ });
175
+ }
176
+
177
+ return Object.freeze({
178
+ documents: Object.freeze(
179
+ documents.map(({ file, sha256 }) => Object.freeze({ path: file, sha256 })),
180
+ ),
181
+ added: this.addedCount,
182
+ updated: this.updatedCount,
183
+ deleted: this.draft.deleted.size,
184
+ itemTypes: Object.freeze(definitions.map((definition) => definition.name)),
185
+ generatedIds: Object.freeze(this.generatedIds.map((entry) => Object.freeze(entry))),
186
+ });
187
+ }
188
+
189
+ private persistCatalog(catalog: ReadonlyMap<string, CatalogEntry>): void {
190
+ for (const entry of this.draft.deleted.values()) {
191
+ if (
192
+ this.storage.getItemType(entry.type) &&
193
+ this.storage.getItem(entry.type, entry.id)
194
+ ) {
195
+ this.storage.deleteItem(entry.type, entry.id);
196
+ }
197
+
198
+ this.storage.deleteCatalogEntry(entry.type, entry.id);
199
+ }
200
+
201
+ for (const key of this.draft.changed) {
202
+ const entry = catalog.get(key);
203
+
204
+ if (entry) {
205
+ this.persistChangedEntry(entry, catalog);
206
+ }
207
+ }
208
+ }
209
+
210
+ private persistChangedEntry(
211
+ entry: CatalogEntry,
212
+ catalog: ReadonlyMap<string, CatalogEntry>,
213
+ ): void {
214
+ const definition = this.storage.getItemType(entry.type);
215
+
216
+ if (!definition) {
217
+ const metadata = [...catalog.values()].find(
218
+ (candidate) =>
219
+ candidate.type === "ItemType" && candidate.properties.name === entry.type,
220
+ );
221
+
222
+ if (metadata && metadata.properties.implementation_type !== "table") {
223
+ throw new PackageImportError(
224
+ "UNSUPPORTED_IMPLEMENTATION",
225
+ `Records of '${entry.type}' use '${metadata.properties.implementation_type}' storage and require an adapter.`,
226
+ entry.source,
227
+ );
228
+ }
229
+
230
+ throw new PackageImportError(
231
+ "MISSING_ITEM_TYPE",
232
+ `No ItemType definition for '${entry.type}'. Supply its package explicitly.`,
233
+ entry.source,
234
+ { reference: { type: "ItemType", name: entry.type } },
235
+ );
236
+ }
237
+
238
+ this.withSource(entry.source, () => {
239
+ const properties = convertProperties(entry, definition);
240
+ const existing = this.storage.getItem(entry.type, entry.id);
241
+
242
+ if (existing) {
243
+ this.storage.updateItem(entry.type, entry.id, properties);
244
+ } else {
245
+ if (definition.isVersionable) {
246
+ const defaults = { config_id: entry.id, generation: 1, is_current: 1 };
247
+
248
+ for (const [name, value] of Object.entries(defaults)) {
249
+ if (properties[name] === undefined) {
250
+ setOwn(properties, name, value);
251
+ }
252
+ }
253
+ }
254
+
255
+ this.storage.insertItem({
256
+ id: entry.id,
257
+ type: entry.type,
258
+ properties,
259
+ });
260
+ }
261
+
262
+ this.storage.putCatalogEntry({ ...entry, properties });
263
+ });
264
+ }
265
+
266
+ private importAction(element: AmlElement): string {
267
+ const type = itemType(element);
268
+
269
+ if (textContent(element).trim()) {
270
+ throw new PackageImportError(
271
+ "INVALID_ITEM_TEXT",
272
+ "An Item may only contain property elements, Relationships, and whitespace.",
273
+ element.source,
274
+ );
275
+ }
276
+
277
+ let action = element.attributes.action ?? "get";
278
+
279
+ if (this.fixtureFiles.has(element.source.file)) {
280
+ if (
281
+ [
282
+ "ItemType",
283
+ "Property",
284
+ "RelationshipType",
285
+ "Server Event",
286
+ "Method",
287
+ "SQL",
288
+ "ItemType Life Cycle",
289
+ "Life Cycle Map",
290
+ "Life Cycle State",
291
+ "Life Cycle Transition",
292
+ ].includes(type)
293
+ ) {
294
+ throw new PackageImportError(
295
+ "FIXTURE_DEFINITION",
296
+ `Fixture files contain starting data. Put '${type}' definitions in packages.`,
297
+ element.source,
298
+ );
299
+ }
300
+
301
+ if (
302
+ action === "add" &&
303
+ element.attributes.id &&
304
+ this.draft.entries.has(entryKey(type, element.attributes.id))
305
+ ) {
306
+ action = "edit";
307
+ }
308
+ }
309
+
310
+ for (const attribute of ["idlist", "condition", "levels", "queryType"]) {
311
+ if (element.attributes[attribute] !== undefined) {
312
+ throw new PackageImportError(
313
+ "UNSUPPORTED_SELECTOR",
314
+ `Item attribute '${attribute}' is not supported by package loading.`,
315
+ element.source,
316
+ );
317
+ }
318
+ }
319
+
320
+ return action;
321
+ }
322
+
323
+ private attemptAction(action: ImportAction): ImportAttempt {
324
+ const added = this.addedCount;
325
+ const updated = this.updatedCount;
326
+ const generated = this.generatedIds.length;
327
+ const reads: ImportRead[] = [];
328
+ this.reads = reads;
329
+ this.draft.begin(action.id);
330
+
331
+ try {
332
+ evaluateImport(new ImportTask(this.applyItemSteps(action.element)));
333
+ const changes = this.draft.changes();
334
+ this.draft.commit();
335
+
336
+ return { reads, changes };
337
+ } catch (error) {
338
+ const changes = this.draft.changes();
339
+ this.draft.rollback();
340
+ this.addedCount = added;
341
+ this.updatedCount = updated;
342
+ this.generatedIds.length = generated;
343
+
344
+ if (!(error instanceof PackageImportError)) {
345
+ throw error;
346
+ }
347
+
348
+ return { reads, changes, error };
349
+ } finally {
350
+ this.reads = undefined;
351
+ }
352
+ }
353
+
354
+ private *applyItemSteps(
355
+ element: AmlElement,
356
+ parent?: DraftEntry,
357
+ ): Generator<ImportWork, string, void> {
358
+ const type = itemType(element);
359
+ const action = this.importAction(element);
360
+
361
+ if (action === "get") {
362
+ const selected = new ImportTask(this.selectOneSteps(element, true, parent));
363
+ yield selected;
364
+
365
+ return selected.value().id;
366
+ }
367
+
368
+ if (action === "delete") {
369
+ const deletion = new ImportTask(this.deleteItemSteps(element, type, parent));
370
+ yield deletion;
371
+
372
+ return deletion.value();
373
+ }
374
+
375
+ if (action !== "add" && action !== "edit") {
376
+ throw new PackageImportError(
377
+ "UNSUPPORTED_IMPORT_ACTION",
378
+ `Import action '${action}' is not implemented. Package loading never executes Methods or platform events.`,
379
+ element.source,
380
+ );
381
+ }
382
+
383
+ const prepared = new ImportTask(this.prepareEntrySteps(element, type, action, parent));
384
+ yield prepared;
385
+ const { entry, repeatedAddition } = prepared.value();
386
+ yield new ImportTask(this.applyPropertiesSteps(element, entry, repeatedAddition, parent));
387
+
388
+ if (type === "Property" && action === "add") {
389
+ this.defaults.replaceProperty(entry);
390
+ this.replaceGeneratedProperty(entry);
391
+ }
392
+
393
+ if (type === "ItemType") {
394
+ this.addSystemProperties(entry);
395
+ }
396
+
397
+ for (const relationships of childElements(element).filter(
398
+ (child) => child.name === "Relationships",
399
+ )) {
400
+ if (textContent(relationships).trim()) {
401
+ throw new PackageImportError(
402
+ "INVALID_RELATIONSHIPS",
403
+ "Relationships may only contain Items and whitespace.",
404
+ relationships.source,
405
+ );
406
+ }
407
+
408
+ for (const relationship of childElements(relationships)) {
409
+ yield new ImportTask(this.applyItemSteps(relationship, entry));
410
+ }
411
+ }
412
+
413
+ return entry.id;
414
+ }
415
+
416
+ private *deleteItemSteps(
417
+ element: AmlElement,
418
+ type: string,
419
+ parent?: DraftEntry,
420
+ ): Generator<ImportWork, string, void> {
421
+ if (childElements(element).length) {
422
+ throw new PackageImportError(
423
+ "UNSUPPORTED_SELECTOR",
424
+ "Delete actions accept only an ID or where selector; child elements are not implemented.",
425
+ element.source,
426
+ );
427
+ }
428
+
429
+ if (type === "ItemType" || type === "Property") {
430
+ throw new PackageImportError(
431
+ "UNSUPPORTED_SCHEMA_CHANGE",
432
+ "Deleting ItemTypes or Properties requires a schema migration implementation.",
433
+ element.source,
434
+ );
435
+ }
436
+
437
+ const selection = new ImportTask(this.selectSteps(element, false, parent, "optional"));
438
+ yield selection;
439
+ const matches = selection.value();
440
+
441
+ // Export installers also remove generated forms/views that may not exist locally.
442
+ // A declarative delete is satisfied when no matching record remains.
443
+ for (const entry of matches) {
444
+ const key = entryKey(type, entry.id);
445
+ this.draft.remove(key, entry);
446
+ }
447
+
448
+ return matches[0]?.id ?? "";
449
+ }
450
+
451
+ private *prepareEntrySteps(
452
+ element: AmlElement,
453
+ type: string,
454
+ action: string,
455
+ parent?: DraftEntry,
456
+ ): Generator<ImportWork, { entry: DraftEntry; repeatedAddition: boolean }, void> {
457
+ if (action === "add") {
458
+ return this.addEntry(element, type);
459
+ }
460
+
461
+ const selection = new ImportTask(this.selectOneSteps(element, false, parent));
462
+ yield selection;
463
+ this.updatedCount += 1;
464
+
465
+ return { entry: selection.value(), repeatedAddition: false };
466
+ }
467
+
468
+ private addEntry(
469
+ element: AmlElement,
470
+ type: string,
471
+ ): { entry: DraftEntry; repeatedAddition: boolean } {
472
+ if (element.attributes.where !== undefined) {
473
+ throw new PackageImportError(
474
+ "UNSUPPORTED_SELECTOR",
475
+ "An add action cannot contain a where selector.",
476
+ element.source,
477
+ );
478
+ }
479
+
480
+ const suppliedId = element.attributes.id;
481
+ const documentHash = this.documentHashes.get(element.source.file);
482
+ const id = suppliedId ?? stableId(`package-item:${documentHash}:${element.source.path}`);
483
+
484
+ if (id.trim().length === 0) {
485
+ throw new PackageImportError("INVALID_ID", "Item ID cannot be empty.", element.source);
486
+ }
487
+
488
+ const key = entryKey(type, id);
489
+ const existing = this.draft.entries.get(key);
490
+ const replacingDefault = existing && isBaselineSource(existing.source);
491
+ const repeatedAddition = Boolean(
492
+ existing &&
493
+ this.sharedAdditions.has(key) &&
494
+ existing.source.file !== element.source.file,
495
+ );
496
+
497
+ if (!replacingDefault && !repeatedAddition) {
498
+ this.reads?.push({
499
+ kind: "absent",
500
+ key,
501
+ type,
502
+ source: element.source,
503
+ matchedKeys: existing ? [key] : [],
504
+
505
+ matches: (candidate) => entryKey(candidate.type, candidate.id) === key,
506
+ });
507
+ }
508
+
509
+ if (existing && !replacingDefault && !repeatedAddition) {
510
+ throw new PackageImportError(
511
+ "DUPLICATE_ITEM",
512
+ `An item of type '${type}' with ID '${id}' already exists at ${existing.source.file}:${existing.source.line}:${existing.source.column}. Use edit for patches.`,
513
+ element.source,
514
+ { relatedSources: [existing.source] },
515
+ );
516
+ }
517
+
518
+ const entry =
519
+ existing && repeatedAddition
520
+ ? existing
521
+ : {
522
+ id,
523
+ type,
524
+ attributes: element.attributes,
525
+ properties: replacingDefault ? { ...existing.properties } : {},
526
+ source: element.source,
527
+ };
528
+
529
+ this.replaceDefaultItemType(element, type, id);
530
+
531
+ this.recordAddition(entry, repeatedAddition, suppliedId === undefined);
532
+
533
+ return { entry, repeatedAddition };
534
+ }
535
+
536
+ private recordAddition(entry: DraftEntry, repeatedAddition: boolean, generated: boolean): void {
537
+ if (!repeatedAddition) {
538
+ this.draft.put(entry);
539
+ this.addedCount += 1;
540
+ }
541
+
542
+ if (generated) {
543
+ this.generatedIds.push({ id: entry.id, source: entry.source });
544
+ }
545
+ }
546
+
547
+ private replaceDefaultItemType(element: AmlElement, type: string, id: string): void {
548
+ if (type === "ItemType") {
549
+ const name = itemProperties(element).find((property) => property.name === "name");
550
+
551
+ if (name) {
552
+ this.defaults.replaceItemType(textContent(name), id);
553
+ }
554
+ }
555
+ }
556
+
557
+ private *applyPropertiesSteps(
558
+ element: AmlElement,
559
+ entry: DraftEntry,
560
+ repeatedAddition: boolean,
561
+ parent?: DraftEntry,
562
+ ): Generator<ImportWork, void, void> {
563
+ const properties = itemProperties(element);
564
+ this.draft.touch(
565
+ entry,
566
+ properties.map((property) => property.name),
567
+ );
568
+
569
+ for (const property of properties) {
570
+ const task = new ImportTask(
571
+ this.importPropertySteps(property, entry, repeatedAddition),
572
+ );
573
+ yield task;
574
+ setOwn(entry.properties, property.name, task.value());
575
+ }
576
+
577
+ if (parent) {
578
+ this.draft.touch(entry, ["source_id"]);
579
+ const sourceId = getOwn(entry.properties, "source_id");
580
+
581
+ if (sourceId !== undefined) {
582
+ const resolved = new ImportTask(this.resolveValueSteps(sourceId));
583
+ yield resolved;
584
+
585
+ if (String(resolved.value()).toLowerCase() !== parent.id.toLowerCase()) {
586
+ throw new PackageImportError(
587
+ "RELATIONSHIP_SOURCE_MISMATCH",
588
+ "A nested relationship's source_id must identify its parent.",
589
+ element.source,
590
+ );
591
+ }
592
+ }
593
+
594
+ entry.properties.source_id = parent.id;
595
+ }
596
+
597
+ if (!repeatedAddition) {
598
+ entry.attributes = element.attributes;
599
+ entry.source = element.source;
600
+ }
601
+ }
602
+
603
+ private *importPropertySteps(
604
+ property: AmlElement,
605
+ entry: DraftEntry,
606
+ repeatedAddition: boolean,
607
+ ): Generator<ImportWork, PendingValue, void> {
608
+ // A family identity does not require the first generation to be present.
609
+ let value: PendingValue;
610
+
611
+ if (property.name === "config_id" && childElements(property).length === 0) {
612
+ value = textContent(property).trim() || null;
613
+ } else {
614
+ const propertyValue = new ImportTask(
615
+ this.propertyValueSteps(property, presentationTypes.has(entry.type)),
616
+ );
617
+ yield propertyValue;
618
+ value = propertyValue.value();
619
+ }
620
+
621
+ const previous = getOwn(entry.properties, property.name);
622
+
623
+ if (repeatedAddition && previous !== undefined) {
624
+ const before = new ImportTask(this.resolveValueSteps(previous));
625
+ yield before;
626
+ const after = new ImportTask(this.resolveValueSteps(value));
627
+ yield after;
628
+
629
+ if (before.value() !== after.value()) {
630
+ throw new PackageImportError(
631
+ "DUPLICATE_ITEM",
632
+ `Repeated addition of '${entry.type}:${entry.id}' conflicts on '${property.name}'.`,
633
+ property.source,
634
+ { relatedSources: [entry.source] },
635
+ );
636
+ }
637
+ }
638
+
639
+ return value;
640
+ }
641
+
642
+ private replaceGeneratedProperty(entry: DraftEntry): void {
643
+ const owner = entry.properties.source_id;
644
+ const name = entry.properties.name;
645
+
646
+ if (typeof owner !== "string" || typeof name !== "string") {
647
+ return;
648
+ }
649
+
650
+ const generatedId = stableId(`system-property-v1:${owner}:${name}`);
651
+
652
+ if (entry.id === generatedId) {
653
+ return;
654
+ }
655
+
656
+ const key = entryKey("Property", generatedId);
657
+
658
+ if (this.draft.entries.has(key)) {
659
+ const stored = this.storage.getCatalogEntry("Property", generatedId);
660
+ this.draft.remove(
661
+ key,
662
+ stored ? { ...stored, properties: { ...stored.properties } } : undefined,
663
+ );
664
+ }
665
+ }
666
+
667
+ private reconcileSystemProperties(catalog: Map<string, CatalogEntry>): void {
668
+ for (const entry of catalog.values()) {
669
+ const owner = entry.properties.source_id;
670
+ const name = entry.properties.name;
671
+
672
+ if (
673
+ entry.type !== "Property" ||
674
+ typeof owner !== "string" ||
675
+ typeof name !== "string"
676
+ ) {
677
+ continue;
678
+ }
679
+
680
+ const generatedId = stableId(`system-property-v1:${owner}:${name}`);
681
+
682
+ if (entry.id === generatedId) {
683
+ continue;
684
+ }
685
+
686
+ const key = entryKey("Property", generatedId);
687
+ const generated = catalog.get(key);
688
+
689
+ if (generated) {
690
+ catalog.delete(key);
691
+ const stored = this.storage.getCatalogEntry("Property", generatedId);
692
+ this.draft.remove(
693
+ key,
694
+ stored ? { ...generated, properties: { ...generated.properties } } : undefined,
695
+ );
696
+ }
697
+ }
698
+ }
699
+
700
+ private addSystemProperties(entry: DraftEntry): void {
701
+ const properties = [...systemProperties];
702
+
703
+ if (entry.properties.is_versionable === "1" || entry.properties.is_versionable === 1) {
704
+ properties.push(...versionableProperties);
705
+ }
706
+
707
+ if (entry.properties.is_relationship === "1") {
708
+ properties.push(...relationshipProperties);
709
+ }
710
+
711
+ const existing = new Set(
712
+ [...this.draft.ofType("Property")]
713
+ .filter((candidate) => candidate.properties.source_id === entry.id)
714
+ .map((candidate) => candidate.properties.name),
715
+ );
716
+
717
+ for (const property of properties) {
718
+ if (existing.has(property.name)) {
719
+ continue;
720
+ }
721
+
722
+ const id = stableId(`system-property-v1:${entry.id}:${property.name}`);
723
+ this.draft.put({
724
+ id,
725
+ type: "Property",
726
+ attributes: {},
727
+ source: entry.source,
728
+ properties: {
729
+ name: property.name,
730
+ data_type: property.dataType,
731
+ source_id: entry.id,
732
+ },
733
+ });
734
+ existing.add(property.name);
735
+ }
736
+ }
737
+
738
+ private completeSystemReferences(catalog: Map<string, CatalogEntry>): void {
739
+ const user = [...catalog.values()].find(
740
+ (entry) =>
741
+ entry.type === "ItemType" && String(entry.properties.name).toLowerCase() === "user",
742
+ );
743
+
744
+ if (!user) {
745
+ return;
746
+ }
747
+
748
+ for (const entry of catalog.values()) {
749
+ const owner = entry.properties.source_id;
750
+
751
+ if (
752
+ entry.type !== "Property" ||
753
+ entry.properties.name !== "locked_by_id" ||
754
+ entry.properties.data_type !== "item" ||
755
+ entry.properties.data_source === user.id ||
756
+ typeof owner !== "string" ||
757
+ entry.id !== stableId(`system-property-v1:${owner}:locked_by_id`)
758
+ ) {
759
+ continue;
760
+ }
761
+
762
+ const updated = { ...entry, properties: { ...entry.properties, data_source: user.id } };
763
+ this.draft.put({ ...updated, properties: { ...updated.properties } });
764
+ catalog.set(entryKey(entry.type, entry.id), updated);
765
+ }
766
+ }
767
+
768
+ private *propertyValueSteps(
769
+ property: AmlElement,
770
+ opaque = false,
771
+ ): Generator<ImportWork, PendingValue, void> {
772
+ const children = childElements(property);
773
+ const value = textContent(property);
774
+ const nullAttribute = validatePropertyAttributes(property);
775
+
776
+ if (nullAttribute === "1") {
777
+ if (children.length || value.trim()) {
778
+ throw new PackageImportError(
779
+ "INVALID_NULL",
780
+ "A null property cannot also contain a value.",
781
+ property.source,
782
+ );
783
+ }
784
+
785
+ return null;
786
+ }
787
+
788
+ if (children.length > 0) {
789
+ const child = children[0];
790
+
791
+ if (children.length !== 1 || child?.name !== "Item" || value.trim()) {
792
+ throw new PackageImportError(
793
+ "UNSUPPORTED_PROPERTY_MARKUP",
794
+ "A property may contain text or one nested Item reference.",
795
+ property.source,
796
+ );
797
+ }
798
+
799
+ if ((child.attributes.action ?? "get") === "get") {
800
+ if (opaque && child.attributes.id) {
801
+ return child.attributes.id;
802
+ }
803
+
804
+ return { kind: "reference", element: child };
805
+ }
806
+
807
+ const nested = new ImportTask(this.applyItemSteps(child));
808
+ yield nested;
809
+ const id = nested.value();
810
+
811
+ return {
812
+ kind: "typed-reference",
813
+ type: itemType(child),
814
+ id,
815
+ source: child.source,
816
+ };
817
+ }
818
+
819
+ const referencedType = property.attributes.type;
820
+
821
+ if (referencedType && value.trim()) {
822
+ if (opaque || presentationTypes.has(referencedType)) {
823
+ return value.trim();
824
+ }
825
+
826
+ return {
827
+ kind: "typed-reference",
828
+ type: referencedType,
829
+ id: value.trim(),
830
+ source: property.source,
831
+ };
832
+ }
833
+
834
+ return value;
835
+ }
836
+
837
+ private *selectSteps(
838
+ element: AmlElement,
839
+ useProperties: boolean,
840
+ parent?: DraftEntry,
841
+ kind: ImportRead["kind"] = "unique",
842
+ ): Generator<ImportWork, DraftEntry[], void> {
843
+ const type = itemType(element);
844
+ this.validateSelector(element, useProperties);
845
+ const id = element.attributes.id;
846
+ const filters: { name: string; value: StorageValue }[] = [...parseWhere(element)];
847
+ const properties = useProperties ? itemProperties(element) : [];
848
+
849
+ for (const property of properties) {
850
+ const value = new ImportTask(this.selectorValueSteps(property));
851
+ yield value;
852
+ filters.push({ name: property.name, value: value.value() });
853
+ }
854
+
855
+ if (id === undefined && filters.length === 0 && properties.length === 0) {
856
+ throw new PackageImportError(
857
+ "UNBOUNDED_SELECTOR",
858
+ "An import selector needs an ID, equality properties, or a supported where clause.",
859
+ element.source,
860
+ );
861
+ }
862
+
863
+ const dataTypes = new Map(
864
+ filters.map(({ name }) => [name, this.propertyDataType(type, name)]),
865
+ );
866
+ const matchedKeys: string[] = [];
867
+ this.reads?.push({
868
+ kind,
869
+ type,
870
+ ...(id !== undefined ? { key: entryKey(type, id) } : {}),
871
+ source: element.source,
872
+ matchedKeys,
873
+
874
+ // The planner invokes this later, after the current interpreter has completed.
875
+ matches: (entry) => {
876
+ const result = this.matchEntry(entry, type, id, parent, filters, dataTypes);
877
+
878
+ return result instanceof ImportTask ? evaluateImport(result) : result;
879
+ },
880
+ });
881
+ const selected: DraftEntry[] = [];
882
+
883
+ const entries =
884
+ id === undefined
885
+ ? this.draft.ofType(type)
886
+ : [this.draft.entries.get(entryKey(type, id))];
887
+
888
+ for (const entry of entries) {
889
+ if (!entry) {
890
+ continue;
891
+ }
892
+
893
+ const match = this.matchEntry(entry, type, id, parent, filters, dataTypes);
894
+
895
+ if (match instanceof ImportTask) {
896
+ yield match;
897
+ }
898
+
899
+ if (match instanceof ImportTask ? match.value() : match) {
900
+ selected.push(entry);
901
+ matchedKeys.push(entryKey(entry.type, entry.id));
902
+ }
903
+ }
904
+
905
+ return selected;
906
+ }
907
+
908
+ private matchEntry(
909
+ entry: DraftEntry,
910
+ type: string,
911
+ id: string | undefined,
912
+ parent: DraftEntry | undefined,
913
+ predicates: readonly { name: string; value: StorageValue }[],
914
+ dataTypes: ReadonlyMap<string, string | undefined>,
915
+ ): boolean | ImportTask<boolean> {
916
+ if (
917
+ entry.type.toLowerCase() !== type.toLowerCase() ||
918
+ (id !== undefined && entry.id.toLowerCase() !== id.toLowerCase())
919
+ ) {
920
+ return false;
921
+ }
922
+
923
+ const criteria = parent
924
+ ? [{ name: "source_id", value: parent.id }, ...predicates]
925
+ : predicates;
926
+
927
+ for (const { name, value } of criteria) {
928
+ const actual = this.lookupProperty(entry, name);
929
+
930
+ if (actual !== null && typeof actual === "object") {
931
+ return new ImportTask(
932
+ this.matchesEntrySteps(entry, type, id, parent, predicates, dataTypes),
933
+ );
934
+ }
935
+
936
+ if (parent && name === "source_id" && actual !== parent.id) {
937
+ return false;
938
+ }
939
+
940
+ if (!matchesImportValue(actual, value, name, dataTypes.get(name))) {
941
+ return false;
942
+ }
943
+ }
944
+
945
+ return true;
946
+ }
947
+
948
+ private *matchesEntrySteps(
949
+ entry: DraftEntry,
950
+ type: string,
951
+ id: string | undefined,
952
+ parent: DraftEntry | undefined,
953
+ predicates: readonly { name: string; value: StorageValue }[],
954
+ dataTypes: ReadonlyMap<string, string | undefined>,
955
+ ): Generator<ImportWork, boolean, void> {
956
+ if (
957
+ entry.type.toLowerCase() !== type.toLowerCase() ||
958
+ (id !== undefined && entry.id.toLowerCase() !== id.toLowerCase())
959
+ ) {
960
+ return false;
961
+ }
962
+
963
+ if (parent) {
964
+ const sourceId = new ImportTask(this.lookupPropertySteps(entry, "source_id"));
965
+ yield sourceId;
966
+
967
+ if (sourceId.value() !== parent.id) {
968
+ return false;
969
+ }
970
+ }
971
+
972
+ for (const { name, value } of predicates) {
973
+ const actual = new ImportTask(this.lookupPropertySteps(entry, name));
974
+ yield actual;
975
+
976
+ if (!matchesImportValue(actual.value(), value, name, dataTypes.get(name))) {
977
+ return false;
978
+ }
979
+ }
980
+
981
+ return true;
982
+ }
983
+
984
+ private validateSelector(element: AmlElement, useProperties: boolean): void {
985
+ for (const attribute of ["idlist", "condition", "levels", "queryType"]) {
986
+ if (element.attributes[attribute] !== undefined) {
987
+ throw new PackageImportError(
988
+ "UNSUPPORTED_SELECTOR",
989
+ `Item attribute '${attribute}' is not supported by package loading.`,
990
+ element.source,
991
+ );
992
+ }
993
+ }
994
+
995
+ if (
996
+ useProperties &&
997
+ childElements(element).some((child) => child.name === "Relationships")
998
+ ) {
999
+ throw new PackageImportError(
1000
+ "UNSUPPORTED_SELECTOR",
1001
+ "Relationship queries are not implemented in package get selectors.",
1002
+ element.source,
1003
+ );
1004
+ }
1005
+ }
1006
+
1007
+ private propertyDataType(type: string, name: string): string | undefined {
1008
+ let dataType =
1009
+ this.storage.getItemType(type)?.properties.find((property) => property.name === name)
1010
+ ?.dataType ?? systemProperties.find((property) => property.name === name)?.dataType;
1011
+ const owner = [...this.draft.ofType("ItemType")].find(
1012
+ (candidate) =>
1013
+ candidate.type === "ItemType" &&
1014
+ (typeof candidate.properties.name === "string"
1015
+ ? candidate.properties.name
1016
+ : ""
1017
+ ).toLowerCase() === type.toLowerCase(),
1018
+ );
1019
+
1020
+ if (owner) {
1021
+ const property = [...this.draft.ofType("Property")].find(
1022
+ (candidate) =>
1023
+ candidate.type === "Property" &&
1024
+ candidate.properties.name === name &&
1025
+ typeof candidate.properties.source_id === "string" &&
1026
+ candidate.properties.source_id.toLowerCase() === owner.id.toLowerCase(),
1027
+ );
1028
+
1029
+ if (typeof property?.properties.data_type === "string") {
1030
+ dataType = property.properties.data_type;
1031
+ }
1032
+ }
1033
+
1034
+ return dataType;
1035
+ }
1036
+
1037
+ private *selectorValueSteps(property: AmlElement): Generator<ImportWork, StorageValue, void> {
1038
+ for (const element of walkElements([property])) {
1039
+ if (element.name === "Item" && (element.attributes.action ?? "get") !== "get") {
1040
+ throw new PackageImportError(
1041
+ "UNSUPPORTED_SELECTOR",
1042
+ "Nested Items in selectors must use the get action.",
1043
+ element.source,
1044
+ );
1045
+ }
1046
+ }
1047
+
1048
+ const value = new ImportTask(this.propertyValueSteps(property));
1049
+ yield value;
1050
+ const resolved = new ImportTask(this.resolveValueSteps(value.value()));
1051
+ yield resolved;
1052
+
1053
+ return resolved.value();
1054
+ }
1055
+
1056
+ private *selectOneSteps(
1057
+ element: AmlElement,
1058
+ useProperties = true,
1059
+ parent?: DraftEntry,
1060
+ ): Generator<ImportWork, DraftEntry, void> {
1061
+ const selection = new ImportTask(this.selectSteps(element, useProperties, parent));
1062
+ yield selection;
1063
+ const matches = selection.value();
1064
+
1065
+ if (matches.length === 0) {
1066
+ return this.noMatch(element);
1067
+ }
1068
+
1069
+ if (matches.length !== 1) {
1070
+ const candidates = matches
1071
+ .map((entry) => `${entry.id} at ${entry.source.file}:${entry.source.line}`)
1072
+ .join(", ");
1073
+
1074
+ throw new PackageImportError(
1075
+ "AMBIGUOUS_REFERENCE",
1076
+ `Selector for '${itemType(element)}' matched ${matches.length} items; expected one. ` +
1077
+ `Candidates: ${candidates}.`,
1078
+ element.source,
1079
+ {
1080
+ relatedSources: matches.map((entry) => entry.source),
1081
+ reference: { type: itemType(element), selector: element },
1082
+ },
1083
+ );
1084
+ }
1085
+
1086
+ const match = matches[0];
1087
+
1088
+ if (!match) {
1089
+ return this.noMatch(element);
1090
+ }
1091
+
1092
+ return match;
1093
+ }
1094
+
1095
+ private noMatch(element: AmlElement): never {
1096
+ throw new PackageImportError(
1097
+ "MISSING_REFERENCE",
1098
+ `No '${itemType(element)}' matches this selector. Supply the required package or fixture explicitly.`,
1099
+ element.source,
1100
+ { reference: { type: itemType(element), selector: element } },
1101
+ );
1102
+ }
1103
+
1104
+ private *lookupPropertySteps(
1105
+ entry: DraftEntry,
1106
+ name: string,
1107
+ ): Generator<ImportWork, StorageValue | undefined, void> {
1108
+ const value = this.lookupProperty(entry, name);
1109
+
1110
+ if (value === undefined || value === null || typeof value !== "object") {
1111
+ return value;
1112
+ }
1113
+
1114
+ const resolved = new ImportTask(this.resolveValueSteps(value));
1115
+ yield resolved;
1116
+
1117
+ return resolved.value();
1118
+ }
1119
+
1120
+ private lookupProperty(entry: DraftEntry, name: string): PendingValue | undefined {
1121
+ if (name === "id") {
1122
+ return entry.id;
1123
+ }
1124
+
1125
+ let value = getOwn(entry.properties, name);
1126
+
1127
+ if (value === undefined && name === "keyed_name" && baselineTypeNames.has(entry.type)) {
1128
+ value = getOwn(entry.properties, "name");
1129
+ }
1130
+
1131
+ // Selector matching compares typed IDs before final target-existence validation.
1132
+ if (value !== null && typeof value === "object" && value.kind === "typed-reference") {
1133
+ return value.id;
1134
+ }
1135
+
1136
+ return value;
1137
+ }
1138
+
1139
+ private resolveValue(value: PendingValue): StorageValue {
1140
+ if (value === null || typeof value !== "object") {
1141
+ return value;
1142
+ }
1143
+
1144
+ return evaluateImport(new ImportTask(this.resolveValueSteps(value)));
1145
+ }
1146
+
1147
+ private *resolveValueSteps(value: PendingValue): Generator<ImportWork, StorageValue, void> {
1148
+ if (value === null || typeof value !== "object") {
1149
+ return value;
1150
+ }
1151
+
1152
+ if (value.kind === "typed-reference") {
1153
+ const key = entryKey(value.type, value.id);
1154
+ this.reads?.push({
1155
+ kind: "unique",
1156
+ key,
1157
+ type: value.type,
1158
+ source: value.source,
1159
+ matchedKeys: this.draft.entries.has(key) ? [key] : [],
1160
+
1161
+ matches: (entry) => entryKey(entry.type, entry.id) === key,
1162
+ });
1163
+
1164
+ if (!this.draft.entries.has(key)) {
1165
+ throw new PackageImportError(
1166
+ "MISSING_REFERENCE",
1167
+ `Missing '${value.type}' with ID '${value.id}'. Supply the required package or fixture explicitly.`,
1168
+ value.source,
1169
+ { reference: { type: value.type, id: value.id } },
1170
+ );
1171
+ }
1172
+
1173
+ return value.id;
1174
+ }
1175
+
1176
+ if (this.resolving.has(value.element)) {
1177
+ throw new PackageImportError(
1178
+ "CYCLIC_SELECTOR",
1179
+ "Nested get selectors form an unresolved cycle.",
1180
+ value.element.source,
1181
+ );
1182
+ }
1183
+
1184
+ this.resolving.add(value.element);
1185
+
1186
+ try {
1187
+ const selection = new ImportTask(this.selectOneSteps(value.element));
1188
+ yield selection;
1189
+
1190
+ return selection.value().id;
1191
+ } finally {
1192
+ this.resolving.delete(value.element);
1193
+ }
1194
+ }
1195
+
1196
+ private resolveCatalog(errors: PackageImportError[]): Map<string, CatalogEntry> {
1197
+ const catalog = new Map<string, CatalogEntry>();
1198
+
1199
+ for (const [key, entry] of this.draft.entries) {
1200
+ const properties: Record<string, StorageValue> = {};
1201
+
1202
+ for (const [name, value] of Object.entries(entry.properties)) {
1203
+ try {
1204
+ setOwn(properties, name, this.resolveValue(value));
1205
+ } catch (error) {
1206
+ if (!(error instanceof PackageImportError)) {
1207
+ throw error;
1208
+ }
1209
+
1210
+ errors.push(error);
1211
+ }
1212
+ }
1213
+
1214
+ catalog.set(key, { ...entry, properties });
1215
+ }
1216
+
1217
+ return catalog;
1218
+ }
1219
+
1220
+ private withSource<T>(source: SourceLocation, action: () => T): T {
1221
+ try {
1222
+ return action();
1223
+ } catch (error) {
1224
+ if (error instanceof PackageImportError) {
1225
+ throw error;
1226
+ }
1227
+
1228
+ throw new PackageImportError("STORAGE_IMPORT_FAILED", errorMessage(error), source, {
1229
+ cause: error,
1230
+ });
1231
+ }
1232
+ }
1233
+ }
1234
+
1235
+ function validatePropertyAttributes(property: AmlElement): string | undefined {
1236
+ const nullAttribute = property.attributes.is_null;
1237
+
1238
+ if (nullAttribute !== undefined && nullAttribute !== "0" && nullAttribute !== "1") {
1239
+ throw new PackageImportError(
1240
+ "INVALID_NULL",
1241
+ "is_null must be '0' or '1'.",
1242
+ property.source,
1243
+ );
1244
+ }
1245
+
1246
+ for (const name of ["condition", "date_range", "is_not_null"]) {
1247
+ if (property.attributes[name] !== undefined) {
1248
+ throw new PackageImportError(
1249
+ "UNSUPPORTED_PROPERTY_ATTRIBUTE",
1250
+ `Property attribute '${name}' is not implemented.`,
1251
+ property.source,
1252
+ );
1253
+ }
1254
+ }
1255
+
1256
+ return nullAttribute;
1257
+ }