@intentius/chant 0.124.13 → 0.124.14

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 (907) hide show
  1. package/bin/chant +11 -0
  2. package/dist/agents/checks.js +326 -0
  3. package/dist/agents/discover.js +885 -0
  4. package/dist/agents/importer.js +17 -0
  5. package/dist/agents/index.js +12 -0
  6. package/dist/agents/types.js +19 -0
  7. package/dist/apply.js +151 -0
  8. package/dist/attrref.js +70 -0
  9. package/dist/audit/catalog.js +350 -0
  10. package/dist/audit/core.js +252 -0
  11. package/dist/audit/discover.js +633 -0
  12. package/dist/audit/fetch.js +666 -0
  13. package/dist/audit/lineage.js +91 -0
  14. package/dist/audit/nginx.js +366 -0
  15. package/dist/audit/prior-art.js +132 -0
  16. package/dist/audit/proof.js +321 -0
  17. package/dist/audit/report-html.js +194 -0
  18. package/dist/audit/report-model.js +198 -0
  19. package/dist/audit/report.js +102 -0
  20. package/dist/audit/rules-doc.js +144 -0
  21. package/dist/audit/secrets.js +405 -0
  22. package/dist/audit/terraform-state.js +140 -0
  23. package/dist/audit/wrangler.js +262 -0
  24. package/dist/behaviour-delta.js +401 -0
  25. package/dist/behaviour-engine.js +357 -0
  26. package/dist/behaviour-graph.js +83 -0
  27. package/dist/behaviour-http.js +188 -0
  28. package/dist/behaviour-kinds.js +172 -0
  29. package/dist/behaviour-overlay.js +50 -0
  30. package/dist/behaviour-predict.js +188 -0
  31. package/dist/behaviour-request.js +194 -0
  32. package/dist/behaviour.js +1325 -0
  33. package/dist/build-params.js +108 -0
  34. package/dist/build.js +668 -0
  35. package/dist/builder.js +44 -0
  36. package/dist/cdk/advise.js +30 -0
  37. package/dist/cdk/assembly.js +122 -0
  38. package/dist/cdk/graph.js +444 -0
  39. package/dist/cdk/tier-map.js +64 -0
  40. package/dist/cdk/types.js +24 -0
  41. package/dist/change-set.js +312 -0
  42. package/dist/child-project.js +21 -0
  43. package/dist/claimed-fields.js +135 -0
  44. package/dist/cli/build-options.js +70 -0
  45. package/dist/cli/build-params-cli.js +139 -0
  46. package/dist/cli/command-group.js +123 -0
  47. package/dist/cli/commands/audit-agents.js +326 -0
  48. package/dist/cli/commands/audit.js +571 -0
  49. package/dist/cli/commands/build.js +920 -0
  50. package/dist/cli/commands/carve-apply.js +153 -0
  51. package/dist/cli/commands/carve-bridge.js +201 -0
  52. package/dist/cli/commands/carve-emit.js +332 -0
  53. package/dist/cli/commands/carve-status.js +119 -0
  54. package/dist/cli/commands/carve.js +204 -0
  55. package/dist/cli/commands/check-lexicon-docs.js +79 -0
  56. package/dist/cli/commands/check-lexicon-examples.js +177 -0
  57. package/dist/cli/commands/check-lexicon-intrinsics.js +291 -0
  58. package/dist/cli/commands/check-lexicon-mcp.js +82 -0
  59. package/dist/cli/commands/check-lexicon-plugin.d.ts.map +1 -1
  60. package/dist/cli/commands/check-lexicon-plugin.js +104 -0
  61. package/dist/cli/commands/check-lexicon.js +766 -0
  62. package/dist/cli/commands/describe.js +85 -0
  63. package/dist/cli/commands/diff.js +175 -0
  64. package/dist/cli/commands/doctor.js +350 -0
  65. package/dist/cli/commands/import-agents.js +155 -0
  66. package/dist/cli/commands/import.js +670 -0
  67. package/dist/cli/commands/init-lexicon/templates/codegen.js +194 -0
  68. package/dist/cli/commands/init-lexicon/templates/docs.js +100 -0
  69. package/dist/cli/commands/init-lexicon/templates/examples.js +29 -0
  70. package/dist/cli/commands/init-lexicon/templates/lint.js +34 -0
  71. package/dist/cli/commands/init-lexicon/templates/lsp.js +37 -0
  72. package/dist/cli/commands/init-lexicon/templates/plugin.js +108 -0
  73. package/dist/cli/commands/init-lexicon/templates/project.js +240 -0
  74. package/dist/cli/commands/init-lexicon/templates/spec.js +56 -0
  75. package/dist/cli/commands/init-lexicon/templates/tests.js +66 -0
  76. package/dist/cli/commands/init-lexicon.js +172 -0
  77. package/dist/cli/commands/init.js +381 -0
  78. package/dist/cli/commands/lexicon-rolling-upgrade.js +145 -0
  79. package/dist/cli/commands/lexicon-surface-diff.js +145 -0
  80. package/dist/cli/commands/licenses.js +125 -0
  81. package/dist/cli/commands/lint.d.ts.map +1 -1
  82. package/dist/cli/commands/lint.js +948 -0
  83. package/dist/cli/commands/list.js +63 -0
  84. package/dist/cli/commands/migrate.d.ts.map +1 -1
  85. package/dist/cli/commands/migrate.js +423 -0
  86. package/dist/cli/commands/onboard.js +403 -0
  87. package/dist/cli/commands/pinned-upgrade.js +191 -0
  88. package/dist/cli/commands/update.js +194 -0
  89. package/dist/cli/commands/vendor.js +217 -0
  90. package/dist/cli/conflict-check.js +104 -0
  91. package/dist/cli/debug.js +8 -0
  92. package/dist/cli/format.js +104 -0
  93. package/dist/cli/handlers/build.js +267 -0
  94. package/dist/cli/handlers/carve-apply.js +30 -0
  95. package/dist/cli/handlers/carve-bridge.js +28 -0
  96. package/dist/cli/handlers/carve-emit.js +50 -0
  97. package/dist/cli/handlers/carve-status.js +26 -0
  98. package/dist/cli/handlers/carve.js +40 -0
  99. package/dist/cli/handlers/change-set.js +46 -0
  100. package/dist/cli/handlers/components.js +730 -0
  101. package/dist/cli/handlers/dev.js +113 -0
  102. package/dist/cli/handlers/emulator.js +233 -0
  103. package/dist/cli/handlers/explain.js +54 -0
  104. package/dist/cli/handlers/fan-out.js +422 -0
  105. package/dist/cli/handlers/gate-resume.js +275 -0
  106. package/dist/cli/handlers/generate.js +84 -0
  107. package/dist/cli/handlers/graph.js +969 -0
  108. package/dist/cli/handlers/init.js +102 -0
  109. package/dist/cli/handlers/lifecycle.js +1727 -0
  110. package/dist/cli/handlers/lint.js +62 -0
  111. package/dist/cli/handlers/migrate.js +48 -0
  112. package/dist/cli/handlers/misc.js +391 -0
  113. package/dist/cli/handlers/operator.js +1162 -0
  114. package/dist/cli/handlers/override-approve.js +102 -0
  115. package/dist/cli/handlers/pr.js +503 -0
  116. package/dist/cli/handlers/promote.js +342 -0
  117. package/dist/cli/handlers/run-generate.js +206 -0
  118. package/dist/cli/handlers/run-wave.js +66 -0
  119. package/dist/cli/handlers/run.js +1191 -0
  120. package/dist/cli/handlers/scenario.js +325 -0
  121. package/dist/cli/handlers/search.js +924 -0
  122. package/dist/cli/handlers/serve.js +32 -0
  123. package/dist/cli/handlers/vendor.js +154 -0
  124. package/dist/cli/index.js +3 -0
  125. package/dist/cli/is-entry-point.js +23 -0
  126. package/dist/cli/lsp/capabilities.js +28 -0
  127. package/dist/cli/lsp/diagnostics.js +34 -0
  128. package/dist/cli/lsp/server.js +329 -0
  129. package/dist/cli/main.d.ts.map +1 -1
  130. package/dist/cli/main.js +2540 -0
  131. package/dist/cli/mcp/lifecycle-tools.js +80 -0
  132. package/dist/cli/mcp/op-tools.js +306 -0
  133. package/dist/cli/mcp/resource-handlers.js +258 -0
  134. package/dist/cli/mcp/resources/context.js +85 -0
  135. package/dist/cli/mcp/server.js +353 -0
  136. package/dist/cli/mcp/tools/build.js +111 -0
  137. package/dist/cli/mcp/tools/composites.js +95 -0
  138. package/dist/cli/mcp/tools/explain.js +166 -0
  139. package/dist/cli/mcp/tools/import.js +49 -0
  140. package/dist/cli/mcp/tools/lint.js +41 -0
  141. package/dist/cli/mcp/tools/scaffold.js +111 -0
  142. package/dist/cli/mcp/tools/search.js +112 -0
  143. package/dist/cli/mcp/types.js +1 -0
  144. package/dist/cli/mcp/workspace-plugins.js +91 -0
  145. package/dist/cli/mcp/workspace-tools.d.ts +1 -1
  146. package/dist/cli/mcp/workspace-tools.js +564 -0
  147. package/dist/cli/mcp-config.js +70 -0
  148. package/dist/cli/plugins.js +313 -0
  149. package/dist/cli/registry.js +23 -0
  150. package/dist/cli/reporters/stylish.js +329 -0
  151. package/dist/cli/version.js +15 -0
  152. package/dist/cli/watch.js +79 -0
  153. package/dist/codegen/bound-property-types.js +82 -0
  154. package/dist/codegen/coverage.js +119 -0
  155. package/dist/codegen/docs-file-markers.js +60 -0
  156. package/dist/codegen/docs-pages.js +115 -0
  157. package/dist/codegen/docs-rule-scanning.js +164 -0
  158. package/dist/codegen/docs-rules.js +76 -0
  159. package/dist/codegen/docs-sections.js +117 -0
  160. package/dist/codegen/docs-sidebar.js +65 -0
  161. package/dist/codegen/docs-types.js +4 -0
  162. package/dist/codegen/docs.js +356 -0
  163. package/dist/codegen/fetch.js +340 -0
  164. package/dist/codegen/generate-post-synth-barrel.js +63 -0
  165. package/dist/codegen/generate-registry.js +71 -0
  166. package/dist/codegen/generate-runtime-index.js +56 -0
  167. package/dist/codegen/generate-typescript.js +119 -0
  168. package/dist/codegen/generate.js +115 -0
  169. package/dist/codegen/json-patch.js +141 -0
  170. package/dist/codegen/json-schema-to-ts.js +344 -0
  171. package/dist/codegen/json-schema.js +246 -0
  172. package/dist/codegen/lexicon-regen.js +412 -0
  173. package/dist/codegen/naming.js +217 -0
  174. package/dist/codegen/okf-lexicon.js +245 -0
  175. package/dist/codegen/package.js +150 -0
  176. package/dist/codegen/pinned-upgrade.d.ts.map +1 -1
  177. package/dist/codegen/pinned-upgrade.js +494 -0
  178. package/dist/codegen/registry.js +60 -0
  179. package/dist/codegen/rehype-base-url.mjs +68 -0
  180. package/dist/codegen/rolling-upgrade.js +217 -0
  181. package/dist/codegen/surface-snapshot.js +537 -0
  182. package/dist/codegen/testdata/postgres-tags.json +242 -0
  183. package/dist/codegen/topo-sort.js +36 -0
  184. package/dist/codegen/typecheck.js +115 -0
  185. package/dist/codegen/validate.js +200 -0
  186. package/dist/codegen/version-bump.js +35 -0
  187. package/dist/components/auto-release.js +143 -0
  188. package/dist/components/builders.js +47 -0
  189. package/dist/components/capability-plugin-loader.js +175 -0
  190. package/dist/components/capability-plugin-schema.js +46 -0
  191. package/dist/components/capability-plugin.js +99 -0
  192. package/dist/components/capability.js +60 -0
  193. package/dist/components/changed-files.js +72 -0
  194. package/dist/components/cli-support.js +427 -0
  195. package/dist/components/component.js +120 -0
  196. package/dist/components/component.schema.json +271 -0
  197. package/dist/components/config-defaults.js +130 -0
  198. package/dist/components/deploy-units.js +60 -0
  199. package/dist/components/discover.d.ts.map +1 -1
  200. package/dist/components/discover.js +189 -0
  201. package/dist/components/driver-output.js +86 -0
  202. package/dist/components/driver.js +728 -0
  203. package/dist/components/fan-out-output.js +165 -0
  204. package/dist/components/fan-out-record.js +94 -0
  205. package/dist/components/fan-out-run.js +373 -0
  206. package/dist/components/fan-out-support.js +60 -0
  207. package/dist/components/fan-out.js +273 -0
  208. package/dist/components/gate-plan.js +41 -0
  209. package/dist/components/gated-wave-pipeline.js +46 -0
  210. package/dist/components/index.js +24 -0
  211. package/dist/components/layers.js +28 -0
  212. package/dist/components/manifest-persistence.js +108 -0
  213. package/dist/components/pilots/alb-ecs.pilot.js +59 -0
  214. package/dist/components/pilots/dynamodb.pilot.js +51 -0
  215. package/dist/components/pilots/jar-emr.pilot.js +65 -0
  216. package/dist/components/pilots/lambda.pilot.js +52 -0
  217. package/dist/components/pilots/neo4j-fanout.pilot.js +68 -0
  218. package/dist/components/pilots/project.js +12 -0
  219. package/dist/components/pr-pipeline.js +134 -0
  220. package/dist/components/pr-run.js +363 -0
  221. package/dist/components/presets/ecs-fargate.js +72 -0
  222. package/dist/components/presets/index.js +28 -0
  223. package/dist/components/presets/lambda.js +34 -0
  224. package/dist/components/presets/single-host-compose.js +41 -0
  225. package/dist/components/promote.js +549 -0
  226. package/dist/components/registry.js +34 -0
  227. package/dist/components/run-progress.js +33 -0
  228. package/dist/components/sandbox/driver.d.ts.map +1 -1
  229. package/dist/components/sandbox/driver.js +93 -0
  230. package/dist/components/sandbox/run.js +115 -0
  231. package/dist/components/starter-plugin.js +104 -0
  232. package/dist/components/verbs/__tests__/mock-cloud-executor.js +68 -0
  233. package/dist/components/verbs/__tests__/mock-process-runner.js +45 -0
  234. package/dist/components/verbs/__tests__/mock-sbom-generator.js +56 -0
  235. package/dist/components/verbs/bom-writer.js +287 -0
  236. package/dist/components/verbs/build-archive.js +188 -0
  237. package/dist/components/verbs/build.js +142 -0
  238. package/dist/components/verbs/cloud-executor.js +110 -0
  239. package/dist/components/verbs/component-bom.js +125 -0
  240. package/dist/components/verbs/ensure-secret.js +50 -0
  241. package/dist/components/verbs/index.js +61 -0
  242. package/dist/components/verbs/license-policy.js +75 -0
  243. package/dist/components/verbs/lockfile-sbom-generator.js +191 -0
  244. package/dist/components/verbs/process-runner.js +78 -0
  245. package/dist/components/verbs/r2-sync.js +93 -0
  246. package/dist/components/verbs/reproducibility.js +62 -0
  247. package/dist/components/verbs/run-agent.js +577 -0
  248. package/dist/components/verbs/sbom-generator.js +119 -0
  249. package/dist/components/verbs/sbom.js +97 -0
  250. package/dist/components/verbs/shell.js +32 -0
  251. package/dist/components/verbs/sign.js +221 -0
  252. package/dist/components/verbs/stub.js +28 -0
  253. package/dist/components/verbs/tool-sbom-generator.js +154 -0
  254. package/dist/components/verbs/verify.js +112 -0
  255. package/dist/components/verbs/vex.js +131 -0
  256. package/dist/components/verbs/vuln-gate.js +152 -0
  257. package/dist/components/verbs/vuln-scan.js +288 -0
  258. package/dist/components/verbs/wait-verify.js +106 -0
  259. package/dist/components/verbs/wrangler.js +179 -0
  260. package/dist/components/wave-plan.js +102 -0
  261. package/dist/composite.js +305 -0
  262. package/dist/config-import.d.ts.map +1 -1
  263. package/dist/config-import.js +22 -0
  264. package/dist/config-sandbox.js +122 -0
  265. package/dist/config-static.js +206 -0
  266. package/dist/config.js +605 -0
  267. package/dist/content-digest.js +23 -0
  268. package/dist/declarable.js +114 -0
  269. package/dist/deep-observation.js +437 -0
  270. package/dist/detectLexicon.js +54 -0
  271. package/dist/discovery/cache.js +70 -0
  272. package/dist/discovery/collect.js +208 -0
  273. package/dist/discovery/cycles.js +95 -0
  274. package/dist/discovery/entity-wire-codec.js +391 -0
  275. package/dist/discovery/entity-wire.js +42 -0
  276. package/dist/discovery/files.js +121 -0
  277. package/dist/discovery/fold-import.d.ts.map +1 -1
  278. package/dist/discovery/fold-import.js +4178 -0
  279. package/dist/discovery/fold-rank.js +292 -0
  280. package/dist/discovery/graph.js +115 -0
  281. package/dist/discovery/import.d.ts.map +1 -1
  282. package/dist/discovery/import.js +65 -0
  283. package/dist/discovery/index.js +333 -0
  284. package/dist/discovery/param-deps.js +487 -0
  285. package/dist/discovery/resolve.js +39 -0
  286. package/dist/discovery/sandbox/bundle.js +214 -0
  287. package/dist/discovery/sandbox/child-errors.js +26 -0
  288. package/dist/discovery/sandbox/config-run.js +100 -0
  289. package/dist/discovery/sandbox/config-wire.js +183 -0
  290. package/dist/discovery/sandbox/driver.d.ts.map +1 -1
  291. package/dist/discovery/sandbox/driver.js +333 -0
  292. package/dist/discovery/sandbox/fork.js +229 -0
  293. package/dist/discovery/sandbox/policy-run.js +142 -0
  294. package/dist/discovery/sandbox/policy-wire.js +152 -0
  295. package/dist/discovery/sandbox/run.js +77 -0
  296. package/dist/discovery/specifier-resolve.js +320 -0
  297. package/dist/discovery/walk.js +284 -0
  298. package/dist/effect-receipt.js +340 -0
  299. package/dist/env.js +55 -0
  300. package/dist/errors.js +62 -0
  301. package/dist/fold/fold.js +1434 -0
  302. package/dist/fold/foldable-helpers.js +229 -0
  303. package/dist/fold/subset.js +696 -0
  304. package/dist/fold-provenance.js +414 -0
  305. package/dist/gate-decision.js +260 -0
  306. package/dist/gate-resume-run.js +154 -0
  307. package/dist/gated-waves.js +165 -0
  308. package/dist/governance.js +43 -0
  309. package/dist/graph-declared.js +45 -0
  310. package/dist/graph-detail.js +207 -0
  311. package/dist/graph-dot.js +54 -0
  312. package/dist/graph-effective.js +107 -0
  313. package/dist/graph-ir.js +623 -0
  314. package/dist/graph-layout.js +184 -0
  315. package/dist/graph-lens.js +105 -0
  316. package/dist/graph-mermaid.js +83 -0
  317. package/dist/graph-ops.js +39 -0
  318. package/dist/graph-refs.js +156 -0
  319. package/dist/held-elsewhere.js +87 -0
  320. package/dist/identity.js +251 -0
  321. package/dist/import/base-parser.js +34 -0
  322. package/dist/import/embedded.js +255 -0
  323. package/dist/import/generator.js +1 -0
  324. package/dist/import/ir-utils.js +85 -0
  325. package/dist/import/parser-options.js +45 -0
  326. package/dist/import/parser.js +1 -0
  327. package/dist/index.js +118 -0
  328. package/dist/intrinsic-interpolation.js +73 -0
  329. package/dist/intrinsic.js +31 -0
  330. package/dist/join-key.js +35 -0
  331. package/dist/kubectl-context.js +150 -0
  332. package/dist/lexicon-config.js +58 -0
  333. package/dist/lexicon-integrity.js +47 -0
  334. package/dist/lexicon-manifest.js +70 -0
  335. package/dist/lexicon-module.d.ts.map +1 -1
  336. package/dist/lexicon-module.js +241 -0
  337. package/dist/lexicon-output.js +218 -0
  338. package/dist/lexicon-plugin-helpers.js +104 -0
  339. package/dist/lexicon-schema.js +136 -0
  340. package/dist/lexicon.js +130 -0
  341. package/dist/lifecycle/affected.js +224 -0
  342. package/dist/lifecycle/assert-live.js +110 -0
  343. package/dist/lifecycle/build-ledger-store.js +160 -0
  344. package/dist/lifecycle/build-ledger.js +155 -0
  345. package/dist/lifecycle/change-set.js +356 -0
  346. package/dist/lifecycle/converge-ledger.js +161 -0
  347. package/dist/lifecycle/deep-diff.js +233 -0
  348. package/dist/lifecycle/deep-observe.js +147 -0
  349. package/dist/lifecycle/digest.js +143 -0
  350. package/dist/lifecycle/disruption.js +135 -0
  351. package/dist/lifecycle/gate-applied.js +113 -0
  352. package/dist/lifecycle/gate-audit.js +341 -0
  353. package/dist/lifecycle/gate-ledger-select.js +89 -0
  354. package/dist/lifecycle/gate-ledger.js +193 -0
  355. package/dist/lifecycle/gate-origin.js +117 -0
  356. package/dist/lifecycle/gate-pending.js +58 -0
  357. package/dist/lifecycle/git.js +1182 -0
  358. package/dist/lifecycle/identity.js +58 -0
  359. package/dist/lifecycle/index.js +26 -0
  360. package/dist/lifecycle/lease.js +283 -0
  361. package/dist/lifecycle/ledger-port.js +1 -0
  362. package/dist/lifecycle/legacy-digest.js +91 -0
  363. package/dist/lifecycle/live-diff.js +274 -0
  364. package/dist/lifecycle/local-note.js +15 -0
  365. package/dist/lifecycle/member-ledger.js +122 -0
  366. package/dist/lifecycle/observation-baseline.js +155 -0
  367. package/dist/lifecycle/observe.js +375 -0
  368. package/dist/lifecycle/oras-referrer-lookup.js +82 -0
  369. package/dist/lifecycle/override-ledger.js +54 -0
  370. package/dist/lifecycle/plan-digest.js +110 -0
  371. package/dist/lifecycle/plan-ledger.js +129 -0
  372. package/dist/lifecycle/receipt-plan.js +192 -0
  373. package/dist/lifecycle/release-ledger.js +155 -0
  374. package/dist/lifecycle/release-read.js +64 -0
  375. package/dist/lifecycle/replay.js +193 -0
  376. package/dist/lifecycle/rollback.js +102 -0
  377. package/dist/lifecycle/run-ledger.js +183 -0
  378. package/dist/lifecycle/scenario-eval.js +204 -0
  379. package/dist/lifecycle/scenario.js +214 -0
  380. package/dist/lifecycle/snapshot.js +239 -0
  381. package/dist/lifecycle/status.js +447 -0
  382. package/dist/lifecycle/symptoms.js +117 -0
  383. package/dist/lifecycle/teardown.js +255 -0
  384. package/dist/lifecycle/types.js +1 -0
  385. package/dist/lifecycle/unobserved-gate.js +33 -0
  386. package/dist/lifecycle/wave-plans.js +68 -0
  387. package/dist/lifecycle/work-item-id.js +36 -0
  388. package/dist/lifecycle/work-lease.js +393 -0
  389. package/dist/lint/component-checks.js +87 -0
  390. package/dist/lint/config.js +483 -0
  391. package/dist/lint/declarative.js +122 -0
  392. package/dist/lint/discover.d.ts.map +1 -1
  393. package/dist/lint/discover.js +138 -0
  394. package/dist/lint/engine.js +246 -0
  395. package/dist/lint/knowledge-checks.js +64 -0
  396. package/dist/lint/named-checks.js +22 -0
  397. package/dist/lint/output-checks.js +87 -0
  398. package/dist/lint/output-docs.js +163 -0
  399. package/dist/lint/parser.js +33 -0
  400. package/dist/lint/pipeline-change-gate.js +70 -0
  401. package/dist/lint/policy-import.d.ts +1 -1
  402. package/dist/lint/policy-import.d.ts.map +1 -1
  403. package/dist/lint/policy-import.js +62 -0
  404. package/dist/lint/policy-sandbox.js +86 -0
  405. package/dist/lint/policy.js +122 -0
  406. package/dist/lint/post-synth.js +87 -0
  407. package/dist/lint/presets/relaxed.json +26 -0
  408. package/dist/lint/presets/strict.json +24 -24
  409. package/dist/lint/receipt-checks.js +83 -0
  410. package/dist/lint/rule-loader.d.ts.map +1 -1
  411. package/dist/lint/rule-loader.js +89 -0
  412. package/dist/lint/rule-registry.js +86 -0
  413. package/dist/lint/rule.js +1 -0
  414. package/dist/lint/rules/__fixtures__/comp/comp000-discovery-error/broken-a.component.js +7 -0
  415. package/dist/lint/rules/__fixtures__/comp/comp000-discovery-error/broken-b.component.js +7 -0
  416. package/dist/lint/rules/__fixtures__/comp/comp001/fail/orphan-lib.component.js +9 -0
  417. package/dist/lint/rules/__fixtures__/comp/comp001/pass/emr-job.component.js +11 -0
  418. package/dist/lint/rules/__fixtures__/comp/comp001/pass/jar-lib.component.js +9 -0
  419. package/dist/lint/rules/__fixtures__/comp/comp002/fail/search-service.component.js +25 -0
  420. package/dist/lint/rules/__fixtures__/comp/comp002/pass/jar-lib.component.js +8 -0
  421. package/dist/lint/rules/__fixtures__/comp/comp002/pass/search-service.component.js +21 -0
  422. package/dist/lint/rules/__fixtures__/comp/comp003/fail/migrator.component.js +8 -0
  423. package/dist/lint/rules/__fixtures__/comp/comp003/pass/agent-turn.component.js +24 -0
  424. package/dist/lint/rules/__fixtures__/comp/comp003/pass/migrator.component.js +17 -0
  425. package/dist/lint/rules/__fixtures__/comp/comp003/pass/orders-table.component.js +8 -0
  426. package/dist/lint/rules/__fixtures__/comp/comp004/fail/neo4j-cluster.component.js +18 -0
  427. package/dist/lint/rules/__fixtures__/comp/comp004/pass/neo4j-cluster.component.js +20 -0
  428. package/dist/lint/rules/__fixtures__/comp/comp004/pass/orders-table.component.js +8 -0
  429. package/dist/lint/rules/__fixtures__/comp/comp005/fail/search-service.component.js +12 -0
  430. package/dist/lint/rules/__fixtures__/comp/comp005/pass/search-service.component.js +16 -0
  431. package/dist/lint/rules/__fixtures__/comp/comp006/fail/legacy-tool.component.js +8 -0
  432. package/dist/lint/rules/__fixtures__/comp/comp006/pass/legacy-tool.component.js +12 -0
  433. package/dist/lint/rules/__fixtures__/comp/comp007/fail/inventory-table.component.js +11 -0
  434. package/dist/lint/rules/__fixtures__/comp/comp007/fail/orders-table.component.js +11 -0
  435. package/dist/lint/rules/__fixtures__/comp/comp007/pass/orders-table.component.js +10 -0
  436. package/dist/lint/rules/__fixtures__/comp/comp007/pass/search-service.component.js +16 -0
  437. package/dist/lint/rules/comp/comp001-publishes-never-applies.js +69 -0
  438. package/dist/lint/rules/comp/comp002-dangling-wiring-ref.js +84 -0
  439. package/dist/lint/rules/comp/comp003-mutating-no-rollback.js +103 -0
  440. package/dist/lint/rules/comp/comp004-gate-needs-durable-runtime.js +70 -0
  441. package/dist/lint/rules/comp/comp005-capability-kind-is-noun.js +109 -0
  442. package/dist/lint/rules/comp/comp006-shell-needs-reason.js +49 -0
  443. package/dist/lint/rules/comp/comp007-composition-sprawl.js +64 -0
  444. package/dist/lint/rules/comp/index.js +33 -0
  445. package/dist/lint/rules/comp/support.js +129 -0
  446. package/dist/lint/rules/composite-scope.js +51 -0
  447. package/dist/lint/rules/cor017-composite-name-match.js +93 -0
  448. package/dist/lint/rules/cor018-composite-prefer-lexicon-type.js +136 -0
  449. package/dist/lint/rules/cor021-env-literal-name.js +100 -0
  450. package/dist/lint/rules/cor022-receipt-leaf.js +118 -0
  451. package/dist/lint/rules/cor024-receipt-secret-pointer.js +199 -0
  452. package/dist/lint/rules/declarable-naming-convention.js +62 -0
  453. package/dist/lint/rules/evl001-non-literal-expression.js +66 -0
  454. package/dist/lint/rules/evl002-control-flow-resource.js +69 -0
  455. package/dist/lint/rules/evl003-dynamic-property-access.js +44 -0
  456. package/dist/lint/rules/evl004-spread-non-const.js +94 -0
  457. package/dist/lint/rules/evl005-resource-block-body.js +41 -0
  458. package/dist/lint/rules/evl007-invalid-siblings.js +105 -0
  459. package/dist/lint/rules/evl009-composite-no-constant.js +158 -0
  460. package/dist/lint/rules/evl010-composite-no-transform.js +59 -0
  461. package/dist/lint/rules/evl011-symbolic-in-template.js +106 -0
  462. package/dist/lint/rules/export-required.js +115 -0
  463. package/dist/lint/rules/file-declarable-limit.js +88 -0
  464. package/dist/lint/rules/flat-declarations.js +62 -0
  465. package/dist/lint/rules/index.js +90 -0
  466. package/dist/lint/rules/no-cyclic-declarable-ref.js +138 -0
  467. package/dist/lint/rules/no-redundant-type-import.js +76 -0
  468. package/dist/lint/rules/no-redundant-value-cast.js +41 -0
  469. package/dist/lint/rules/no-string-ref.js +59 -0
  470. package/dist/lint/rules/no-unused-declarable-import.js +75 -0
  471. package/dist/lint/rules/no-unused-declarable.js +142 -0
  472. package/dist/lint/rules/op/index.js +28 -0
  473. package/dist/lint/rules/op/ops012-activity-contract.js +54 -0
  474. package/dist/lint/rules/op/ops013-step-output-ref.js +88 -0
  475. package/dist/lint/rules/op/ops014-converge-rule-refusals.js +114 -0
  476. package/dist/lint/rules/op/ops015-gate-approval.js +45 -0
  477. package/dist/lint/rules/op/support.js +11 -0
  478. package/dist/lint/rules/op/sys010-key-over-plain-http.js +100 -0
  479. package/dist/lint/rules/property-kind.js +56 -0
  480. package/dist/lint/rules/single-concern-file.js +71 -0
  481. package/dist/lint/rules/sys001-no-literal-key.js +60 -0
  482. package/dist/lint/selectors.js +168 -0
  483. package/dist/lint/suppressions.js +129 -0
  484. package/dist/lint/typescript.js +17 -0
  485. package/dist/live-endpoint.js +113 -0
  486. package/dist/live-read-session.js +76 -0
  487. package/dist/lsp/lexicon-providers.js +163 -0
  488. package/dist/lsp/types.js +5 -0
  489. package/dist/managed-fields.js +293 -0
  490. package/dist/mcp/types.js +4 -0
  491. package/dist/notify-verify.js +0 -1
  492. package/dist/notify.js +0 -1
  493. package/dist/notify.schema.json +72 -0
  494. package/dist/observation.js +266 -0
  495. package/dist/okf-read.js +134 -0
  496. package/dist/okf.js +275 -0
  497. package/dist/op/__fixtures__/decide-stub-backend.js +125 -0
  498. package/dist/op/activities/activity-contracts.js +313 -0
  499. package/dist/op/activities/apply.js +582 -0
  500. package/dist/op/activities/build.js +18 -0
  501. package/dist/op/activities/change-coverage.js +40 -0
  502. package/dist/op/activities/change-set.js +64 -0
  503. package/dist/op/activities/converge.js +492 -0
  504. package/dist/op/activities/decide.js +211 -0
  505. package/dist/op/activities/env-teardown.js +110 -0
  506. package/dist/op/activities/factory.js +591 -0
  507. package/dist/op/activities/forge-pull-request.js +82 -0
  508. package/dist/op/activities/gh-host.js +78 -0
  509. package/dist/op/activities/guard-validate.js +165 -0
  510. package/dist/op/activities/http-check.js +40 -0
  511. package/dist/op/activities/index.js +59 -0
  512. package/dist/op/activities/lexicon-upgrade.js +629 -0
  513. package/dist/op/activities/lifecycle.js +109 -0
  514. package/dist/op/activities/pipeline-audit.js +147 -0
  515. package/dist/op/activities/policy.js +26 -0
  516. package/dist/op/activities/predict-behaviour.js +341 -0
  517. package/dist/op/activities/propose-upgrade.js +165 -0
  518. package/dist/op/activities/reconcile.js +997 -0
  519. package/dist/op/activities/shell.js +118 -0
  520. package/dist/op/activities/source-release.js +97 -0
  521. package/dist/op/activities/source-rollback.js +165 -0
  522. package/dist/op/activities/teardown.js +17 -0
  523. package/dist/op/activities/util.js +6 -0
  524. package/dist/op/activities/wait.js +51 -0
  525. package/dist/op/activities/work-evidence.js +35 -0
  526. package/dist/op/activities/workflow-audit.js +133 -0
  527. package/dist/op/activity-contract-registry.js +106 -0
  528. package/dist/op/activity-contract.js +232 -0
  529. package/dist/op/activity-failure.js +31 -0
  530. package/dist/op/activity-profiles.js +129 -0
  531. package/dist/op/activity-registry.js +105 -0
  532. package/dist/op/activity-runtime.js +28 -0
  533. package/dist/op/builders.js +801 -0
  534. package/dist/op/change-signal.js +118 -0
  535. package/dist/op/composites/apply-op.js +151 -0
  536. package/dist/op/composites/behaviour-op.js +65 -0
  537. package/dist/op/composites/converge-op.js +141 -0
  538. package/dist/op/composites/index.js +19 -0
  539. package/dist/op/composites/lexicon-upgrade-op.js +107 -0
  540. package/dist/op/composites/pipeline-audit-op.js +50 -0
  541. package/dist/op/composites/reconcile-op.js +84 -0
  542. package/dist/op/composites/watch-op.js +69 -0
  543. package/dist/op/composites/workflow-audit-op.js +57 -0
  544. package/dist/op/converge-rule.js +205 -0
  545. package/dist/op/cron.js +146 -0
  546. package/dist/op/decide-backend.js +181 -0
  547. package/dist/op/decide-config.js +68 -0
  548. package/dist/op/decide-read-inputs.js +141 -0
  549. package/dist/op/discover.d.ts.map +1 -1
  550. package/dist/op/discover.js +213 -0
  551. package/dist/op/duration.js +21 -0
  552. package/dist/op/emulator-freshness.js +80 -0
  553. package/dist/op/emulator-lifecycle.js +269 -0
  554. package/dist/op/factory.js +83 -0
  555. package/dist/op/gate-approval.js +172 -0
  556. package/dist/op/gate-name.js +86 -0
  557. package/dist/op/gate-plan-context.js +167 -0
  558. package/dist/op/gate-point-run.js +67 -0
  559. package/dist/op/gate-point.js +111 -0
  560. package/dist/op/gate-resume-plan.js +155 -0
  561. package/dist/op/gate-resume.js +31 -0
  562. package/dist/op/gate-review.js +290 -0
  563. package/dist/op/gate-run-locator.js +85 -0
  564. package/dist/op/gate-summary.js +100 -0
  565. package/dist/op/gate-wait.js +56 -0
  566. package/dist/op/gate.js +449 -0
  567. package/dist/op/generate-pipeline.js +124 -0
  568. package/dist/op/index.js +51 -0
  569. package/dist/op/lifecycle-receipt-store.js +45 -0
  570. package/dist/op/local-executor.js +1164 -0
  571. package/dist/op/local-output.js +140 -0
  572. package/dist/op/op-ir.js +317 -0
  573. package/dist/op/op-verb-class.js +131 -0
  574. package/dist/op/op-waves-notify.js +136 -0
  575. package/dist/op/op-waves-run.js +1657 -0
  576. package/dist/op/op-waves.js +409 -0
  577. package/dist/op/operator.js +743 -0
  578. package/dist/op/receipt-store.js +94 -0
  579. package/dist/op/resource.js +23 -0
  580. package/dist/op/run-context.js +28 -0
  581. package/dist/op/run-live.js +256 -0
  582. package/dist/op/runtime.js +21 -0
  583. package/dist/op/runtimes/local.js +195 -0
  584. package/dist/op/source-archive.js +131 -0
  585. package/dist/op/step-output-ref.js +397 -0
  586. package/dist/op/steward-beside.js +169 -0
  587. package/dist/op/steward-points.js +138 -0
  588. package/dist/op/steward-turn.js +59 -0
  589. package/dist/op/steward.js +317 -0
  590. package/dist/op/types.js +25 -0
  591. package/dist/op/work-lease-decl.js +81 -0
  592. package/dist/op/work-lease-run.js +393 -0
  593. package/dist/override-gate.js +284 -0
  594. package/dist/owner-chain.js +74 -0
  595. package/dist/ownership.js +92 -0
  596. package/dist/params.js +61 -0
  597. package/dist/plan-summary.js +711 -0
  598. package/dist/point-decision.js +211 -0
  599. package/dist/pr-forge.js +810 -0
  600. package/dist/pr-loop.js +203 -0
  601. package/dist/project-codegen.js +191 -0
  602. package/dist/project-root.js +74 -0
  603. package/dist/project-validation.js +50 -0
  604. package/dist/provenance.js +157 -0
  605. package/dist/pseudo-parameter.js +40 -0
  606. package/dist/reconcile.js +450 -0
  607. package/dist/resource-attributes.js +33 -0
  608. package/dist/runtime-adapter.js +77 -0
  609. package/dist/runtime.js +66 -0
  610. package/dist/secret-materialization.js +153 -0
  611. package/dist/secret-provenance.js +250 -0
  612. package/dist/serializer-walker.js +112 -0
  613. package/dist/serializer.js +1 -0
  614. package/dist/sort.js +45 -0
  615. package/dist/stack-output.js +115 -0
  616. package/dist/telemetry-attribution.js +149 -0
  617. package/dist/terraform/__fixtures__/build-graph.js +63 -0
  618. package/dist/terraform/adopt-state.js +40 -0
  619. package/dist/terraform/aws-resources.js +384 -0
  620. package/dist/terraform/bridge.js +204 -0
  621. package/dist/terraform/carve-provider.js +155 -0
  622. package/dist/terraform/carve.js +138 -0
  623. package/dist/terraform/data-source-shape.js +57 -0
  624. package/dist/terraform/emit-source.js +36 -0
  625. package/dist/terraform/excise.js +123 -0
  626. package/dist/terraform/graduate.js +128 -0
  627. package/dist/terraform/graph.js +435 -0
  628. package/dist/terraform/hcl2json.js +60 -0
  629. package/dist/terraform/manifest.js +149 -0
  630. package/dist/terraform/parse.js +81 -0
  631. package/dist/terraform/providers/aws.js +146 -0
  632. package/dist/terraform/providers/gcp.js +294 -0
  633. package/dist/terraform/providers/index.js +17 -0
  634. package/dist/terraform/providers/kubernetes.js +253 -0
  635. package/dist/terraform/score.js +151 -0
  636. package/dist/terraform/state.js +67 -0
  637. package/dist/terraform/tier-map.js +74 -0
  638. package/dist/terraform/types.js +13 -0
  639. package/dist/terraform/unified-diff.js +132 -0
  640. package/dist/testing.js +295 -0
  641. package/dist/toml-emit.js +153 -0
  642. package/dist/toml-parse.js +355 -0
  643. package/dist/toml-utils.js +60 -0
  644. package/dist/toml.js +428 -0
  645. package/dist/ts-loader.d.ts +46 -0
  646. package/dist/ts-loader.d.ts.map +1 -0
  647. package/dist/ts-loader.js +103 -0
  648. package/dist/types.js +1 -0
  649. package/dist/utils.js +61 -0
  650. package/dist/validation.js +20 -0
  651. package/dist/vendor/js-yaml-load.js +1662 -0
  652. package/dist/workspace/__fixtures__/contract-repo.js +103 -0
  653. package/dist/workspace/__fixtures__/decide-workspace.js +112 -0
  654. package/dist/workspace/__fixtures__/sessions.js +91 -0
  655. package/dist/workspace/__fixtures__/two-member-workspace.js +34 -0
  656. package/dist/workspace/agent-cli.js +99 -0
  657. package/dist/workspace/agent.schema.json +390 -0
  658. package/dist/workspace/answers-ledger.js +89 -0
  659. package/dist/workspace/box-cli.js +142 -0
  660. package/dist/workspace/box-factory-write.js +196 -0
  661. package/dist/workspace/box-factory-write.schema.json +342 -0
  662. package/dist/workspace/box-factory.js +88 -0
  663. package/dist/workspace/box-intent.js +126 -0
  664. package/dist/workspace/box-isolation.js +169 -0
  665. package/dist/workspace/box-listing-write.schema.json +204 -0
  666. package/dist/workspace/box-listing.js +298 -0
  667. package/dist/workspace/box-publish.js +352 -0
  668. package/dist/workspace/box-publish.schema.json +498 -0
  669. package/dist/workspace/box-services.js +39 -0
  670. package/dist/workspace/broker-protocol.js +359 -0
  671. package/dist/workspace/broker-protocol.schema.json +228 -0
  672. package/dist/workspace/change-set.schema.json +460 -0
  673. package/dist/workspace/changes-cli.js +56 -0
  674. package/dist/workspace/changes.js +446 -0
  675. package/dist/workspace/changes.schema.json +642 -0
  676. package/dist/workspace/chant-migrations/chud-lexicon-exit-fly-site.js +198 -0
  677. package/dist/workspace/chant-migrations/chud-lexicon-exit-live-names.js +155 -0
  678. package/dist/workspace/chant-migrations/chud-lexicon-exit-rollback.js +214 -0
  679. package/dist/workspace/chant-migrations/chud-lexicon-exit-ship-inputs.js +180 -0
  680. package/dist/workspace/chant-migrations/chud-lexicon-exit-ship-policy.js +99 -0
  681. package/dist/workspace/chant-migrations/chud-lexicon-exit.js +847 -0
  682. package/dist/workspace/chant-migrations.js +113 -0
  683. package/dist/workspace/check.schema.json +433 -0
  684. package/dist/workspace/checks/box-isolation.js +62 -0
  685. package/dist/workspace/checks/boxes.js +491 -0
  686. package/dist/workspace/checks/diagrams.js +104 -0
  687. package/dist/workspace/checks/generated.js +419 -0
  688. package/dist/workspace/checks/ledgers.js +212 -0
  689. package/dist/workspace/checks/links.js +191 -0
  690. package/dist/workspace/checks/live.js +100 -0
  691. package/dist/workspace/checks/pipelines.js +188 -0
  692. package/dist/workspace/checks/records.js +169 -0
  693. package/dist/workspace/checks.js +426 -0
  694. package/dist/workspace/ci-green-cli.js +125 -0
  695. package/dist/workspace/ci-green-forge.js +83 -0
  696. package/dist/workspace/ci-green-workflow.js +199 -0
  697. package/dist/workspace/ci-green.js +325 -0
  698. package/dist/workspace/ci-last-green.schema.json +158 -0
  699. package/dist/workspace/compose-graph.js +235 -0
  700. package/dist/workspace/compose-reports.js +146 -0
  701. package/dist/workspace/composites.js +264 -0
  702. package/dist/workspace/composites.schema.json +617 -0
  703. package/dist/workspace/conformance/__fixture__/app/package.json +7 -0
  704. package/dist/workspace/conformance/__fixture__/app/src/server.mjs +29 -0
  705. package/dist/workspace/conformance/__fixture__/decisions/decision.kind.mjs +54 -0
  706. package/dist/workspace/conformance/__fixture__/decisions/decision.schema.json +512 -0
  707. package/dist/workspace/conformance/__fixture__/decisions/fix-001-how-the-app-is-deployed.md +40 -0
  708. package/dist/workspace/conformance/__fixture__/delivery/chant.config.ts +7 -0
  709. package/dist/workspace/conformance/__fixture__/delivery/lexicon/index.ts +26 -0
  710. package/dist/workspace/conformance/__fixture__/delivery/package.json +7 -0
  711. package/dist/workspace/conformance/__fixture__/delivery/src/app.component.ts +14 -0
  712. package/dist/workspace/conformance/__fixture__/delivery/src/app.ts +4 -0
  713. package/dist/workspace/conformance/__fixtures__/reference-broker.js +205 -0
  714. package/dist/workspace/conformance/__writer_fixture__/answers/answer.kind.mjs +32 -0
  715. package/dist/workspace/conformance/__writer_fixture__/answers/answer.schema.json +135 -0
  716. package/dist/workspace/conformance/__writer_fixture__/contracts/contract.kind.mjs +37 -0
  717. package/dist/workspace/conformance/__writer_fixture__/contracts/contract.schema.json +213 -0
  718. package/dist/workspace/conformance/__writer_fixture__/decisions/points.json +228 -0
  719. package/dist/workspace/conformance/__writer_fixture__/drivers/driver.kind.mjs +15 -0
  720. package/dist/workspace/conformance/__writer_fixture__/drivers/driver.schema.json +38 -0
  721. package/dist/workspace/conformance/__writer_fixture__/sessions/session.kind.mjs +54 -0
  722. package/dist/workspace/conformance/__writer_fixture__/sessions/session.schema.json +289 -0
  723. package/dist/workspace/conformance/__writer_fixture__/work/W-001-the-writer-suite-works-this-item.md +25 -0
  724. package/dist/workspace/conformance/__writer_fixture__/work/work.kind.mjs +60 -0
  725. package/dist/workspace/conformance/__writer_fixture__/work/work.schema.json +603 -0
  726. package/dist/workspace/conformance/broker.js +736 -0
  727. package/dist/workspace/conformance/index.js +673 -0
  728. package/dist/workspace/conformance/vitest.js +108 -0
  729. package/dist/workspace/conformance/writer.js +1080 -0
  730. package/dist/workspace/decide.js +879 -0
  731. package/dist/workspace/decision-points.schema.json +135 -135
  732. package/dist/workspace/declaration-write-cli.js +74 -0
  733. package/dist/workspace/declaration-write.js +238 -0
  734. package/dist/workspace/declaration.js +938 -0
  735. package/dist/workspace/declaration.schema.json +1413 -1413
  736. package/dist/workspace/declared-kinds.js +106 -0
  737. package/dist/workspace/environments.js +164 -0
  738. package/dist/workspace/evidence.schema.json +279 -0
  739. package/dist/workspace/export-cli.js +185 -0
  740. package/dist/workspace/export.js +499 -0
  741. package/dist/workspace/factory-rules.js +175 -0
  742. package/dist/workspace/generated-files.js +92 -0
  743. package/dist/workspace/glob.js +45 -0
  744. package/dist/workspace/graph-cache.js +352 -0
  745. package/dist/workspace/graph-cli.js +348 -0
  746. package/dist/workspace/graph.schema.json +1338 -0
  747. package/dist/workspace/identity-gate-rule.js +75 -0
  748. package/dist/workspace/identity.js +126 -0
  749. package/dist/workspace/import.js +283 -0
  750. package/dist/workspace/init.js +620 -0
  751. package/dist/workspace/intent-cli.js +263 -0
  752. package/dist/workspace/intent-joins.js +201 -0
  753. package/dist/workspace/intent-record.js +352 -0
  754. package/dist/workspace/intent-record.schema.json +864 -0
  755. package/dist/workspace/intent.js +1582 -0
  756. package/dist/workspace/intent.schema.json +2420 -0
  757. package/dist/workspace/json-edit.js +221 -0
  758. package/dist/workspace/jsonc.js +235 -0
  759. package/dist/workspace/kind-readers.js +103 -0
  760. package/dist/workspace/kinds.js +587 -0
  761. package/dist/workspace/lexicon-symbols.js +112 -0
  762. package/dist/workspace/lineage-adopt-cli.js +102 -0
  763. package/dist/workspace/lineage-adopt.js +360 -0
  764. package/dist/workspace/lineage-check.js +282 -0
  765. package/dist/workspace/lineage-cli.js +121 -0
  766. package/dist/workspace/lineage-hash-index.js +284 -0
  767. package/dist/workspace/lineage-init.js +507 -0
  768. package/dist/workspace/lineage-lock.js +387 -0
  769. package/dist/workspace/lineage-merge.js +45 -0
  770. package/dist/workspace/lineage-migrations.d.ts.map +1 -1
  771. package/dist/workspace/lineage-migrations.js +329 -0
  772. package/dist/workspace/lineage-provenance.js +36 -0
  773. package/dist/workspace/lineage-update.js +138 -0
  774. package/dist/workspace/lineage-upgrade-cli.js +131 -0
  775. package/dist/workspace/lineage-upgrade.js +889 -0
  776. package/dist/workspace/lineage-vendor.js +171 -0
  777. package/dist/workspace/lineage-version.js +128 -0
  778. package/dist/workspace/lineage-versions.js +275 -0
  779. package/dist/workspace/links.js +330 -0
  780. package/dist/workspace/ls-generated.js +95 -0
  781. package/dist/workspace/ls.js +277 -0
  782. package/dist/workspace/ls.schema.json +333 -0
  783. package/dist/workspace/member-commands.js +508 -0
  784. package/dist/workspace/member-handles.js +216 -0
  785. package/dist/workspace/member-pipeline.js +258 -0
  786. package/dist/workspace/member-run.js +117 -0
  787. package/dist/workspace/member-write.schema.json +193 -0
  788. package/dist/workspace/nested-graph.js +156 -0
  789. package/dist/workspace/nesting.js +38 -0
  790. package/dist/workspace/patch.js +301 -0
  791. package/dist/workspace/patch.schema.json +321 -0
  792. package/dist/workspace/pin-cli.js +55 -0
  793. package/dist/workspace/pin-integrity.js +100 -0
  794. package/dist/workspace/plan-summary.schema.json +155 -0
  795. package/dist/workspace/point-answer.schema.json +129 -129
  796. package/dist/workspace/points-cli.js +291 -0
  797. package/dist/workspace/points-write.schema.json +660 -0
  798. package/dist/workspace/points.js +521 -0
  799. package/dist/workspace/points.schema.json +916 -0
  800. package/dist/workspace/pr-report.schema.json +108 -0
  801. package/dist/workspace/principal-classes.js +245 -0
  802. package/dist/workspace/reason-codes.js +326 -0
  803. package/dist/workspace/record-assets.js +151 -0
  804. package/dist/workspace/record-decided.js +105 -0
  805. package/dist/workspace/record-sessions.js +96 -0
  806. package/dist/workspace/record-source.js +114 -0
  807. package/dist/workspace/records-amend.schema.json +284 -0
  808. package/dist/workspace/records-checkout.js +76 -0
  809. package/dist/workspace/records-cli.js +707 -0
  810. package/dist/workspace/records-close.js +116 -0
  811. package/dist/workspace/records-close.schema.json +278 -0
  812. package/dist/workspace/records-new.schema.json +202 -0
  813. package/dist/workspace/records-review.schema.json +367 -0
  814. package/dist/workspace/records-since.js +317 -0
  815. package/dist/workspace/records-since.schema.json +218 -0
  816. package/dist/workspace/records-write.js +1229 -0
  817. package/dist/workspace/records.js +1345 -0
  818. package/dist/workspace/records.schema.json +604 -0
  819. package/dist/workspace/reference-kinds/app/package.json +10 -0
  820. package/dist/workspace/reference-kinds/app/workspace-kinds.json +45 -0
  821. package/dist/workspace/returns.js +303 -0
  822. package/dist/workspace/root-refusal.js +75 -0
  823. package/dist/workspace/run-statement.schema.json +622 -0
  824. package/dist/workspace/runs-cli.js +584 -0
  825. package/dist/workspace/runs-write.schema.json +994 -0
  826. package/dist/workspace/runs.js +708 -0
  827. package/dist/workspace/runs.schema.json +1257 -0
  828. package/dist/workspace/runtimes.js +76 -0
  829. package/dist/workspace/session-kinds.js +83 -0
  830. package/dist/workspace/signers.schema.json +206 -0
  831. package/dist/workspace/source-block.js +125 -0
  832. package/dist/workspace/squash.js +177 -0
  833. package/dist/workspace/status-gates.js +162 -0
  834. package/dist/workspace/status-stewards.js +330 -0
  835. package/dist/workspace/status.js +514 -0
  836. package/dist/workspace/status.schema.json +998 -0
  837. package/dist/workspace/steward-index.js +191 -0
  838. package/dist/workspace/symbols.js +188 -0
  839. package/dist/workspace/template-manifest.js +227 -0
  840. package/dist/workspace/template-pins.js +115 -0
  841. package/dist/workspace/trailer-joins.js +65 -0
  842. package/dist/workspace/trailers.js +111 -0
  843. package/dist/workspace/tree.js +136 -0
  844. package/dist/workspace/trust/attestor.js +63 -0
  845. package/dist/workspace/trust/dsse.js +108 -0
  846. package/dist/workspace/trust/evidence-cli.js +175 -0
  847. package/dist/workspace/trust/evidence.js +161 -0
  848. package/dist/workspace/trust/gate-seal.js +226 -0
  849. package/dist/workspace/trust/policy.js +190 -0
  850. package/dist/workspace/trust/provenance.js +180 -0
  851. package/dist/workspace/trust/rotation.js +298 -0
  852. package/dist/workspace/trust/run-commits.js +101 -0
  853. package/dist/workspace/trust/run-statement.js +182 -0
  854. package/dist/workspace/trust/seal.js +272 -0
  855. package/dist/workspace/trust/signers-cli.js +152 -0
  856. package/dist/workspace/trust/ssh-commit.js +178 -0
  857. package/dist/workspace/trust/test-repo.js +118 -0
  858. package/dist/workspace/trust/trust-files.js +193 -0
  859. package/dist/workspace/trust/verify-cli.js +63 -0
  860. package/dist/workspace/trust/verify.js +192 -0
  861. package/dist/workspace/which-chant.js +141 -0
  862. package/dist/workspace/wip-cli.js +95 -0
  863. package/dist/workspace/wip-write.schema.json +504 -0
  864. package/dist/workspace/wip.js +631 -0
  865. package/dist/workspace/wip.schema.json +334 -0
  866. package/dist/workspace/work-cli.js +448 -0
  867. package/dist/workspace/work-evidence.js +122 -0
  868. package/dist/workspace/work-evidence.schema.json +222 -0
  869. package/dist/workspace/work-history.schema.json +421 -0
  870. package/dist/workspace/work-lease.schema.json +246 -0
  871. package/dist/workspace/work-size.js +77 -0
  872. package/dist/workspace/work.js +283 -0
  873. package/dist/workspace/workspace-kinds.schema.json +259 -259
  874. package/dist/workspace/workspace-principals.schema.json +53 -53
  875. package/dist/workspace/write-lock-cli.js +105 -0
  876. package/dist/workspace/write-lock.js +424 -0
  877. package/dist/workspace/write-lock.schema.json +172 -0
  878. package/dist/workspace/write-scope.js +484 -0
  879. package/dist/yaml.js +459 -0
  880. package/package.json +2 -2
  881. package/src/cli/commands/check-lexicon-plugin.ts +2 -0
  882. package/src/cli/commands/lint.ts +3 -0
  883. package/src/cli/commands/migrate.ts +2 -0
  884. package/src/cli/compiled-cli.e2e.test.ts +165 -0
  885. package/src/cli/main.ts +121 -27
  886. package/src/cli/mcp/workspace-tools.ts +1 -1
  887. package/src/codegen/pinned-upgrade.ts +2 -0
  888. package/src/components/discover.ts +2 -0
  889. package/src/components/sandbox/driver.ts +3 -1
  890. package/src/config-import.ts +3 -0
  891. package/src/discovery/fold-import.ts +23 -14
  892. package/src/discovery/import.ts +2 -0
  893. package/src/discovery/sandbox/driver.ts +3 -1
  894. package/src/lexicon-module.ts +3 -0
  895. package/src/lint/config.ts +1 -1
  896. package/src/lint/discover.ts +28 -8
  897. package/src/lint/policy-import.ts +4 -1
  898. package/src/lint/rule-loader.ts +2 -0
  899. package/src/op/discover.ts +3 -0
  900. package/src/ts-loader.test.ts +23 -0
  901. package/src/ts-loader.ts +122 -0
  902. package/src/workspace/chant-migrations/chud-lexicon-exit.ts +1 -1
  903. package/src/workspace/declaration.ts +1 -1
  904. package/src/workspace/kinds.ts +1 -1
  905. package/src/workspace/lineage-migrations.ts +2 -0
  906. package/src/workspace/points.ts +1 -1
  907. package/src/workspace/principal-classes.ts +1 -1
