@beehexa/hexasync-ai-toolkit 2611.14.1 → 2612.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +2 -2
- package/.codex-plugin/plugin.json +3 -4
- package/.cursor-plugin/plugin.json +3 -4
- package/README.md +5 -74
- package/dist/cli.js +15 -2070
- package/gemini-extension.json +2 -11
- package/openclaw.extension.mjs +2 -3
- package/openclaw.plugin.json +2 -2
- package/package.json +3 -4
- package/plugin.json +3 -4
- package/skills/hexasync-connections/SKILL.md +10 -25
- package/skills/hexasync-connections/references/INDEX.md +4 -4
- package/skills/hexasync-connections/references/INSTALL.md +5 -48
- package/skills/hexasync-connections/references/connections.CONNECTIONS.api-recovery.md +1 -1
- package/skills/hexasync-connections/references/connections.CONNECTIONS.captured-call-and-authenticated-composition.md +2 -2
- package/skills/hexasync-connections/references/connections.CONNECTIONS.framework-understood-connection-option-catalogue.md +2 -2
- package/skills/hexasync-connections/references/connections.CONNECTIONS.how-a-step-finds-its-connection.md +2 -2
- package/skills/hexasync-connections/references/connections.CONNECTIONS.md +1 -1
- package/skills/hexasync-connections/references/connections.CONNECTIONS.one-connection-one-credential-scope.md +2 -2
- package/skills/hexasync-connections/references/connections.CONNECTIONS.related.md +5 -5
- package/skills/hexasync-connections/references/connections.CONNECTIONS.the-self-connector.md +1 -1
- package/skills/hexasync-connections/references/frontend.FRONTEND-FLOWS.api_proxy.md +94 -0
- package/skills/hexasync-connections/references/frontend.FRONTEND-FLOWS.expressions-and-tooling.md +2 -2
- package/skills/hexasync-connections/references/frontend.FRONTEND-FLOWS.fail.md +1 -1
- package/skills/hexasync-connections/references/frontend.FRONTEND-FLOWS.frontend-step-fields.md +2 -2
- package/skills/hexasync-connections/references/frontend.FRONTEND-FLOWS.md +1 -1
- package/skills/hexasync-connections/references/frontend.FRONTEND-FLOWS.preview-and-source-navigation.md +3 -3
- package/skills/hexasync-connections/references/frontend.FRONTEND-FLOWS.task-and-reference-data-changes.md +1 -1
- package/skills/hexasync-error-handling/SKILL.md +9 -16
- package/skills/hexasync-error-handling/references/INDEX.md +1 -1
- package/skills/hexasync-error-handling/references/INSTALL.md +5 -48
- package/skills/hexasync-error-handling/references/routing.NEXT.md +10 -10
- package/skills/hexasync-error-handling/references/steps.EXCEPTION.md +5 -5
- package/skills/hexasync-error-handling/references/steps.Error.md +8 -8
- package/skills/hexasync-expressions/SKILL.md +10 -25
- package/skills/hexasync-expressions/references/INDEX.md +3 -3
- package/skills/hexasync-expressions/references/INSTALL.md +5 -48
- package/skills/hexasync-expressions/references/expressions.CONTEXT-AND-IO.arguments--computed-before-the-step-runs.md +1 -1
- package/skills/hexasync-expressions/references/expressions.CONTEXT-AND-IO.dialect-classification-and-silent-scriban-fallback.md +2 -2
- package/skills/hexasync-expressions/references/expressions.CONTEXT-AND-IO.exact-mutation-timeline.md +4 -4
- package/skills/hexasync-expressions/references/expressions.CONTEXT-AND-IO.executor-results-are-not-downstream-values.md +2 -2
- package/skills/hexasync-expressions/references/expressions.CONTEXT-AND-IO.graceful-failures-and-run-errors.md +1 -1
- package/skills/hexasync-expressions/references/expressions.CONTEXT-AND-IO.jsonata-call-site-scope-and-bindings.md +17 -17
- package/skills/hexasync-expressions/references/expressions.CONTEXT-AND-IO.jsonata-engine-pinned-version-and-restrictions.md +1 -1
- package/skills/hexasync-expressions/references/expressions.CONTEXT-AND-IO.jsonpath-expressions.md +2 -2
- package/skills/hexasync-expressions/references/expressions.CONTEXT-AND-IO.related.md +1 -1
- package/skills/hexasync-expressions/references/expressions.CONTEXT-AND-IO.runtime-scope.md +10 -10
- package/skills/hexasync-expressions/references/expressions.CONTEXT-AND-IO.scriban-default-and-host-custom-builtins.host-qualified-authoring-examples.md +2 -2
- package/skills/hexasync-expressions/references/frontend.FRONTEND-FLOWS.api_proxy.md +94 -0
- package/skills/hexasync-expressions/references/frontend.FRONTEND-FLOWS.expressions-and-tooling.md +2 -2
- package/skills/hexasync-expressions/references/frontend.FRONTEND-FLOWS.fail.md +1 -1
- package/skills/hexasync-expressions/references/frontend.FRONTEND-FLOWS.frontend-step-fields.md +2 -2
- package/skills/hexasync-expressions/references/frontend.FRONTEND-FLOWS.md +1 -1
- package/skills/hexasync-expressions/references/frontend.FRONTEND-FLOWS.preview-and-source-navigation.md +3 -3
- package/skills/hexasync-expressions/references/frontend.FRONTEND-FLOWS.task-and-reference-data-changes.md +1 -1
- package/skills/hexasync-expressions/references/steps.JSONata.md +8 -8
- package/skills/hexasync-expressions/references/steps.Liquid.md +2 -2
- package/skills/hexasync-expressions/references/steps.Scriban.md +9 -9
- package/skills/hexasync-field-mapping/SKILL.md +13 -19
- package/skills/hexasync-field-mapping/references/INDEX.md +2 -2
- package/skills/hexasync-field-mapping/references/INSTALL.md +5 -48
- package/skills/hexasync-field-mapping/references/steps.SAVE_TASK_DATA.md +19 -19
- package/skills/hexasync-field-mapping/references/tables.TABLES.best-practices.md +1 -1
- package/skills/hexasync-field-mapping/references/tables.TABLES.fields.md +1 -1
- package/skills/hexasync-field-mapping/references/tables.TABLES.md +1 -1
- package/skills/hexasync-field-mapping/references/tables.TABLES.minimal-declaration-and-composed-usage.md +1 -1
- package/skills/hexasync-field-mapping/references/tables.TABLES.related.md +5 -5
- package/skills/hexasync-field-mapping/references/tables.TABLES.the-system-columns-are-not-declared-here.md +1 -1
- package/skills/hexasync-field-mapping/references/transformations.TRANSFORMATIONS.puller-mapping-transformations.md +1 -1
- package/skills/hexasync-field-mapping/references/transformations.TRANSFORMATIONS.related.md +6 -6
- package/skills/hexasync-field-mapping/references/transformations.TRANSFORMATIONS.renamedependency--declared-but-unimplemented.md +1 -1
- package/skills/hexasync-field-mapping/references/transformations.TRANSFORMATIONS.transformation-types.jsonata--compute-a-field-from-a-jsonata-expression.md +1 -1
- package/skills/hexasync-field-mapping/references/transformations.TRANSFORMATIONS.transformation-types.query-argument-binding.md +2 -2
- package/skills/hexasync-field-mapping/references/transformations.TRANSFORMATIONS.transformation-types.query_single--the-dsl-replacement-for-sql.md +4 -4
- package/skills/hexasync-field-mapping/references/transformations.TRANSFORMATIONS.transformation-types.scriban--compute-a-field-from-a-scriban-expression.md +1 -1
- package/skills/hexasync-field-mapping/references/transformations.TRANSFORMATIONS.when-to-use.md +1 -1
- package/skills/hexasync-metrics-reports/SKILL.md +9 -16
- package/skills/hexasync-metrics-reports/references/INDEX.md +1 -1
- package/skills/hexasync-metrics-reports/references/INSTALL.md +5 -48
- package/skills/hexasync-metrics-reports/references/metrics.METRICS_REFERENCE.common-metadata-properties.md +1 -1
- package/skills/hexasync-metrics-reports/references/metrics.METRICS_REFERENCE.metric-configuration.md +1 -1
- package/skills/hexasync-metrics-reports/references/metrics.METRICS_REFERENCE.metric-kinds-reference.md +2 -2
- package/skills/hexasync-metrics-reports/references/metrics.METRICS_REFERENCE.related.md +4 -4
- package/skills/hexasync-metrics-reports/references/metrics.METRICS_REFERENCE.when-to-use.md +1 -1
- package/skills/hexasync-metrics-reports/references/reports.REPORTS.md +4 -4
- package/skills/hexasync-metrics-reports/references/steps.METRIC_QUERY.md +2 -2
- package/skills/hexasync-metrics-reports/references/steps.QUERY_METRICS.md +8 -8
- package/skills/hexasync-pullers/SKILL.md +11 -18
- package/skills/hexasync-pullers/references/INDEX.md +3 -3
- package/skills/hexasync-pullers/references/INSTALL.md +5 -48
- package/skills/hexasync-pullers/references/pullers.PULLERS.api-error-classification.md +3 -3
- package/skills/hexasync-pullers/references/pullers.PULLERS.entity-classification.md +1 -1
- package/skills/hexasync-pullers/references/pullers.PULLERS.entry-context-and-transitions.md +1 -1
- package/skills/hexasync-pullers/references/pullers.PULLERS.overview.md +2 -2
- package/skills/hexasync-pullers/references/pullers.PULLERS.page-termination-and-the-four-platform-guards.md +2 -2
- package/skills/hexasync-pullers/references/pullers.PULLERS.persistence-and-safe-full-pull-removal.md +2 -2
- package/skills/hexasync-pullers/references/pullers.PULLERS.placement-afterpullsteps.md +1 -1
- package/skills/hexasync-pullers/references/pullers.PULLERS.placement-beforepullsteps.md +1 -1
- package/skills/hexasync-pullers/references/pullers.PULLERS.placement-contracts.md +1 -1
- package/skills/hexasync-pullers/references/pullers.PULLERS.placement-onerrorsteps.md +2 -2
- package/skills/hexasync-pullers/references/pullers.PULLERS.placement-pullsteps.md +1 -1
- package/skills/hexasync-pullers/references/pullers.PULLERS.placement-steps.md +1 -1
- package/skills/hexasync-pullers/references/pullers.PULLERS.property-reference.md +6 -6
- package/skills/hexasync-pullers/references/pullers.PULLERS.puller-completeness-contract.md +6 -6
- package/skills/hexasync-pullers/references/pullers.PULLERS.related.md +7 -7
- package/skills/hexasync-pullers/references/pullers.PULLERS.the-resume-computation.md +2 -2
- package/skills/hexasync-pullers/references/pullers.PULLERS.the-webhook-vs-puller-division.md +1 -1
- package/skills/hexasync-pullers/references/pullers.PULLERS.two-puller-host-modes-not-two-workflow-constructs.md +2 -2
- package/skills/hexasync-pullers/references/pullers.PULLERS.watermark-trustworthiness.md +1 -1
- package/skills/hexasync-pullers/references/pullers.PULLERS.worked-example-new-kind-snapshot-pull.md +2 -2
- package/skills/hexasync-pullers/references/steps.PULLER.md +8 -8
- package/skills/hexasync-pushers/SKILL.md +20 -22
- package/skills/hexasync-pushers/references/INDEX.md +2 -2
- package/skills/hexasync-pushers/references/INSTALL.md +5 -48
- package/skills/hexasync-pushers/references/pushers.PUSHERS.association-transform-routing.md +1 -1
- package/skills/hexasync-pushers/references/pushers.PUSHERS.best-practices.md +3 -3
- package/skills/hexasync-pushers/references/pushers.PUSHERS.expression-roots-differ-from-a-puller.md +1 -1
- package/skills/hexasync-pushers/references/pushers.PUSHERS.fields.md +4 -4
- package/skills/hexasync-pushers/references/pushers.PUSHERS.four-step-phases.md +1 -1
- package/skills/hexasync-pushers/references/pushers.PUSHERS.indirect-pushers.md +2 -2
- package/skills/hexasync-pushers/references/pushers.PUSHERS.md +1 -1
- package/skills/hexasync-pushers/references/pushers.PUSHERS.minimal-configuration.md +2 -2
- package/skills/hexasync-pushers/references/pushers.PUSHERS.placement-beforepushsteps.md +2 -2
- package/skills/hexasync-pushers/references/pushers.PUSHERS.placement-contracts.md +3 -3
- package/skills/hexasync-pushers/references/pushers.PUSHERS.placement-finalsteps.md +2 -2
- package/skills/hexasync-pushers/references/pushers.PUSHERS.related.md +6 -6
- package/skills/hexasync-pushers/references/pushers.PUSHERS.resolution-ordering-locks-and-retries.md +4 -4
- package/skills/hexasync-pushers/references/pushers.PUSHERS.worked-example-direct-push-with-dependency.md +1 -1
- package/skills/hexasync-pushers/references/steps.PUSHER.md +8 -8
- package/skills/hexasync-pushers/references/steps.UPDATE_ITEM_STATUS.md +14 -14
- package/skills/hexasync-pushers/references/steps.UPDATE_ITEM_SYNC_PROCESS.md +13 -13
- package/skills/hexasync-query-dsl/SKILL.md +13 -17
- package/skills/hexasync-query-dsl/references/INDEX.md +1 -1
- package/skills/hexasync-query-dsl/references/INSTALL.md +5 -48
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.best-practice.md +1 -1
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.filter-dsl-language-contract.filter-composition.md +2 -2
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.filter-dsl-language-contract.filter-fields.md +1 -1
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.filter-dsl-language-contract.filter-predicates.md +1 -1
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.filter-dsl-language-contract.filter-request-envelope.md +2 -2
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.filter-dsl-language-contract.md +2 -2
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.operands.md +1 -1
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.operands.query-arguments.md +3 -3
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.operands.value-binding-and-casts.md +1 -1
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.operators.between-takes-a-range-not-an-operand.md +1 -1
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.operators.bitwise-predicates.md +4 -4
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.operators.last_int_unit-needs-format-on-the-left.md +3 -3
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.operators.membership-predicates.md +1 -1
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.operators.null-predicates-are-unary.md +5 -5
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.operators.regex-predicates-complete-scalar-postgresql-patterns.md +2 -2
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.operators.text-matching-six-predicates-scalar-patterns-and-value-lists.md +2 -2
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.operators.verbatim-scalar-comparisons.md +2 -2
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.runtime-rules-and-authoring-shape.md +4 -4
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.the-shape.builder-condition-tree.md +1 -1
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.the-shape.grouping-precedence-and-exact-parentheses.md +2 -2
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.the-shape.join-types.md +1 -1
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.the-shape.query-envelope.md +3 -3
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.troubleshooting-and-canonical-references.md +1 -1
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.when-to-use.md +1 -1
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.where-it-is-used.md +7 -7
- package/skills/hexasync-query-dsl/references/steps.QUERY_MANY.md +9 -9
- package/skills/hexasync-query-dsl/references/steps.QUERY_SINGLE.md +9 -9
- package/skills/hexasync-query-dsl/references/steps.SQL.md +12 -12
- package/skills/hexasync-query-dsl/references/steps.SQL_PROXY.md +9 -9
- package/skills/hexasync-startup-tasks-scheduling/SKILL.md +9 -16
- package/skills/hexasync-startup-tasks-scheduling/references/INDEX.md +3 -3
- package/skills/hexasync-startup-tasks-scheduling/references/INSTALL.md +5 -48
- package/skills/hexasync-startup-tasks-scheduling/references/startupTasks.STARTUP-TASKS.legacy-target-tasks.md +3 -3
- package/skills/hexasync-startup-tasks-scheduling/references/startupTasks.STARTUP-TASKS.metric-defaults.md +1 -1
- package/skills/hexasync-startup-tasks-scheduling/references/startupTasks.STARTUP-TASKS.related.md +5 -5
- package/skills/hexasync-startup-tasks-scheduling/references/startupTasks.STARTUP-TASKS.scheduler-metadata.md +6 -6
- package/skills/hexasync-startup-tasks-scheduling/references/startupTasks.STARTUP-TASKS.when-to-use.md +2 -2
- package/skills/hexasync-startup-tasks-scheduling/references/steps.ENQUEUER.md +9 -9
- package/skills/hexasync-steps-api-http/SKILL.md +20 -27
- package/skills/hexasync-steps-api-http/references/INDEX.md +4 -4
- package/skills/hexasync-steps-api-http/references/INSTALL.md +5 -48
- package/skills/hexasync-steps-api-http/references/frontend.FRONTEND-FLOWS.api_proxy.md +94 -0
- package/skills/hexasync-steps-api-http/references/frontend.FRONTEND-FLOWS.expressions-and-tooling.md +2 -2
- package/skills/hexasync-steps-api-http/references/frontend.FRONTEND-FLOWS.fail.md +1 -1
- package/skills/hexasync-steps-api-http/references/frontend.FRONTEND-FLOWS.frontend-step-fields.md +2 -2
- package/skills/hexasync-steps-api-http/references/frontend.FRONTEND-FLOWS.md +1 -1
- package/skills/hexasync-steps-api-http/references/frontend.FRONTEND-FLOWS.preview-and-source-navigation.md +3 -3
- package/skills/hexasync-steps-api-http/references/frontend.FRONTEND-FLOWS.task-and-reference-data-changes.md +1 -1
- package/skills/hexasync-steps-api-http/references/responseFilters.RESPONSE-FILTERS.best-practices.md +1 -1
- package/skills/hexasync-steps-api-http/references/responseFilters.RESPONSE-FILTERS.execution-order-and-shared-values.md +1 -1
- package/skills/hexasync-steps-api-http/references/responseFilters.RESPONSE-FILTERS.md +1 -1
- package/skills/hexasync-steps-api-http/references/responseFilters.RESPONSE-FILTERS.parsejson-boundary.md +2 -2
- package/skills/hexasync-steps-api-http/references/responseFilters.RESPONSE-FILTERS.related.md +1 -1
- package/skills/hexasync-steps-api-http/references/responseFilters.RESPONSE-FILTERS.same-name-different-placement-grammars.md +4 -4
- package/skills/hexasync-steps-api-http/references/routing.NEXT.md +7 -7
- package/skills/hexasync-steps-api-http/references/steps.API.api-pagination.md +1 -1
- package/skills/hexasync-steps-api-http/references/steps.API.contract.md +2 -2
- package/skills/hexasync-steps-api-http/references/steps.API.failure-handling.md +2 -2
- package/skills/hexasync-steps-api-http/references/steps.API.fields.md +1 -1
- package/skills/hexasync-steps-api-http/references/steps.API.related.md +4 -4
- package/skills/hexasync-steps-api-http/references/steps.INDEX.md +90 -90
- package/skills/hexasync-steps-api-http/references/steps.STEP-ENVELOPE._history--the-per-step-occurrence-ring.md +1 -1
- package/skills/hexasync-steps-api-http/references/steps.STEP-ENVELOPE.arguments-and-routing.md +2 -2
- package/skills/hexasync-steps-api-http/references/steps.STEP-ENVELOPE.best-practices.md +1 -1
- package/skills/hexasync-steps-api-http/references/steps.STEP-ENVELOPE.one-canonical-workflow-component.md +16 -16
- package/skills/hexasync-steps-api-http/references/steps.STEP-ENVELOPE.recovery-bypasses-and-connector-restart.md +1 -1
- package/skills/hexasync-steps-api-http/references/steps.STEP-ENVELOPE.related.md +1 -1
- package/skills/hexasync-steps-api-http/references/steps.STEP-ENVELOPE.shape.md +4 -4
- package/skills/hexasync-steps-control-data/SKILL.md +24 -30
- package/skills/hexasync-steps-control-data/references/INDEX.md +3 -3
- package/skills/hexasync-steps-control-data/references/INSTALL.md +5 -48
- package/skills/hexasync-steps-control-data/references/frontend.FRONTEND-FLOWS.api_proxy.md +94 -0
- package/skills/hexasync-steps-control-data/references/frontend.FRONTEND-FLOWS.expressions-and-tooling.md +2 -2
- package/skills/hexasync-steps-control-data/references/frontend.FRONTEND-FLOWS.fail.md +1 -1
- package/skills/hexasync-steps-control-data/references/frontend.FRONTEND-FLOWS.frontend-step-fields.md +2 -2
- package/skills/hexasync-steps-control-data/references/frontend.FRONTEND-FLOWS.md +1 -1
- package/skills/hexasync-steps-control-data/references/frontend.FRONTEND-FLOWS.preview-and-source-navigation.md +3 -3
- package/skills/hexasync-steps-control-data/references/frontend.FRONTEND-FLOWS.task-and-reference-data-changes.md +1 -1
- package/skills/hexasync-steps-control-data/references/steps.BASE64_TO_MIME_TYPE.md +3 -3
- package/skills/hexasync-steps-control-data/references/steps.Begin.md +3 -3
- package/skills/hexasync-steps-control-data/references/steps.CACHE.md +4 -4
- package/skills/hexasync-steps-control-data/references/steps.Composite.md +4 -4
- package/skills/hexasync-steps-control-data/references/steps.DIRECT_INDEX.md +12 -12
- package/skills/hexasync-steps-control-data/references/steps.DOWNLOAD_CSV.md +23 -23
- package/skills/hexasync-steps-control-data/references/steps.EXCEL_READER.md +7 -7
- package/skills/hexasync-steps-control-data/references/steps.End.md +4 -4
- package/skills/hexasync-steps-control-data/references/steps.GET_KEY_VALUE.md +6 -6
- package/skills/hexasync-steps-control-data/references/steps.GraphQL.md +7 -7
- package/skills/hexasync-steps-control-data/references/steps.IF.md +12 -12
- package/skills/hexasync-steps-control-data/references/steps.IGNORE_ITEM.md +7 -7
- package/skills/hexasync-steps-control-data/references/steps.INDEX.md +48 -48
- package/skills/hexasync-steps-control-data/references/steps.INVALIDATE_CACHE.md +2 -2
- package/skills/hexasync-steps-control-data/references/steps.LOOKUP_STEP.md +8 -8
- package/skills/hexasync-steps-control-data/references/steps.OData.md +4 -4
- package/skills/hexasync-steps-control-data/references/steps.PUBLISH_EVENT.md +5 -5
- package/skills/hexasync-steps-control-data/references/steps.QueryDSL.md +3 -3
- package/skills/hexasync-steps-control-data/references/steps.REMOVE_DATA.md +7 -7
- package/skills/hexasync-steps-control-data/references/steps.RESET_ITEM.md +12 -12
- package/skills/hexasync-steps-control-data/references/steps.RESOLVE_RAW_DATA.md +11 -11
- package/skills/hexasync-steps-control-data/references/steps.Restful.md +6 -6
- package/skills/hexasync-steps-control-data/references/steps.SEED_DATA.md +10 -10
- package/skills/hexasync-steps-control-data/references/steps.SET_KEY_VALUE.md +7 -7
- package/skills/hexasync-steps-control-data/references/steps.SLEEP.md +8 -8
- package/skills/hexasync-steps-control-data/references/steps.SWITCH.md +12 -12
- package/skills/hexasync-steps-control-data/references/steps.TRACK_FOR_REMOVAL.md +12 -12
- package/skills/hexasync-steps-control-data/references/steps.UPDATE_TASK_DATA_STATUS.md +13 -13
- package/skills/hexasync-steps-control-data/references/steps.VALUES.md +12 -12
- package/skills/hexasync-steps-control-data/references/steps.VERIFY_CACHED.md +5 -5
- package/skills/hexasync-steps-control-data/references/steps.cURL.md +8 -8
- package/skills/hexasync-tables-tasks-objects/SKILL.md +11 -18
- package/skills/hexasync-tables-tasks-objects/references/INDEX.md +2 -2
- package/skills/hexasync-tables-tasks-objects/references/INSTALL.md +5 -48
- package/skills/hexasync-tables-tasks-objects/references/dependencies.DEPENDENCIES.fields.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/dependencies.DEPENDENCIES.related.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/dependencies.DEPENDENCIES.using-resolved-prerequisite-data.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/objectAssociations.OBJECT-ASSOCIATIONS.md +7 -7
- package/skills/hexasync-tables-tasks-objects/references/objects.object.best-practices-and-pitfalls.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/objects.object.fields.dataprocessing.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/objects.object.fields.dependencies.md +2 -2
- package/skills/hexasync-tables-tasks-objects/references/objects.object.fields.description.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/objects.object.fields.enqueue.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/objects.object.fields.fromconnectionid.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/objects.object.fields.id.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/objects.object.fields.ignorechange.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/objects.object.fields.ignoreremoval.md +2 -2
- package/skills/hexasync-tables-tasks-objects/references/objects.object.fields.integrationtype.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/objects.object.fields.isdirtyremovable.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/objects.object.fields.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/objects.object.fields.metricgroups.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/objects.object.fields.metrics.md +2 -2
- package/skills/hexasync-tables-tasks-objects/references/objects.object.fields.name.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/objects.object.fields.newtablename.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/objects.object.fields.oldtablename.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/objects.object.fields.priority.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/objects.object.fields.puller.md +4 -4
- package/skills/hexasync-tables-tasks-objects/references/objects.object.fields.pusher.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/objects.object.fields.queuer.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/objects.object.fields.toconnectionid.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/objects.object.fields.type.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/objects.object.fields.valuetablename.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/objects.object.fields.viewname.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/objects.object.fields.visible.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/objects.object.minimal-declaration.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/objects.object.related.md +2 -2
- package/skills/hexasync-tables-tasks-objects/references/steps.SAVE_TASK_DATA.md +16 -16
- package/skills/hexasync-tables-tasks-objects/references/tables.TABLES.best-practices.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/tables.TABLES.fields.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/tables.TABLES.related.md +3 -3
- package/skills/hexasync-tables-tasks-objects/references/tasks.TASKS-AND-TABLES.fields.md +5 -5
- package/skills/hexasync-tables-tasks-objects/references/tasks.TASKS-AND-TABLES.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/tasks.TASKS-AND-TABLES.related.md +6 -6
- package/skills/hexasync-tables-tasks-objects/references/tasks.TASKS-AND-TABLES.status-and-row-clocks.md +1 -1
- package/skills/hexasync-tables-tasks-objects/references/tasks.TASKS-AND-TABLES.system-column-contract.md +1 -1
- package/skills/hexasync-templates/SKILL.md +16 -31
- package/skills/hexasync-templates/references/AI-INDEX.md +31 -31
- package/skills/hexasync-templates/references/INDEX.md +3 -2
- package/skills/hexasync-templates/references/INSTALL.md +5 -48
- package/skills/hexasync-templates/references/KB-INDEX.md +98 -98
- package/skills/hexasync-templates/references/PROFILE-ROOT.composed-and-render-only-metadata.md +1 -1
- package/skills/hexasync-templates/references/PROFILE-ROOT.minimal-worker-facing-profile.md +2 -2
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-references.md +10 -10
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.connectors.md +1 -1
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.dependencies.md +1 -1
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.frontend-steps-creationsteps-setupsteps-authorizationsteps.api--gateway_api.md +1 -1
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.frontend-steps-creationsteps-setupsteps-authorizationsteps.api_proxy.md +69 -0
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.frontend-steps-creationsteps-setupsteps-authorizationsteps.md +3 -2
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.frontend-steps-creationsteps-setupsteps-authorizationsteps.step-envelope-fields.md +4 -4
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.getreadyflows.md +1 -1
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.legacy-roots--do-not-author.md +1 -1
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.metricgroups.md +1 -1
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.objectassociations.md +1 -1
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.objects.md +1 -1
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.pullers.md +1 -1
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.pushers.md +1 -1
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.reports.md +1 -1
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.startuptasks.md +1 -1
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.tables.md +1 -1
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.transformations.md +1 -1
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.validations.md +1 -1
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.webhooks.md +1 -1
- package/skills/hexasync-templates/references/PROFILE-ROOT.recommendation-selection.md +1 -1
- package/skills/hexasync-templates/references/PROFILE-ROOT.reference-composition-across-run-and-render-scope.md +1 -1
- package/skills/hexasync-templates/references/PROFILE-ROOT.rejected-reference-forms-and-safe-correction.md +1 -1
- package/skills/hexasync-templates/references/PROFILE-ROOT.related.md +1 -1
- package/skills/hexasync-templates/references/frontend.FRONTEND-FLOWS.api_proxy.md +94 -0
- package/skills/hexasync-templates/references/frontend.FRONTEND-FLOWS.expressions-and-tooling.md +2 -2
- package/skills/hexasync-templates/references/frontend.FRONTEND-FLOWS.frontend-step-fields.md +1 -1
- package/skills/hexasync-templates/references/frontend.FRONTEND-FLOWS.md +1 -1
- package/skills/hexasync-templates/references/frontend.FRONTEND-FLOWS.preview-and-source-navigation.md +3 -3
- package/skills/hexasync-templates/references/frontend.FRONTEND-FLOWS.task-and-reference-data-changes.md +1 -1
- package/skills/hexasync-transformations/SKILL.md +9 -16
- package/skills/hexasync-transformations/references/INDEX.md +2 -2
- package/skills/hexasync-transformations/references/INSTALL.md +5 -48
- package/skills/hexasync-transformations/references/transformations.TRANSFORMATIONS.explicit-mapping-for-push.md +1 -1
- package/skills/hexasync-transformations/references/transformations.TRANSFORMATIONS.puller-mapping-transformations.md +1 -1
- package/skills/hexasync-transformations/references/transformations.TRANSFORMATIONS.related.md +6 -6
- package/skills/hexasync-transformations/references/transformations.TRANSFORMATIONS.renamedependency--declared-but-unimplemented.md +1 -1
- package/skills/hexasync-transformations/references/transformations.TRANSFORMATIONS.transformation-types.jsonata--compute-a-field-from-a-jsonata-expression.md +1 -1
- package/skills/hexasync-transformations/references/transformations.TRANSFORMATIONS.transformation-types.query-argument-binding.md +2 -2
- package/skills/hexasync-transformations/references/transformations.TRANSFORMATIONS.transformation-types.query_single--the-dsl-replacement-for-sql.md +4 -4
- package/skills/hexasync-transformations/references/transformations.TRANSFORMATIONS.transformation-types.scriban--compute-a-field-from-a-scriban-expression.md +1 -1
- package/skills/hexasync-transformations/references/transformations.TRANSFORMATIONS.when-to-use.md +1 -1
- package/skills/hexasync-validations/SKILL.md +9 -16
- package/skills/hexasync-validations/references/INDEX.md +1 -1
- package/skills/hexasync-validations/references/INSTALL.md +5 -48
- package/skills/hexasync-validations/references/steps.CHECK_FORMAT.md +6 -6
- package/skills/hexasync-validations/references/validations.VALIDATIONS.fields.md +1 -1
- package/skills/hexasync-validations/references/validations.VALIDATIONS.how-validations-behave.md +2 -2
- package/skills/hexasync-validations/references/validations.VALIDATIONS.md +1 -1
- package/skills/hexasync-validations/references/validations.VALIDATIONS.not-the-query-dsl.md +1 -1
- package/skills/hexasync-webhooks/SKILL.md +12 -19
- package/skills/hexasync-webhooks/references/INDEX.md +2 -2
- package/skills/hexasync-webhooks/references/INSTALL.md +5 -48
- package/skills/hexasync-webhooks/references/steps.FORWARD.md +7 -7
- package/skills/hexasync-webhooks/references/steps.WEBHOOK_FORWARD.md +10 -10
- package/skills/hexasync-webhooks/references/webhooks.WEBHOOKS.best-practices.md +2 -2
- package/skills/hexasync-webhooks/references/webhooks.WEBHOOKS.gateway-mcp-webhook-workflow.md +1 -1
- package/skills/hexasync-webhooks/references/webhooks.WEBHOOKS.md +2 -2
- package/skills/hexasync-webhooks/references/webhooks.WEBHOOKS.placement-finalsteps.md +1 -1
- package/skills/hexasync-webhooks/references/webhooks.WEBHOOKS.placement-pullsteps.md +6 -6
- package/skills/hexasync-webhooks/references/webhooks.WEBHOOKS.related.md +6 -6
- package/skills/hexasync-webhooks/references/webhooks.WEBHOOKS.target-properties.autoenqueue.md +2 -2
- package/skills/hexasync-webhooks/references/webhooks.WEBHOOKS.target-properties.dataparser.md +3 -3
- package/skills/hexasync-webhooks/references/webhooks.WEBHOOKS.target-properties.options.md +1 -1
- package/skills/hexasync-webhooks/references/webhooks.WEBHOOKS.target-properties.pullsteps.md +1 -1
- package/.cursor-plugin/mcp.json +0 -12
- package/.mcp.json +0 -11
- package/skills/hexasync-connections/references/frontend.FRONTEND-FLOWS.publish_event.md +0 -44
- package/skills/hexasync-expressions/references/frontend.FRONTEND-FLOWS.publish_event.md +0 -44
- package/skills/hexasync-steps-api-http/references/frontend.FRONTEND-FLOWS.publish_event.md +0 -44
- package/skills/hexasync-steps-control-data/references/frontend.FRONTEND-FLOWS.publish_event.md +0 -44
- package/skills/hexasync-templates/references/frontend.FRONTEND-FLOWS.publish_event.md +0 -44
package/dist/cli.js
CHANGED
|
@@ -149,221 +149,6 @@ var CLIENT_DIALECT_POLICIES = Object.freeze(Object.fromEntries(Object.entries({
|
|
|
149
149
|
nextActions: Object.freeze([...policy.nextActions])
|
|
150
150
|
})])));
|
|
151
151
|
|
|
152
|
-
// ../hexasync-template-client-setup/src/config/json.ts
|
|
153
|
-
var InvalidJson = class extends Error {
|
|
154
|
-
};
|
|
155
|
-
var Parser = class {
|
|
156
|
-
constructor(text, comments) {
|
|
157
|
-
this.text = text;
|
|
158
|
-
this.comments = comments;
|
|
159
|
-
}
|
|
160
|
-
text;
|
|
161
|
-
comments;
|
|
162
|
-
position = 0;
|
|
163
|
-
depth = 0;
|
|
164
|
-
literal = /(?:true|false|null|-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)/y;
|
|
165
|
-
parse() {
|
|
166
|
-
for (let index = 0; index < this.text.length; index++) {
|
|
167
|
-
const unit = this.text.charCodeAt(index);
|
|
168
|
-
if (unit >= 55296 && unit <= 56319) {
|
|
169
|
-
const next = this.text.charCodeAt(++index);
|
|
170
|
-
if (!(next >= 56320 && next <= 57343)) throw new InvalidJson();
|
|
171
|
-
} else if (unit >= 56320 && unit <= 57343) throw new InvalidJson();
|
|
172
|
-
}
|
|
173
|
-
const value = this.value();
|
|
174
|
-
this.trivia();
|
|
175
|
-
if (this.position !== this.text.length) throw new InvalidJson();
|
|
176
|
-
return value;
|
|
177
|
-
}
|
|
178
|
-
trivia() {
|
|
179
|
-
for (; ; ) {
|
|
180
|
-
while (/[\t\r\n ]/.test(this.text[this.position] ?? "") && this.position < this.text.length) this.position++;
|
|
181
|
-
if (!this.comments || this.text[this.position] !== "/") return;
|
|
182
|
-
if (this.text[this.position + 1] === "/") {
|
|
183
|
-
this.position += 2;
|
|
184
|
-
while (this.position < this.text.length && !/[\r\n]/.test(this.text[this.position])) this.position++;
|
|
185
|
-
} else if (this.text[this.position + 1] === "*") {
|
|
186
|
-
const end = this.text.indexOf("*/", this.position + 2);
|
|
187
|
-
if (end === -1) throw new InvalidJson();
|
|
188
|
-
this.position = end + 2;
|
|
189
|
-
} else return;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
string() {
|
|
193
|
-
const start = this.position++;
|
|
194
|
-
let escaped = false;
|
|
195
|
-
while (this.position < this.text.length) {
|
|
196
|
-
const character = this.text[this.position++];
|
|
197
|
-
if (character === '"' && !escaped) {
|
|
198
|
-
let value;
|
|
199
|
-
try {
|
|
200
|
-
value = JSON.parse(this.text.slice(start, this.position));
|
|
201
|
-
} catch {
|
|
202
|
-
throw new InvalidJson();
|
|
203
|
-
}
|
|
204
|
-
return { start, end: this.position, value };
|
|
205
|
-
}
|
|
206
|
-
if (character.charCodeAt(0) < 32) throw new InvalidJson();
|
|
207
|
-
escaped = character === "\\" && !escaped;
|
|
208
|
-
}
|
|
209
|
-
throw new InvalidJson();
|
|
210
|
-
}
|
|
211
|
-
value() {
|
|
212
|
-
if (++this.depth > 256) throw new InvalidJson();
|
|
213
|
-
try {
|
|
214
|
-
this.trivia();
|
|
215
|
-
const start = this.position;
|
|
216
|
-
const character = this.text[this.position];
|
|
217
|
-
if (character === '"') return this.string();
|
|
218
|
-
if (character === "{") return this.object();
|
|
219
|
-
if (character === "[") return this.array();
|
|
220
|
-
this.literal.lastIndex = start;
|
|
221
|
-
const literal = this.literal.exec(this.text);
|
|
222
|
-
if (!literal) throw new InvalidJson();
|
|
223
|
-
this.position += literal[0].length;
|
|
224
|
-
const value = JSON.parse(literal[0]);
|
|
225
|
-
if (typeof value === "number" && !Number.isFinite(value)) throw new InvalidJson();
|
|
226
|
-
return { start, end: this.position, value };
|
|
227
|
-
} finally {
|
|
228
|
-
this.depth--;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
object() {
|
|
232
|
-
const start = this.position++;
|
|
233
|
-
const properties = [];
|
|
234
|
-
const value = /* @__PURE__ */ Object.create(null);
|
|
235
|
-
this.trivia();
|
|
236
|
-
while (this.text[this.position] !== "}") {
|
|
237
|
-
if (this.text[this.position] !== '"') throw new InvalidJson();
|
|
238
|
-
const key = this.string();
|
|
239
|
-
const name = key.value;
|
|
240
|
-
if (Object.hasOwn(value, name)) throw new InvalidJson();
|
|
241
|
-
this.trivia();
|
|
242
|
-
if (this.text[this.position++] !== ":") throw new InvalidJson();
|
|
243
|
-
const child = this.value();
|
|
244
|
-
value[name] = child.value;
|
|
245
|
-
this.trivia();
|
|
246
|
-
const comma = this.text[this.position] === "," ? this.position++ : null;
|
|
247
|
-
properties.push({ key: name, keyStart: key.start, value: child, comma });
|
|
248
|
-
this.trivia();
|
|
249
|
-
if (comma === null && this.text[this.position] !== "}") throw new InvalidJson();
|
|
250
|
-
if (comma !== null && this.text[this.position] === "}" && !this.comments) throw new InvalidJson();
|
|
251
|
-
}
|
|
252
|
-
return { start, end: ++this.position, value, properties };
|
|
253
|
-
}
|
|
254
|
-
array() {
|
|
255
|
-
const start = this.position++;
|
|
256
|
-
const value = [];
|
|
257
|
-
this.trivia();
|
|
258
|
-
while (this.text[this.position] !== "]") {
|
|
259
|
-
value.push(this.value().value);
|
|
260
|
-
this.trivia();
|
|
261
|
-
const comma = this.text[this.position] === ",";
|
|
262
|
-
if (comma) this.position++;
|
|
263
|
-
this.trivia();
|
|
264
|
-
if (!comma && this.text[this.position] !== "]") throw new InvalidJson();
|
|
265
|
-
if (comma && this.text[this.position] === "]" && !this.comments) throw new InvalidJson();
|
|
266
|
-
}
|
|
267
|
-
return { start, end: ++this.position, value };
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
function semantic(value) {
|
|
271
|
-
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
272
|
-
if (Array.isArray(value)) return `[${value.map(semantic).join(",")}]`;
|
|
273
|
-
const record = value;
|
|
274
|
-
return `{${Object.keys(record).sort().map((key) => `${JSON.stringify(key)}:${semantic(record[key])}`).join(",")}}`;
|
|
275
|
-
}
|
|
276
|
-
function applyEdits(text, edits) {
|
|
277
|
-
let result = text;
|
|
278
|
-
for (const edit of edits.sort((a, b) => b.start - a.start)) result = result.slice(0, edit.start) + edit.text + result.slice(edit.end);
|
|
279
|
-
return result;
|
|
280
|
-
}
|
|
281
|
-
function indentation(text, position) {
|
|
282
|
-
const start = Math.max(text.lastIndexOf("\n", position - 1), text.lastIndexOf("\r", position - 1)) + 1;
|
|
283
|
-
return /^[\t ]*/.exec(text.slice(start, position))[0];
|
|
284
|
-
}
|
|
285
|
-
function render(value, indent, unit, newline) {
|
|
286
|
-
return JSON.stringify(value, null, unit).replace(/\n/g, `${newline}${indent}`);
|
|
287
|
-
}
|
|
288
|
-
function insertProperties(text, object, entries, newline) {
|
|
289
|
-
const properties = object.properties;
|
|
290
|
-
const last2 = properties.at(-1);
|
|
291
|
-
const multiline = /[\r\n]/.test(text.slice(object.start, object.end));
|
|
292
|
-
const parentIndent = indentation(text, object.start);
|
|
293
|
-
const childIndent = properties.length && multiline ? indentation(text, properties[0].keyStart) : `${parentIndent} `;
|
|
294
|
-
const unit = childIndent.slice(parentIndent.length) || " ";
|
|
295
|
-
const entry = entries.map(
|
|
296
|
-
([key, value]) => `${JSON.stringify(key)}: ${render(value, multiline ? childIndent : "", multiline ? unit : "", newline)}`
|
|
297
|
-
).join(multiline ? `,${newline}${childIndent}` : ", ");
|
|
298
|
-
const edits = [];
|
|
299
|
-
const close = object.end - 1;
|
|
300
|
-
const needsComma = last2 !== void 0 && last2.comma === null;
|
|
301
|
-
const commaAtClose = needsComma && last2.value.end === close;
|
|
302
|
-
if (needsComma && !commaAtClose) edits.push({ start: last2.value.end, end: last2.value.end, text: "," });
|
|
303
|
-
const prefix = multiline ? (text[close - 1] === "\n" ? "" : newline) + childIndent : last2 || close > object.start + 1 ? " " : "";
|
|
304
|
-
edits.push({ start: close, end: close, text: `${commaAtClose ? "," : ""}${prefix}${entry}${multiline ? newline + parentIndent : ""}` });
|
|
305
|
-
return applyEdits(text, edits);
|
|
306
|
-
}
|
|
307
|
-
function planJsonServerEntry(beforeImage, request) {
|
|
308
|
-
const removing = request.entry === null;
|
|
309
|
-
const comments = request.format === "jsonc";
|
|
310
|
-
const malformed = (reason) => Object.freeze({ status: "Malformed", afterImage: beforeImage, operation: removing ? "remove" : "add", reason });
|
|
311
|
-
const done = (afterImage, operation) => {
|
|
312
|
-
if (afterImage !== beforeImage && afterImage !== null) {
|
|
313
|
-
try {
|
|
314
|
-
new Parser(afterImage, comments).parse();
|
|
315
|
-
} catch {
|
|
316
|
-
return malformed("The preserving edit cannot guarantee valid JSON; the original file was kept.");
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
return Object.freeze({ status: afterImage === beforeImage ? "NoOp" : "Planned", afterImage, operation });
|
|
320
|
-
};
|
|
321
|
-
const nest = (path, value2) => path.reduceRight((inner, key2) => ({ [key2]: inner }), value2);
|
|
322
|
-
const fresh = (newline2) => `${JSON.stringify(nest([...request.mapPath, request.entryKey], request.entry), null, 2)}${newline2}`;
|
|
323
|
-
const text = beforeImage ?? "";
|
|
324
|
-
if (!text.trim()) return removing ? done(beforeImage, "remove") : done(fresh("\n"), "add");
|
|
325
|
-
let root;
|
|
326
|
-
try {
|
|
327
|
-
root = new Parser(text, comments).parse();
|
|
328
|
-
} catch {
|
|
329
|
-
return malformed("The configuration is not valid JSON (or has duplicate keys); repair it before installing.");
|
|
330
|
-
}
|
|
331
|
-
if (!root.properties) return malformed("The configuration root must be an object.");
|
|
332
|
-
const newline = /\r\n|\n|\r/.exec(text)?.[0] ?? "\n";
|
|
333
|
-
let parent = root;
|
|
334
|
-
let depth = 0;
|
|
335
|
-
for (; depth < request.mapPath.length; depth++) {
|
|
336
|
-
const property = parent.properties.find((candidate) => candidate.key === request.mapPath[depth]);
|
|
337
|
-
if (!property) break;
|
|
338
|
-
if (!property.value.properties) return malformed(`\`${request.mapPath.slice(0, depth + 1).join(".")}\` must be an object.`);
|
|
339
|
-
parent = property.value;
|
|
340
|
-
}
|
|
341
|
-
const existing = depth === request.mapPath.length ? parent.properties.find((property) => property.key === request.entryKey) : void 0;
|
|
342
|
-
if (removing) {
|
|
343
|
-
if (!existing) return done(beforeImage, "remove");
|
|
344
|
-
const properties = parent.properties;
|
|
345
|
-
const index = properties.indexOf(existing);
|
|
346
|
-
const comma = existing.comma ?? (index > 0 ? properties[index - 1].comma : null);
|
|
347
|
-
const edits = [{ start: existing.keyStart, end: existing.value.end, text: "" }];
|
|
348
|
-
if (comma !== null) edits.push({ start: comma, end: comma + 1, text: "" });
|
|
349
|
-
return done(applyEdits(text, edits), "remove");
|
|
350
|
-
}
|
|
351
|
-
const desired = request.entry;
|
|
352
|
-
if (existing) {
|
|
353
|
-
if (semantic(existing.value.value) === semantic(desired)) return done(beforeImage, "update");
|
|
354
|
-
const indent = indentation(text, existing.keyStart);
|
|
355
|
-
return done(applyEdits(text, [{
|
|
356
|
-
start: existing.value.start,
|
|
357
|
-
end: existing.value.end,
|
|
358
|
-
text: render(desired, indent, indent.includes(" ") ? " " : " ", newline)
|
|
359
|
-
}]), "update");
|
|
360
|
-
}
|
|
361
|
-
if (root.properties.length === 0 && text.trim() === "{}") return done(fresh(newline), "add");
|
|
362
|
-
const remaining = request.mapPath.slice(depth);
|
|
363
|
-
const [key, value] = remaining.length === 0 ? [request.entryKey, desired] : [remaining[0], nest([...remaining.slice(1), request.entryKey], desired)];
|
|
364
|
-
return done(insertProperties(text, parent, [[key, value]], newline), "add");
|
|
365
|
-
}
|
|
366
|
-
|
|
367
152
|
// ../../node_modules/eslint-visitor-keys/lib/visitor-keys.js
|
|
368
153
|
var KEYS = {
|
|
369
154
|
ArrayExpression: ["elements"],
|
|
@@ -492,9 +277,6 @@ function unionWith(additionalKeys) {
|
|
|
492
277
|
function last(arr) {
|
|
493
278
|
return arr[arr.length - 1] ?? null;
|
|
494
279
|
}
|
|
495
|
-
function toKeyName(node) {
|
|
496
|
-
return node.type === "TOMLBare" ? node.name : node.value;
|
|
497
|
-
}
|
|
498
280
|
var TOMLVerImpl = class {
|
|
499
281
|
constructor(major, minor) {
|
|
500
282
|
this.major = major;
|
|
@@ -509,67 +291,6 @@ var TOMLVerImpl = class {
|
|
|
509
291
|
};
|
|
510
292
|
var TOML_VERSION_1_0 = new TOMLVerImpl(1, 0);
|
|
511
293
|
var TOML_VERSION_1_1 = new TOMLVerImpl(1, 1);
|
|
512
|
-
var DEFAULT_TOML_VERSION = TOML_VERSION_1_1;
|
|
513
|
-
var SUPPORTED_TOML_VERSIONS = {
|
|
514
|
-
"1.0": TOML_VERSION_1_0,
|
|
515
|
-
"1.0.0": TOML_VERSION_1_0,
|
|
516
|
-
"1.1": TOML_VERSION_1_1,
|
|
517
|
-
"1.1.0": TOML_VERSION_1_1,
|
|
518
|
-
latest: TOML_VERSION_1_1,
|
|
519
|
-
next: TOML_VERSION_1_1
|
|
520
|
-
};
|
|
521
|
-
function getTOMLVer(v) {
|
|
522
|
-
return v && SUPPORTED_TOML_VERSIONS[v] || DEFAULT_TOML_VERSION;
|
|
523
|
-
}
|
|
524
|
-
var MESSAGES = {
|
|
525
|
-
"unterminated-string": "Unterminated string constant",
|
|
526
|
-
"unterminated-table-key": "Unterminated table-key",
|
|
527
|
-
"unterminated-array": "Unterminated array",
|
|
528
|
-
"unterminated-inline-table": "Unterminated inline table",
|
|
529
|
-
"missing-key": "Empty bare keys are not allowed",
|
|
530
|
-
"missing-newline": "Must be a newline",
|
|
531
|
-
"missing-equals-sign": "Expected equal (=) token",
|
|
532
|
-
"missing-value": "Unspecified values are invalid",
|
|
533
|
-
"missing-comma": "Expected comma (,) token",
|
|
534
|
-
"dupe-keys": "Defining a key multiple times is invalid",
|
|
535
|
-
"unexpected-char": "Unexpected character",
|
|
536
|
-
"unexpected-token": "Unexpected token",
|
|
537
|
-
"invalid-control-character": "Control characters (codes < 0x1f and 0x7f) are not allowed",
|
|
538
|
-
"invalid-comment-character": "Invalid code point {{cp}} within comments",
|
|
539
|
-
"invalid-key-value-newline": "The key, equals sign, and value must be on the same line",
|
|
540
|
-
"invalid-inline-table-newline": "No newlines are allowed between the curly braces unless they are valid within a value",
|
|
541
|
-
"invalid-underscore": "Underscores are allowed between digits",
|
|
542
|
-
"invalid-space": "Unexpected spaces",
|
|
543
|
-
"invalid-three-quotes": "Three or more quotes are not permitted",
|
|
544
|
-
"invalid-date": "Unexpected invalid date",
|
|
545
|
-
"invalid-time": "Unexpected invalid time",
|
|
546
|
-
"invalid-leading-zero": "Leading zeros are not allowed",
|
|
547
|
-
"invalid-trailing-comma-in-inline-table": "Trailing comma is not permitted in an inline table",
|
|
548
|
-
"invalid-char-in-escape-sequence": "Invalid character in escape sequence",
|
|
549
|
-
"invalid-consecutive-dots-in-key": "Consecutive dots are not permitted in keys",
|
|
550
|
-
"invalid-code-point": "Invalid code point {{cp}}",
|
|
551
|
-
"invalid-trailing-dot-in-key": "Keys cannot end with a dot",
|
|
552
|
-
"invalid-leading-dot-in-key": "Keys cannot start with a dot"
|
|
553
|
-
};
|
|
554
|
-
function getMessage(code, data) {
|
|
555
|
-
if (data) return MESSAGES[code].replace(/\{\{(.*?)\}\}/gu, (_, name$2) => {
|
|
556
|
-
if (name$2 in data) return data[name$2];
|
|
557
|
-
return `{{${name$2}}}`;
|
|
558
|
-
});
|
|
559
|
-
return MESSAGES[code];
|
|
560
|
-
}
|
|
561
|
-
var ParseError = class extends SyntaxError {
|
|
562
|
-
/**
|
|
563
|
-
* Initialize this ParseError instance.
|
|
564
|
-
*
|
|
565
|
-
*/
|
|
566
|
-
constructor(code, offset, line, column, data) {
|
|
567
|
-
super(getMessage(code, data));
|
|
568
|
-
this.index = offset;
|
|
569
|
-
this.lineNumber = line;
|
|
570
|
-
this.column = column;
|
|
571
|
-
}
|
|
572
|
-
};
|
|
573
294
|
var CodePoint = {
|
|
574
295
|
EOF: -1,
|
|
575
296
|
NULL: 0,
|
|
@@ -661,124 +382,6 @@ var CodePoint = {
|
|
|
661
382
|
CP_EFFFF: 983039,
|
|
662
383
|
CP_10FFFF: 1114111
|
|
663
384
|
};
|
|
664
|
-
function isControl(cp2) {
|
|
665
|
-
return cp2 >= CodePoint.NULL && cp2 <= CodePoint.US;
|
|
666
|
-
}
|
|
667
|
-
function isWhitespace(cp2) {
|
|
668
|
-
return cp2 === CodePoint.TABULATION || cp2 === CodePoint.SPACE;
|
|
669
|
-
}
|
|
670
|
-
function isEOL(cp2) {
|
|
671
|
-
return cp2 === CodePoint.LINE_FEED || cp2 === CodePoint.CARRIAGE_RETURN;
|
|
672
|
-
}
|
|
673
|
-
function isUpperLetter(cp2) {
|
|
674
|
-
return cp2 >= CodePoint.LATIN_CAPITAL_A && cp2 <= CodePoint.LATIN_CAPITAL_Z;
|
|
675
|
-
}
|
|
676
|
-
function isLowerLetter(cp2) {
|
|
677
|
-
return cp2 >= CodePoint.LATIN_SMALL_A && cp2 <= CodePoint.LATIN_SMALL_Z;
|
|
678
|
-
}
|
|
679
|
-
function isLetter(cp2) {
|
|
680
|
-
return isLowerLetter(cp2) || isUpperLetter(cp2);
|
|
681
|
-
}
|
|
682
|
-
function isDigit(cp2) {
|
|
683
|
-
return cp2 >= CodePoint.DIGIT_0 && cp2 <= CodePoint.DIGIT_9;
|
|
684
|
-
}
|
|
685
|
-
function isHexDig(cp2) {
|
|
686
|
-
return isDigit(cp2) || cp2 >= CodePoint.LATIN_SMALL_A && cp2 <= CodePoint.LATIN_SMALL_F || cp2 >= CodePoint.LATIN_CAPITAL_A && cp2 <= CodePoint.LATIN_CAPITAL_F;
|
|
687
|
-
}
|
|
688
|
-
function isOctalDig(cp2) {
|
|
689
|
-
return cp2 >= CodePoint.DIGIT_0 && cp2 <= CodePoint.DIGIT_7;
|
|
690
|
-
}
|
|
691
|
-
function isUnicodeScalarValue(cp2) {
|
|
692
|
-
return cp2 >= 0 && cp2 <= 55295 || cp2 >= 57344 && cp2 <= 1114111;
|
|
693
|
-
}
|
|
694
|
-
function sortedLastIndex(array, value) {
|
|
695
|
-
let low = 0;
|
|
696
|
-
let high = array.length;
|
|
697
|
-
while (low < high) {
|
|
698
|
-
const mid = low + high >>> 1;
|
|
699
|
-
const val = array[mid];
|
|
700
|
-
if (val === value) return mid + 1;
|
|
701
|
-
if (val < value) low = mid + 1;
|
|
702
|
-
else high = mid;
|
|
703
|
-
}
|
|
704
|
-
return low;
|
|
705
|
-
}
|
|
706
|
-
var Locations = class {
|
|
707
|
-
constructor() {
|
|
708
|
-
this.offsets = [];
|
|
709
|
-
}
|
|
710
|
-
addOffset(offset) {
|
|
711
|
-
for (let i = this.offsets.length - 1; i >= 0; i--) {
|
|
712
|
-
const element = this.offsets[i];
|
|
713
|
-
if (element === offset) return;
|
|
714
|
-
if (element < offset) break;
|
|
715
|
-
}
|
|
716
|
-
this.offsets.push(offset);
|
|
717
|
-
}
|
|
718
|
-
/**
|
|
719
|
-
* Calculate the location of the given index.
|
|
720
|
-
* @param index The index to calculate their location.
|
|
721
|
-
* @returns The location of the index.
|
|
722
|
-
*/
|
|
723
|
-
getLocFromIndex(offset) {
|
|
724
|
-
const line = sortedLastIndex(this.offsets, offset) + 1;
|
|
725
|
-
return {
|
|
726
|
-
line,
|
|
727
|
-
column: offset - (line === 1 ? 0 : this.offsets[line - 2])
|
|
728
|
-
};
|
|
729
|
-
}
|
|
730
|
-
};
|
|
731
|
-
var CodePointIterator = class {
|
|
732
|
-
/**
|
|
733
|
-
* Initialize this char iterator.
|
|
734
|
-
*/
|
|
735
|
-
constructor(text) {
|
|
736
|
-
this.locs = new Locations();
|
|
737
|
-
this.lastCodePoint = CodePoint.NULL;
|
|
738
|
-
this.start = -1;
|
|
739
|
-
this.end = 0;
|
|
740
|
-
this.text = text;
|
|
741
|
-
}
|
|
742
|
-
next() {
|
|
743
|
-
if (this.lastCodePoint === CodePoint.EOF) return CodePoint.EOF;
|
|
744
|
-
return this.lastCodePoint = this.moveAt(this.end);
|
|
745
|
-
}
|
|
746
|
-
getLocFromIndex(index) {
|
|
747
|
-
return this.locs.getLocFromIndex(index);
|
|
748
|
-
}
|
|
749
|
-
eat(cp2) {
|
|
750
|
-
if (this.text.codePointAt(this.end) === cp2) {
|
|
751
|
-
this.next();
|
|
752
|
-
return true;
|
|
753
|
-
}
|
|
754
|
-
return false;
|
|
755
|
-
}
|
|
756
|
-
moveAt(offset) {
|
|
757
|
-
this.start = this.end = offset;
|
|
758
|
-
const cp2 = this.text.codePointAt(this.start) ?? CodePoint.EOF;
|
|
759
|
-
if (cp2 === CodePoint.EOF) {
|
|
760
|
-
this.end = this.start;
|
|
761
|
-
return cp2;
|
|
762
|
-
}
|
|
763
|
-
this.end += cp2 >= 65536 ? 2 : 1;
|
|
764
|
-
if (cp2 === CodePoint.LINE_FEED) this.locs.addOffset(this.end);
|
|
765
|
-
else if (cp2 === CodePoint.CARRIAGE_RETURN) {
|
|
766
|
-
if (this.text.codePointAt(this.end) === CodePoint.LINE_FEED) {
|
|
767
|
-
this.end++;
|
|
768
|
-
this.locs.addOffset(this.end);
|
|
769
|
-
}
|
|
770
|
-
return CodePoint.LINE_FEED;
|
|
771
|
-
}
|
|
772
|
-
return cp2;
|
|
773
|
-
}
|
|
774
|
-
};
|
|
775
|
-
var HAS_BIGINT = typeof BigInt !== "undefined";
|
|
776
|
-
var RADIX_PREFIXES = {
|
|
777
|
-
16: "0x",
|
|
778
|
-
10: "",
|
|
779
|
-
8: "0o",
|
|
780
|
-
2: "0b"
|
|
781
|
-
};
|
|
782
385
|
var ESCAPES_1_0 = {
|
|
783
386
|
[CodePoint.QUOTATION_MARK]: CodePoint.QUOTATION_MARK,
|
|
784
387
|
[CodePoint.BACKSLASH]: CodePoint.BACKSLASH,
|
|
@@ -792,1471 +395,6 @@ var ESCAPES_LATEST = {
|
|
|
792
395
|
...ESCAPES_1_0,
|
|
793
396
|
[CodePoint.LATIN_SMALL_E]: CodePoint.ESCAPE
|
|
794
397
|
};
|
|
795
|
-
var Tokenizer = class {
|
|
796
|
-
/**
|
|
797
|
-
* Initialize this tokenizer.
|
|
798
|
-
*/
|
|
799
|
-
constructor(text, parserOptions) {
|
|
800
|
-
this.backCode = false;
|
|
801
|
-
this.lastCodePoint = CodePoint.NULL;
|
|
802
|
-
this.state = "DATA";
|
|
803
|
-
this.token = null;
|
|
804
|
-
this.tokenStart = -1;
|
|
805
|
-
this.valuesEnabled = false;
|
|
806
|
-
this.text = text;
|
|
807
|
-
this.parserOptions = parserOptions || {};
|
|
808
|
-
this.codePointIterator = new CodePointIterator(text);
|
|
809
|
-
this.tomlVersion = getTOMLVer(this.parserOptions.tomlVersion);
|
|
810
|
-
this.ESCAPES = this.tomlVersion.gte(1, 1) ? ESCAPES_LATEST : ESCAPES_1_0;
|
|
811
|
-
}
|
|
812
|
-
get start() {
|
|
813
|
-
return this.codePointIterator.start;
|
|
814
|
-
}
|
|
815
|
-
get end() {
|
|
816
|
-
return this.codePointIterator.end;
|
|
817
|
-
}
|
|
818
|
-
getLocFromIndex(index) {
|
|
819
|
-
return this.codePointIterator.getLocFromIndex(index);
|
|
820
|
-
}
|
|
821
|
-
/**
|
|
822
|
-
* Report an invalid character error.
|
|
823
|
-
*/
|
|
824
|
-
reportParseError(code, data) {
|
|
825
|
-
const offset = this.codePointIterator.start;
|
|
826
|
-
const loc = this.codePointIterator.getLocFromIndex(offset);
|
|
827
|
-
throw new ParseError(code, offset, loc.line, loc.column, data);
|
|
828
|
-
}
|
|
829
|
-
/**
|
|
830
|
-
* Get the next token.
|
|
831
|
-
*/
|
|
832
|
-
nextToken() {
|
|
833
|
-
let token = this.token;
|
|
834
|
-
if (token != null) {
|
|
835
|
-
this.token = null;
|
|
836
|
-
return token;
|
|
837
|
-
}
|
|
838
|
-
let cp2 = this.lastCodePoint;
|
|
839
|
-
while (cp2 !== CodePoint.EOF && !this.token) {
|
|
840
|
-
cp2 = this.nextCode();
|
|
841
|
-
const nextState = this[this.state](cp2);
|
|
842
|
-
if (!nextState) throw new Error(`Unknown error: pre state=${this.state}`);
|
|
843
|
-
this.state = nextState;
|
|
844
|
-
}
|
|
845
|
-
token = this.token;
|
|
846
|
-
this.token = null;
|
|
847
|
-
return token;
|
|
848
|
-
}
|
|
849
|
-
/**
|
|
850
|
-
* Get the next code point.
|
|
851
|
-
*/
|
|
852
|
-
nextCode() {
|
|
853
|
-
if (this.lastCodePoint === CodePoint.EOF) return CodePoint.EOF;
|
|
854
|
-
if (this.backCode) {
|
|
855
|
-
this.backCode = false;
|
|
856
|
-
return this.lastCodePoint;
|
|
857
|
-
}
|
|
858
|
-
return this.lastCodePoint = this.codePointIterator.next();
|
|
859
|
-
}
|
|
860
|
-
/**
|
|
861
|
-
* Eat the next code point.
|
|
862
|
-
*/
|
|
863
|
-
eatCode(cp2) {
|
|
864
|
-
if (this.lastCodePoint === CodePoint.EOF) return false;
|
|
865
|
-
if (this.backCode) {
|
|
866
|
-
if (this.lastCodePoint === cp2) {
|
|
867
|
-
this.backCode = false;
|
|
868
|
-
return true;
|
|
869
|
-
}
|
|
870
|
-
return false;
|
|
871
|
-
}
|
|
872
|
-
return this.codePointIterator.eat(cp2);
|
|
873
|
-
}
|
|
874
|
-
/**
|
|
875
|
-
* Moves the character position to the given position.
|
|
876
|
-
*/
|
|
877
|
-
moveAt(loc) {
|
|
878
|
-
if (this.backCode) this.backCode = false;
|
|
879
|
-
this.lastCodePoint = this.codePointIterator.moveAt(loc);
|
|
880
|
-
}
|
|
881
|
-
/**
|
|
882
|
-
* Back the current code point as the given state.
|
|
883
|
-
*/
|
|
884
|
-
back(state) {
|
|
885
|
-
this.backCode = true;
|
|
886
|
-
return state;
|
|
887
|
-
}
|
|
888
|
-
punctuatorToken() {
|
|
889
|
-
this.startToken();
|
|
890
|
-
this.endToken("Punctuator", "end");
|
|
891
|
-
}
|
|
892
|
-
startToken() {
|
|
893
|
-
this.tokenStart = this.codePointIterator.start;
|
|
894
|
-
}
|
|
895
|
-
/**
|
|
896
|
-
* Commit the current token.
|
|
897
|
-
*/
|
|
898
|
-
endToken(type, pos, option1, option2) {
|
|
899
|
-
const { tokenStart } = this;
|
|
900
|
-
const end = this.codePointIterator[pos];
|
|
901
|
-
const range = [tokenStart, end];
|
|
902
|
-
const loc = {
|
|
903
|
-
start: this.codePointIterator.getLocFromIndex(tokenStart),
|
|
904
|
-
end: this.codePointIterator.getLocFromIndex(end)
|
|
905
|
-
};
|
|
906
|
-
if (type === "Block") this.token = {
|
|
907
|
-
type,
|
|
908
|
-
value: this.text.slice(tokenStart + 1, end),
|
|
909
|
-
range,
|
|
910
|
-
loc
|
|
911
|
-
};
|
|
912
|
-
else {
|
|
913
|
-
let token;
|
|
914
|
-
const value = this.text.slice(tokenStart, end);
|
|
915
|
-
if (type === "BasicString" || type === "LiteralString" || type === "MultiLineBasicString" || type === "MultiLineLiteralString") token = {
|
|
916
|
-
type,
|
|
917
|
-
value,
|
|
918
|
-
string: option1,
|
|
919
|
-
range,
|
|
920
|
-
loc
|
|
921
|
-
};
|
|
922
|
-
else if (type === "Integer") {
|
|
923
|
-
const text = option1;
|
|
924
|
-
token = {
|
|
925
|
-
type,
|
|
926
|
-
value,
|
|
927
|
-
number: parseInt(text, option2),
|
|
928
|
-
bigint: HAS_BIGINT ? BigInt(RADIX_PREFIXES[option2] + text) : null,
|
|
929
|
-
range,
|
|
930
|
-
loc
|
|
931
|
-
};
|
|
932
|
-
} else if (type === "Float") token = {
|
|
933
|
-
type,
|
|
934
|
-
value,
|
|
935
|
-
number: option1,
|
|
936
|
-
range,
|
|
937
|
-
loc
|
|
938
|
-
};
|
|
939
|
-
else if (type === "Boolean") token = {
|
|
940
|
-
type,
|
|
941
|
-
value,
|
|
942
|
-
boolean: option1,
|
|
943
|
-
range,
|
|
944
|
-
loc
|
|
945
|
-
};
|
|
946
|
-
else if (type === "LocalDate" || type === "LocalTime" || type === "LocalDateTime" || type === "OffsetDateTime") token = {
|
|
947
|
-
type,
|
|
948
|
-
value,
|
|
949
|
-
date: option1,
|
|
950
|
-
range,
|
|
951
|
-
loc
|
|
952
|
-
};
|
|
953
|
-
else token = {
|
|
954
|
-
type,
|
|
955
|
-
value,
|
|
956
|
-
range,
|
|
957
|
-
loc
|
|
958
|
-
};
|
|
959
|
-
this.token = token;
|
|
960
|
-
}
|
|
961
|
-
}
|
|
962
|
-
DATA(cp2) {
|
|
963
|
-
while (isWhitespace(cp2) || isEOL(cp2)) cp2 = this.nextCode();
|
|
964
|
-
if (cp2 === CodePoint.HASH) {
|
|
965
|
-
this.startToken();
|
|
966
|
-
return "COMMENT";
|
|
967
|
-
}
|
|
968
|
-
if (cp2 === CodePoint.QUOTATION_MARK) {
|
|
969
|
-
this.startToken();
|
|
970
|
-
return "BASIC_STRING";
|
|
971
|
-
}
|
|
972
|
-
if (cp2 === CodePoint.SINGLE_QUOTE) {
|
|
973
|
-
this.startToken();
|
|
974
|
-
return "LITERAL_STRING";
|
|
975
|
-
}
|
|
976
|
-
if (cp2 === CodePoint.DOT || cp2 === CodePoint.EQUALS_SIGN || cp2 === CodePoint.LEFT_BRACKET || cp2 === CodePoint.RIGHT_BRACKET || cp2 === CodePoint.LEFT_BRACE || cp2 === CodePoint.RIGHT_BRACE || cp2 === CodePoint.COMMA) {
|
|
977
|
-
this.punctuatorToken();
|
|
978
|
-
return "DATA";
|
|
979
|
-
}
|
|
980
|
-
if (this.valuesEnabled) {
|
|
981
|
-
if (cp2 === CodePoint.DASH || cp2 === CodePoint.PLUS_SIGN) {
|
|
982
|
-
this.startToken();
|
|
983
|
-
return "SIGN";
|
|
984
|
-
}
|
|
985
|
-
if (cp2 === CodePoint.LATIN_SMALL_N || cp2 === CodePoint.LATIN_SMALL_I) {
|
|
986
|
-
this.startToken();
|
|
987
|
-
return this.back("NAN_OR_INF");
|
|
988
|
-
}
|
|
989
|
-
if (isDigit(cp2)) {
|
|
990
|
-
this.startToken();
|
|
991
|
-
return this.back("NUMBER");
|
|
992
|
-
}
|
|
993
|
-
if (cp2 === CodePoint.LATIN_SMALL_T || cp2 === CodePoint.LATIN_SMALL_F) {
|
|
994
|
-
this.startToken();
|
|
995
|
-
return this.back("BOOLEAN");
|
|
996
|
-
}
|
|
997
|
-
} else if (isUnquotedKeyChar(cp2, this.tomlVersion)) {
|
|
998
|
-
this.startToken();
|
|
999
|
-
return "BARE";
|
|
1000
|
-
}
|
|
1001
|
-
if (cp2 === CodePoint.EOF) return "DATA";
|
|
1002
|
-
return this.reportParseError("unexpected-char");
|
|
1003
|
-
}
|
|
1004
|
-
COMMENT(cp2) {
|
|
1005
|
-
const processCommentChar = this.tomlVersion.gte(1, 1) ? (c) => {
|
|
1006
|
-
if (!isNonEOL(c)) this.reportParseError("invalid-comment-character", { cp: JSON.stringify(String.fromCodePoint(c)).slice(1, -1) });
|
|
1007
|
-
} : (c) => {
|
|
1008
|
-
if (isControlOtherThanTab(c)) this.reportParseErrorControlChar();
|
|
1009
|
-
};
|
|
1010
|
-
while (!isEOL(cp2) && cp2 !== CodePoint.EOF) {
|
|
1011
|
-
processCommentChar(cp2);
|
|
1012
|
-
cp2 = this.nextCode();
|
|
1013
|
-
}
|
|
1014
|
-
this.endToken("Block", "start");
|
|
1015
|
-
return "DATA";
|
|
1016
|
-
}
|
|
1017
|
-
BARE(cp2) {
|
|
1018
|
-
while (isUnquotedKeyChar(cp2, this.tomlVersion)) cp2 = this.nextCode();
|
|
1019
|
-
this.endToken("Bare", "start");
|
|
1020
|
-
return this.back("DATA");
|
|
1021
|
-
}
|
|
1022
|
-
BASIC_STRING(cp2) {
|
|
1023
|
-
if (cp2 === CodePoint.QUOTATION_MARK) {
|
|
1024
|
-
cp2 = this.nextCode();
|
|
1025
|
-
if (cp2 === CodePoint.QUOTATION_MARK) return "MULTI_LINE_BASIC_STRING";
|
|
1026
|
-
this.endToken("BasicString", "start", "");
|
|
1027
|
-
return this.back("DATA");
|
|
1028
|
-
}
|
|
1029
|
-
const out = [];
|
|
1030
|
-
while (cp2 !== CodePoint.QUOTATION_MARK && cp2 !== CodePoint.EOF && cp2 !== CodePoint.LINE_FEED) {
|
|
1031
|
-
if (isControlOtherThanTab(cp2)) return this.reportParseErrorControlChar();
|
|
1032
|
-
if (cp2 === CodePoint.BACKSLASH) {
|
|
1033
|
-
cp2 = this.nextCode();
|
|
1034
|
-
const ecp = this.ESCAPES[cp2];
|
|
1035
|
-
if (ecp) {
|
|
1036
|
-
out.push(ecp);
|
|
1037
|
-
cp2 = this.nextCode();
|
|
1038
|
-
continue;
|
|
1039
|
-
} else if (cp2 === CodePoint.LATIN_SMALL_U) {
|
|
1040
|
-
const code = this.parseUnicode(4);
|
|
1041
|
-
out.push(code);
|
|
1042
|
-
cp2 = this.nextCode();
|
|
1043
|
-
continue;
|
|
1044
|
-
} else if (cp2 === CodePoint.LATIN_CAPITAL_U) {
|
|
1045
|
-
const code = this.parseUnicode(8);
|
|
1046
|
-
out.push(code);
|
|
1047
|
-
cp2 = this.nextCode();
|
|
1048
|
-
continue;
|
|
1049
|
-
} else if (cp2 === CodePoint.LATIN_SMALL_X && this.tomlVersion.gte(1, 1)) {
|
|
1050
|
-
const code = this.parseUnicode(2);
|
|
1051
|
-
out.push(code);
|
|
1052
|
-
cp2 = this.nextCode();
|
|
1053
|
-
continue;
|
|
1054
|
-
}
|
|
1055
|
-
return this.reportParseError("invalid-char-in-escape-sequence");
|
|
1056
|
-
}
|
|
1057
|
-
out.push(cp2);
|
|
1058
|
-
cp2 = this.nextCode();
|
|
1059
|
-
}
|
|
1060
|
-
if (cp2 !== CodePoint.QUOTATION_MARK) return this.reportParseError("unterminated-string");
|
|
1061
|
-
this.endToken("BasicString", "end", String.fromCodePoint(...out));
|
|
1062
|
-
return "DATA";
|
|
1063
|
-
}
|
|
1064
|
-
MULTI_LINE_BASIC_STRING(cp2) {
|
|
1065
|
-
const out = [];
|
|
1066
|
-
if (cp2 === CodePoint.LINE_FEED) cp2 = this.nextCode();
|
|
1067
|
-
while (cp2 !== CodePoint.EOF) {
|
|
1068
|
-
if (cp2 !== CodePoint.LINE_FEED && isControlOtherThanTab(cp2)) return this.reportParseErrorControlChar();
|
|
1069
|
-
if (cp2 === CodePoint.QUOTATION_MARK) {
|
|
1070
|
-
const startPos = this.codePointIterator.start;
|
|
1071
|
-
if (this.eatCode(CodePoint.QUOTATION_MARK) && this.eatCode(CodePoint.QUOTATION_MARK)) {
|
|
1072
|
-
if (this.eatCode(CodePoint.QUOTATION_MARK)) {
|
|
1073
|
-
out.push(CodePoint.QUOTATION_MARK);
|
|
1074
|
-
if (this.eatCode(CodePoint.QUOTATION_MARK)) {
|
|
1075
|
-
out.push(CodePoint.QUOTATION_MARK);
|
|
1076
|
-
if (this.eatCode(CodePoint.QUOTATION_MARK)) {
|
|
1077
|
-
this.moveAt(startPos);
|
|
1078
|
-
return this.reportParseError("invalid-three-quotes");
|
|
1079
|
-
}
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
this.endToken("MultiLineBasicString", "end", String.fromCodePoint(...out));
|
|
1083
|
-
return "DATA";
|
|
1084
|
-
}
|
|
1085
|
-
this.moveAt(startPos);
|
|
1086
|
-
}
|
|
1087
|
-
if (cp2 === CodePoint.BACKSLASH) {
|
|
1088
|
-
cp2 = this.nextCode();
|
|
1089
|
-
const ecp = this.ESCAPES[cp2];
|
|
1090
|
-
if (ecp) {
|
|
1091
|
-
out.push(ecp);
|
|
1092
|
-
cp2 = this.nextCode();
|
|
1093
|
-
continue;
|
|
1094
|
-
} else if (cp2 === CodePoint.LATIN_SMALL_U) {
|
|
1095
|
-
const code = this.parseUnicode(4);
|
|
1096
|
-
out.push(code);
|
|
1097
|
-
cp2 = this.nextCode();
|
|
1098
|
-
continue;
|
|
1099
|
-
} else if (cp2 === CodePoint.LATIN_CAPITAL_U) {
|
|
1100
|
-
const code = this.parseUnicode(8);
|
|
1101
|
-
out.push(code);
|
|
1102
|
-
cp2 = this.nextCode();
|
|
1103
|
-
continue;
|
|
1104
|
-
} else if (cp2 === CodePoint.LATIN_SMALL_X && this.tomlVersion.gte(1, 1)) {
|
|
1105
|
-
const code = this.parseUnicode(2);
|
|
1106
|
-
out.push(code);
|
|
1107
|
-
cp2 = this.nextCode();
|
|
1108
|
-
continue;
|
|
1109
|
-
} else if (cp2 === CodePoint.LINE_FEED) {
|
|
1110
|
-
cp2 = this.nextCode();
|
|
1111
|
-
while (isWhitespace(cp2) || cp2 === CodePoint.LINE_FEED) cp2 = this.nextCode();
|
|
1112
|
-
continue;
|
|
1113
|
-
} else if (isWhitespace(cp2)) {
|
|
1114
|
-
let valid = true;
|
|
1115
|
-
const startPos = this.codePointIterator.start;
|
|
1116
|
-
let nextCp;
|
|
1117
|
-
while ((nextCp = this.nextCode()) !== CodePoint.EOF) {
|
|
1118
|
-
if (nextCp === CodePoint.LINE_FEED) break;
|
|
1119
|
-
if (!isWhitespace(nextCp)) {
|
|
1120
|
-
this.moveAt(startPos);
|
|
1121
|
-
valid = false;
|
|
1122
|
-
break;
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
if (valid) {
|
|
1126
|
-
cp2 = this.nextCode();
|
|
1127
|
-
while (isWhitespace(cp2) || cp2 === CodePoint.LINE_FEED) cp2 = this.nextCode();
|
|
1128
|
-
continue;
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
return this.reportParseError("invalid-char-in-escape-sequence");
|
|
1132
|
-
}
|
|
1133
|
-
out.push(cp2);
|
|
1134
|
-
cp2 = this.nextCode();
|
|
1135
|
-
}
|
|
1136
|
-
return this.reportParseError("unterminated-string");
|
|
1137
|
-
}
|
|
1138
|
-
LITERAL_STRING(cp2) {
|
|
1139
|
-
if (cp2 === CodePoint.SINGLE_QUOTE) {
|
|
1140
|
-
cp2 = this.nextCode();
|
|
1141
|
-
if (cp2 === CodePoint.SINGLE_QUOTE) return "MULTI_LINE_LITERAL_STRING";
|
|
1142
|
-
this.endToken("LiteralString", "start", "");
|
|
1143
|
-
return this.back("DATA");
|
|
1144
|
-
}
|
|
1145
|
-
const out = [];
|
|
1146
|
-
while (cp2 !== CodePoint.SINGLE_QUOTE && cp2 !== CodePoint.EOF && cp2 !== CodePoint.LINE_FEED) {
|
|
1147
|
-
if (isControlOtherThanTab(cp2)) return this.reportParseErrorControlChar();
|
|
1148
|
-
out.push(cp2);
|
|
1149
|
-
cp2 = this.nextCode();
|
|
1150
|
-
}
|
|
1151
|
-
if (cp2 !== CodePoint.SINGLE_QUOTE) return this.reportParseError("unterminated-string");
|
|
1152
|
-
this.endToken("LiteralString", "end", String.fromCodePoint(...out));
|
|
1153
|
-
return "DATA";
|
|
1154
|
-
}
|
|
1155
|
-
MULTI_LINE_LITERAL_STRING(cp2) {
|
|
1156
|
-
const out = [];
|
|
1157
|
-
if (cp2 === CodePoint.LINE_FEED) cp2 = this.nextCode();
|
|
1158
|
-
while (cp2 !== CodePoint.EOF) {
|
|
1159
|
-
if (cp2 !== CodePoint.LINE_FEED && isControlOtherThanTab(cp2)) return this.reportParseErrorControlChar();
|
|
1160
|
-
if (cp2 === CodePoint.SINGLE_QUOTE) {
|
|
1161
|
-
const startPos = this.codePointIterator.start;
|
|
1162
|
-
if (this.eatCode(CodePoint.SINGLE_QUOTE) && this.eatCode(CodePoint.SINGLE_QUOTE)) {
|
|
1163
|
-
if (this.eatCode(CodePoint.SINGLE_QUOTE)) {
|
|
1164
|
-
out.push(CodePoint.SINGLE_QUOTE);
|
|
1165
|
-
if (this.eatCode(CodePoint.SINGLE_QUOTE)) {
|
|
1166
|
-
out.push(CodePoint.SINGLE_QUOTE);
|
|
1167
|
-
if (this.eatCode(CodePoint.SINGLE_QUOTE)) {
|
|
1168
|
-
this.moveAt(startPos);
|
|
1169
|
-
return this.reportParseError("invalid-three-quotes");
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
this.endToken("MultiLineLiteralString", "end", String.fromCodePoint(...out));
|
|
1174
|
-
return "DATA";
|
|
1175
|
-
}
|
|
1176
|
-
this.moveAt(startPos);
|
|
1177
|
-
}
|
|
1178
|
-
out.push(cp2);
|
|
1179
|
-
cp2 = this.nextCode();
|
|
1180
|
-
}
|
|
1181
|
-
return this.reportParseError("unterminated-string");
|
|
1182
|
-
}
|
|
1183
|
-
SIGN(cp2) {
|
|
1184
|
-
if (cp2 === CodePoint.LATIN_SMALL_N || cp2 === CodePoint.LATIN_SMALL_I) return this.back("NAN_OR_INF");
|
|
1185
|
-
if (isDigit(cp2)) return this.back("NUMBER");
|
|
1186
|
-
return this.reportParseError("unexpected-char");
|
|
1187
|
-
}
|
|
1188
|
-
NAN_OR_INF(cp2) {
|
|
1189
|
-
if (cp2 === CodePoint.LATIN_SMALL_N) {
|
|
1190
|
-
const startPos = this.codePointIterator.start;
|
|
1191
|
-
if (this.eatCode(CodePoint.LATIN_SMALL_A) && this.eatCode(CodePoint.LATIN_SMALL_N)) {
|
|
1192
|
-
this.endToken("Float", "end", NaN);
|
|
1193
|
-
return "DATA";
|
|
1194
|
-
}
|
|
1195
|
-
this.moveAt(startPos);
|
|
1196
|
-
} else if (cp2 === CodePoint.LATIN_SMALL_I) {
|
|
1197
|
-
const startPos = this.codePointIterator.start;
|
|
1198
|
-
if (this.eatCode(CodePoint.LATIN_SMALL_N) && this.eatCode(CodePoint.LATIN_SMALL_F)) {
|
|
1199
|
-
this.endToken("Float", "end", this.text[this.tokenStart] === "-" ? -Infinity : Infinity);
|
|
1200
|
-
return "DATA";
|
|
1201
|
-
}
|
|
1202
|
-
this.moveAt(startPos);
|
|
1203
|
-
}
|
|
1204
|
-
return this.reportParseError("unexpected-char");
|
|
1205
|
-
}
|
|
1206
|
-
NUMBER(cp2) {
|
|
1207
|
-
const start = this.text[this.tokenStart];
|
|
1208
|
-
const sign = start === "+" ? CodePoint.PLUS_SIGN : start === "-" ? CodePoint.DASH : CodePoint.NULL;
|
|
1209
|
-
if (cp2 === CodePoint.DIGIT_0) {
|
|
1210
|
-
if (sign === CodePoint.NULL) {
|
|
1211
|
-
const startPos = this.codePointIterator.start;
|
|
1212
|
-
const nextCp$1 = this.nextCode();
|
|
1213
|
-
if (isDigit(nextCp$1)) {
|
|
1214
|
-
const nextNextCp = this.nextCode();
|
|
1215
|
-
if (nextNextCp === CodePoint.COLON) {
|
|
1216
|
-
this.data = {
|
|
1217
|
-
hasDate: false,
|
|
1218
|
-
year: 0,
|
|
1219
|
-
month: 0,
|
|
1220
|
-
day: 0,
|
|
1221
|
-
hour: Number(String.fromCodePoint(CodePoint.DIGIT_0, nextCp$1)),
|
|
1222
|
-
minute: 0,
|
|
1223
|
-
second: 0
|
|
1224
|
-
};
|
|
1225
|
-
return "TIME_MINUTE";
|
|
1226
|
-
}
|
|
1227
|
-
if (isDigit(nextNextCp)) {
|
|
1228
|
-
const nextNextNextCp = this.nextCode();
|
|
1229
|
-
if (isDigit(nextNextNextCp) && this.eatCode(CodePoint.DASH)) {
|
|
1230
|
-
this.data = {
|
|
1231
|
-
hasDate: true,
|
|
1232
|
-
year: Number(String.fromCodePoint(CodePoint.DIGIT_0, nextCp$1, nextNextCp, nextNextNextCp)),
|
|
1233
|
-
month: 0,
|
|
1234
|
-
day: 0,
|
|
1235
|
-
hour: 0,
|
|
1236
|
-
minute: 0,
|
|
1237
|
-
second: 0
|
|
1238
|
-
};
|
|
1239
|
-
return "DATE_MONTH";
|
|
1240
|
-
}
|
|
1241
|
-
}
|
|
1242
|
-
this.moveAt(startPos);
|
|
1243
|
-
return this.reportParseError("invalid-leading-zero");
|
|
1244
|
-
}
|
|
1245
|
-
this.moveAt(startPos);
|
|
1246
|
-
}
|
|
1247
|
-
cp2 = this.nextCode();
|
|
1248
|
-
if (cp2 === CodePoint.LATIN_SMALL_X || cp2 === CodePoint.LATIN_SMALL_O || cp2 === CodePoint.LATIN_SMALL_B) {
|
|
1249
|
-
if (sign !== CodePoint.NULL) return this.reportParseError("unexpected-char");
|
|
1250
|
-
return cp2 === CodePoint.LATIN_SMALL_X ? "HEX" : cp2 === CodePoint.LATIN_SMALL_O ? "OCTAL" : "BINARY";
|
|
1251
|
-
}
|
|
1252
|
-
if (cp2 === CodePoint.LATIN_SMALL_E || cp2 === CodePoint.LATIN_CAPITAL_E) {
|
|
1253
|
-
this.data = {
|
|
1254
|
-
minus: sign === CodePoint.DASH,
|
|
1255
|
-
left: [CodePoint.DIGIT_0]
|
|
1256
|
-
};
|
|
1257
|
-
return "EXPONENT_RIGHT";
|
|
1258
|
-
}
|
|
1259
|
-
if (cp2 === CodePoint.DOT) {
|
|
1260
|
-
this.data = {
|
|
1261
|
-
minus: sign === CodePoint.DASH,
|
|
1262
|
-
absInt: [CodePoint.DIGIT_0]
|
|
1263
|
-
};
|
|
1264
|
-
return "FRACTIONAL_RIGHT";
|
|
1265
|
-
}
|
|
1266
|
-
this.endToken("Integer", "start", "0", 10);
|
|
1267
|
-
return this.back("DATA");
|
|
1268
|
-
}
|
|
1269
|
-
const { out, nextCp, hasUnderscore } = this.parseDigits(cp2, isDigit);
|
|
1270
|
-
if (nextCp === CodePoint.DASH && sign === CodePoint.NULL && !hasUnderscore && out.length === 4) {
|
|
1271
|
-
this.data = {
|
|
1272
|
-
hasDate: true,
|
|
1273
|
-
year: Number(String.fromCodePoint(...out)),
|
|
1274
|
-
month: 0,
|
|
1275
|
-
day: 0,
|
|
1276
|
-
hour: 0,
|
|
1277
|
-
minute: 0,
|
|
1278
|
-
second: 0
|
|
1279
|
-
};
|
|
1280
|
-
return "DATE_MONTH";
|
|
1281
|
-
}
|
|
1282
|
-
if (nextCp === CodePoint.COLON && sign === CodePoint.NULL && !hasUnderscore && out.length === 2) {
|
|
1283
|
-
this.data = {
|
|
1284
|
-
hasDate: false,
|
|
1285
|
-
year: 0,
|
|
1286
|
-
month: 0,
|
|
1287
|
-
day: 0,
|
|
1288
|
-
hour: Number(String.fromCodePoint(...out)),
|
|
1289
|
-
minute: 0,
|
|
1290
|
-
second: 0
|
|
1291
|
-
};
|
|
1292
|
-
return "TIME_MINUTE";
|
|
1293
|
-
}
|
|
1294
|
-
if (nextCp === CodePoint.LATIN_SMALL_E || nextCp === CodePoint.LATIN_CAPITAL_E) {
|
|
1295
|
-
this.data = {
|
|
1296
|
-
minus: sign === CodePoint.DASH,
|
|
1297
|
-
left: out
|
|
1298
|
-
};
|
|
1299
|
-
return "EXPONENT_RIGHT";
|
|
1300
|
-
}
|
|
1301
|
-
if (nextCp === CodePoint.DOT) {
|
|
1302
|
-
this.data = {
|
|
1303
|
-
minus: sign === CodePoint.DASH,
|
|
1304
|
-
absInt: out
|
|
1305
|
-
};
|
|
1306
|
-
return "FRACTIONAL_RIGHT";
|
|
1307
|
-
}
|
|
1308
|
-
this.endToken("Integer", "start", sign === CodePoint.DASH ? String.fromCodePoint(CodePoint.DASH, ...out) : String.fromCodePoint(...out), 10);
|
|
1309
|
-
return this.back("DATA");
|
|
1310
|
-
}
|
|
1311
|
-
HEX(cp2) {
|
|
1312
|
-
const { out } = this.parseDigits(cp2, isHexDig);
|
|
1313
|
-
this.endToken("Integer", "start", String.fromCodePoint(...out), 16);
|
|
1314
|
-
return this.back("DATA");
|
|
1315
|
-
}
|
|
1316
|
-
OCTAL(cp2) {
|
|
1317
|
-
const { out } = this.parseDigits(cp2, isOctalDig);
|
|
1318
|
-
this.endToken("Integer", "start", String.fromCodePoint(...out), 8);
|
|
1319
|
-
return this.back("DATA");
|
|
1320
|
-
}
|
|
1321
|
-
BINARY(cp2) {
|
|
1322
|
-
const { out } = this.parseDigits(cp2, (c) => c === CodePoint.DIGIT_0 || c === CodePoint.DIGIT_1);
|
|
1323
|
-
this.endToken("Integer", "start", String.fromCodePoint(...out), 2);
|
|
1324
|
-
return this.back("DATA");
|
|
1325
|
-
}
|
|
1326
|
-
FRACTIONAL_RIGHT(cp2) {
|
|
1327
|
-
const { minus, absInt } = this.data;
|
|
1328
|
-
const { out, nextCp } = this.parseDigits(cp2, isDigit);
|
|
1329
|
-
const absNum = [
|
|
1330
|
-
...absInt,
|
|
1331
|
-
CodePoint.DOT,
|
|
1332
|
-
...out
|
|
1333
|
-
];
|
|
1334
|
-
if (nextCp === CodePoint.LATIN_SMALL_E || nextCp === CodePoint.LATIN_CAPITAL_E) {
|
|
1335
|
-
this.data = {
|
|
1336
|
-
minus,
|
|
1337
|
-
left: absNum
|
|
1338
|
-
};
|
|
1339
|
-
return "EXPONENT_RIGHT";
|
|
1340
|
-
}
|
|
1341
|
-
const value = Number(minus ? String.fromCodePoint(CodePoint.DASH, ...absNum) : String.fromCodePoint(...absNum));
|
|
1342
|
-
this.endToken("Float", "start", value);
|
|
1343
|
-
return this.back("DATA");
|
|
1344
|
-
}
|
|
1345
|
-
EXPONENT_RIGHT(cp2) {
|
|
1346
|
-
const { left, minus: leftMinus } = this.data;
|
|
1347
|
-
let minus = false;
|
|
1348
|
-
if (cp2 === CodePoint.DASH || cp2 === CodePoint.PLUS_SIGN) {
|
|
1349
|
-
minus = cp2 === CodePoint.DASH;
|
|
1350
|
-
cp2 = this.nextCode();
|
|
1351
|
-
}
|
|
1352
|
-
const { out } = this.parseDigits(cp2, isDigit);
|
|
1353
|
-
const right = out;
|
|
1354
|
-
if (minus) right.unshift(CodePoint.DASH);
|
|
1355
|
-
const value = Number(leftMinus ? String.fromCodePoint(CodePoint.DASH, ...left, CodePoint.LATIN_SMALL_E, ...right) : String.fromCodePoint(...left, CodePoint.LATIN_SMALL_E, ...right));
|
|
1356
|
-
this.endToken("Float", "start", value);
|
|
1357
|
-
return this.back("DATA");
|
|
1358
|
-
}
|
|
1359
|
-
BOOLEAN(cp2) {
|
|
1360
|
-
if (cp2 === CodePoint.LATIN_SMALL_T) {
|
|
1361
|
-
const startPos = this.codePointIterator.start;
|
|
1362
|
-
if (this.eatCode(CodePoint.LATIN_SMALL_R) && this.eatCode(CodePoint.LATIN_SMALL_U) && this.eatCode(CodePoint.LATIN_SMALL_E)) {
|
|
1363
|
-
this.endToken("Boolean", "end", true);
|
|
1364
|
-
return "DATA";
|
|
1365
|
-
}
|
|
1366
|
-
this.moveAt(startPos);
|
|
1367
|
-
} else if (cp2 === CodePoint.LATIN_SMALL_F) {
|
|
1368
|
-
const startPos = this.codePointIterator.start;
|
|
1369
|
-
if (this.eatCode(CodePoint.LATIN_SMALL_A) && this.eatCode(CodePoint.LATIN_SMALL_L) && this.eatCode(CodePoint.LATIN_SMALL_S) && this.eatCode(CodePoint.LATIN_SMALL_E)) {
|
|
1370
|
-
this.endToken("Boolean", "end", false);
|
|
1371
|
-
return "DATA";
|
|
1372
|
-
}
|
|
1373
|
-
this.moveAt(startPos);
|
|
1374
|
-
}
|
|
1375
|
-
return this.reportParseError("unexpected-char");
|
|
1376
|
-
}
|
|
1377
|
-
DATE_MONTH(cp2) {
|
|
1378
|
-
const start = this.codePointIterator.start;
|
|
1379
|
-
if (!isDigit(cp2)) return this.reportParseError("unexpected-char");
|
|
1380
|
-
cp2 = this.nextCode();
|
|
1381
|
-
if (!isDigit(cp2)) return this.reportParseError("unexpected-char");
|
|
1382
|
-
cp2 = this.nextCode();
|
|
1383
|
-
if (cp2 !== CodePoint.DASH) return this.reportParseError("unexpected-char");
|
|
1384
|
-
const end = this.codePointIterator.start;
|
|
1385
|
-
const data = this.data;
|
|
1386
|
-
data.month = Number(this.text.slice(start, end));
|
|
1387
|
-
return "DATE_DAY";
|
|
1388
|
-
}
|
|
1389
|
-
DATE_DAY(cp2) {
|
|
1390
|
-
const start = this.codePointIterator.start;
|
|
1391
|
-
if (!isDigit(cp2)) return this.reportParseError("unexpected-char");
|
|
1392
|
-
cp2 = this.nextCode();
|
|
1393
|
-
if (!isDigit(cp2)) return this.reportParseError("unexpected-char");
|
|
1394
|
-
const end = this.codePointIterator.end;
|
|
1395
|
-
const data = this.data;
|
|
1396
|
-
data.day = Number(this.text.slice(start, end));
|
|
1397
|
-
if (!isValidDate(data.year, data.month, data.day)) return this.reportParseError("invalid-date");
|
|
1398
|
-
cp2 = this.nextCode();
|
|
1399
|
-
if (cp2 === CodePoint.LATIN_CAPITAL_T || cp2 === CodePoint.LATIN_SMALL_T) return "TIME_HOUR";
|
|
1400
|
-
if (cp2 === CodePoint.SPACE) {
|
|
1401
|
-
const startPos = this.codePointIterator.start;
|
|
1402
|
-
if (isDigit(this.nextCode()) && isDigit(this.nextCode())) {
|
|
1403
|
-
this.moveAt(startPos);
|
|
1404
|
-
return "TIME_HOUR";
|
|
1405
|
-
}
|
|
1406
|
-
this.moveAt(startPos);
|
|
1407
|
-
}
|
|
1408
|
-
const dateValue = getDateFromDateTimeData(data, "");
|
|
1409
|
-
this.endToken("LocalDate", "start", dateValue);
|
|
1410
|
-
return this.back("DATA");
|
|
1411
|
-
}
|
|
1412
|
-
TIME_HOUR(cp2) {
|
|
1413
|
-
const start = this.codePointIterator.start;
|
|
1414
|
-
if (!isDigit(cp2)) return this.reportParseError("unexpected-char");
|
|
1415
|
-
cp2 = this.nextCode();
|
|
1416
|
-
if (!isDigit(cp2)) return this.reportParseError("unexpected-char");
|
|
1417
|
-
cp2 = this.nextCode();
|
|
1418
|
-
if (cp2 !== CodePoint.COLON) return this.reportParseError("unexpected-char");
|
|
1419
|
-
const end = this.codePointIterator.start;
|
|
1420
|
-
const data = this.data;
|
|
1421
|
-
data.hour = Number(this.text.slice(start, end));
|
|
1422
|
-
return "TIME_MINUTE";
|
|
1423
|
-
}
|
|
1424
|
-
TIME_MINUTE(cp2) {
|
|
1425
|
-
const start = this.codePointIterator.start;
|
|
1426
|
-
if (!isDigit(cp2)) return this.reportParseError("unexpected-char");
|
|
1427
|
-
cp2 = this.nextCode();
|
|
1428
|
-
if (!isDigit(cp2)) return this.reportParseError("unexpected-char");
|
|
1429
|
-
const end = this.codePointIterator.end;
|
|
1430
|
-
const data = this.data;
|
|
1431
|
-
data.minute = Number(this.text.slice(start, end));
|
|
1432
|
-
cp2 = this.nextCode();
|
|
1433
|
-
if (cp2 === CodePoint.COLON) return "TIME_SECOND";
|
|
1434
|
-
if (this.tomlVersion.lt(1, 1)) return this.reportParseError("unexpected-char");
|
|
1435
|
-
if (!isValidTime(data.hour, data.minute, data.second)) return this.reportParseError("invalid-time");
|
|
1436
|
-
return this.processTimeEnd(cp2, data);
|
|
1437
|
-
}
|
|
1438
|
-
TIME_SECOND(cp2) {
|
|
1439
|
-
const start = this.codePointIterator.start;
|
|
1440
|
-
if (!isDigit(cp2)) return this.reportParseError("unexpected-char");
|
|
1441
|
-
cp2 = this.nextCode();
|
|
1442
|
-
if (!isDigit(cp2)) return this.reportParseError("unexpected-char");
|
|
1443
|
-
const end = this.codePointIterator.end;
|
|
1444
|
-
const data = this.data;
|
|
1445
|
-
data.second = Number(this.text.slice(start, end));
|
|
1446
|
-
if (!isValidTime(data.hour, data.minute, data.second)) return this.reportParseError("invalid-time");
|
|
1447
|
-
cp2 = this.nextCode();
|
|
1448
|
-
if (cp2 === CodePoint.DOT) return "TIME_SEC_FRAC";
|
|
1449
|
-
return this.processTimeEnd(cp2, data);
|
|
1450
|
-
}
|
|
1451
|
-
TIME_SEC_FRAC(cp2) {
|
|
1452
|
-
if (!isDigit(cp2)) return this.reportParseError("unexpected-char");
|
|
1453
|
-
const start = this.codePointIterator.start;
|
|
1454
|
-
while (isDigit(cp2)) cp2 = this.nextCode();
|
|
1455
|
-
const end = this.codePointIterator.start;
|
|
1456
|
-
const data = this.data;
|
|
1457
|
-
data.frac = this.text.slice(start, end);
|
|
1458
|
-
return this.processTimeEnd(cp2, data);
|
|
1459
|
-
}
|
|
1460
|
-
processTimeEnd(cp2, data) {
|
|
1461
|
-
if (data.hasDate) {
|
|
1462
|
-
if (cp2 === CodePoint.DASH || cp2 === CodePoint.PLUS_SIGN) {
|
|
1463
|
-
data.offsetSign = cp2;
|
|
1464
|
-
return "TIME_OFFSET";
|
|
1465
|
-
}
|
|
1466
|
-
if (cp2 === CodePoint.LATIN_CAPITAL_Z || cp2 === CodePoint.LATIN_SMALL_Z) {
|
|
1467
|
-
const dateValue$2 = getDateFromDateTimeData(data, "Z");
|
|
1468
|
-
this.endToken("OffsetDateTime", "end", dateValue$2);
|
|
1469
|
-
return "DATA";
|
|
1470
|
-
}
|
|
1471
|
-
const dateValue$1 = getDateFromDateTimeData(data, "");
|
|
1472
|
-
this.endToken("LocalDateTime", "start", dateValue$1);
|
|
1473
|
-
return this.back("DATA");
|
|
1474
|
-
}
|
|
1475
|
-
const dateValue = getDateFromDateTimeData(data, "");
|
|
1476
|
-
this.endToken("LocalTime", "start", dateValue);
|
|
1477
|
-
return this.back("DATA");
|
|
1478
|
-
}
|
|
1479
|
-
TIME_OFFSET(cp2) {
|
|
1480
|
-
if (!isDigit(cp2)) return this.reportParseError("unexpected-char");
|
|
1481
|
-
const hourStart = this.codePointIterator.start;
|
|
1482
|
-
cp2 = this.nextCode();
|
|
1483
|
-
if (!isDigit(cp2)) return this.reportParseError("unexpected-char");
|
|
1484
|
-
cp2 = this.nextCode();
|
|
1485
|
-
if (cp2 !== CodePoint.COLON) return this.reportParseError("unexpected-char");
|
|
1486
|
-
const hourEnd = this.codePointIterator.start;
|
|
1487
|
-
cp2 = this.nextCode();
|
|
1488
|
-
const minuteStart = this.codePointIterator.start;
|
|
1489
|
-
if (!isDigit(cp2)) return this.reportParseError("unexpected-char");
|
|
1490
|
-
cp2 = this.nextCode();
|
|
1491
|
-
if (!isDigit(cp2)) return this.reportParseError("unexpected-char");
|
|
1492
|
-
const minuteEnd = this.codePointIterator.end;
|
|
1493
|
-
const hour = Number(this.text.slice(hourStart, hourEnd));
|
|
1494
|
-
const minute = Number(this.text.slice(minuteStart, minuteEnd));
|
|
1495
|
-
if (!isValidTime(hour, minute, 0)) return this.reportParseError("invalid-time");
|
|
1496
|
-
const data = this.data;
|
|
1497
|
-
const dateValue = getDateFromDateTimeData(data, `${String.fromCodePoint(data.offsetSign)}${padStart(hour, 2)}:${padStart(minute, 2)}`);
|
|
1498
|
-
this.endToken("OffsetDateTime", "end", dateValue);
|
|
1499
|
-
return "DATA";
|
|
1500
|
-
}
|
|
1501
|
-
parseDigits(cp2, checkDigit) {
|
|
1502
|
-
if (cp2 === CodePoint.UNDERSCORE) return this.reportParseError("invalid-underscore");
|
|
1503
|
-
if (!checkDigit(cp2)) return this.reportParseError("unexpected-char");
|
|
1504
|
-
const out = [];
|
|
1505
|
-
let before = CodePoint.NULL;
|
|
1506
|
-
let hasUnderscore = false;
|
|
1507
|
-
while (checkDigit(cp2) || cp2 === CodePoint.UNDERSCORE) {
|
|
1508
|
-
if (cp2 === CodePoint.UNDERSCORE) {
|
|
1509
|
-
hasUnderscore = true;
|
|
1510
|
-
if (before === CodePoint.UNDERSCORE) return this.reportParseError("invalid-underscore");
|
|
1511
|
-
} else out.push(cp2);
|
|
1512
|
-
before = cp2;
|
|
1513
|
-
cp2 = this.nextCode();
|
|
1514
|
-
}
|
|
1515
|
-
if (before === CodePoint.UNDERSCORE) return this.reportParseError("invalid-underscore");
|
|
1516
|
-
return {
|
|
1517
|
-
out,
|
|
1518
|
-
nextCp: cp2,
|
|
1519
|
-
hasUnderscore
|
|
1520
|
-
};
|
|
1521
|
-
}
|
|
1522
|
-
parseUnicode(count) {
|
|
1523
|
-
const startLoc = this.codePointIterator.start;
|
|
1524
|
-
const start = this.codePointIterator.end;
|
|
1525
|
-
let charCount = 0;
|
|
1526
|
-
let cp2;
|
|
1527
|
-
while ((cp2 = this.nextCode()) !== CodePoint.EOF) {
|
|
1528
|
-
if (!isHexDig(cp2)) {
|
|
1529
|
-
this.moveAt(startLoc);
|
|
1530
|
-
return this.reportParseError("invalid-char-in-escape-sequence");
|
|
1531
|
-
}
|
|
1532
|
-
charCount++;
|
|
1533
|
-
if (charCount >= count) break;
|
|
1534
|
-
}
|
|
1535
|
-
const end = this.codePointIterator.end;
|
|
1536
|
-
const code = this.text.slice(start, end);
|
|
1537
|
-
const codePoint = parseInt(code, 16);
|
|
1538
|
-
if (!isUnicodeScalarValue(codePoint)) return this.reportParseError("invalid-code-point", { cp: code });
|
|
1539
|
-
return codePoint;
|
|
1540
|
-
}
|
|
1541
|
-
reportParseErrorControlChar() {
|
|
1542
|
-
return this.reportParseError("invalid-control-character");
|
|
1543
|
-
}
|
|
1544
|
-
};
|
|
1545
|
-
function isUnquotedKeyChar(cp2, tomlVersion) {
|
|
1546
|
-
if (isLetter(cp2) || isDigit(cp2) || cp2 === CodePoint.UNDERSCORE || cp2 === CodePoint.DASH) return true;
|
|
1547
|
-
if (tomlVersion.lt(1, 1)) return false;
|
|
1548
|
-
return false;
|
|
1549
|
-
}
|
|
1550
|
-
function isControlOtherThanTab(cp2) {
|
|
1551
|
-
return isControl(cp2) && cp2 !== CodePoint.TABULATION || cp2 === CodePoint.DELETE;
|
|
1552
|
-
}
|
|
1553
|
-
function isNonEOL(cp2) {
|
|
1554
|
-
return cp2 === CodePoint.TABULATION || CodePoint.SPACE <= cp2 && cp2 <= CodePoint.TILDE || isNonAscii(cp2);
|
|
1555
|
-
}
|
|
1556
|
-
function isNonAscii(cp2) {
|
|
1557
|
-
return CodePoint.PAD <= cp2 && cp2 <= CodePoint.CP_D7FF || CodePoint.CP_E000 <= cp2 && cp2 <= CodePoint.CP_10FFFF;
|
|
1558
|
-
}
|
|
1559
|
-
function isValidDate(y, m, d) {
|
|
1560
|
-
if (y >= 0 && m <= 12 && m >= 1 && d >= 1) return d <= (m === 2 ? y & 3 || !(y % 25) && y & 15 ? 28 : 29 : 30 + (m + (m >> 3) & 1));
|
|
1561
|
-
return false;
|
|
1562
|
-
}
|
|
1563
|
-
function isValidTime(h, m, s) {
|
|
1564
|
-
if (h >= 24 || h < 0 || m > 59 || m < 0 || s > 60 || s < 0) return false;
|
|
1565
|
-
return true;
|
|
1566
|
-
}
|
|
1567
|
-
function getDateFromDateTimeData(data, timeZone) {
|
|
1568
|
-
const year = padStart(data.year, 4);
|
|
1569
|
-
const month = data.month ? padStart(data.month, 2) : "01";
|
|
1570
|
-
const day = data.day ? padStart(data.day, 2) : "01";
|
|
1571
|
-
const hour = padStart(data.hour, 2);
|
|
1572
|
-
const minute = padStart(data.minute, 2);
|
|
1573
|
-
const second = padStart(data.second, 2);
|
|
1574
|
-
const textDate = `${year}-${month}-${day}`;
|
|
1575
|
-
const frac = data.frac ? `.${data.frac}` : "";
|
|
1576
|
-
const dateValue = /* @__PURE__ */ new Date(`${textDate}T${hour}:${minute}:${second}${frac}${timeZone}`);
|
|
1577
|
-
if (!isNaN(dateValue.getTime()) || data.second !== 60) return dateValue;
|
|
1578
|
-
return /* @__PURE__ */ new Date(`${textDate}T${hour}:${minute}:59${frac}${timeZone}`);
|
|
1579
|
-
}
|
|
1580
|
-
function padStart(num, maxLength) {
|
|
1581
|
-
return String(num).padStart(maxLength, "0");
|
|
1582
|
-
}
|
|
1583
|
-
var VALUE_KIND_VALUE = /* @__PURE__ */ Symbol("VALUE_KIND_VALUE");
|
|
1584
|
-
var VALUE_KIND_INTERMEDIATE = /* @__PURE__ */ Symbol("VALUE_KIND_INTERMEDIATE");
|
|
1585
|
-
var KeysResolver = class {
|
|
1586
|
-
constructor(ctx) {
|
|
1587
|
-
this.rootKeys = /* @__PURE__ */ new Map();
|
|
1588
|
-
this.tables = [];
|
|
1589
|
-
this.ctx = ctx;
|
|
1590
|
-
}
|
|
1591
|
-
applyResolveKeyForTable(node) {
|
|
1592
|
-
let keys = this.rootKeys;
|
|
1593
|
-
const peekKeyIndex = node.key.keys.length - 1;
|
|
1594
|
-
for (let index = 0; index < peekKeyIndex; index++) {
|
|
1595
|
-
const keyNode = node.key.keys[index];
|
|
1596
|
-
const keyName = toKeyName(keyNode);
|
|
1597
|
-
node.resolvedKey.push(keyName);
|
|
1598
|
-
let keyStore = keys.get(keyName);
|
|
1599
|
-
if (!keyStore) {
|
|
1600
|
-
keyStore = {
|
|
1601
|
-
node: keyNode,
|
|
1602
|
-
keys: /* @__PURE__ */ new Map()
|
|
1603
|
-
};
|
|
1604
|
-
keys.set(keyName, keyStore);
|
|
1605
|
-
} else if (keyStore.table === "array") {
|
|
1606
|
-
const peekIndex = keyStore.peekIndex;
|
|
1607
|
-
node.resolvedKey.push(peekIndex);
|
|
1608
|
-
keyStore = keyStore.keys.get(peekIndex);
|
|
1609
|
-
}
|
|
1610
|
-
keys = keyStore.keys;
|
|
1611
|
-
}
|
|
1612
|
-
const lastKeyNode = node.key.keys[peekKeyIndex];
|
|
1613
|
-
const lastKeyName = toKeyName(lastKeyNode);
|
|
1614
|
-
node.resolvedKey.push(lastKeyName);
|
|
1615
|
-
const lastKeyStore = keys.get(lastKeyName);
|
|
1616
|
-
if (!lastKeyStore) if (node.kind === "array") {
|
|
1617
|
-
node.resolvedKey.push(0);
|
|
1618
|
-
const newKeyStore = {
|
|
1619
|
-
node: lastKeyNode,
|
|
1620
|
-
keys: /* @__PURE__ */ new Map()
|
|
1621
|
-
};
|
|
1622
|
-
keys.set(lastKeyName, {
|
|
1623
|
-
table: node.kind,
|
|
1624
|
-
node: lastKeyNode,
|
|
1625
|
-
keys: /* @__PURE__ */ new Map([[0, newKeyStore]]),
|
|
1626
|
-
peekIndex: 0
|
|
1627
|
-
});
|
|
1628
|
-
this.tables.push({
|
|
1629
|
-
node,
|
|
1630
|
-
keys: newKeyStore.keys
|
|
1631
|
-
});
|
|
1632
|
-
} else {
|
|
1633
|
-
const newKeyStore = {
|
|
1634
|
-
table: node.kind,
|
|
1635
|
-
node: lastKeyNode,
|
|
1636
|
-
keys: /* @__PURE__ */ new Map()
|
|
1637
|
-
};
|
|
1638
|
-
keys.set(lastKeyName, newKeyStore);
|
|
1639
|
-
this.tables.push({
|
|
1640
|
-
node,
|
|
1641
|
-
keys: newKeyStore.keys
|
|
1642
|
-
});
|
|
1643
|
-
}
|
|
1644
|
-
else if (!lastKeyStore.table) if (node.kind === "array") this.ctx.reportParseError("dupe-keys", lastKeyNode);
|
|
1645
|
-
else {
|
|
1646
|
-
const transformKey = {
|
|
1647
|
-
table: node.kind,
|
|
1648
|
-
node: lastKeyNode,
|
|
1649
|
-
keys: lastKeyStore.keys
|
|
1650
|
-
};
|
|
1651
|
-
keys.set(lastKeyName, transformKey);
|
|
1652
|
-
this.tables.push({
|
|
1653
|
-
node,
|
|
1654
|
-
keys: transformKey.keys
|
|
1655
|
-
});
|
|
1656
|
-
}
|
|
1657
|
-
else if (lastKeyStore.table === "array") if (node.kind === "array") {
|
|
1658
|
-
const newKeyStore = {
|
|
1659
|
-
node: lastKeyNode,
|
|
1660
|
-
keys: /* @__PURE__ */ new Map()
|
|
1661
|
-
};
|
|
1662
|
-
const newIndex = lastKeyStore.peekIndex + 1;
|
|
1663
|
-
node.resolvedKey.push(newIndex);
|
|
1664
|
-
lastKeyStore.keys.set(newIndex, newKeyStore);
|
|
1665
|
-
lastKeyStore.peekIndex = newIndex;
|
|
1666
|
-
this.tables.push({
|
|
1667
|
-
node,
|
|
1668
|
-
keys: newKeyStore.keys
|
|
1669
|
-
});
|
|
1670
|
-
} else this.ctx.reportParseError("dupe-keys", lastKeyNode);
|
|
1671
|
-
else this.ctx.reportParseError("dupe-keys", lastKeyNode);
|
|
1672
|
-
}
|
|
1673
|
-
verifyDuplicateKeys(node) {
|
|
1674
|
-
for (const body of node.body) if (body.type === "TOMLKeyValue") verifyDuplicateKeysForKeyValue(this.ctx, this.rootKeys, body);
|
|
1675
|
-
for (const { node: tableNode, keys } of this.tables) for (const body of tableNode.body) verifyDuplicateKeysForKeyValue(this.ctx, keys, body);
|
|
1676
|
-
}
|
|
1677
|
-
};
|
|
1678
|
-
function verifyDuplicateKeysForKeyValue(ctx, defineKeys, node) {
|
|
1679
|
-
let keys = defineKeys;
|
|
1680
|
-
const lastKey = last(node.key.keys);
|
|
1681
|
-
for (const keyNode of node.key.keys) {
|
|
1682
|
-
const key = toKeyName(keyNode);
|
|
1683
|
-
let defineKey = keys.get(key);
|
|
1684
|
-
if (defineKey) {
|
|
1685
|
-
if (defineKey.value === VALUE_KIND_VALUE) ctx.reportParseError("dupe-keys", getAfterNode(keyNode, defineKey.node));
|
|
1686
|
-
else if (lastKey === keyNode) ctx.reportParseError("dupe-keys", getAfterNode(keyNode, defineKey.node));
|
|
1687
|
-
else if (defineKey.table) ctx.reportParseError("dupe-keys", getAfterNode(keyNode, defineKey.node));
|
|
1688
|
-
defineKey.value = VALUE_KIND_INTERMEDIATE;
|
|
1689
|
-
} else {
|
|
1690
|
-
if (lastKey === keyNode) defineKey = {
|
|
1691
|
-
value: VALUE_KIND_VALUE,
|
|
1692
|
-
node: keyNode,
|
|
1693
|
-
keys: /* @__PURE__ */ new Map()
|
|
1694
|
-
};
|
|
1695
|
-
else defineKey = {
|
|
1696
|
-
value: VALUE_KIND_INTERMEDIATE,
|
|
1697
|
-
node: keyNode,
|
|
1698
|
-
keys: /* @__PURE__ */ new Map()
|
|
1699
|
-
};
|
|
1700
|
-
keys.set(key, defineKey);
|
|
1701
|
-
}
|
|
1702
|
-
keys = defineKey.keys;
|
|
1703
|
-
}
|
|
1704
|
-
if (node.value.type === "TOMLInlineTable") verifyDuplicateKeysForInlineTable(ctx, keys, node.value);
|
|
1705
|
-
else if (node.value.type === "TOMLArray") verifyDuplicateKeysForArray(ctx, keys, node.value);
|
|
1706
|
-
}
|
|
1707
|
-
function verifyDuplicateKeysForInlineTable(ctx, defineKeys, node) {
|
|
1708
|
-
for (const body of node.body) verifyDuplicateKeysForKeyValue(ctx, defineKeys, body);
|
|
1709
|
-
}
|
|
1710
|
-
function verifyDuplicateKeysForArray(ctx, defineKeys, node) {
|
|
1711
|
-
const keys = defineKeys;
|
|
1712
|
-
for (let index = 0; index < node.elements.length; index++) {
|
|
1713
|
-
const element = node.elements[index];
|
|
1714
|
-
let defineKey = keys.get(index);
|
|
1715
|
-
if (defineKey) ctx.reportParseError("dupe-keys", getAfterNode(element, defineKey.node));
|
|
1716
|
-
else {
|
|
1717
|
-
defineKey = {
|
|
1718
|
-
value: VALUE_KIND_VALUE,
|
|
1719
|
-
node: element,
|
|
1720
|
-
keys: /* @__PURE__ */ new Map()
|
|
1721
|
-
};
|
|
1722
|
-
defineKeys.set(index, defineKey);
|
|
1723
|
-
if (element.type === "TOMLInlineTable") verifyDuplicateKeysForInlineTable(ctx, defineKey.keys, element);
|
|
1724
|
-
else if (element.type === "TOMLArray") verifyDuplicateKeysForArray(ctx, defineKey.keys, element);
|
|
1725
|
-
}
|
|
1726
|
-
}
|
|
1727
|
-
}
|
|
1728
|
-
function getAfterNode(a, b) {
|
|
1729
|
-
return a.range[0] <= b.range[0] ? b : a;
|
|
1730
|
-
}
|
|
1731
|
-
var Context = class {
|
|
1732
|
-
constructor(data) {
|
|
1733
|
-
this.tokens = [];
|
|
1734
|
-
this.comments = [];
|
|
1735
|
-
this.back = null;
|
|
1736
|
-
this.stateStack = [];
|
|
1737
|
-
this.needNewLine = false;
|
|
1738
|
-
this.needSameLine = false;
|
|
1739
|
-
this.currToken = null;
|
|
1740
|
-
this.prevToken = null;
|
|
1741
|
-
this.valueContainerStack = [];
|
|
1742
|
-
this.tokenizer = new Tokenizer(data.text, data.parserOptions);
|
|
1743
|
-
this.topLevelTable = data.topLevelTable;
|
|
1744
|
-
this.table = data.topLevelTable;
|
|
1745
|
-
this.keysResolver = new KeysResolver(this);
|
|
1746
|
-
}
|
|
1747
|
-
/**
|
|
1748
|
-
* Get the next token.
|
|
1749
|
-
*/
|
|
1750
|
-
nextToken(option) {
|
|
1751
|
-
this.prevToken = this.currToken;
|
|
1752
|
-
if (this.back) {
|
|
1753
|
-
this.currToken = this.back;
|
|
1754
|
-
this.back = null;
|
|
1755
|
-
} else this.currToken = this._nextTokenFromTokenizer(option);
|
|
1756
|
-
if ((this.needNewLine || this.needSameLine || option?.needSameLine) && this.prevToken && this.currToken) if (this.prevToken.loc.end.line === this.currToken.loc.start.line) {
|
|
1757
|
-
if (this.needNewLine) return this.reportParseError("missing-newline", this.currToken);
|
|
1758
|
-
} else {
|
|
1759
|
-
const needSameLine = this.needSameLine || option?.needSameLine;
|
|
1760
|
-
if (needSameLine) return this.reportParseError(needSameLine, this.currToken);
|
|
1761
|
-
}
|
|
1762
|
-
this.needNewLine = false;
|
|
1763
|
-
this.needSameLine = false;
|
|
1764
|
-
return this.currToken;
|
|
1765
|
-
}
|
|
1766
|
-
_nextTokenFromTokenizer(option) {
|
|
1767
|
-
const valuesEnabled = this.tokenizer.valuesEnabled;
|
|
1768
|
-
if (option?.valuesEnabled) this.tokenizer.valuesEnabled = option.valuesEnabled;
|
|
1769
|
-
let token = this.tokenizer.nextToken();
|
|
1770
|
-
while (token && token.type === "Block") {
|
|
1771
|
-
this.comments.push(token);
|
|
1772
|
-
token = this.tokenizer.nextToken();
|
|
1773
|
-
}
|
|
1774
|
-
if (token) this.tokens.push(token);
|
|
1775
|
-
this.tokenizer.valuesEnabled = valuesEnabled;
|
|
1776
|
-
return token;
|
|
1777
|
-
}
|
|
1778
|
-
backToken() {
|
|
1779
|
-
if (this.back) throw new Error("Illegal state");
|
|
1780
|
-
this.back = this.currToken;
|
|
1781
|
-
this.currToken = this.prevToken;
|
|
1782
|
-
}
|
|
1783
|
-
addValueContainer(valueContainer) {
|
|
1784
|
-
this.valueContainerStack.push(valueContainer);
|
|
1785
|
-
this.tokenizer.valuesEnabled = true;
|
|
1786
|
-
}
|
|
1787
|
-
consumeValueContainer() {
|
|
1788
|
-
const valueContainer = this.valueContainerStack.pop();
|
|
1789
|
-
this.tokenizer.valuesEnabled = this.valueContainerStack.length > 0;
|
|
1790
|
-
return valueContainer;
|
|
1791
|
-
}
|
|
1792
|
-
applyResolveKeyForTable(node) {
|
|
1793
|
-
this.keysResolver.applyResolveKeyForTable(node);
|
|
1794
|
-
}
|
|
1795
|
-
verifyDuplicateKeys() {
|
|
1796
|
-
this.keysResolver.verifyDuplicateKeys(this.topLevelTable);
|
|
1797
|
-
}
|
|
1798
|
-
/**
|
|
1799
|
-
* Report an invalid token error.
|
|
1800
|
-
*/
|
|
1801
|
-
reportParseError(code, token) {
|
|
1802
|
-
let offset, line, column;
|
|
1803
|
-
if (token) {
|
|
1804
|
-
offset = token.range[0];
|
|
1805
|
-
line = token.loc.start.line;
|
|
1806
|
-
column = token.loc.start.column;
|
|
1807
|
-
} else {
|
|
1808
|
-
offset = this.tokenizer.start;
|
|
1809
|
-
const startPos = this.tokenizer.getLocFromIndex(offset);
|
|
1810
|
-
line = startPos.line;
|
|
1811
|
-
column = startPos.column;
|
|
1812
|
-
}
|
|
1813
|
-
throw new ParseError(code, offset, line, column);
|
|
1814
|
-
}
|
|
1815
|
-
};
|
|
1816
|
-
var STATE_FOR_ERROR = { VALUE: "missing-value" };
|
|
1817
|
-
var STRING_VALUE_STYLE_MAP = {
|
|
1818
|
-
BasicString: "basic",
|
|
1819
|
-
MultiLineBasicString: "basic",
|
|
1820
|
-
LiteralString: "literal",
|
|
1821
|
-
MultiLineLiteralString: "literal"
|
|
1822
|
-
};
|
|
1823
|
-
var STRING_KEY_STYLE_MAP = {
|
|
1824
|
-
BasicString: "basic",
|
|
1825
|
-
LiteralString: "literal"
|
|
1826
|
-
};
|
|
1827
|
-
var DATETIME_VALUE_KIND_MAP = {
|
|
1828
|
-
OffsetDateTime: "offset-date-time",
|
|
1829
|
-
LocalDateTime: "local-date-time",
|
|
1830
|
-
LocalDate: "local-date",
|
|
1831
|
-
LocalTime: "local-time"
|
|
1832
|
-
};
|
|
1833
|
-
var TOMLParser = class {
|
|
1834
|
-
/**
|
|
1835
|
-
* Initialize this parser.
|
|
1836
|
-
*/
|
|
1837
|
-
constructor(text, parserOptions) {
|
|
1838
|
-
this.text = text;
|
|
1839
|
-
this.parserOptions = parserOptions || {};
|
|
1840
|
-
this.tomlVersion = getTOMLVer(this.parserOptions.tomlVersion);
|
|
1841
|
-
}
|
|
1842
|
-
/**
|
|
1843
|
-
* Parse TOML
|
|
1844
|
-
*/
|
|
1845
|
-
parse() {
|
|
1846
|
-
const ast = {
|
|
1847
|
-
type: "Program",
|
|
1848
|
-
body: [],
|
|
1849
|
-
sourceType: "module",
|
|
1850
|
-
tokens: [],
|
|
1851
|
-
comments: [],
|
|
1852
|
-
parent: null,
|
|
1853
|
-
range: [0, 0],
|
|
1854
|
-
loc: {
|
|
1855
|
-
start: {
|
|
1856
|
-
line: 1,
|
|
1857
|
-
column: 0
|
|
1858
|
-
},
|
|
1859
|
-
end: {
|
|
1860
|
-
line: 1,
|
|
1861
|
-
column: 0
|
|
1862
|
-
}
|
|
1863
|
-
}
|
|
1864
|
-
};
|
|
1865
|
-
const node = {
|
|
1866
|
-
type: "TOMLTopLevelTable",
|
|
1867
|
-
body: [],
|
|
1868
|
-
parent: ast,
|
|
1869
|
-
range: cloneRange(ast.range),
|
|
1870
|
-
loc: cloneLoc(ast.loc)
|
|
1871
|
-
};
|
|
1872
|
-
ast.body = [node];
|
|
1873
|
-
const ctx = new Context({
|
|
1874
|
-
text: this.text,
|
|
1875
|
-
parserOptions: this.parserOptions,
|
|
1876
|
-
topLevelTable: node
|
|
1877
|
-
});
|
|
1878
|
-
let token = ctx.nextToken();
|
|
1879
|
-
if (token) {
|
|
1880
|
-
node.range[0] = token.range[0];
|
|
1881
|
-
node.loc.start = clonePos(token.loc.start);
|
|
1882
|
-
while (token) {
|
|
1883
|
-
const state$1 = ctx.stateStack.pop() || "TABLE";
|
|
1884
|
-
ctx.stateStack.push(...this[state$1](token, ctx));
|
|
1885
|
-
token = ctx.nextToken();
|
|
1886
|
-
}
|
|
1887
|
-
const state = ctx.stateStack.pop() || "TABLE";
|
|
1888
|
-
if (state in STATE_FOR_ERROR) return ctx.reportParseError(STATE_FOR_ERROR[state], null);
|
|
1889
|
-
if (ctx.table.type === "TOMLTable") applyEndLoc(ctx.table, last(ctx.table.body));
|
|
1890
|
-
applyEndLoc(node, last(node.body));
|
|
1891
|
-
}
|
|
1892
|
-
ctx.verifyDuplicateKeys();
|
|
1893
|
-
ast.tokens = ctx.tokens;
|
|
1894
|
-
ast.comments = ctx.comments;
|
|
1895
|
-
const endOffset = ctx.tokenizer.end;
|
|
1896
|
-
const endPos = ctx.tokenizer.getLocFromIndex(endOffset);
|
|
1897
|
-
ast.range[1] = endOffset;
|
|
1898
|
-
ast.loc.end = {
|
|
1899
|
-
line: endPos.line,
|
|
1900
|
-
column: endPos.column
|
|
1901
|
-
};
|
|
1902
|
-
return ast;
|
|
1903
|
-
}
|
|
1904
|
-
TABLE(token, ctx) {
|
|
1905
|
-
if (isBare(token) || isString(token)) return this.processKeyValue(token, ctx.table, ctx);
|
|
1906
|
-
if (isLeftBracket(token)) return this.processTable(token, ctx.topLevelTable, ctx);
|
|
1907
|
-
return ctx.reportParseError("unexpected-token", token);
|
|
1908
|
-
}
|
|
1909
|
-
VALUE(token, ctx) {
|
|
1910
|
-
if (isString(token) || isMultiLineString(token)) return this.processStringValue(token, ctx);
|
|
1911
|
-
if (isNumber(token)) return this.processNumberValue(token, ctx);
|
|
1912
|
-
if (isBoolean(token)) return this.processBooleanValue(token, ctx);
|
|
1913
|
-
if (isDateTime(token)) return this.processDateTimeValue(token, ctx);
|
|
1914
|
-
if (isLeftBracket(token)) return this.processArray(token, ctx);
|
|
1915
|
-
if (isLeftBrace(token)) return this.processInlineTable(token, ctx);
|
|
1916
|
-
return ctx.reportParseError("unexpected-token", token);
|
|
1917
|
-
}
|
|
1918
|
-
processTable(token, topLevelTableNode, ctx) {
|
|
1919
|
-
const tableNode = {
|
|
1920
|
-
type: "TOMLTable",
|
|
1921
|
-
kind: "standard",
|
|
1922
|
-
key: null,
|
|
1923
|
-
resolvedKey: [],
|
|
1924
|
-
body: [],
|
|
1925
|
-
parent: topLevelTableNode,
|
|
1926
|
-
range: cloneRange(token.range),
|
|
1927
|
-
loc: cloneLoc(token.loc)
|
|
1928
|
-
};
|
|
1929
|
-
if (ctx.table.type === "TOMLTable") applyEndLoc(ctx.table, last(ctx.table.body));
|
|
1930
|
-
topLevelTableNode.body.push(tableNode);
|
|
1931
|
-
ctx.table = tableNode;
|
|
1932
|
-
let targetToken = ctx.nextToken({ needSameLine: "invalid-key-value-newline" });
|
|
1933
|
-
if (isLeftBracket(targetToken)) {
|
|
1934
|
-
if (token.range[1] < targetToken.range[0]) return ctx.reportParseError("invalid-space", targetToken);
|
|
1935
|
-
tableNode.kind = "array";
|
|
1936
|
-
targetToken = ctx.nextToken({ needSameLine: "invalid-key-value-newline" });
|
|
1937
|
-
}
|
|
1938
|
-
if (isRightBracket(targetToken)) return ctx.reportParseError("missing-key", targetToken);
|
|
1939
|
-
if (!targetToken) return ctx.reportParseError("unterminated-table-key", null);
|
|
1940
|
-
targetToken = this.processKeyNode(targetToken, tableNode, ctx).nextToken;
|
|
1941
|
-
if (!isRightBracket(targetToken)) return ctx.reportParseError("unterminated-table-key", targetToken);
|
|
1942
|
-
if (tableNode.kind === "array") {
|
|
1943
|
-
const rightBracket = targetToken;
|
|
1944
|
-
targetToken = ctx.nextToken({ needSameLine: "invalid-key-value-newline" });
|
|
1945
|
-
if (!isRightBracket(targetToken)) return ctx.reportParseError("unterminated-table-key", targetToken);
|
|
1946
|
-
if (rightBracket.range[1] < targetToken.range[0]) return ctx.reportParseError("invalid-space", targetToken);
|
|
1947
|
-
}
|
|
1948
|
-
applyEndLoc(tableNode, targetToken);
|
|
1949
|
-
ctx.applyResolveKeyForTable(tableNode);
|
|
1950
|
-
ctx.needNewLine = true;
|
|
1951
|
-
return [];
|
|
1952
|
-
}
|
|
1953
|
-
processKeyValue(token, tableNode, ctx) {
|
|
1954
|
-
const keyValueNode = {
|
|
1955
|
-
type: "TOMLKeyValue",
|
|
1956
|
-
key: null,
|
|
1957
|
-
value: null,
|
|
1958
|
-
parent: tableNode,
|
|
1959
|
-
range: cloneRange(token.range),
|
|
1960
|
-
loc: cloneLoc(token.loc)
|
|
1961
|
-
};
|
|
1962
|
-
tableNode.body.push(keyValueNode);
|
|
1963
|
-
const { nextToken: targetToken } = this.processKeyNode(token, keyValueNode, ctx);
|
|
1964
|
-
if (!isEq(targetToken)) return ctx.reportParseError("missing-equals-sign", targetToken);
|
|
1965
|
-
ctx.addValueContainer({
|
|
1966
|
-
parent: keyValueNode,
|
|
1967
|
-
set: (valNode) => {
|
|
1968
|
-
keyValueNode.value = valNode;
|
|
1969
|
-
applyEndLoc(keyValueNode, valNode);
|
|
1970
|
-
ctx.needNewLine = true;
|
|
1971
|
-
return [];
|
|
1972
|
-
}
|
|
1973
|
-
});
|
|
1974
|
-
ctx.needSameLine = "invalid-key-value-newline";
|
|
1975
|
-
return ["VALUE"];
|
|
1976
|
-
}
|
|
1977
|
-
processKeyNode(token, parent, ctx) {
|
|
1978
|
-
if (isDot(token)) ctx.reportParseError("invalid-leading-dot-in-key", token);
|
|
1979
|
-
const keyNode = {
|
|
1980
|
-
type: "TOMLKey",
|
|
1981
|
-
keys: [],
|
|
1982
|
-
parent,
|
|
1983
|
-
range: cloneRange(token.range),
|
|
1984
|
-
loc: cloneLoc(token.loc)
|
|
1985
|
-
};
|
|
1986
|
-
parent.key = keyNode;
|
|
1987
|
-
let targetToken = token;
|
|
1988
|
-
let dotToken = null;
|
|
1989
|
-
do {
|
|
1990
|
-
if (isBare(targetToken)) this.processBareKey(targetToken, keyNode);
|
|
1991
|
-
else if (isString(targetToken)) this.processStringKey(targetToken, keyNode);
|
|
1992
|
-
else break;
|
|
1993
|
-
dotToken = null;
|
|
1994
|
-
targetToken = ctx.nextToken({ needSameLine: "invalid-key-value-newline" });
|
|
1995
|
-
if (!isDot(targetToken)) break;
|
|
1996
|
-
dotToken = targetToken;
|
|
1997
|
-
targetToken = ctx.nextToken({ needSameLine: "invalid-key-value-newline" });
|
|
1998
|
-
} while (targetToken);
|
|
1999
|
-
if (dotToken) ctx.reportParseError(isDot(targetToken) ? "invalid-consecutive-dots-in-key" : "invalid-trailing-dot-in-key", dotToken);
|
|
2000
|
-
applyEndLoc(keyNode, last(keyNode.keys));
|
|
2001
|
-
return {
|
|
2002
|
-
keyNode,
|
|
2003
|
-
nextToken: targetToken
|
|
2004
|
-
};
|
|
2005
|
-
}
|
|
2006
|
-
processBareKey(token, keyNode) {
|
|
2007
|
-
const node = {
|
|
2008
|
-
type: "TOMLBare",
|
|
2009
|
-
name: token.value,
|
|
2010
|
-
parent: keyNode,
|
|
2011
|
-
range: cloneRange(token.range),
|
|
2012
|
-
loc: cloneLoc(token.loc)
|
|
2013
|
-
};
|
|
2014
|
-
keyNode.keys.push(node);
|
|
2015
|
-
}
|
|
2016
|
-
processStringKey(token, keyNode) {
|
|
2017
|
-
const node = {
|
|
2018
|
-
type: "TOMLQuoted",
|
|
2019
|
-
kind: "string",
|
|
2020
|
-
value: token.string,
|
|
2021
|
-
style: STRING_KEY_STYLE_MAP[token.type],
|
|
2022
|
-
multiline: false,
|
|
2023
|
-
parent: keyNode,
|
|
2024
|
-
range: cloneRange(token.range),
|
|
2025
|
-
loc: cloneLoc(token.loc)
|
|
2026
|
-
};
|
|
2027
|
-
keyNode.keys.push(node);
|
|
2028
|
-
}
|
|
2029
|
-
processStringValue(token, ctx) {
|
|
2030
|
-
const valueContainer = ctx.consumeValueContainer();
|
|
2031
|
-
const node = {
|
|
2032
|
-
type: "TOMLValue",
|
|
2033
|
-
kind: "string",
|
|
2034
|
-
value: token.string,
|
|
2035
|
-
style: STRING_VALUE_STYLE_MAP[token.type],
|
|
2036
|
-
multiline: isMultiLineString(token),
|
|
2037
|
-
parent: valueContainer.parent,
|
|
2038
|
-
range: cloneRange(token.range),
|
|
2039
|
-
loc: cloneLoc(token.loc)
|
|
2040
|
-
};
|
|
2041
|
-
return valueContainer.set(node);
|
|
2042
|
-
}
|
|
2043
|
-
processNumberValue(token, ctx) {
|
|
2044
|
-
const valueContainer = ctx.consumeValueContainer();
|
|
2045
|
-
const text = this.text;
|
|
2046
|
-
const [startRange, endRange] = token.range;
|
|
2047
|
-
let numberString = null;
|
|
2048
|
-
const getNumberText = () => {
|
|
2049
|
-
return numberString ?? (numberString = text.slice(startRange, endRange).replace(/_/g, ""));
|
|
2050
|
-
};
|
|
2051
|
-
let node;
|
|
2052
|
-
if (token.type === "Integer") node = {
|
|
2053
|
-
type: "TOMLValue",
|
|
2054
|
-
kind: "integer",
|
|
2055
|
-
value: token.number,
|
|
2056
|
-
bigint: token.bigint,
|
|
2057
|
-
get number() {
|
|
2058
|
-
return getNumberText();
|
|
2059
|
-
},
|
|
2060
|
-
parent: valueContainer.parent,
|
|
2061
|
-
range: cloneRange(token.range),
|
|
2062
|
-
loc: cloneLoc(token.loc)
|
|
2063
|
-
};
|
|
2064
|
-
else node = {
|
|
2065
|
-
type: "TOMLValue",
|
|
2066
|
-
kind: "float",
|
|
2067
|
-
value: token.number,
|
|
2068
|
-
get number() {
|
|
2069
|
-
return getNumberText();
|
|
2070
|
-
},
|
|
2071
|
-
parent: valueContainer.parent,
|
|
2072
|
-
range: cloneRange(token.range),
|
|
2073
|
-
loc: cloneLoc(token.loc)
|
|
2074
|
-
};
|
|
2075
|
-
return valueContainer.set(node);
|
|
2076
|
-
}
|
|
2077
|
-
processBooleanValue(token, ctx) {
|
|
2078
|
-
const valueContainer = ctx.consumeValueContainer();
|
|
2079
|
-
const node = {
|
|
2080
|
-
type: "TOMLValue",
|
|
2081
|
-
kind: "boolean",
|
|
2082
|
-
value: token.boolean,
|
|
2083
|
-
parent: valueContainer.parent,
|
|
2084
|
-
range: cloneRange(token.range),
|
|
2085
|
-
loc: cloneLoc(token.loc)
|
|
2086
|
-
};
|
|
2087
|
-
return valueContainer.set(node);
|
|
2088
|
-
}
|
|
2089
|
-
processDateTimeValue(token, ctx) {
|
|
2090
|
-
const valueContainer = ctx.consumeValueContainer();
|
|
2091
|
-
const node = {
|
|
2092
|
-
type: "TOMLValue",
|
|
2093
|
-
kind: DATETIME_VALUE_KIND_MAP[token.type],
|
|
2094
|
-
value: token.date,
|
|
2095
|
-
datetime: token.value,
|
|
2096
|
-
parent: valueContainer.parent,
|
|
2097
|
-
range: cloneRange(token.range),
|
|
2098
|
-
loc: cloneLoc(token.loc)
|
|
2099
|
-
};
|
|
2100
|
-
return valueContainer.set(node);
|
|
2101
|
-
}
|
|
2102
|
-
processArray(token, ctx) {
|
|
2103
|
-
const valueContainer = ctx.consumeValueContainer();
|
|
2104
|
-
const node = {
|
|
2105
|
-
type: "TOMLArray",
|
|
2106
|
-
elements: [],
|
|
2107
|
-
parent: valueContainer.parent,
|
|
2108
|
-
range: cloneRange(token.range),
|
|
2109
|
-
loc: cloneLoc(token.loc)
|
|
2110
|
-
};
|
|
2111
|
-
const nextToken = ctx.nextToken({ valuesEnabled: true });
|
|
2112
|
-
if (isRightBracket(nextToken)) {
|
|
2113
|
-
applyEndLoc(node, nextToken);
|
|
2114
|
-
return valueContainer.set(node);
|
|
2115
|
-
}
|
|
2116
|
-
ctx.backToken();
|
|
2117
|
-
return this.processArrayValue(node, valueContainer, ctx);
|
|
2118
|
-
}
|
|
2119
|
-
processArrayValue(node, valueContainer, ctx) {
|
|
2120
|
-
ctx.addValueContainer({
|
|
2121
|
-
parent: node,
|
|
2122
|
-
set: (valNode) => {
|
|
2123
|
-
node.elements.push(valNode);
|
|
2124
|
-
let nextToken = ctx.nextToken({ valuesEnabled: true });
|
|
2125
|
-
const hasComma = isComma(nextToken);
|
|
2126
|
-
if (hasComma) nextToken = ctx.nextToken({ valuesEnabled: true });
|
|
2127
|
-
if (isRightBracket(nextToken)) {
|
|
2128
|
-
applyEndLoc(node, nextToken);
|
|
2129
|
-
return valueContainer.set(node);
|
|
2130
|
-
}
|
|
2131
|
-
if (hasComma) {
|
|
2132
|
-
ctx.backToken();
|
|
2133
|
-
return this.processArrayValue(node, valueContainer, ctx);
|
|
2134
|
-
}
|
|
2135
|
-
return ctx.reportParseError(nextToken ? "missing-comma" : "unterminated-array", nextToken);
|
|
2136
|
-
}
|
|
2137
|
-
});
|
|
2138
|
-
return ["VALUE"];
|
|
2139
|
-
}
|
|
2140
|
-
processInlineTable(token, ctx) {
|
|
2141
|
-
const valueContainer = ctx.consumeValueContainer();
|
|
2142
|
-
const node = {
|
|
2143
|
-
type: "TOMLInlineTable",
|
|
2144
|
-
body: [],
|
|
2145
|
-
parent: valueContainer.parent,
|
|
2146
|
-
range: cloneRange(token.range),
|
|
2147
|
-
loc: cloneLoc(token.loc)
|
|
2148
|
-
};
|
|
2149
|
-
const needSameLine = this.tomlVersion.gte(1, 1) ? void 0 : "invalid-inline-table-newline";
|
|
2150
|
-
const nextToken = ctx.nextToken({ needSameLine });
|
|
2151
|
-
if (nextToken) {
|
|
2152
|
-
if (isBare(nextToken) || isString(nextToken)) return this.processInlineTableKeyValue(nextToken, node, valueContainer, ctx);
|
|
2153
|
-
if (isRightBrace(nextToken)) {
|
|
2154
|
-
applyEndLoc(node, nextToken);
|
|
2155
|
-
return valueContainer.set(node);
|
|
2156
|
-
}
|
|
2157
|
-
}
|
|
2158
|
-
return ctx.reportParseError("unexpected-token", nextToken);
|
|
2159
|
-
}
|
|
2160
|
-
processInlineTableKeyValue(token, inlineTableNode, valueContainer, ctx) {
|
|
2161
|
-
const keyValueNode = {
|
|
2162
|
-
type: "TOMLKeyValue",
|
|
2163
|
-
key: null,
|
|
2164
|
-
value: null,
|
|
2165
|
-
parent: inlineTableNode,
|
|
2166
|
-
range: cloneRange(token.range),
|
|
2167
|
-
loc: cloneLoc(token.loc)
|
|
2168
|
-
};
|
|
2169
|
-
inlineTableNode.body.push(keyValueNode);
|
|
2170
|
-
const { nextToken: targetToken } = this.processKeyNode(token, keyValueNode, ctx);
|
|
2171
|
-
if (!isEq(targetToken)) return ctx.reportParseError("missing-equals-sign", targetToken);
|
|
2172
|
-
const needSameLine = this.tomlVersion.gte(1, 1) ? void 0 : "invalid-inline-table-newline";
|
|
2173
|
-
ctx.addValueContainer({
|
|
2174
|
-
parent: keyValueNode,
|
|
2175
|
-
set: (valNode) => {
|
|
2176
|
-
keyValueNode.value = valNode;
|
|
2177
|
-
applyEndLoc(keyValueNode, valNode);
|
|
2178
|
-
let nextToken = ctx.nextToken({ needSameLine });
|
|
2179
|
-
if (isComma(nextToken)) {
|
|
2180
|
-
nextToken = ctx.nextToken({ needSameLine });
|
|
2181
|
-
if (nextToken && (isBare(nextToken) || isString(nextToken))) return this.processInlineTableKeyValue(nextToken, inlineTableNode, valueContainer, ctx);
|
|
2182
|
-
if (isRightBrace(nextToken)) {
|
|
2183
|
-
if (this.tomlVersion.lt(1, 1)) return ctx.reportParseError("invalid-trailing-comma-in-inline-table", nextToken);
|
|
2184
|
-
} else return ctx.reportParseError(nextToken ? "unexpected-token" : "unterminated-inline-table", nextToken);
|
|
2185
|
-
}
|
|
2186
|
-
if (isRightBrace(nextToken)) {
|
|
2187
|
-
applyEndLoc(inlineTableNode, nextToken);
|
|
2188
|
-
return valueContainer.set(inlineTableNode);
|
|
2189
|
-
}
|
|
2190
|
-
return ctx.reportParseError(nextToken ? "missing-comma" : "unterminated-inline-table", nextToken);
|
|
2191
|
-
}
|
|
2192
|
-
});
|
|
2193
|
-
ctx.needSameLine = "invalid-key-value-newline";
|
|
2194
|
-
return ["VALUE"];
|
|
2195
|
-
}
|
|
2196
|
-
};
|
|
2197
|
-
function isDot(token) {
|
|
2198
|
-
return isPunctuator(token) && token.value === ".";
|
|
2199
|
-
}
|
|
2200
|
-
function isEq(token) {
|
|
2201
|
-
return isPunctuator(token) && token.value === "=";
|
|
2202
|
-
}
|
|
2203
|
-
function isLeftBracket(token) {
|
|
2204
|
-
return isPunctuator(token) && token.value === "[";
|
|
2205
|
-
}
|
|
2206
|
-
function isRightBracket(token) {
|
|
2207
|
-
return isPunctuator(token) && token.value === "]";
|
|
2208
|
-
}
|
|
2209
|
-
function isLeftBrace(token) {
|
|
2210
|
-
return isPunctuator(token) && token.value === "{";
|
|
2211
|
-
}
|
|
2212
|
-
function isRightBrace(token) {
|
|
2213
|
-
return isPunctuator(token) && token.value === "}";
|
|
2214
|
-
}
|
|
2215
|
-
function isComma(token) {
|
|
2216
|
-
return isPunctuator(token) && token.value === ",";
|
|
2217
|
-
}
|
|
2218
|
-
function isPunctuator(token) {
|
|
2219
|
-
return Boolean(token && token.type === "Punctuator");
|
|
2220
|
-
}
|
|
2221
|
-
function isBare(token) {
|
|
2222
|
-
return token.type === "Bare";
|
|
2223
|
-
}
|
|
2224
|
-
function isString(token) {
|
|
2225
|
-
return token.type === "BasicString" || token.type === "LiteralString";
|
|
2226
|
-
}
|
|
2227
|
-
function isMultiLineString(token) {
|
|
2228
|
-
return token.type === "MultiLineBasicString" || token.type === "MultiLineLiteralString";
|
|
2229
|
-
}
|
|
2230
|
-
function isNumber(token) {
|
|
2231
|
-
return token.type === "Integer" || token.type === "Float";
|
|
2232
|
-
}
|
|
2233
|
-
function isBoolean(token) {
|
|
2234
|
-
return token.type === "Boolean";
|
|
2235
|
-
}
|
|
2236
|
-
function isDateTime(token) {
|
|
2237
|
-
return token.type === "OffsetDateTime" || token.type === "LocalDateTime" || token.type === "LocalDate" || token.type === "LocalTime";
|
|
2238
|
-
}
|
|
2239
|
-
function applyEndLoc(node, child) {
|
|
2240
|
-
if (child) {
|
|
2241
|
-
node.range[1] = child.range[1];
|
|
2242
|
-
node.loc.end = clonePos(child.loc.end);
|
|
2243
|
-
}
|
|
2244
|
-
}
|
|
2245
|
-
function cloneRange(range) {
|
|
2246
|
-
return [range[0], range[1]];
|
|
2247
|
-
}
|
|
2248
|
-
function cloneLoc(loc) {
|
|
2249
|
-
return {
|
|
2250
|
-
start: clonePos(loc.start),
|
|
2251
|
-
end: clonePos(loc.end)
|
|
2252
|
-
};
|
|
2253
|
-
}
|
|
2254
|
-
function clonePos(pos) {
|
|
2255
|
-
return {
|
|
2256
|
-
line: pos.line,
|
|
2257
|
-
column: pos.column
|
|
2258
|
-
};
|
|
2259
|
-
}
|
|
2260
398
|
var tomlKeys = {
|
|
2261
399
|
Program: ["body"],
|
|
2262
400
|
TOMLTopLevelTable: ["body"],
|
|
@@ -2270,13 +408,6 @@ var tomlKeys = {
|
|
|
2270
408
|
TOMLValue: []
|
|
2271
409
|
};
|
|
2272
410
|
var KEYS2 = unionWith(tomlKeys);
|
|
2273
|
-
function parseForESLint(code, options) {
|
|
2274
|
-
return {
|
|
2275
|
-
ast: new TOMLParser(code, options).parse(),
|
|
2276
|
-
visitorKeys: KEYS2,
|
|
2277
|
-
services: { isTOML: true }
|
|
2278
|
-
};
|
|
2279
|
-
}
|
|
2280
411
|
var getStaticTOMLValue = generateConvertTOMLValue((node) => node.value);
|
|
2281
412
|
function generateConvertTOMLValue(convertValue) {
|
|
2282
413
|
function resolveValue(node, baseTable) {
|
|
@@ -2403,120 +534,10 @@ function set(baseTable, keys, value) {
|
|
|
2403
534
|
function isValue(value) {
|
|
2404
535
|
return typeof value !== "object" || value instanceof Date;
|
|
2405
536
|
}
|
|
2406
|
-
function parseTOML(code, options) {
|
|
2407
|
-
return parseForESLint(code, options).ast;
|
|
2408
|
-
}
|
|
2409
|
-
|
|
2410
|
-
// ../hexasync-template-client-setup/src/config/toml.ts
|
|
2411
|
-
function keyPath(key) {
|
|
2412
|
-
return key.keys.map((component) => component.type === "TOMLBare" ? component.name : component.value);
|
|
2413
|
-
}
|
|
2414
|
-
function renderTomlValue(value) {
|
|
2415
|
-
if (Array.isArray(value)) return `[${value.map((item) => JSON.stringify(item)).join(", ")}]`;
|
|
2416
|
-
return typeof value === "string" ? JSON.stringify(value) : String(value);
|
|
2417
|
-
}
|
|
2418
|
-
function planTomlServerTable(beforeImage, request) {
|
|
2419
|
-
const [mapKey, name] = request.tablePath;
|
|
2420
|
-
const removing = request.fields === null;
|
|
2421
|
-
const refused = (status, reason) => Object.freeze({ status, afterImage: beforeImage, operation: removing ? "remove" : "add", reason });
|
|
2422
|
-
const text = beforeImage ?? "";
|
|
2423
|
-
let parsed;
|
|
2424
|
-
try {
|
|
2425
|
-
parsed = parseTOML(text, { tomlVersion: "1.0" });
|
|
2426
|
-
} catch {
|
|
2427
|
-
return refused("Malformed", "The configuration is not valid TOML; repair it before installing.");
|
|
2428
|
-
}
|
|
2429
|
-
let owned = null;
|
|
2430
|
-
const descendants = [];
|
|
2431
|
-
for (const statement of parsed.body[0].body) {
|
|
2432
|
-
const path = keyPath(statement.key);
|
|
2433
|
-
if (path[0] !== mapKey) continue;
|
|
2434
|
-
if (statement.type === "TOMLKeyValue") {
|
|
2435
|
-
if (path.length === 1 || path[1] === name) return refused("Unsupported", `\`${mapKey}\` is defined with dotted or inline keys; edit \`${name}\` manually.`);
|
|
2436
|
-
continue;
|
|
2437
|
-
}
|
|
2438
|
-
if (path.length === 1) {
|
|
2439
|
-
if (statement.kind === "array" || statement.body.some((field) => keyPath(field.key)[0] === name)) {
|
|
2440
|
-
return refused("Unsupported", `\`${name}\` is defined inline under \`[${mapKey}]\`; edit it manually.`);
|
|
2441
|
-
}
|
|
2442
|
-
continue;
|
|
2443
|
-
}
|
|
2444
|
-
if (path[1] !== name) continue;
|
|
2445
|
-
if (path.length > 2) {
|
|
2446
|
-
descendants.push(statement);
|
|
2447
|
-
continue;
|
|
2448
|
-
}
|
|
2449
|
-
if (statement.kind !== "standard" || owned !== null) return refused("Unsupported", `\`${name}\` is declared more than once or as an array table.`);
|
|
2450
|
-
owned = statement;
|
|
2451
|
-
}
|
|
2452
|
-
const outcome = (afterImage, operation) => {
|
|
2453
|
-
if (afterImage !== beforeImage) {
|
|
2454
|
-
try {
|
|
2455
|
-
parseTOML(afterImage ?? "", { tomlVersion: "1.0" });
|
|
2456
|
-
} catch {
|
|
2457
|
-
return refused("Unsupported", "The preserving edit cannot guarantee valid TOML; the original file was kept.");
|
|
2458
|
-
}
|
|
2459
|
-
}
|
|
2460
|
-
return Object.freeze({ status: afterImage === beforeImage ? "NoOp" : "Planned", afterImage, operation });
|
|
2461
|
-
};
|
|
2462
|
-
const apply = (edits2) => {
|
|
2463
|
-
let result = text;
|
|
2464
|
-
for (const edit of [...edits2].sort((a, b) => b.start - a.start)) result = result.slice(0, edit.start) + edit.text + result.slice(edit.end);
|
|
2465
|
-
return result;
|
|
2466
|
-
};
|
|
2467
|
-
const newline = /\r\n|\n|\r/.exec(text)?.[0] ?? "\n";
|
|
2468
|
-
const header = `[${mapKey}.${JSON.stringify(name)}]`;
|
|
2469
|
-
if (owned === null) {
|
|
2470
|
-
if (removing) return outcome(beforeImage, "remove");
|
|
2471
|
-
const table = header + newline + Object.entries(request.fields).map(([key, value]) => `${key} = ${renderTomlValue(value)}`).join(newline) + newline;
|
|
2472
|
-
return outcome(text + (text.length && !/[\r\n]$/.test(text) ? newline : "") + (text.length ? newline : "") + table, "add");
|
|
2473
|
-
}
|
|
2474
|
-
const closing = parsed.tokens.find((token) => token.type === "Punctuator" && token.value === "]" && token.range[0] >= owned.key.range[1] && token.loc.start.line === owned.loc.start.line);
|
|
2475
|
-
if (!closing) return refused("Unsupported", "The server table header could not be located safely.");
|
|
2476
|
-
if (removing) {
|
|
2477
|
-
const edits2 = [owned, ...descendants].map((table) => {
|
|
2478
|
-
let start = table.range[0];
|
|
2479
|
-
let end = table === owned ? Math.max(table.range[1], closing.range[1]) : table.range[1];
|
|
2480
|
-
const trailing = /^[\t ]*(?:\r\n|\n|\r)/.exec(text.slice(end));
|
|
2481
|
-
if (trailing) end += trailing[0].length;
|
|
2482
|
-
const blankBefore = /(?:\r\n|\n|\r)((?:\r\n|\n|\r))$/.exec(text.slice(0, start));
|
|
2483
|
-
if (blankBefore) start -= blankBefore[1].length;
|
|
2484
|
-
return { start, end, text: "" };
|
|
2485
|
-
});
|
|
2486
|
-
return outcome(apply(edits2), "remove");
|
|
2487
|
-
}
|
|
2488
|
-
const fields = /* @__PURE__ */ new Map();
|
|
2489
|
-
for (const field of owned.body) {
|
|
2490
|
-
const path = keyPath(field.key);
|
|
2491
|
-
if (path.length === 1) fields.set(path[0], field);
|
|
2492
|
-
}
|
|
2493
|
-
const edits = [];
|
|
2494
|
-
const missing = [];
|
|
2495
|
-
for (const [key, value] of Object.entries(request.fields)) {
|
|
2496
|
-
const field = fields.get(key);
|
|
2497
|
-
if (!field) missing.push(`${key} = ${renderTomlValue(value)}`);
|
|
2498
|
-
else {
|
|
2499
|
-
const current = field.value.type === "TOMLArray" ? field.value.elements.map((element) => element.type === "TOMLValue" ? element.value : void 0) : field.value.type === "TOMLValue" ? field.value.value : void 0;
|
|
2500
|
-
if (JSON.stringify(typeof current === "bigint" ? Number(current) : current) !== JSON.stringify(value)) {
|
|
2501
|
-
edits.push({ start: field.value.range[0], end: field.value.range[1], text: renderTomlValue(value) });
|
|
2502
|
-
}
|
|
2503
|
-
}
|
|
2504
|
-
}
|
|
2505
|
-
if (missing.length) {
|
|
2506
|
-
const lineFeed = text.indexOf("\n", closing.range[1]);
|
|
2507
|
-
const insertion = lineFeed < 0 ? text.length : text[lineFeed - 1] === "\r" ? lineFeed - 1 : lineFeed;
|
|
2508
|
-
edits.push({ start: insertion, end: insertion, text: newline + missing.join(newline) + (lineFeed < 0 ? newline : "") });
|
|
2509
|
-
}
|
|
2510
|
-
return outcome(edits.length ? apply(edits) : beforeImage, "update");
|
|
2511
|
-
}
|
|
2512
537
|
|
|
2513
538
|
// ../hexasync-template-client-setup/src/node/standalone.ts
|
|
2514
539
|
var STANDALONE_SERVER_NAME = "hexasync-template-ide";
|
|
2515
|
-
var STANDALONE_MCP_PACKAGE = "@beehexa/hexasync-template-ide-mcp";
|
|
2516
540
|
var STANDALONE_CLIENT_IDS = ["claude", "codex", "cursor", "antigravity", "pi", "openclaw", "vscode"];
|
|
2517
|
-
function standaloneLaunch(platform, packageSpec = `${STANDALONE_MCP_PACKAGE}@latest`) {
|
|
2518
|
-
return platform === "win32" ? { command: "cmd", args: ["/c", "npx", "-y", packageSpec] } : { command: "npx", args: ["-y", packageSpec] };
|
|
2519
|
-
}
|
|
2520
541
|
var pathFor = (host) => host.platform === "win32" ? win32 : posix;
|
|
2521
542
|
var envPath = (host, name) => host.env[name]?.trim() || void 0;
|
|
2522
543
|
function vscodeUserDir(host) {
|
|
@@ -2596,17 +617,6 @@ var STANDALONE_DIALECTS = Object.freeze({
|
|
|
2596
617
|
entry: (launch) => ({ type: "stdio", command: launch.command, args: [...launch.args] })
|
|
2597
618
|
}
|
|
2598
619
|
});
|
|
2599
|
-
function planStandaloneRegistration(clientId, beforeImage, request) {
|
|
2600
|
-
const dialect = STANDALONE_DIALECTS[clientId];
|
|
2601
|
-
const entry = request.operation === "remove" ? null : dialect.entry(request.launch);
|
|
2602
|
-
if (dialect.format === "toml") {
|
|
2603
|
-
return planTomlServerTable(beforeImage, {
|
|
2604
|
-
tablePath: [dialect.mapPath[0], STANDALONE_SERVER_NAME],
|
|
2605
|
-
fields: entry
|
|
2606
|
-
});
|
|
2607
|
-
}
|
|
2608
|
-
return planJsonServerEntry(beforeImage, { format: dialect.format, mapPath: dialect.mapPath, entryKey: STANDALONE_SERVER_NAME, entry });
|
|
2609
|
-
}
|
|
2610
620
|
|
|
2611
621
|
// src/features/install/clients.ts
|
|
2612
622
|
import { posix as posix2, win32 as win322 } from "node:path";
|
|
@@ -2631,46 +641,17 @@ function skillsDir(clientId, scope, host) {
|
|
|
2631
641
|
return scope === "project" ? project : path.join(host.home, ".copilot", "skills");
|
|
2632
642
|
}
|
|
2633
643
|
}
|
|
2634
|
-
function vscodeExtensionRoots(host) {
|
|
2635
|
-
const path = host.platform === "win32" ? win322 : posix2;
|
|
2636
|
-
return [".vscode", ".vscode-insiders", ".vscode-server", ".vscode-server-insiders", ".vscode-oss"].map((folder) => path.join(host.home, folder, "extensions"));
|
|
2637
|
-
}
|
|
2638
|
-
var HEXASYNC_EXTENSION_PREFIX = "beehexa-corp.hexasync-templates-";
|
|
2639
644
|
|
|
2640
645
|
// src/features/install/plan.ts
|
|
2641
|
-
async function extensionInstalled(ports) {
|
|
2642
|
-
for (const root of vscodeExtensionRoots(ports.host)) {
|
|
2643
|
-
let obsolete = {};
|
|
2644
|
-
try {
|
|
2645
|
-
obsolete = JSON.parse(await ports.readText(`${root}/.obsolete`) ?? "{}");
|
|
2646
|
-
} catch {
|
|
2647
|
-
}
|
|
2648
|
-
let registered = null;
|
|
2649
|
-
try {
|
|
2650
|
-
const index = await ports.readText(`${root}/extensions.json`);
|
|
2651
|
-
if (index !== null) {
|
|
2652
|
-
registered = new Set(JSON.parse(index).map((entry) => (entry.relativeLocation ?? "").toLowerCase()));
|
|
2653
|
-
}
|
|
2654
|
-
} catch {
|
|
2655
|
-
}
|
|
2656
|
-
const match = (await ports.listDir(root)).find((name) => name.toLowerCase().startsWith(HEXASYNC_EXTENSION_PREFIX) && obsolete[name] !== true && (registered === null || registered.has(name.toLowerCase())));
|
|
2657
|
-
if (match) return `${root}/${match}`;
|
|
2658
|
-
}
|
|
2659
|
-
return null;
|
|
2660
|
-
}
|
|
2661
646
|
async function planInstall(options, ports) {
|
|
2662
|
-
const launch = standaloneLaunch(ports.host.platform, `${STANDALONE_MCP_PACKAGE}@${options.toolkitVersion}`);
|
|
2663
647
|
const copiedTo = /* @__PURE__ */ new Map();
|
|
2664
648
|
const clients = [];
|
|
2665
649
|
for (const clientId of options.clients) {
|
|
2666
650
|
const dialect = STANDALONE_DIALECTS[clientId];
|
|
2667
651
|
const actions = [];
|
|
2668
|
-
const configPath = dialect.configPath(options.scope, ports.host);
|
|
2669
|
-
const before = configPath === null ? null : await ports.readText(configPath);
|
|
2670
|
-
const registered = before !== null && planStandaloneRegistration(clientId, before, { operation: "remove", launch }).status === "Planned";
|
|
2671
652
|
const target = skillsDir(clientId, options.scope, ports.host);
|
|
2672
653
|
const present = target === null ? [] : (await ports.listDir(target)).filter((name) => options.skillNames.includes(name));
|
|
2673
|
-
if (options.command === "update" &&
|
|
654
|
+
if (options.command === "update" && present.length === 0) {
|
|
2674
655
|
clients.push({ clientId, displayName: dialect.displayName, actions: [{ kind: "note", message: `nothing installed at ${options.scope} scope; run \`install\` to add it` }] });
|
|
2675
656
|
continue;
|
|
2676
657
|
}
|
|
@@ -2687,59 +668,29 @@ async function planInstall(options, ports) {
|
|
|
2687
668
|
}
|
|
2688
669
|
}
|
|
2689
670
|
if (options.mcp) {
|
|
2690
|
-
|
|
2691
|
-
const cli = options.useCli && dialect.cli ? await ports.which(dialect.cli.executable) : null;
|
|
2692
|
-
if (extension) {
|
|
2693
|
-
actions.push({ kind: "warn", message: `mcp: skipped \u2014 the HexaSync Template IDE extension (${extension}) already provides this server in VS Code; a second registration would duplicate every tool` });
|
|
2694
|
-
} else if (configPath === null) {
|
|
2695
|
-
actions.push({ kind: "warn", message: `mcp: ${dialect.displayName} has no ${options.scope}-scope MCP configuration; use --scope user` });
|
|
2696
|
-
} else if (cli && dialect.cli) {
|
|
2697
|
-
if (removing) actions.push({ kind: "run", executable: cli, argv: dialect.cli.remove(options.scope), allowFailure: !registered });
|
|
2698
|
-
else {
|
|
2699
|
-
const prepare = dialect.cli.beforeAdd?.(options.scope);
|
|
2700
|
-
if (prepare) actions.push({ kind: "run", executable: cli, argv: prepare, allowFailure: true });
|
|
2701
|
-
actions.push({ kind: "run", executable: cli, argv: dialect.cli.add(options.scope, launch), allowFailure: false });
|
|
2702
|
-
}
|
|
2703
|
-
} else {
|
|
2704
|
-
const planned = planStandaloneRegistration(clientId, before, { operation: removing ? "remove" : "add", launch });
|
|
2705
|
-
const mapLabel = `${dialect.mapPath.join(".")}.${STANDALONE_SERVER_NAME}`;
|
|
2706
|
-
if (planned.status === "Planned" && planned.afterImage !== null) {
|
|
2707
|
-
actions.push({
|
|
2708
|
-
kind: "write-config",
|
|
2709
|
-
path: configPath,
|
|
2710
|
-
before,
|
|
2711
|
-
after: planned.afterImage,
|
|
2712
|
-
operation: planned.operation,
|
|
2713
|
-
summary: `${planned.operation} ${mapLabel}`
|
|
2714
|
-
});
|
|
2715
|
-
} else if (planned.status === "NoOp") {
|
|
2716
|
-
actions.push({ kind: "note", message: `mcp: ${configPath} already ${removing ? "has no" : "has the current"} ${mapLabel}` });
|
|
2717
|
-
} else {
|
|
2718
|
-
actions.push({ kind: "error", message: `mcp: ${configPath} left unchanged \u2014 ${planned.reason ?? planned.status}` });
|
|
2719
|
-
}
|
|
2720
|
-
}
|
|
671
|
+
actions.push({ kind: "note", message: "MCP is hosted on AI Gateway. Follow the client connection instructions; this installer does not change MCP configuration." });
|
|
2721
672
|
}
|
|
2722
673
|
clients.push({ clientId, displayName: dialect.displayName, actions });
|
|
2723
674
|
}
|
|
2724
|
-
return { options,
|
|
675
|
+
return { options, clients };
|
|
2725
676
|
}
|
|
2726
677
|
|
|
2727
678
|
// src/cli/main.ts
|
|
2728
679
|
var USAGE = `Usage: hexasync-ai-toolkit <command> [options]
|
|
2729
680
|
|
|
2730
681
|
Commands:
|
|
2731
|
-
install Copy the HexaSync skills
|
|
2732
|
-
update Refresh skills
|
|
2733
|
-
uninstall Remove the HexaSync skills
|
|
682
|
+
install Copy the HexaSync skills
|
|
683
|
+
update Refresh installed skills
|
|
684
|
+
uninstall Remove the HexaSync skills
|
|
2734
685
|
list Show the packaged skills and what is installed for each client
|
|
2735
686
|
|
|
2736
687
|
Options:
|
|
2737
688
|
--client <id> ${STANDALONE_CLIENT_IDS.join("|")}|all (repeatable or comma-separated; default all)
|
|
2738
689
|
--scope <scope> user|project (default user; project uses the current directory)
|
|
2739
690
|
--skills-only Only copy/remove skills
|
|
2740
|
-
--mcp-only
|
|
691
|
+
--mcp-only No longer supported; connect the remote MCP through your client
|
|
2741
692
|
--dry-run Print the planned changes without writing anything
|
|
2742
|
-
--no-cli
|
|
693
|
+
--no-cli Accepted for compatibility; no MCP client configuration is changed
|
|
2743
694
|
-h, --help Show this help
|
|
2744
695
|
-v, --version Print the toolkit version`;
|
|
2745
696
|
function parseArgs(argv) {
|
|
@@ -2795,26 +746,25 @@ function parseArgs(argv) {
|
|
|
2795
746
|
}
|
|
2796
747
|
}
|
|
2797
748
|
if (skillsOnly && mcpOnly) throw new Error("--skills-only and --mcp-only exclude each other.");
|
|
749
|
+
if (mcpOnly) throw new Error("MCP registration is no longer managed by this toolkit. Follow the HexaSync AI Gateway connection instructions.");
|
|
2798
750
|
return {
|
|
2799
751
|
command: command ?? "help",
|
|
2800
752
|
clients: clients.size ? [...clients] : [...STANDALONE_CLIENT_IDS],
|
|
2801
753
|
scope,
|
|
2802
|
-
skills:
|
|
754
|
+
skills: true,
|
|
2803
755
|
mcp: !skillsOnly,
|
|
2804
756
|
dryRun,
|
|
2805
757
|
useCli
|
|
2806
758
|
};
|
|
2807
759
|
}
|
|
2808
|
-
function describe(action,
|
|
760
|
+
function describe(action, _plan, _clientId) {
|
|
2809
761
|
switch (action.kind) {
|
|
2810
762
|
case "copy-skills":
|
|
2811
763
|
return [`+ skills copy ${action.skills.length} skills \u2192 ${action.target}`];
|
|
2812
764
|
case "remove-skills":
|
|
2813
765
|
return [`- skills remove ${action.skills.length} skills from ${action.target}`];
|
|
2814
766
|
case "write-config": {
|
|
2815
|
-
const dialect = STANDALONE_DIALECTS[clientId];
|
|
2816
767
|
const lines = [`${action.operation === "remove" ? "-" : "+"} mcp ${action.path}: ${action.summary}${action.before === null ? " (new file)" : " (backup kept)"}`];
|
|
2817
|
-
if (action.operation !== "remove") lines.push(` entry ${JSON.stringify(dialect.entry(plan.launch))}`);
|
|
2818
768
|
return lines;
|
|
2819
769
|
}
|
|
2820
770
|
case "run":
|
|
@@ -2856,7 +806,7 @@ ${USAGE}
|
|
|
2856
806
|
}
|
|
2857
807
|
const manifest = JSON.parse(await readFile2(join2(packageRoot2, "package.json"), "utf8"));
|
|
2858
808
|
if (!manifest || typeof manifest !== "object" || !("version" in manifest) || typeof manifest.version !== "string" || !manifest.version.trim()) {
|
|
2859
|
-
throw new Error("The toolkit package.json has no release version
|
|
809
|
+
throw new Error("The toolkit package.json has no release version.");
|
|
2860
810
|
}
|
|
2861
811
|
const version = manifest.version;
|
|
2862
812
|
if (args.command === "help") {
|
|
@@ -2882,12 +832,8 @@ ${USAGE}
|
|
|
2882
832
|
const dialect = STANDALONE_DIALECTS[clientId];
|
|
2883
833
|
const target = skillsDir(clientId, args.scope, ports.host);
|
|
2884
834
|
const installed = target === null ? [] : (await ports.listDir(target)).filter((name) => skillNames.includes(name));
|
|
2885
|
-
const configPath = dialect.configPath(args.scope, ports.host);
|
|
2886
|
-
const before = configPath === null ? null : await ports.readText(configPath);
|
|
2887
|
-
const registered = before !== null && planStandaloneRegistration(clientId, before, { operation: "remove", launch: { command: "npx", args: [] } }).status === "Planned";
|
|
2888
835
|
write(`${dialect.displayName}
|
|
2889
836
|
skills ${installed.length}/${skillNames.length} in ${target ?? "(none)"}
|
|
2890
|
-
mcp ${configPath === null ? `(no ${args.scope}-scope config)` : `${registered ? "registered" : "not registered"} in ${configPath}`}
|
|
2891
837
|
`);
|
|
2892
838
|
}
|
|
2893
839
|
return 0;
|
|
@@ -2905,8 +851,7 @@ ${USAGE}
|
|
|
2905
851
|
}, ports);
|
|
2906
852
|
write(`HexaSync AI toolkit ${version} \u2014 ${args.command}, ${args.scope} scope, ${ports.host.platform}${args.dryRun ? " (dry run: nothing is written)" : ""}
|
|
2907
853
|
`);
|
|
2908
|
-
write(
|
|
2909
|
-
`);
|
|
854
|
+
write("MCP: connect hexasync-template-development-standards on HexaSync AI Gateway using the client connection instructions.\n");
|
|
2910
855
|
let failed = plan.clients.some((client) => client.actions.some((action) => action.kind === "error"));
|
|
2911
856
|
const results = args.dryRun ? null : await applyInstallPlan(plan);
|
|
2912
857
|
for (const client of plan.clients) {
|
|
@@ -2922,8 +867,8 @@ ${client.displayName}
|
|
|
2922
867
|
if (result && !result.ok) failed = true;
|
|
2923
868
|
}
|
|
2924
869
|
}
|
|
2925
|
-
if (!args.dryRun && plan.clients.some((client) => client.actions.some((action) => action.kind === "
|
|
2926
|
-
write("\nRestart (or reload) each client so it
|
|
870
|
+
if (!args.dryRun && plan.clients.some((client) => client.actions.some((action) => action.kind === "copy-skills" || action.kind === "remove-skills"))) {
|
|
871
|
+
write("\nRestart (or reload) each client so it discovers the skills; connect the remote MCP separately.\n");
|
|
2927
872
|
}
|
|
2928
873
|
return failed ? 1 : 0;
|
|
2929
874
|
}
|