farseer-cli 1.18.0 → 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/README.md +33 -10
  2. package/dist/commands/app.js +42 -3
  3. package/dist/commands/app.js.map +1 -2
  4. package/dist/commands/apps.js.map +0 -1
  5. package/dist/commands/cells.js +120 -85
  6. package/dist/commands/cells.js.map +1 -2
  7. package/dist/commands/code.js.map +0 -1
  8. package/dist/commands/config.js.map +0 -1
  9. package/dist/commands/dashboards.js +246 -12
  10. package/dist/commands/dashboards.js.map +1 -2
  11. package/dist/commands/diff.js.map +0 -1
  12. package/dist/commands/dimensions.js +52 -27
  13. package/dist/commands/dimensions.js.map +1 -2
  14. package/dist/commands/docs.js +82 -0
  15. package/dist/commands/docs.js.map +6 -0
  16. package/dist/commands/files.js +49 -0
  17. package/dist/commands/files.js.map +2 -3
  18. package/dist/commands/folders.js +76 -0
  19. package/dist/commands/folders.js.map +6 -0
  20. package/dist/commands/formula.js +38 -30
  21. package/dist/commands/formula.js.map +1 -2
  22. package/dist/commands/install.js +32 -30
  23. package/dist/commands/install.js.map +2 -3
  24. package/dist/commands/list.js.map +0 -1
  25. package/dist/commands/login.js +3 -3
  26. package/dist/commands/login.js.map +1 -2
  27. package/dist/commands/logout.js.map +0 -1
  28. package/dist/commands/mcp-server.js.map +0 -1
  29. package/dist/commands/model.js +30 -5
  30. package/dist/commands/model.js.map +2 -3
  31. package/dist/commands/pipeline.js.map +0 -1
  32. package/dist/commands/pull.js +1 -1
  33. package/dist/commands/pull.js.map +1 -2
  34. package/dist/commands/push.js +6 -4
  35. package/dist/commands/push.js.map +1 -2
  36. package/dist/commands/refresh.js.map +0 -1
  37. package/dist/commands/run.js.map +0 -1
  38. package/dist/commands/sheets.js +289 -52
  39. package/dist/commands/sheets.js.map +1 -2
  40. package/dist/commands/skills.js +157 -0
  41. package/dist/commands/skills.js.map +6 -0
  42. package/dist/commands/status.js.map +0 -1
  43. package/dist/commands/tool.js.map +0 -1
  44. package/dist/commands/variables.js +246 -82
  45. package/dist/commands/variables.js.map +1 -2
  46. package/dist/commands/whoami.js.map +0 -1
  47. package/dist/index.js +117 -23
  48. package/dist/index.js.map +1 -2
  49. package/dist/mcp/index.js.map +0 -1
  50. package/dist/mcp/prompts/workflows.js.map +0 -1
  51. package/dist/mcp/resources/documentation.js +19 -12
  52. package/dist/mcp/resources/documentation.js.map +1 -2
  53. package/dist/mcp/server.js.map +0 -1
  54. package/dist/mcp/skills.js.map +0 -1
  55. package/dist/mcp/tools/appTools.js +1 -7
  56. package/dist/mcp/tools/appTools.js.map +1 -2
  57. package/dist/mcp/tools/authTools.js +1 -1
  58. package/dist/mcp/tools/authTools.js.map +1 -2
  59. package/dist/mcp/tools/cellTools.js +6 -19
  60. package/dist/mcp/tools/cellTools.js.map +1 -2
  61. package/dist/mcp/tools/dashboardTools.js +30 -412
  62. package/dist/mcp/tools/dashboardTools.js.map +2 -3
  63. package/dist/mcp/tools/dataTools.js +15 -146
  64. package/dist/mcp/tools/dataTools.js.map +1 -2
  65. package/dist/mcp/tools/folderTools.js +12 -78
  66. package/dist/mcp/tools/folderTools.js.map +1 -2
  67. package/dist/mcp/tools/modelTools.js +23 -372
  68. package/dist/mcp/tools/modelTools.js.map +1 -2
  69. package/dist/mcp/tools/pipelineContract.js +5 -1
  70. package/dist/mcp/tools/pipelineContract.js.map +1 -2
  71. package/dist/mcp/tools/pipelineTools.js.map +0 -1
  72. package/dist/mcp/tools/runTools.js +8 -69
  73. package/dist/mcp/tools/runTools.js.map +1 -2
  74. package/dist/mcp/tools/sheetTools.js +14 -264
  75. package/dist/mcp/tools/sheetTools.js.map +1 -2
  76. package/dist/mcp/tools/syncTools.js +7 -3
  77. package/dist/mcp/tools/syncTools.js.map +1 -2
  78. package/dist/mcp/utils/helpers.js.map +0 -1
  79. package/dist/mcp/utils/launchPin.js.map +0 -1
  80. package/dist/mcp/utils/operationResponse.js +41 -0
  81. package/dist/mcp/utils/operationResponse.js.map +6 -0
  82. package/dist/mcp/utils/registerTool.js.map +0 -1
  83. package/dist/mcp/utils/session.js.map +0 -1
  84. package/dist/mcp/utils/tenantPin.js.map +0 -1
  85. package/dist/operations/cells.js +444 -0
  86. package/dist/operations/cells.js.map +6 -0
  87. package/dist/operations/dashboards.js +357 -0
  88. package/dist/operations/dashboards.js.map +6 -0
  89. package/dist/operations/data.js +206 -0
  90. package/dist/operations/data.js.map +6 -0
  91. package/dist/operations/errors.js +64 -0
  92. package/dist/operations/errors.js.map +6 -0
  93. package/dist/operations/exportModel.js +59 -0
  94. package/dist/operations/exportModel.js.map +6 -0
  95. package/dist/operations/folderPath.js +128 -0
  96. package/dist/operations/folderPath.js.map +6 -0
  97. package/dist/operations/folders.js +80 -0
  98. package/dist/operations/folders.js.map +6 -0
  99. package/dist/operations/install.js +109 -0
  100. package/dist/operations/install.js.map +6 -0
  101. package/dist/operations/model.js +271 -0
  102. package/dist/operations/model.js.map +6 -0
  103. package/dist/operations/sheets.js +428 -0
  104. package/dist/operations/sheets.js.map +6 -0
  105. package/dist/pipeline/compatibility.js.map +0 -1
  106. package/dist/pipeline/connect.js.map +0 -1
  107. package/dist/pipeline/create.js.map +0 -1
  108. package/dist/pipeline/errors.js.map +0 -1
  109. package/dist/pipeline/failStep.js +43 -0
  110. package/dist/pipeline/failStep.js.map +6 -0
  111. package/dist/pipeline/generated-reference.json +25 -13
  112. package/dist/pipeline/guide.js.map +0 -1
  113. package/dist/pipeline/init.js.map +0 -1
  114. package/dist/pipeline/operations.js.map +0 -1
  115. package/dist/pipeline/query.js.map +0 -1
  116. package/dist/pipeline/queryDownloads.js.map +0 -1
  117. package/dist/pipeline/queryWorker.js +3 -1
  118. package/dist/pipeline/queryWorker.js.map +1 -2
  119. package/dist/pipeline/readiness.js.map +0 -1
  120. package/dist/pipeline/reference.js.map +0 -1
  121. package/dist/pipeline/requests.js +3 -32
  122. package/dist/pipeline/requests.js.map +1 -2
  123. package/dist/pipeline/runArguments.js.map +0 -1
  124. package/dist/pipeline/runtime.js.map +0 -1
  125. package/dist/pipeline/service.js +46 -2
  126. package/dist/pipeline/service.js.map +1 -2
  127. package/dist/services/appSyncService.js +59 -9
  128. package/dist/services/appSyncService.js.map +1 -2
  129. package/dist/services/apps.js +10 -0
  130. package/dist/services/apps.js.map +1 -2
  131. package/dist/services/authErrors.js.map +0 -1
  132. package/dist/services/codefirst/api.js +38 -5
  133. package/dist/services/codefirst/api.js.map +1 -2
  134. package/dist/services/codefirst/binaryDisk.js.map +0 -1
  135. package/dist/services/codefirst/byteHashes.js +5 -0
  136. package/dist/services/codefirst/byteHashes.js.map +1 -2
  137. package/dist/services/codefirst/documents.js +41 -15
  138. package/dist/services/codefirst/documents.js.map +1 -2
  139. package/dist/services/codefirst/layoutBinaryProjection.js +24 -13
  140. package/dist/services/codefirst/layoutBinaryProjection.js.map +1 -2
  141. package/dist/services/codefirst/layoutCompose.js +44 -38
  142. package/dist/services/codefirst/layoutCompose.js.map +1 -2
  143. package/dist/services/codefirst/layoutCore.js +14 -1
  144. package/dist/services/codefirst/layoutCore.js.map +1 -2
  145. package/dist/services/codefirst/layoutPaths.js +80 -4
  146. package/dist/services/codefirst/layoutPaths.js.map +1 -2
  147. package/dist/services/codefirst/layoutProjection.js +73 -39
  148. package/dist/services/codefirst/layoutProjection.js.map +1 -2
  149. package/dist/services/codefirst/layoutReadback.js +357 -130
  150. package/dist/services/codefirst/layoutReadback.js.map +2 -3
  151. package/dist/services/codefirst/layoutReadbackPlacement.js +94 -57
  152. package/dist/services/codefirst/layoutReadbackPlacement.js.map +2 -3
  153. package/dist/services/codefirst/layoutReceipt.js +283 -243
  154. package/dist/services/codefirst/layoutReceipt.js.map +2 -3
  155. package/dist/services/codefirst/layoutScan.js +208 -110
  156. package/dist/services/codefirst/layoutScan.js.map +1 -2
  157. package/dist/services/codefirst/output.js +76 -10
  158. package/dist/services/codefirst/output.js.map +1 -2
  159. package/dist/services/codefirst/types.js.map +0 -1
  160. package/dist/services/codefirst/workflow.js +65 -29
  161. package/dist/services/codefirst/workflow.js.map +2 -3
  162. package/dist/services/codefirst/workspace.js.map +0 -1
  163. package/dist/services/codefirst/workspaceLock.js.map +0 -1
  164. package/dist/services/codefirst/workspaceRoot.js +2 -1
  165. package/dist/services/codefirst/workspaceRoot.js.map +1 -2
  166. package/dist/services/configService.js.map +0 -1
  167. package/dist/services/credentials.js.map +0 -1
  168. package/dist/services/farseerService.js +31 -7
  169. package/dist/services/farseerService.js.map +1 -2
  170. package/dist/services/httpError.js.map +0 -1
  171. package/dist/services/modelExport.js.map +0 -1
  172. package/dist/services/organisation.js.map +0 -1
  173. package/dist/services/preflight.js.map +0 -1
  174. package/dist/services/realms.js.map +0 -1
  175. package/dist/services/syncService.js +3 -3
  176. package/dist/services/syncService.js.map +1 -2
  177. package/dist/skills/bundled.js +106 -0
  178. package/dist/skills/bundled.js.map +6 -0
  179. package/dist/skills/install.js +257 -0
  180. package/dist/skills/install.js.map +6 -0
  181. package/dist/skills/pipeline.js +10 -18
  182. package/dist/skills/pipeline.js.map +1 -2
  183. package/dist/utils/agentSandbox.js +1 -1
  184. package/dist/utils/agentSandbox.js.map +0 -1
  185. package/dist/utils/cliOptions.js.map +0 -1
  186. package/dist/utils/constants.js.map +0 -1
  187. package/dist/utils/entityResolver.js +72 -25
  188. package/dist/utils/entityResolver.js.map +1 -2
  189. package/dist/utils/errorFormatter.js +72 -11
  190. package/dist/utils/errorFormatter.js.map +1 -2
  191. package/dist/utils/fileLogger.js.map +0 -1
  192. package/dist/utils/fileValidation.js.map +0 -1
  193. package/dist/utils/folderMatch.js.map +0 -1
  194. package/dist/utils/formulaFilters.js +11 -2
  195. package/dist/utils/formulaFilters.js.map +1 -2
  196. package/dist/utils/helpers.js.map +0 -1
  197. package/dist/utils/logger.js.map +0 -1
  198. package/dist/utils/nameResolver.js.map +0 -1
  199. package/dist/utils/operationCli.js +102 -0
  200. package/dist/utils/operationCli.js.map +6 -0
  201. package/dist/utils/packageManager.js.map +0 -1
  202. package/dist/utils/syncReporting.js.map +0 -1
  203. package/dist/utils/syncScope.js.map +0 -1
  204. package/dist/utils/updateCheck.js.map +0 -1
  205. package/dist/utils/variableValues.js.map +0 -1
  206. package/dist/utils/workspace.js.map +0 -1
  207. package/docs/cli-guide.md +182 -2
  208. package/docs/import-workflows.md +14 -14
  209. package/docs/new-app-template.md +1 -1
  210. package/docs/pipeline-client-guide.md +1 -1
  211. package/docs/pipeline-reference.md +304 -9
  212. package/docs/troubleshooting.md +18 -0
  213. package/package.json +2 -2
  214. package/skills/farseer-analysis/SKILL.md +132 -0
  215. package/skills/farseer-app-dev/SKILL.md +131 -0
  216. package/skills/farseer-app-dev/assignments.md +185 -0
  217. package/skills/farseer-app-dev/farseer-client-api-guide.md +907 -0
  218. package/skills/farseer-app-dev/farseer-client-release-notes.md +212 -0
  219. package/skills/farseer-app-dev/working-patterns.md +876 -0
  220. package/skills/farseer-authenticate-to-tenant/SKILL.md +60 -0
  221. package/skills/farseer-authenticate-to-tenant/app-authentication.md +91 -0
  222. package/skills/farseer-author-import-job/SKILL.md +114 -0
  223. package/skills/farseer-author-import-job/cell-writes.md +530 -0
  224. package/skills/farseer-author-import-job/deploying-a-farseer-app.md +383 -0
  225. package/skills/farseer-author-import-job/import-job-pattern.md +232 -0
  226. package/skills/farseer-build-model/SKILL.md +122 -0
  227. package/skills/farseer-build-model/formula-grain-alignment.md +612 -0
  228. package/skills/farseer-build-model/naming-conventions.md +435 -0
  229. package/skills/farseer-build-model/sparse-formulas-pattern.md +330 -0
  230. package/skills/farseer-build-pipeline/SKILL.md +190 -0
  231. package/skills/farseer-build-pipeline/erp-sales/README.md +108 -0
  232. package/skills/farseer-build-pipeline/erp-sales/erp-sales-etl/Models/bronze/erp_sales_invoice_lines.yaml +23 -0
  233. package/skills/farseer-build-pipeline/erp-sales/erp-sales-etl/Models/bronze/erp_sales_invoice_lines_raw.yaml +23 -0
  234. package/skills/farseer-build-pipeline/erp-sales/erp-sales-etl/Models/bronze/erp_sales_item_product_map.yaml +17 -0
  235. package/skills/farseer-build-pipeline/erp-sales/erp-sales-etl/Models/bronze/erp_sales_item_product_map_raw.yaml +11 -0
  236. package/skills/farseer-build-pipeline/erp-sales/erp-sales-etl/Models/gold/erp_sales_cells.yaml +40 -0
  237. package/skills/farseer-build-pipeline/erp-sales/erp-sales-etl/Models/silver/erp_sales_lines.yaml +35 -0
  238. package/skills/farseer-build-pipeline/erp-sales/erp-sales-etl/Models/silver/erp_sales_recon.yaml +43 -0
  239. package/skills/farseer-build-pipeline/erp-sales/erp-sales-etl/Models/silver/erp_sales_unmapped_items.yaml +28 -0
  240. package/skills/farseer-build-pipeline/erp-sales/erp-sales-etl/main.py +49 -0
  241. package/skills/farseer-build-pipeline/erp-sales/erp-sales-load/Models/in/erp_sales_cells.yaml +17 -0
  242. package/skills/farseer-build-pipeline/erp-sales/erp-sales-load/Models/in/erp_sales_cells_raw.yaml +14 -0
  243. package/skills/farseer-build-pipeline/erp-sales/erp-sales-load/Models/load/erp_sales_to_model.yaml +47 -0
  244. package/skills/farseer-build-pipeline/erp-sales/erp-sales-load/main.py +44 -0
  245. package/skills/farseer-build-pipeline/erp-sales/item_to_product.csv +5 -0
  246. package/skills/farseer-build-pipeline/pipeline-app-failure-report-pattern.md +103 -0
  247. package/skills/farseer-build-pipeline/pipeline-source-encoding.md +68 -0
  248. package/skills/farseer-dashboards/SKILL.md +40 -0
  249. package/skills/farseer-formulas/SKILL.md +165 -0
  250. package/skills/farseer-help-center/SKILL.md +66 -0
  251. package/skills/farseer-model/SKILL.md +119 -0
  252. package/skills/farseer-modify-model/SKILL.md +158 -0
  253. package/skills/farseer-modify-model/model-validation-pattern.md +251 -0
  254. package/skills/farseer-optimize-model/SKILL.md +314 -0
  255. package/skills/farseer-optimize-model/stats-dump.ts +139 -0
  256. package/skills/farseer-pnl/SKILL.md +220 -0
  257. package/skills/farseer-review-model/SKILL.md +172 -0
  258. package/skills/farseer-run-apps/SKILL.md +102 -0
  259. package/skills/pipeline-authoring/SKILL.md +7 -5
  260. package/skills/pipeline-authoring/practices.md +21 -8
  261. package/dist/services/agentApprovalFetch.js +0 -86
  262. package/dist/services/agentApprovalFetch.js.map +0 -7
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "formatVersion": 1,
3
- "engineVersion": "3.0.0",
4
- "engineProfile": "3.0",
5
- "runnerImage": "runner-python-simple-pipelines:1.14.0",
3
+ "engineVersion": "3.3.0",
4
+ "engineProfile": "3.3",
5
+ "runnerImage": "runner-python-simple-pipelines:1.18.0",
6
6
  "sourceHashes": {
7
- "data-platform/packages/simple-pipelines/src/farseer_simple_pipelines/schema.py": "f2b6408e74e1312bd7cc105df7055a08a1cf5fc8fadcf3b8e8897ac704758706",
8
- "data-platform/packages/simple-pipelines/pyproject.toml": "13e888969318f6fbac59d31f65d3295e075f004bbde6991fa0b24af1093fa608",
7
+ "data-platform/packages/simple-pipelines/src/farseer_simple_pipelines/schema.py": "f1fe05738e0d4f0ea1388937786cbb7afecf062975e5fb32160d40ddc7ab63c7",
8
+ "data-platform/packages/simple-pipelines/pyproject.toml": "1f085aebe2b3c5a58836baa893cf59fea659620784d2084b36f53c974c2ab251",
9
9
  "tools/pipeline/generate_docs.py": "3a3639b1421f06ed816a35def8861fc42104324eff3c38892ae8367bf877e4cc",
10
- "runner-images/VERSION": "bb0df1bd902faba507c15975eb9973e695f2732f760d851b4f9c7ba17068f5ff",
11
- "runner-images/python-simple-pipelines/pyproject.toml": "3b99503f425c7f0941a432d813b16c5bb5a0f9260ed2c0f7c00d697b7d950c45",
10
+ "runner-images/VERSION": "04d659518a1793d5396007fcabdc9211a8c1db8406bf4e0fa8069171fdb06518",
11
+ "runner-images/python-simple-pipelines/pyproject.toml": "f25fcfd6fd0770fb17d155846055ad9d3abcdd120bd8cf4113f328763e44af0f",
12
12
  "tools/pipeline/examples/FarseerFilesExtractConfig.yaml": "20950da2f5413833dcaa1e700f13dd0597530c5a17d75ed96e35d6e3ca87eaa4",
13
13
  "tools/pipeline/examples/LoadCellsConfig.yaml": "2b56bd84e35765b616916c21c98fd306e2b93127358979777a77083991ac8bf1",
14
14
  "tools/pipeline/examples/ParseConfig.yaml": "c5b2deada46ba2edbe29410a37d4b3fd53ffd231d506417a5990cdd3c2d7f8ac",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "notice": "Generated from Pydantic's validation schema using YAML aliases. This describes rendered dataset definitions, not discovery/template directives. Descriptions come from the models; Python validators may impose additional cross-field rules. Read the method guide for the supported pipeline subset. Optional fields without a literal default may use a default factory. Runtime-derived fields are listed separately and must not be authored in YAML.",
18
18
  "topics": {
19
- "DatasetDefinition": "## DatasetDefinition\n\nValidated representation of a single dataset YAML file.\n\n- Set exactly the configuration block matching type: extract, parse, transform, load or export.\n- For load/export, deps must match the explicitly referenced source_dataset names in both directions. Use qualified names verbatim.\n- Authored pipelines are validated before any source is read: sql_file and farseer_credentials are refused; read the method guide before using this full engine reference.\n- Steps run in dependency order, and steps at the same depth run in name order, so a quality check or reconciliation runs before a load only if the load's source dataset depends on it.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `schema_version` | integer | no | `1` | minimum=`1` |\n| `name` | string | yes | none | |\n| `type` | [StepType](#steptype) | yes | none | |\n| `deps` | array of string | no | none | |\n| `description` | string | no | `\"\"` | |\n| `extract` | [ExtractConfig](#extractconfig) or null | no | `null` | |\n| `parse` | [ParseConfig](#parseconfig) or null | no | `null` | |\n| `transform` | [TransformConfig](#transformconfig) or null | no | `null` | |\n| `load` | [LoadConfig](#loadconfig) or null | no | `null` | |\n| `export` | [ExportConfig](#exportconfig) or null | no | `null` | |\n| `schema` | [DataSchema](#dataschema) or null | no | `null` | |\n| `quality_rules` | array of [QualityRuleEntry](#qualityruleentry) | no | none | |\n| `write_mode` | [WriteMode](#writemode) | no | `\"overwrite\"` | |\n| `merge_keys` | array of string | no | none | |\n\nRuntime-derived; do not set in YAML: `qualified_name`, `namespace`, `source_path`, `render_context`.\n",
19
+ "DatasetDefinition": "## DatasetDefinition\n\nValidated representation of a single dataset YAML file.\n\n- Set exactly the configuration block matching type: extract, parse, transform, load or export.\n- For load/export, deps must match the explicitly referenced source_dataset names in both directions. Use qualified names verbatim.\n- Authored pipelines are validated before any source is read: sql_file and farseer_credentials are refused; read the method guide before using this full engine reference.\n- Steps run in dependency order, and steps at the same depth run in name order, so a quality check or reconciliation runs before a load only if the load's source dataset depends on it.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `schema_version` | integer | no | `1` | minimum=`1` |\n| `name` | string | yes | none | |\n| `type` | [StepType](#steptype) | yes | none | |\n| `deps` | array of string | no | none | |\n| `description` | string | no | `\"\"` | For the client, who reads it in the step's panel on the Pipeline tab: what the step does, and any rule needed to judge its result. Plain words, at most about 300 characters, no build details. |\n| `extract` | [ExtractConfig](#extractconfig) or null | no | `null` | |\n| `parse` | [ParseConfig](#parseconfig) or null | no | `null` | |\n| `transform` | [TransformConfig](#transformconfig) or null | no | `null` | |\n| `load` | [LoadConfig](#loadconfig) or null | no | `null` | |\n| `export` | [ExportConfig](#exportconfig) or null | no | `null` | |\n| `schema` | [DataSchema](#dataschema) or null | no | `null` | |\n| `quality_rules` | array of [QualityRuleEntry](#qualityruleentry) | no | none | |\n| `write_mode` | [WriteMode](#writemode) | no | `\"overwrite\"` | |\n| `merge_keys` | array of string | no | none | |\n| `sort_by` | array of string | no | none | |\n| `max_file_size` | string or integer or null | no | `null` | |\n\nRuntime-derived; do not set in YAML: `qualified_name`, `namespace`, `source_path`, `render_context`.\n",
20
20
  "BusinessCentralExtractConfig": "## BusinessCentralExtractConfig\n\nExtraction settings for Microsoft Dynamics 365 Business Central.\n\nReads through the OData V4 API, authenticating with the OAuth2\nclient-credentials flow against Azure AD. Requires an Azure AD app\nregistration consented in the BC tenant (typical permission:\n`Dynamics 365 Business Central / app_access`). Credentials (`tenant_id`,\n`client_id`, `client_secret`) are supplied as YAML fields — typically\ntemplated via `{{ pipeline_args.NAME }}` so a Remote Job's secret\n`expectedArguments` flow through at discovery time.\n\nA BC URL is composed as:\n\n {api_base}/{bc_tenant_id}/{environment}/api/{publisher}/{api_group}/{api_version}/companies({company_guid})/{entity}\n\nThe four URL-path fields (`publisher`, `api_group`, `entity`,\n`api_version`) are kept separate so that authors can't accidentally\nglue them into a malformed path; the same structure also lets the\nextractor log one stable summary regardless of which entity is fetched.\n\n`bc_tenant_id` is the *BC* tenant GUID (the one that appears in the\nAPI URL) and may differ from `tenant_id` (the Azure AD tenant GUID\nused for the token endpoint), although in practice they are usually\nthe same.\n\n`filter` is an OData `$filter` expression (e.g.\n`\"postingDateYear eq 2025\"`) — server-side filtering, so it scales\nindependent of pagination. `select` projects a subset of fields\nserver-side; useful when the response payload is dominated by\ncolumns the pipeline does not need.\n\nPagination follows `@odata.nextLink` until exhausted. `page_size`\nis forwarded to BC as `?$top=` — leave unset to accept BC's default\n(20,000 rows per page); set it to a smaller value when running\nagainst a slow connection or to force a multi-page test on a small\nentity.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `bc_tenant_id` | string | yes | none | |\n| `environment` | string | yes | none | |\n| `publisher` | string | yes | none | |\n| `api_group` | string | yes | none | |\n| `company_guid` | string | yes | none | |\n| `entity` | string | yes | none | |\n| `api_version` | string | no | `\"v1.0\"` | |\n| `filter` | string or null | no | `null` | |\n| `select` | string or null | no | `null` | |\n| `page_size` | integer or null | no | `null` | integer: exclusiveMinimum=`0` |\n| `tenant_id` | string or null | no | `null` | |\n| `client_id` | string or null | no | `null` | |\n| `client_secret` | string or null | no | `null` | |\n",
21
21
  "CellsOptions": "## CellsOptions\n\nPer-entry options for cell value import.\n\nRows that land on the same coordinates in one import are summed, so the\nsource should already hold one row per cell.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `overwrite_cells` | boolean | yes | none | true replaces the existing value of every coordinate in this import; cells for coordinates not in the import keep their values. false refuses the whole import if any target cell already holds a value, so a rerun fails. |\n| `import_zeros` | boolean | no | `true` | false drops rows whose value is 0, so a value that fell to zero keeps its old number. |\n| `create_missing_members` | boolean | no | `false` | When true, members that appear in mapped source columns but not in the model are created during the import. Fixed dimension members are not created: each must already exist, or be written by a dimension load earlier in the same run. |\n| `missing_member_policy` | `\"DISALLOW\"`, `\"USE_DEFAULT\"`, `\"SKIP_ROW\"` | no | `\"DISALLOW\"` | What happens to a source value a dimension does not have: DISALLOW fails the whole import, USE_DEFAULT books the row to the table's default member, SKIP_ROW drops the row without counting it. |\n| `labels` | array of string | no | none | Stored on the import job; the engine adds pipeline:<load qualified name>. undo_previous finds earlier imports by all of them, so name exactly the slice one run owns. |\n| `undo_previous` | boolean | no | `false` | After this import commits, undo every earlier import carrying all the same labels. Undo deletes that import's cells and never restores the values they replaced; a failed undo is only a warning. |\n| `review_gate` | [ReviewGateConfig](#reviewgateconfig) or null | no | `null` | |\n| `allow_empty` | boolean | no | `false` | true turns a source with zero rows into a no-op instead of an error. Mapped columns must still be present, and nothing is undone. |\n",
22
22
  "ColumnSchema": "## ColumnSchema\n\nSchema definition for a single column.\n\n`quality_rules:` carries the column's single-column quality rules —\neach one applies to *this* column with no further reference needed.\nRelational rules (which span multiple columns) sit in the top-level\n`quality_rules:` block on the dataset, not here.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `name` | string | yes | none | |\n| `type` | `\"str\"`, `\"int\"`, `\"float\"`, `\"datetime\"`, `\"bool\"`, `\"list[str]\"` or null | no | `null` | |\n| `not_null` | boolean | no | `false` | |\n| `quality_rules` | array of [QualityRuleEntry](#qualityruleentry) | no | none | |\n",
@@ -24,8 +24,10 @@
24
24
  "Connection": "## Connection\n\nMaps a source column to a target dimension table (foreign key).\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `source_column` | string | yes | none | |\n| `target_dimension_table` | string | yes | none | |\n",
25
25
  "CsvParseOptions": "## CsvParseOptions\n\nHow to read a csv payload.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `encoding` | string | no | `\"utf-8\"` | |\n| `separator` | string or null | no | `null` | |\n| `decimal` | string or null | no | `null` | |\n| `has_header` | boolean | no | `true` | |\n| `columns` | string or null | no | `null` | |\n",
26
26
  "CsvWriteOptions": "## CsvWriteOptions\n\nOptions for DataFrame → CSV serialization on export.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `separator` | string | no | `\",\"` | |\n| `decimal` | string | no | `\".\"` | |\n| `encoding` | string | no | `\"utf-8\"` | |\n| `include_header` | boolean | no | `true` | |\n| `lineterminator` | string | no | `\"\\n\"` | minLength=`1` |\n",
27
+ "CustomExtractConfig": "## CustomExtractConfig\n\n`extract.type: custom` -- an extract an author writes, as an `@extractor` function in `Code/`.\n\nFor a source no built-in type reaches: an odd authentication, a SOAP\nservice, a flow of several calls. `script` is a file under `Code/`, in the\nfolder mirroring the step's own under `Models/`, and `function` names the\nfunction in it, the dataset's own name when omitted -- the binding\n`transform` and `parse` scripts follow.\n\n extract:\n type: custom\n custom:\n script: invoices.py\n args: {base_url: \"https://api.example.com/v1\"}\n secrets: {token: \"{{ pipeline_args.SHOP_TOKEN }}\"}\n\nThe function takes keyword-only `args` (a dict), `secrets` (a mapping\nthat prints itself masked), `http` (a client with retries and the\nnetwork guard of the `http` extract, sending `headers` with every\nrequest) and `logger`, each optional. Every value under `secrets` is\nmasked in the run's output, what the function prints included; a\ncredential put under `args` or `headers` is not.\n\nWhat the function returns is what lands: a file it wrote into the\ndirectory it was handed (the file's extension is the payload's format),\nrecords (a list or generator of dicts, landed as one JSON object per line),\nor a table (a DataFrame or Arrow table, landed as parquet). The parse step\nreading this extract interprets it, as for any other source, and\n`optional: true` skips only when the function raises\n`ExtractionSourceMissing`.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `script` | string | yes | none | |\n| `function` | string or null | no | `null` | |\n| `args` | object | no | none | |\n| `secrets` | map of string | no | none | |\n| `headers` | map of string | no | none | Headers the `http` client sends with every request, to any host, such as a `User-Agent` a source's firewall expects. Not credentials: those go under `secrets:`. |\n| `timeout` | number | no | `120.0` | maximum=`3600`; exclusiveMinimum=`0`; Seconds per request the `http` client handed to the function makes. |\n| `private_network` | boolean | no | `false` | |\n",
27
28
  "CustomField": "## CustomField\n\nMaps a DataFrame column to a CUSTOM column meta.\n\nEach imported cell receives the column's value in a per-cell JSON blob,\nkeyed by the column's header name (= `source_column`). Typical uses:\nsource-system IDs, processing notes, confidence scores.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `source_column` | string | yes | none | |\n",
28
- "DataSchema": "## DataSchema\n\nTop-level `schema:` block in a dataset YAML.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `columns` | array of [ColumnSchema](#columnschema) | yes | none | minItems=`1` |\n",
29
+ "DataFormat": "## DataFormat\n\nThe extension a stored file may carry, which is all a store needs.\n\nNot \"a format the framework can interpret\" -- every step writes parquet, and\n`parse:` decides how a payload is read. This is the narrower question of\nwhat a file at rest may be *called*, which the Farseer Files store answers\nby writing `<leaf>.<value>` and probing these in order to find it again.\n\nThe set mirrors the backend's upload allow-list exactly, so any file that\nstore accepts can be landed. A subset would be a second, narrower policy\nfor someone to keep in sync, and it would fail the first time a source\nhands back a type nobody trimmed for.\n\nA folder there can hold more than one file under a dataset's name -- the\nworkbook an extract reads sits beside the parquet it writes, and a\n`sales.csv` written before parquet became the only output stays until\nsomeone removes it -- because the store writes its own file and touches no\nother. A name the store wrote in this run is read under the extension it\nwas written with; the probe, which takes the first extension present, is\nfor files from earlier runs, so `PARQUET` is first: a step's own output is\nthe one found.\n\nValues: `\"parquet\"`, `\"csv\"`, `\"json\"`, `\"xlsx\"`, `\"xls\"`, `\"xml\"`, `\"zip\"`, `\"txt\"`, `\"html\"`, `\"pdf\"`, `\"docx\"`, `\"md\"`, `\"yaml\"`, `\"yml\"`, `\"css\"`, `\"scss\"`, `\"js\"`, `\"jsx\"`, `\"ts\"`, `\"tsx\"`, `\"py\"`, `\"jpg\"`, `\"jpeg\"`, `\"png\"`, `\"svg\"`, `\"gif\"`, `\"webp\"`\n",
30
+ "DataSchema": "## DataSchema\n\nTop-level `schema:` block in a dataset YAML: the columns the dataset keeps.\n\nA parse step or transform with a `schema:` writes exactly these columns, in\nthis order. A column its output has and this does not declare is dropped and\nnamed in a warning, so declare every column a reader needs; a declared column\nthe output lacks fails validation. Without a `schema:` every column is kept.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `columns` | array of [ColumnSchema](#columnschema) | yes | none | minItems=`1` |\n",
29
31
  "DateColumn": "## DateColumn\n\nMaps a DataFrame column to a DATE attribute column on a RAMA dim table.\n\nValues are converted to Excel serial numbers at load time via\n`farseer_client.date_utils.to_excel_serial`.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `source_column` | string | yes | none | |\n| `target_dimension_table_column` | string | yes | none | |\n",
30
32
  "DimensionTableEntryOptions": "## DimensionTableEntryOptions\n\nPer-entry options for one dimension-table sync (this table only).\n\nDistinct from `DimensionTableOptions`, which carries options for the\nwhole `model.load` call (all tables at once); these govern a single\ntable's source frame.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `allow_empty` | boolean | no | `false` | |\n",
31
33
  "DimensionTableOptions": "## DimensionTableOptions\n\nShared options for dimension table sync (applies to all tables in one API call).\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `delete_missing` | boolean | no | `false` | |\n",
@@ -33,8 +35,8 @@
33
35
  "ExportConfig": "## ExportConfig\n\nConfiguration for a `type: export` dataset step.\n\n`target` selects the destination system. The target-specific\nconfig block must match (e.g. `target: sharepoint` requires a\n`sharepoint:` section). Export steps are terminal sinks — no\ndownstream dataset depends on their output.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `target` | [ExportTarget](#exporttarget) | yes | none | |\n| `sharepoint` | [SharePointExportConfig](#sharepointexportconfig) or null | no | `null` | |\n| `farseer_files` | [FarseerFilesExportConfig](#farseerfilesexportconfig) or null | no | `null` | |\n| `allow_empty` | boolean | no | `false` | |\n",
34
36
  "ExportFormat": "## ExportFormat\n\nValues: `\"csv\"`, `\"xlsx\"`, `\"parquet\"`\n",
35
37
  "ExportTarget": "## ExportTarget\n\nValues: `\"sharepoint\"`, `\"farseer_files\"`\n",
36
- "ExtractConfig": "## ExtractConfig\n\nConfiguration for a `type: extract` dataset step.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `type` | [ExtractType](#extracttype) | yes | none | |\n| `google_drive_public` | [GoogleDrivePublicExtractConfig](#googledrivepublicextractconfig) or null | no | `null` | |\n| `google_drive` | [GoogleDriveExtractConfig](#googledriveextractconfig) or null | no | `null` | |\n| `sharepoint` | [SharePointExtractConfig](#sharepointextractconfig) or null | no | `null` | |\n| `sql_database` | [SqlDatabaseExtractConfig](#sqldatabaseextractconfig) or null | no | `null` | |\n| `farseer` | [FarseerExtractConfig](#farseerextractconfig) or null | no | `null` | |\n| `business_central` | [BusinessCentralExtractConfig](#businesscentralextractconfig) or null | no | `null` | |\n| `tldv` | [TldvExtractConfig](#tldvextractconfig) or null | no | `null` | |\n| `intercom` | [IntercomExtractConfig](#intercomextractconfig) or null | no | `null` | |\n| `notion` | [NotionExtractConfig](#notionextractconfig) or null | no | `null` | |\n| `hubspot` | [HubspotExtractConfig](#hubspotextractconfig) or null | no | `null` | |\n| `sap_odata` | [SapOdataExtractConfig](#sapodataextractconfig) or null | no | `null` | |\n| `s3` | [S3ExtractConfig](#s3extractconfig) or null | no | `null` | |\n| `optional` | boolean | no | `false` | When true, a source that does not exist (404, no such table, no such file) skips this extract instead of failing the run. The skip propagates to the parse step reading it and every step that depends on that, loads and exports included, and the run still finishes successfully. Network errors, authentication failures, timeouts and 5xx responses still fail the run. |\n",
37
- "ExtractType": "## ExtractType\n\nValues: `\"google_drive_public\"`, `\"google_drive\"`, `\"sharepoint\"`, `\"sql_database\"`, `\"farseer\"`, `\"business_central\"`, `\"tldv\"`, `\"intercom\"`, `\"notion\"`, `\"hubspot\"`, `\"sap_odata\"`, `\"s3\"`\n",
38
+ "ExtractConfig": "## ExtractConfig\n\nConfiguration for a `type: extract` dataset step.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `type` | [ExtractType](#extracttype) | yes | none | |\n| `google_drive_public` | [GoogleDrivePublicExtractConfig](#googledrivepublicextractconfig) or null | no | `null` | |\n| `google_drive` | [GoogleDriveExtractConfig](#googledriveextractconfig) or null | no | `null` | |\n| `sharepoint` | [SharePointExtractConfig](#sharepointextractconfig) or null | no | `null` | |\n| `sql_database` | [SqlDatabaseExtractConfig](#sqldatabaseextractconfig) or null | no | `null` | |\n| `farseer` | [FarseerExtractConfig](#farseerextractconfig) or null | no | `null` | |\n| `business_central` | [BusinessCentralExtractConfig](#businesscentralextractconfig) or null | no | `null` | |\n| `tldv` | [TldvExtractConfig](#tldvextractconfig) or null | no | `null` | |\n| `intercom` | [IntercomExtractConfig](#intercomextractconfig) or null | no | `null` | |\n| `notion` | [NotionExtractConfig](#notionextractconfig) or null | no | `null` | |\n| `hubspot` | [HubspotExtractConfig](#hubspotextractconfig) or null | no | `null` | |\n| `sap_odata` | [SapOdataExtractConfig](#sapodataextractconfig) or null | no | `null` | |\n| `s3` | [S3ExtractConfig](#s3extractconfig) or null | no | `null` | |\n| `http` | [HttpExtractConfig](#httpextractconfig) or null | no | `null` | |\n| `custom` | [CustomExtractConfig](#customextractconfig) or null | no | `null` | |\n| `optional` | boolean | no | `false` | When true, a source that does not exist (404, no such table, no such file) skips this extract instead of failing the run. The skip propagates to the parse step reading it and every step that depends on that, loads and exports included, and the run still finishes successfully. Network errors, authentication failures, timeouts and 5xx responses still fail the run. |\n",
39
+ "ExtractType": "## ExtractType\n\nValues: `\"google_drive_public\"`, `\"google_drive\"`, `\"sharepoint\"`, `\"sql_database\"`, `\"farseer\"`, `\"business_central\"`, `\"tldv\"`, `\"intercom\"`, `\"notion\"`, `\"hubspot\"`, `\"sap_odata\"`, `\"s3\"`, `\"http\"`, `\"custom\"`\n",
38
40
  "FarseerDatasetsExtractConfig": "## FarseerDatasetsExtractConfig\n\n`extract.farseer.source: datasets` — read a versioned dataset.\n\nReads from the Labs Datasets API: the symmetric counterpart to\n`DatasetDataStore` writes — same control-plane API, same GCS data-plane,\njust the read half.\n\n`qualified_name` is the dataset's registered name (the writer's\nqualified name maps 1:1 to the API `name` field). `version_id`\npins the read to a specific completed version for reproducibility;\nwhen omitted the extractor reads the dataset's currently promoted\nversion. An unpromoted dataset (created but never promoted) is\ntreated as a missing source so `optional: true` can absorb it.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `qualified_name` | string | yes | none | |\n| `version_id` | string or null | no | `null` | |\n",
39
41
  "FarseerDimensionsConnection": "## FarseerDimensionsConnection\n\nProjects a foreign-key column on a dim table to a DataFrame column.\n\nInverse of the load side's `dimension_tables.tables[].mapping.connections`.\nThe DataFrame cell receives a list of connected-member names\n(`/model/export` resolves FK ids to names server-side via\n`PK_MEMBER_EXTRACTOR`).\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `source_dimension_table` | string | yes | none | |\n| `target_column` | string | yes | none | |\n",
40
42
  "FarseerDimensionsDateColumn": "## FarseerDimensionsDateColumn\n\nProjects a DATE attribute column on a dim table to a DataFrame column.\n\nThe DataFrame value is the raw Excel serial number Rama stores — days\nsince 1899-12-30 with the 1900 leap-year bug preserved. See\n`clients/python/src/farseer_client/date_utils.py` for the formula\n(only the forward conversion `to_excel_serial` ships in the client\ntoday) if a downstream transform needs a Python date.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `source_dimension_table_column` | string | yes | none | |\n| `target_column` | string | yes | none | |\n",
@@ -56,6 +58,16 @@
56
58
  "FixedDimension": "## FixedDimension\n\nPin a dimension member for a variable column.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `dimension_table` | string | yes | none | |\n| `dimension_member` | string | yes | none | |\n",
57
59
  "GoogleDriveExtractConfig": "## GoogleDriveExtractConfig\n\nExtraction settings for private Google Drive files (service account).\n\nAuthenticates as a Google Cloud service account; the client shares the\nfolder (or Shared Drive) with the service account's e-mail as a Viewer,\nso no domain-wide delegation and no per-user OAuth is involved.\n\n`service_account_json` is the service account's full JSON key,\ntemplated via `{{ pipeline_args.NAME }}` so a Remote Job's secret\n`expectedArguments` flow through at discovery time. Its shape is\nvalidated at extract time, not here — a schema-load error would echo\nthe offending input back into logs (`hide_input_in_errors` guards\nthe pydantic side of that).\n\nTwo addressing modes, mutually exclusive:\n\n- `file_id` — opaque Drive file ID.\n- `folder_id` + `file_path` — anchor folder ID (the folder the\n client shared) plus a slash-separated path below it, resolved one\n segment at a time. Folder IDs are stable across renames, so the\n anchor survives the client tidying up folder names. The final\n segment may contain `*` wildcards (e.g. `REPORT2502AC.*` for a\n source whose extension flips between `.xlsx` and `.xls` across\n periods); exactly one file must match.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `service_account_json` | string or null | no | `null` | |\n| `file_id` | string or null | no | `null` | |\n| `folder_id` | string or null | no | `null` | |\n| `file_path` | string or null | no | `null` | |\n",
58
60
  "GoogleDrivePublicExtractConfig": "## GoogleDrivePublicExtractConfig\n\nExtraction settings for public Google Drive files.\n\nOnly works with files shared as \"Anyone with the link\" — no auth required.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `file_id` | string | yes | none | |\n",
61
+ "HttpBasicAuth": "## HttpBasicAuth\n\nHTTP Basic authentication with a username and a password.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `type` | `\"basic\"` | yes | none | |\n| `username` | string | yes | none | |\n| `password` | string | yes | none | From a secret run argument: `{{ pipeline_args.NAME }}`. |\n",
62
+ "HttpBearerAuth": "## HttpBearerAuth\n\n`Authorization: Bearer <token>` on every request to the configured origin.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `type` | `\"bearer\"` | yes | none | |\n| `token` | string | yes | none | The token, from a secret run argument: `{{ pipeline_args.NAME }}`. |\n",
63
+ "HttpCursorPagination": "## HttpCursorPagination\n\nSend the cursor from each page as a query parameter, until a page returns none.\n\nA page that hands back the cursor it was asked with fails the step rather\nthan looping.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `type` | `\"cursor\"` | yes | none | |\n| `cursor` | string | yes | none | JSON Pointer to the next cursor in the body, e.g. `/meta/next_cursor`. |\n| `param` | string | yes | none | The query parameter the cursor is sent in. |\n| `max_pages` | integer | no | `1000` | exclusiveMinimum=`0`; A ceiling on pages, so a crawl that never ends fails instead of running until the job's time limit. A source with more pages fails the step; it never truncates. The empty page that ends a page or offset crawl does not count. |\n",
64
+ "HttpExtractConfig": "## HttpExtractConfig\n\n`extract.type: http` -- one HTTP(S) source, configured rather than coded.\n\nA single request lands the response body as it came, under `format` (or\nthe extension its `Content-Type` names), for the parse step reading this\nextract to interpret: an ECB `csvdata` response is read by\n`parse: {format: csv}` with no code at all.\n\nWith `records`, or with `pagination`, the body is JSON and what lands is\nthe records: the array `records` points at, from every page, one JSON\nobject per line, as the source sent each one. A `format: json` parse step\nreads them when the fields it declares are flat; nested ones need an\n`@parse` function.\n\n extract:\n type: http\n http:\n url: https://api.example.com/v1/orders\n params: {status: open}\n auth: {type: bearer, token: \"{{ pipeline_args.SHOP_TOKEN }}\"}\n records: /data\n pagination: {type: cursor, cursor: /meta/next_cursor, param: cursor}\n\nCredentials go in `auth:` and nowhere else, templated from secret run\narguments. They are sent only to the origin of `url`, masked in every\nmessage, and dropped on a redirect to another origin.\n\n`not_found` and `empty` say whether a 404, or a response with no body (no\nrecords, in record mode), means the data is not there -- the signal\n`optional: true` skips on -- or that something is wrong. Both default to\nfailing: the ECB answers 404 for a misspelled series key, which must not\nread as an absent month.\n\nDestinations other than public `https://` hosts are refused -- loopback,\nlink-local, private ranges and plain `http://` -- unless\n`private_network: true`, which is how a source behind the tenant's VPN is\nreached. That catches a wrong URL; it is not a sandbox.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `url` | string | yes | none | |\n| `method` | `\"GET\"`, `\"POST\"` | no | `\"GET\"` | |\n| `params` | map of string or integer or number or boolean | no | none | Query parameters, added to `url`'s own. |\n| `headers` | map of string | no | none | Headers that are not credentials; credentials go in `auth:`. |\n| `json` | any | no | `null` | A JSON request body, for `POST` only. |\n| `auth` | [HttpBearerAuth](#httpbearerauth) or [HttpBasicAuth](#httpbasicauth) or [HttpHeaderAuth](#httpheaderauth) or [HttpQueryAuth](#httpqueryauth) or [HttpOAuth2ClientCredentialsAuth](#httpoauth2clientcredentialsauth) or null | no | `null` | |\n| `format` | [DataFormat](#dataformat) or null | no | `null` | What the body is, which is the extension the payload is stored under. Omit it to take the one the `Content-Type` names. Record mode always lands `json`. |\n| `records` | string or null | no | `null` | JSON Pointer to the array of records in the body, e.g. `/data` or `/value`. Omit it for a body that is the array itself. |\n| `pagination` | [HttpNextUrlPagination](#httpnexturlpagination) or [HttpCursorPagination](#httpcursorpagination) or [HttpPagePagination](#httppagepagination) or [HttpOffsetPagination](#httpoffsetpagination) or null | no | `null` | |\n| `not_found` | `\"fail\"`, `\"missing\"` | no | `\"fail\"` | |\n| `empty` | `\"fail\"`, `\"missing\"` | no | `\"fail\"` | |\n| `timeout` | number | no | `120.0` | maximum=`3600`; exclusiveMinimum=`0`; Seconds per request. |\n| `private_network` | boolean | no | `false` | |\n",
65
+ "HttpHeaderAuth": "## HttpHeaderAuth\n\nOne or more headers carrying a key, such as `X-Api-Key`.\n\nEvery value here is treated as a secret: masked in messages and logs, and\nnever sent to another origin.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `type` | `\"header\"` | yes | none | |\n| `headers` | map of string | yes | none | |\n",
66
+ "HttpNextUrlPagination": "## HttpNextUrlPagination\n\nFollow each page's link to the next one, until a page has none.\n\n`next_url` points at the link in the body (`/@odata.nextLink`,\n`/links/next`). Without it the `Link` response header is read for\n`rel=\"next\"`. A relative link is resolved against the page it came from;\na link to another origin is refused, because the request carries the\nstep's credentials.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `type` | `\"next_url\"` | yes | none | |\n| `next_url` | string or null | no | `null` | JSON Pointer to the next page's URL in the body. Omit it to read the `Link` header. |\n| `max_pages` | integer | no | `1000` | exclusiveMinimum=`0`; A ceiling on pages, so a crawl that never ends fails instead of running until the job's time limit. A source with more pages fails the step; it never truncates. The empty page that ends a page or offset crawl does not count. |\n",
67
+ "HttpOAuth2ClientCredentialsAuth": "## HttpOAuth2ClientCredentialsAuth\n\nOAuth 2.0 client credentials: a token from `token_url`, then `Bearer` on every request.\n\nThe token is requested once per run and is not refreshed, so a crawl that\noutlives it fails with a 401 rather than continuing on a stale grant.\n`params` adds form fields some servers require, such as `audience` or\n`resource`.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `type` | `\"oauth2_client_credentials\"` | yes | none | |\n| `token_url` | string | yes | none | |\n| `client_id` | string | yes | none | |\n| `client_secret` | string | yes | none | From a secret run argument: `{{ pipeline_args.NAME }}`. |\n| `scope` | string or null | no | `null` | |\n| `params` | map of string | no | none | |\n",
68
+ "HttpOffsetPagination": "## HttpOffsetPagination\n\nMove an offset by the records each page returned, until a page returns none.\n\nIt asks for `limit` records a page but moves by what arrived, so a server\nthat caps its pages below `limit` is still read whole. It stops on an\nempty page for the reason page numbering does.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `type` | `\"offset\"` | yes | none | |\n| `param` | string | no | `\"offset\"` | |\n| `limit_param` | string | no | `\"limit\"` | |\n| `limit` | integer | yes | none | exclusiveMinimum=`0` |\n| `start` | integer | no | `0` | minimum=`0` |\n| `max_pages` | integer | no | `1000` | exclusiveMinimum=`0`; A ceiling on pages, so a crawl that never ends fails instead of running until the job's time limit. A source with more pages fails the step; it never truncates. The empty page that ends a page or offset crawl does not count. |\n",
69
+ "HttpPagePagination": "## HttpPagePagination\n\nNumber the pages in a query parameter, until a page returns no records.\n\nIt stops on the first empty page rather than the first short one: an API\nthat caps its page size below the one asked for returns short pages long\nbefore the end, and stopping there would drop the rest without a word.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `type` | `\"page\"` | yes | none | |\n| `param` | string | no | `\"page\"` | |\n| `start` | integer | no | `1` | |\n| `size_param` | string or null | no | `null` | |\n| `size` | integer or null | no | `null` | integer: exclusiveMinimum=`0` |\n| `max_pages` | integer | no | `1000` | exclusiveMinimum=`0`; A ceiling on pages, so a crawl that never ends fails instead of running until the job's time limit. A source with more pages fails the step; it never truncates. The empty page that ends a page or offset crawl does not count. |\n",
70
+ "HttpQueryAuth": "## HttpQueryAuth\n\nA key sent as a query parameter, such as `?api_key=...`.\n\nEvery value here is treated as a secret and masked wherever the URL is\nshown. Prefer a header where the API accepts one: a query string is more\nlikely to be logged on the server side.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `type` | `\"query\"` | yes | none | |\n| `params` | map of string | yes | none | |\n",
59
71
  "HubspotAssociationsExtractConfig": "## HubspotAssociationsExtractConfig\n\nOne row per (record of `object_type`, associated record) pair.\n\nThe link table between two HubSpot object types -- which company a deal\nbelongs to, which contacts a note was logged against. A record extract\ncarries no such information: HubSpot keeps associations beside the\nrecord, not on it, and reports them only when a crawl asks for the\n`to_object_types` by name. This grain does that ask over the same record\ncrawl `objects` uses, and explodes what comes back to one row per pair.\n\n`association_type` is HubSpot's own label for the link\n(`deal_to_company`, `note_to_contact`, ...). The same pair often arrives\ntwice, once as the typed link and once as its `_unlabeled` twin, which is\nHubSpot's representation of an unlabelled association rather than a\nduplicate; keep both or dedupe in a transform, as the model needs.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `object_type` | string | yes | none | |\n| `to_object_types` | array of string | yes | none | minItems=`1` |\n| `archived` | boolean | no | `false` | |\n| `page_size` | integer | no | `100` | maximum=`100`; exclusiveMinimum=`0` |\n",
60
72
  "HubspotExtractConfig": "## HubspotExtractConfig\n\n`extract.type: hubspot` — multi-source family over the HubSpot CRM API.\n\nAuthentication is a `pat-<region>-...` bearer token — either an\n**account service key** (the current developer platform's credential\nfor single-account API access) or a **legacy private app token**. Both\nare account-level, carry the same object-specific scopes, and go over\nthe wire identically, so `access_token` is validated only for presence\nand not for shape: a token format check here would reject a\nHubSpot-issued credential the moment they add a fourth variant. The\ntoken is supplied as a YAML field, typically templated via\n`{{ pipeline_args.HUBSPOT_ACCESS_TOKEN }}` so a Remote Job's secret\n`expectedArguments` flow through at discovery time.\n\n`source:` picks the grain; the matching inner block carries its\nconfig. One token covers every source, so it lives out here.\n\nEvery source stores a parquet payload, which a parse step reads with\n`format: parquet` — same as `business_central` and `sql_database`. A\n`schema:` goes on that parse step, where it checks the result rather than\ninstructing the read.\n\nHubSpot serializes every record property as a JSON *string*, including\nnumbers, booleans and dates. The extractor reads the object's property\ncatalog and coerces each column to the type HubSpot declares for it,\nbecause leaving it alone would make `amount` a text column that sums\nby concatenation, and `\"false\"` a truthy value. Record ids stay\nstrings deliberately: they exceed 2^53 in some portals, so any numeric\ndtype would corrupt them.\n\nTimestamps land as timezone-naive UTC. HubSpot documents every time as\nUTC and date-only properties as midnight UTC; dropping the marker\nrather than converting keeps the values as HubSpot stated them and\nmatches the physical type the platform's `type: datetime` declares.\nLocalizing them to a negative-offset zone downstream would move a\nclose date — and its revenue — into the previous month.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `source` | [HubspotSource](#hubspotsource) | yes | none | |\n| `access_token` | string or null | no | `null` | |\n| `objects` | [HubspotObjectsExtractConfig](#hubspotobjectsextractconfig) or null | no | `null` | |\n| `pipelines` | [HubspotPipelinesExtractConfig](#hubspotpipelinesextractconfig) or null | no | `null` | |\n| `properties` | [HubspotPropertyCatalogConfig](#hubspotpropertycatalogconfig) or null | no | `null` | |\n| `property_options` | [HubspotPropertyCatalogConfig](#hubspotpropertycatalogconfig) or null | no | `null` | |\n| `associations` | [HubspotAssociationsExtractConfig](#hubspotassociationsextractconfig) or null | no | `null` | |\n| `owners` | [HubspotOwnersExtractConfig](#hubspotownersextractconfig) or null | no | `null` | |\n",
61
73
  "HubspotObjectsExtractConfig": "## HubspotObjectsExtractConfig\n\nOne row per CRM record of `object_type`, one column per requested property.\n\n`object_type` is HubSpot's own plural object name as it appears in the\nAPI path (`deals`, `companies`, `contacts`, `line_items`, `tickets`),\nor a custom object's `p<portalId>_<name>` / `2-xxxxxxx` identifier.\n\n`properties` is required and has no wildcard form, which is the single\nmost consequential choice in this config. HubSpot returns only about\neight default properties when the parameter is omitted — a portal with\n400 deal properties answers a propertyless request with eight columns\nand no warning — so an implicit \"everything\" would make the dataset's\ncolumn set a function of whatever a HubSpot admin last added, silently\nfor undeclared columns and as a hard failure for anything downstream\ndeclaring a `schema:`. Declaring the list keeps the frame's shape owned\nby the pipeline. Extract `source: properties` first to discover what the\nportal actually has, then name the ones the model needs.\n\nProperty names are checked against the portal's own catalog before the\ncrawl starts: HubSpot ignores an unknown property rather than\nrejecting it, so a typo would otherwise land a frame quietly missing\nthat column.\n\n`archived` selects HubSpot's archived (soft-deleted, recoverable)\nrecords *instead of* the live ones — it is the API's own parameter, not\na union. Reading both means two datasets.\n\n`page_size` is HubSpot's `limit`. It defaults to the documented\nmaximum rather than HubSpot's own default of 10, which would make ten\ntimes as many requests for the same data.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `object_type` | string | yes | none | |\n| `properties` | array of string | yes | none | minItems=`1` |\n| `archived` | boolean | no | `false` | |\n| `page_size` | integer | no | `100` | maximum=`100`; exclusiveMinimum=`0` |\n",
@@ -94,7 +106,7 @@
94
106
  "S3ExtractConfig": "## S3ExtractConfig\n\nExtraction settings for one object in an Amazon S3 bucket.\n\nAuthenticates with an IAM access key pair the YAML supplies, typically\ntemplated via `{{ pipeline_args.NAME }}` from a Remote Job's secret\n`expectedArguments`. There is deliberately no fallback to an ambient AWS\nidentity: the runner serves every tenant, so whatever credentials its\nenvironment holds are not any one pipeline's to use.\n\n`key` is the object key exactly as S3 stores it -- no leading-slash\nstripping, because `/a.csv` and `a.csv` are different objects. `region`\nis optional; without it botocore follows S3's redirect to the bucket's\nregion at the cost of a round trip.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `bucket` | string | yes | none | |\n| `key` | string | yes | none | |\n| `region` | string or null | no | `null` | |\n| `access_key_id` | string or null | no | `null` | |\n| `secret_access_key` | string or null | no | `null` | |\n| `session_token` | string or null | no | `null` | |\n",
95
107
  "SapOdataCursor": "## SapOdataCursor\n\nThe change stamp an incremental SAP OData read advances on.\n\n`column` is a UTC change timestamp that SAP writes whenever a row\nchanges, in ABAP's decimal form `YYYYMMDDhhmmss.fffffff`\n(`LASTCHANGEDATETIME` on the billing-document and product views). Each\nrun reads the rows stamped from one second past the previous bound\nthrough the last whole second that ended `settle_lag` before `now`, the\nrunner's clock, because SAP sends no clock of its own.\nConsecutive windows tile, so a run over a quiet source reads nothing and\nthe run publishes no new version.\n\n`settle_lag_seconds` is how long a stamped row gets to become visible. A\nrow whose commit lags its stamp by more than this, less the amount SAP's\nclock runs behind the runner's, is never read by a window. The default\nis SAP's own safety interval for generic timestamp delta.\n\n`zero_stamp` is the rule for rows whose stamp is ABAP's initial value 0,\nSAP's null, which no window can contain. It has no default, because on\nthe billing header those rows are real documents -- cancellations are\ncreated with 0 and keep it:\n\n* `refuse` fails the run when any such row exists: the first read counts\n them, and every later run probes for them.\n* `creation_date` reads them by `creation_date_column`, a day-grain\n `Edm.DateTime`, once each day has closed everywhere: a day `d` is read\n from `(d+1)T12:00Z + settle_lag`, which covers every time zone the\n date can have been written in.\n\n`full_read_every_days` makes a run read the whole entity set again when\nthe last whole read is that many days old. Under upsert that repairs\nwhat a window cannot see: a change that did not move the stamp, a row\nthat committed later than the lag, a row that changes more often than\nthe lag.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `column` | string | yes | none | |\n| `zero_stamp` | `\"refuse\"`, `\"creation_date\"` | yes | none | |\n| `creation_date_column` | string or null | no | `null` | |\n| `settle_lag_seconds` | integer | no | `1800` | minimum=`60`; maximum=`86400` |\n| `full_read_every_days` | integer or null | no | `null` | integer: minimum=`1`; maximum=`366` |\n",
96
108
  "SapOdataExtractConfig": "## SapOdataExtractConfig\n\nExtraction settings for SAP S/4HANA via an OData V2 service.\n\nReads a CDS-view-backed entity set exposed through SAP Gateway,\nauthenticating with HTTP basic against a read-only SAP service user.\nCredentials (`username`, `password`) are supplied as YAML fields,\ntypically templated via `{{ pipeline_args.NAME }}`.\n\nThe entity URL is composed as `{base_url}{service_path}/{entity_set}`,\nkept as separate fields so authors can't glue them into a malformed path.\n`entity_set` is the set's name as the service's `$metadata` lists it,\nsince that entry types the columns: a key, a parameterised view's\nparameters or a navigation path is refused.\n\nWithout `cursor` or `odp`, every run re-reads the whole entity set, so pair it\nwith `write_mode: overwrite` on the parse step reading it for a full\nrefresh.\n\nWith `cursor` (see `SapOdataCursor`) the read is incremental: each run\nreads only the rows whose change stamp moved since the last published\nrun, and the watermark of the parse step's dataset, kept by the backend,\nremembers how far that was. The one parse step reading it must then declare\n`write_mode: upsert` with the entity's key as `merge_keys`, because a\nchanged row arrives again and has to replace the row it was, and the\nextract needs `sap_client`, because the stream is one client's data. Both\nare refused before any step runs. Nothing is registered in SAP -- the\nposition lives only in the watermark.\n\nWhat the cursor cannot see: a change that does not move the stamp, a\nrow whose commit lagged its stamp by more than the settle lag, a column\nadded to the view after a row was read, and a row deleted at the source\n(on these views, an archived document). `full_read_every_days` repairs\nall but the last; deleted rows stay.\n\n**Changing the stream needs an operator step.** The stored progress is\nkeyed by the Gateway origin and path, the entity set, the client, the\ncursor columns, the zero-stamp rule and a hash of `select`. Changing any of them makes every\nlater run refuse, until `DELETE /labs/datasets/{id}/watermark` -- the id\nof the parse step's dataset, where the position is kept -- resets the\nprogress and the next run reads the whole entity set again.\n\nWith `odp` (see `SapOdataOdp`) the read is incremental through SAP's own\nchange tracking instead. It opens a subscription in SAP, so it needs a\ndedicated SAP user or service per dataset and environment. Its stored\nprogress is keyed by a digest of the SAP user instead of the cursor\nsettings, and after the watermark is deleted a run refuses while the\nuser's subscription exists, until `odp.reset_subscription_until` is set\nfor one run. The parse-step and `sap_client` rules apply as for `cursor`,\nand besides them both together are refused,\n`odp.key` has to equal the parse step's `merge_keys`, and `select` is\nrefused: how SAP applies the initial load's projection to a delta read\nis not verified.\n\n`select` is OData `$select` passthrough. There is no `$filter`: SAP drops\na filter its ODP translation cannot handle and answers with every row,\nand nothing checks a full load's rows, so a filter belongs downstream.\n`max_page_size` is sent as `Prefer: odata.maxpagesize` and sizes each page\nSAP returns; the pages are then followed through their `__next` links.\nIt is not `$top`, which in SAP's V2 truncates the total result and is\nnever sent. Memory scales with it: a 146-column view peaked at about\n0.7 GB with the default of 10,000 and about 1.3 GB at 50,000. Unpatched\nSAP_BW 7.50-7.56 ignores a value above 50,000 (SAP note 3118751), so\n50,000 is the ceiling that pages on every release.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `base_url` | string | yes | none | |\n| `service_path` | string | yes | none | |\n| `entity_set` | string | yes | none | |\n| `max_page_size` | integer | no | `10000` | minimum=`1`; maximum=`50000` |\n| `sap_client` | string or null | no | `null` | |\n| `select` | string or null | no | `null` | |\n| `username` | string or null | no | `null` | |\n| `password` | string or null | no | `null` | |\n| `cursor` | [SapOdataCursor](#sapodatacursor) or null | no | `null` | |\n| `odp` | [SapOdataOdp](#sapodataodp) or null | no | `null` | |\n",
97
- "SapOdataOdp": "## SapOdataOdp\n\nSAP's own change tracking (ODP delta) as the incremental read.\n\nThe first run sends `Prefer: odata.track-changes`, which opens a\nsubscription in SAP's operational delta queue (ODQ), and takes the new\ninitial-load token from `DeltaLinksOf<entity>`. Each later run reads the\nchanges since the committed token and commits the new one SAP hands out,\nalso from an empty read. SAP keeps the subscription, keyed by the SAP user\nand the OData service: one per pair, so every dataset and environment\nneeds its own user or service. A new initial load for the same pair\nsilently invalidates the tokens of whoever held it before.\n\n`key` is the entity's key. One delta can carry a key more than once, and\nthe last image in the response is the one kept. That is verified for a\nCDS view with change data capture, whose repeated images of one key are\nthe same. A recovery sends its requests in the order SAP delivered them,\nbut within one request SAP's order is not change order, so a source that\nsends two different images of one key in one request, as an extractor's\nafter-image delta process may, can keep the older one. It is wrong for\nsources that send differences. `key` has to equal the `merge_keys` of the\nparse step reading the extract.\n\n`deletes` is the rule for SAP's delete records. `ignore` is the only rule\nfor now: they are dropped and counted, so an archived document stays in\nthe dataset, as it does with the cursor.\n\n`reset_subscription_until` and `release_until` are lifecycle steps, each\nin effect until the instant it names and refused after it, so a copied\nor forgotten setting stops acting. `reset_subscription_until` ends this\nuser's subscription on the service before the initial load of a dataset\nwith no committed position; without it such a run refuses, since the\nsubscription may be another dataset's. `release_until` ends the\nsubscription of a dataset that holds a committed position, and the parse\nstep reading the extract publishes a released position, which every later\nrun reads as nothing to do;\nnothing else ends it, because the backend holds no SAP credentials.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `key` | array of string | yes | none | minItems=`1` |\n| `deletes` | `\"ignore\"` | yes | none | |\n| `reset_subscription_until` | string or null | no | `null` | string: format=`\"date-time\"` |\n| `release_until` | string or null | no | `null` | string: format=`\"date-time\"` |\n",
109
+ "SapOdataOdp": "## SapOdataOdp\n\nSAP's own change tracking (ODP delta) as the incremental read.\n\nThe first run sends `Prefer: odata.track-changes`, which opens a\nsubscription in SAP's operational delta queue (ODQ), and takes the new\ninitial-load token from `DeltaLinksOf<entity>`. Each later run reads the\nchanges since the committed token and commits the new one SAP hands out,\nalso from an empty read. SAP keeps the subscription, keyed by the SAP user\nand the OData service: one per pair, so every dataset and environment\nneeds its own user or service. A new initial load for the same pair\nsilently invalidates the tokens of whoever held it before.\n\n`key` is the entity's key. One delta can carry a key more than once, and\nthe last image in the response is the one kept. That is verified for a\nCDS view with change data capture, whose repeated images of one key are\nthe same. A recovery sends its requests in the order SAP delivered them,\nbut within one request SAP's order is not change order, so a source that\nsends two different images of one key in one request, as an extractor's\nafter-image delta process may, can keep the older one. It is wrong for\nsources that send differences. `key` has to equal the `merge_keys` of the\nparse step reading the extract.\n\n`deletes` is the rule for SAP's delete records. `apply` is the default: a\ndelete removes the keyed row, so the dataset mirrors the source's current\nstate. `ignore` drops the delete and counts it and keeps the row, for\nretaining history the source purges, as the cursor does.\n\n`reset_subscription_until` and `release_until` are lifecycle steps, each\nin effect until the instant it names and refused after it, so a copied\nor forgotten setting stops acting. `reset_subscription_until` ends this\nuser's subscription on the service before the initial load of a dataset\nwith no committed position; without it such a run refuses, since the\nsubscription may be another dataset's. `release_until` ends the\nsubscription of a dataset that holds a committed position, and the parse\nstep reading the extract publishes a released position, which every later\nrun reads as nothing to do;\nnothing else ends it, because the backend holds no SAP credentials.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `key` | array of string | yes | none | minItems=`1` |\n| `deletes` | `\"ignore\"`, `\"apply\"` | no | `\"apply\"` | |\n| `reset_subscription_until` | string or null | no | `null` | string: format=`\"date-time\"` |\n| `release_until` | string or null | no | `null` | string: format=`\"date-time\"` |\n",
98
110
  "SharePointExportConfig": "## SharePointExportConfig\n\nSharePoint upload target via Microsoft Graph.\n\nSerializes the source DataFrame to `format` (csv / xlsx / parquet)\nand writes the bytes to `file_path` under `site_url`. Reuses the\nexact OAuth client-credentials flow and site/library resolution the\nSharePoint extractor already ships with — same `tenant_id` /\n`client_id` / `client_secret` triple, same `{{ pipeline_args.* }}`\ntemplating, same `library_name` conventions.\n\nWrite options live in the block named for `format` -- `csv:` or `xlsx:` --\nby the rule a parse step's read options follow: the block for `format` is\nfilled with defaults when omitted, a block for another format is refused\nrather than ignored, and `parquet` has none.\n\n format: xlsx\n xlsx:\n sheet_name: Monthly\n\nRequired Azure AD application permissions: either `Sites.ReadWrite.All`\n(tenant-wide) or `Sites.Selected` + per-site `write` grant.\n\n`conflict_behavior=REPLACE` (default) is safe for SharePoint\ndocument libraries because versioning is on by default — prior\nuploads remain recoverable through the SharePoint UI. Targets\nwithout versioning (future: raw SFTP) should interpret `REPLACE`\nas a genuinely destructive overwrite and document that caveat on\ntheir own config class.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `source_dataset` | string | yes | none | |\n| `site_url` | string | yes | none | |\n| `file_path` | string | yes | none | |\n| `library_name` | string or null | no | `null` | |\n| `tenant_id` | string or null | no | `null` | |\n| `client_id` | string or null | no | `null` | |\n| `client_secret` | string or null | no | `null` | |\n| `format` | [ExportFormat](#exportformat) | no | `\"csv\"` | |\n| `conflict_behavior` | [ConflictBehavior](#conflictbehavior) | no | `\"replace\"` | |\n| `csv` | [CsvWriteOptions](#csvwriteoptions) or null | no | `null` | |\n| `xlsx` | [XlsxWriteOptions](#xlsxwriteoptions) or null | no | `null` | |\n",
99
111
  "SharePointExtractConfig": "## SharePointExtractConfig\n\nExtraction settings for SharePoint files via Microsoft Graph API.\n\nRequires an Azure AD app registration with Sites.Read.All (or\nSites.Selected) permission.\n\nCredentials (`tenant_id`, `client_id`, `client_secret`) are\nsupplied as YAML fields — typically templated via\n`{{ pipeline_args.NAME }}` so a Remote Job's secret\n`expectedArguments` flow through at discovery time.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `site_url` | string | yes | none | |\n| `file_path` | string | yes | none | |\n| `library_name` | string or null | no | `null` | |\n| `tenant_id` | string or null | no | `null` | |\n| `client_id` | string or null | no | `null` | |\n| `client_secret` | string or null | no | `null` | |\n",
100
112
  "SqlDatabaseExtractConfig": "## SqlDatabaseExtractConfig\n\nExtraction settings for SQL databases via SQLAlchemy.\n\nUses `pd.read_sql` / `pd.read_sql_table` under the hood. The\n*connection_string* must be a valid SQLAlchemy URL (e.g.\n`postgresql+psycopg2://user:pass@host/db`).\n\nSpecify exactly one of *query* or *table*.\n\n`cursor_column` makes the extract incremental. It names a column of the\nquery's result (or of the table) whose values only ever grow for new or\nchanged rows: an `updated_at` timestamp, an autoincrement id, a log\nsequence number. Each run then reads only the rows past the position the\nprevious run committed, and the dataset's watermark, kept by the backend,\nremembers that position across runs. The window is fixed before it is\nread: the run first asks the source for the column's current maximum, then\nreads `(committed, maximum]`. Each retry measures a new maximum; the bound\nis fixed within one attempt and does not provide a shared database snapshot.\nExactly one parse step reads it, and that step chooses `write_mode`\nindependently: append and upsert accumulate rows, while overwrite retains\nonly the latest published window. The window is published as part of the\nparse step's dataset, which is why the position is tracked on that dataset\nrather than on this one. The store must support the requested mode and the\nextraction lifecycle (see `WriteMode`).\n\nWhat the cursor cannot see: a row whose cursor value does not change when\nthe row changes, and a row deleted at the source. Both stay as they were\nlast read. An initial read (no committed bound) refuses null cursors, since\nno window can include them. Later runs only inspect rows past the committed\nbound, so historical nulls do not block progress; null rows remain excluded\nuntil assigned a cursor beyond that bound. Rows sharing the maximum value\nwith a row still being written at the moment of the read are read once and\nnever again, so the column should be one the source assigns at commit, not\nat the start of a transaction.\n\n**Renaming the cursor column, or moving the source, needs an operator step.**\nThe stored progress is keyed by the derivation's version, the driver name,\nthe host and port, the database, the relation *and* the cursor column (for\na `query`, the relation is a hash of its exact text), plus a hash of any\ndriver options left in the URL. Changing any of them in this YAML makes\nevery later run refuse:\na position measured against one stream never applied to another. Answering\nthat refusal is `PUT /labs/datasets/{id}/watermark` -- the id of the parse\nstep's dataset, where the position is kept -- which states the new\nkey and the position to carry over. Nothing about the data already stored\nchanges. The position carried over names the column it was measured on, and\na run whose cursor is a different column refuses it rather than bounding on\na value that was never compared against that column.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `connection_string` | string | yes | none | |\n| `table` | string or null | no | `null` | |\n| `batch_size` | integer | no | `100000` | exclusiveMinimum=`0` |\n| `query` | string or null | no | `null` | |\n| `cursor_column` | string or null | no | `null` | |\n",
@@ -106,7 +118,7 @@
106
118
  "TldvExtractConfig": "## TldvExtractConfig\n\n`extract.type: tldv` — multi-source family over the tl;dv REST API.\n\nAuthentication is a personal API key from tl;dv's settings, sent as\n`x-api-key`; it is a YAML field, typically templated via\n`{{ pipeline_args.TLDV_API_KEY }}`. A key sees the meetings its owner\ncan see, and a transcript is exported only for meetings whose organizer\nis on a paid plan -- tl;dv answers 403 for the others, which the\nextractor logs and skips per meeting rather than failing the run.\n\n`meetings` is one row per meeting; `transcripts` one row per spoken\nsegment; `notes` one row per meeting with tl;dv's generated notes as\nMarkdown. The filter block is the same on all three. Every source\nstores a parquet payload, which a parse step reads with `format: parquet`.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `source` | [TldvSource](#tldvsource) | yes | none | |\n| `api_key` | string or null | no | `null` | |\n| `meetings` | [TldvMeetingsFilter](#tldvmeetingsfilter) or null | no | `null` | |\n| `transcripts` | [TldvMeetingsFilter](#tldvmeetingsfilter) or null | no | `null` | |\n| `notes` | [TldvMeetingsFilter](#tldvmeetingsfilter) or null | no | `null` | |\n",
107
119
  "TldvMeetingsFilter": "## TldvMeetingsFilter\n\nWhich meetings a tl;dv source reads: a date window.\n\nShared by every source, because transcripts and notes are addressed per\nmeeting and so start from the same meeting list. `from_date` and\n`to_date` are ISO 8601 dates.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `from_date` | string or null | no | `null` | |\n| `to_date` | string or null | no | `null` | |\n| `page_size` | integer | no | `50` | maximum=`50`; exclusiveMinimum=`0` |\n",
108
120
  "TldvSource": "## TldvSource\n\nSub-discriminator on `extract.tldv.source`.\n\nValues: `\"meetings\"`, `\"transcripts\"`, `\"notes\"`\n",
109
- "TransformConfig": "## TransformConfig\n\nConfiguration for a `type: transform` dataset step.\n\nChoose the surface in this order and always set `engine`, because its\ndefault is `python`: SQL (`duckdb`) for anything set-based, `ibis` when the\nlogic needs Python to compose, and `python` only for work with no lazy form.\n`duckdb` and `ibis` stream; `python` holds every input and its output in\nmemory.\n\nFor `engine: duckdb`:\n\n`query` (inline SQL) supplies the query. Upstream `deps` are exposed to\nthe SQL as views named by their leaf name. Output is always parquet.\n`sql_file` (a `.sql` file in `Code/`) exists for engine-run pipelines but\nis refused for authored pipelines, which are validated before any source\nis read; use `query`.\n\nFor `engine: ibis`:\n\n`script` names a `Code/` file holding an `@ibis_transform` function. The\nrunner calls it with one lazy ibis `Table` per dep, named by the dep's leaf\nname, and it must return a `Table`; returning a DataFrame is refused. Rows\ncome back in no fixed order unless the expression ends in `.order_by()`.\n\n from farseer_simple_pipelines import ibis_transform\n\n @ibis_transform\n def sales_clean(sales_lines, *, args):\n t = sales_lines\n for column in args[\"code_columns\"]:\n t = t.mutate(**{column: t[column].strip().upper()})\n return t.order_by(args[\"code_columns\"])\n\nFor `engine: python`:\n\n`script` is the Python filename containing the `@transform` function.\nThe runner calls it with one pandas DataFrame per dep, as a keyword\nargument named by the dep's leaf name, and the function returns one\nDataFrame.\n\nFor both script surfaces:\n\n`function` optionally overrides which decorated function in the script\nbacks this dataset. When unset, the runner binds the function whose name\nmatches the dataset's leaf name. Setting this lets one shared function\nback many datasets (e.g. a single `tb_any` used by `tb_c4c`, `tb_cdg`,\n`tb_cih`). `args` is an arbitrary dict passed to the function's\nkeyword-only `args` parameter, if it declares one. The script lives under\n`Code/`, mirroring the dataset's folder under `Models/`.\n\nWhatever the engine, the output is parquet, so there is no format to set:\na transform's output is typed and read back by scanning it, and neither\nsurvives csv or json.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `engine` | [TransformEngine](#transformengine) | no | `\"python\"` | |\n| `script` | string or null | no | `null` | |\n| `function` | string or null | no | `null` | |\n| `query` | string or null | no | `null` | |\n| `sql_file` | string or null | no | `null` | |\n| `args` | object | no | none | |\n| `max_file_size` | string or integer or null | no | `null` | |\n\n### Example\n\n```yaml\n# Models/sales_monthly.yaml: a file's name must match its `name:`.\n# Totals the month by product and region in SQL. Each dep is a view named after\n# its leaf name; cast SUMs and dates, which DuckDB returns as DECIMAL and DATE.\nname: sales_monthly\ntype: transform\ndeps: [sales]\ntransform:\n engine: duckdb\n query: |\n SELECT\n product,\n region,\n strftime(CAST(sale_date AS DATE), '%Y-%m-01') AS month,\n CAST(SUM(amount) AS DOUBLE) AS amount\n FROM sales\n GROUP BY ALL\n```\n",
121
+ "TransformConfig": "## TransformConfig\n\nConfiguration for a `type: transform` dataset step.\n\nChoose the surface in this order and always set `engine`, because its\ndefault is `python`: SQL (`duckdb`) for anything set-based, `ibis` when the\nlogic needs Python to compose, and `python` only for work with no lazy form.\n`duckdb` and `ibis` stream; `python` holds every input and its output in\nmemory.\n\nFor `engine: duckdb`:\n\n`query` (inline SQL) supplies the query. Upstream `deps` are exposed to\nthe SQL as views named by their leaf name. Output is always parquet.\n`sql_file` (a `.sql` file in `Code/`) exists for engine-run pipelines but\nis refused for authored pipelines, which are validated before any source\nis read; use `query`. A query that should stop because the data isn't\nwhat the step needs calls `fail_step('…')` with what is wrong and what the\nclient does next, not `error()`: the client reads `fail_step`'s message as\nthe step's failure, and `error()` only as the app's own code failing.\n\nFor `engine: ibis`:\n\n`script` names a `Code/` file holding an `@ibis_transform` function. The\nrunner calls it with one lazy ibis `Table` per dep, named by the dep's leaf\nname, and it must return a `Table`; returning a DataFrame is refused. Rows\ncome back in no fixed order unless the expression ends in `.order_by()`.\n\n from farseer_simple_pipelines import ibis_transform\n\n @ibis_transform\n def sales_clean(sales_lines, *, args):\n t = sales_lines\n for column in args[\"code_columns\"]:\n t = t.mutate(**{column: t[column].strip().upper()})\n return t.order_by(args[\"code_columns\"])\n\nFor `engine: python`:\n\n`script` is the Python filename containing the `@transform` function.\nThe runner calls it with one pandas DataFrame per dep, as a keyword\nargument named by the dep's leaf name, and the function returns one\nDataFrame.\n\nFor both script surfaces:\n\n`function` optionally overrides which decorated function in the script\nbacks this dataset. When unset, the runner binds the function whose name\nmatches the dataset's leaf name. Setting this lets one shared function\nback many datasets (e.g. a single `tb_any` used by `tb_c4c`, `tb_cdg`,\n`tb_cih`). `args` is an arbitrary dict passed to the function's\nkeyword-only `args` parameter, if it declares one. The script lives under\n`Code/`, mirroring the dataset's folder under `Models/`.\n\nWhatever the engine, the output is parquet, so there is no format to set:\na transform's output is typed and read back by scanning it, and neither\nsurvives csv or json.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `engine` | [TransformEngine](#transformengine) | no | `\"python\"` | |\n| `script` | string or null | no | `null` | |\n| `function` | string or null | no | `null` | |\n| `query` | string or null | no | `null` | |\n| `sql_file` | string or null | no | `null` | |\n| `args` | object | no | none | |\n| `max_file_size` | string or integer or null | no | `null` | |\n\n### Example\n\n```yaml\n# Models/sales_monthly.yaml: a file's name must match its `name:`.\n# Totals the month by product and region in SQL. Each dep is a view named after\n# its leaf name; cast SUMs and dates, which DuckDB returns as DECIMAL and DATE.\nname: sales_monthly\ntype: transform\ndeps: [sales]\ntransform:\n engine: duckdb\n query: |\n SELECT\n product,\n region,\n strftime(CAST(sale_date AS DATE), '%Y-%m-01') AS month,\n CAST(SUM(amount) AS DOUBLE) AS amount\n FROM sales\n GROUP BY ALL\n```\n",
110
122
  "TransformEngine": "## TransformEngine\n\nHow a transform is authored, and therefore whether it materialises.\n\nNot the compute engine, despite the name: there is one of those, DuckDB, and\nevery surface here runs on it. What this selects is the authoring surface --\nand because exactly one surface holds a whole dataset in memory, it is also\nthe step's resource envelope, declared where a scheduler can read it before\nthe step has ever run. The name is kept because the field is a tenant's\nYAML.\n\n`duckdb` runs author SQL over the dependency relations. Streams.\n\n`ibis` runs an `@ibis_transform` function over lazy tables, returning one.\nStreams.\n\n`python` runs a `@transform` function over DataFrames, returning one. **The\nonly surface that materialises**, so a step declaring it is bounded by the\ncontainer rather than by a memory limit.\n\nValues: `\"python\"`, `\"duckdb\"`, `\"ibis\"`\n",
111
123
  "WriteMode": "## WriteMode\n\nChoose how a parse step or transform writes its output to a dataset.\n\n`overwrite` replaces the rows, `append` adds rows, and `upsert` replaces\nmatching keys while retaining the others. The tenant chooses the mode on\neach run, independently of whether the source uses a SQL cursor.\nOverwriting an incremental window and appending a complete result are both\nintentional choices we support. A SAP OData window (`cursor` or `odp`) is\nthe exception: a changed row arrives again, so the parse step reading it\nmust upsert on the entity's key, or the run fails before any step runs. The\nstore must implement the requested mode; currently only the Iceberg store\nsupports append and upsert. An extract declares no mode: it stores a\npayload, and the dataset is the parse step reading it.\n\nQuality rules and `schema:` see the accumulated dataset rather than this\nrun's rows, because validation loads back what was persisted. A rule has to\nhold across runs. Schema-only checks avoid a cached copy, but quality rules\nmaterialize the full dataset; incremental reads do not make validation cost\nproportional to the new window.\n\nA run whose window read no rows publishes no version and adds no file, so\nwhat a consumer reads tracks changes rather than runs. The exception is an\nextractor that returns its position as a `MovedPosition` (SAP ODP, which\nserves an older delta token only as a recovery of what it already\ndelivered): that window is published, empty, to carry it. Declared validation\nstill checks the published dataset: rules may have changed since the last\npublication. A first run over an empty source does publish, so a consumer\nfinds an empty dataset rather than none, provided its columns are typed:\ndeclared under `schema:`, or already typed in the payload, as a SAP OData\nread's are from the service's `$metadata`. Without types the Iceberg store\nrefuses that run: every column of an empty result arrives untyped, and a\nnew table needs types.\n\nThe candidate that a quiet run opened is cancelled and its logical version\nnumber stays consumed. Physical cleanup and metadata retention are deferred;\nthe abandonment sweep only marks eligible active attempts cancelled.\n\nValues: `\"overwrite\"`, `\"append\"`, `\"upsert\"`\n",
112
124
  "XlsxParseOptions": "## XlsxParseOptions\n\nHow to read an xlsx payload.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `sheet_name` | string or integer | no | `0` | |\n| `columns` | string or null | no | `null` | |\n| `has_header` | boolean | no | `true` | |\n| `start_row` | integer or null | no | `null` | |\n",
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/pipeline/guide.ts"],
4
- "sourcesContent": ["import { pipelineSkill } from '../skills/pipeline';\n\n// CLI and MCP guide callers read the same method and practices as native skill clients.\nexport const PIPELINE_GUIDE = pipelineSkill.body;\nexport const PIPELINE_PRACTICES = pipelineSkill.practices;\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA8B;AAGvB,MAAM,iBAAiB,8BAAc;AACrC,MAAM,qBAAqB,8BAAc;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/pipeline/init.ts"],
4
- "sourcesContent": ["import * as fs from 'fs';\nimport * as path from 'path';\nimport { randomUUID } from 'crypto';\nimport type { RemoteApp, SourceFolderResolution } from '../services/apps';\nimport { profileFile, type PipelinePaths } from './connect';\nimport { PIPELINE_ENGINE_PROFILE } from './reference';\nimport { assertPipelineRuntime, compareRuntime } from './runtime';\nimport {\n BLANK_SETUP,\n PipelineClient,\n PipelineProfile,\n PipelineService,\n profileSchema,\n readPipelineProfileFile,\n redact,\n SCHEDULE_NOTE,\n} from './service';\n\nconst { load: loadYaml }: { load: (source: string) => unknown } = require('js-yaml');\n\n/** What the skill's starter layout uses and what check expects when the job names no script. */\nconst CONVENTIONAL_ENTRYPOINT = 'main.py';\n// Mirrors the engine's charset for a rendered dataset name; anything else is templated or invalid.\nconst DATASET_NAME = /^[A-Za-z0-9_-]+$/;\n\nexport interface InitOptions {\n organisation: string;\n tenant: string;\n jobId: number;\n workspace?: string;\n force?: boolean;\n}\ninterface Definition {\n file: string;\n qualifiedName: string;\n}\ninterface SkippedDefinition {\n file: string;\n reason: string;\n}\nexport interface InitResult {\n file: string;\n profile: PipelineProfile;\n datasets: { name: string; id: string; file: string }[];\n /** Declared under Models/ but not created yet; the engine creates a dataset on its first write. */\n pendingDatasets: { name: string; file: string }[];\n skippedDefinitions: SkippedDefinition[];\n warnings: string[];\n nextSteps: string[];\n}\ntype Job = RemoteApp & { sourceFolderId: number; runnerImage: string };\n\n/** Derive a profile from the prepared job and write it. Reads only; never changes remote state. */\nexport async function initPipelineProfile(\n options: InitOptions,\n client: PipelineClient,\n paths: PipelinePaths,\n): Promise<InitResult> {\n const warnings: string[] = [];\n const job = await readJob(client, options.jobId);\n const workspace = options.workspace ?? (await locateWorkspace(client, job));\n const folder = await resolveFolder(client, job, workspace);\n const file = targetFile(paths.profileDir, workspace, options.force ?? false);\n const identity = {\n organisation: options.organisation,\n tenant: options.tenant,\n jobId: job.id,\n sourceFolderId: job.sourceFolderId,\n workspace,\n };\n const kept = writtenByPeople(file, identity, warnings);\n const draft = profileSchema.parse({\n ...identity,\n author: kept?.author,\n configFiles: kept?.configFiles,\n entrypoint: entrypointFor(job, folder, warnings),\n engine: PIPELINE_ENGINE_PROFILE,\n schedule: job.schedule ?? null,\n });\n const runtime = compareRuntime(job.runnerImage);\n if (runtime.status !== 'match') warnings.push(runtime.nextAction);\n if (job.schedule)\n warnings.push(`Job runs on schedule \"${job.schedule}\" (recorded in the profile). ${SCHEDULE_NOTE}`);\n const service = new PipelineService(draft, client, paths.filesDir, paths.stateRoot);\n const { definitions, skipped } = await scanDefinitions(service, paths.filesDir, warnings);\n const resolved = await resolveDatasets(client, definitions);\n const profile = profileSchema.parse({\n ...draft,\n datasetIds: [...new Set(resolved.datasets.map((d) => d.id))],\n setup: kept?.setup ?? BLANK_SETUP,\n });\n writeProfile(file, profile);\n return {\n file,\n profile,\n ...resolved,\n skippedDefinitions: skipped,\n warnings,\n nextSteps: [\n 'Fill the setup record: owner, checkedAt (ISO datetime), evidence, retentionDays, otherWritersExcluded=true and runtimeVerified=true. These are owner statements; check reports the record as pending until all are filled.',\n ...(resolved.pendingDatasets.length\n ? [\n `Pending datasets (${resolved.pendingDatasets.map((d) => d.name).join(', ')}) are created on the first run; rerun init jobId=${job.id} force=true after it to record their IDs.`,\n ]\n : []),\n 'Run check to see what is verified and what is still pending.',\n ],\n };\n}\n\nasync function readJob(client: PipelineClient, jobId: number): Promise<Job> {\n const job = await client.getApp(String(jobId));\n if (!job) throw new Error(`Job ${jobId} was not found on this tenant`);\n const runnerImage = job.runnerImage ?? '';\n assertPipelineRuntime(runnerImage);\n if (!job.sourceFolderId) throw new Error(`Job ${jobId} has no source folder; set one in the web app first`);\n return { ...job, sourceFolderId: job.sourceFolderId, runnerImage };\n}\n\n/** The job stores a folder ID, not a path; the path comes from where its main script lives. */\nasync function locateWorkspace(client: PipelineClient, job: Job): Promise<string> {\n const advice = 'give the workspace folder (workspace=<dir>, the tenant-relative source folder path)';\n if (!job.mainScriptFileId) throw new Error(`Job ${job.id} has no main script; ${advice}`);\n const script = (await client.listFiles(['Files'])).find((f) => f.reference === job.mainScriptFileId);\n if (!script) throw new Error(`Main script of job ${job.id} was not found under Files; ${advice}`);\n const workspace = path.posix.dirname(script.path);\n if (workspace === '.') throw new Error(`Main script of job ${job.id} sits at the Files root; ${advice}`);\n return workspace;\n}\n\nasync function resolveFolder(client: PipelineClient, job: Job, workspace: string): Promise<SourceFolderResolution> {\n const folder = await client.resolveSourceFolder(workspace);\n if (!folder) throw new Error(`Workspace folder \"${workspace}\" does not exist under Files`);\n if (folder.id !== job.sourceFolderId)\n throw new Error(\n `Workspace folder \"${workspace}\" (id ${folder.id}) is not the source folder of job ${job.id} (id ${job.sourceFolderId})`,\n );\n return folder;\n}\n\nfunction entrypointFor(job: Job, folder: SourceFolderResolution, warnings: string[]): string {\n const script = folder.scripts.find((s) => s.id === job.mainScriptFileId);\n if (script) return script.name;\n warnings.push(\n `Job ${job.id} names no main script inside its source folder; wrote the conventional entrypoint ${CONVENTIONAL_ENTRYPOINT}. Until the job's main script is set to it, check reports prepared-job as failed and run refuses.`,\n );\n return CONVENTIONAL_ENTRYPOINT;\n}\n\n/**\n * What people wrote into the existing profile, kept when it belongs to the same job and folder: a\n * rerun with force refreshes only what init reads from the job. A profile for anything else, or one\n * that cannot be read, is replaced by a fresh one.\n */\nfunction writtenByPeople(\n file: string,\n identity: Pick<PipelineProfile, 'organisation' | 'tenant' | 'jobId' | 'sourceFolderId' | 'workspace'>,\n warnings: string[],\n): Pick<PipelineProfile, 'author' | 'configFiles' | 'setup'> | undefined {\n if (!fs.existsSync(file)) return undefined;\n let existing: PipelineProfile;\n try {\n existing = readPipelineProfileFile(file);\n } catch (error) {\n warnings.push(\n `The existing profile could not be read, so its setup record, config files and author were not kept: ${redact(error instanceof Error ? error.message : String(error))}`,\n );\n return undefined;\n }\n const same = (Object.keys(identity) as (keyof typeof identity)[]).every((key) => existing[key] === identity[key]);\n return same ? { author: existing.author, configFiles: existing.configFiles, setup: existing.setup } : undefined;\n}\n\n/** Named after the pipeline folder, so one tenant can hold a profile per pipeline. */\nfunction targetFile(profileDir: string, workspace: string, force: boolean): string {\n const file = profileFile(profileDir, path.posix.basename(workspace));\n if (fs.existsSync(file) && !force)\n throw new Error(`Profile ${file} already exists for workspace ${workspace}; set force=true to overwrite it`);\n return file;\n}\n\n/** Dataset YAML in the local Models/ tree, pulled first when the workspace has no local source. */\nasync function scanDefinitions(\n service: PipelineService,\n filesDir: string,\n warnings: string[],\n): Promise<{ definitions: Definition[]; skipped: SkippedDefinition[] }> {\n if (!service.localSources().length) {\n try {\n await service.syncSources('pull');\n } catch (error) {\n warnings.push(\n `No local source and the pull failed, so no datasets were derived: ${redact(String(error))}. Fix the job, pull, then rerun init jobId=${service.profile.jobId} force=true.`,\n );\n }\n }\n const prefix = `${service.profile.workspace}/Models/`;\n const definitions: Definition[] = [];\n const skipped: SkippedDefinition[] = [];\n for (const file of service\n .localSources()\n .filter((f) => f.startsWith(prefix) && /\\.ya?ml$/.test(f))\n .sort()) {\n const parsed = readDefinition(path.join(filesDir, file), file.slice(prefix.length));\n if ('reason' in parsed) skipped.push({ file, reason: parsed.reason });\n else definitions.push({ file, qualifiedName: parsed.qualifiedName });\n }\n return { definitions, skipped };\n}\n\n/** Same rule as the engine: folders under Models/ form the namespace, the YAML name is the last segment. */\nfunction readDefinition(absolute: string, relativeToModels: string): { qualifiedName: string } | { reason: string } {\n let data: unknown;\n try {\n data = loadYaml(fs.readFileSync(absolute, 'utf8'));\n } catch {\n return { reason: 'invalid YAML syntax' };\n }\n const name = (data as { name?: unknown } | null)?.name;\n if (typeof name !== 'string') return { reason: 'no string name field' };\n if (!DATASET_NAME.test(name)) return { reason: `name \"${name}\" is templated or not a plain dataset name` };\n const namespace = path.posix\n .dirname(relativeToModels)\n .split('/')\n .filter((p) => p !== '.');\n return { qualifiedName: [...namespace, name].join('.') };\n}\n\nasync function resolveDatasets(client: PipelineClient, definitions: Definition[]) {\n // A newly scaffolded pipeline (or a plain script job) has no dataset names\n // to resolve. It must be initializable before dataset storage is configured.\n if (definitions.length === 0) return { datasets: [], pendingDatasets: [] };\n const remote = await client.pipelineRequest<{ id: string; name: string }[]>('GET', '/labs/datasets');\n const byName = new Map(remote.map((d) => [d.name, d.id]));\n const datasets: InitResult['datasets'] = [];\n const pendingDatasets: InitResult['pendingDatasets'] = [];\n for (const { file, qualifiedName: name } of definitions) {\n const id = byName.get(name);\n if (id) datasets.push({ name, id, file });\n else pendingDatasets.push({ name, file });\n }\n return { datasets, pendingDatasets };\n}\n\nfunction writeProfile(file: string, profile: PipelineProfile) {\n fs.mkdirSync(path.dirname(file), { recursive: true });\n const tmp = `${file}.${randomUUID()}`;\n fs.writeFileSync(tmp, JSON.stringify(profile, null, 2) + '\\n', { mode: 0o600 });\n fs.renameSync(tmp, file);\n}\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAoB;AACpB,WAAsB;AACtB,oBAA2B;AAE3B,qBAAgD;AAChD,uBAAwC;AACxC,qBAAsD;AACtD,qBASO;AAEP,MAAM,EAAE,MAAM,SAAS,IAA2C,QAAQ,SAAS;AAGnF,MAAM,0BA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G,EAAE;AAC3D;AAEA,eAAe,gBAAgB,QAAwB,aAA2B;AAG9E,MAAI,YAAY,WAAW,EAAG,QAAO,EAAE,UAAU,CAAC,GAAG,iBAAiB,CAAC,EAAE;AACzE,QAAM,SAAS,MAAM,OAAO,gBAAgD,OAAO,gBAAgB;AACnG,QAAM,SAAS,IAAI,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;AACxD,QAAM,WAAmC,CAAC;AAC1C,QAAM,kBAAiD,CAAC;AACxD,aAAW,EAAE,MAAM,eAAe,KAAK,KAAK,aAAa;AACrD,UAAM,KAAK,OAAO,IAAI,IAAI;AAC1B,QAAI,GAAI,UAAS,KAAK,EAAE,MAAM,IAAI,KAAK,CAAC;AAAA,QACnC,iBAAgB,KAAK,EAAE,MAAM,KAAK,CAAC;AAAA,EAC5C;AACA,SAAO,EAAE,UAAU,gBAAgB;AACvC;AAEA,SAAS,aAAa,MAAc,SAA0B;AAC1D,KAAG,UAAU,KAAK,QAAQ,IAAI,GAAG,EAAE,WAAW,KAAK,CAAC;AACpD,QAAM,MAAM,GAAG,IAAI,QAAI,0BAAW,CAAC;AACnC,KAAG,cAAc,KAAK,KAAK,UAAU,SAAS,MAAM,CAAC,IAAI,MAAM,EAAE,MAAM,IAAM,CAAC;AAC9E,KAAG,WAAW,KAAK,IAAI;AAC3B;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/pipeline/operations.ts"],
4
- "sourcesContent": ["import type { PipelinePaths } from './connect';\nimport { createPipeline } from './create';\nimport { initPipelineProfile } from './init';\nimport type { PipelineClient, PipelineService } from './service';\n\n/**\n * The operations every surface (CLI command, MCP tool) exposes on a connected pipeline.\n * recover and unlock stay CLI-only: they resolve local state after a crash and are not\n * offered to a model.\n */\nexport const PIPELINE_OPERATIONS = [\n 'check',\n 'pull',\n 'push',\n 'run',\n 'runs',\n 'inspect',\n 'inspect-import',\n 'query',\n 'versions',\n 'restore',\n 'terminate',\n 'upgrade-runtime',\n] as const;\nexport type PipelineOperation = (typeof PIPELINE_OPERATIONS)[number];\n\nexport interface PipelineOperationArgs {\n /** Exact run UUID: for inspect (the local receipt's run when absent) and terminate (required). */\n uuid?: string;\n datasetId?: string;\n versionId?: string;\n /** The current version observed before restore; a stale value is refused by the backend. */\n expectedCurrent?: string;\n importId?: number;\n /** Log offset for inspect, from a previous page's nextOffset. */\n offset?: number;\n /** Ordered job arguments for run. */\n args?: string[];\n /** Version bindings {name, datasetId, versionId} or file bindings {name, file} for query. */\n bindings?: unknown[];\n sql?: string;\n /** Runs to list, newest first. */\n limit?: number;\n}\n\nexport interface PipelineInitSelection {\n organisation: string;\n tenant: string;\n /** Attach to a job somebody prepared; reads only. */\n jobId?: number;\n /** Create folder, job and profile for a new pipeline named after its folder. */\n name?: string;\n workspace?: string;\n force?: boolean;\n}\n\nfunction required<T>(name: keyof PipelineOperationArgs, value: T | undefined): T {\n if (value === undefined) throw new Error(`${name} is required`);\n return value;\n}\n\n/** One dispatcher for every surface, so an operation means the same call everywhere. */\nexport async function runPipelineOperation(\n service: PipelineService,\n operation: PipelineOperation,\n args: PipelineOperationArgs,\n signal?: AbortSignal,\n): Promise<unknown> {\n switch (operation) {\n case 'check':\n return service.check(signal);\n case 'pull':\n case 'push':\n return service.syncSources(operation);\n case 'run':\n return service.submit(args.args ?? []);\n case 'runs':\n return service.runs(args.limit);\n case 'inspect':\n return service.inspect(args.uuid, args.offset ?? 0);\n case 'inspect-import':\n return service.inspectImport(required('importId', args.importId));\n case 'versions':\n return service.versions(required('datasetId', args.datasetId));\n case 'restore':\n return service.restore(\n required('datasetId', args.datasetId),\n required('versionId', args.versionId),\n required('expectedCurrent', args.expectedCurrent),\n );\n case 'terminate':\n return service.terminate(required('uuid', args.uuid));\n case 'upgrade-runtime':\n return service.upgradeRuntime();\n case 'query': {\n const bindings = required('bindings', args.bindings);\n const sql = required('sql', args.sql);\n // A binding naming a dataset version reads immutable history; a file binding\n // reads the current mutable Farseer File. The first binding decides the mode.\n const versioned = (bindings[0] as { datasetId?: unknown } | undefined)?.datasetId !== undefined;\n return versioned\n ? service.queryVersions(bindings as Parameters<PipelineService['queryVersions']>[0], sql, signal)\n : service.query(bindings as Parameters<PipelineService['query']>[0], sql, signal);\n }\n default:\n throw new Error(\n `Unknown operation \"${String(operation)}\". Supported operations: ${PIPELINE_OPERATIONS.join(', ')}`,\n );\n }\n}\n\n/**\n * Attach to a prepared job or create a pipeline from nothing; exactly one of the two.\n * The selection is validated before the client is opened, so a bad call never touches the tenant.\n */\nexport async function runPipelineInit(\n selection: PipelineInitSelection,\n openClient: () => Promise<PipelineClient>,\n paths: PipelinePaths,\n) {\n const { organisation, tenant, jobId, name, workspace, force } = selection;\n if ((jobId === undefined) === (name === undefined))\n throw new Error('Pass either a prepared jobId or a new name, not both and not neither');\n if (name !== undefined) {\n if (workspace !== undefined || force !== undefined)\n throw new Error('workspace and force only apply when attaching to a prepared jobId');\n return createPipeline({ organisation, tenant, name }, await openClient(), paths);\n }\n return initPipelineProfile(\n { organisation, tenant, jobId: jobId as number, workspace, force },\n await openClient(),\n paths,\n );\n}\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAA+B;AAC/B,kBAAoC;AAQ7B,MAAM,sBAAsB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAiCA,SAAS,SAAY,MAAmC,OAAyB;AAC7E,MAAI,UAAU,OAAW,OAAM,IAAI,MAAM,GAAG,IAAI,cAAc;AAC9D,SAAO;AACX;AAGA,eAAsB,qBAClB,SACA,WACA,MACA,QACgB;AAChB,UAAQ,WAAW;AAAA,IACf,KAAK;AACD,aAAO,QAAQ,MAAM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1F,MAAI,SAAS,QAAW;AACpB,QAAI,cAAc,UAAa,UAAU;AACrC,YAAM,IAAI,MAAM,mEAAmE;AACvF,eAAO,8BAAe,EAAE,cAAc,QAAQ,KAAK,GAAG,MAAM,WAAW,GAAG,KAAK;AAAA,EACnF;AACA,aAAO;AAAA,IACH,EAAE,cAAc,QAAQ,OAAwB,WAAW,MAAM;AAAA,IACjE,MAAM,WAAW;AAAA,IACjB;AAAA,EACJ;AACJ;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/pipeline/query.ts"],
4
- "sourcesContent": ["import { fork } from 'child_process';\nimport * as fs from 'fs';\nimport * as os from 'os';\nimport * as path from 'path';\nimport { downloadQueryFiles } from './queryDownloads';\n\nexport interface QueryLimits {\n memoryMb: number;\n spillMb: number;\n threads: number;\n timeMs: number;\n inputBytes: number;\n rows: number;\n resultBytes: number;\n}\nexport const DEFAULT_LIMITS: Readonly<QueryLimits> = Object.freeze({\n memoryMb: 256,\n spillMb: 256,\n threads: 2,\n timeMs: 30_000,\n inputBytes: 256 * 1024 * 1024,\n rows: 1000,\n resultBytes: 256 * 1024,\n});\nexport interface QueryRequest {\n bindings: { name: string; url?: string; urls?: string[] }[];\n sql: string;\n limits: QueryLimits;\n /** Local test harness only; not an MCP/CLI argument. */\n loopbackTest?: boolean;\n}\nexport interface QueryResult {\n columns: string[];\n rows: unknown[][];\n truncated: boolean;\n complete: boolean;\n downloadedBytes: number;\n resultBytes: number;\n}\n\nexport async function queryFiles(\n request: QueryRequest,\n signal?: AbortSignal,\n download?: (binding: number, file: number, signal: AbortSignal) => Promise<Response>,\n): Promise<QueryResult> {\n if (signal?.aborted) throw new Error('Query cancelled');\n for (const value of Object.values(request.limits))\n if (!Number.isSafeInteger(value) || value <= 0) throw new Error('Invalid query limits');\n if (!request.bindings.length || request.bindings.length > 16 || request.sql.length > 100_000)\n throw new Error('Invalid query size or bindings');\n const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'farseer-pipeline-query-'));\n fs.chmodSync(directory, 0o700);\n const timeout = new AbortController();\n const querySignal = signal ? AbortSignal.any([signal, timeout.signal]) : timeout.signal;\n const cancelled = () => new Error(timeout.signal.aborted ? 'Query time limit exceeded' : 'Query cancelled');\n const timer = setTimeout(() => timeout.abort(), request.limits.timeMs);\n try {\n // The sandbox parent downloads through its authenticated backend connection. Only local\n // files reach the disposable SQL worker; it receives no credential or authenticated URL.\n const prepared = download\n ? await downloadQueryFiles(request, directory, (_address, binding, file) =>\n download(binding, file, querySignal),\n )\n : undefined;\n if (querySignal.aborted) throw cancelled();\n const worker = path.join(__dirname, 'queryWorker.js');\n const child = fork(worker, [], {\n stdio: ['ignore', 'ignore', 'ignore', 'ipc'],\n execArgv: [],\n // A laptop behind a TLS-inspecting proxy needs its extra CA for signed storage reads.\n env: {\n HOME: directory,\n TMPDIR: directory,\n LANG: 'en_US.UTF-8',\n ...(process.env.NODE_EXTRA_CA_CERTS ? { NODE_EXTRA_CA_CERTS: process.env.NODE_EXTRA_CA_CERTS } : {}),\n },\n });\n return await new Promise((resolve, reject) => {\n let outcome: { value?: QueryResult; error?: Error } | undefined;\n const finish = (next: typeof outcome) => {\n if (!outcome) {\n outcome = next;\n child.kill('SIGKILL');\n }\n };\n const cancel = () => finish({ error: cancelled() });\n querySignal.addEventListener('abort', cancel, { once: true });\n child.once('message', (message: any) =>\n finish(message.ok ? { value: message.result } : { error: new Error(message.error) }),\n );\n child.once('error', (error) => finish({ error }));\n child.once('exit', () => {\n querySignal.removeEventListener('abort', cancel);\n if (outcome?.value) resolve(outcome.value);\n else reject(outcome?.error ?? new Error('Query worker exited without a result'));\n });\n child.send({\n ...request,\n ...(prepared ? { bindings: request.bindings.map(({ name }) => ({ name })) } : {}),\n directory,\n prepared,\n });\n if (querySignal.aborted) cancel();\n });\n } catch (error) {\n if (querySignal.aborted) throw cancelled();\n throw error;\n } finally {\n clearTimeout(timer);\n fs.rmSync(directory, { recurs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ACA;AAAA,MACJ,CAAC;AACD,UAAI,YAAY,QAAS,QAAO;AAAA,IACpC,CAAC;AAAA,EACL,SAAS,OAAO;AACZ,QAAI,YAAY,QAAS,OAAM,UAAU;AACzC,UAAM;AAAA,EACV,UAAE;AACE,iBAAa,KAAK;AAClB,OAAG,OAAO,WAAW,EAAE,WAAW,MAAM,OAAO,KAAK,CAAC;AAAA,EACzD;AACJ;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/pipeline/queryDownloads.ts"],
4
- "sourcesContent": ["import * as fs from 'fs';\nimport * as path from 'path';\nimport type { QueryRequest } from './query';\n\nexport interface QueryFiles {\n groups: string[][];\n downloadedBytes: number;\n}\n\n/** Shared byte limits for direct signed downloads and authenticated backend downloads. */\nexport async function downloadQueryFiles(\n request: QueryRequest,\n directory: string,\n download: (address: string, binding: number, file: number) => Promise<Response>,\n): Promise<QueryFiles> {\n let downloadedBytes = 0;\n let fileCount = 0;\n const groups: string[][] = [];\n for (const [index, binding] of request.bindings.entries()) {\n const group: string[] = [];\n groups.push(group);\n const urls = binding.urls ?? (binding.url ? [binding.url] : []);\n if (!urls.length || urls.length > 512) throw new Error('Unsupported version file count');\n for (const [fileIndex, address] of urls.entries()) {\n const response = await download(address, index, fileIndex);\n if (!response.ok || !response.body) {\n await response.body?.cancel();\n throw new Error(`Dataset read failed (${response.status}); retry as a new query`);\n }\n const file = path.join(directory, `${fileCount++}.parquet`);\n const handle = await fs.promises.open(file, 'wx', 0o600);\n try {\n for await (const chunk of response.body as any) {\n downloadedBytes += chunk.byteLength;\n if (downloadedBytes > request.limits.inputBytes)\n throw new Error('Input download byte limit exceeded');\n await handle.write(chunk);\n }\n } finally {\n await handle.close();\n }\n group.push(file);\n }\n }\n return { groups, downloadedBytes };\n}\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAoB;AACpB,WAAsB;AAStB,eAAsB,mBAClB,SACA,WACA,UACmB;AACnB,MAAI,kBAAkB;AACtB,MAAI,YAAY;AAChB,QAAM,SAAqB,CAAC;AAC5B,aAAW,CAAC,OAAO,OAAO,KAAK,QAAQ,SAAS,QAAQ,GAAG;AACvD,UAAM,QAAkB,CAAC;AACzB,WAAO,KAAK,KAAK;AACjB,UAAM,OAAO,QAAQ,SAAS,QAAQ,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC;AAC7D,QAAI,CAAC,KAAK,UAAU,KAAK,SAAS,IAAK,OAAM,IAAI,MAAM,gCAAgC;AACvF,eAAW,CAAC,WAAW,OAAO,KAAK,KAAK,QAAQ,GAAG;AAC/C,YAAM,WAAW,MAAM,SAAS,SAAS,OAAO,SAAS;AACzD,UAAI,CAAC,SAAS,MAAM,CAAC,SAAS,MAAM;AAChC,cAAM,SAAS,MAAM,OAAO;AAC5B,cAAM,IAAI,MAAM,wBAAwB,SAAS,MAAM,yBAAyB;AAAA,MACpF;AACA,YAAM,OAAO,KAAK,KAAK,WAAW,GAAG,WAAW,UAAU;AAC1D,YAAM,SAAS,MAAM,GAAG,SAAS,KAAK,MAAM,MAAM,GAAK;AACvD,UAAI;AACA,yBAAiB,SAAS,SAAS,MAAa;AAC5C,6BAAmB,MAAM;AACzB,cAAI,kBAAkB,QAAQ,OAAO;AACjC,kBAAM,IAAI,MAAM,oCAAoC;AACxD,gBAAM,OAAO,MAAM,KAAK;AAAA,QAC5B;AAAA,MACJ,UAAE;AACE,cAAM,OAAO,MAAM;AAAA,MACvB;AACA,YAAM,KAAK,IAAI;AAAA,IACnB;AAAA,EACJ;AACA,SAAO,EAAE,QAAQ,gBAAgB;AACrC;",
6
5
  "names": []
7
6
  }
@@ -24,6 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  var import_node_api = require("@duckdb/node-api");
25
25
  var path = __toESM(require("path"));
26
26
  var import_queryDownloads = require("./queryDownloads");
27
+ var import_failStep = require("./failStep");
27
28
  const literal = (s) => `'${s.replace(/'/g, "''")}'`;
28
29
  process.once("message", async (request) => {
29
30
  const { directory, limits } = request;
@@ -54,6 +55,7 @@ process.once("message", async (request) => {
54
55
  `CREATE VIEW "${binding.name}" AS SELECT * FROM read_parquet([${groups[i].map(literal).join(",")}])`
55
56
  );
56
57
  }
58
+ await connection.run(import_failStep.FAIL_STEP_MACRO);
57
59
  await connection.run("SET lock_configuration = true");
58
60
  const statements = await connection.extractStatements(request.sql);
59
61
  if (statements.count !== 1) throw new Error("Exactly one SELECT query is supported");
@@ -87,7 +89,7 @@ process.once("message", async (request) => {
87
89
  }
88
90
  });
89
91
  } catch (error) {
90
- const message = String(error instanceof Error ? error.message : error).replace(/https?:\/\/[^\s'"<>]+/g, "[signed URL redacted]").split(directory).join("[query temp]");
92
+ const message = (0, import_failStep.failStepText)(String(error instanceof Error ? error.message : error)).replace(/https?:\/\/[^\s'"<>]+/g, "[signed URL redacted]").split(directory).join("[query temp]");
91
93
  process.send?.({ ok: false, error: message.slice(0, 2e3) });
92
94
  } finally {
93
95
  process.disconnect();
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/pipeline/queryWorker.ts"],
4
- "sourcesContent": ["// Runs in a disposable child process. No tenant token or user environment is inherited.\nimport { DuckDBInstance, StatementType } from '@duckdb/node-api';\nimport * as path from 'path';\nimport type { QueryRequest } from './query';\nimport { downloadQueryFiles, type QueryFiles } from './queryDownloads';\n\nconst literal = (s: string) => `'${s.replace(/'/g, \"''\")}'`;\nprocess.once('message', async (request: QueryRequest & { directory: string; prepared?: QueryFiles }) => {\n const { directory, limits } = request;\n try {\n const { groups, downloadedBytes } =\n request.prepared ??\n (await downloadQueryFiles(request, directory, async (address) => {\n const url = new URL(address);\n if (\n url.protocol !== 'https:' &&\n !(request.loopbackTest && url.protocol === 'http:' && url.hostname === '127.0.0.1')\n ) {\n throw new Error('Signed access must use HTTPS');\n }\n // One fixed grant, no credential forwarding, redirects or automatic rebinding.\n return fetch(url, { redirect: 'error' });\n }));\n const files = groups.flat();\n const db = await DuckDBInstance.create(':memory:', {\n memory_limit: `${limits.memoryMb}MB`,\n threads: String(limits.threads),\n temp_directory: path.join(directory, 'spill'),\n max_temp_directory_size: `${limits.spillMb}MB`,\n autoinstall_known_extensions: 'false',\n autoload_known_extensions: 'false',\n allow_unsigned_extensions: 'false',\n });\n const connection = await db.connect();\n await connection.run(`SET allowed_paths = [${files.map(literal).join(',')}]`);\n await connection.run('SET enable_external_access = false');\n for (const [i, binding] of request.bindings.entries()) {\n if (!/^[a-zA-Z_][a-zA-Z0-9_]{0,62}$/.test(binding.name)) throw new Error('Invalid SQL binding name');\n await connection.run(\n `CREATE VIEW \"${binding.name}\" AS SELECT * FROM read_parquet([${groups[i].map(literal).join(',')}])`,\n );\n }\n await connection.run('SET lock_configuration = true');\n const statements = await connection.extractStatements(request.sql);\n if (statements.count !== 1) throw new Error('Exactly one SELECT query is supported');\n const prepared = await statements.prepare(0);\n if (prepared.statementType !== StatementType.SELECT) throw new Error('Only SELECT queries are supported');\n prepared.destroySync();\n // Streaming avoids materializing an unbounded result in JS. Timeout includes downloads.\n const result = await connection.stream(request.sql);\n const rows: unknown[][] = [];\n let bytes = 0;\n let truncated = false;\n outer: for await (const chunk of result.yieldRowsJson()) {\n for (const row of chunk) {\n const size = Buffer.byteLength(JSON.stringify(row));\n if (rows.length >= limits.rows || bytes + size > limits.resultBytes) {\n truncated = true;\n break outer;\n }\n rows.push(row);\n bytes += size;\n }\n }\n process.send?.({\n ok: true,\n result: {\n columns: result.columnNames(),\n rows,\n truncated,\n complete: !truncated,\n downloadedBytes,\n resultBytes: bytes,\n },\n });\n } catch (error) {\n const message = String(error instanceof Error ? error.message : error)\n .replace(/https?:\\/\\/[^\\s'\"<>]+/g, '[signed URL redacted]')\n .split(directory)\n .join('[query temp]');\n process.send?.({ ok: false, error: message.slice(0, 2000) });\n } finally {\n process.disconnect();\n }\n});\n"],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E;AACE,YAAQ,WAAW;AAAA,EACvB;AACJ,CAAC;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/pipeline/readiness.ts"],
4
- "sourcesContent": ["import { boundedPipelineCall, pipelineRequestSignal } from './requests';\n\n/** Probe one fixed grant without tenant credentials, redirects, or a full download. */\nexport async function probeParquetAccess(address: string): Promise<void> {\n if (new URL(address).protocol !== 'https:') throw new Error('Signed read access must use HTTPS');\n await probeParquetPrefix((signal) =>\n fetch(address, {\n headers: { Range: 'bytes=0-3' },\n redirect: 'error',\n signal,\n }),\n );\n}\n\n/** Read a file's first four bytes, confirm the Parquet magic number, and stop the download there. */\nexport async function probeParquetPrefix(open: (signal: AbortSignal) => Promise<Response>): Promise<void> {\n await boundedPipelineCall(async () => {\n // boundedPipelineCall always sets the request signal.\n const response = await open(pipelineRequestSignal()!);\n if (!response.ok || !response.body) {\n await response.body?.cancel();\n throw new Error(`Read probe failed (${response.status})`);\n }\n const reader = response.body.getReader();\n const prefix: number[] = [];\n try {\n while (prefix.length < 4) {\n const next = await reader.read();\n if (next.done) break;\n prefix.push(...next.value.subarray(0, 4 - prefix.length));\n }\n if (Buffer.from(prefix).toString('ascii') !== 'PAR1') throw new Error('Probed file is not Parquet');\n } finally {\n await reader.cancel(); // Also stops servers that ignore Range, as the API's file route does.\n }\n });\n}\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA2D;AAG3D,eAAsB,mBAAmB,SAAgC;AACrE,MAAI,IAAI,IAAI,OAAO,EAAE,aAAa,SAAU,OAAM,IAAI,MAAM,mCAAmC;AAC/F,QAAM;AAAA,IAAmB,CAAC,WACtB,MAAM,SAAS;AAAA,MACX,SAAS,EAAE,OAAO,YAAY;AAAA,MAC9B,UAAU;AAAA,MACV;AAAA,IACJ,CAAC;AAAA,EACL;AACJ;AAGA,eAAsB,mBAAmB,MAAiE;AACtG,YAAM,qCAAoB,YAAY;AAElC,UAAM,WAAW,MAAM,SAAK,uCAAsB,CAAE;AACpD,QAAI,CAAC,SAAS,MAAM,CAAC,SAAS,MAAM;AAChC,YAAM,SAAS,MAAM,OAAO;AAC5B,YAAM,IAAI,MAAM,sBAAsB,SAAS,MAAM,GAAG;AAAA,IAC5D;AACA,UAAM,SAAS,SAAS,KAAK,UAAU;AACvC,UAAM,SAAmB,CAAC;AAC1B,QAAI;AACA,aAAO,OAAO,SAAS,GAAG;AACtB,cAAM,OAAO,MAAM,OAAO,KAAK;AAC/B,YAAI,KAAK,KAAM;AACf,eAAO,KAAK,GAAG,KAAK,MAAM,SAAS,GAAG,IAAI,OAAO,MAAM,CAAC;AAAA,MAC5D;AACA,UAAI,OAAO,KAAK,MAAM,EAAE,SAAS,OAAO,MAAM,OAAQ,OAAM,IAAI,MAAM,4BAA4B;AAAA,IACtG,UAAE;AACE,YAAM,OAAO,OAAO;AAAA,IACxB;AAAA,EACJ,CAAC;AACL;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/pipeline/reference.ts"],
4
- "sourcesContent": ["import reference from './generated-reference.json';\nimport { PIPELINE_GUIDE, PIPELINE_PRACTICES } from './guide';\nimport { CLI_VERSION } from '../utils/constants';\nimport { inAgentSandbox } from '../utils/agentSandbox';\n\n/** The engine line (major.minor) this CLI's grammar describes. Patch releases keep the grammar. */\nexport const PIPELINE_ENGINE_PROFILE = reference.engineProfile;\n\nexport interface EngineReport {\n /** Engine version the run reported at startup, or null when no start marker was inspected. */\n ran: string | null;\n /** Engine line (major.minor) this CLI's bundled grammar describes. */\n expected: string;\n status: 'match' | 'mismatch' | 'unobserved';\n}\n\n/** Compare the engine line a run actually started on against the one this CLI's grammar describes. */\nexport function engineReport(observations: Record<string, unknown>[]): EngineReport {\n const expected = PIPELINE_ENGINE_PROFILE;\n const started = observations.find((o) => o.event === 'pipeline_started');\n const ran = typeof started?.version === 'string' ? started.version : null;\n if (ran === null) return { ran, expected, status: 'unobserved' };\n const line = ran.split('.').slice(0, 2).join('.');\n return { ran, expected, status: line === expected ? 'match' : 'mismatch' };\n}\n// An agent sandbox's CLI is part of its image and the sandbox cannot reach npm; a conversation keeps\n// its image, so only a new chat (on the deployment's current image) can bring a newer CLI.\nexport const CLI_UPDATE_INSTRUCTION = inAgentSandbox()\n ? \"This chat's CLI comes with its sandbox and cannot be updated here; do not try to install one. Tell the user that a new chat starts with the newest CLI this deployment provides, and that if it is still too old, a Labs admin must update the sandbox image.\"\n : 'Update to the latest compatible CLI: npm install -g farseer-cli@latest. Restart the MCP connection in your AI client after updating. Until the matching CLI is published, install the build supplied by the setup owner.';\n\nexport function pipelineGuide(topic = 'method'): string {\n const header =\n `Pipeline authoring reference: engine ${reference.engineVersion}; CLI ${CLI_VERSION}.\\n` +\n 'This is the bundled reference for the prepared pipeline runtime; the engine was not detected from a job.\\n\\n';\n if (topic === 'method')\n return (\n header +\n PIPELINE_GUIDE +\n '\\nRead topic=\"grammar\" for the generated YAML reference, then request the model names it links to.\\n' +\n CLI_UPDATE_INSTRUCTION\n );\n if (topic === 'practices') return header + PIPELINE_PRACTICES;\n const topics: Record<string, string> = reference.topics;\n if (topic === 'grammar')\n return (\n header +\n reference.notice +\n '\\n\\n' +\n topics.DatasetDefinition +\n '\\nAvailable topics (use their exact names as topic):\\n' +\n Object.keys(topics).join(', ')\n );\n if (!Object.prototype.hasOwnProperty.call(topics, topic))\n throw new Error(`Unknown guide topic \"${topic}\". Read topic=\"grammar\" to list supported model names.`);\n return header + reference.notice + '\\n\\n' + topics[topic];\n}\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAAsB;AACtB,mBAAmD;AACnD,uBAA4B;AAC5B,0BAA+B;AAGxB,MAAM,0BAA0B,2BAAAA,QAAU;AAW1C,SAAS,aAAa,cAAuD;AAChF,QAAM,WAAW;AACjB,QAAM,UAAU,aAAa,KAAK,CAAC,MAAM,EAAE,UAAU,kBAAkB;AACvE,QAAM,MAAM,OAAO,SAAS,YAAY,WAAW,QAAQ,UAAU;AACrE,MAAI,QAAQ,KAAM,QAAO,EAAE,KAAK,UAAU,QAAQ,aAAa;AAC/D,QAAM,OAAO,IAAI,MAAM,GAAG,EAAE,MAAM,GAAG,CAAC,EAAE,KAAK,GAAG;AAChD,SAAO,EAAE,KAAK,UAAU,QAAQ,SAAS,WAAW,UAAU,WAAW;AAC7E;AAGO,MAAM,6BAAyB,oCAAe,IAC/C,kQACA;AAEC,SAAS,cAAc,QAAQ,UAAkB;AACpD,QAAM,SACF,wCAAwC,2BAAAA,QAAU,aAAa,SAAS,4BAAW;AAAA;AAAA;AAAA;AAEvF,MAAI,UAAU;AACV,WACI,SACA,8BACA,yGACA;AAER,MAAI,UAAU,YAAa,QAAO,SAAS;AAC3C,QAAM,SAAiC,2BAAAA,QAAU;AACjD,MAAI,UAAU;AACV,WACI,SACA,2BAAAA,QAAU,SACV,SACA,OAAO,oBACP,2DACA,OAAO,KAAK,MAAM,EAAE,KAAK,IAAI;AAErC,MAAI,CAAC,OAAO,UAAU,eAAe,KAAK,QAAQ,KAAK;AACnD,UAAM,IAAI,MAAM,wBAAwB,KAAK,wDAAwD;AACzG,SAAO,SAAS,2BAAAA,QAAU,SAAS,SAAS,OAAO,KAAK;AAC5D;",
6
5
  "names": ["reference"]
7
6
  }
@@ -21,7 +21,6 @@ __export(requests_exports, {
21
21
  PIPELINE_REQUEST_TIMEOUT_MS: () => PIPELINE_REQUEST_TIMEOUT_MS,
22
22
  boundedPipelineCall: () => boundedPipelineCall,
23
23
  boundedPipelineClient: () => boundedPipelineClient,
24
- pausePipelineDeadlines: () => pausePipelineDeadlines,
25
24
  pipelineFetch: () => pipelineFetch,
26
25
  pipelineRequestSignal: () => pipelineRequestSignal,
27
26
  withPipelineRequests: () => withPipelineRequests
@@ -42,50 +41,24 @@ function pipelineRequestSignal(existing) {
42
41
  function pipelineFetch(fetcher = (...args) => fetch(...args)) {
43
42
  return (input, init) => fetcher(input, { ...init, signal: pipelineRequestSignal(init?.signal) });
44
43
  }
45
- function pausePipelineDeadlines() {
46
- const resume = [];
47
- for (let current = context.getStore(); current; current = current.parent)
48
- if (current.pause) resume.push(current.pause());
49
- return () => resume.forEach((fn) => fn());
50
- }
51
44
  async function boundedPipelineCall(fn) {
52
45
  const parent = context.getStore();
53
46
  const controller = new AbortController();
54
47
  const signal = parent?.signal ? AbortSignal.any([parent.signal, controller.signal]) : controller.signal;
55
48
  signal.throwIfAborted();
56
49
  const timeoutMs = parent?.timeoutMs ?? PIPELINE_REQUEST_TIMEOUT_MS;
57
- let remaining = timeoutMs;
58
- let started = Date.now();
59
- let pauses = 0;
60
- let finished = false;
61
- const startTimer = () => setTimeout(
50
+ const timer = setTimeout(
62
51
  () => controller.abort(
63
52
  new Error(
64
53
  "Pipeline request timed out. A write may have been accepted; inspect its outcome before retrying."
65
54
  )
66
55
  ),
67
- remaining
56
+ timeoutMs
68
57
  );
69
- let timer = startTimer();
70
- const pause = () => {
71
- if (pauses++ === 0) {
72
- clearTimeout(timer);
73
- remaining = Math.max(0, remaining - (Date.now() - started));
74
- }
75
- let resumed = false;
76
- return () => {
77
- if (resumed) return;
78
- resumed = true;
79
- if (--pauses === 0 && !finished) {
80
- started = Date.now();
81
- timer = startTimer();
82
- }
83
- };
84
- };
85
58
  let cancel = () => void 0;
86
59
  try {
87
60
  return await Promise.race([
88
- context.run({ signal, timeoutMs, parent, pause }, fn),
61
+ context.run({ signal, timeoutMs }, fn),
89
62
  new Promise((_, reject) => {
90
63
  cancel = () => reject(signal.reason);
91
64
  signal.addEventListener("abort", cancel, { once: true });
@@ -93,7 +66,6 @@ async function boundedPipelineCall(fn) {
93
66
  })
94
67
  ]);
95
68
  } finally {
96
- finished = true;
97
69
  clearTimeout(timer);
98
70
  signal.removeEventListener("abort", cancel);
99
71
  }
@@ -114,7 +86,6 @@ function boundedPipelineClient(client) {
114
86
  PIPELINE_REQUEST_TIMEOUT_MS,
115
87
  boundedPipelineCall,
116
88
  boundedPipelineClient,
117
- pausePipelineDeadlines,
118
89
  pipelineFetch,
119
90
  pipelineRequestSignal,
120
91
  withPipelineRequests
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/pipeline/requests.ts"],
4
- "sourcesContent": ["import { AsyncLocalStorage } from 'async_hooks';\n\nexport const PIPELINE_REQUEST_TIMEOUT_MS = 30_000;\ntype RequestContext = { signal?: AbortSignal; timeoutMs: number; parent?: RequestContext; pause?: () => () => void };\nconst context = new AsyncLocalStorage<RequestContext>();\n\n// Only pipeline operations opt in. SDK helpers and authentication share their caller's\n// cancellation without changing the rest of the CLI's networking policy.\nexport function withPipelineRequests<T>(\n fn: () => Promise<T>,\n signal?: AbortSignal,\n timeoutMs = PIPELINE_REQUEST_TIMEOUT_MS,\n) {\n signal?.throwIfAborted();\n return context.run({ signal, timeoutMs }, fn);\n}\n\nexport function pipelineRequestSignal(existing?: AbortSignal | null): AbortSignal | undefined {\n const signal = context.getStore()?.signal;\n signal?.throwIfAborted();\n return signal && existing ? AbortSignal.any([signal, existing]) : (signal ?? existing ?? undefined);\n}\n\nexport function pipelineFetch(fetcher: typeof fetch = (...args) => fetch(...args)): typeof fetch {\n return (input, init) => fetcher(input, { ...init, signal: pipelineRequestSignal(init?.signal) });\n}\n\n/** Human approval is not network time. Cancellation and the turn's own deadline still apply. */\nexport function pausePipelineDeadlines(): () => void {\n const resume: (() => void)[] = [];\n for (let current = context.getStore(); current; current = current.parent)\n if (current.pause) resume.push(current.pause());\n return () => resume.forEach((fn) => fn());\n}\n\nexport async function boundedPipelineCall<T>(fn: () => Promise<T>): Promise<T> {\n const parent = context.getStore();\n const controller = new AbortController();\n const signal = parent?.signal ? AbortSignal.any([parent.signal, controller.signal]) : controller.signal;\n signal.throwIfAborted();\n const timeoutMs = parent?.timeoutMs ?? PIPELINE_REQUEST_TIMEOUT_MS;\n let remaining = timeoutMs;\n let started = Date.now();\n let pauses = 0;\n let finished = false;\n const startTimer = () =>\n setTimeout(\n () =>\n controller.abort(\n new Error(\n 'Pipeline request timed out. A write may have been accepted; inspect its outcome before retrying.',\n ),\n ),\n remaining,\n );\n let timer = startTimer();\n const pause = () => {\n if (pauses++ === 0) {\n clearTimeout(timer);\n remaining = Math.max(0, remaining - (Date.now() - started));\n }\n let resumed = false;\n return () => {\n if (resumed) return;\n resumed = true;\n if (--pauses === 0 && !finished) {\n started = Date.now();\n timer = startTimer();\n }\n };\n };\n let cancel: () => void = () => undefined;\n try {\n // The signal aborts real HTTP I/O. The race also bounds legacy helpers\n // which swallow errors or wait for a shared authentication refresh.\n return await Promise.race([\n context.run({ signal, timeoutMs, parent, pause }, fn),\n new Promise<never>((_, reject) => {\n cancel = () => reject(signal.reason);\n signal.addEventListener('abort', cancel, { once: true });\n if (signal.aborted) cancel();\n }),\n ]);\n } finally {\n finished = true;\n clearTimeout(timer);\n signal.removeEventListener('abort', cancel);\n }\n}\n\nexport function boundedPipelineClient<T extends object>(client: T): T {\n const synchronous = new Set(['updateAccessToken', 'isTextFile', 'isBinaryFile']);\n return new Proxy(client, {\n get(target, key) {\n const value = Reflect.get(target, key);\n if (typeof value !== 'function') return value;\n const call = (...args: unknown[]) => value.apply(target, args);\n return synchronous.has(String(key))\n ? call\n : (...args: unknown[]) => boundedPipelineCall(() => call(...args));\n },\n });\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAkC;AAE3B,MAAM,8BAA8B;AAE3C,MAAM,UAAU,IAAI,qCAAkC;AAI/C,SAAS,qBACZ,IACA,QACA,YAAY,6BACd;AACE,UAAQ,eAAe;AACvB,SAAO,QAAQ,IAAI,EAAE,QAAQ,UAAU,GAAG,EAAE;AAChD;A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C,qBAAqB,cAAc,cAAc,CAAC;AAC/E,SAAO,IAAI,MAAM,QAAQ;AAAA,IACrB,IAAI,QAAQ,KAAK;AACb,YAAM,QAAQ,QAAQ,IAAI,QAAQ,GAAG;AACrC,UAAI,OAAO,UAAU,WAAY,QAAO;AACxC,YAAM,OAAO,IAAI,SAAoB,MAAM,MAAM,QAAQ,IAAI;AAC7D,aAAO,YAAY,IAAI,OAAO,GAAG,CAAC,IAC5B,OACA,IAAI,SAAoB,oBAAoB,MAAM,KAAK,GAAG,IAAI,CAAC;AAAA,IACzE;AAAA,EACJ,CAAC;AACL;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/pipeline/runArguments.ts"],
4
- "sourcesContent": ["import type { AppArgument } from '../services/apps';\nimport { PipelineError } from './errors';\n\n/**\n * Run arguments by name. The backend takes a run's arguments by position, in the order the job\n * declares them, and an empty slot keeps that argument's default. A positional value an author\n * meant for a later argument therefore lands silently in the first one, which may be a secret.\n * So the CLI and the MCP tool take `NAME=value` entries only, and this builds the positional list.\n */\nexport function resolveRunArguments(\n declared: readonly AppArgument[],\n entries: readonly string[],\n): { positional: string[]; given: Record<string, string> } {\n const byName = new Map(declared.map((a) => [a.name, a]));\n const values = new Map<string, string>();\n for (const entry of entries) {\n const at = entry.indexOf('=');\n if (at <= 0)\n throw refused(\n declared,\n `Run argument \"${entry}\" must be NAME=value, naming one of this job's arguments (${names(declared)}).`,\n );\n const name = entry.slice(0, at);\n const argument = byName.get(name);\n if (!argument)\n throw refused(declared, `${name} is not an argument of this job. Its arguments are: ${names(declared)}.`);\n if (argument.fixed) throw refused(declared, `${name} is fixed on this job, so a run cannot change it.`);\n if (values.has(name)) throw refused(declared, `${name} is given twice.`);\n const value = entry.slice(at + 1);\n if (value === '')\n throw refused(\n declared,\n `${name} cannot be empty: the backend runs an empty value with the argument's default. Leave ${name} out to keep its default, or give it a value.`,\n );\n values.set(name, value);\n }\n const given: Record<string, string> = {};\n for (const [name, value] of values) given[name] = byName.get(name)?.secret ? '****' : value;\n return { positional: declared.map((a) => values.get(a.name) ?? ''), given };\n}\n\nfunction refused(declared: readonly AppArgument[], message: string): PipelineError {\n return new PipelineError(\n 'refused',\n 'INVALID_ARGUMENTS',\n message,\n `Pass job arguments as NAME=value, naming only this job's arguments (${names(declared)}); nothing was submitted.`,\n );\n}\n\nfunction names(declared: readonly AppArgument[]): string {\n return declared.length ? declared.map((a) => a.name).join(', ') : 'none';\n}\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAA8B;AAQvB,SAAS,oBACZ,UACA,SACuD;AACvD,QAAM,SAAS,IAAI,IAAI,SAAS,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AACvD,QAAM,SAAS,oBAAI,IAAoB;AACvC,aAAW,SAAS,SAAS;AACzB,UAAM,KAAK,MAAM,QAAQ,GAAG;AAC5B,QAAI,MAAM;AACN,YAAM;AAAA,QACF;AAAA,QACA,iBAAiB,KAAK,6DAA6D,MAAM,QAAQ,CAAC;AAAA,MACtG;AACJ,UAAM,OAAO,MAAM,MAAM,GAAG,EAAE;AAC9B,UAAM,WAAW,OAAO,IAAI,IAAI;AAChC,QAAI,CAAC;AACD,YAAM,QAAQ,UAAU,GAAG,IAAI,uDAAuD,MAAM,QAAQ,CAAC,GAAG;AAC5G,QAAI,SAAS,MAAO,OAAM,QAAQ,UAAU,GAAG,IAAI,mDAAmD;AACtG,QAAI,OAAO,IAAI,IAAI,EAAG,OAAM,QAAQ,UAAU,GAAG,IAAI,kBAAkB;AACvE,UAAM,QAAQ,MAAM,MAAM,KAAK,CAAC;AAChC,QAAI,UAAU;AACV,YAAM;AAAA,QACF;AAAA,QACA,GAAG,IAAI,wFAAwF,IAAI;AAAA,MACvG;AACJ,WAAO,IAAI,MAAM,KAAK;AAAA,EAC1B;AACA,QAAM,QAAgC,CAAC;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