@@ -0,0 +1,1662 @@
1
+ // @ts-nocheck
2
+ /*
3
+ * A load-only YAML reader, vendored from js-yaml 4.3.2 (lib/loader.js and the core types).
4
+ *
5
+ * js-yaml is MIT licensed:
6
+ *
7
+ * Copyright (C) 2011-2015 by Vitaly Puzrin
8
+ *
9
+ * Permission is hereby granted, free of charge, to any person obtaining a
10
+ * copy of this software and associated documentation files (the
11
+ * "Software"), to deal in the Software without restriction, including
12
+ * without limitation the rights to use, copy, modify, merge, publish,
13
+ * distribute, sublicense, and/or sell copies of the Software, and to permit
14
+ * persons to whom the Software is furnished to do so, subject to the
15
+ * following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included
18
+ * in all copies or substantial portions of the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
23
+ * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
24
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
25
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
26
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
27
+ *
28
+ * Changes from upstream: the dumper, the unused built-in types (binary,
29
+ * timestamp, omap, pairs, set), the snippet renderer, the schema classes and
30
+ * the loader's option handling are gone. The reader always runs in json mode
31
+ * (a repeated mapping key takes the last value) and takes its type list from
32
+ * the caller. With the options fixed, the branches only another setting
33
+ * reached (the duplicate key error, the legacy line break check) and the
34
+ * warnings, which nothing listened to, are gone too. The parsing code itself
35
+ * is otherwise unchanged. It is kept in one file
36
+ * because js-yaml's ES module wraps each of its files in an init function a
37
+ * bundler cannot shake, so importing it costs the whole library.
38
+ */
39
+ export class YAMLException extends Error {
40
+ constructor(reason, mark) {
41
+ super(reason);
42
+ this.name = "YAMLException";
43
+ this.reason = reason;
44
+ this.mark = mark;
45
+ }
46
+ }
47
+ const common = {
48
+ isObject: (subject) => typeof subject === "object" && subject !== null,
49
+ repeat: (string, count) => string.repeat(Math.max(0, count)),
50
+ };
51
+ function isNegativeZero(number) {
52
+ return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
53
+ }
54
+ // ---------------------------------------------------------------------------
55
+ // Types (YAML 1.2 core schema scalars)
56
+ // ---------------------------------------------------------------------------
57
+ export const NULL_TYPE = {
58
+ tag: "tag:yaml.org,2002:null",
59
+ kind: "scalar",
60
+ resolve: (data) => data === null || data === "~" || data === "null" || data === "Null" || data === "NULL",
61
+ construct: () => null,
62
+ };
63
+ const isHexCode = (c) => (c >= 0x30 && c <= 0x39) || (c >= 0x41 && c <= 0x46) || (c >= 0x61 && c <= 0x66);
64
+ const isOctCode = (c) => c >= 0x30 && c <= 0x37;
65
+ const isDecCode = (c) => c >= 0x30 && c <= 0x39;
66
+ function resolveYamlInteger(data) {
67
+ if (data === null)
68
+ return false;
69
+ const max = data.length;
70
+ let index = 0;
71
+ let hasDigits = false;
72
+ if (!max)
73
+ return false;
74
+ let ch = data[index];
75
+ // sign
76
+ if (ch === '-' || ch === '+') {
77
+ ch = data[++index];
78
+ }
79
+ if (ch === '0') {
80
+ if (index + 1 === max)
81
+ return true;
82
+ ch = data[++index];
83
+ // base 2, base 8, base 16
84
+ const digit = { b: (c) => c === 0x30 || c === 0x31, x: isHexCode, o: isOctCode }[ch];
85
+ if (digit) {
86
+ index++;
87
+ for (; index < max; index++) {
88
+ if (!digit(data.charCodeAt(index)))
89
+ return false;
90
+ hasDigits = true;
91
+ }
92
+ return hasDigits && isFinite(parseYamlInteger(data));
93
+ }
94
+ }
95
+ // base 10 (except 0)
96
+ for (; index < max; index++) {
97
+ if (!isDecCode(data.charCodeAt(index)))
98
+ return false;
99
+ hasDigits = true;
100
+ }
101
+ if (!hasDigits)
102
+ return false;
103
+ return isFinite(parseYamlInteger(data));
104
+ }
105
+ function parseYamlInteger(data) {
106
+ let value = data;
107
+ let sign = 1;
108
+ let ch = value[0];
109
+ if (ch === '-' || ch === '+') {
110
+ if (ch === '-')
111
+ sign = -1;
112
+ value = value.slice(1);
113
+ ch = value[0];
114
+ }
115
+ if (value === '0')
116
+ return 0;
117
+ if (ch === '0') {
118
+ if (value[1] === 'b')
119
+ return sign * parseInt(value.slice(2), 2);
120
+ if (value[1] === 'x')
121
+ return sign * parseInt(value.slice(2), 16);
122
+ if (value[1] === 'o')
123
+ return sign * parseInt(value.slice(2), 8);
124
+ }
125
+ return sign * parseInt(value, 10);
126
+ }
127
+ export const INT_TYPE = {
128
+ tag: 'tag:yaml.org,2002:int',
129
+ kind: 'scalar',
130
+ resolve: resolveYamlInteger,
131
+ construct: parseYamlInteger,
132
+ };
133
+ const YAML_FLOAT_PATTERN = new RegExp('^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?' +
134
+ '|\\.[0-9]+(?:[eE][-+]?[0-9]+)?' +
135
+ '|[-+]?\\.(?:inf|Inf|INF)' +
136
+ '|\\.(?:nan|NaN|NAN))$');
137
+ const YAML_FLOAT_SPECIAL_PATTERN = new RegExp('^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$');
138
+ function resolveYamlFloat(data) {
139
+ if (data === null)
140
+ return false;
141
+ if (!YAML_FLOAT_PATTERN.test(data))
142
+ return false;
143
+ if (isFinite(parseFloat(data, 10)))
144
+ return true;
145
+ return YAML_FLOAT_SPECIAL_PATTERN.test(data);
146
+ }
147
+ export const FLOAT_TYPE = {
148
+ tag: 'tag:yaml.org,2002:float',
149
+ kind: 'scalar',
150
+ resolve: resolveYamlFloat,
151
+ construct: (data) => {
152
+ let value = data.toLowerCase();
153
+ const sign = value[0] === '-' ? -1 : 1;
154
+ if ('+-'.indexOf(value[0]) >= 0)
155
+ value = value.slice(1);
156
+ if (value === '.inf')
157
+ return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
158
+ if (value === '.nan')
159
+ return NaN;
160
+ return sign * parseFloat(value, 10);
161
+ },
162
+ };
163
+ export const STR_TYPE = { tag: "tag:yaml.org,2002:str", kind: "scalar", construct: (data) => (data !== null ? data : "") };
164
+ export const SEQ_TYPE = { tag: "tag:yaml.org,2002:seq", kind: "sequence", construct: (data) => (data !== null ? data : []) };
165
+ export const MAP_TYPE = { tag: "tag:yaml.org,2002:map", kind: "mapping", construct: (data) => (data !== null ? data : {}) };
166
+ for (const t of [NULL_TYPE, INT_TYPE, FLOAT_TYPE, STR_TYPE, SEQ_TYPE, MAP_TYPE]) {
167
+ t.resolve ?? (t.resolve = () => true);
168
+ }
169
+ /** A type list as the loader uses it: implicit scalar resolvers, then tag lookup maps. */
170
+ function compileTypes(implicit, explicit) {
171
+ const typeMap = { scalar: {}, sequence: {}, mapping: {}, fallback: {}, multi: { scalar: [], sequence: [], mapping: [], fallback: [] } };
172
+ for (const type of [...implicit, ...explicit]) {
173
+ type.resolve ?? (type.resolve = () => true);
174
+ type.construct ?? (type.construct = (data) => data);
175
+ if (type.multi) {
176
+ typeMap.multi[type.kind].push(type);
177
+ typeMap.multi.fallback.push(type);
178
+ }
179
+ else {
180
+ typeMap[type.kind][type.tag] = typeMap.fallback[type.tag] = type;
181
+ }
182
+ }
183
+ return typeMap;
184
+ }
185
+ // ---------------------------------------------------------------------------
186
+ // Loader
187
+ // ---------------------------------------------------------------------------
188
+ const _hasOwnProperty = Object.prototype.hasOwnProperty;
189
+ const CONTEXT_FLOW_IN = 1;
190
+ const CONTEXT_FLOW_OUT = 2;
191
+ const CONTEXT_BLOCK_IN = 3;
192
+ const CONTEXT_BLOCK_OUT = 4;
193
+ const CHOMPING_CLIP = 1;
194
+ const CHOMPING_STRIP = 2;
195
+ const CHOMPING_KEEP = 3;
196
+ // eslint-disable-next-line no-control-regex
197
+ const PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
198
+ // eslint-disable-next-line no-useless-escape
199
+ const PATTERN_FLOW_INDICATORS = /[,\[\]{}]/;
200
+ // eslint-disable-next-line no-useless-escape
201
+ const PATTERN_TAG_HANDLE = /^(?:!|!!|![0-9A-Za-z-]+!)$/;
202
+ // eslint-disable-next-line no-useless-escape
203
+ const PATTERN_TAG_URI = /^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;
204
+ function _class(obj) { return Object.prototype.toString.call(obj); }
205
+ function isEol(c) {
206
+ return (c === 0x0A /* LF */) || (c === 0x0D /* CR */);
207
+ }
208
+ function isWhiteSpace(c) {
209
+ return (c === 0x09 /* Tab */) || (c === 0x20 /* Space */);
210
+ }
211
+ function isWsOrEol(c) {
212
+ return (c === 0x09 /* Tab */) ||
213
+ (c === 0x20 /* Space */) ||
214
+ (c === 0x0A /* LF */) ||
215
+ (c === 0x0D /* CR */);
216
+ }
217
+ function isFlowIndicator(c) {
218
+ return c === 0x2C /* , */ ||
219
+ c === 0x5B /* [ */ ||
220
+ c === 0x5D /* ] */ ||
221
+ c === 0x7B /* { */ ||
222
+ c === 0x7D; /* } */
223
+ }
224
+ function fromHexCode(c) {
225
+ if ((c >= 0x30 /* 0 */) && (c <= 0x39 /* 9 */)) {
226
+ return c - 0x30;
227
+ }
228
+ const lc = c | 0x20;
229
+ if ((lc >= 0x61 /* a */) && (lc <= 0x66 /* f */)) {
230
+ return lc - 0x61 + 10;
231
+ }
232
+ return -1;
233
+ }
234
+ function escapedHexLen(c) {
235
+ if (c === 0x78 /* x */) {
236
+ return 2;
237
+ }
238
+ if (c === 0x75 /* u */) {
239
+ return 4;
240
+ }
241
+ if (c === 0x55 /* U */) {
242
+ return 8;
243
+ }
244
+ return 0;
245
+ }
246
+ function fromDecimalCode(c) {
247
+ if ((c >= 0x30 /* 0 */) && (c <= 0x39 /* 9 */)) {
248
+ return c - 0x30;
249
+ }
250
+ return -1;
251
+ }
252
+ function simpleEscapeSequence(c) {
253
+ switch (c) {
254
+ case 0x30 /* 0 */: return '\x00';
255
+ case 0x61 /* a */: return '\x07';
256
+ case 0x62 /* b */: return '\x08';
257
+ case 0x74 /* t */: return '\x09';
258
+ case 0x09 /* Tab */: return '\x09';
259
+ case 0x6E /* n */: return '\x0A';
260
+ case 0x76 /* v */: return '\x0B';
261
+ case 0x66 /* f */: return '\x0C';
262
+ case 0x72 /* r */: return '\x0D';
263
+ case 0x65 /* e */: return '\x1B';
264
+ case 0x20 /* Space */: return ' ';
265
+ case 0x22 /* " */: return '\x22';
266
+ case 0x2F /* / */: return '/';
267
+ case 0x5C /* \ */: return '\x5C';
268
+ case 0x4E /* N */: return '\x85';
269
+ case 0x5F /* _ */: return '\xA0';
270
+ case 0x4C /* L */: return '\u2028';
271
+ case 0x50 /* P */: return '\u2029';
272
+ default: return '';
273
+ }
274
+ }
275
+ function charFromCodepoint(c) {
276
+ if (c <= 0xFFFF) {
277
+ return String.fromCharCode(c);
278
+ }
279
+ // Encode UTF-16 surrogate pair
280
+ // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF
281
+ return String.fromCharCode(((c - 0x010000) >> 10) + 0xD800, ((c - 0x010000) & 0x03FF) + 0xDC00);
282
+ }
283
+ // set a property of a literal object, while protecting against prototype pollution,
284
+ // see https://github.com/nodeca/js-yaml/issues/164 for more details
285
+ function setProperty(object, key, value) {
286
+ // used for this specific key only because Object.defineProperty is slow
287
+ if (key === '__proto__') {
288
+ Object.defineProperty(object, key, {
289
+ configurable: true,
290
+ enumerable: true,
291
+ writable: true,
292
+ value: value
293
+ });
294
+ }
295
+ else {
296
+ object[key] = value;
297
+ }
298
+ }
299
+ const simpleEscapeCheck = new Array(256); // integer, for fast access
300
+ const simpleEscapeMap = new Array(256);
301
+ for (let i = 0; i < 256; i++) {
302
+ simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
303
+ simpleEscapeMap[i] = simpleEscapeSequence(i);
304
+ }
305
+ function State(input, types) {
306
+ this.input = input;
307
+ this.implicitTypes = types.implicit;
308
+ this.typeMap = compileTypes(types.implicit, types.explicit);
309
+ this.maxDepth = 100;
310
+ this.maxTotalMergeKeys = 10000;
311
+ this.length = input.length;
312
+ this.position = 0;
313
+ this.line = 0;
314
+ this.lineStart = 0;
315
+ this.lineIndent = 0;
316
+ this.depth = 0;
317
+ this.totalMergeKeys = 0;
318
+ // position of first leading tab in the current line,
319
+ // used to make sure there are no tabs in the indentation
320
+ this.firstTabInLine = -1;
321
+ this.documents = [];
322
+ this.anchorMapTransactions = [];
323
+ /*
324
+ this.version;
325
+ this.tagMap;
326
+ this.anchorMap;
327
+ this.tag;
328
+ this.anchor;
329
+ this.kind;
330
+ this.result; */
331
+ }
332
+ function generateError(state, message) {
333
+ const mark = {
334
+ name: null,
335
+ buffer: state.input.slice(0, -1), // omit trailing \0
336
+ position: state.position,
337
+ line: state.line,
338
+ column: state.position - state.lineStart
339
+ };
340
+ return new YAMLException(message, mark);
341
+ }
342
+ function throwError(state, message) {
343
+ throw generateError(state, message);
344
+ }
345
+ function storeAnchor(state, name, value) {
346
+ const transactions = state.anchorMapTransactions;
347
+ if (transactions.length !== 0) {
348
+ const transaction = transactions[transactions.length - 1];
349
+ if (!_hasOwnProperty.call(transaction, name)) {
350
+ transaction[name] = {
351
+ existed: _hasOwnProperty.call(state.anchorMap, name),
352
+ value: state.anchorMap[name]
353
+ };
354
+ }
355
+ }
356
+ state.anchorMap[name] = value;
357
+ }
358
+ function beginAnchorTransaction(state) {
359
+ state.anchorMapTransactions.push(Object.create(null));
360
+ }
361
+ function commitAnchorTransaction(state) {
362
+ const transaction = state.anchorMapTransactions.pop();
363
+ const transactions = state.anchorMapTransactions;
364
+ if (transactions.length === 0)
365
+ return;
366
+ const parent = transactions[transactions.length - 1];
367
+ const names = Object.keys(transaction);
368
+ for (let index = 0, length = names.length; index < length; index += 1) {
369
+ const name = names[index];
370
+ if (!_hasOwnProperty.call(parent, name)) {
371
+ parent[name] = transaction[name];
372
+ }
373
+ }
374
+ }
375
+ function rollbackAnchorTransaction(state) {
376
+ const transaction = state.anchorMapTransactions.pop();
377
+ const names = Object.keys(transaction);
378
+ for (let index = names.length - 1; index >= 0; index -= 1) {
379
+ const entry = transaction[names[index]];
380
+ if (entry.existed) {
381
+ state.anchorMap[names[index]] = entry.value;
382
+ }
383
+ else {
384
+ delete state.anchorMap[names[index]];
385
+ }
386
+ }
387
+ }
388
+ function snapshotState(state) {
389
+ return {
390
+ position: state.position,
391
+ line: state.line,
392
+ lineStart: state.lineStart,
393
+ lineIndent: state.lineIndent,
394
+ firstTabInLine: state.firstTabInLine,
395
+ tag: state.tag,
396
+ anchor: state.anchor,
397
+ kind: state.kind,
398
+ result: state.result
399
+ };
400
+ }
401
+ function restoreState(state, snapshot) {
402
+ state.position = snapshot.position;
403
+ state.line = snapshot.line;
404
+ state.lineStart = snapshot.lineStart;
405
+ state.lineIndent = snapshot.lineIndent;
406
+ state.firstTabInLine = snapshot.firstTabInLine;
407
+ state.tag = snapshot.tag;
408
+ state.anchor = snapshot.anchor;
409
+ state.kind = snapshot.kind;
410
+ state.result = snapshot.result;
411
+ }
412
+ const directiveHandlers = {
413
+ YAML: function handleYamlDirective(state, name, args) {
414
+ if (state.version !== null) {
415
+ throwError(state, 'duplication of %YAML directive');
416
+ }
417
+ if (args.length !== 1) {
418
+ throwError(state, 'YAML directive accepts exactly one argument');
419
+ }
420
+ const match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
421
+ if (match === null) {
422
+ throwError(state, 'ill-formed argument of the YAML directive');
423
+ }
424
+ const major = parseInt(match[1], 10);
425
+ if (major !== 1) {
426
+ throwError(state, 'unacceptable YAML version of the document');
427
+ }
428
+ state.version = args[0];
429
+ },
430
+ TAG: function handleTagDirective(state, name, args) {
431
+ let prefix;
432
+ if (args.length !== 2) {
433
+ throwError(state, 'TAG directive accepts exactly two arguments');
434
+ }
435
+ const handle = args[0];
436
+ prefix = args[1];
437
+ if (!PATTERN_TAG_HANDLE.test(handle)) {
438
+ throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');
439
+ }
440
+ if (_hasOwnProperty.call(state.tagMap, handle)) {
441
+ throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
442
+ }
443
+ if (!PATTERN_TAG_URI.test(prefix)) {
444
+ throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');
445
+ }
446
+ try {
447
+ prefix = decodeURIComponent(prefix);
448
+ }
449
+ catch (err) {
450
+ throwError(state, 'tag prefix is malformed: ' + prefix);
451
+ }
452
+ state.tagMap[handle] = prefix;
453
+ }
454
+ };
455
+ function captureSegment(state, start, end, checkJson) {
456
+ if (start < end) {
457
+ const _result = state.input.slice(start, end);
458
+ if (checkJson) {
459
+ for (let _position = 0, _length = _result.length; _position < _length; _position += 1) {
460
+ const _character = _result.charCodeAt(_position);
461
+ if (!(_character === 0x09 ||
462
+ (_character >= 0x20 && _character <= 0x10FFFF))) {
463
+ throwError(state, 'expected valid JSON character');
464
+ }
465
+ }
466
+ }
467
+ else if (PATTERN_NON_PRINTABLE.test(_result)) {
468
+ throwError(state, 'the stream contains non-printable characters');
469
+ }
470
+ state.result += _result;
471
+ }
472
+ }
473
+ function chargeMergeWork(state) {
474
+ state.totalMergeKeys++;
475
+ if (state.maxTotalMergeKeys !== -1 && state.totalMergeKeys > state.maxTotalMergeKeys) {
476
+ throwError(state, 'merge keys exceeded maxTotalMergeKeys (' + state.maxTotalMergeKeys + ')');
477
+ }
478
+ }
479
+ function mergeMappings(state, destination, source, overridableKeys) {
480
+ if (!common.isObject(source)) {
481
+ throwError(state, 'cannot merge mappings; the provided source object is unacceptable');
482
+ }
483
+ // Count the source mapping itself to bound sequences of empty mappings.
484
+ chargeMergeWork(state);
485
+ const sourceKeys = Object.keys(source);
486
+ for (let index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
487
+ const key = sourceKeys[index];
488
+ chargeMergeWork(state);
489
+ if (!_hasOwnProperty.call(destination, key)) {
490
+ setProperty(destination, key, source[key]);
491
+ overridableKeys[key] = true;
492
+ }
493
+ }
494
+ }
495
+ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode) {
496
+ // The output is a plain object here, so keys can only be strings.
497
+ // We need to convert keyNode to a string, but doing so can hang the process
498
+ // (deeply nested arrays that explode exponentially using aliases).
499
+ if (Array.isArray(keyNode)) {
500
+ keyNode = Array.prototype.slice.call(keyNode);
501
+ for (let index = 0, quantity = keyNode.length; index < quantity; index += 1) {
502
+ if (Array.isArray(keyNode[index])) {
503
+ throwError(state, 'nested arrays are not supported inside keys');
504
+ }
505
+ if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') {
506
+ keyNode[index] = '[object Object]';
507
+ }
508
+ }
509
+ }
510
+ // Avoid code execution in load() via toString property
511
+ // (still use its own toString for arrays, timestamps,
512
+ // and whatever user schema extensions happen to have @@toStringTag)
513
+ if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') {
514
+ keyNode = '[object Object]';
515
+ }
516
+ keyNode = String(keyNode);
517
+ if (_result === null) {
518
+ _result = {};
519
+ }
520
+ if (keyTag === 'tag:yaml.org,2002:merge') {
521
+ if (Array.isArray(valueNode)) {
522
+ if (valueNode.length > 100) {
523
+ throwError(state, 'abnormal merge sequence size');
524
+ }
525
+ for (let index = 0, quantity = valueNode.length; index < quantity; index += 1) {
526
+ mergeMappings(state, _result, valueNode[index], overridableKeys);
527
+ }
528
+ }
529
+ else {
530
+ mergeMappings(state, _result, valueNode, overridableKeys);
531
+ }
532
+ }
533
+ else {
534
+ // json mode: a repeated key takes the last value.
535
+ setProperty(_result, keyNode, valueNode);
536
+ delete overridableKeys[keyNode];
537
+ }
538
+ return _result;
539
+ }
540
+ function readLineBreak(state) {
541
+ const ch = state.input.charCodeAt(state.position);
542
+ if (ch === 0x0A /* LF */) {
543
+ state.position++;
544
+ }
545
+ else if (ch === 0x0D /* CR */) {
546
+ state.position++;
547
+ if (state.input.charCodeAt(state.position) === 0x0A /* LF */) {
548
+ state.position++;
549
+ }
550
+ }
551
+ else {
552
+ throwError(state, 'a line break is expected');
553
+ }
554
+ state.line += 1;
555
+ state.lineStart = state.position;
556
+ state.firstTabInLine = -1;
557
+ }
558
+ function skipSeparationSpace(state, allowComments, checkIndent) {
559
+ let lineBreaks = 0;
560
+ let ch = state.input.charCodeAt(state.position);
561
+ while (ch !== 0) {
562
+ while (isWhiteSpace(ch)) {
563
+ if (ch === 0x09 /* Tab */ && state.firstTabInLine === -1) {
564
+ state.firstTabInLine = state.position;
565
+ }
566
+ ch = state.input.charCodeAt(++state.position);
567
+ }
568
+ if (allowComments && ch === 0x23 /* # */) {
569
+ do {
570
+ ch = state.input.charCodeAt(++state.position);
571
+ } while (ch !== 0x0A /* LF */ && ch !== 0x0D /* CR */ && ch !== 0);
572
+ }
573
+ if (isEol(ch)) {
574
+ readLineBreak(state);
575
+ ch = state.input.charCodeAt(state.position);
576
+ lineBreaks++;
577
+ state.lineIndent = 0;
578
+ while (ch === 0x20 /* Space */) {
579
+ state.lineIndent++;
580
+ ch = state.input.charCodeAt(++state.position);
581
+ }
582
+ }
583
+ else {
584
+ break;
585
+ }
586
+ }
587
+ return lineBreaks;
588
+ }
589
+ function testDocumentSeparator(state) {
590
+ let _position = state.position;
591
+ let ch = state.input.charCodeAt(_position);
592
+ // Condition state.position === state.lineStart is tested
593
+ // in parent on each call, for efficiency. No needs to test here again.
594
+ if ((ch === 0x2D /* - */ || ch === 0x2E /* . */) &&
595
+ ch === state.input.charCodeAt(_position + 1) &&
596
+ ch === state.input.charCodeAt(_position + 2)) {
597
+ _position += 3;
598
+ ch = state.input.charCodeAt(_position);
599
+ if (ch === 0 || isWsOrEol(ch)) {
600
+ return true;
601
+ }
602
+ }
603
+ return false;
604
+ }
605
+ function writeFoldedLines(state, count) {
606
+ if (count === 1) {
607
+ state.result += ' ';
608
+ }
609
+ else if (count > 1) {
610
+ state.result += common.repeat('\n', count - 1);
611
+ }
612
+ }
613
+ function readPlainScalar(state, nodeIndent, withinFlowCollection) {
614
+ let captureStart;
615
+ let captureEnd;
616
+ let hasPendingContent;
617
+ let _line;
618
+ let _lineStart;
619
+ let _lineIndent;
620
+ const _kind = state.kind;
621
+ const _result = state.result;
622
+ let ch = state.input.charCodeAt(state.position);
623
+ if (isWsOrEol(ch) ||
624
+ isFlowIndicator(ch) ||
625
+ ch === 0x23 /* # */ ||
626
+ ch === 0x26 /* & */ ||
627
+ ch === 0x2A /* * */ ||
628
+ ch === 0x21 /* ! */ ||
629
+ ch === 0x7C /* | */ ||
630
+ ch === 0x3E /* > */ ||
631
+ ch === 0x27 /* ' */ ||
632
+ ch === 0x22 /* " */ ||
633
+ ch === 0x25 /* % */ ||
634
+ ch === 0x40 /* @ */ ||
635
+ ch === 0x60 /* ` */) {
636
+ return false;
637
+ }
638
+ if (ch === 0x3F /* ? */ || ch === 0x2D /* - */) {
639
+ const following = state.input.charCodeAt(state.position + 1);
640
+ if (isWsOrEol(following) ||
641
+ (withinFlowCollection && isFlowIndicator(following))) {
642
+ return false;
643
+ }
644
+ }
645
+ state.kind = 'scalar';
646
+ state.result = '';
647
+ captureStart = captureEnd = state.position;
648
+ hasPendingContent = false;
649
+ while (ch !== 0) {
650
+ if (ch === 0x3A /* : */) {
651
+ const following = state.input.charCodeAt(state.position + 1);
652
+ if (isWsOrEol(following) ||
653
+ (withinFlowCollection && isFlowIndicator(following))) {
654
+ break;
655
+ }
656
+ }
657
+ else if (ch === 0x23 /* # */) {
658
+ const preceding = state.input.charCodeAt(state.position - 1);
659
+ if (isWsOrEol(preceding)) {
660
+ break;
661
+ }
662
+ }
663
+ else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||
664
+ (withinFlowCollection && isFlowIndicator(ch))) {
665
+ break;
666
+ }
667
+ else if (isEol(ch)) {
668
+ _line = state.line;
669
+ _lineStart = state.lineStart;
670
+ _lineIndent = state.lineIndent;
671
+ skipSeparationSpace(state, false, -1);
672
+ if (state.lineIndent >= nodeIndent) {
673
+ hasPendingContent = true;
674
+ ch = state.input.charCodeAt(state.position);
675
+ continue;
676
+ }
677
+ else {
678
+ state.position = captureEnd;
679
+ state.line = _line;
680
+ state.lineStart = _lineStart;
681
+ state.lineIndent = _lineIndent;
682
+ break;
683
+ }
684
+ }
685
+ if (hasPendingContent) {
686
+ captureSegment(state, captureStart, captureEnd, false);
687
+ writeFoldedLines(state, state.line - _line);
688
+ captureStart = captureEnd = state.position;
689
+ hasPendingContent = false;
690
+ }
691
+ if (!isWhiteSpace(ch)) {
692
+ captureEnd = state.position + 1;
693
+ }
694
+ ch = state.input.charCodeAt(++state.position);
695
+ }
696
+ captureSegment(state, captureStart, captureEnd, false);
697
+ if (state.result) {
698
+ return true;
699
+ }
700
+ state.kind = _kind;
701
+ state.result = _result;
702
+ return false;
703
+ }
704
+ function readSingleQuotedScalar(state, nodeIndent) {
705
+ let captureStart;
706
+ let captureEnd;
707
+ let ch = state.input.charCodeAt(state.position);
708
+ if (ch !== 0x27 /* ' */) {
709
+ return false;
710
+ }
711
+ state.kind = 'scalar';
712
+ state.result = '';
713
+ state.position++;
714
+ captureStart = captureEnd = state.position;
715
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
716
+ if (ch === 0x27 /* ' */) {
717
+ captureSegment(state, captureStart, state.position, true);
718
+ ch = state.input.charCodeAt(++state.position);
719
+ if (ch === 0x27 /* ' */) {
720
+ captureStart = state.position;
721
+ state.position++;
722
+ captureEnd = state.position;
723
+ }
724
+ else {
725
+ return true;
726
+ }
727
+ }
728
+ else if (isEol(ch)) {
729
+ captureSegment(state, captureStart, captureEnd, true);
730
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
731
+ captureStart = captureEnd = state.position;
732
+ }
733
+ else if (state.position === state.lineStart && testDocumentSeparator(state)) {
734
+ throwError(state, 'unexpected end of the document within a single quoted scalar');
735
+ }
736
+ else {
737
+ state.position++;
738
+ if (!isWhiteSpace(ch)) {
739
+ captureEnd = state.position;
740
+ }
741
+ }
742
+ }
743
+ throwError(state, 'unexpected end of the stream within a single quoted scalar');
744
+ }
745
+ function readDoubleQuotedScalar(state, nodeIndent) {
746
+ let captureStart;
747
+ let captureEnd;
748
+ let tmp;
749
+ let ch = state.input.charCodeAt(state.position);
750
+ if (ch !== 0x22 /* " */) {
751
+ return false;
752
+ }
753
+ state.kind = 'scalar';
754
+ state.result = '';
755
+ state.position++;
756
+ captureStart = captureEnd = state.position;
757
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
758
+ if (ch === 0x22 /* " */) {
759
+ captureSegment(state, captureStart, state.position, true);
760
+ state.position++;
761
+ return true;
762
+ }
763
+ else if (ch === 0x5C /* \ */) {
764
+ captureSegment(state, captureStart, state.position, true);
765
+ ch = state.input.charCodeAt(++state.position);
766
+ if (isEol(ch)) {
767
+ skipSeparationSpace(state, false, nodeIndent);
768
+ // TODO: rework to inline fn with no type cast?
769
+ }
770
+ else if (ch < 256 && simpleEscapeCheck[ch]) {
771
+ state.result += simpleEscapeMap[ch];
772
+ state.position++;
773
+ }
774
+ else if ((tmp = escapedHexLen(ch)) > 0) {
775
+ let hexLength = tmp;
776
+ let hexResult = 0;
777
+ for (; hexLength > 0; hexLength--) {
778
+ ch = state.input.charCodeAt(++state.position);
779
+ if ((tmp = fromHexCode(ch)) >= 0) {
780
+ hexResult = (hexResult << 4) + tmp;
781
+ }
782
+ else {
783
+ throwError(state, 'expected hexadecimal character');
784
+ }
785
+ }
786
+ state.result += charFromCodepoint(hexResult);
787
+ state.position++;
788
+ }
789
+ else {
790
+ throwError(state, 'unknown escape sequence');
791
+ }
792
+ captureStart = captureEnd = state.position;
793
+ }
794
+ else if (isEol(ch)) {
795
+ captureSegment(state, captureStart, captureEnd, true);
796
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
797
+ captureStart = captureEnd = state.position;
798
+ }
799
+ else if (state.position === state.lineStart && testDocumentSeparator(state)) {
800
+ throwError(state, 'unexpected end of the document within a double quoted scalar');
801
+ }
802
+ else {
803
+ state.position++;
804
+ if (!isWhiteSpace(ch)) {
805
+ captureEnd = state.position;
806
+ }
807
+ }
808
+ }
809
+ throwError(state, 'unexpected end of the stream within a double quoted scalar');
810
+ }
811
+ function readFlowCollection(state, nodeIndent) {
812
+ let readNext = true;
813
+ let _line;
814
+ const _tag = state.tag;
815
+ let _result;
816
+ const _anchor = state.anchor;
817
+ let terminator;
818
+ let isPair;
819
+ let isExplicitPair;
820
+ let isMapping;
821
+ const overridableKeys = Object.create(null);
822
+ let keyNode;
823
+ let keyTag;
824
+ let valueNode;
825
+ let ch = state.input.charCodeAt(state.position);
826
+ if (ch === 0x5B /* [ */) {
827
+ terminator = 0x5D; /* ] */
828
+ isMapping = false;
829
+ _result = [];
830
+ }
831
+ else if (ch === 0x7B /* { */) {
832
+ terminator = 0x7D; /* } */
833
+ isMapping = true;
834
+ _result = {};
835
+ }
836
+ else {
837
+ return false;
838
+ }
839
+ if (state.anchor !== null) {
840
+ storeAnchor(state, state.anchor, _result);
841
+ }
842
+ ch = state.input.charCodeAt(++state.position);
843
+ while (ch !== 0) {
844
+ skipSeparationSpace(state, true, nodeIndent);
845
+ ch = state.input.charCodeAt(state.position);
846
+ if (ch === terminator) {
847
+ state.position++;
848
+ state.tag = _tag;
849
+ state.anchor = _anchor;
850
+ state.kind = isMapping ? 'mapping' : 'sequence';
851
+ state.result = _result;
852
+ return true;
853
+ }
854
+ else if (!readNext) {
855
+ throwError(state, 'missed comma between flow collection entries');
856
+ }
857
+ else if (ch === 0x2C /* , */) {
858
+ // "flow collection entries can never be completely empty", as per YAML 1.2, section 7.4
859
+ throwError(state, "expected the node content, but found ','");
860
+ }
861
+ keyTag = keyNode = valueNode = null;
862
+ isPair = isExplicitPair = false;
863
+ if (ch === 0x3F /* ? */) {
864
+ const following = state.input.charCodeAt(state.position + 1);
865
+ if (isWsOrEol(following)) {
866
+ isPair = isExplicitPair = true;
867
+ state.position++;
868
+ skipSeparationSpace(state, true, nodeIndent);
869
+ }
870
+ }
871
+ _line = state.line; // Save the current line.
872
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
873
+ keyTag = state.tag;
874
+ keyNode = state.result;
875
+ skipSeparationSpace(state, true, nodeIndent);
876
+ ch = state.input.charCodeAt(state.position);
877
+ if ((isExplicitPair || state.line === _line) && ch === 0x3A /* : */) {
878
+ isPair = true;
879
+ ch = state.input.charCodeAt(++state.position);
880
+ skipSeparationSpace(state, true, nodeIndent);
881
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
882
+ valueNode = state.result;
883
+ }
884
+ if (isMapping) {
885
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);
886
+ }
887
+ else if (isPair) {
888
+ _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode));
889
+ }
890
+ else {
891
+ _result.push(keyNode);
892
+ }
893
+ skipSeparationSpace(state, true, nodeIndent);
894
+ ch = state.input.charCodeAt(state.position);
895
+ if (ch === 0x2C /* , */) {
896
+ readNext = true;
897
+ ch = state.input.charCodeAt(++state.position);
898
+ }
899
+ else {
900
+ readNext = false;
901
+ }
902
+ }
903
+ throwError(state, 'unexpected end of the stream within a flow collection');
904
+ }
905
+ function readBlockScalar(state, nodeIndent) {
906
+ let folding;
907
+ let chomping = CHOMPING_CLIP;
908
+ let didReadContent = false;
909
+ let detectedIndent = false;
910
+ let textIndent = nodeIndent;
911
+ let emptyLines = 0;
912
+ let atMoreIndented = false;
913
+ let tmp;
914
+ let ch = state.input.charCodeAt(state.position);
915
+ if (ch === 0x7C /* | */) {
916
+ folding = false;
917
+ }
918
+ else if (ch === 0x3E /* > */) {
919
+ folding = true;
920
+ }
921
+ else {
922
+ return false;
923
+ }
924
+ state.kind = 'scalar';
925
+ state.result = '';
926
+ while (ch !== 0) {
927
+ ch = state.input.charCodeAt(++state.position);
928
+ if (ch === 0x2B /* + */ || ch === 0x2D /* - */) {
929
+ if (CHOMPING_CLIP === chomping) {
930
+ chomping = (ch === 0x2B /* + */) ? CHOMPING_KEEP : CHOMPING_STRIP;
931
+ }
932
+ else {
933
+ throwError(state, 'repeat of a chomping mode identifier');
934
+ }
935
+ }
936
+ else if ((tmp = fromDecimalCode(ch)) >= 0) {
937
+ if (tmp === 0) {
938
+ throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');
939
+ }
940
+ else if (!detectedIndent) {
941
+ textIndent = nodeIndent + tmp - 1;
942
+ detectedIndent = true;
943
+ }
944
+ else {
945
+ throwError(state, 'repeat of an indentation width identifier');
946
+ }
947
+ }
948
+ else {
949
+ break;
950
+ }
951
+ }
952
+ if (isWhiteSpace(ch)) {
953
+ do {
954
+ ch = state.input.charCodeAt(++state.position);
955
+ } while (isWhiteSpace(ch));
956
+ if (ch === 0x23 /* # */) {
957
+ do {
958
+ ch = state.input.charCodeAt(++state.position);
959
+ } while (!isEol(ch) && (ch !== 0));
960
+ }
961
+ }
962
+ while (ch !== 0) {
963
+ readLineBreak(state);
964
+ state.lineIndent = 0;
965
+ ch = state.input.charCodeAt(state.position);
966
+ // eslint-disable-next-line no-unmodified-loop-condition
967
+ while ((!detectedIndent || state.lineIndent < textIndent) &&
968
+ (ch === 0x20 /* Space */)) {
969
+ state.lineIndent++;
970
+ ch = state.input.charCodeAt(++state.position);
971
+ }
972
+ if (!detectedIndent && state.lineIndent > textIndent) {
973
+ textIndent = state.lineIndent;
974
+ }
975
+ if (isEol(ch)) {
976
+ emptyLines++;
977
+ continue;
978
+ }
979
+ if (!detectedIndent && textIndent === 0) {
980
+ throwError(state, 'missing indentation for block scalar');
981
+ }
982
+ // End of the scalar.
983
+ if (state.lineIndent < textIndent) {
984
+ // Perform the chomping.
985
+ if (chomping === CHOMPING_KEEP) {
986
+ state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
987
+ }
988
+ else if (chomping === CHOMPING_CLIP) {
989
+ if (didReadContent) { // i.e. only if the scalar is not empty.
990
+ state.result += '\n';
991
+ }
992
+ }
993
+ // Break this `while` cycle and go to the funciton's epilogue.
994
+ break;
995
+ }
996
+ // Folded style: use fancy rules to handle line breaks.
997
+ if (folding) {
998
+ // Lines starting with white space characters (more-indented lines) are not folded.
999
+ if (isWhiteSpace(ch)) {
1000
+ atMoreIndented = true;
1001
+ // except for the first content line (cf. Example 8.1)
1002
+ state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
1003
+ // End of more-indented block.
1004
+ }
1005
+ else if (atMoreIndented) {
1006
+ atMoreIndented = false;
1007
+ state.result += common.repeat('\n', emptyLines + 1);
1008
+ // Just one line break - perceive as the same line.
1009
+ }
1010
+ else if (emptyLines === 0) {
1011
+ if (didReadContent) { // i.e. only if we have already read some scalar content.
1012
+ state.result += ' ';
1013
+ }
1014
+ // Several line breaks - perceive as different lines.
1015
+ }
1016
+ else {
1017
+ state.result += common.repeat('\n', emptyLines);
1018
+ }
1019
+ // Literal style: just add exact number of line breaks between content lines.
1020
+ }
1021
+ else {
1022
+ // Keep all line breaks except the header line break.
1023
+ state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
1024
+ }
1025
+ didReadContent = true;
1026
+ detectedIndent = true;
1027
+ emptyLines = 0;
1028
+ const captureStart = state.position;
1029
+ while (!isEol(ch) && (ch !== 0)) {
1030
+ ch = state.input.charCodeAt(++state.position);
1031
+ }
1032
+ captureSegment(state, captureStart, state.position, false);
1033
+ }
1034
+ return true;
1035
+ }
1036
+ function readBlockSequence(state, nodeIndent) {
1037
+ const _tag = state.tag;
1038
+ const _anchor = state.anchor;
1039
+ const _result = [];
1040
+ let detected = false;
1041
+ // there is a leading tab before this token, so it can't be a block sequence/mapping;
1042
+ // it can still be flow sequence/mapping or a scalar
1043
+ if (state.firstTabInLine !== -1)
1044
+ return false;
1045
+ if (state.anchor !== null) {
1046
+ storeAnchor(state, state.anchor, _result);
1047
+ }
1048
+ let ch = state.input.charCodeAt(state.position);
1049
+ while (ch !== 0) {
1050
+ if (state.firstTabInLine !== -1) {
1051
+ state.position = state.firstTabInLine;
1052
+ throwError(state, 'tab characters must not be used in indentation');
1053
+ }
1054
+ if (ch !== 0x2D /* - */) {
1055
+ break;
1056
+ }
1057
+ const following = state.input.charCodeAt(state.position + 1);
1058
+ if (!isWsOrEol(following)) {
1059
+ break;
1060
+ }
1061
+ detected = true;
1062
+ state.position++;
1063
+ if (skipSeparationSpace(state, true, -1)) {
1064
+ if (state.lineIndent <= nodeIndent) {
1065
+ _result.push(null);
1066
+ ch = state.input.charCodeAt(state.position);
1067
+ continue;
1068
+ }
1069
+ }
1070
+ const _line = state.line;
1071
+ composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
1072
+ _result.push(state.result);
1073
+ skipSeparationSpace(state, true, -1);
1074
+ ch = state.input.charCodeAt(state.position);
1075
+ if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {
1076
+ throwError(state, 'bad indentation of a sequence entry');
1077
+ }
1078
+ else if (state.lineIndent < nodeIndent) {
1079
+ break;
1080
+ }
1081
+ }
1082
+ if (detected) {
1083
+ state.tag = _tag;
1084
+ state.anchor = _anchor;
1085
+ state.kind = 'sequence';
1086
+ state.result = _result;
1087
+ return true;
1088
+ }
1089
+ return false;
1090
+ }
1091
+ function readBlockMapping(state, nodeIndent, flowIndent) {
1092
+ let allowCompact;
1093
+ const _tag = state.tag;
1094
+ const _anchor = state.anchor;
1095
+ const _result = {};
1096
+ const overridableKeys = Object.create(null);
1097
+ let keyTag = null;
1098
+ let keyNode = null;
1099
+ let valueNode = null;
1100
+ let atExplicitKey = false;
1101
+ let detected = false;
1102
+ // there is a leading tab before this token, so it can't be a block sequence/mapping;
1103
+ // it can still be flow sequence/mapping or a scalar
1104
+ if (state.firstTabInLine !== -1)
1105
+ return false;
1106
+ if (state.anchor !== null) {
1107
+ storeAnchor(state, state.anchor, _result);
1108
+ }
1109
+ let ch = state.input.charCodeAt(state.position);
1110
+ while (ch !== 0) {
1111
+ if (!atExplicitKey && state.firstTabInLine !== -1) {
1112
+ state.position = state.firstTabInLine;
1113
+ throwError(state, 'tab characters must not be used in indentation');
1114
+ }
1115
+ const following = state.input.charCodeAt(state.position + 1);
1116
+ const _line = state.line; // Save the current line.
1117
+ //
1118
+ // Explicit notation case. There are two separate blocks:
1119
+ // first for the key (denoted by "?") and second for the value (denoted by ":")
1120
+ //
1121
+ if ((ch === 0x3F /* ? */ || ch === 0x3A /* : */) && isWsOrEol(following)) {
1122
+ if (ch === 0x3F /* ? */) {
1123
+ if (atExplicitKey) {
1124
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
1125
+ keyTag = keyNode = valueNode = null;
1126
+ }
1127
+ detected = true;
1128
+ atExplicitKey = true;
1129
+ allowCompact = true;
1130
+ }
1131
+ else if (atExplicitKey) {
1132
+ // i.e. 0x3A/* : */ === character after the explicit key.
1133
+ atExplicitKey = false;
1134
+ allowCompact = true;
1135
+ }
1136
+ else {
1137
+ throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line');
1138
+ }
1139
+ state.position += 1;
1140
+ ch = following;
1141
+ //
1142
+ // Implicit notation case. Flow-style node as the key first, then ":", and the value.
1143
+ //
1144
+ }
1145
+ else {
1146
+ if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
1147
+ // Neither implicit nor explicit notation.
1148
+ // Reading is done. Go to the epilogue.
1149
+ break;
1150
+ }
1151
+ if (state.line === _line) {
1152
+ ch = state.input.charCodeAt(state.position);
1153
+ while (isWhiteSpace(ch)) {
1154
+ ch = state.input.charCodeAt(++state.position);
1155
+ }
1156
+ if (ch === 0x3A /* : */) {
1157
+ ch = state.input.charCodeAt(++state.position);
1158
+ if (!isWsOrEol(ch)) {
1159
+ throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping');
1160
+ }
1161
+ if (atExplicitKey) {
1162
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
1163
+ keyTag = keyNode = valueNode = null;
1164
+ }
1165
+ detected = true;
1166
+ atExplicitKey = false;
1167
+ allowCompact = false;
1168
+ keyTag = state.tag;
1169
+ keyNode = state.result;
1170
+ }
1171
+ else if (detected) {
1172
+ throwError(state, 'can not read an implicit mapping pair; a colon is missed');
1173
+ }
1174
+ else {
1175
+ state.tag = _tag;
1176
+ state.anchor = _anchor;
1177
+ return true; // Keep the result of `composeNode`.
1178
+ }
1179
+ }
1180
+ else if (detected) {
1181
+ throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');
1182
+ }
1183
+ else {
1184
+ state.tag = _tag;
1185
+ state.anchor = _anchor;
1186
+ return true; // Keep the result of `composeNode`.
1187
+ }
1188
+ }
1189
+ //
1190
+ // Common reading code for both explicit and implicit notations.
1191
+ //
1192
+ if (state.line === _line || state.lineIndent > nodeIndent) {
1193
+ if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
1194
+ if (atExplicitKey) {
1195
+ keyNode = state.result;
1196
+ }
1197
+ else {
1198
+ valueNode = state.result;
1199
+ }
1200
+ }
1201
+ if (!atExplicitKey) {
1202
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);
1203
+ keyTag = keyNode = valueNode = null;
1204
+ }
1205
+ skipSeparationSpace(state, true, -1);
1206
+ ch = state.input.charCodeAt(state.position);
1207
+ }
1208
+ if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {
1209
+ throwError(state, 'bad indentation of a mapping entry');
1210
+ }
1211
+ else if (state.lineIndent < nodeIndent) {
1212
+ break;
1213
+ }
1214
+ }
1215
+ //
1216
+ // Epilogue.
1217
+ //
1218
+ // Special case: last mapping's node contains only the key in explicit notation.
1219
+ if (atExplicitKey) {
1220
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
1221
+ }
1222
+ // Expose the resulting mapping.
1223
+ if (detected) {
1224
+ state.tag = _tag;
1225
+ state.anchor = _anchor;
1226
+ state.kind = 'mapping';
1227
+ state.result = _result;
1228
+ }
1229
+ return detected;
1230
+ }
1231
+ function readTagProperty(state) {
1232
+ let isVerbatim = false;
1233
+ let isNamed = false;
1234
+ let tagHandle;
1235
+ let tagName;
1236
+ let ch = state.input.charCodeAt(state.position);
1237
+ if (ch !== 0x21 /* ! */)
1238
+ return false;
1239
+ if (state.tag !== null) {
1240
+ throwError(state, 'duplication of a tag property');
1241
+ }
1242
+ ch = state.input.charCodeAt(++state.position);
1243
+ if (ch === 0x3C /* < */) {
1244
+ isVerbatim = true;
1245
+ ch = state.input.charCodeAt(++state.position);
1246
+ }
1247
+ else if (ch === 0x21 /* ! */) {
1248
+ isNamed = true;
1249
+ tagHandle = '!!';
1250
+ ch = state.input.charCodeAt(++state.position);
1251
+ }
1252
+ else {
1253
+ tagHandle = '!';
1254
+ }
1255
+ let _position = state.position;
1256
+ if (isVerbatim) {
1257
+ do {
1258
+ ch = state.input.charCodeAt(++state.position);
1259
+ } while (ch !== 0 && ch !== 0x3E /* > */);
1260
+ if (state.position < state.length) {
1261
+ tagName = state.input.slice(_position, state.position);
1262
+ ch = state.input.charCodeAt(++state.position);
1263
+ }
1264
+ else {
1265
+ throwError(state, 'unexpected end of the stream within a verbatim tag');
1266
+ }
1267
+ }
1268
+ else {
1269
+ while (ch !== 0 && !isWsOrEol(ch)) {
1270
+ if (ch === 0x21 /* ! */) {
1271
+ if (!isNamed) {
1272
+ tagHandle = state.input.slice(_position - 1, state.position + 1);
1273
+ if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
1274
+ throwError(state, 'named tag handle cannot contain such characters');
1275
+ }
1276
+ isNamed = true;
1277
+ _position = state.position + 1;
1278
+ }
1279
+ else {
1280
+ throwError(state, 'tag suffix cannot contain exclamation marks');
1281
+ }
1282
+ }
1283
+ ch = state.input.charCodeAt(++state.position);
1284
+ }
1285
+ tagName = state.input.slice(_position, state.position);
1286
+ if (PATTERN_FLOW_INDICATORS.test(tagName)) {
1287
+ throwError(state, 'tag suffix cannot contain flow indicator characters');
1288
+ }
1289
+ }
1290
+ if (tagName && !PATTERN_TAG_URI.test(tagName)) {
1291
+ throwError(state, 'tag name cannot contain such characters: ' + tagName);
1292
+ }
1293
+ try {
1294
+ tagName = decodeURIComponent(tagName);
1295
+ }
1296
+ catch (err) {
1297
+ throwError(state, 'tag name is malformed: ' + tagName);
1298
+ }
1299
+ if (isVerbatim) {
1300
+ state.tag = tagName;
1301
+ }
1302
+ else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
1303
+ state.tag = state.tagMap[tagHandle] + tagName;
1304
+ }
1305
+ else if (tagHandle === '!') {
1306
+ state.tag = '!' + tagName;
1307
+ }
1308
+ else if (tagHandle === '!!') {
1309
+ state.tag = 'tag:yaml.org,2002:' + tagName;
1310
+ }
1311
+ else {
1312
+ throwError(state, 'undeclared tag handle "' + tagHandle + '"');
1313
+ }
1314
+ return true;
1315
+ }
1316
+ function readAnchorProperty(state) {
1317
+ let ch = state.input.charCodeAt(state.position);
1318
+ if (ch !== 0x26 /* & */)
1319
+ return false;
1320
+ if (state.anchor !== null) {
1321
+ throwError(state, 'duplication of an anchor property');
1322
+ }
1323
+ ch = state.input.charCodeAt(++state.position);
1324
+ const _position = state.position;
1325
+ while (ch !== 0 && !isWsOrEol(ch) && !isFlowIndicator(ch)) {
1326
+ ch = state.input.charCodeAt(++state.position);
1327
+ }
1328
+ if (state.position === _position) {
1329
+ throwError(state, 'name of an anchor node must contain at least one character');
1330
+ }
1331
+ state.anchor = state.input.slice(_position, state.position);
1332
+ return true;
1333
+ }
1334
+ function readAlias(state) {
1335
+ let ch = state.input.charCodeAt(state.position);
1336
+ if (ch !== 0x2A /* * */)
1337
+ return false;
1338
+ ch = state.input.charCodeAt(++state.position);
1339
+ const _position = state.position;
1340
+ while (ch !== 0 && !isWsOrEol(ch) && !isFlowIndicator(ch)) {
1341
+ ch = state.input.charCodeAt(++state.position);
1342
+ }
1343
+ if (state.position === _position) {
1344
+ throwError(state, 'name of an alias node must contain at least one character');
1345
+ }
1346
+ const alias = state.input.slice(_position, state.position);
1347
+ if (!_hasOwnProperty.call(state.anchorMap, alias)) {
1348
+ throwError(state, 'unidentified alias "' + alias + '"');
1349
+ }
1350
+ state.result = state.anchorMap[alias];
1351
+ skipSeparationSpace(state, true, -1);
1352
+ return true;
1353
+ }
1354
+ function tryReadBlockMappingFromProperty(state, propertyStart, nodeIndent, flowIndent) {
1355
+ const fallbackState = snapshotState(state);
1356
+ beginAnchorTransaction(state);
1357
+ restoreState(state, propertyStart);
1358
+ // Re-read the leading properties as part of the first implicit key, not as
1359
+ // properties of the current node.
1360
+ state.tag = null;
1361
+ state.anchor = null;
1362
+ state.kind = null;
1363
+ state.result = null;
1364
+ if (readBlockMapping(state, nodeIndent, flowIndent) && state.kind === 'mapping') {
1365
+ commitAnchorTransaction(state);
1366
+ return true;
1367
+ }
1368
+ rollbackAnchorTransaction(state);
1369
+ restoreState(state, fallbackState);
1370
+ return false;
1371
+ }
1372
+ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
1373
+ let allowBlockScalars;
1374
+ let allowBlockCollections;
1375
+ let indentStatus = 1; // 1: this>parent, 0: this=parent, -1: this<parent
1376
+ let atNewLine = false;
1377
+ let hasContent = false;
1378
+ let propertyStart = null;
1379
+ let type;
1380
+ let flowIndent;
1381
+ let blockIndent;
1382
+ if (state.depth >= state.maxDepth) {
1383
+ throwError(state, 'nesting exceeded maxDepth (' + state.maxDepth + ')');
1384
+ }
1385
+ state.depth += 1;
1386
+ state.tag = null;
1387
+ state.anchor = null;
1388
+ state.kind = null;
1389
+ state.result = null;
1390
+ const allowBlockStyles = allowBlockScalars = allowBlockCollections =
1391
+ CONTEXT_BLOCK_OUT === nodeContext ||
1392
+ CONTEXT_BLOCK_IN === nodeContext;
1393
+ if (allowToSeek) {
1394
+ if (skipSeparationSpace(state, true, -1)) {
1395
+ atNewLine = true;
1396
+ if (state.lineIndent > parentIndent) {
1397
+ indentStatus = 1;
1398
+ }
1399
+ else if (state.lineIndent === parentIndent) {
1400
+ indentStatus = 0;
1401
+ }
1402
+ else if (state.lineIndent < parentIndent) {
1403
+ indentStatus = -1;
1404
+ }
1405
+ }
1406
+ }
1407
+ if (indentStatus === 1) {
1408
+ while (true) {
1409
+ const ch = state.input.charCodeAt(state.position);
1410
+ const propertyState = snapshotState(state);
1411
+ // A duplicate property token after a line break can be the first key of
1412
+ // a nested block mapping, e.g. `!!map\n !!str key: value`.
1413
+ if (atNewLine &&
1414
+ ((ch === 0x21 /* ! */ && state.tag !== null) ||
1415
+ (ch === 0x26 /* & */ && state.anchor !== null))) {
1416
+ break;
1417
+ }
1418
+ if (!readTagProperty(state) && !readAnchorProperty(state)) {
1419
+ break;
1420
+ }
1421
+ if (propertyStart === null) {
1422
+ propertyStart = propertyState;
1423
+ }
1424
+ if (skipSeparationSpace(state, true, -1)) {
1425
+ atNewLine = true;
1426
+ allowBlockCollections = allowBlockStyles;
1427
+ if (state.lineIndent > parentIndent) {
1428
+ indentStatus = 1;
1429
+ }
1430
+ else if (state.lineIndent === parentIndent) {
1431
+ indentStatus = 0;
1432
+ }
1433
+ else if (state.lineIndent < parentIndent) {
1434
+ indentStatus = -1;
1435
+ }
1436
+ }
1437
+ else {
1438
+ allowBlockCollections = false;
1439
+ }
1440
+ }
1441
+ }
1442
+ if (allowBlockCollections) {
1443
+ allowBlockCollections = atNewLine || allowCompact;
1444
+ }
1445
+ if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
1446
+ if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
1447
+ flowIndent = parentIndent;
1448
+ }
1449
+ else {
1450
+ flowIndent = parentIndent + 1;
1451
+ }
1452
+ blockIndent = state.position - state.lineStart;
1453
+ if (indentStatus === 1) {
1454
+ if ((allowBlockCollections &&
1455
+ (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent))) ||
1456
+ readFlowCollection(state, flowIndent)) {
1457
+ hasContent = true;
1458
+ }
1459
+ else {
1460
+ const ch = state.input.charCodeAt(state.position);
1461
+ if (propertyStart !== null && allowBlockStyles && !allowBlockCollections &&
1462
+ ch !== 0x7C /* | */ && ch !== 0x3E /* > */ &&
1463
+ tryReadBlockMappingFromProperty(state, propertyStart, propertyStart.position - propertyStart.lineStart, flowIndent)) {
1464
+ hasContent = true;
1465
+ }
1466
+ else if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||
1467
+ readSingleQuotedScalar(state, flowIndent) ||
1468
+ readDoubleQuotedScalar(state, flowIndent)) {
1469
+ hasContent = true;
1470
+ }
1471
+ else if (readAlias(state)) {
1472
+ hasContent = true;
1473
+ if (state.tag !== null || state.anchor !== null) {
1474
+ throwError(state, 'alias node should not have any properties');
1475
+ }
1476
+ }
1477
+ else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
1478
+ hasContent = true;
1479
+ if (state.tag === null) {
1480
+ state.tag = '?';
1481
+ }
1482
+ }
1483
+ if (state.anchor !== null) {
1484
+ storeAnchor(state, state.anchor, state.result);
1485
+ }
1486
+ }
1487
+ }
1488
+ else if (indentStatus === 0) {
1489
+ // Special case: block sequences are allowed to have same indentation level as the parent.
1490
+ // http://www.yaml.org/spec/1.2/spec.html#id2799784
1491
+ hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
1492
+ }
1493
+ }
1494
+ if (state.tag === null) {
1495
+ if (state.anchor !== null) {
1496
+ storeAnchor(state, state.anchor, state.result);
1497
+ }
1498
+ }
1499
+ else if (state.tag === '?') {
1500
+ // Implicit resolving is not allowed for non-scalar types, and '?'
1501
+ // non-specific tag is only automatically assigned to plain scalars.
1502
+ //
1503
+ // We only need to check kind conformity in case user explicitly assigns '?'
1504
+ // tag, for example like this: "!<?> [0]"
1505
+ //
1506
+ if (state.result !== null && state.kind !== 'scalar') {
1507
+ throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
1508
+ }
1509
+ for (let typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
1510
+ type = state.implicitTypes[typeIndex];
1511
+ if (type.resolve(state.result)) { // `state.result` updated in resolver if matched
1512
+ state.result = type.construct(state.result);
1513
+ state.tag = type.tag;
1514
+ if (state.anchor !== null) {
1515
+ storeAnchor(state, state.anchor, state.result);
1516
+ }
1517
+ break;
1518
+ }
1519
+ }
1520
+ }
1521
+ else if (state.tag !== '!') {
1522
+ if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) {
1523
+ type = state.typeMap[state.kind || 'fallback'][state.tag];
1524
+ }
1525
+ else {
1526
+ // looking for multi type
1527
+ type = null;
1528
+ const typeList = state.typeMap.multi[state.kind || 'fallback'];
1529
+ for (let typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
1530
+ if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
1531
+ type = typeList[typeIndex];
1532
+ break;
1533
+ }
1534
+ }
1535
+ }
1536
+ if (!type) {
1537
+ throwError(state, 'unknown tag !<' + state.tag + '>');
1538
+ }
1539
+ if (state.result !== null && type.kind !== state.kind) {
1540
+ throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
1541
+ }
1542
+ if (!type.resolve(state.result, state.tag)) { // `state.result` updated in resolver if matched
1543
+ throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');
1544
+ }
1545
+ else {
1546
+ state.result = type.construct(state.result, state.tag);
1547
+ if (state.anchor !== null) {
1548
+ storeAnchor(state, state.anchor, state.result);
1549
+ }
1550
+ }
1551
+ }
1552
+ state.depth -= 1;
1553
+ return state.tag !== null || state.anchor !== null || hasContent;
1554
+ }
1555
+ function readDocument(state) {
1556
+ let hasDirectives = false;
1557
+ let ch;
1558
+ state.version = null;
1559
+ state.tagMap = Object.create(null);
1560
+ state.anchorMap = Object.create(null);
1561
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
1562
+ skipSeparationSpace(state, true, -1);
1563
+ ch = state.input.charCodeAt(state.position);
1564
+ if (state.lineIndent > 0 || ch !== 0x25 /* % */) {
1565
+ break;
1566
+ }
1567
+ hasDirectives = true;
1568
+ ch = state.input.charCodeAt(++state.position);
1569
+ let _position = state.position;
1570
+ while (ch !== 0 && !isWsOrEol(ch)) {
1571
+ ch = state.input.charCodeAt(++state.position);
1572
+ }
1573
+ const directiveName = state.input.slice(_position, state.position);
1574
+ const directiveArgs = [];
1575
+ if (directiveName.length < 1) {
1576
+ throwError(state, 'directive name must not be less than one character in length');
1577
+ }
1578
+ while (ch !== 0) {
1579
+ while (isWhiteSpace(ch)) {
1580
+ ch = state.input.charCodeAt(++state.position);
1581
+ }
1582
+ if (ch === 0x23 /* # */) {
1583
+ do {
1584
+ ch = state.input.charCodeAt(++state.position);
1585
+ } while (ch !== 0 && !isEol(ch));
1586
+ break;
1587
+ }
1588
+ if (isEol(ch))
1589
+ break;
1590
+ _position = state.position;
1591
+ while (ch !== 0 && !isWsOrEol(ch)) {
1592
+ ch = state.input.charCodeAt(++state.position);
1593
+ }
1594
+ directiveArgs.push(state.input.slice(_position, state.position));
1595
+ }
1596
+ if (ch !== 0)
1597
+ readLineBreak(state);
1598
+ // An unknown directive is ignored.
1599
+ if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
1600
+ directiveHandlers[directiveName](state, directiveName, directiveArgs);
1601
+ }
1602
+ }
1603
+ skipSeparationSpace(state, true, -1);
1604
+ if (state.lineIndent === 0 &&
1605
+ state.input.charCodeAt(state.position) === 0x2D /* - */ &&
1606
+ state.input.charCodeAt(state.position + 1) === 0x2D /* - */ &&
1607
+ state.input.charCodeAt(state.position + 2) === 0x2D /* - */) {
1608
+ state.position += 3;
1609
+ skipSeparationSpace(state, true, -1);
1610
+ }
1611
+ else if (hasDirectives) {
1612
+ throwError(state, 'directives end mark is expected');
1613
+ }
1614
+ composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
1615
+ skipSeparationSpace(state, true, -1);
1616
+ state.documents.push(state.result);
1617
+ if (state.position === state.lineStart && testDocumentSeparator(state)) {
1618
+ if (state.input.charCodeAt(state.position) === 0x2E /* . */) {
1619
+ state.position += 3;
1620
+ skipSeparationSpace(state, true, -1);
1621
+ }
1622
+ return;
1623
+ }
1624
+ if (state.position < (state.length - 1)) {
1625
+ throwError(state, 'end of the stream or a document separator is expected');
1626
+ }
1627
+ }
1628
+ /**
1629
+ * Read one YAML document. `types.implicit` lists the scalar types tried in
1630
+ * order on untagged scalars; `types.explicit` lists those reachable by tag.
1631
+ * Returns `undefined` for an empty stream and throws {@link YAMLException}
1632
+ * on malformed input or more than one document.
1633
+ */
1634
+ export function load(input, types) {
1635
+ input = String(input);
1636
+ if (input.length !== 0) {
1637
+ if (input.charCodeAt(input.length - 1) !== 0x0a && input.charCodeAt(input.length - 1) !== 0x0d)
1638
+ input += "\n";
1639
+ if (input.charCodeAt(0) === 0xfeff)
1640
+ input = input.slice(1);
1641
+ }
1642
+ var state = new State(input, types);
1643
+ var nullpos = input.indexOf("\0");
1644
+ if (nullpos !== -1) {
1645
+ state.position = nullpos;
1646
+ throwError(state, "null byte is not allowed in input");
1647
+ }
1648
+ // Use 0 as string terminator. That significantly simplifies bounds check.
1649
+ state.input += "\0";
1650
+ while (state.input.charCodeAt(state.position) === 0x20) {
1651
+ state.lineIndent += 1;
1652
+ state.position += 1;
1653
+ }
1654
+ while (state.position < state.length - 1)
1655
+ readDocument(state);
1656
+ const documents = state.documents;
1657
+ if (documents.length === 0)
1658
+ return undefined;
1659
+ if (documents.length === 1)
1660
+ return documents[0];
1661
+ throw new YAMLException("expected a single document in the stream, but found more");
1662
+ }