apexrest 2.1.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -101
- package/dist/codex-compat/.claude-plugin/marketplace.json +2 -2
- package/dist/codex-compat/plugins/apexrest-apex/.claude-plugin/plugin.json +5 -2
- package/dist/codex-compat/plugins/apexrest-apex/.codex-plugin/plugin.json +1 -1
- package/dist/codex-compat/plugins/apexrest-apex/.mcp.json +4 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/blocks/generator.json +1 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/blueprints/crm-26.2.yaml +1 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/blueprints/crm.yaml +1 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/blueprints/service-desk-26.2.yaml +1 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/blueprints/service-desk.yaml +1 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/business-logic/dynamic-actions/recipes/dynamic-actions-alert-confirm.md +177 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/business-logic/dynamic-actions/recipes/dynamic-actions-cancel-dialog.md +220 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/business-logic/dynamic-actions/recipes/dynamic-actions-close-dialog.md +224 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/business-logic/dynamic-actions/recipes/dynamic-actions-debounce-throttle.md +330 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/business-logic/dynamic-actions/recipes/dynamic-actions-delete-notification.md +199 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/business-logic/dynamic-actions/recipes/dynamic-actions-refresh-after-dialog.md +282 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/business-logic/dynamic-actions/recipes/dynamic-actions-region-class.md +193 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/business-logic/dynamic-actions/recipes/dynamic-actions-show-error-message.md +154 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/business-logic/dynamic-actions.md +9 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/business-logic/processes/parameters.md +32618 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/business-logic/processes/recipes/processes-close-dialog.md +269 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/business-logic/processes/recipes/processes-execute-code.md +201 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/business-logic/processes/recipes/processes-form-initialization.md +239 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/business-logic/processes/source-examples.md +938 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/business-logic/processes.md +31 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/business-logic/validations/recipes/validations-plsql-error.md +205 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/business-logic/validations.md +2 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/buttons/icon/recipes/button-trigger-action.md +139 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/buttons/icon.md +2 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/buttons/text/recipes/button-confirmation.md +128 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/buttons/text/recipes/button-server-side-condition.md +160 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/buttons/text/recipes/button-submit-request.md +183 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/buttons/text-with-icon/recipes/button-dynamic-action.md +137 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/buttons/text-with-icon/recipes/button-redirect-items.md +155 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/buttons/text-with-icon.md +3 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/buttons/text.md +4 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/catalog.md +7 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/checkbox-group/recipes/item-checkbox-group-columns.md +125 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/checkbox-group.md +2 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/date-picker/recipes/item-date-picker-range.md +121 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/date-picker.md +2 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/display-image/parameters.md +7998 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/display-image/recipes/item-display-image.md +118 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/display-image.md +27 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/geocoded-address/parameters.md +8564 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/geocoded-address/recipes/item-geocoded-address.md +137 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/geocoded-address.md +27 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/number-field/recipes/item-number-field-format-mask.md +123 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/number-field.md +2 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/popup-lov/recipes/item-popup-lov-display-null.md +128 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/popup-lov.md +2 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/radio-group/recipes/item-radio-group-columns.md +123 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/radio-group.md +2 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/rich-text-editor/parameters.md +8003 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/rich-text-editor/recipes/item-rich-text-editor.md +126 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/rich-text-editor.md +27 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/select-list/recipes/item-select-list-shared-lov.md +149 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/select-list.md +2 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/shuttle/recipes/item-shuttle-shared-lov.md +157 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/shuttle.md +2 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/switch/recipes/item-switch-custom-values.md +123 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/switch.md +2 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/textarea/recipes/item-textarea-required-length.md +123 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/items/textarea.md +2 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/breadcrumb/parameters.md +13322 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/breadcrumb/recipes/breadcrumb.md +137 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/breadcrumb/source-examples.md +20 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/breadcrumb.md +29 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/calendar/recipes/calendar-create-event-on-select.md +252 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/calendar/recipes/calendar-custom-navigation.md +360 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/calendar/recipes/calendar-custom-styling.md +156 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/calendar/recipes/calendar-delete-or-copy-on-click.md +271 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/calendar/recipes/calendar-standard-monthly.md +147 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/calendar/recipes/calendar-status-tracking.md +259 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/calendar/recipes/calendar-weekly-conference.md +153 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/calendar/recipes/calendar-weekly-drag-drop.md +146 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/calendar/recipes/calendar-weekly-time-format-toggle.md +330 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/calendar.md +10 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/cards/recipes/cards-actions.md +193 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/cards.md +2 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/chart/recipes/chart-3d-effect.md +176 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/chart/recipes/chart-area-custom-legend.md +226 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/chart/recipes/chart-bar-dual-axis.md +203 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/chart/recipes/chart-bar-stacked-horizontal.md +170 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/chart/recipes/chart-bubble.md +171 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/chart/recipes/chart-custom-tooltip.md +156 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/chart/recipes/chart-dashboard-combination.md +234 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/chart/recipes/chart-data-densification.md +169 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/chart/recipes/chart-gantt.md +188 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/chart/recipes/chart-line-with-area.md +197 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/chart/recipes/chart-links.md +188 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/chart/recipes/chart-scatter.md +167 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/chart/recipes/chart-series-color.md +143 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/chart/recipes/chart-status-meter-gauge.md +142 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/chart/recipes/chart-stock.md +173 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/chart/recipes/chart-zoom-scroll.md +168 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/chart.md +17 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/faceted-search/recipes/faceted-search-calendar.md +352 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/faceted-search/recipes/faceted-search-cards.md +430 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/faceted-search/recipes/faceted-search-content-row.md +599 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/faceted-search/recipes/faceted-search-dashboard.md +883 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/faceted-search/recipes/faceted-search-directory-groups.md +514 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/faceted-search/recipes/faceted-search-grouped-rows.md +663 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/faceted-search/recipes/faceted-search-map.md +379 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/faceted-search/recipes/faceted-search-search-only-report.md +408 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/faceted-search/recipes/faceted-search-timeline.md +510 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/faceted-search.md +10 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/form/recipes/form-dialog-buttons.md +247 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/form/recipes/sectioned-form-expense-report.md +938 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/form.md +3 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/help-text/parameters.md +11842 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/help-text/recipes/help-text.md +137 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/help-text.md +27 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/map/recipes/map-bbox-static.md +152 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/map/recipes/map-browser-location.md +138 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/map/recipes/map-extruded-polygons.md +155 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/map/recipes/map-geojson-icon-points.md +150 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/map/recipes/map-heat-map.md +143 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/map/recipes/map-lines-geojson.md +147 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/map/recipes/map-multi-layer-legend.md +220 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/map/recipes/map-points-lonlat.md +148 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/map/recipes/map-polygons-color-scheme.md +160 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/map.md +10 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/region-display-selector/recipes/region-display-selector-icons.md +161 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/region-display-selector.md +2 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/static-content/recipes/static-content-accordion.md +152 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/static-content/recipes/static-content-collection-toolbar.md +205 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/static-content/recipes/static-content-dividers.md +155 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/static-content/recipes/static-content-empty-state.md +139 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/regions/static-content.md +5 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/reports/classic-report/recipes/classic-report-notifications.md +141 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/reports/classic-report/recipes/classic-report-percent-graph.md +151 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/reports/classic-report/recipes/classic-report-suggestions.md +134 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/reports/classic-report.md +4 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/reports/contextual-info/recipes/contextual-info-row-based.md +138 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/reports/contextual-info.md +2 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/reports/interactive-grid/recipes/editable-grid-expense-lines.md +378 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/reports/interactive-grid/recipes/interactive-grid-toolbar-download.md +200 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/reports/interactive-grid.md +3 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/reports/interactive-report/recipes/interactive-report-full-options.md +227 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/reports/interactive-report/recipes/interactive-report-search-bar-actions.md +206 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/reports/interactive-report/recipes/interactive-report-secondary.md +161 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/reports/interactive-report.md +4 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/template-components/content-row/recipes/directory-hero-search-content-row.md +476 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/documents/template-components/content-row.md +2 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/index.json +3485 -739
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/manifest.json +245 -38
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/compiler-evidence.json +2103 -422
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-breadcrumb/pages/p00001-home.apx +46 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-breadcrumb/shared-components/breadcrumbs.apx +17 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-button-confirmation/pages/p00001-home.apx +60 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-button-dynamic-action/pages/p00001-home.apx +69 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-button-redirect-items/pages/p00001-home.apx +87 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-button-server-side-condition/pages/p00001-home.apx +90 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-button-submit-request/pages/p00001-home.apx +113 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-button-trigger-action/pages/p00001-home.apx +71 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-calendar-create-event-on-select/pages/p00001-home.apx +181 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-calendar-custom-navigation/pages/p00001-home.apx +292 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-calendar-custom-styling/pages/p00001-home.apx +88 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-calendar-delete-or-copy-on-click/pages/p00001-home.apx +200 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-calendar-standard-monthly/pages/p00001-home.apx +79 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-calendar-status-tracking/pages/p00001-home.apx +191 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-calendar-weekly-conference/pages/p00001-home.apx +85 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-calendar-weekly-drag-drop/pages/p00001-home.apx +78 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-calendar-weekly-time-format-toggle/pages/p00001-home.apx +260 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-cards-actions/pages/p00001-home.apx +125 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-chart-3d-effect/pages/p00001-home.apx +108 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-chart-area-custom-legend/pages/p00001-home.apx +158 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-chart-bar-dual-axis/pages/p00001-home.apx +135 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-chart-bar-stacked-horizontal/pages/p00001-home.apx +102 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-chart-bubble/pages/p00001-home.apx +103 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-chart-custom-tooltip/pages/p00001-home.apx +88 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-chart-dashboard-combination/pages/p00001-home.apx +166 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-chart-data-densification/pages/p00001-home.apx +101 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-chart-gantt/pages/p00001-home.apx +120 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-chart-line-with-area/pages/p00001-home.apx +129 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-chart-links/pages/p00001-home.apx +120 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-chart-scatter/pages/p00001-home.apx +99 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-chart-series-color/pages/p00001-home.apx +75 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-chart-status-meter-gauge/pages/p00001-home.apx +74 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-chart-stock/pages/p00001-home.apx +105 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-chart-zoom-scroll/pages/p00001-home.apx +100 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-classic-report-notifications/pages/p00001-home.apx +73 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-classic-report-percent-graph/pages/p00001-home.apx +83 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-classic-report-suggestions/pages/p00001-home.apx +66 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-contextual-info-row-based/pages/p00001-home.apx +70 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-directory-hero-search-content-row/pages/p00001-home.apx +406 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-dynamic-actions-alert-confirm/pages/p00001-home.apx +109 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-dynamic-actions-cancel-dialog/pages/p00001-home.apx +48 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-dynamic-actions-cancel-dialog/pages/p00002-dialog.apx +98 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-dynamic-actions-close-dialog/pages/p00001-home.apx +48 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-dynamic-actions-close-dialog/pages/p00002-dialog.apx +102 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-dynamic-actions-debounce-throttle/pages/p00001-home.apx +262 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-dynamic-actions-delete-notification/pages/p00001-home.apx +129 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-dynamic-actions-refresh-after-dialog/pages/p00001-home.apx +109 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-dynamic-actions-refresh-after-dialog/pages/p00002-dialog.apx +99 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-dynamic-actions-region-class/pages/p00001-home.apx +125 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-dynamic-actions-show-error-message/pages/p00001-home.apx +86 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-editable-grid-expense-lines/pages/p00001-home.apx +310 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-faceted-search-calendar/pages/p00001-home.apx +284 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-faceted-search-cards/pages/p00001-home.apx +362 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-faceted-search-content-row/pages/p00001-home.apx +531 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-faceted-search-dashboard/pages/p00001-home.apx +809 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-faceted-search-directory-groups/pages/p00001-home.apx +446 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-faceted-search-grouped-rows/pages/p00001-home.apx +595 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-faceted-search-map/pages/p00001-home.apx +311 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-faceted-search-search-only-report/pages/p00001-home.apx +340 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-faceted-search-timeline/pages/p00001-home.apx +442 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-form-dialog-buttons/pages/p00001-home.apx +179 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-help-text/pages/p00001-home.apx +69 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-interactive-grid-toolbar-download/pages/p00001-home.apx +132 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-interactive-report-full-options/pages/p00001-home.apx +159 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-interactive-report-search-bar-actions/pages/p00001-home.apx +138 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-interactive-report-secondary/pages/p00001-home.apx +93 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-item-checkbox-group-columns/pages/p00001-home.apx +55 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-item-date-picker-range/pages/p00001-home.apx +51 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-item-display-image/pages/p00001-home.apx +50 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-item-geocoded-address/pages/p00001-home.apx +66 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-item-number-field-format-mask/pages/p00001-home.apx +53 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-item-popup-lov-display-null/pages/p00001-home.apx +58 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-item-radio-group-columns/pages/p00001-home.apx +53 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-item-rich-text-editor/pages/p00001-home.apx +56 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-item-select-list-shared-lov/pages/p00001-home.apx +48 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-item-select-list-shared-lov/shared-components/lovs.apx +25 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-item-shuttle-shared-lov/pages/p00001-home.apx +50 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-item-shuttle-shared-lov/shared-components/lovs.apx +31 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-item-switch-custom-values/pages/p00001-home.apx +53 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-item-textarea-required-length/pages/p00001-home.apx +53 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-map-bbox-static/pages/p00001-home.apx +82 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-map-browser-location/pages/p00001-home.apx +70 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-map-extruded-polygons/pages/p00001-home.apx +87 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-map-geojson-icon-points/pages/p00001-home.apx +82 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-map-heat-map/pages/p00001-home.apx +75 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-map-lines-geojson/pages/p00001-home.apx +79 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-map-multi-layer-legend/pages/p00001-home.apx +152 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-map-points-lonlat/pages/p00001-home.apx +80 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-map-polygons-color-scheme/pages/p00001-home.apx +92 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-processes-close-dialog/pages/p00001-home.apx +48 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-processes-close-dialog/pages/p00002-dialog.apx +145 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-processes-execute-code/pages/p00001-home.apx +130 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-processes-form-initialization/pages/p00001-home.apx +171 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-region-display-selector-icons/pages/p00001-home.apx +93 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-sectioned-form-expense-report/pages/p00001-home.apx +870 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-static-content-accordion/pages/p00001-home.apx +84 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-static-content-collection-toolbar/pages/p00001-home.apx +137 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-static-content-dividers/pages/p00001-home.apx +87 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-static-content-empty-state/pages/p00001-home.apx +71 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/internet-validations-plsql-error/pages/p00001-home.apx +134 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/components/recipes/registry.json +4973 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/patterns/docs/metrics/capacity-summary/recipes/unit-aware.md +3 -3
- package/dist/codex-compat/plugins/apexrest-apex/resources/patterns/index.json +408 -408
- package/dist/codex-compat/plugins/apexrest-apex/resources/patterns/manifest.json +8 -8
- package/dist/codex-compat/plugins/apexrest-apex/resources/patterns/recipes/compiler-evidence.json +3 -3
- package/dist/codex-compat/plugins/apexrest-apex/resources/patterns/recipes/registry.json +1 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/patterns/recipes/ux-extra-metrics-capacity-summary-unit-aware/pages/p00001-home.apx +2 -2
- package/dist/codex-compat/plugins/apexrest-apex/resources/policy/deployment-safety.md +197 -20
- package/dist/codex-compat/plugins/apexrest-apex/resources/references/26.2/guides/upgrade-audit.md +13 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/references/26.2/guides.json +1 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/references/26.2/index.json +3 -3
- package/dist/codex-compat/plugins/apexrest-apex/resources/references/26.2/oracle-snapshot.json +2 -2
- package/dist/codex-compat/plugins/apexrest-apex/resources/references/26.2/search.json +1 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/scaffold/observations.sql +126 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/schemas/composer-blueprint.schema.json +17 -17
- package/dist/codex-compat/plugins/apexrest-apex/resources/schemas/composer-contract.schema.json +9 -2
- package/dist/codex-compat/plugins/apexrest-apex/resources/schemas/composer-entity.schema.json +5 -3
- package/dist/codex-compat/plugins/apexrest-apex/resources/schemas/composer-field.schema.json +4 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/schemas/composer-instance.schema.json +2 -8
- package/dist/codex-compat/plugins/apexrest-apex/resources/schemas/composer-parameters.schema.json +1 -5
- package/dist/codex-compat/plugins/apexrest-apex/resources/schemas/composer-plan.schema.json +102 -5
- package/dist/codex-compat/plugins/apexrest-apex/resources/schemas/composer-shared-resource.schema.json +82 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/schemas/composer-state.schema.json +88 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/schemas/deploy-plan.schema.json +75 -3
- package/dist/codex-compat/plugins/apexrest-apex/resources/schemas/operations.schema.json +488 -17
- package/dist/codex-compat/plugins/apexrest-apex/resources/schemas/policy.schema.json +1 -1
- package/dist/codex-compat/plugins/apexrest-apex/resources/schemas/project.schema.json +61 -5
- package/dist/codex-compat/plugins/apexrest-apex/resources/schemas/sync-state.schema.json +8 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/templates/blank-app/application/application.apx +1 -0
- package/dist/codex-compat/plugins/apexrest-apex/resources/toolchains/sources.lock.json +1 -1
- package/dist/codex-compat/plugins/apexrest-apex/runtime/apexrest.mjs +154 -52
- package/dist/codex-compat/plugins/apexrest-apex/runtime/chunk-26MTCOZK.mjs +239 -0
- package/dist/codex-compat/plugins/apexrest-apex/runtime/chunk-47GDU535.mjs +1020 -0
- package/dist/codex-compat/plugins/apexrest-apex/runtime/chunk-4LEHTNYH.mjs +252 -0
- package/dist/codex-compat/plugins/apexrest-apex/runtime/chunk-4MIZ34V4.mjs +280 -0
- package/dist/codex-compat/plugins/apexrest-apex/runtime/chunk-6JZB7NDZ.mjs +33342 -0
- package/dist/{runtime/chunk-U7MVLA3R.mjs → codex-compat/plugins/apexrest-apex/runtime/chunk-CI5IU2PI.mjs} +433 -181
- package/dist/codex-compat/plugins/apexrest-apex/runtime/{chunk-JZ5FIGSS.mjs → chunk-DJPW35KJ.mjs} +5 -5
- package/dist/{runtime/chunk-BLB5JLWO.mjs → codex-compat/plugins/apexrest-apex/runtime/chunk-GHVRIHN6.mjs} +834 -4808
- package/dist/codex-compat/plugins/apexrest-apex/runtime/chunk-JJYHZOQR.mjs +6608 -0
- package/dist/codex-compat/plugins/apexrest-apex/runtime/{chunk-AESZGFM2.mjs → chunk-LCNHRIKE.mjs} +6 -3
- package/dist/codex-compat/plugins/apexrest-apex/runtime/{chunk-YEGSGHTV.mjs → chunk-LIG5PZ4K.mjs} +44 -12
- package/dist/codex-compat/plugins/apexrest-apex/runtime/{chunk-2YXH4VEB.mjs → chunk-LIGDVE6F.mjs} +438 -154
- package/dist/codex-compat/plugins/apexrest-apex/runtime/{chunk-WK445BKL.mjs → chunk-M5EC4OUI.mjs} +116 -41
- package/dist/{runtime/chunk-TE5VTEAH.mjs → codex-compat/plugins/apexrest-apex/runtime/chunk-MPKKOQVI.mjs} +349 -446
- package/dist/codex-compat/plugins/apexrest-apex/runtime/chunk-N3KQBIVW.mjs +252 -0
- package/dist/codex-compat/plugins/apexrest-apex/runtime/chunk-PFOHMLO4.mjs +141 -0
- package/dist/codex-compat/plugins/apexrest-apex/runtime/chunk-PNGZYZE7.mjs +4703 -0
- package/dist/codex-compat/plugins/apexrest-apex/runtime/{chunk-NBA54QYW.mjs → chunk-PS2GKOR2.mjs} +9 -6
- package/dist/codex-compat/plugins/apexrest-apex/runtime/{chunk-T3UX6AQO.mjs → chunk-TBHIU7PZ.mjs} +170 -3432
- package/dist/codex-compat/plugins/apexrest-apex/runtime/chunk-TDM3E2NK.mjs +161 -0
- package/dist/{runtime/chunk-ZSDDYNF5.mjs → codex-compat/plugins/apexrest-apex/runtime/chunk-UKXRUJT4.mjs} +7 -5
- package/dist/codex-compat/plugins/apexrest-apex/runtime/{chunk-BZZ3RV7L.mjs → chunk-XJ7FW7XH.mjs} +4 -4
- package/dist/codex-compat/plugins/apexrest-apex/runtime/mcp.mjs +1 -1
- package/dist/codex-compat/plugins/apexrest-apex/runtime/preview-oracle-worker.mjs +57 -0
- package/dist/codex-compat/plugins/apexrest-apex/skills/apexrest-apexlang/SKILL.md +11 -13
- package/dist/codex-compat/plugins/apexrest-apex/skills/apexrest-oracle-sync/SKILL.md +5 -1
- package/dist/codex-compat/plugins/apexrest-apex/skills/apexrest-oracle-sync/references/oracle-skills.md +19 -0
- package/dist/codex-compat/plugins/apexrest-apex/skills/apexrest-work/SKILL.md +14 -11
- package/dist/codex-compat/plugins/apexrest-apex/skills/apexrest-work/references/peer-review.md +12 -0
- package/dist/codex-compat/plugins/apexrest-apex/skills/apexrest-work/references/scaffold.md +115 -0
- package/dist/codex-compat/plugins/apexrest-apex/skills/apexrest-work/references/upgrade.md +11 -0
- package/dist/resources/blocks/generator.json +1 -1
- package/dist/resources/blueprints/crm-26.2.yaml +1 -0
- package/dist/resources/blueprints/crm.yaml +1 -0
- package/dist/resources/blueprints/service-desk-26.2.yaml +1 -0
- package/dist/resources/blueprints/service-desk.yaml +1 -0
- package/dist/resources/components/documents/business-logic/dynamic-actions/recipes/dynamic-actions-alert-confirm.md +177 -0
- package/dist/resources/components/documents/business-logic/dynamic-actions/recipes/dynamic-actions-cancel-dialog.md +220 -0
- package/dist/resources/components/documents/business-logic/dynamic-actions/recipes/dynamic-actions-close-dialog.md +224 -0
- package/dist/resources/components/documents/business-logic/dynamic-actions/recipes/dynamic-actions-debounce-throttle.md +330 -0
- package/dist/resources/components/documents/business-logic/dynamic-actions/recipes/dynamic-actions-delete-notification.md +199 -0
- package/dist/resources/components/documents/business-logic/dynamic-actions/recipes/dynamic-actions-refresh-after-dialog.md +282 -0
- package/dist/resources/components/documents/business-logic/dynamic-actions/recipes/dynamic-actions-region-class.md +193 -0
- package/dist/resources/components/documents/business-logic/dynamic-actions/recipes/dynamic-actions-show-error-message.md +154 -0
- package/dist/resources/components/documents/business-logic/dynamic-actions.md +9 -1
- package/dist/resources/components/documents/business-logic/processes/parameters.md +32618 -0
- package/dist/resources/components/documents/business-logic/processes/recipes/processes-close-dialog.md +269 -0
- package/dist/resources/components/documents/business-logic/processes/recipes/processes-execute-code.md +201 -0
- package/dist/resources/components/documents/business-logic/processes/recipes/processes-form-initialization.md +239 -0
- package/dist/resources/components/documents/business-logic/processes/source-examples.md +938 -0
- package/dist/resources/components/documents/business-logic/processes.md +31 -0
- package/dist/resources/components/documents/business-logic/validations/recipes/validations-plsql-error.md +205 -0
- package/dist/resources/components/documents/business-logic/validations.md +2 -1
- package/dist/resources/components/documents/buttons/icon/recipes/button-trigger-action.md +139 -0
- package/dist/resources/components/documents/buttons/icon.md +2 -1
- package/dist/resources/components/documents/buttons/text/recipes/button-confirmation.md +128 -0
- package/dist/resources/components/documents/buttons/text/recipes/button-server-side-condition.md +160 -0
- package/dist/resources/components/documents/buttons/text/recipes/button-submit-request.md +183 -0
- package/dist/resources/components/documents/buttons/text-with-icon/recipes/button-dynamic-action.md +137 -0
- package/dist/resources/components/documents/buttons/text-with-icon/recipes/button-redirect-items.md +155 -0
- package/dist/resources/components/documents/buttons/text-with-icon.md +3 -1
- package/dist/resources/components/documents/buttons/text.md +4 -1
- package/dist/resources/components/documents/catalog.md +7 -1
- package/dist/resources/components/documents/items/checkbox-group/recipes/item-checkbox-group-columns.md +125 -0
- package/dist/resources/components/documents/items/checkbox-group.md +2 -1
- package/dist/resources/components/documents/items/date-picker/recipes/item-date-picker-range.md +121 -0
- package/dist/resources/components/documents/items/date-picker.md +2 -1
- package/dist/resources/components/documents/items/display-image/parameters.md +7998 -0
- package/dist/resources/components/documents/items/display-image/recipes/item-display-image.md +118 -0
- package/dist/resources/components/documents/items/display-image.md +27 -0
- package/dist/resources/components/documents/items/geocoded-address/parameters.md +8564 -0
- package/dist/resources/components/documents/items/geocoded-address/recipes/item-geocoded-address.md +137 -0
- package/dist/resources/components/documents/items/geocoded-address.md +27 -0
- package/dist/resources/components/documents/items/number-field/recipes/item-number-field-format-mask.md +123 -0
- package/dist/resources/components/documents/items/number-field.md +2 -1
- package/dist/resources/components/documents/items/popup-lov/recipes/item-popup-lov-display-null.md +128 -0
- package/dist/resources/components/documents/items/popup-lov.md +2 -1
- package/dist/resources/components/documents/items/radio-group/recipes/item-radio-group-columns.md +123 -0
- package/dist/resources/components/documents/items/radio-group.md +2 -1
- package/dist/resources/components/documents/items/rich-text-editor/parameters.md +8003 -0
- package/dist/resources/components/documents/items/rich-text-editor/recipes/item-rich-text-editor.md +126 -0
- package/dist/resources/components/documents/items/rich-text-editor.md +27 -0
- package/dist/resources/components/documents/items/select-list/recipes/item-select-list-shared-lov.md +149 -0
- package/dist/resources/components/documents/items/select-list.md +2 -1
- package/dist/resources/components/documents/items/shuttle/recipes/item-shuttle-shared-lov.md +157 -0
- package/dist/resources/components/documents/items/shuttle.md +2 -1
- package/dist/resources/components/documents/items/switch/recipes/item-switch-custom-values.md +123 -0
- package/dist/resources/components/documents/items/switch.md +2 -1
- package/dist/resources/components/documents/items/textarea/recipes/item-textarea-required-length.md +123 -0
- package/dist/resources/components/documents/items/textarea.md +2 -1
- package/dist/resources/components/documents/regions/breadcrumb/parameters.md +13322 -0
- package/dist/resources/components/documents/regions/breadcrumb/recipes/breadcrumb.md +137 -0
- package/dist/resources/components/documents/regions/breadcrumb/source-examples.md +20 -0
- package/dist/resources/components/documents/regions/breadcrumb.md +29 -0
- package/dist/resources/components/documents/regions/calendar/recipes/calendar-create-event-on-select.md +252 -0
- package/dist/resources/components/documents/regions/calendar/recipes/calendar-custom-navigation.md +360 -0
- package/dist/resources/components/documents/regions/calendar/recipes/calendar-custom-styling.md +156 -0
- package/dist/resources/components/documents/regions/calendar/recipes/calendar-delete-or-copy-on-click.md +271 -0
- package/dist/resources/components/documents/regions/calendar/recipes/calendar-standard-monthly.md +147 -0
- package/dist/resources/components/documents/regions/calendar/recipes/calendar-status-tracking.md +259 -0
- package/dist/resources/components/documents/regions/calendar/recipes/calendar-weekly-conference.md +153 -0
- package/dist/resources/components/documents/regions/calendar/recipes/calendar-weekly-drag-drop.md +146 -0
- package/dist/resources/components/documents/regions/calendar/recipes/calendar-weekly-time-format-toggle.md +330 -0
- package/dist/resources/components/documents/regions/calendar.md +10 -1
- package/dist/resources/components/documents/regions/cards/recipes/cards-actions.md +193 -0
- package/dist/resources/components/documents/regions/cards.md +2 -1
- package/dist/resources/components/documents/regions/chart/recipes/chart-3d-effect.md +176 -0
- package/dist/resources/components/documents/regions/chart/recipes/chart-area-custom-legend.md +226 -0
- package/dist/resources/components/documents/regions/chart/recipes/chart-bar-dual-axis.md +203 -0
- package/dist/resources/components/documents/regions/chart/recipes/chart-bar-stacked-horizontal.md +170 -0
- package/dist/resources/components/documents/regions/chart/recipes/chart-bubble.md +171 -0
- package/dist/resources/components/documents/regions/chart/recipes/chart-custom-tooltip.md +156 -0
- package/dist/resources/components/documents/regions/chart/recipes/chart-dashboard-combination.md +234 -0
- package/dist/resources/components/documents/regions/chart/recipes/chart-data-densification.md +169 -0
- package/dist/resources/components/documents/regions/chart/recipes/chart-gantt.md +188 -0
- package/dist/resources/components/documents/regions/chart/recipes/chart-line-with-area.md +197 -0
- package/dist/resources/components/documents/regions/chart/recipes/chart-links.md +188 -0
- package/dist/resources/components/documents/regions/chart/recipes/chart-scatter.md +167 -0
- package/dist/resources/components/documents/regions/chart/recipes/chart-series-color.md +143 -0
- package/dist/resources/components/documents/regions/chart/recipes/chart-status-meter-gauge.md +142 -0
- package/dist/resources/components/documents/regions/chart/recipes/chart-stock.md +173 -0
- package/dist/resources/components/documents/regions/chart/recipes/chart-zoom-scroll.md +168 -0
- package/dist/resources/components/documents/regions/chart.md +17 -1
- package/dist/resources/components/documents/regions/faceted-search/recipes/faceted-search-calendar.md +352 -0
- package/dist/resources/components/documents/regions/faceted-search/recipes/faceted-search-cards.md +430 -0
- package/dist/resources/components/documents/regions/faceted-search/recipes/faceted-search-content-row.md +599 -0
- package/dist/resources/components/documents/regions/faceted-search/recipes/faceted-search-dashboard.md +883 -0
- package/dist/resources/components/documents/regions/faceted-search/recipes/faceted-search-directory-groups.md +514 -0
- package/dist/resources/components/documents/regions/faceted-search/recipes/faceted-search-grouped-rows.md +663 -0
- package/dist/resources/components/documents/regions/faceted-search/recipes/faceted-search-map.md +379 -0
- package/dist/resources/components/documents/regions/faceted-search/recipes/faceted-search-search-only-report.md +408 -0
- package/dist/resources/components/documents/regions/faceted-search/recipes/faceted-search-timeline.md +510 -0
- package/dist/resources/components/documents/regions/faceted-search.md +10 -1
- package/dist/resources/components/documents/regions/form/recipes/form-dialog-buttons.md +247 -0
- package/dist/resources/components/documents/regions/form/recipes/sectioned-form-expense-report.md +938 -0
- package/dist/resources/components/documents/regions/form.md +3 -1
- package/dist/resources/components/documents/regions/help-text/parameters.md +11842 -0
- package/dist/resources/components/documents/regions/help-text/recipes/help-text.md +137 -0
- package/dist/resources/components/documents/regions/help-text.md +27 -0
- package/dist/resources/components/documents/regions/map/recipes/map-bbox-static.md +152 -0
- package/dist/resources/components/documents/regions/map/recipes/map-browser-location.md +138 -0
- package/dist/resources/components/documents/regions/map/recipes/map-extruded-polygons.md +155 -0
- package/dist/resources/components/documents/regions/map/recipes/map-geojson-icon-points.md +150 -0
- package/dist/resources/components/documents/regions/map/recipes/map-heat-map.md +143 -0
- package/dist/resources/components/documents/regions/map/recipes/map-lines-geojson.md +147 -0
- package/dist/resources/components/documents/regions/map/recipes/map-multi-layer-legend.md +220 -0
- package/dist/resources/components/documents/regions/map/recipes/map-points-lonlat.md +148 -0
- package/dist/resources/components/documents/regions/map/recipes/map-polygons-color-scheme.md +160 -0
- package/dist/resources/components/documents/regions/map.md +10 -1
- package/dist/resources/components/documents/regions/region-display-selector/recipes/region-display-selector-icons.md +161 -0
- package/dist/resources/components/documents/regions/region-display-selector.md +2 -1
- package/dist/resources/components/documents/regions/static-content/recipes/static-content-accordion.md +152 -0
- package/dist/resources/components/documents/regions/static-content/recipes/static-content-collection-toolbar.md +205 -0
- package/dist/resources/components/documents/regions/static-content/recipes/static-content-dividers.md +155 -0
- package/dist/resources/components/documents/regions/static-content/recipes/static-content-empty-state.md +139 -0
- package/dist/resources/components/documents/regions/static-content.md +5 -1
- package/dist/resources/components/documents/reports/classic-report/recipes/classic-report-notifications.md +141 -0
- package/dist/resources/components/documents/reports/classic-report/recipes/classic-report-percent-graph.md +151 -0
- package/dist/resources/components/documents/reports/classic-report/recipes/classic-report-suggestions.md +134 -0
- package/dist/resources/components/documents/reports/classic-report.md +4 -1
- package/dist/resources/components/documents/reports/contextual-info/recipes/contextual-info-row-based.md +138 -0
- package/dist/resources/components/documents/reports/contextual-info.md +2 -1
- package/dist/resources/components/documents/reports/interactive-grid/recipes/editable-grid-expense-lines.md +378 -0
- package/dist/resources/components/documents/reports/interactive-grid/recipes/interactive-grid-toolbar-download.md +200 -0
- package/dist/resources/components/documents/reports/interactive-grid.md +3 -1
- package/dist/resources/components/documents/reports/interactive-report/recipes/interactive-report-full-options.md +227 -0
- package/dist/resources/components/documents/reports/interactive-report/recipes/interactive-report-search-bar-actions.md +206 -0
- package/dist/resources/components/documents/reports/interactive-report/recipes/interactive-report-secondary.md +161 -0
- package/dist/resources/components/documents/reports/interactive-report.md +4 -1
- package/dist/resources/components/documents/template-components/content-row/recipes/directory-hero-search-content-row.md +476 -0
- package/dist/resources/components/documents/template-components/content-row.md +2 -1
- package/dist/resources/components/index.json +3485 -739
- package/dist/resources/components/manifest.json +245 -38
- package/dist/resources/components/recipes/compiler-evidence.json +2103 -422
- package/dist/resources/components/recipes/internet-breadcrumb/pages/p00001-home.apx +46 -0
- package/dist/resources/components/recipes/internet-breadcrumb/shared-components/breadcrumbs.apx +17 -0
- package/dist/resources/components/recipes/internet-button-confirmation/pages/p00001-home.apx +60 -0
- package/dist/resources/components/recipes/internet-button-dynamic-action/pages/p00001-home.apx +69 -0
- package/dist/resources/components/recipes/internet-button-redirect-items/pages/p00001-home.apx +87 -0
- package/dist/resources/components/recipes/internet-button-server-side-condition/pages/p00001-home.apx +90 -0
- package/dist/resources/components/recipes/internet-button-submit-request/pages/p00001-home.apx +113 -0
- package/dist/resources/components/recipes/internet-button-trigger-action/pages/p00001-home.apx +71 -0
- package/dist/resources/components/recipes/internet-calendar-create-event-on-select/pages/p00001-home.apx +181 -0
- package/dist/resources/components/recipes/internet-calendar-custom-navigation/pages/p00001-home.apx +292 -0
- package/dist/resources/components/recipes/internet-calendar-custom-styling/pages/p00001-home.apx +88 -0
- package/dist/resources/components/recipes/internet-calendar-delete-or-copy-on-click/pages/p00001-home.apx +200 -0
- package/dist/resources/components/recipes/internet-calendar-standard-monthly/pages/p00001-home.apx +79 -0
- package/dist/resources/components/recipes/internet-calendar-status-tracking/pages/p00001-home.apx +191 -0
- package/dist/resources/components/recipes/internet-calendar-weekly-conference/pages/p00001-home.apx +85 -0
- package/dist/resources/components/recipes/internet-calendar-weekly-drag-drop/pages/p00001-home.apx +78 -0
- package/dist/resources/components/recipes/internet-calendar-weekly-time-format-toggle/pages/p00001-home.apx +260 -0
- package/dist/resources/components/recipes/internet-cards-actions/pages/p00001-home.apx +125 -0
- package/dist/resources/components/recipes/internet-chart-3d-effect/pages/p00001-home.apx +108 -0
- package/dist/resources/components/recipes/internet-chart-area-custom-legend/pages/p00001-home.apx +158 -0
- package/dist/resources/components/recipes/internet-chart-bar-dual-axis/pages/p00001-home.apx +135 -0
- package/dist/resources/components/recipes/internet-chart-bar-stacked-horizontal/pages/p00001-home.apx +102 -0
- package/dist/resources/components/recipes/internet-chart-bubble/pages/p00001-home.apx +103 -0
- package/dist/resources/components/recipes/internet-chart-custom-tooltip/pages/p00001-home.apx +88 -0
- package/dist/resources/components/recipes/internet-chart-dashboard-combination/pages/p00001-home.apx +166 -0
- package/dist/resources/components/recipes/internet-chart-data-densification/pages/p00001-home.apx +101 -0
- package/dist/resources/components/recipes/internet-chart-gantt/pages/p00001-home.apx +120 -0
- package/dist/resources/components/recipes/internet-chart-line-with-area/pages/p00001-home.apx +129 -0
- package/dist/resources/components/recipes/internet-chart-links/pages/p00001-home.apx +120 -0
- package/dist/resources/components/recipes/internet-chart-scatter/pages/p00001-home.apx +99 -0
- package/dist/resources/components/recipes/internet-chart-series-color/pages/p00001-home.apx +75 -0
- package/dist/resources/components/recipes/internet-chart-status-meter-gauge/pages/p00001-home.apx +74 -0
- package/dist/resources/components/recipes/internet-chart-stock/pages/p00001-home.apx +105 -0
- package/dist/resources/components/recipes/internet-chart-zoom-scroll/pages/p00001-home.apx +100 -0
- package/dist/resources/components/recipes/internet-classic-report-notifications/pages/p00001-home.apx +73 -0
- package/dist/resources/components/recipes/internet-classic-report-percent-graph/pages/p00001-home.apx +83 -0
- package/dist/resources/components/recipes/internet-classic-report-suggestions/pages/p00001-home.apx +66 -0
- package/dist/resources/components/recipes/internet-contextual-info-row-based/pages/p00001-home.apx +70 -0
- package/dist/resources/components/recipes/internet-directory-hero-search-content-row/pages/p00001-home.apx +406 -0
- package/dist/resources/components/recipes/internet-dynamic-actions-alert-confirm/pages/p00001-home.apx +109 -0
- package/dist/resources/components/recipes/internet-dynamic-actions-cancel-dialog/pages/p00001-home.apx +48 -0
- package/dist/resources/components/recipes/internet-dynamic-actions-cancel-dialog/pages/p00002-dialog.apx +98 -0
- package/dist/resources/components/recipes/internet-dynamic-actions-close-dialog/pages/p00001-home.apx +48 -0
- package/dist/resources/components/recipes/internet-dynamic-actions-close-dialog/pages/p00002-dialog.apx +102 -0
- package/dist/resources/components/recipes/internet-dynamic-actions-debounce-throttle/pages/p00001-home.apx +262 -0
- package/dist/resources/components/recipes/internet-dynamic-actions-delete-notification/pages/p00001-home.apx +129 -0
- package/dist/resources/components/recipes/internet-dynamic-actions-refresh-after-dialog/pages/p00001-home.apx +109 -0
- package/dist/resources/components/recipes/internet-dynamic-actions-refresh-after-dialog/pages/p00002-dialog.apx +99 -0
- package/dist/resources/components/recipes/internet-dynamic-actions-region-class/pages/p00001-home.apx +125 -0
- package/dist/resources/components/recipes/internet-dynamic-actions-show-error-message/pages/p00001-home.apx +86 -0
- package/dist/resources/components/recipes/internet-editable-grid-expense-lines/pages/p00001-home.apx +310 -0
- package/dist/resources/components/recipes/internet-faceted-search-calendar/pages/p00001-home.apx +284 -0
- package/dist/resources/components/recipes/internet-faceted-search-cards/pages/p00001-home.apx +362 -0
- package/dist/resources/components/recipes/internet-faceted-search-content-row/pages/p00001-home.apx +531 -0
- package/dist/resources/components/recipes/internet-faceted-search-dashboard/pages/p00001-home.apx +809 -0
- package/dist/resources/components/recipes/internet-faceted-search-directory-groups/pages/p00001-home.apx +446 -0
- package/dist/resources/components/recipes/internet-faceted-search-grouped-rows/pages/p00001-home.apx +595 -0
- package/dist/resources/components/recipes/internet-faceted-search-map/pages/p00001-home.apx +311 -0
- package/dist/resources/components/recipes/internet-faceted-search-search-only-report/pages/p00001-home.apx +340 -0
- package/dist/resources/components/recipes/internet-faceted-search-timeline/pages/p00001-home.apx +442 -0
- package/dist/resources/components/recipes/internet-form-dialog-buttons/pages/p00001-home.apx +179 -0
- package/dist/resources/components/recipes/internet-help-text/pages/p00001-home.apx +69 -0
- package/dist/resources/components/recipes/internet-interactive-grid-toolbar-download/pages/p00001-home.apx +132 -0
- package/dist/resources/components/recipes/internet-interactive-report-full-options/pages/p00001-home.apx +159 -0
- package/dist/resources/components/recipes/internet-interactive-report-search-bar-actions/pages/p00001-home.apx +138 -0
- package/dist/resources/components/recipes/internet-interactive-report-secondary/pages/p00001-home.apx +93 -0
- package/dist/resources/components/recipes/internet-item-checkbox-group-columns/pages/p00001-home.apx +55 -0
- package/dist/resources/components/recipes/internet-item-date-picker-range/pages/p00001-home.apx +51 -0
- package/dist/resources/components/recipes/internet-item-display-image/pages/p00001-home.apx +50 -0
- package/dist/resources/components/recipes/internet-item-geocoded-address/pages/p00001-home.apx +66 -0
- package/dist/resources/components/recipes/internet-item-number-field-format-mask/pages/p00001-home.apx +53 -0
- package/dist/resources/components/recipes/internet-item-popup-lov-display-null/pages/p00001-home.apx +58 -0
- package/dist/resources/components/recipes/internet-item-radio-group-columns/pages/p00001-home.apx +53 -0
- package/dist/resources/components/recipes/internet-item-rich-text-editor/pages/p00001-home.apx +56 -0
- package/dist/resources/components/recipes/internet-item-select-list-shared-lov/pages/p00001-home.apx +48 -0
- package/dist/resources/components/recipes/internet-item-select-list-shared-lov/shared-components/lovs.apx +25 -0
- package/dist/resources/components/recipes/internet-item-shuttle-shared-lov/pages/p00001-home.apx +50 -0
- package/dist/resources/components/recipes/internet-item-shuttle-shared-lov/shared-components/lovs.apx +31 -0
- package/dist/resources/components/recipes/internet-item-switch-custom-values/pages/p00001-home.apx +53 -0
- package/dist/resources/components/recipes/internet-item-textarea-required-length/pages/p00001-home.apx +53 -0
- package/dist/resources/components/recipes/internet-map-bbox-static/pages/p00001-home.apx +82 -0
- package/dist/resources/components/recipes/internet-map-browser-location/pages/p00001-home.apx +70 -0
- package/dist/resources/components/recipes/internet-map-extruded-polygons/pages/p00001-home.apx +87 -0
- package/dist/resources/components/recipes/internet-map-geojson-icon-points/pages/p00001-home.apx +82 -0
- package/dist/resources/components/recipes/internet-map-heat-map/pages/p00001-home.apx +75 -0
- package/dist/resources/components/recipes/internet-map-lines-geojson/pages/p00001-home.apx +79 -0
- package/dist/resources/components/recipes/internet-map-multi-layer-legend/pages/p00001-home.apx +152 -0
- package/dist/resources/components/recipes/internet-map-points-lonlat/pages/p00001-home.apx +80 -0
- package/dist/resources/components/recipes/internet-map-polygons-color-scheme/pages/p00001-home.apx +92 -0
- package/dist/resources/components/recipes/internet-processes-close-dialog/pages/p00001-home.apx +48 -0
- package/dist/resources/components/recipes/internet-processes-close-dialog/pages/p00002-dialog.apx +145 -0
- package/dist/resources/components/recipes/internet-processes-execute-code/pages/p00001-home.apx +130 -0
- package/dist/resources/components/recipes/internet-processes-form-initialization/pages/p00001-home.apx +171 -0
- package/dist/resources/components/recipes/internet-region-display-selector-icons/pages/p00001-home.apx +93 -0
- package/dist/resources/components/recipes/internet-sectioned-form-expense-report/pages/p00001-home.apx +870 -0
- package/dist/resources/components/recipes/internet-static-content-accordion/pages/p00001-home.apx +84 -0
- package/dist/resources/components/recipes/internet-static-content-collection-toolbar/pages/p00001-home.apx +137 -0
- package/dist/resources/components/recipes/internet-static-content-dividers/pages/p00001-home.apx +87 -0
- package/dist/resources/components/recipes/internet-static-content-empty-state/pages/p00001-home.apx +71 -0
- package/dist/resources/components/recipes/internet-validations-plsql-error/pages/p00001-home.apx +134 -0
- package/dist/resources/components/recipes/registry.json +4973 -0
- package/dist/resources/patterns/docs/metrics/capacity-summary/recipes/unit-aware.md +3 -3
- package/dist/resources/patterns/index.json +408 -408
- package/dist/resources/patterns/manifest.json +8 -8
- package/dist/resources/patterns/recipes/compiler-evidence.json +3 -3
- package/dist/resources/patterns/recipes/registry.json +1 -1
- package/dist/resources/patterns/recipes/ux-extra-metrics-capacity-summary-unit-aware/pages/p00001-home.apx +2 -2
- package/dist/resources/policy/deployment-safety.md +197 -20
- package/dist/resources/references/26.2/guides/upgrade-audit.md +13 -1
- package/dist/resources/references/26.2/guides.json +1 -1
- package/dist/resources/references/26.2/index.json +3 -3
- package/dist/resources/references/26.2/oracle-snapshot.json +2 -2
- package/dist/resources/references/26.2/search.json +1 -1
- package/dist/resources/scaffold/observations.sql +126 -0
- package/dist/resources/schemas/composer-blueprint.schema.json +17 -17
- package/dist/resources/schemas/composer-contract.schema.json +9 -2
- package/dist/resources/schemas/composer-entity.schema.json +5 -3
- package/dist/resources/schemas/composer-field.schema.json +4 -1
- package/dist/resources/schemas/composer-instance.schema.json +2 -8
- package/dist/resources/schemas/composer-parameters.schema.json +1 -5
- package/dist/resources/schemas/composer-plan.schema.json +102 -5
- package/dist/resources/schemas/composer-shared-resource.schema.json +82 -0
- package/dist/resources/schemas/composer-state.schema.json +88 -0
- package/dist/resources/schemas/deploy-plan.schema.json +75 -3
- package/dist/resources/schemas/operations.schema.json +488 -17
- package/dist/resources/schemas/policy.schema.json +1 -1
- package/dist/resources/schemas/project.schema.json +61 -5
- package/dist/resources/schemas/sync-state.schema.json +8 -0
- package/dist/resources/templates/blank-app/application/application.apx +1 -0
- package/dist/resources/toolchains/sources.lock.json +1 -1
- package/dist/runtime/apexrest.mjs +154 -52
- package/dist/runtime/chunk-26MTCOZK.mjs +239 -0
- package/dist/runtime/chunk-47GDU535.mjs +1020 -0
- package/dist/runtime/chunk-4LEHTNYH.mjs +252 -0
- package/dist/runtime/chunk-4MIZ34V4.mjs +280 -0
- package/dist/runtime/chunk-6JZB7NDZ.mjs +33342 -0
- package/dist/{codex-compat/plugins/apexrest-apex/runtime/chunk-U7MVLA3R.mjs → runtime/chunk-CI5IU2PI.mjs} +433 -181
- package/dist/runtime/{chunk-JZ5FIGSS.mjs → chunk-DJPW35KJ.mjs} +5 -5
- package/dist/{codex-compat/plugins/apexrest-apex/runtime/chunk-BLB5JLWO.mjs → runtime/chunk-GHVRIHN6.mjs} +834 -4808
- package/dist/runtime/chunk-JJYHZOQR.mjs +6608 -0
- package/dist/runtime/{chunk-AESZGFM2.mjs → chunk-LCNHRIKE.mjs} +6 -3
- package/dist/runtime/{chunk-YEGSGHTV.mjs → chunk-LIG5PZ4K.mjs} +44 -12
- package/dist/runtime/{chunk-2YXH4VEB.mjs → chunk-LIGDVE6F.mjs} +438 -154
- package/dist/runtime/{chunk-WK445BKL.mjs → chunk-M5EC4OUI.mjs} +116 -41
- package/dist/{codex-compat/plugins/apexrest-apex/runtime/chunk-TE5VTEAH.mjs → runtime/chunk-MPKKOQVI.mjs} +349 -446
- package/dist/runtime/chunk-N3KQBIVW.mjs +252 -0
- package/dist/runtime/chunk-PFOHMLO4.mjs +141 -0
- package/dist/runtime/chunk-PNGZYZE7.mjs +4703 -0
- package/dist/runtime/{chunk-NBA54QYW.mjs → chunk-PS2GKOR2.mjs} +9 -6
- package/dist/runtime/{chunk-T3UX6AQO.mjs → chunk-TBHIU7PZ.mjs} +170 -3432
- package/dist/runtime/chunk-TDM3E2NK.mjs +161 -0
- package/dist/{codex-compat/plugins/apexrest-apex/runtime/chunk-ZSDDYNF5.mjs → runtime/chunk-UKXRUJT4.mjs} +7 -5
- package/dist/runtime/{chunk-BZZ3RV7L.mjs → chunk-XJ7FW7XH.mjs} +4 -4
- package/dist/runtime/mcp.mjs +1 -1
- package/dist/runtime/preview-oracle-worker.mjs +57 -0
- package/package.json +8 -5
- package/dist/codex-compat/plugins/apexrest-apex/runtime/chunk-A7ESH6F5.mjs +0 -31
- package/dist/codex-compat/plugins/apexrest-apex/runtime/chunk-I5KYBPSK.mjs +0 -419
- package/dist/runtime/chunk-A7ESH6F5.mjs +0 -31
- package/dist/runtime/chunk-I5KYBPSK.mjs +0 -419
package/dist/codex-compat/plugins/apexrest-apex/runtime/{chunk-T3UX6AQO.mjs → chunk-TBHIU7PZ.mjs}
RENAMED
|
@@ -1,39 +1,31 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
runPooledSqlcl,
|
|
6
|
-
runProcess,
|
|
7
|
-
runSqlclMcp
|
|
8
|
-
} from "./chunk-TE5VTEAH.mjs";
|
|
3
|
+
resourceRoot
|
|
4
|
+
} from "./chunk-PNGZYZE7.mjs";
|
|
9
5
|
import {
|
|
10
|
-
isProductionTarget,
|
|
11
6
|
managedHome,
|
|
12
|
-
parse
|
|
13
|
-
|
|
14
|
-
relativePath,
|
|
15
|
-
targetDigest
|
|
16
|
-
} from "./chunk-YEGSGHTV.mjs";
|
|
7
|
+
parse
|
|
8
|
+
} from "./chunk-LIG5PZ4K.mjs";
|
|
17
9
|
import {
|
|
18
|
-
external_exports
|
|
19
|
-
} from "./chunk-U7MVLA3R.mjs";
|
|
20
|
-
import {
|
|
21
|
-
Fault,
|
|
22
|
-
__commonJS,
|
|
23
|
-
__export,
|
|
24
|
-
__require,
|
|
25
|
-
__toESM,
|
|
26
10
|
atomicWrite,
|
|
27
|
-
canonical,
|
|
28
11
|
contained,
|
|
29
12
|
exists,
|
|
30
13
|
hash,
|
|
31
14
|
hashFile,
|
|
32
|
-
inventory,
|
|
33
15
|
readJson,
|
|
34
16
|
withLock,
|
|
35
17
|
writeJson
|
|
36
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-26MTCOZK.mjs";
|
|
19
|
+
import {
|
|
20
|
+
runProcess
|
|
21
|
+
} from "./chunk-MPKKOQVI.mjs";
|
|
22
|
+
import {
|
|
23
|
+
Fault,
|
|
24
|
+
__commonJS,
|
|
25
|
+
__require,
|
|
26
|
+
__toESM,
|
|
27
|
+
external_exports
|
|
28
|
+
} from "./chunk-CI5IU2PI.mjs";
|
|
37
29
|
|
|
38
30
|
// node_modules/pend/index.js
|
|
39
31
|
var require_pend = __commonJS({
|
|
@@ -531,7 +523,7 @@ var require_yauzl = __commonJS({
|
|
|
531
523
|
var PassThrough = __require("stream").PassThrough;
|
|
532
524
|
var Writable = __require("stream").Writable;
|
|
533
525
|
var crc32 = typeof zlib.crc32 === "function" ? zlib.crc32 : require_crc32();
|
|
534
|
-
exports.open =
|
|
526
|
+
exports.open = open;
|
|
535
527
|
exports.fromFd = fromFd;
|
|
536
528
|
exports.fromBuffer = fromBuffer;
|
|
537
529
|
exports.fromRandomAccessReader = fromRandomAccessReader;
|
|
@@ -547,9 +539,9 @@ var require_yauzl = __commonJS({
|
|
|
547
539
|
exports.Entry = Entry;
|
|
548
540
|
exports.LocalFileHeader = LocalFileHeader;
|
|
549
541
|
exports.RandomAccessReader = RandomAccessReader;
|
|
550
|
-
function openPromise(
|
|
542
|
+
function openPromise(path5, options2) {
|
|
551
543
|
return new Promise((resolve, reject) => {
|
|
552
|
-
|
|
544
|
+
open(path5, { ...options2, lazyEntries: true }, function(err, zipfile) {
|
|
553
545
|
if (err) return reject(err);
|
|
554
546
|
resolve(zipfile);
|
|
555
547
|
});
|
|
@@ -579,7 +571,7 @@ var require_yauzl = __commonJS({
|
|
|
579
571
|
});
|
|
580
572
|
});
|
|
581
573
|
}
|
|
582
|
-
function
|
|
574
|
+
function open(path5, options2, callback) {
|
|
583
575
|
if (typeof options2 === "function") {
|
|
584
576
|
callback = options2;
|
|
585
577
|
options2 = null;
|
|
@@ -591,7 +583,7 @@ var require_yauzl = __commonJS({
|
|
|
591
583
|
if (options2.validateEntrySizes == null) options2.validateEntrySizes = true;
|
|
592
584
|
if (options2.strictFileNames == null) options2.strictFileNames = false;
|
|
593
585
|
if (callback == null) callback = defaultCallback;
|
|
594
|
-
fs2.open(
|
|
586
|
+
fs2.open(path5, "r", function(err, fd) {
|
|
595
587
|
if (err) return callback(err);
|
|
596
588
|
fromFd(fd, options2, function(err2, zipfile) {
|
|
597
589
|
if (err2) fs2.close(fd, defaultCallback);
|
|
@@ -1292,3315 +1284,101 @@ var require_yauzl = __commonJS({
|
|
|
1292
1284
|
});
|
|
1293
1285
|
});
|
|
1294
1286
|
installDestroyFn(byteCounter, function() {
|
|
1295
|
-
destroyed = true;
|
|
1296
|
-
refUnrefFilter.unpipe(byteCounter);
|
|
1297
|
-
refUnrefFilter.destroy();
|
|
1298
|
-
});
|
|
1299
|
-
return stream.pipe(refUnrefFilter).pipe(byteCounter);
|
|
1300
|
-
};
|
|
1301
|
-
RandomAccessReader.prototype._readStreamForRange = function(start, end) {
|
|
1302
|
-
throw new Error("not implemented");
|
|
1303
|
-
};
|
|
1304
|
-
RandomAccessReader.prototype.read = function(buffer, offset, length, position, callback) {
|
|
1305
|
-
var readStream = this.createReadStream({ start: position, end: position + length });
|
|
1306
|
-
var writeStream = new Writable();
|
|
1307
|
-
var written = 0;
|
|
1308
|
-
writeStream._write = function(chunk, encoding, cb) {
|
|
1309
|
-
chunk.copy(buffer, offset + written, 0, chunk.length);
|
|
1310
|
-
written += chunk.length;
|
|
1311
|
-
cb();
|
|
1312
|
-
};
|
|
1313
|
-
writeStream.on("finish", callback);
|
|
1314
|
-
readStream.on("error", function(error) {
|
|
1315
|
-
callback(error);
|
|
1316
|
-
});
|
|
1317
|
-
readStream.pipe(writeStream);
|
|
1318
|
-
};
|
|
1319
|
-
RandomAccessReader.prototype.close = function(callback) {
|
|
1320
|
-
setImmediate(callback);
|
|
1321
|
-
};
|
|
1322
|
-
util.inherits(RefUnrefFilter, PassThrough);
|
|
1323
|
-
function RefUnrefFilter(context) {
|
|
1324
|
-
PassThrough.call(this);
|
|
1325
|
-
this.context = context;
|
|
1326
|
-
this.context.ref();
|
|
1327
|
-
this.unreffedYet = false;
|
|
1328
|
-
}
|
|
1329
|
-
RefUnrefFilter.prototype._flush = function(cb) {
|
|
1330
|
-
this.unref();
|
|
1331
|
-
cb();
|
|
1332
|
-
};
|
|
1333
|
-
RefUnrefFilter.prototype.unref = function(cb) {
|
|
1334
|
-
if (this.unreffedYet) return;
|
|
1335
|
-
this.unreffedYet = true;
|
|
1336
|
-
this.context.unref();
|
|
1337
|
-
};
|
|
1338
|
-
var cp437 = "\0\u263A\u263B\u2665\u2666\u2663\u2660\u2022\u25D8\u25CB\u25D9\u2642\u2640\u266A\u266B\u263C\u25BA\u25C4\u2195\u203C\xB6\xA7\u25AC\u21A8\u2191\u2193\u2192\u2190\u221F\u2194\u25B2\u25BC !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u2302\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0";
|
|
1339
|
-
function decodeBuffer(buffer, isUtf8) {
|
|
1340
|
-
if (isUtf8) {
|
|
1341
|
-
return buffer.toString("utf8");
|
|
1342
|
-
} else {
|
|
1343
|
-
var result = "";
|
|
1344
|
-
for (var i = 0; i < buffer.length; i++) {
|
|
1345
|
-
result += cp437[buffer[i]];
|
|
1346
|
-
}
|
|
1347
|
-
return result;
|
|
1348
|
-
}
|
|
1349
|
-
}
|
|
1350
|
-
function readUInt64LE(buffer, offset) {
|
|
1351
|
-
var lower32 = buffer.readUInt32LE(offset);
|
|
1352
|
-
var upper32 = buffer.readUInt32LE(offset + 4);
|
|
1353
|
-
return upper32 * 4294967296 + lower32;
|
|
1354
|
-
}
|
|
1355
|
-
var newBuffer;
|
|
1356
|
-
if (typeof Buffer.allocUnsafe === "function") {
|
|
1357
|
-
newBuffer = function(len) {
|
|
1358
|
-
return Buffer.allocUnsafe(len);
|
|
1359
|
-
};
|
|
1360
|
-
} else {
|
|
1361
|
-
newBuffer = function(len) {
|
|
1362
|
-
return new Buffer(len);
|
|
1363
|
-
};
|
|
1364
|
-
}
|
|
1365
|
-
function installDestroyFn(stream, fn) {
|
|
1366
|
-
if (typeof stream.destroy === "function") {
|
|
1367
|
-
stream._destroy = function(err, cb) {
|
|
1368
|
-
fn();
|
|
1369
|
-
if (cb != null) cb(err);
|
|
1370
|
-
};
|
|
1371
|
-
} else {
|
|
1372
|
-
stream.destroy = fn;
|
|
1373
|
-
}
|
|
1374
|
-
}
|
|
1375
|
-
function defaultCallback(err) {
|
|
1376
|
-
if (err) throw err;
|
|
1377
|
-
}
|
|
1378
|
-
}
|
|
1379
|
-
});
|
|
1380
|
-
|
|
1381
|
-
// packages/installer/src/toolchain.ts
|
|
1382
|
-
import path16 from "node:path";
|
|
1383
|
-
import { mkdir as mkdir8, mkdtemp as mkdtemp4, readdir as readdir4, readlink, rename as rename4, rm as rm8, chmod as chmod3, statfs, realpath as realpath6 } from "node:fs/promises";
|
|
1384
|
-
|
|
1385
|
-
// packages/core/src/project.ts
|
|
1386
|
-
import path12 from "node:path";
|
|
1387
|
-
import { cp as cp4, mkdir as mkdir5, lstat as lstat3, readdir as readdir3, writeFile, mkdtemp as mkdtemp2, rm as rm6, rename as rename3 } from "node:fs/promises";
|
|
1388
|
-
import { fileURLToPath } from "node:url";
|
|
1389
|
-
|
|
1390
|
-
// packages/core/src/oracle.ts
|
|
1391
|
-
var oracle_exports = {};
|
|
1392
|
-
__export(oracle_exports, {
|
|
1393
|
-
OracleAdapter: () => OracleAdapter,
|
|
1394
|
-
SCRIPT_RESTRICT_LEVEL: () => SCRIPT_RESTRICT_LEVEL,
|
|
1395
|
-
compilerDetails: () => compilerDetails,
|
|
1396
|
-
compilerFault: () => compilerFault,
|
|
1397
|
-
compilerSucceeded: () => compilerSucceeded,
|
|
1398
|
-
diagnosticHint: () => diagnosticHint,
|
|
1399
|
-
installSources: () => installSources,
|
|
1400
|
-
jsonDocuments: () => jsonDocuments,
|
|
1401
|
-
oracleDiagnostics: () => oracleDiagnostics,
|
|
1402
|
-
parseCompilerDiagnostics: () => parseCompilerDiagnostics,
|
|
1403
|
-
parseStatementMs: () => parseStatementMs,
|
|
1404
|
-
resetCapabilityCache: () => resetCapabilityCache,
|
|
1405
|
-
sqlLiteral: () => sqlLiteral,
|
|
1406
|
-
sqlclToken: () => sqlclToken,
|
|
1407
|
-
targetIdentitySql: () => targetIdentitySql
|
|
1408
|
-
});
|
|
1409
|
-
import { performance } from "node:perf_hooks";
|
|
1410
|
-
import path11 from "node:path";
|
|
1411
|
-
import { randomUUID } from "node:crypto";
|
|
1412
|
-
import { cp as cp3, mkdir as mkdir4, mkdtemp, readFile as readFile5, readdir as readdir2, realpath as realpath4, rename as rename2, rm as rm5, stat as stat3 } from "node:fs/promises";
|
|
1413
|
-
|
|
1414
|
-
// packages/core/src/connections.ts
|
|
1415
|
-
import path2 from "node:path";
|
|
1416
|
-
import { chmod, constants as constants2, lstat, mkdir, open as open2, rm, stat } from "node:fs/promises";
|
|
1417
|
-
|
|
1418
|
-
// packages/core/src/local-env.ts
|
|
1419
|
-
import path from "node:path";
|
|
1420
|
-
import { constants, open, realpath } from "node:fs/promises";
|
|
1421
|
-
function parseLocalEnv(contents) {
|
|
1422
|
-
const result = /* @__PURE__ */ Object.create(null);
|
|
1423
|
-
for (const line of contents.split(/\r?\n/)) {
|
|
1424
|
-
if (!line.trim() || line.trimStart().startsWith("#")) continue;
|
|
1425
|
-
const match = /^(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/.exec(line.trim());
|
|
1426
|
-
if (!match || Object.hasOwn(result, match[1]))
|
|
1427
|
-
throw new Fault("ENV_FILE_INVALID", "The local ENV file has an invalid or duplicate entry.", 2);
|
|
1428
|
-
let value = match[2];
|
|
1429
|
-
if (value.startsWith('"') || value.startsWith("'")) {
|
|
1430
|
-
const quote = value[0], end = value.lastIndexOf(quote);
|
|
1431
|
-
if (end === 0 || !/^\s*(?:#.*)?$/.test(value.slice(end + 1)))
|
|
1432
|
-
throw new Fault("ENV_FILE_INVALID", "The local ENV file has an invalid quoted entry.", 2);
|
|
1433
|
-
value = value.slice(1, end);
|
|
1434
|
-
} else value = value.replace(/\s+#.*$/, "").trimEnd();
|
|
1435
|
-
result[match[1]] = value;
|
|
1436
|
-
}
|
|
1437
|
-
return result;
|
|
1438
|
-
}
|
|
1439
|
-
async function readLocalEnv(file) {
|
|
1440
|
-
const requested = path.resolve(file), physical = await realpath(requested);
|
|
1441
|
-
if (requested !== physical)
|
|
1442
|
-
throw new Fault("ENV_FILE_UNSAFE", "Credential ENV paths cannot use symlink aliases.", 2);
|
|
1443
|
-
const cwd = path.dirname(physical);
|
|
1444
|
-
const root = await runProcess({
|
|
1445
|
-
executable: "git",
|
|
1446
|
-
args: ["rev-parse", "--show-toplevel"],
|
|
1447
|
-
cwd,
|
|
1448
|
-
timeoutMs: 5e3
|
|
1449
|
-
});
|
|
1450
|
-
if (root.code !== 0)
|
|
1451
|
-
throw new Fault("ENV_FILE_UNSAFE", "Credential ENV files must belong to a Git working tree.", 2);
|
|
1452
|
-
const relative = path.relative(root.stdout.trim(), physical);
|
|
1453
|
-
const tracked = await runProcess({
|
|
1454
|
-
executable: "git",
|
|
1455
|
-
args: ["ls-files", "--error-unmatch", "--", relative],
|
|
1456
|
-
cwd: root.stdout.trim(),
|
|
1457
|
-
timeoutMs: 5e3
|
|
1458
|
-
});
|
|
1459
|
-
const ignored = await runProcess({
|
|
1460
|
-
executable: "git",
|
|
1461
|
-
args: ["check-ignore", "-q", "--", relative],
|
|
1462
|
-
cwd: root.stdout.trim(),
|
|
1463
|
-
timeoutMs: 5e3
|
|
1464
|
-
});
|
|
1465
|
-
if (tracked.code === 0 || ignored.code !== 0)
|
|
1466
|
-
throw new Fault(
|
|
1467
|
-
"ENV_FILE_UNSAFE",
|
|
1468
|
-
"Credential ENV files must be ignored by Git and absent from tracked files.",
|
|
1469
|
-
2
|
|
1470
|
-
);
|
|
1471
|
-
const handle = await open(physical, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
1472
|
-
try {
|
|
1473
|
-
const info = await handle.stat();
|
|
1474
|
-
if (!info.isFile() || info.size > 65536 || typeof process.getuid === "function" && info.uid !== process.getuid())
|
|
1475
|
-
throw new Fault(
|
|
1476
|
-
"ENV_FILE_UNSAFE",
|
|
1477
|
-
"Credential ENV files must be bounded regular files owned by the current user.",
|
|
1478
|
-
2
|
|
1479
|
-
);
|
|
1480
|
-
return parseLocalEnv(await handle.readFile("utf8"));
|
|
1481
|
-
} finally {
|
|
1482
|
-
await handle.close();
|
|
1483
|
-
}
|
|
1484
|
-
}
|
|
1485
|
-
|
|
1486
|
-
// packages/core/src/connections.ts
|
|
1487
|
-
var savedConnectionName = external_exports.string().min(1).max(512).regex(/^[^\x00-\x1f\x7f-\x9f]+$/);
|
|
1488
|
-
var ordsUrl = external_exports.string().url().max(2048).refine((value) => {
|
|
1489
|
-
const url = new URL(value);
|
|
1490
|
-
return ["http:", "https:"].includes(url.protocol) && // Plaintext HTTP would expose the ORDS password; allow it for loopback only.
|
|
1491
|
-
(url.protocol === "https:" || ["localhost", "127.0.0.1", "[::1]"].includes(url.hostname)) && !url.username && !url.password && !url.search && !url.hash && url.pathname.endsWith("/") && !url.pathname.replace(/\/+$/, "").endsWith("/_/sql") && !/[\s"\x00-\x1f]/.test(value);
|
|
1492
|
-
}, "Use the ORDS schema HTTPS URL ending in / (HTTP only for localhost), without credentials, query or fragment.");
|
|
1493
|
-
var ordsUsername = external_exports.string().min(1).max(128).regex(/^[^"\x00-\x1f\x7f-\x9f]+$/);
|
|
1494
|
-
var ordsSchema = external_exports.strictObject({ url: ordsUrl, username: ordsUsername });
|
|
1495
|
-
var connectionSchema = external_exports.strictObject({
|
|
1496
|
-
kind: external_exports.literal("sqlcl-store"),
|
|
1497
|
-
name: savedConnectionName.optional(),
|
|
1498
|
-
ords: ordsSchema.optional()
|
|
1499
|
-
}).refine((value) => !!(value.name || value.ords), "Configure a direct connection or ORDS endpoint.");
|
|
1500
|
-
var storeSchema = external_exports.record(refName, connectionSchema);
|
|
1501
|
-
var references = /* @__PURE__ */ new WeakMap();
|
|
1502
|
-
var connectionReference = (connection) => references.get(connection);
|
|
1503
|
-
var credentialSchema = ordsSchema.extend({ password: external_exports.string().min(1).max(4096) }).strict();
|
|
1504
|
-
function checkPassword(password) {
|
|
1505
|
-
if (!password || password.length > 4096 || /["\x00-\x1f\x7f-\x9f]/.test(password))
|
|
1506
|
-
throw new Fault(
|
|
1507
|
-
"INVALID_ORDS_PASSWORD",
|
|
1508
|
-
"ORDS passwords must be nonempty and cannot contain control characters or double quotes.",
|
|
1509
|
-
2
|
|
1510
|
-
);
|
|
1511
|
-
return password;
|
|
1512
|
-
}
|
|
1513
|
-
async function credentialPath(name) {
|
|
1514
|
-
parse(refName, name);
|
|
1515
|
-
return contained(managedHome(), path2.join("credentials", name + ".json"));
|
|
1516
|
-
}
|
|
1517
|
-
async function ordsCredentials(connection) {
|
|
1518
|
-
const name = references.get(connection);
|
|
1519
|
-
if (!name || !connection.ords)
|
|
1520
|
-
throw new Fault(
|
|
1521
|
-
"ORDS_CONNECTION_REQUIRED",
|
|
1522
|
-
"Configure this connection reference with a plugin-level ORDS endpoint and credentials.",
|
|
1523
|
-
3,
|
|
1524
|
-
"blocked"
|
|
1525
|
-
);
|
|
1526
|
-
const file = await credentialPath(name);
|
|
1527
|
-
if (!await exists(file))
|
|
1528
|
-
throw new Fault(
|
|
1529
|
-
"ORDS_CREDENTIALS_REQUIRED",
|
|
1530
|
-
"Save the ORDS password locally in plugin connection settings.",
|
|
1531
|
-
3,
|
|
1532
|
-
"blocked"
|
|
1533
|
-
);
|
|
1534
|
-
if (process.platform !== "win32" && ((await stat(file)).mode & 63) !== 0)
|
|
1535
|
-
throw new Fault(
|
|
1536
|
-
"ORDS_CREDENTIAL_PERMISSIONS",
|
|
1537
|
-
"ORDS credential files must only be readable by their owner (0600).",
|
|
1538
|
-
3,
|
|
1539
|
-
"blocked"
|
|
1540
|
-
);
|
|
1541
|
-
let value;
|
|
1542
|
-
try {
|
|
1543
|
-
value = parse(credentialSchema, await readJson(file));
|
|
1544
|
-
} catch {
|
|
1545
|
-
throw new Fault(
|
|
1546
|
-
"ORDS_CREDENTIALS_INVALID",
|
|
1547
|
-
"The local ORDS credential file is invalid. Save it again in plugin settings.",
|
|
1548
|
-
3,
|
|
1549
|
-
"blocked"
|
|
1550
|
-
);
|
|
1551
|
-
}
|
|
1552
|
-
if (value.url !== connection.ords.url || value.username !== connection.ords.username)
|
|
1553
|
-
throw new Fault(
|
|
1554
|
-
"ORDS_CREDENTIALS_REQUIRED",
|
|
1555
|
-
"Save credentials for the configured ORDS endpoint and username.",
|
|
1556
|
-
3,
|
|
1557
|
-
"blocked"
|
|
1558
|
-
);
|
|
1559
|
-
checkPassword(value.password);
|
|
1560
|
-
return value;
|
|
1561
|
-
}
|
|
1562
|
-
async function connections() {
|
|
1563
|
-
const file = path2.join(managedHome(), "connections.json");
|
|
1564
|
-
return await exists(file) ? parse(storeSchema, await readJson(file)) : {};
|
|
1565
|
-
}
|
|
1566
|
-
async function resolveConnection(name) {
|
|
1567
|
-
const connection = (await connections())[name];
|
|
1568
|
-
if (!connection)
|
|
1569
|
-
throw new Fault(
|
|
1570
|
-
"CONNECTION_REQUIRED",
|
|
1571
|
-
"Configure the requested SQLcl connection reference locally; do not send credentials in chat.",
|
|
1572
|
-
3,
|
|
1573
|
-
"blocked"
|
|
1574
|
-
);
|
|
1575
|
-
references.set(connection, name);
|
|
1576
|
-
return connection;
|
|
1577
|
-
}
|
|
1578
|
-
async function editConnection(name, value) {
|
|
1579
|
-
parse(refName, name);
|
|
1580
|
-
return withLock(path2.join(managedHome(), "connections.lock"), async () => {
|
|
1581
|
-
const current = await connections();
|
|
1582
|
-
let credentialsDeleted = false;
|
|
1583
|
-
if (value) current[name] = parse(connectionSchema, { ...current[name], ...value });
|
|
1584
|
-
else {
|
|
1585
|
-
delete current[name];
|
|
1586
|
-
const file = await credentialPath(name);
|
|
1587
|
-
credentialsDeleted = await exists(file);
|
|
1588
|
-
await rm(file, { force: true });
|
|
1589
|
-
}
|
|
1590
|
-
await writeJson(path2.join(managedHome(), "connections.json"), current);
|
|
1591
|
-
return { name, status: value ? "configured" : "removed", credentialsDeleted };
|
|
1592
|
-
});
|
|
1593
|
-
}
|
|
1594
|
-
async function readPasswordFile(file) {
|
|
1595
|
-
let handle;
|
|
1596
|
-
let before;
|
|
1597
|
-
try {
|
|
1598
|
-
before = await lstat(file);
|
|
1599
|
-
if (before.isSymbolicLink() || !before.isFile())
|
|
1600
|
-
throw new Fault("PASSWORD_FILE_UNSAFE", "The password file must be a regular non-symlink file.", 2);
|
|
1601
|
-
handle = await open2(file, constants2.O_RDONLY | (constants2.O_NOFOLLOW ?? 0));
|
|
1602
|
-
} catch (error) {
|
|
1603
|
-
if (error instanceof Fault) throw error;
|
|
1604
|
-
const code = error.code;
|
|
1605
|
-
throw new Fault(
|
|
1606
|
-
"PASSWORD_FILE_UNSAFE",
|
|
1607
|
-
code === "ELOOP" || code === "EMLINK" ? "The password file must not be a symbolic link." : "The password file cannot be opened.",
|
|
1608
|
-
2
|
|
1609
|
-
);
|
|
1610
|
-
}
|
|
1611
|
-
try {
|
|
1612
|
-
const info = await handle.stat();
|
|
1613
|
-
const current = await lstat(file);
|
|
1614
|
-
if (!info.isFile() || !current.isFile() || current.isSymbolicLink() || before.dev !== info.dev || before.ino !== info.ino || current.dev !== info.dev || current.ino !== info.ino)
|
|
1615
|
-
throw new Fault("PASSWORD_FILE_UNSAFE", "The password file changed or is not a regular file.", 2);
|
|
1616
|
-
if (process.platform !== "win32" && (info.mode & 63) !== 0)
|
|
1617
|
-
throw new Fault(
|
|
1618
|
-
"PASSWORD_FILE_UNSAFE",
|
|
1619
|
-
"The password file must only be accessible by its owner (chmod 600).",
|
|
1620
|
-
2
|
|
1621
|
-
);
|
|
1622
|
-
return await handle.readFile("utf8");
|
|
1623
|
-
} finally {
|
|
1624
|
-
await handle.close();
|
|
1625
|
-
}
|
|
1626
|
-
}
|
|
1627
|
-
async function configureConnection(name, input) {
|
|
1628
|
-
parse(refName, name);
|
|
1629
|
-
if (input.envFile) {
|
|
1630
|
-
if (input.password !== void 0 || input.passwordFile)
|
|
1631
|
-
throw new Fault("INVALID_INPUT", "Select one local credential source.", 2);
|
|
1632
|
-
const values = await readLocalEnv(input.envFile);
|
|
1633
|
-
const password = values[input.passwordKey ?? "ORDS_PASSWORD"];
|
|
1634
|
-
const username = values[input.usernameKey ?? "ORDS_USERNAME"];
|
|
1635
|
-
const url = values[input.urlKey ?? "ORDS_URL"];
|
|
1636
|
-
if (!password || !(input.ordsUsername ?? username) || !(input.ordsUrl ?? url))
|
|
1637
|
-
throw new Fault("ENV_CREDENTIALS_MISSING", "The selected local ENV credential keys are missing.", 2);
|
|
1638
|
-
input = {
|
|
1639
|
-
...input,
|
|
1640
|
-
password,
|
|
1641
|
-
ordsUsername: input.ordsUsername ?? username,
|
|
1642
|
-
ordsUrl: input.ordsUrl ?? url
|
|
1643
|
-
};
|
|
1644
|
-
}
|
|
1645
|
-
return withLock(path2.join(managedHome(), "connections.lock"), async () => {
|
|
1646
|
-
const current = await connections();
|
|
1647
|
-
const previous = current[name];
|
|
1648
|
-
const ords = input.ordsUrl || input.ordsUsername ? parse(ordsSchema, { url: input.ordsUrl, username: input.ordsUsername }) : previous?.ords;
|
|
1649
|
-
const value = parse(connectionSchema, {
|
|
1650
|
-
...previous,
|
|
1651
|
-
kind: "sqlcl-store",
|
|
1652
|
-
...input.sqlclName ? { name: input.sqlclName } : {},
|
|
1653
|
-
...ords ? { ords } : {}
|
|
1654
|
-
});
|
|
1655
|
-
let password = input.password;
|
|
1656
|
-
if (input.passwordFile) {
|
|
1657
|
-
if (password !== void 0) throw new Fault("INVALID_INPUT", "Supply one local password source.", 2);
|
|
1658
|
-
const file = path2.resolve(input.passwordFile);
|
|
1659
|
-
const roots = [managedHome(), ...input.project ? [path2.resolve(input.project)] : [], process.cwd()];
|
|
1660
|
-
const inside = (root) => {
|
|
1661
|
-
const relative = path2.relative(root, file);
|
|
1662
|
-
return relative !== "" && !relative.startsWith("..") && !path2.isAbsolute(relative);
|
|
1663
|
-
};
|
|
1664
|
-
if (!roots.some(inside))
|
|
1665
|
-
throw new Fault(
|
|
1666
|
-
"PASSWORD_FILE_UNSAFE",
|
|
1667
|
-
"The password file must be inside the managed home, the project directory or the current working directory.",
|
|
1668
|
-
2
|
|
1669
|
-
);
|
|
1670
|
-
password = (await readPasswordFile(file)).replace(/\r?\n$/, "");
|
|
1671
|
-
}
|
|
1672
|
-
if (password !== void 0 && !ords)
|
|
1673
|
-
throw new Fault(
|
|
1674
|
-
"INVALID_INPUT",
|
|
1675
|
-
"Configure the ORDS endpoint and username before saving its password.",
|
|
1676
|
-
2
|
|
1677
|
-
);
|
|
1678
|
-
if (ords && (input.ordsUrl || input.ordsUsername || password !== void 0)) {
|
|
1679
|
-
if (password !== void 0) {
|
|
1680
|
-
const folder = await contained(managedHome(), "credentials");
|
|
1681
|
-
await mkdir(folder, { recursive: true, mode: 448 });
|
|
1682
|
-
if (process.platform !== "win32") await chmod(folder, 448);
|
|
1683
|
-
await writeJson(await credentialPath(name), { ...ords, password: checkPassword(password) });
|
|
1684
|
-
} else {
|
|
1685
|
-
references.set(value, name);
|
|
1686
|
-
await ordsCredentials(value);
|
|
1687
|
-
}
|
|
1688
|
-
}
|
|
1689
|
-
current[name] = value;
|
|
1690
|
-
await writeJson(path2.join(managedHome(), "connections.json"), current);
|
|
1691
|
-
return { name, status: "configured" };
|
|
1692
|
-
});
|
|
1693
|
-
}
|
|
1694
|
-
|
|
1695
|
-
// packages/core/src/sqlcl-config.ts
|
|
1696
|
-
import path3 from "node:path";
|
|
1697
|
-
var sqlclMode = external_exports.enum(["cli", "mcp"]);
|
|
1698
|
-
var sqlclRestriction = external_exports.enum(["4", "1"]);
|
|
1699
|
-
var databaseTransport = external_exports.enum(["direct", "ords"]);
|
|
1700
|
-
var sqlclConfigSchema = external_exports.strictObject({
|
|
1701
|
-
schemaVersion: external_exports.literal(1),
|
|
1702
|
-
mode: sqlclMode,
|
|
1703
|
-
mcpRestrictLevel: sqlclRestriction,
|
|
1704
|
-
databaseTransport: databaseTransport.optional()
|
|
1705
|
-
});
|
|
1706
|
-
async function sqlclConfig() {
|
|
1707
|
-
const home = managedHome();
|
|
1708
|
-
if (!await exists(home)) return { schemaVersion: 1, mode: "cli", mcpRestrictLevel: "4" };
|
|
1709
|
-
const file = await contained(home, "sqlcl.json");
|
|
1710
|
-
return await exists(file) ? parse(sqlclConfigSchema, await readJson(file)) : { schemaVersion: 1, mode: "cli", mcpRestrictLevel: "4" };
|
|
1711
|
-
}
|
|
1712
|
-
async function configureSqlcl(mode, level, transport) {
|
|
1713
|
-
const home = managedHome();
|
|
1714
|
-
return withLock(path3.join(home, "sqlcl-config.lock"), async () => {
|
|
1715
|
-
const previous = await sqlclConfig();
|
|
1716
|
-
const configuration = parse(sqlclConfigSchema, {
|
|
1717
|
-
...previous,
|
|
1718
|
-
mode,
|
|
1719
|
-
mcpRestrictLevel: level ?? previous.mcpRestrictLevel,
|
|
1720
|
-
...transport ? { databaseTransport: transport } : {}
|
|
1721
|
-
});
|
|
1722
|
-
if (configuration.mode === "mcp" && configuration.databaseTransport === "ords")
|
|
1723
|
-
throw new Fault(
|
|
1724
|
-
"ORDS_CLI_REQUIRED",
|
|
1725
|
-
"ORDS HTTP requires SQLcl CLI mode. Select CLI execution for this transport.",
|
|
1726
|
-
3,
|
|
1727
|
-
"blocked"
|
|
1728
|
-
);
|
|
1729
|
-
await writeJson(await contained(home, "sqlcl.json"), configuration);
|
|
1730
|
-
return configuration;
|
|
1731
|
-
});
|
|
1732
|
-
}
|
|
1733
|
-
|
|
1734
|
-
// packages/core/src/ords.ts
|
|
1735
|
-
import path4 from "node:path";
|
|
1736
|
-
import { realpath as realpath2, rm as rm2 } from "node:fs/promises";
|
|
1737
|
-
async function sqlclHome(executable) {
|
|
1738
|
-
const candidates = path4.isAbsolute(executable) ? [executable] : executable.includes(path4.sep) ? [path4.resolve(executable)] : (process.env.PATH ?? "").split(path4.delimiter).flatMap(
|
|
1739
|
-
(directory) => process.platform === "win32" ? ["", ".exe", ".cmd", ".bat"].map((extension) => path4.join(directory, executable + extension)) : [path4.join(directory, executable)]
|
|
1740
|
-
);
|
|
1741
|
-
for (const candidate of candidates) {
|
|
1742
|
-
if (!await exists(candidate)) continue;
|
|
1743
|
-
const home = path4.dirname(path4.dirname(await realpath2(candidate)));
|
|
1744
|
-
if (await exists(path4.join(home, "lib", "jdbcrest.jar"))) return home;
|
|
1745
|
-
break;
|
|
1746
|
-
}
|
|
1747
|
-
throw new Fault(
|
|
1748
|
-
"ORDS_SQLCL_LIBRARIES_REQUIRED",
|
|
1749
|
-
"ORDS APEX operations require the selected SQLcl installation with lib/jdbcrest.jar and the Oracle APEXlang compiler. Set APEXREST_SQLCL to its bin/sql executable.",
|
|
1750
|
-
3,
|
|
1751
|
-
"blocked"
|
|
1752
|
-
);
|
|
1753
|
-
}
|
|
1754
|
-
async function resolveOrdsJava(javaHome, stage, env, signal, runner = runProcess) {
|
|
1755
|
-
const executableName = process.platform === "win32" ? "java.exe" : "java";
|
|
1756
|
-
const candidates = [
|
|
1757
|
-
...[javaHome, process.env.JAVA_HOME].filter((home) => !!home).map((home) => ({ executable: path4.join(home, "bin", executableName), javaHome: home })),
|
|
1758
|
-
{ executable: executableName, javaHome: void 0 }
|
|
1759
|
-
];
|
|
1760
|
-
const attempted = /* @__PURE__ */ new Set();
|
|
1761
|
-
for (const candidate of candidates) {
|
|
1762
|
-
if (attempted.has(candidate.executable)) continue;
|
|
1763
|
-
attempted.add(candidate.executable);
|
|
1764
|
-
if (signal?.aborted) throw new Fault("CANCELLED", "ORDS operation cancelled.", 6, "cancelled");
|
|
1765
|
-
try {
|
|
1766
|
-
const result = await runner({
|
|
1767
|
-
executable: candidate.executable,
|
|
1768
|
-
args: ["--list-modules"],
|
|
1769
|
-
cwd: stage,
|
|
1770
|
-
env: { ...env, JAVA_HOME: candidate.javaHome },
|
|
1771
|
-
timeoutMs: 1e4,
|
|
1772
|
-
...signal ? { signal } : {}
|
|
1773
|
-
});
|
|
1774
|
-
if (result.cancelled || signal?.aborted)
|
|
1775
|
-
throw new Fault("CANCELLED", "ORDS operation cancelled.", 6, "cancelled");
|
|
1776
|
-
const major = Number(result.stdout.match(/^java\.base@(\d+)/m)?.[1] ?? 0);
|
|
1777
|
-
if (result.code === 0 && !result.timedOut && !result.truncated && major >= 21 && /^jdk\.compiler@/m.test(result.stdout))
|
|
1778
|
-
return candidate;
|
|
1779
|
-
} catch (error) {
|
|
1780
|
-
if (!(error instanceof Fault) || error.code !== "DEPENDENCY_MISSING") throw error;
|
|
1781
|
-
}
|
|
1782
|
-
}
|
|
1783
|
-
throw new Fault(
|
|
1784
|
-
"ORDS_JDK_REQUIRED",
|
|
1785
|
-
"ORDS APEX operations need an installed JDK 21 or newer with jdk.compiler. The configured Java runtime and JAVA_HOME/PATH do not provide one. Set APEXREST_JAVA_HOME or JAVA_HOME to an existing JDK; ordinary SQLcl can continue using its managed JRE.",
|
|
1786
|
-
3,
|
|
1787
|
-
"blocked"
|
|
1788
|
-
);
|
|
1789
|
-
}
|
|
1790
|
-
async function runOrdsBridge(settings, job, credentials, stage, signal, runner = runProcess) {
|
|
1791
|
-
if (signal?.aborted) throw new Fault("CANCELLED", "ORDS operation cancelled.", 6, "cancelled");
|
|
1792
|
-
const home = await sqlclHome(settings.executable);
|
|
1793
|
-
const helper = path4.join(resourceRoot(), "ords", "OrdsBridge.java");
|
|
1794
|
-
if (!await exists(helper))
|
|
1795
|
-
throw new Fault("ORDS_HELPER_REQUIRED", "The installed plugin is missing its ORDS helper.", 3, "blocked");
|
|
1796
|
-
const jobFile = path4.join(stage, "ords-job.json");
|
|
1797
|
-
const output = path4.join(stage, "ords-result.json");
|
|
1798
|
-
await rm2(output, { force: true });
|
|
1799
|
-
await writeJson(jobFile, { ...job, output });
|
|
1800
|
-
const env = { ...process.env, JAVA_HOME: settings.javaHome };
|
|
1801
|
-
delete env.NODE_OPTIONS;
|
|
1802
|
-
delete env.JAVA_TOOL_OPTIONS;
|
|
1803
|
-
delete env._JAVA_OPTIONS;
|
|
1804
|
-
delete env.JDK_JAVA_OPTIONS;
|
|
1805
|
-
const java = await resolveOrdsJava(settings.javaHome, stage, env, signal, runner);
|
|
1806
|
-
env.JAVA_HOME = java.javaHome;
|
|
1807
|
-
const processResult = await runner({
|
|
1808
|
-
executable: java.executable,
|
|
1809
|
-
args: [
|
|
1810
|
-
"-cp",
|
|
1811
|
-
[path4.join(home, "lib", "*"), path4.join(home, "lib", "ext", "*")].join(path4.delimiter),
|
|
1812
|
-
helper,
|
|
1813
|
-
jobFile
|
|
1814
|
-
],
|
|
1815
|
-
cwd: stage,
|
|
1816
|
-
env,
|
|
1817
|
-
input: credentials ? JSON.stringify(credentials) : "",
|
|
1818
|
-
timeoutMs: 18e4,
|
|
1819
|
-
...signal ? { signal } : {}
|
|
1820
|
-
});
|
|
1821
|
-
const mutation = job.operation === "import" || job.operation === "script";
|
|
1822
|
-
if (processResult.timedOut || processResult.cancelled || processResult.truncated)
|
|
1823
|
-
throw new Fault(
|
|
1824
|
-
processResult.truncated ? "OUTPUT_LIMIT" : processResult.cancelled ? "CANCELLED" : "TIMEOUT",
|
|
1825
|
-
"The ORDS helper did not confirm completion. Reconcile any import before retrying.",
|
|
1826
|
-
6,
|
|
1827
|
-
mutation ? "outcome_unknown" : "cancelled"
|
|
1828
|
-
);
|
|
1829
|
-
let result;
|
|
1830
|
-
if (await exists(output)) {
|
|
1831
|
-
try {
|
|
1832
|
-
const value = await readJson(output);
|
|
1833
|
-
if (value && value.operation === job.operation && ["succeeded", "failed"].includes(value.status))
|
|
1834
|
-
result = value;
|
|
1835
|
-
} catch {
|
|
1836
|
-
}
|
|
1837
|
-
}
|
|
1838
|
-
if (processResult.code !== 0 || result?.status !== "succeeded" || !processResult.stdout.split(/\r?\n/).some((line) => line.trim() === "APEXREST_ORDS_COMPLETE")) {
|
|
1839
|
-
const unknown = mutation && (!result || result.writeStarted === true);
|
|
1840
|
-
throw new Fault(
|
|
1841
|
-
unknown ? "ORDS_OUTCOME_UNKNOWN" : result?.code ?? "ORDS_BRIDGE_FAILED",
|
|
1842
|
-
unknown ? "ORDS import did not confirm a complete outcome; reconcile the target before retrying." : "The Oracle ORDS helper failed. Check the SQLcl/Java prerequisites, ORDS authentication and schema privileges.",
|
|
1843
|
-
unknown ? 6 : 1,
|
|
1844
|
-
unknown ? "outcome_unknown" : "failed"
|
|
1845
|
-
);
|
|
1846
|
-
}
|
|
1847
|
-
return result;
|
|
1848
|
-
}
|
|
1849
|
-
|
|
1850
|
-
// packages/core/src/compatibility.ts
|
|
1851
|
-
import path5 from "node:path";
|
|
1852
|
-
import { readFile } from "node:fs/promises";
|
|
1853
|
-
var APEX_262_PROFILE = {
|
|
1854
|
-
id: "apex262-sqlcl263-mmd3479",
|
|
1855
|
-
apex: "26.2",
|
|
1856
|
-
sqlcl: "26.3.0.260.1620",
|
|
1857
|
-
mmd: "26.2.0+3479",
|
|
1858
|
-
qualification: "partial-local"
|
|
1859
|
-
};
|
|
1860
|
-
function databaseMeetsApex262Minimum(version) {
|
|
1861
|
-
const match = /^(\d+)\.(\d+)\.(\d+)(?:\.|$)/.exec(version);
|
|
1862
|
-
if (!match) return false;
|
|
1863
|
-
const major = Number(match[1]), minor = Number(match[2]);
|
|
1864
|
-
if (major === 23) return minor >= 26;
|
|
1865
|
-
return major > 19 || major === 19 && minor >= 18;
|
|
1866
|
-
}
|
|
1867
|
-
async function sourceMmdVersion(source) {
|
|
1868
|
-
try {
|
|
1869
|
-
const value = JSON.parse(await readFile(path5.join(source, ".apex/apexlang.json"), "utf8"));
|
|
1870
|
-
const version = value?.mmdVersion;
|
|
1871
|
-
return typeof version === "string" && /^\d+\.\d+\.\d+\+\d+$/.test(version) ? version : null;
|
|
1872
|
-
} catch {
|
|
1873
|
-
return null;
|
|
1874
|
-
}
|
|
1875
|
-
}
|
|
1876
|
-
function evaluatePartialImportCompatibility(input) {
|
|
1877
|
-
const reasons = [];
|
|
1878
|
-
if (input.mode !== "cli" || input.databaseTransport !== "direct")
|
|
1879
|
-
reasons.push("Partial import requires direct SQLcl CLI transport.");
|
|
1880
|
-
if (!input.importFiles) reasons.push("The selected SQLcl import help does not advertise -files.");
|
|
1881
|
-
if (!input.compilerVersion.includes(APEX_262_PROFILE.sqlcl))
|
|
1882
|
-
reasons.push("The SQLcl build is outside the reviewed partial-import profile.");
|
|
1883
|
-
if (input.mmdVersion !== APEX_262_PROFILE.mmd)
|
|
1884
|
-
reasons.push("Source MMD is outside the reviewed APEX 26.2 profile.");
|
|
1885
|
-
if (!/^26\.2(?:\.|$)/.test(input.apexVersion))
|
|
1886
|
-
reasons.push("The target APEX release is outside the reviewed 26.2 profile.");
|
|
1887
|
-
if (!databaseMeetsApex262Minimum(input.databaseVersion))
|
|
1888
|
-
reasons.push("Target database release is unconfirmed or below the APEX 26.2 minimum.");
|
|
1889
|
-
return { ...input, supported: reasons.length === 0, reasons };
|
|
1890
|
-
}
|
|
1891
|
-
|
|
1892
|
-
// packages/core/src/upgrade-audit.ts
|
|
1893
|
-
import path6 from "node:path";
|
|
1894
|
-
import { readFile as readFile2, stat as stat2, opendir } from "node:fs/promises";
|
|
1895
|
-
function parseCodeScan(output, source) {
|
|
1896
|
-
const clean = output.replace(/\x1b\[[0-9;]*m/g, "");
|
|
1897
|
-
const from = clean.indexOf("["), to2 = clean.lastIndexOf("]");
|
|
1898
|
-
if (from < 0 || to2 < from) throw new Error("CodeScan did not return its JSON report.");
|
|
1899
|
-
const report = JSON.parse(clean.slice(from, to2 + 1));
|
|
1900
|
-
if (!Array.isArray(report)) throw new Error("CodeScan report is not a list.");
|
|
1901
|
-
const findings = [];
|
|
1902
|
-
for (const entry of report) {
|
|
1903
|
-
if (!entry || typeof entry.file !== "string" || !Array.isArray(entry.issues))
|
|
1904
|
-
throw new Error("CodeScan report entry is incomplete.");
|
|
1905
|
-
const file = path6.relative(source, path6.resolve(source, entry.file)).replaceAll(path6.sep, "/");
|
|
1906
|
-
if (!file || file.startsWith("../") || path6.isAbsolute(file))
|
|
1907
|
-
throw new Error("CodeScan returned a file outside the inspected source.");
|
|
1908
|
-
for (const issue of entry.issues) {
|
|
1909
|
-
if (typeof issue?.ruleNo !== "string" || typeof issue.msg !== "string" || !Number.isInteger(issue.line) || issue.line < 0 || !Number.isInteger(issue.col) || issue.col < 0)
|
|
1910
|
-
throw new Error("CodeScan issue is incomplete.");
|
|
1911
|
-
findings.push({
|
|
1912
|
-
code: issue.ruleNo,
|
|
1913
|
-
file,
|
|
1914
|
-
line: issue.line,
|
|
1915
|
-
column: issue.col,
|
|
1916
|
-
message: issue.msg,
|
|
1917
|
-
severity: "warning"
|
|
1918
|
-
});
|
|
1919
|
-
}
|
|
1920
|
-
}
|
|
1921
|
-
return findings;
|
|
1922
|
-
}
|
|
1923
|
-
var upgradeRules = [
|
|
1924
|
-
{
|
|
1925
|
-
code: "APEX262_AI_TOOL_CALLS",
|
|
1926
|
-
pattern: /\btool_calls\b/i,
|
|
1927
|
-
message: "Review legacy AI tool_calls handling against the APEX 26.2 response contract."
|
|
1928
|
-
},
|
|
1929
|
-
{
|
|
1930
|
-
code: "APEX262_AI_MESSAGE",
|
|
1931
|
-
pattern: /\bt_chat_response\b/i,
|
|
1932
|
-
message: "Review APEX_AI t_chat_response and response.message usage against the 26.2 response contract."
|
|
1933
|
-
},
|
|
1934
|
-
{
|
|
1935
|
-
code: "APEX262_ASSSO",
|
|
1936
|
-
pattern: /\bASSSO\b/i,
|
|
1937
|
-
message: "Review legacy ASSSO authentication against the APEX 26.2 desupport guidance."
|
|
1938
|
-
},
|
|
1939
|
-
{
|
|
1940
|
-
code: "APEX262_REST_RESOURCE",
|
|
1941
|
-
pattern: /\bAPEX_REST_RESOURCE\b/i,
|
|
1942
|
-
message: "Review legacy APEX_REST_RESOURCE references against APEX 26.2 migration guidance."
|
|
1943
|
-
},
|
|
1944
|
-
{
|
|
1945
|
-
code: "APEX262_ADVISOR",
|
|
1946
|
-
pattern: /\b(?:apex_advisor|advisor)\b/i,
|
|
1947
|
-
message: "Review Advisor references against the APEX 26.2 Advisor changes; this text match may be unrelated."
|
|
1948
|
-
}
|
|
1949
|
-
];
|
|
1950
|
-
async function auditUpgradeSource(source) {
|
|
1951
|
-
const files = [], directories = [""];
|
|
1952
|
-
const findings = [], skipped = [];
|
|
1953
|
-
let inspected = 0, traversalTruncated = false;
|
|
1954
|
-
discovery: while (directories.length) {
|
|
1955
|
-
const relative = directories.pop();
|
|
1956
|
-
for await (const entry of await opendir(path6.join(source, relative))) {
|
|
1957
|
-
if (++inspected > 1e4) {
|
|
1958
|
-
traversalTruncated = true;
|
|
1959
|
-
break discovery;
|
|
1960
|
-
}
|
|
1961
|
-
const file = path6.posix.join(relative, entry.name);
|
|
1962
|
-
if (entry.isSymbolicLink()) skipped.push(file);
|
|
1963
|
-
else if (entry.isDirectory()) directories.push(file);
|
|
1964
|
-
else if (entry.isFile() && /\.(?:apx|sql|js)$/i.test(file)) files.push(file);
|
|
1965
|
-
}
|
|
1966
|
-
}
|
|
1967
|
-
files.sort();
|
|
1968
|
-
let bytes = 0, scannedFiles = 0;
|
|
1969
|
-
for (const file of files) {
|
|
1970
|
-
const absolute = path6.join(source, file), size = (await stat2(absolute)).size;
|
|
1971
|
-
if (size > 1024 * 1024 || bytes + size > 16 * 1024 * 1024 || scannedFiles >= 2e3) {
|
|
1972
|
-
skipped.push(file);
|
|
1973
|
-
continue;
|
|
1974
|
-
}
|
|
1975
|
-
bytes += size;
|
|
1976
|
-
scannedFiles++;
|
|
1977
|
-
const lines = (await readFile2(absolute, "utf8")).split(/\r?\n/);
|
|
1978
|
-
for (const rule of upgradeRules) {
|
|
1979
|
-
const at2 = lines.findIndex((line) => rule.pattern.test(line));
|
|
1980
|
-
if (at2 >= 0)
|
|
1981
|
-
findings.push({ code: rule.code, file, line: at2 + 1, message: rule.message, severity: "warning" });
|
|
1982
|
-
}
|
|
1983
|
-
}
|
|
1984
|
-
return {
|
|
1985
|
-
status: "advisory",
|
|
1986
|
-
targetRelease: "26.2",
|
|
1987
|
-
scannedFiles,
|
|
1988
|
-
findings,
|
|
1989
|
-
skipped,
|
|
1990
|
-
traversalTruncated,
|
|
1991
|
-
limitation: "Source text review hints only; not a complete dependency, SQL, security or runtime audit."
|
|
1992
|
-
};
|
|
1993
|
-
}
|
|
1994
|
-
|
|
1995
|
-
// packages/core/src/locality.ts
|
|
1996
|
-
import { hostname } from "node:os";
|
|
1997
|
-
var loopback = (host) => ["localhost", "127.0.0.1", "::1", "[::1]"].includes(host.toLowerCase());
|
|
1998
|
-
function localConnectionEndpoint(description) {
|
|
1999
|
-
const jdbc = /jdbc:oracle:(thin|oci):(?:[^@\r\n]*@)?([^\r\n]*)/i.exec(description);
|
|
2000
|
-
if (!jdbc) return { local: false, evidence: "unconfirmed-connection-endpoint" };
|
|
2001
|
-
if (jdbc[1].toLowerCase() === "oci" && !jdbc[2].trim())
|
|
2002
|
-
return { local: true, evidence: "native-local-transport" };
|
|
2003
|
-
const address = jdbc[2].trim();
|
|
2004
|
-
const descriptorHosts = [...address.matchAll(/\(host\s*=\s*([^\s)]+)\)/gi)].map((m2) => m2[1]);
|
|
2005
|
-
const easy = /^(?:\/\/)?(\[[^\]]+\]|[^/:,?\s]+)(?::\d+)?(?:\/|:)/.exec(address);
|
|
2006
|
-
const hosts = descriptorHosts.length ? descriptorHosts : easy ? [easy[1]] : [];
|
|
2007
|
-
return {
|
|
2008
|
-
local: hosts.length > 0 && hosts.every(loopback),
|
|
2009
|
-
evidence: hosts.length && hosts.every(loopback) ? "effective-loopback-endpoint" : "remote-or-unresolved-endpoint"
|
|
2010
|
-
};
|
|
2011
|
-
}
|
|
2012
|
-
async function localServerHost(serverHost) {
|
|
2013
|
-
const host = serverHost.toLowerCase();
|
|
2014
|
-
if (loopback(host) || host === hostname().toLowerCase()) return true;
|
|
2015
|
-
const engines = [
|
|
2016
|
-
"docker",
|
|
2017
|
-
"podman",
|
|
2018
|
-
...process.platform === "darwin" ? ["/opt/podman/bin/podman", "/Applications/Docker.app/Contents/Resources/bin/docker"] : []
|
|
2019
|
-
];
|
|
2020
|
-
for (const executable of engines) {
|
|
2021
|
-
const podman = executable.endsWith("podman");
|
|
2022
|
-
try {
|
|
2023
|
-
if (podman) {
|
|
2024
|
-
if (process.env.CONTAINER_HOST && !process.env.CONTAINER_HOST.startsWith("unix://")) continue;
|
|
2025
|
-
if (process.platform !== "linux") {
|
|
2026
|
-
const connections2 = await runProcess({
|
|
2027
|
-
executable,
|
|
2028
|
-
args: ["system", "connection", "list", "--format", "json"],
|
|
2029
|
-
cwd: process.cwd(),
|
|
2030
|
-
timeoutMs: 5e3
|
|
2031
|
-
});
|
|
2032
|
-
const entries = JSON.parse(connections2.stdout);
|
|
2033
|
-
const active = process.env.CONTAINER_CONNECTION ? entries.find((entry) => entry.Name === process.env.CONTAINER_CONNECTION) : entries.find((entry) => entry.Default);
|
|
2034
|
-
if (!active?.URI) continue;
|
|
2035
|
-
const endpoint = new URL(active.URI);
|
|
2036
|
-
if (!loopback(endpoint.hostname)) continue;
|
|
2037
|
-
const machines = await runProcess({
|
|
2038
|
-
executable,
|
|
2039
|
-
args: ["machine", "list", "--format", "json"],
|
|
2040
|
-
cwd: process.cwd(),
|
|
2041
|
-
timeoutMs: 5e3
|
|
2042
|
-
});
|
|
2043
|
-
if (machines.code !== 0 || !JSON.parse(machines.stdout).some(
|
|
2044
|
-
(machine) => machine.Running && machine.Port === Number(endpoint.port)
|
|
2045
|
-
))
|
|
2046
|
-
continue;
|
|
2047
|
-
}
|
|
2048
|
-
} else {
|
|
2049
|
-
const context = process.env.DOCKER_HOST ?? (await runProcess({
|
|
2050
|
-
executable,
|
|
2051
|
-
args: ["context", "inspect", "--format", "{{.Endpoints.docker.Host}}"],
|
|
2052
|
-
cwd: process.cwd(),
|
|
2053
|
-
timeoutMs: 5e3
|
|
2054
|
-
})).stdout.trim();
|
|
2055
|
-
if (!/^(unix|npipe):\/\//.test(context)) continue;
|
|
2056
|
-
}
|
|
2057
|
-
const list = await runProcess({ executable, args: ["ps", "-q"], cwd: process.cwd(), timeoutMs: 5e3 });
|
|
2058
|
-
const ids = list.stdout.trim().split(/\s+/).filter((id) => /^[a-f0-9]{12,64}$/.test(id));
|
|
2059
|
-
if (list.code !== 0 || !ids.length) continue;
|
|
2060
|
-
const names = await runProcess({
|
|
2061
|
-
executable,
|
|
2062
|
-
args: ["inspect", "--format", "{{.Config.Hostname}}", ...ids],
|
|
2063
|
-
cwd: process.cwd(),
|
|
2064
|
-
timeoutMs: 5e3
|
|
2065
|
-
});
|
|
2066
|
-
if (names.code === 0 && names.stdout.trim().split(/\s+/).some((name) => name.toLowerCase() === host))
|
|
2067
|
-
return true;
|
|
2068
|
-
} catch {
|
|
2069
|
-
}
|
|
2070
|
-
}
|
|
2071
|
-
return false;
|
|
2072
|
-
}
|
|
2073
|
-
|
|
2074
|
-
// packages/core/src/partial-import.ts
|
|
2075
|
-
import path10 from "node:path";
|
|
2076
|
-
import { cp as cp2, mkdir as mkdir3, rename, rm as rm4 } from "node:fs/promises";
|
|
2077
|
-
|
|
2078
|
-
// packages/core/src/sync.ts
|
|
2079
|
-
import path8 from "node:path";
|
|
2080
|
-
import { lstat as lstat2, mkdir as mkdir2, readdir, realpath as realpath3, open as open3, cp, chmod as chmod2 } from "node:fs/promises";
|
|
2081
|
-
|
|
2082
|
-
// packages/core/src/deployment-control.ts
|
|
2083
|
-
import path7 from "node:path";
|
|
2084
|
-
import { hostname as hostname2 } from "node:os";
|
|
2085
|
-
import { rm as rm3 } from "node:fs/promises";
|
|
2086
|
-
function coordination(env) {
|
|
2087
|
-
return {
|
|
2088
|
-
backend: "local",
|
|
2089
|
-
scope: "managed-home-schema",
|
|
2090
|
-
// Bind plans to the history store. Moving a plan to a fresh home is not migration recovery.
|
|
2091
|
-
storeDigest: hash(canonical({ home: managedHome(), ...env.databaseIdentity, schema: env.parsingSchema }))
|
|
2092
|
-
};
|
|
2093
|
-
}
|
|
2094
|
-
var ownerSchema = external_exports.strictObject({
|
|
2095
|
-
runId: external_exports.string(),
|
|
2096
|
-
pid: external_exports.number().int().positive(),
|
|
2097
|
-
hostname: external_exports.string(),
|
|
2098
|
-
phase: external_exports.enum(["preparing", "writing"]),
|
|
2099
|
-
createdAt: external_exports.string()
|
|
2100
|
-
});
|
|
2101
|
-
var historySchema = external_exports.array(
|
|
2102
|
-
external_exports.strictObject({
|
|
2103
|
-
version: external_exports.string(),
|
|
2104
|
-
checksum: external_exports.string().regex(/^[a-f0-9]{64}$/),
|
|
2105
|
-
status: external_exports.enum(["started", "succeeded"]),
|
|
2106
|
-
run_id: external_exports.string()
|
|
2107
|
-
})
|
|
2108
|
-
);
|
|
2109
|
-
var LocalDeploymentControl = class {
|
|
2110
|
-
directory;
|
|
2111
|
-
constructor(env) {
|
|
2112
|
-
const key = hash(canonical({ ...env.databaseIdentity, schema: env.parsingSchema }));
|
|
2113
|
-
this.directory = path7.join(managedHome(), "deployment-control", key);
|
|
2114
|
-
}
|
|
2115
|
-
file(name) {
|
|
2116
|
-
return path7.join(this.directory, name);
|
|
2117
|
-
}
|
|
2118
|
-
async history() {
|
|
2119
|
-
const file = this.file("history.json");
|
|
2120
|
-
return await exists(file) ? parse(historySchema, await readJson(file)) : [];
|
|
2121
|
-
}
|
|
2122
|
-
async owner() {
|
|
2123
|
-
const file = this.file("active.json");
|
|
2124
|
-
try {
|
|
2125
|
-
return parse(ownerSchema, await readJson(file));
|
|
2126
|
-
} catch (error) {
|
|
2127
|
-
if (error.code === "ENOENT") return void 0;
|
|
2128
|
-
throw error;
|
|
2129
|
-
}
|
|
2130
|
-
}
|
|
2131
|
-
async acquire(runId) {
|
|
2132
|
-
await withLock(this.file("control.lock"), async () => {
|
|
2133
|
-
const owner = await this.owner();
|
|
2134
|
-
if (owner) {
|
|
2135
|
-
let dead = false;
|
|
2136
|
-
if (owner.hostname === hostname2()) {
|
|
2137
|
-
try {
|
|
2138
|
-
process.kill(owner.pid, 0);
|
|
2139
|
-
} catch (e) {
|
|
2140
|
-
dead = e.code === "ESRCH";
|
|
2141
|
-
}
|
|
2142
|
-
}
|
|
2143
|
-
if (!dead || owner.phase === "writing")
|
|
2144
|
-
throw new Fault(
|
|
2145
|
-
"TARGET_LOCKED",
|
|
2146
|
-
"A runner owns this schema or an interrupted write needs reconciliation. Preserve its control state.",
|
|
2147
|
-
5,
|
|
2148
|
-
"conflict"
|
|
2149
|
-
);
|
|
2150
|
-
}
|
|
2151
|
-
await writeJson(this.file("active.json"), {
|
|
2152
|
-
runId,
|
|
2153
|
-
pid: process.pid,
|
|
2154
|
-
hostname: hostname2(),
|
|
2155
|
-
phase: "preparing",
|
|
2156
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2157
|
-
});
|
|
2158
|
-
});
|
|
2159
|
-
}
|
|
2160
|
-
async assertOwner(runId) {
|
|
2161
|
-
const owner = await this.owner();
|
|
2162
|
-
if (owner?.runId !== runId || owner.pid !== process.pid || owner.hostname !== hostname2())
|
|
2163
|
-
throw new Fault(
|
|
2164
|
-
"LEASE_LOST",
|
|
2165
|
-
"Local deployment ownership is no longer confirmed.",
|
|
2166
|
-
6,
|
|
2167
|
-
"outcome_unknown"
|
|
2168
|
-
);
|
|
2169
|
-
return owner;
|
|
2170
|
-
}
|
|
2171
|
-
async markWriting(runId) {
|
|
2172
|
-
await withLock(this.file("control.lock"), async () => {
|
|
2173
|
-
await writeJson(this.file("active.json"), { ...await this.assertOwner(runId), phase: "writing" });
|
|
2174
|
-
});
|
|
2175
|
-
}
|
|
2176
|
-
async migration(runId, version, checksum, status) {
|
|
2177
|
-
await withLock(this.file("control.lock"), async () => {
|
|
2178
|
-
await this.assertOwner(runId);
|
|
2179
|
-
const history = await this.history(), previous = history.find((row) => row.version === version);
|
|
2180
|
-
if (status === "started" ? Boolean(previous) : !previous || previous.run_id !== runId || previous.checksum !== checksum || previous.status !== "started")
|
|
2181
|
-
throw new Fault(
|
|
2182
|
-
"MIGRATION_HISTORY_CONFLICT",
|
|
2183
|
-
"Migration history requires reconciliation; it cannot be replayed or overwritten.",
|
|
2184
|
-
5
|
|
2185
|
-
);
|
|
2186
|
-
const next = history.filter((row) => row.version !== version);
|
|
2187
|
-
next.push({ version, checksum, status, run_id: runId });
|
|
2188
|
-
await writeJson(
|
|
2189
|
-
this.file("history.json"),
|
|
2190
|
-
next.sort((a, b2) => a.version.localeCompare(b2.version))
|
|
2191
|
-
);
|
|
2192
|
-
});
|
|
2193
|
-
}
|
|
2194
|
-
async release(runId) {
|
|
2195
|
-
await withLock(this.file("control.lock"), async () => {
|
|
2196
|
-
await this.assertOwner(runId);
|
|
2197
|
-
await rm3(this.file("active.json"));
|
|
2198
|
-
});
|
|
2199
|
-
}
|
|
2200
|
-
/** Release only the reconciled run after its worker has stopped. Keep history. */
|
|
2201
|
-
async claimReconciled(runId) {
|
|
2202
|
-
await withLock(this.file("control.lock"), async () => {
|
|
2203
|
-
const owner = await this.owner();
|
|
2204
|
-
if (!owner) {
|
|
2205
|
-
await writeJson(this.file("active.json"), {
|
|
2206
|
-
runId,
|
|
2207
|
-
pid: process.pid,
|
|
2208
|
-
hostname: hostname2(),
|
|
2209
|
-
phase: "preparing",
|
|
2210
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2211
|
-
});
|
|
2212
|
-
return;
|
|
2213
|
-
}
|
|
2214
|
-
if (owner.runId !== runId || owner.hostname !== hostname2())
|
|
2215
|
-
throw new Fault(
|
|
2216
|
-
"TARGET_LOCKED",
|
|
2217
|
-
"Another runner owns this target; reconciliation cannot clear its ownership.",
|
|
2218
|
-
5
|
|
2219
|
-
);
|
|
2220
|
-
if (owner.pid !== process.pid) {
|
|
2221
|
-
let dead = false;
|
|
2222
|
-
try {
|
|
2223
|
-
process.kill(owner.pid, 0);
|
|
2224
|
-
} catch (error) {
|
|
2225
|
-
dead = error.code === "ESRCH";
|
|
2226
|
-
}
|
|
2227
|
-
if (!dead)
|
|
2228
|
-
throw new Fault(
|
|
2229
|
-
"TARGET_LOCKED",
|
|
2230
|
-
"The import worker is still alive; wait for its terminal result.",
|
|
2231
|
-
5
|
|
2232
|
-
);
|
|
2233
|
-
}
|
|
2234
|
-
await writeJson(this.file("active.json"), { ...owner, pid: process.pid, phase: "preparing" });
|
|
2235
|
-
});
|
|
2236
|
-
}
|
|
2237
|
-
};
|
|
2238
|
-
|
|
2239
|
-
// plugins/metadata.json
|
|
2240
|
-
var metadata_default = {
|
|
2241
|
-
name: "apexrest-apex",
|
|
2242
|
-
version: "2.1.0",
|
|
2243
|
-
description: "Develop, deploy and test Oracle APEX applications from Codex or Claude Code.",
|
|
2244
|
-
author: {
|
|
2245
|
-
name: "APEXREST",
|
|
2246
|
-
url: "https://apexrest-dev.github.io/apexrest/"
|
|
2247
|
-
},
|
|
2248
|
-
license: "Apache-2.0",
|
|
2249
|
-
interface: {
|
|
2250
|
-
displayName: "APEXREST for Codex and Claude Code",
|
|
2251
|
-
shortDescription: "Oracle APEX development workflows",
|
|
2252
|
-
longDescription: "Oracle APEX development, controlled deployment and testing directly in your current Codex or Claude Code session.",
|
|
2253
|
-
developerName: "APEXREST",
|
|
2254
|
-
websiteURL: "https://apexrest-dev.github.io/apexrest/",
|
|
2255
|
-
composerIcon: "./assets/apexrest-icon.svg",
|
|
2256
|
-
logo: "./assets/apexrest-logo.svg",
|
|
2257
|
-
logoDark: "./assets/apexrest-logo.svg",
|
|
2258
|
-
category: "Productivity",
|
|
2259
|
-
capabilities: ["Read", "Write"],
|
|
2260
|
-
defaultPrompt: [
|
|
2261
|
-
"Use $apexrest-work to build or change my Oracle APEX application in this session.",
|
|
2262
|
-
"Use $apexrest-setup to check my tools and connection references.",
|
|
2263
|
-
"Use $apexrest-safety to explain what blocked my APEX deployment or test."
|
|
2264
|
-
]
|
|
2265
|
-
}
|
|
2266
|
-
};
|
|
2267
|
-
|
|
2268
|
-
// packages/core/src/version.ts
|
|
2269
|
-
var VERSION = metadata_default.version;
|
|
2270
|
-
|
|
2271
|
-
// packages/core/src/sync.ts
|
|
2272
|
-
var digest = external_exports.string().regex(/^[a-f0-9]{64}$/);
|
|
2273
|
-
var snapshotSchema = external_exports.strictObject({
|
|
2274
|
-
directory: relativePath,
|
|
2275
|
-
files: external_exports.record(relativePath, digest),
|
|
2276
|
-
digest
|
|
2277
|
-
});
|
|
2278
|
-
var serverMetadataSchema = external_exports.strictObject({
|
|
2279
|
-
lastUpdatedOn: external_exports.string().nullable(),
|
|
2280
|
-
lastUpdatedBy: external_exports.string().nullable()
|
|
2281
|
-
});
|
|
2282
|
-
var syncStateSchema = external_exports.strictObject({
|
|
2283
|
-
schemaVersion: external_exports.literal(1),
|
|
2284
|
-
syncId: external_exports.uuid(),
|
|
2285
|
-
revision: external_exports.number().int().nonnegative(),
|
|
2286
|
-
projectRoot: external_exports.string(),
|
|
2287
|
-
projectId: external_exports.string(),
|
|
2288
|
-
environment: external_exports.string(),
|
|
2289
|
-
targetDigest: digest,
|
|
2290
|
-
target: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
2291
|
-
sourceDir: relativePath,
|
|
2292
|
-
toolchainDigest: digest,
|
|
2293
|
-
runtimeVersion: external_exports.string(),
|
|
2294
|
-
compilerVersion: external_exports.string().min(1),
|
|
2295
|
-
exportedAt: external_exports.iso.datetime(),
|
|
2296
|
-
baseline: snapshotSchema,
|
|
2297
|
-
backup: external_exports.strictObject({ backupId: external_exports.uuid(), checksum: digest }),
|
|
2298
|
-
observedMetadata: serverMetadataSchema,
|
|
2299
|
-
lastSuccessfulImport: external_exports.strictObject({
|
|
2300
|
-
at: external_exports.iso.datetime(),
|
|
2301
|
-
runId: external_exports.uuid(),
|
|
2302
|
-
snapshot: snapshotSchema,
|
|
2303
|
-
verifiedFiles: external_exports.array(relativePath).optional()
|
|
2304
|
-
}).nullable(),
|
|
2305
|
-
recoveryCheckpoint: external_exports.strictObject({ at: external_exports.iso.datetime(), runId: external_exports.uuid(), snapshot: snapshotSchema }).nullable().optional(),
|
|
2306
|
-
status: external_exports.enum(["ready", "importing", "verification_failed", "outcome_unknown", "invalidated"]),
|
|
2307
|
-
importingRunId: external_exports.uuid().nullable()
|
|
2308
|
-
});
|
|
2309
|
-
async function syncPath(ctx, relative) {
|
|
2310
|
-
const file = await contained(ctx.root, relative);
|
|
2311
|
-
let probe = ctx.root;
|
|
2312
|
-
for (const part of path8.relative(ctx.root, file).split(path8.sep).filter(Boolean)) {
|
|
2313
|
-
probe = path8.join(probe, part);
|
|
2314
|
-
if (await exists(probe)) {
|
|
2315
|
-
if ((await lstat2(probe)).isSymbolicLink())
|
|
2316
|
-
throw new Fault("SYNC_PATH_UNSAFE", "Working-copy storage rejects symlinks.", 5);
|
|
2317
|
-
}
|
|
2318
|
-
}
|
|
2319
|
-
return file;
|
|
2320
|
-
}
|
|
2321
|
-
async function privateCopy(source, destination) {
|
|
2322
|
-
await cp(source, destination, { recursive: true });
|
|
2323
|
-
async function secure(directory) {
|
|
2324
|
-
await chmod2(directory, 448);
|
|
2325
|
-
for (const entry of await readdir(directory, { withFileTypes: true })) {
|
|
2326
|
-
if (entry.isSymbolicLink()) throw new Fault("SYNC_PATH_UNSAFE", "Private copies reject symlinks.", 5);
|
|
2327
|
-
const file = path8.join(directory, entry.name);
|
|
2328
|
-
if (entry.isDirectory()) await secure(file);
|
|
2329
|
-
else if (entry.isFile()) await chmod2(file, 384);
|
|
2330
|
-
else throw new Fault("SYNC_PATH_UNSAFE", "Private copies accept regular files only.", 5);
|
|
2331
|
-
}
|
|
2332
|
-
}
|
|
2333
|
-
await secure(destination);
|
|
2334
|
-
}
|
|
2335
|
-
async function checkSnapshot(ctx, snapshot) {
|
|
2336
|
-
if (!snapshot.directory.startsWith(".apexrest/"))
|
|
2337
|
-
throw new Fault("SYNC_ARTIFACT_INVALID", "Snapshot must be private project storage.", 5);
|
|
2338
|
-
const actual = await inventory(await syncPath(ctx, snapshot.directory));
|
|
2339
|
-
if (!Object.keys(actual).length || canonical(actual) !== canonical(snapshot.files) || hash(canonical(actual)) !== snapshot.digest)
|
|
2340
|
-
throw new Fault("SYNC_ARTIFACT_INVALID", "Working-copy snapshot checksum verification failed.", 5);
|
|
2341
|
-
return actual;
|
|
2342
|
-
}
|
|
2343
|
-
async function checkSyncBackup(ctx, backup, envDigest, environmentName) {
|
|
2344
|
-
const directory = await syncPath(ctx, ".apexrest/backups/" + backup.backupId);
|
|
2345
|
-
const metadata = await readJson(
|
|
2346
|
-
await syncPath(ctx, ".apexrest/backups/" + backup.backupId + "/backup.json")
|
|
2347
|
-
);
|
|
2348
|
-
const files = await inventory(await syncPath(ctx, ".apexrest/backups/" + backup.backupId + "/application"));
|
|
2349
|
-
if (metadata.schemaVersion !== 1 || metadata.environment !== environmentName || metadata.backupId !== backup.backupId || metadata.targetDigest !== envDigest || metadata.digest !== backup.checksum || hash(canonical(files)) !== backup.checksum || canonical(metadata.files) !== canonical(files) || !Object.keys(files).length)
|
|
2350
|
-
throw new Fault("BACKUP_INVALID", "Initial source backup checksum or target verification failed.", 5);
|
|
2351
|
-
}
|
|
2352
|
-
function checkpoint(state) {
|
|
2353
|
-
return state.recoveryCheckpoint?.snapshot ?? state.lastSuccessfulImport?.snapshot ?? state.baseline;
|
|
2354
|
-
}
|
|
2355
|
-
var SyncStore = class {
|
|
2356
|
-
constructor(ctx, env, name) {
|
|
2357
|
-
this.ctx = ctx;
|
|
2358
|
-
this.env = env;
|
|
2359
|
-
this.name = name;
|
|
2360
|
-
}
|
|
2361
|
-
ctx;
|
|
2362
|
-
env;
|
|
2363
|
-
name;
|
|
2364
|
-
async file(key = targetDigest(this.env)) {
|
|
2365
|
-
return syncPath(this.ctx, ".apexrest/sync/" + key + "/state.json");
|
|
2366
|
-
}
|
|
2367
|
-
async lock(action) {
|
|
2368
|
-
return withLock(await syncPath(this.ctx, ".apexrest/sync/state.lock"), action);
|
|
2369
|
-
}
|
|
2370
|
-
/** Scan environment records so a changed target cannot silently become a legacy project. */
|
|
2371
|
-
async read(allowMappingChange = false) {
|
|
2372
|
-
const base = await syncPath(this.ctx, ".apexrest/sync");
|
|
2373
|
-
if (!await exists(base)) return null;
|
|
2374
|
-
const matches = [];
|
|
2375
|
-
for (const entry of await readdir(base, { withFileTypes: true })) {
|
|
2376
|
-
if (entry.isSymbolicLink()) throw new Fault("SYNC_PATH_UNSAFE", "Sync storage contains a symlink.", 5);
|
|
2377
|
-
if (!entry.isDirectory() || !/^[a-f0-9]{64}$/.test(entry.name)) continue;
|
|
2378
|
-
const file = await this.file(entry.name);
|
|
2379
|
-
if (!await exists(file)) {
|
|
2380
|
-
if (await exists(await syncPath(this.ctx, ".apexrest/sync/" + entry.name + "/journal.jsonl")))
|
|
2381
|
-
throw new Fault(
|
|
2382
|
-
"SYNC_STATE_INVALID",
|
|
2383
|
-
"A durable sync journal exists but its state is missing. Recover it explicitly; no export fallback.",
|
|
2384
|
-
5
|
|
2385
|
-
);
|
|
2386
|
-
continue;
|
|
2387
|
-
}
|
|
2388
|
-
let state2;
|
|
2389
|
-
try {
|
|
2390
|
-
state2 = syncStateSchema.parse(await readJson(file));
|
|
2391
|
-
} catch {
|
|
2392
|
-
throw new Fault(
|
|
2393
|
-
"SYNC_STATE_INVALID",
|
|
2394
|
-
"Corrupt working-copy state requires explicit recovery; no export fallback.",
|
|
2395
|
-
5
|
|
2396
|
-
);
|
|
2397
|
-
}
|
|
2398
|
-
if (state2.targetDigest !== entry.name)
|
|
2399
|
-
throw new Fault("SYNC_STATE_INVALID", "Sync record storage key differs from its target.", 5);
|
|
2400
|
-
if (state2.targetDigest === targetDigest(this.env) && state2.environment !== this.name && state2.status !== "invalidated")
|
|
2401
|
-
throw new Fault(
|
|
2402
|
-
"SYNC_MAPPING_CHANGED",
|
|
2403
|
-
"This target is bound to another environment. Explicitly invalidate the previous mapping first.",
|
|
2404
|
-
5
|
|
2405
|
-
);
|
|
2406
|
-
if (state2.environment === this.name && (state2.status !== "invalidated" || state2.targetDigest === targetDigest(this.env)))
|
|
2407
|
-
matches.push(state2);
|
|
2408
|
-
}
|
|
2409
|
-
const active = matches.filter((s3) => s3.status !== "invalidated");
|
|
2410
|
-
if (active.length > 1)
|
|
2411
|
-
throw new Fault("SYNC_STATE_INVALID", "Multiple active records require reconciliation.", 5);
|
|
2412
|
-
const state = active[0] ?? matches[0] ?? null;
|
|
2413
|
-
if (state && state.status !== "invalidated" && !allowMappingChange) await this.checkMapping(state);
|
|
2414
|
-
return state;
|
|
2415
|
-
}
|
|
2416
|
-
async checkMapping(state) {
|
|
2417
|
-
const { readFile: readFile6 } = await import("node:fs/promises");
|
|
2418
|
-
if (state.projectRoot !== await realpath3(this.ctx.root) || state.projectId !== this.ctx.config.projectId || state.environment !== this.name || state.targetDigest !== targetDigest(this.env) || state.sourceDir !== this.ctx.config.application.sourceDir || state.runtimeVersion !== VERSION || state.toolchainDigest !== hash(await readFile6(await contained(this.ctx.root, this.ctx.config.toolchain.lockFile))) || await isProductionTarget(this.env))
|
|
2419
|
-
throw new Fault(
|
|
2420
|
-
"SYNC_MAPPING_CHANGED",
|
|
2421
|
-
"Project, target, source directory or toolchain changed. Explicit refresh or invalidate is required.",
|
|
2422
|
-
5
|
|
2423
|
-
);
|
|
2424
|
-
}
|
|
2425
|
-
async validate(state, ready = true) {
|
|
2426
|
-
await this.checkMapping(state);
|
|
2427
|
-
if (ready && state.status !== "ready")
|
|
2428
|
-
throw new Fault(
|
|
2429
|
-
"SYNC_BLOCKED",
|
|
2430
|
-
`Working copy is ${state.status}. Inspect the existing run and reconcile before writes.`,
|
|
2431
|
-
5
|
|
2432
|
-
);
|
|
2433
|
-
const validRunSnapshot = (reference) => {
|
|
2434
|
-
const base = ".apexrest/deployments/" + reference.runId + "/";
|
|
2435
|
-
if (["snapshot", "server"].some(
|
|
2436
|
-
(kind) => reference.snapshot.directory === base + kind + "/" + state.sourceDir
|
|
2437
|
-
))
|
|
2438
|
-
return true;
|
|
2439
|
-
const relative = reference.snapshot.directory.startsWith(base) ? reference.snapshot.directory.slice(base.length) : "";
|
|
2440
|
-
return /^recovery\/\d{10,17}\/application$/.test(relative);
|
|
2441
|
-
};
|
|
2442
|
-
if (state.baseline.directory !== ".apexrest/sync/" + state.targetDigest + "/baselines/" + state.syncId + "/application" || state.lastSuccessfulImport && !validRunSnapshot(state.lastSuccessfulImport) || state.recoveryCheckpoint && !validRunSnapshot(state.recoveryCheckpoint))
|
|
2443
|
-
throw new Fault(
|
|
2444
|
-
"SYNC_ARTIFACT_INVALID",
|
|
2445
|
-
"Snapshot reference does not match its sync or deployment owner.",
|
|
2446
|
-
5
|
|
2447
|
-
);
|
|
2448
|
-
if (state.status === "ready" && (await new LocalDeploymentControl(this.env).owner())?.phase === "writing")
|
|
2449
|
-
throw new Fault("SYNC_BLOCKED", "A writing owner must complete or be reconciled before reuse.", 5);
|
|
2450
|
-
await checkSnapshot(this.ctx, state.baseline);
|
|
2451
|
-
if (state.lastSuccessfulImport) await checkSnapshot(this.ctx, state.lastSuccessfulImport.snapshot);
|
|
2452
|
-
if (state.recoveryCheckpoint) await checkSnapshot(this.ctx, state.recoveryCheckpoint.snapshot);
|
|
2453
|
-
await checkSyncBackup(this.ctx, state.backup, state.targetDigest, this.name);
|
|
2454
|
-
}
|
|
2455
|
-
async write(state) {
|
|
2456
|
-
const valid = syncStateSchema.parse(state);
|
|
2457
|
-
const file = await this.file(valid.targetDigest);
|
|
2458
|
-
await mkdir2(path8.dirname(file), { recursive: true, mode: 448 });
|
|
2459
|
-
const journalFile = await syncPath(this.ctx, ".apexrest/sync/" + valid.targetDigest + "/journal.jsonl");
|
|
2460
|
-
const journal = await open3(journalFile, "a", 384);
|
|
2461
|
-
try {
|
|
2462
|
-
await journal.writeFile(
|
|
2463
|
-
JSON.stringify({
|
|
2464
|
-
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2465
|
-
syncId: valid.syncId,
|
|
2466
|
-
revision: valid.revision,
|
|
2467
|
-
status: valid.status,
|
|
2468
|
-
importingRunId: valid.importingRunId,
|
|
2469
|
-
baseline: valid.baseline.directory,
|
|
2470
|
-
backupId: valid.backup.backupId,
|
|
2471
|
-
latestApplied: valid.lastSuccessfulImport?.snapshot.directory ?? null
|
|
2472
|
-
}) + "\n"
|
|
2473
|
-
);
|
|
2474
|
-
await journal.sync();
|
|
2475
|
-
} finally {
|
|
2476
|
-
await journal.close();
|
|
2477
|
-
}
|
|
2478
|
-
await writeJson(file, valid);
|
|
2479
|
-
const directory = process.platform !== "win32" ? await open3(path8.dirname(file), "r") : null;
|
|
2480
|
-
try {
|
|
2481
|
-
await directory?.sync();
|
|
2482
|
-
} finally {
|
|
2483
|
-
await directory?.close();
|
|
2484
|
-
}
|
|
2485
|
-
}
|
|
2486
|
-
async status() {
|
|
2487
|
-
const state = await this.read(true);
|
|
2488
|
-
if (!state) return { mode: "full-export", status: "absent", serverFreshness: "not-checked" };
|
|
2489
|
-
let blockedReason = null;
|
|
2490
|
-
try {
|
|
2491
|
-
await this.validate(state, false);
|
|
2492
|
-
} catch (error) {
|
|
2493
|
-
blockedReason = error instanceof Fault ? error.code : "SYNC_ARTIFACT_INVALID";
|
|
2494
|
-
}
|
|
2495
|
-
if ((await new LocalDeploymentControl(this.env).owner())?.phase === "writing")
|
|
2496
|
-
blockedReason = "SYNC_BLOCKED";
|
|
2497
|
-
const source = await syncPath(this.ctx, state.sourceDir);
|
|
2498
|
-
const files = await exists(source) ? await inventory(source) : {};
|
|
2499
|
-
return {
|
|
2500
|
-
mode: state.status === "invalidated" ? "full-export" : "working-copy",
|
|
2501
|
-
syncId: state.syncId,
|
|
2502
|
-
revision: state.revision,
|
|
2503
|
-
status: state.status,
|
|
2504
|
-
exportedAt: state.exportedAt,
|
|
2505
|
-
lastSuccessfulImport: state.lastSuccessfulImport ? {
|
|
2506
|
-
at: state.lastSuccessfulImport.at,
|
|
2507
|
-
runId: state.lastSuccessfulImport.runId,
|
|
2508
|
-
digest: state.lastSuccessfulImport.snapshot.digest,
|
|
2509
|
-
verifiedFiles: state.lastSuccessfulImport.verifiedFiles ?? null
|
|
2510
|
-
} : null,
|
|
2511
|
-
backupId: state.backup.backupId,
|
|
2512
|
-
importingRunId: state.importingRunId,
|
|
2513
|
-
dirty: canonical(files) !== canonical(checkpoint(state).files),
|
|
2514
|
-
blocked: !!blockedReason || !["ready", "invalidated"].includes(state.status),
|
|
2515
|
-
blockedReason,
|
|
2516
|
-
serverFreshness: "not-checked",
|
|
2517
|
-
assumption: "selected-content-conflicts; independent managed homes require external serialization"
|
|
2518
|
-
};
|
|
2519
|
-
}
|
|
2520
|
-
};
|
|
2521
|
-
|
|
2522
|
-
// packages/core/src/apexlang-equivalence.ts
|
|
2523
|
-
import path9 from "node:path";
|
|
2524
|
-
import { readFile as readFile3 } from "node:fs/promises";
|
|
2525
|
-
var APEXLANG_EQUIVALENCE_POLICY = "apex262-selected-source-v1";
|
|
2526
|
-
var formattingRule = "structural-whitespace-and-comments";
|
|
2527
|
-
var defaultRule = "pageItem.selectList.layout.startNewRow:true-default";
|
|
2528
|
-
var pageDefaultRule = "page.security.pageAccessProtection:argumentsMustHaveChecksum-default";
|
|
2529
|
-
var regionDefaultRule = "region.layout.startNewRow:true-default";
|
|
2530
|
-
var chartDefaultRule = "region.chart.type:bar-default";
|
|
2531
|
-
var cursorDefaultRule = "page.navigation.cursorFocus:doNotFocusCursor-default";
|
|
2532
|
-
var autocompleteDefaultRule = "page.security.formAutoComplete:false-default";
|
|
2533
|
-
var paginationDefaultRule = "region.classicReport.pagination.type:nextAndPreviousLinks-default";
|
|
2534
|
-
var orderRule = "explicit-unique-region-and-chart-component-order";
|
|
2535
|
-
var columnOrderRule = "explicit-unique-report-column-order";
|
|
2536
|
-
var memberOrderRule = "unique-property-and-group-order";
|
|
2537
|
-
var quotedLiteralRule = "single-line-literal-quoting";
|
|
2538
|
-
var invokeDefaultRule = "invokeApi.parameter.direction:in,dataType:varchar2,ignoreOutput:false-default";
|
|
2539
|
-
var invokeCaseRule = "invokeApi.invoke.identifier-case";
|
|
2540
|
-
var eventDefaultRule = "dynamicAction.when.items.event:change-default";
|
|
2541
|
-
var componentOrderRule = "key-ordered-page-components";
|
|
2542
|
-
var limit = 8 * 1024 * 1024;
|
|
2543
|
-
function readStructure(source) {
|
|
2544
|
-
if (Buffer.byteLength(source) > limit) throw new Error("Source exceeds the comparison limit.");
|
|
2545
|
-
const lines = source.match(/[^\r\n]*(?:\r\n|\r|\n|$)/g)?.filter(Boolean) ?? [];
|
|
2546
|
-
const roots = [];
|
|
2547
|
-
const stack = [];
|
|
2548
|
-
const append = (node) => (stack.at(-1)?.children ?? roots).push(node);
|
|
2549
|
-
for (let index = 0; index < lines.length; index++) {
|
|
2550
|
-
const raw = lines[index];
|
|
2551
|
-
const line = raw.replace(/[\r\n]+$/, "");
|
|
2552
|
-
const trimmed = line.trim();
|
|
2553
|
-
if (!trimmed || trimmed.startsWith("//")) continue;
|
|
2554
|
-
if (trimmed.startsWith("/*")) {
|
|
2555
|
-
let comment = trimmed;
|
|
2556
|
-
while (!comment.includes("*/") && ++index < lines.length) comment += lines[index];
|
|
2557
|
-
const end = comment.indexOf("*/");
|
|
2558
|
-
if (end < 0 || comment.slice(end + 2).trim()) throw new Error("Unsupported comment boundary.");
|
|
2559
|
-
continue;
|
|
2560
|
-
}
|
|
2561
|
-
if (trimmed.startsWith("```")) {
|
|
2562
|
-
if (!/^```[A-Za-z0-9_-]*[ \t]*$/.test(trimmed)) throw new Error("Unsupported fenced literal.");
|
|
2563
|
-
let literal = line.replace(/^[ \t]*/, "") + raw.slice(line.length);
|
|
2564
|
-
let closed = false;
|
|
2565
|
-
while (++index < lines.length) {
|
|
2566
|
-
const next = lines[index];
|
|
2567
|
-
if (/^[ \t]*```[ \t]*(?:\r\n|\r|\n)?$/.test(next)) {
|
|
2568
|
-
literal += next.replace(/^[ \t]*/, "");
|
|
2569
|
-
closed = true;
|
|
2570
|
-
break;
|
|
2571
|
-
}
|
|
2572
|
-
literal += next;
|
|
2573
|
-
}
|
|
2574
|
-
if (!closed) throw new Error("Unclosed fenced literal.");
|
|
2575
|
-
const siblings = stack.at(-1)?.children ?? roots;
|
|
2576
|
-
const owner = siblings.at(-1);
|
|
2577
|
-
if (owner?.kind === "property" && owner.value === "" && owner.literal === void 0) {
|
|
2578
|
-
owner.literal = literal;
|
|
2579
|
-
owner.indent = /^[ \t]*/.exec(line)[0];
|
|
2580
|
-
} else append({ kind: "literal", value: literal });
|
|
2581
|
-
continue;
|
|
2582
|
-
}
|
|
2583
|
-
const property = /^[ \t]*([A-Za-z][\w]*):[ \t]*(.*)$/.exec(line);
|
|
2584
|
-
if (property) {
|
|
2585
|
-
const value = property[2];
|
|
2586
|
-
if (value.includes("```") || value.startsWith('"""') || value.startsWith("'''"))
|
|
2587
|
-
throw new Error("Unsupported inline or multiline literal.");
|
|
2588
|
-
if (value === "{") {
|
|
2589
|
-
const node = { kind: "map", name: property[1], key: "", children: [] };
|
|
2590
|
-
append(node);
|
|
2591
|
-
stack.push(node);
|
|
2592
|
-
} else if (value === "[") {
|
|
2593
|
-
const items = [];
|
|
2594
|
-
let closed = false;
|
|
2595
|
-
while (++index < lines.length) {
|
|
2596
|
-
const entry = lines[index].trim();
|
|
2597
|
-
if (entry === "]") {
|
|
2598
|
-
closed = true;
|
|
2599
|
-
break;
|
|
2600
|
-
}
|
|
2601
|
-
if (!entry || /[[\]{}()]$|^```/.test(entry)) throw new Error("Unsupported list entry.");
|
|
2602
|
-
items.push(entry);
|
|
2603
|
-
}
|
|
2604
|
-
if (!closed) throw new Error("Unclosed list.");
|
|
2605
|
-
append({ kind: "property", name: property[1], value: "[" + items.join("\n") + "]" });
|
|
2606
|
-
} else append({ kind: "property", name: property[1], value });
|
|
2607
|
-
continue;
|
|
2608
|
-
}
|
|
2609
|
-
const component = /^([A-Za-z][\w]*)(?:[ \t]+(.*?))?[ \t]*\([ \t]*$/.exec(trimmed);
|
|
2610
|
-
if (component) {
|
|
2611
|
-
const node = { kind: "component", name: component[1], key: component[2] ?? "", children: [] };
|
|
2612
|
-
append(node);
|
|
2613
|
-
stack.push(node);
|
|
2614
|
-
continue;
|
|
2615
|
-
}
|
|
2616
|
-
const group = /^([A-Za-z][\w]*)[ \t]*\{[ \t]*$/.exec(trimmed);
|
|
2617
|
-
if (group) {
|
|
2618
|
-
const node = { kind: "group", name: group[1], key: "", children: [] };
|
|
2619
|
-
append(node);
|
|
2620
|
-
stack.push(node);
|
|
2621
|
-
continue;
|
|
2622
|
-
}
|
|
2623
|
-
if (trimmed === ")" || trimmed === "}") {
|
|
2624
|
-
const node = stack.pop();
|
|
2625
|
-
if (!node || trimmed === ")" !== (node.kind === "component"))
|
|
2626
|
-
throw new Error("Unbalanced structural boundary.");
|
|
2627
|
-
continue;
|
|
2628
|
-
}
|
|
2629
|
-
throw new Error("Unsupported source form.");
|
|
2630
|
-
}
|
|
2631
|
-
if (stack.length) throw new Error("Unclosed structural boundary.");
|
|
2632
|
-
return roots;
|
|
2633
|
-
}
|
|
2634
|
-
function removeQualifiedDefault(nodes, parent) {
|
|
2635
|
-
return nodes.map((node) => {
|
|
2636
|
-
if (!("children" in node)) return node;
|
|
2637
|
-
let children = node.children;
|
|
2638
|
-
if (node.kind === "component" && node.name === "pageItem" && parent?.kind === "component" && parent.name === "page") {
|
|
2639
|
-
const types = children.filter((child) => child.kind === "property" && child.name === "type");
|
|
2640
|
-
const layouts = children.filter((child) => child.kind === "group" && child.name === "layout");
|
|
2641
|
-
if (types.length === 1 && types[0].kind === "property" && types[0].value === "selectList" && layouts.length === 1) {
|
|
2642
|
-
children = children.map((child) => {
|
|
2643
|
-
if (child.kind !== "group" || child.name !== "layout") return child;
|
|
2644
|
-
const rows = child.children.filter(
|
|
2645
|
-
(entry) => entry.kind === "property" && entry.name === "startNewRow"
|
|
2646
|
-
);
|
|
2647
|
-
const layouts2 = child.children.filter(
|
|
2648
|
-
(entry) => entry.kind === "property" && entry.name === "startNewLayout"
|
|
2649
|
-
);
|
|
2650
|
-
if (rows.length !== 1 || rows[0].kind !== "property" || rows[0].value !== "true" || layouts2.length > 1 || layouts2.length === 1 && (layouts2[0].kind !== "property" || layouts2[0].value !== "false"))
|
|
2651
|
-
return child;
|
|
2652
|
-
return { ...child, children: child.children.filter((entry) => entry !== rows[0]) };
|
|
2653
|
-
});
|
|
2654
|
-
}
|
|
2655
|
-
}
|
|
2656
|
-
return { ...node, children: removeQualifiedDefault(children, node) };
|
|
2657
|
-
});
|
|
2658
|
-
}
|
|
2659
|
-
function normalizeExport(nodes, rules, parent) {
|
|
2660
|
-
const result = nodes.map((node) => {
|
|
2661
|
-
if (!("children" in node)) return node;
|
|
2662
|
-
let children = normalizeExport(node.children, rules, node);
|
|
2663
|
-
const property = (name) => children.filter((entry) => entry.kind === "property" && entry.name === name);
|
|
2664
|
-
const omit = (name, value, rule) => {
|
|
2665
|
-
const matches = property(name);
|
|
2666
|
-
if (matches.length === 1 && matches[0].kind === "property" && matches[0].value === value) {
|
|
2667
|
-
children = children.filter((entry) => entry !== matches[0]);
|
|
2668
|
-
rules.add(rule);
|
|
2669
|
-
}
|
|
2670
|
-
};
|
|
2671
|
-
if (node.kind === "group" && node.name === "security" && parent?.name === "page") {
|
|
2672
|
-
omit("pageAccessProtection", "argumentsMustHaveChecksum", pageDefaultRule);
|
|
2673
|
-
omit("formAutoComplete", "false", autocompleteDefaultRule);
|
|
2674
|
-
}
|
|
2675
|
-
if (node.kind === "group" && node.name === "navigation" && parent?.name === "page")
|
|
2676
|
-
omit("cursorFocus", "doNotFocusCursor", cursorDefaultRule);
|
|
2677
|
-
if (node.kind === "group" && node.name === "pagination" && parent?.kind === "component" && parent.name === "region" && parent.children.some(
|
|
2678
|
-
(entry) => entry.kind === "property" && entry.name === "type" && entry.value === "classicReport"
|
|
2679
|
-
))
|
|
2680
|
-
omit("type", "nextAndPreviousLinks", paginationDefaultRule);
|
|
2681
|
-
if (node.kind === "group" && node.name === "layout" && parent?.kind === "component" && parent.name === "region") {
|
|
2682
|
-
const starts = property("startNewLayout");
|
|
2683
|
-
if (!starts.length || starts.length === 1 && starts[0].kind === "property" && starts[0].value === "false")
|
|
2684
|
-
omit("startNewRow", "true", regionDefaultRule);
|
|
2685
|
-
}
|
|
2686
|
-
if (node.kind === "group" && node.name === "chart" && parent?.kind === "component" && parent.name === "region" && parent.children.some(
|
|
2687
|
-
(entry) => entry.kind === "property" && entry.name === "type" && entry.value === "chart"
|
|
2688
|
-
))
|
|
2689
|
-
omit("type", "bar", chartDefaultRule);
|
|
2690
|
-
const identities = node.children.filter((entry) => entry.kind !== "literal").map(
|
|
2691
|
-
(entry) => entry.kind + ":" + ("name" in entry ? entry.name : "") + ":" + ("key" in entry ? entry.key : "")
|
|
2692
|
-
);
|
|
2693
|
-
if (new Set(identities).size !== identities.length) throw new Error("Duplicate structural identity.");
|
|
2694
|
-
const sortable = children.filter(
|
|
2695
|
-
(entry) => entry.kind === "component" && (node.name === "page" && entry.name === "region" || node.name === "region" && node.children.some(
|
|
2696
|
-
(child) => child.kind === "property" && child.name === "type" && child.value === "chart"
|
|
2697
|
-
) && ["axis", "series"].includes(entry.name) || node.name === "region" && node.children.some(
|
|
2698
|
-
(child) => child.kind === "property" && child.name === "type" && child.value === "classicReport"
|
|
2699
|
-
) && entry.name === "column")
|
|
2700
|
-
);
|
|
2701
|
-
if (sortable.length > 1) {
|
|
2702
|
-
const sequence = (entry) => {
|
|
2703
|
-
if (!("children" in entry)) return void 0;
|
|
2704
|
-
if (entry.name === "axis") return entry.key === "x" || entry.key === "y" ? entry.key : void 0;
|
|
2705
|
-
const group = entry.children.find(
|
|
2706
|
-
(child) => child.kind === "group" && child.name === (entry.name === "series" ? "execution" : "layout")
|
|
2707
|
-
);
|
|
2708
|
-
const value = group && "children" in group ? group.children.find((child) => child.kind === "property" && child.name === "sequence") : void 0;
|
|
2709
|
-
return value?.kind === "property" && /^\d+$/.test(value.value) ? entry.name + ":" + value.value : void 0;
|
|
2710
|
-
};
|
|
2711
|
-
const sequences = sortable.map(sequence);
|
|
2712
|
-
if (sequences.every(Boolean) && new Set(sequences).size === sequences.length) {
|
|
2713
|
-
const sorted = [...sortable].sort(
|
|
2714
|
-
(left, right) => ("name" in left ? left.name : "").localeCompare("name" in right ? right.name : "") || ("key" in left ? left.key : "").localeCompare("key" in right ? right.key : "")
|
|
2715
|
-
);
|
|
2716
|
-
let index = 0;
|
|
2717
|
-
children = children.map((entry) => sortable.includes(entry) ? sorted[index++] : entry);
|
|
2718
|
-
rules.add(
|
|
2719
|
-
sortable.some((entry) => "name" in entry && entry.name === "column") ? columnOrderRule : orderRule
|
|
2720
|
-
);
|
|
2721
|
-
}
|
|
2722
|
-
}
|
|
2723
|
-
return { ...node, children };
|
|
2724
|
-
});
|
|
2725
|
-
return result.filter(
|
|
2726
|
-
(node) => !("children" in node && !node.children.length && node.kind === "group" && (parent?.name === "page" && ["security", "navigation"].includes(node.name) || parent?.name === "region" && ["chart", "layout", "pagination"].includes(node.name)))
|
|
2727
|
-
);
|
|
2728
|
-
}
|
|
2729
|
-
var identifier = /^[A-Za-z][A-Za-z0-9_$#]*$/;
|
|
2730
|
-
function normalizeForms(nodes, rules, parent) {
|
|
2731
|
-
const result = [];
|
|
2732
|
-
for (const node of nodes) {
|
|
2733
|
-
if (node.kind === "property") {
|
|
2734
|
-
if (node.literal !== void 0) {
|
|
2735
|
-
const lines = node.literal.split(/\r\n|\r|\n/);
|
|
2736
|
-
const content = lines.length === 4 && lines[3] === "" ? lines[1] : void 0;
|
|
2737
|
-
if (content !== void 0 && content.startsWith(node.indent ?? "") && lines[2] === "```") {
|
|
2738
|
-
result.push({
|
|
2739
|
-
kind: "property",
|
|
2740
|
-
name: node.name,
|
|
2741
|
-
value: JSON.stringify(content.slice((node.indent ?? "").length))
|
|
2742
|
-
});
|
|
2743
|
-
rules.add(quotedLiteralRule);
|
|
2744
|
-
continue;
|
|
2745
|
-
}
|
|
2746
|
-
result.push(node);
|
|
2747
|
-
continue;
|
|
2748
|
-
}
|
|
2749
|
-
if (/^".*"$/.test(node.value)) {
|
|
2750
|
-
try {
|
|
2751
|
-
const decoded = JSON.parse(node.value);
|
|
2752
|
-
if (typeof decoded === "string" && JSON.stringify(decoded) !== node.value) {
|
|
2753
|
-
result.push({ ...node, value: JSON.stringify(decoded) });
|
|
2754
|
-
continue;
|
|
2755
|
-
}
|
|
2756
|
-
} catch {
|
|
2757
|
-
}
|
|
2758
|
-
}
|
|
2759
|
-
if (parent?.kind === "group" && parent.name === "invoke" && ["package", "procedureOrFunction"].includes(node.name) && identifier.test(node.value)) {
|
|
2760
|
-
if (node.value !== node.value.toUpperCase()) rules.add(invokeCaseRule);
|
|
2761
|
-
result.push({ ...node, value: node.value.toUpperCase() });
|
|
2762
|
-
continue;
|
|
2763
|
-
}
|
|
2764
|
-
result.push(node);
|
|
2765
|
-
continue;
|
|
2766
|
-
}
|
|
2767
|
-
if (!("children" in node)) {
|
|
2768
|
-
result.push(node);
|
|
2769
|
-
continue;
|
|
2770
|
-
}
|
|
2771
|
-
let children = normalizeForms(node.children, rules, node);
|
|
2772
|
-
const scalar = (name) => {
|
|
2773
|
-
const matches = children.filter((entry) => entry.kind === "property" && entry.name === name);
|
|
2774
|
-
return matches.length === 1 && matches[0].kind === "property" ? matches[0] : void 0;
|
|
2775
|
-
};
|
|
2776
|
-
if (node.kind === "group" && node.name === "parameter" && parent?.kind === "component" && parent.name === "parameter") {
|
|
2777
|
-
for (const [name, value] of [
|
|
2778
|
-
["direction", "in"],
|
|
2779
|
-
["dataType", "varchar2"],
|
|
2780
|
-
["ignoreOutput", "false"]
|
|
2781
|
-
]) {
|
|
2782
|
-
const entry = scalar(name);
|
|
2783
|
-
if (entry?.kind === "property" && entry.value === value) {
|
|
2784
|
-
children = children.filter((child) => child !== entry);
|
|
2785
|
-
rules.add(invokeDefaultRule);
|
|
2786
|
-
}
|
|
2787
|
-
}
|
|
2788
|
-
if (!children.length) {
|
|
2789
|
-
rules.add(invokeDefaultRule);
|
|
2790
|
-
continue;
|
|
2791
|
-
}
|
|
2792
|
-
}
|
|
2793
|
-
if (node.kind === "group" && node.name === "when" && parent?.kind === "component" && parent.name === "dynamicAction") {
|
|
2794
|
-
const event = scalar("event"), selection = scalar("selectionType");
|
|
2795
|
-
if (event?.kind === "property" && event.value === "change" && selection?.kind === "property" && selection.value === "items") {
|
|
2796
|
-
children = children.filter((child) => child !== event);
|
|
2797
|
-
rules.add(eventDefaultRule);
|
|
2798
|
-
}
|
|
2799
|
-
}
|
|
2800
|
-
result.push({ ...node, children });
|
|
2801
|
-
}
|
|
2802
|
-
return result;
|
|
2803
|
-
}
|
|
2804
|
-
var sequencedComponents = {
|
|
2805
|
-
page: {
|
|
2806
|
-
region: ["layout", "sequence"],
|
|
2807
|
-
pageItem: ["layout", "sequence"],
|
|
2808
|
-
button: ["layout", "sequence"],
|
|
2809
|
-
dynamicAction: ["execution", "sequence"],
|
|
2810
|
-
validation: ["execution", "sequence"],
|
|
2811
|
-
process: ["execution", "sequence"],
|
|
2812
|
-
computation: ["execution", "sequence"],
|
|
2813
|
-
branch: ["execution", "sequence"]
|
|
2814
|
-
},
|
|
2815
|
-
process: { parameter: ["advanced", "displaySequence"] },
|
|
2816
|
-
dynamicAction: { action: ["execution", "sequence"] }
|
|
2817
|
-
};
|
|
2818
|
-
var componentKey = (node) => ("name" in node ? node.name : "") + ":" + ("key" in node ? node.key : "");
|
|
2819
|
-
function orderComponents(nodes, rules) {
|
|
2820
|
-
return nodes.map((node) => {
|
|
2821
|
-
if (!("children" in node)) return node;
|
|
2822
|
-
let children = orderComponents(node.children, rules);
|
|
2823
|
-
const allowed = node.kind === "component" ? sequencedComponents[node.name] : void 0;
|
|
2824
|
-
const components = children.filter((child) => child.kind === "component");
|
|
2825
|
-
if (allowed && components.length > 1) {
|
|
2826
|
-
const qualified = components.every((child) => {
|
|
2827
|
-
if (child.kind !== "component" || !allowed[child.name]) return false;
|
|
2828
|
-
const [groupName, propertyName] = allowed[child.name];
|
|
2829
|
-
const group = child.children.find((entry) => entry.kind === "group" && entry.name === groupName);
|
|
2830
|
-
return !!group && "children" in group && group.children.some(
|
|
2831
|
-
(entry) => entry.kind === "property" && entry.name === propertyName && /^\d+$/.test(entry.value)
|
|
2832
|
-
);
|
|
2833
|
-
});
|
|
2834
|
-
const keys = components.map(componentKey);
|
|
2835
|
-
if (qualified && new Set(keys).size === keys.length) {
|
|
2836
|
-
const sorted = [...components].sort(
|
|
2837
|
-
(left, right) => componentKey(left).localeCompare(componentKey(right))
|
|
2838
|
-
);
|
|
2839
|
-
if (sorted.some((child, index2) => child !== components[index2])) rules.add(componentOrderRule);
|
|
2840
|
-
let index = 0;
|
|
2841
|
-
children = children.map((child) => child.kind === "component" ? sorted[index++] : child);
|
|
2842
|
-
}
|
|
2843
|
-
}
|
|
2844
|
-
return { ...node, children };
|
|
2845
|
-
});
|
|
2846
|
-
}
|
|
2847
|
-
function orderMembers(nodes, rules) {
|
|
2848
|
-
return nodes.map((node) => {
|
|
2849
|
-
if (!("children" in node)) return node;
|
|
2850
|
-
let children = orderMembers(node.children, rules);
|
|
2851
|
-
if (!children.some((child) => child.kind === "literal")) {
|
|
2852
|
-
const members = children.filter((child) => child.kind !== "component");
|
|
2853
|
-
const names = members.map((child) => child.kind + ":" + ("name" in child ? child.name : ""));
|
|
2854
|
-
if (new Set(names).size === names.length) {
|
|
2855
|
-
const sorted = [...members].sort(
|
|
2856
|
-
(left, right) => (left.kind + ":" + ("name" in left ? left.name : "")).localeCompare(
|
|
2857
|
-
right.kind + ":" + ("name" in right ? right.name : "")
|
|
2858
|
-
)
|
|
2859
|
-
);
|
|
2860
|
-
if (sorted.some((child, index) => child !== members[index])) rules.add(memberOrderRule);
|
|
2861
|
-
children = [...sorted, ...children.filter((child) => child.kind === "component")];
|
|
2862
|
-
}
|
|
2863
|
-
}
|
|
2864
|
-
return { ...node, children };
|
|
2865
|
-
});
|
|
2866
|
-
}
|
|
2867
|
-
function compareApexlangSource(expected, actual) {
|
|
2868
|
-
if (expected === actual) return { equivalent: true, rules: [] };
|
|
2869
|
-
try {
|
|
2870
|
-
const left = readStructure(expected), right = readStructure(actual);
|
|
2871
|
-
if (canonical(left) === canonical(right)) return { equivalent: true, rules: [formattingRule] };
|
|
2872
|
-
if (canonical(removeQualifiedDefault(left)) === canonical(removeQualifiedDefault(right)))
|
|
2873
|
-
return { equivalent: true, rules: [formattingRule, defaultRule] };
|
|
2874
|
-
const rules = /* @__PURE__ */ new Set();
|
|
2875
|
-
if (canonical(left) !== canonical(removeQualifiedDefault(left)) || canonical(right) !== canonical(removeQualifiedDefault(right)))
|
|
2876
|
-
rules.add(defaultRule);
|
|
2877
|
-
if (canonical(normalizeExport(removeQualifiedDefault(left), rules)) === canonical(normalizeExport(removeQualifiedDefault(right), rules)))
|
|
2878
|
-
return { equivalent: true, rules: [formattingRule, ...rules] };
|
|
2879
|
-
const formRules = new Set(rules);
|
|
2880
|
-
const normalized = (nodes) => orderComponents(
|
|
2881
|
-
orderMembers(
|
|
2882
|
-
normalizeExport(normalizeForms(removeQualifiedDefault(nodes), formRules), formRules),
|
|
2883
|
-
formRules
|
|
2884
|
-
),
|
|
2885
|
-
formRules
|
|
2886
|
-
);
|
|
2887
|
-
if (canonical(normalized(left)) === canonical(normalized(right)))
|
|
2888
|
-
return { equivalent: true, rules: [formattingRule, ...formRules] };
|
|
2889
|
-
return {
|
|
2890
|
-
equivalent: false,
|
|
2891
|
-
rules: [],
|
|
2892
|
-
reason: "Source differs beyond the qualified formatting/default rules."
|
|
2893
|
-
};
|
|
2894
|
-
} catch (error) {
|
|
2895
|
-
return {
|
|
2896
|
-
equivalent: false,
|
|
2897
|
-
rules: [],
|
|
2898
|
-
reason: error instanceof Error ? error.message : "Source form is unsupported."
|
|
2899
|
-
};
|
|
2900
|
-
}
|
|
2901
|
-
}
|
|
2902
|
-
async function compareApplicationExports(expectedRoot, actualRoot, expectedFiles, actualFiles, allowedFiles) {
|
|
2903
|
-
const allowed = new Set(allowedFiles);
|
|
2904
|
-
const result = {
|
|
2905
|
-
equivalent: true,
|
|
2906
|
-
policy: APEXLANG_EQUIVALENCE_POLICY,
|
|
2907
|
-
normalizations: [],
|
|
2908
|
-
mismatchedFiles: [],
|
|
2909
|
-
mismatches: []
|
|
2910
|
-
};
|
|
2911
|
-
for (const file of [.../* @__PURE__ */ new Set([...Object.keys(expectedFiles), ...Object.keys(actualFiles)])].sort()) {
|
|
2912
|
-
if (expectedFiles[file] === actualFiles[file]) continue;
|
|
2913
|
-
let reason = "File bytes differ outside the selected APEXlang normalization scope.";
|
|
2914
|
-
if (expectedFiles[file] && actualFiles[file] && allowed.has(file) && path9.posix.extname(file) === ".apx") {
|
|
2915
|
-
const [expected, actual] = await Promise.all([
|
|
2916
|
-
readFile3(await contained(expectedRoot, file)),
|
|
2917
|
-
readFile3(await contained(actualRoot, file))
|
|
2918
|
-
]);
|
|
2919
|
-
if (hash(expected) !== expectedFiles[file] || hash(actual) !== actualFiles[file])
|
|
2920
|
-
reason = "Source changed during readback comparison.";
|
|
2921
|
-
else {
|
|
2922
|
-
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
2923
|
-
let comparison;
|
|
2924
|
-
try {
|
|
2925
|
-
comparison = compareApexlangSource(decoder.decode(expected), decoder.decode(actual));
|
|
2926
|
-
} catch {
|
|
2927
|
-
comparison = { equivalent: false, rules: [], reason: "Source is not valid UTF-8." };
|
|
2928
|
-
}
|
|
2929
|
-
if (comparison.equivalent) {
|
|
2930
|
-
result.normalizations.push({
|
|
2931
|
-
file,
|
|
2932
|
-
expectedSha256: expectedFiles[file],
|
|
2933
|
-
actualSha256: actualFiles[file],
|
|
2934
|
-
rules: comparison.rules
|
|
2935
|
-
});
|
|
2936
|
-
continue;
|
|
2937
|
-
}
|
|
2938
|
-
reason = comparison.reason ?? reason;
|
|
2939
|
-
}
|
|
2940
|
-
}
|
|
2941
|
-
result.equivalent = false;
|
|
2942
|
-
result.mismatchedFiles.push(file);
|
|
2943
|
-
result.mismatches.push({ file, reason });
|
|
2944
|
-
}
|
|
2945
|
-
return result;
|
|
2946
|
-
}
|
|
2947
|
-
|
|
2948
|
-
// packages/core/src/partial-import.ts
|
|
2949
|
-
var importSelectionSchema = external_exports.strictObject({
|
|
2950
|
-
requestedMode: external_exports.enum(["auto", "full", "files"]),
|
|
2951
|
-
resolvedMode: external_exports.enum(["full", "files"]),
|
|
2952
|
-
files: external_exports.array(relativePath),
|
|
2953
|
-
reasons: external_exports.array(external_exports.string()),
|
|
2954
|
-
dependencies: external_exports.array(relativePath),
|
|
2955
|
-
before: snapshotSchema.nullable(),
|
|
2956
|
-
effective: snapshotSchema.nullable(),
|
|
2957
|
-
capabilities: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
2958
|
-
readbackPolicy: external_exports.literal(APEXLANG_EQUIVALENCE_POLICY).optional(),
|
|
2959
|
-
exportScope: external_exports.enum(["selected", "full"]).optional()
|
|
2960
|
-
});
|
|
2961
|
-
function importOptions(value = {}) {
|
|
2962
|
-
const mode = value.importMode ?? "auto";
|
|
2963
|
-
if ((value.files?.length ?? 0) > 1e3)
|
|
2964
|
-
throw new Fault("INVALID_INPUT", "Select at most 1000 files in one import.", 2);
|
|
2965
|
-
if (!["auto", "full", "files"].includes(mode)) throw new Fault("INVALID_INPUT", "Unknown import mode.", 2);
|
|
2966
|
-
if (mode === "files" !== !!value.files?.length)
|
|
2967
|
-
throw new Fault(
|
|
2968
|
-
"INVALID_INPUT",
|
|
2969
|
-
"files mode requires a nonempty file list; other modes do not accept files.",
|
|
2970
|
-
2
|
|
2971
|
-
);
|
|
2972
|
-
const files = (value.files ?? []).map((file) => {
|
|
2973
|
-
if (!relativePath.safeParse(file).success || /[\\*?\[\]]/.test(file) || /^[A-Za-z]:/.test(file) || file.startsWith("-") || path10.posix.normalize(file) !== file || file === ".")
|
|
2974
|
-
throw new Fault(
|
|
2975
|
-
"IMPORT_FILE_UNSAFE",
|
|
2976
|
-
"Use normalized application-relative file paths without globs.",
|
|
2977
|
-
2
|
|
2978
|
-
);
|
|
2979
|
-
return file;
|
|
2980
|
-
});
|
|
2981
|
-
if (new Set(files).size !== files.length)
|
|
2982
|
-
throw new Fault("IMPORT_FILE_UNSAFE", "Duplicate import files are not allowed.", 2);
|
|
2983
|
-
return { importMode: mode, files: files.sort() };
|
|
2984
|
-
}
|
|
2985
|
-
async function sourceRelease(root) {
|
|
2986
|
-
try {
|
|
2987
|
-
const value = await readJson(path10.join(root, ".apex/apexlang.json"));
|
|
2988
|
-
return typeof value.mmdVersion === "string" ? value.mmdVersion.match(/^\d+\.\d+/)?.[0] ?? null : null;
|
|
2989
|
-
} catch {
|
|
2990
|
-
return null;
|
|
2991
|
-
}
|
|
2992
|
-
}
|
|
2993
|
-
function supportedFile(file) {
|
|
2994
|
-
return /^pages\/p\d{5}[-\w]*\.apx$/.test(file) || /^shared-components\/.+\.apx$/.test(file) && !/(?:^|\/)(?:themes?|templates?|plugins?|plug-ins?|static-files|files|authentications?|authorizations?)(?:[/.]|$)/i.test(
|
|
2995
|
-
file
|
|
2996
|
-
);
|
|
2997
|
-
}
|
|
2998
|
-
function scopedExportFile(file) {
|
|
2999
|
-
return /^pages\/p\d{5}[-\w]*\.apx$/.test(file);
|
|
3000
|
-
}
|
|
3001
|
-
function pickFiles(files, selected) {
|
|
3002
|
-
return Object.fromEntries(selected.filter((file) => files[file]).map((file) => [file, files[file]]));
|
|
3003
|
-
}
|
|
3004
|
-
async function overlaySelection(source, exported, files, destination) {
|
|
3005
|
-
await privateCopy(source, destination);
|
|
3006
|
-
const observed = await inventory(exported);
|
|
3007
|
-
for (const file of files) {
|
|
3008
|
-
const target = await contained(destination, file);
|
|
3009
|
-
if (!observed[file]) await rm4(target, { force: true });
|
|
3010
|
-
else {
|
|
3011
|
-
await mkdir3(path10.dirname(target), { recursive: true, mode: 448 });
|
|
3012
|
-
await cp2(await contained(exported, file), target);
|
|
3013
|
-
}
|
|
3014
|
-
}
|
|
3015
|
-
return destination;
|
|
3016
|
-
}
|
|
3017
|
-
function changedFiles(before, after) {
|
|
3018
|
-
return [.../* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)])].filter((file) => before[file] !== after[file]).sort();
|
|
3019
|
-
}
|
|
3020
|
-
function selectImport(base, local, remote, options2) {
|
|
3021
|
-
const requested = importOptions(options2);
|
|
3022
|
-
const localChanges = changedFiles(base, local);
|
|
3023
|
-
const remoteChanges = changedFiles(base, remote);
|
|
3024
|
-
const selected = requested.importMode === "files" ? requested.files : localChanges;
|
|
3025
|
-
for (const file of selected)
|
|
3026
|
-
if (!Object.hasOwn(local, file) && requested.importMode === "files")
|
|
3027
|
-
throw new Fault("IMPORT_FILE_MISSING", `Selected file is missing: ${file}`, 2);
|
|
3028
|
-
const conflicts = localChanges.filter(
|
|
3029
|
-
(file) => remoteChanges.includes(file) && local[file] !== remote[file]
|
|
3030
|
-
);
|
|
3031
|
-
if (conflicts.length)
|
|
3032
|
-
throw new Fault(
|
|
3033
|
-
"IMPORT_CONFLICT",
|
|
3034
|
-
`Local and server changes overlap; reconcile before planning: ${conflicts.join(", ")}`,
|
|
3035
|
-
5,
|
|
3036
|
-
"blocked",
|
|
3037
|
-
{ conflicts }
|
|
3038
|
-
);
|
|
3039
|
-
const reasons = [];
|
|
3040
|
-
if (selected.some((file) => !Object.hasOwn(local, file))) reasons.push("deleted-files-require-full-import");
|
|
3041
|
-
if (selected.some((file) => !supportedFile(file))) reasons.push("unsupported-component-files");
|
|
3042
|
-
const files = selected.filter((file) => local[file] !== remote[file]);
|
|
3043
|
-
if (!files.length) reasons.push("no-changed-files");
|
|
3044
|
-
const effective = { ...remote };
|
|
3045
|
-
for (const file of files) {
|
|
3046
|
-
if (local[file]) effective[file] = local[file];
|
|
3047
|
-
else delete effective[file];
|
|
3048
|
-
}
|
|
3049
|
-
return { files, reasons, remoteChanges, effective: Object.fromEntries(Object.entries(effective).sort()) };
|
|
3050
|
-
}
|
|
3051
|
-
async function persistSnapshot(ctx, source, directory) {
|
|
3052
|
-
const destination = await syncPath(ctx, directory);
|
|
3053
|
-
await mkdir3(path10.dirname(destination), { recursive: true, mode: 448 });
|
|
3054
|
-
await privateCopy(source, destination);
|
|
3055
|
-
const files = await inventory(destination);
|
|
3056
|
-
return { directory, files, digest: hash(canonical(files)) };
|
|
3057
|
-
}
|
|
3058
|
-
async function stageSelection(ctx, before, localRoot, files, expected, directory) {
|
|
3059
|
-
const root = await syncPath(ctx, directory);
|
|
3060
|
-
await mkdir3(path10.dirname(root), { recursive: true, mode: 448 });
|
|
3061
|
-
await privateCopy(await syncPath(ctx, before.directory), root);
|
|
3062
|
-
for (const file of files) {
|
|
3063
|
-
const destination = await contained(root, file);
|
|
3064
|
-
await mkdir3(path10.dirname(destination), { recursive: true, mode: 448 });
|
|
3065
|
-
await cp2(await contained(localRoot, file), destination);
|
|
3066
|
-
}
|
|
3067
|
-
const actual = await inventory(root);
|
|
3068
|
-
if (canonical(actual) !== canonical(expected))
|
|
3069
|
-
throw new Fault("SOURCE_DRIFT", "Source changed while preparing the selected import.", 5);
|
|
3070
|
-
return { directory, files: actual, digest: hash(canonical(actual)) };
|
|
3071
|
-
}
|
|
3072
|
-
async function rebaseAfterImport(ctx, runId, reviewedLocal, before, server, selected) {
|
|
3073
|
-
await checkSnapshot(ctx, server);
|
|
3074
|
-
const localRoot = await syncPath(ctx, ctx.config.application.sourceDir);
|
|
3075
|
-
if (canonical(await inventory(localRoot)) !== canonical(reviewedLocal))
|
|
3076
|
-
throw new Fault(
|
|
3077
|
-
"LOCAL_RECONCILIATION_REQUIRED",
|
|
3078
|
-
"Import confirmed; local files changed during execution. Reconcile them before another import.",
|
|
3079
|
-
5
|
|
3080
|
-
);
|
|
3081
|
-
const base = ".apexrest/deployments/" + runId;
|
|
3082
|
-
const replacement = await syncPath(ctx, base + "/rebased-source");
|
|
3083
|
-
const retained = await syncPath(ctx, base + "/local-before-rebase");
|
|
3084
|
-
await privateCopy(localRoot, replacement);
|
|
3085
|
-
const remoteOnly = changedFiles(before, server.files).filter(
|
|
3086
|
-
(file) => selected.includes(file) || reviewedLocal[file] === before[file]
|
|
3087
|
-
);
|
|
3088
|
-
for (const file of /* @__PURE__ */ new Set([...remoteOnly, ...selected])) {
|
|
3089
|
-
const destination = await contained(replacement, file);
|
|
3090
|
-
if (!server.files[file]) await rm4(destination, { force: true });
|
|
3091
|
-
else {
|
|
3092
|
-
await mkdir3(path10.dirname(destination), { recursive: true });
|
|
3093
|
-
await cp2(await contained(await syncPath(ctx, server.directory), file), destination);
|
|
3094
|
-
}
|
|
3095
|
-
}
|
|
3096
|
-
if (canonical(await inventory(localRoot)) !== canonical(reviewedLocal))
|
|
3097
|
-
throw new Fault(
|
|
3098
|
-
"LOCAL_RECONCILIATION_REQUIRED",
|
|
3099
|
-
"Import confirmed; concurrent local edits prevented rebase.",
|
|
3100
|
-
5
|
|
3101
|
-
);
|
|
3102
|
-
await rename(localRoot, retained);
|
|
3103
|
-
if (canonical(await inventory(retained)) !== canonical(reviewedLocal)) {
|
|
3104
|
-
await rename(retained, localRoot);
|
|
3105
|
-
throw new Fault(
|
|
3106
|
-
"LOCAL_RECONCILIATION_REQUIRED",
|
|
3107
|
-
"Import confirmed; concurrent local edits were preserved.",
|
|
3108
|
-
5
|
|
3109
|
-
);
|
|
3110
|
-
}
|
|
3111
|
-
try {
|
|
3112
|
-
await rename(replacement, localRoot);
|
|
3113
|
-
} catch (error) {
|
|
3114
|
-
await rename(retained, localRoot);
|
|
3115
|
-
throw error;
|
|
3116
|
-
}
|
|
3117
|
-
}
|
|
3118
|
-
|
|
3119
|
-
// packages/core/src/oracle.ts
|
|
3120
|
-
var targetIdentitySql = `select 'identity' target_record,
|
|
3121
|
-
sys_context('USERENV','DB_UNIQUE_NAME') db_unique_name,
|
|
3122
|
-
sys_context('USERENV','SERVICE_NAME') service_name,
|
|
3123
|
-
sys_context('USERENV','CURRENT_SCHEMA') parsing_schema,
|
|
3124
|
-
null workspace_id, null workspace, null application_id, null alias, null owner
|
|
3125
|
-
from dual
|
|
3126
|
-
union all
|
|
3127
|
-
select 'workspace', null, null, null, workspace_id, workspace, null, null, null
|
|
3128
|
-
from apex_workspaces where workspace = :p_workspace
|
|
3129
|
-
union all
|
|
3130
|
-
select 'application', null, null, null, null, workspace, application_id, alias, owner
|
|
3131
|
-
from apex_applications where application_id = :p_app_id`;
|
|
3132
|
-
var applicationMetadataSql = `select to_char(last_updated_on, 'YYYY-MM-DD"T"HH24:MI:SS', 'NLS_DATE_LANGUAGE=American') last_updated_on,
|
|
3133
|
-
last_updated_by,
|
|
3134
|
-
case when last_updated_on is null then 'Y' else 'N' end last_updated_on_is_null,
|
|
3135
|
-
case when last_updated_by is null then 'Y' else 'N' end last_updated_by_is_null
|
|
3136
|
-
from apex_applications
|
|
3137
|
-
where application_id = :p_app_id and workspace = :p_workspace and owner = :p_owner`;
|
|
3138
|
-
function parseApplicationMetadata(rows) {
|
|
3139
|
-
const row = rows[0];
|
|
3140
|
-
if (row && !Object.hasOwn(row, "last_updated_on") && row.last_updated_on_is_null === "Y")
|
|
3141
|
-
row.last_updated_on = null;
|
|
3142
|
-
if (row && !Object.hasOwn(row, "last_updated_by") && row.last_updated_by_is_null === "Y")
|
|
3143
|
-
row.last_updated_by = null;
|
|
3144
|
-
if (rows.length !== 1 || !row || !Object.hasOwn(row, "last_updated_on") || !Object.hasOwn(row, "last_updated_by"))
|
|
3145
|
-
throw new Fault("SYNC_METADATA_UNCONFIRMED", "Application update metadata is absent or inaccessible.", 5);
|
|
3146
|
-
if ([row.last_updated_on, row.last_updated_by].some((v2) => v2 !== null && typeof v2 !== "string"))
|
|
3147
|
-
throw new Fault("SYNC_METADATA_UNCONFIRMED", "Unexpected application update metadata.", 5);
|
|
3148
|
-
return {
|
|
3149
|
-
lastUpdatedOn: row.last_updated_on,
|
|
3150
|
-
lastUpdatedBy: row.last_updated_by
|
|
3151
|
-
};
|
|
3152
|
-
}
|
|
3153
|
-
var targetVersionSql = "select (select version_no from apex_release) apex_version, version_full database_version from product_component_version where product like 'Oracle%Database%'";
|
|
3154
|
-
function parseStatementMs(output) {
|
|
3155
|
-
const tail = output.slice(output.lastIndexOf("}") + 1);
|
|
3156
|
-
const matches = [...tail.matchAll(/^Elapsed: (\d+):(\d{2}):(\d{2}(?:\.\d+)?)\s*$/gm)];
|
|
3157
|
-
if (matches.length !== 1)
|
|
3158
|
-
throw new Fault("SQLCL_TIMING_UNCONFIRMED", "SQLcl did not return one statement elapsed interval.", 1);
|
|
3159
|
-
const m2 = matches[0];
|
|
3160
|
-
const value = (Number(m2[1]) * 3600 + Number(m2[2]) * 60 + Number(m2[3])) * 1e3;
|
|
3161
|
-
if (!Number.isFinite(value) || Number(m2[2]) >= 60 || Number(m2[3]) >= 60)
|
|
3162
|
-
throw new Fault("SQLCL_TIMING_UNCONFIRMED", "Invalid SQLcl statement elapsed interval.", 1);
|
|
3163
|
-
return value;
|
|
3164
|
-
}
|
|
3165
|
-
var capabilityCache = /* @__PURE__ */ new Map();
|
|
3166
|
-
var importHelpCache = /* @__PURE__ */ new Map();
|
|
3167
|
-
function resetCapabilityCache() {
|
|
3168
|
-
capabilityCache.clear();
|
|
3169
|
-
importHelpCache.clear();
|
|
3170
|
-
}
|
|
3171
|
-
function raceCancellation(promise, signal, message) {
|
|
3172
|
-
const cancelled = () => new Fault("CANCELLED", message, 6, "cancelled");
|
|
3173
|
-
if (!signal) return promise;
|
|
3174
|
-
if (signal.aborted) return Promise.reject(cancelled());
|
|
3175
|
-
return new Promise((resolve, reject) => {
|
|
3176
|
-
const abort = () => reject(cancelled());
|
|
3177
|
-
signal.addEventListener("abort", abort, { once: true });
|
|
3178
|
-
promise.then(resolve, reject).finally(() => signal.removeEventListener("abort", abort));
|
|
3179
|
-
});
|
|
3180
|
-
}
|
|
3181
|
-
function sqlclToken(value) {
|
|
3182
|
-
if (!value || /[\r\n\x00"&]/.test(value))
|
|
3183
|
-
throw new Fault(
|
|
3184
|
-
"INVALID_SQLCL_TOKEN",
|
|
3185
|
-
"SQLcl argument contains a forbidden quote, newline or substitution character.",
|
|
3186
|
-
2
|
|
3187
|
-
);
|
|
3188
|
-
return '"' + value.replaceAll("\\", "/") + '"';
|
|
3189
|
-
}
|
|
3190
|
-
function sqlLiteral(value) {
|
|
3191
|
-
if (/[\x00-\x1f]/.test(value) || value.length > 1024)
|
|
3192
|
-
throw new Fault("INVALID_SQL_LITERAL", "Invalid SQL literal.", 2);
|
|
3193
|
-
return "'" + value.replaceAll("'", "''") + "'";
|
|
3194
|
-
}
|
|
3195
|
-
function oracleDiagnostics(r, mutation = false, format = "text") {
|
|
3196
|
-
const stdout = r.stdout.replace(/\x1b\[[0-9;]*m/g, ""), stderr = r.stderr.replace(/\x1b\[[0-9;]*m/g, ""), output = stdout + "\n" + stderr;
|
|
3197
|
-
if (r.cancelled || r.timedOut || r.truncated)
|
|
3198
|
-
throw new Fault(
|
|
3199
|
-
r.truncated ? "OUTPUT_LIMIT" : r.cancelled ? "CANCELLED" : "TIMEOUT",
|
|
3200
|
-
"SQLcl did not complete with a confirmed outcome.",
|
|
3201
|
-
6,
|
|
3202
|
-
mutation ? "outcome_unknown" : "cancelled"
|
|
3203
|
-
);
|
|
3204
|
-
let diagnostics = output;
|
|
3205
|
-
if (format === "json") {
|
|
3206
|
-
diagnostics = stripEnvelopeRows(stdout) + "\n" + stderr;
|
|
3207
|
-
}
|
|
3208
|
-
if (/ORA-01017|ORA-28000|ORA-28001/i.test(diagnostics))
|
|
3209
|
-
throw new Fault("AUTHENTICATION_FAILED", "Oracle authentication failed.", 4, "blocked");
|
|
3210
|
-
if (/ORA-01031/i.test(diagnostics))
|
|
3211
|
-
throw new Fault("DB_PRIVILEGE", "Oracle privileges are insufficient.", 4, "blocked");
|
|
3212
|
-
if (r.code !== 0 || /(?:ORA-|PLS-|SP2-|SQLCL-)[0-9]+|(?:^|\n)\s*(?:Error(?:\s|:)|Unknown command|Invalid command|Invalid option|Compilation failed|Validation failed)|not connected|Unable to|No APEXlang files/i.test(
|
|
3213
|
-
diagnostics
|
|
3214
|
-
))
|
|
3215
|
-
throw new Fault(
|
|
3216
|
-
"ORACLE_COMMAND_FAILED",
|
|
3217
|
-
output.trim().slice(0, 6e3) || "SQLcl exited without success.",
|
|
3218
|
-
1
|
|
3219
|
-
);
|
|
3220
|
-
return output;
|
|
3221
|
-
}
|
|
3222
|
-
function jsonDocuments(text) {
|
|
3223
|
-
const spans = [];
|
|
3224
|
-
let depth = 0, start = -1, quoted = false;
|
|
3225
|
-
for (let i = 0; i < text.length; i++) {
|
|
3226
|
-
const c = text[i];
|
|
3227
|
-
if (quoted) {
|
|
3228
|
-
if (c === "\\") i++;
|
|
3229
|
-
else if (c === '"') quoted = false;
|
|
3230
|
-
} else if (c === '"') quoted = true;
|
|
3231
|
-
else if (c === "{") {
|
|
3232
|
-
if (depth++ === 0) start = i;
|
|
3233
|
-
} else if (c === "}" && depth > 0 && --depth === 0) spans.push([start, i + 1]);
|
|
3234
|
-
}
|
|
3235
|
-
return spans;
|
|
3236
|
-
}
|
|
3237
|
-
function stripEnvelopeRows(stdout) {
|
|
3238
|
-
let result = "", cursor = 0;
|
|
3239
|
-
for (const [start, end] of jsonDocuments(stdout)) {
|
|
3240
|
-
let replacement = stdout.slice(start, end);
|
|
3241
|
-
try {
|
|
3242
|
-
const envelope = JSON.parse(replacement);
|
|
3243
|
-
if (Array.isArray(envelope.results) && envelope.results.length > 0 && envelope.results.every((entry) => Array.isArray(entry.items)))
|
|
3244
|
-
replacement = JSON.stringify({
|
|
3245
|
-
...envelope,
|
|
3246
|
-
results: envelope.results.map(({ items: _items, ...metadata }) => metadata)
|
|
3247
|
-
});
|
|
3248
|
-
} catch {
|
|
3249
|
-
}
|
|
3250
|
-
result += stdout.slice(cursor, start) + replacement;
|
|
3251
|
-
cursor = end;
|
|
3252
|
-
}
|
|
3253
|
-
return result + stdout.slice(cursor);
|
|
3254
|
-
}
|
|
3255
|
-
var SCRIPT_RESTRICT_LEVEL = "2";
|
|
3256
|
-
var OracleAdapter = class {
|
|
3257
|
-
constructor(runner = runProcess, executable = process.env.APEXREST_SQLCL ?? "sql", mcpRunner = runSqlclMcp) {
|
|
3258
|
-
this.runner = runner;
|
|
3259
|
-
this.executable = executable;
|
|
3260
|
-
this.mcpRunner = mcpRunner;
|
|
3261
|
-
}
|
|
3262
|
-
runner;
|
|
3263
|
-
executable;
|
|
3264
|
-
mcpRunner;
|
|
3265
|
-
selectedTransport;
|
|
3266
|
-
selectedConnections = /* @__PURE__ */ new Map();
|
|
3267
|
-
async settings() {
|
|
3268
|
-
const file = path11.join(managedHome(), "runtime.json");
|
|
3269
|
-
const state = await exists(file) ? await readJson(file) : {};
|
|
3270
|
-
const transport = await (this.selectedTransport ??= sqlclConfig());
|
|
3271
|
-
return {
|
|
3272
|
-
...transport,
|
|
3273
|
-
executable: process.env.APEXREST_SQLCL ?? state.sqlcl ?? this.executable,
|
|
3274
|
-
javaHome: process.env.APEXREST_JAVA_HOME ?? (state.java ? path11.dirname(path11.dirname(state.java)) : process.env.JAVA_HOME)
|
|
3275
|
-
};
|
|
3276
|
-
}
|
|
3277
|
-
async selectedConnection(connection) {
|
|
3278
|
-
const settings = await this.settings();
|
|
3279
|
-
const key = connectionReference(connection) ?? JSON.stringify(connection);
|
|
3280
|
-
let selected = this.selectedConnections.get(key);
|
|
3281
|
-
if (!selected) {
|
|
3282
|
-
selected = (async () => {
|
|
3283
|
-
if (settings.databaseTransport === "ords") {
|
|
3284
|
-
if (settings.mode !== "cli")
|
|
3285
|
-
throw new Fault("ORDS_CLI_REQUIRED", "ORDS HTTP requires SQLcl CLI mode.", 3, "blocked");
|
|
3286
|
-
return { ords: await ordsCredentials(connection) };
|
|
3287
|
-
}
|
|
3288
|
-
if (!connection.name)
|
|
3289
|
-
throw new Fault(
|
|
3290
|
-
"DIRECT_CONNECTION_REQUIRED",
|
|
3291
|
-
"Configure a direct SQLcl saved connection for this reference or select ORDS HTTP in plugin settings.",
|
|
3292
|
-
3,
|
|
3293
|
-
"blocked"
|
|
3294
|
-
);
|
|
3295
|
-
return { name: parse(savedConnectionName, connection.name) };
|
|
3296
|
-
})();
|
|
3297
|
-
this.selectedConnections.set(key, selected);
|
|
3298
|
-
}
|
|
3299
|
-
return selected;
|
|
3300
|
-
}
|
|
3301
|
-
async session(input, connection, mutation = false, signal, cwd, format = "text", restrictLevel, isolated = false, label = "session") {
|
|
3302
|
-
if (restrictLevel && (await this.settings()).mode === "mcp")
|
|
3303
|
-
throw new Fault(
|
|
3304
|
-
"SQLCL_MCP_SCRIPT_RESTRICT_UNAVAILABLE",
|
|
3305
|
-
"Restricted script operations require SQLcl CLI mode with -R 2; MCP does not provide an equivalent restriction.",
|
|
3306
|
-
3,
|
|
3307
|
-
"blocked"
|
|
3308
|
-
);
|
|
3309
|
-
const work = cwd ?? await this.stage();
|
|
3310
|
-
try {
|
|
3311
|
-
return await this.sessionIn(
|
|
3312
|
-
work,
|
|
3313
|
-
input,
|
|
3314
|
-
connection,
|
|
3315
|
-
mutation,
|
|
3316
|
-
signal,
|
|
3317
|
-
format,
|
|
3318
|
-
restrictLevel,
|
|
3319
|
-
isolated,
|
|
3320
|
-
label
|
|
3321
|
-
);
|
|
3322
|
-
} finally {
|
|
3323
|
-
if (!cwd) await this.discardStage(work);
|
|
3324
|
-
}
|
|
3325
|
-
}
|
|
3326
|
-
async sessionIn(work, input, connection, mutation, signal, format, restrictLevel, isolated, label) {
|
|
3327
|
-
const settings = await this.settings();
|
|
3328
|
-
if (mutation) await this.requireMutationSupport();
|
|
3329
|
-
const selected = connection ? await this.selectedConnection(connection) : void 0;
|
|
3330
|
-
const args = [
|
|
3331
|
-
"-S",
|
|
3332
|
-
"-L",
|
|
3333
|
-
...restrictLevel ? ["-R", restrictLevel] : [],
|
|
3334
|
-
...selected?.name ? ["-name", selected.name] : ["/nolog"]
|
|
3335
|
-
];
|
|
3336
|
-
const env = {
|
|
3337
|
-
...process.env,
|
|
3338
|
-
SQLPATH: "",
|
|
3339
|
-
ORACLE_PATH: "",
|
|
3340
|
-
TNS_ADMIN: process.env.TNS_ADMIN,
|
|
3341
|
-
JAVA_HOME: settings.javaHome
|
|
3342
|
-
};
|
|
3343
|
-
delete env.NODE_OPTIONS;
|
|
3344
|
-
delete env.JAVA_TOOL_OPTIONS;
|
|
3345
|
-
delete env._JAVA_OPTIONS;
|
|
3346
|
-
delete env.JDK_JAVA_OPTIONS;
|
|
3347
|
-
const preamble = "set define off\nset echo off\nset feedback off\n" + (settings.mode === "mcp" && settings.mcpRestrictLevel === "4" ? "" : "whenever oserror exit failure rollback\nwhenever sqlerror exit failure rollback\n");
|
|
3348
|
-
const connect = selected?.ords ? `set history filter default connect
|
|
3349
|
-
connect -orest -user "${selected.ords.username}" -password "${selected.ords.password}" -url "${selected.ords.url}"
|
|
3350
|
-
` : "";
|
|
3351
|
-
const marker = `APEXREST_COMPLETE_${randomUUID().replaceAll("-", "")}`;
|
|
3352
|
-
let timingRecorded = false;
|
|
3353
|
-
const request = {
|
|
3354
|
-
mutation,
|
|
3355
|
-
sqlclConnected: !!selected,
|
|
3356
|
-
onSqlclTiming: (timing) => {
|
|
3357
|
-
timingRecorded = true;
|
|
3358
|
-
recordSqlclTiming(label, timing);
|
|
3359
|
-
},
|
|
3360
|
-
executable: settings.executable,
|
|
3361
|
-
args,
|
|
3362
|
-
cwd: work,
|
|
3363
|
-
env,
|
|
3364
|
-
input: preamble + connect + input + "\nexit\n",
|
|
3365
|
-
timeoutMs: 18e4,
|
|
3366
|
-
...signal ? { signal } : {}
|
|
3367
|
-
};
|
|
3368
|
-
const pooled = !isolated && (settings.mode === "mcp" ? this.mcpRunner === runSqlclMcp : this.runner === runProcess && !selected && settings.databaseTransport !== "ords");
|
|
3369
|
-
const viaServer = settings.mode === "mcp" || pooled;
|
|
3370
|
-
const executionStarted = performance.now();
|
|
3371
|
-
let raw;
|
|
3372
|
-
try {
|
|
3373
|
-
raw = viaServer ? await (pooled ? runPooledSqlcl : this.mcpRunner)({
|
|
3374
|
-
...request,
|
|
3375
|
-
cwd: pooled ? await this.sessionHome() : work,
|
|
3376
|
-
// Let SQLcl apply its MCP default. In 26.1, explicit -R 4
|
|
3377
|
-
// also suppresses connmgr output, unlike the default MCP profile.
|
|
3378
|
-
args: settings.mode === "mcp" ? settings.mcpRestrictLevel === "4" ? ["-mcp"] : ["-R", "1", "-mcp"] : [...restrictLevel ? ["-R", restrictLevel] : [], "-mcp"],
|
|
3379
|
-
// CLI's final EXIT commits on success. Preserve that transaction
|
|
3380
|
-
// boundary before acknowledging a write over a persistent session.
|
|
3381
|
-
input: (settings.mode === "cli" ? preamble.replace(/exit failure rollback/g, "continue") : preamble) + // Persistent servers keep SET state between batches; start neutral.
|
|
3382
|
-
(selected?.name ? "rollback;\nbegin dbms_session.reset_package; execute immediate 'alter session set current_schema = ' || dbms_assert.enquote_name(sys_context('USERENV', 'SESSION_USER'), false); end;\n/\n" : "") + "set serveroutput off\nset sqlformat default\n" + input + (mutation ? "\ncommit;\n" : "\n") + `prompt ${marker}
|
|
3383
|
-
`,
|
|
3384
|
-
mutation,
|
|
3385
|
-
completionMarker: marker,
|
|
3386
|
-
...selected?.name ? { connectionName: selected.name } : {}
|
|
3387
|
-
}) : await this.runner(request);
|
|
3388
|
-
} finally {
|
|
3389
|
-
if (!timingRecorded) {
|
|
3390
|
-
const elapsed = performance.now() - executionStarted;
|
|
3391
|
-
recordSqlclTiming(label, {
|
|
3392
|
-
queueMs: 0,
|
|
3393
|
-
spawnMs: null,
|
|
3394
|
-
connectMs: null,
|
|
3395
|
-
executeMs: elapsed,
|
|
3396
|
-
totalMs: elapsed,
|
|
3397
|
-
reused: false,
|
|
3398
|
-
mutation,
|
|
3399
|
-
connected: !!selected,
|
|
3400
|
-
transport: viaServer ? pooled ? "mcp-pool" : "mcp" : "cli"
|
|
3401
|
-
});
|
|
3402
|
-
}
|
|
3403
|
-
}
|
|
3404
|
-
const secret = selected?.ords?.password;
|
|
3405
|
-
const result = secret && format !== "json" ? {
|
|
3406
|
-
...raw,
|
|
3407
|
-
stdout: raw.stdout.replaceAll(secret, "[REDACTED]"),
|
|
3408
|
-
stderr: raw.stderr.replaceAll(secret, "[REDACTED]")
|
|
3409
|
-
} : raw;
|
|
3410
|
-
let output;
|
|
3411
|
-
try {
|
|
3412
|
-
output = oracleDiagnostics(result, mutation, format);
|
|
3413
|
-
} catch (error) {
|
|
3414
|
-
if (secret && error instanceof Error) error.message = error.message.replaceAll(secret, "[REDACTED]");
|
|
3415
|
-
throw error;
|
|
3416
|
-
}
|
|
3417
|
-
if (viaServer && !output.split(/\r?\n/).some((line) => line.trim() === marker))
|
|
3418
|
-
throw new Fault(
|
|
3419
|
-
"SQLCL_MCP_INCOMPLETE",
|
|
3420
|
-
"SQLcl MCP did not confirm the complete command batch.",
|
|
3421
|
-
6,
|
|
3422
|
-
mutation ? "outcome_unknown" : "failed"
|
|
3423
|
-
);
|
|
3424
|
-
return { ...result, output: viaServer ? output.replace(marker, "").trim() : output, work };
|
|
3425
|
-
}
|
|
3426
|
-
/** Working directory of pooled SQLcl servers: a durable private directory, never a per-call stage. */
|
|
3427
|
-
async sessionHome() {
|
|
3428
|
-
const root = path11.join(managedHome(), "staging");
|
|
3429
|
-
await mkdir4(root, { recursive: true, mode: 448 });
|
|
3430
|
-
return root;
|
|
3431
|
-
}
|
|
3432
|
-
async requireMutationSupport() {
|
|
3433
|
-
const settings = await this.settings();
|
|
3434
|
-
if (settings.databaseTransport === "ords" && settings.mode !== "cli")
|
|
3435
|
-
throw new Fault("ORDS_CLI_REQUIRED", "ORDS HTTP requires SQLcl CLI mode.", 3, "blocked");
|
|
3436
|
-
if (settings.mode === "mcp" && settings.mcpRestrictLevel !== "1")
|
|
3437
|
-
throw new Fault(
|
|
3438
|
-
"SQLCL_MCP_RESTRICTED",
|
|
3439
|
-
"SQLcl MCP restrict level 4 cannot provide fail-stop scripts for writes. Explicitly select MCP restrict level 1 in SQLcl settings for authorized deployment/scripts.",
|
|
3440
|
-
3,
|
|
3441
|
-
"blocked"
|
|
3442
|
-
);
|
|
3443
|
-
}
|
|
3444
|
-
async stage() {
|
|
3445
|
-
const root = path11.join(managedHome(), "staging");
|
|
3446
|
-
await mkdir4(root, { recursive: true, mode: 448 });
|
|
3447
|
-
return mkdtemp(path11.join(root, "oracle-"));
|
|
3448
|
-
}
|
|
3449
|
-
/** Remove a private staging directory created by stage(). Other paths are never removed. */
|
|
3450
|
-
async discardStage(stage) {
|
|
3451
|
-
if (!stage) return;
|
|
3452
|
-
const relative = path11.relative(path11.join(managedHome(), "staging"), path11.resolve(stage));
|
|
3453
|
-
if (!/^oracle-[^/\\]+$/.test(relative)) return;
|
|
3454
|
-
await rm5(stage, { recursive: true, force: true });
|
|
3455
|
-
}
|
|
3456
|
-
async ordsBridge(job, connection, signal, stage) {
|
|
3457
|
-
const settings = await this.settings();
|
|
3458
|
-
const selected = connection ? await this.selectedConnection(connection) : void 0;
|
|
3459
|
-
if (connection && !selected?.ords)
|
|
3460
|
-
throw new Fault(
|
|
3461
|
-
"ORDS_CONNECTION_REQUIRED",
|
|
3462
|
-
"Select the ORDS transport for this operation.",
|
|
3463
|
-
3,
|
|
3464
|
-
"blocked"
|
|
3465
|
-
);
|
|
3466
|
-
const work = stage ?? await this.stage();
|
|
3467
|
-
try {
|
|
3468
|
-
return await runOrdsBridge(settings, job, selected?.ords, work, signal, this.runner);
|
|
3469
|
-
} finally {
|
|
3470
|
-
if (!stage) await this.discardStage(work);
|
|
3471
|
-
}
|
|
3472
|
-
}
|
|
3473
|
-
async capabilityKey(settings) {
|
|
3474
|
-
if (!path11.isAbsolute(settings.executable)) return;
|
|
3475
|
-
try {
|
|
3476
|
-
const executable = await realpath4(settings.executable);
|
|
3477
|
-
const bin = path11.dirname(executable);
|
|
3478
|
-
if (path11.basename(bin) !== "bin") return;
|
|
3479
|
-
const lib = path11.join(path11.dirname(bin), "lib");
|
|
3480
|
-
const mark = async (file, required) => {
|
|
3481
|
-
try {
|
|
3482
|
-
const info = await stat3(file, { bigint: true });
|
|
3483
|
-
return [info.dev, info.ino, info.mode, info.size, info.mtimeNs, info.ctimeNs].map(String);
|
|
3484
|
-
} catch (error) {
|
|
3485
|
-
if (required) throw error;
|
|
3486
|
-
return "absent";
|
|
3487
|
-
}
|
|
3488
|
-
};
|
|
3489
|
-
const marks = {
|
|
3490
|
-
executable: await mark(executable, true),
|
|
3491
|
-
lib: await mark(lib, true),
|
|
3492
|
-
apex: await mark(path11.join(lib, "dbtools-apex.jar"), false),
|
|
3493
|
-
apexlang: await mark(path11.join(lib, "apexlang-compiler.jar"), false),
|
|
3494
|
-
ext: await mark(path11.join(lib, "ext"), false),
|
|
3495
|
-
extApex: await mark(path11.join(lib, "ext/dbtools-apex.jar"), false),
|
|
3496
|
-
extApexlang: await mark(path11.join(lib, "ext/apexlang-compiler.jar"), false)
|
|
3497
|
-
};
|
|
3498
|
-
const { executable: _executable, ...rest } = settings;
|
|
3499
|
-
return hash(canonical({ ...rest, executable, marks }));
|
|
3500
|
-
} catch {
|
|
3501
|
-
return;
|
|
3502
|
-
}
|
|
3503
|
-
}
|
|
3504
|
-
async probeCapabilities(settings, key) {
|
|
3505
|
-
const versionStage = await this.stage();
|
|
3506
|
-
let version;
|
|
3507
|
-
try {
|
|
3508
|
-
version = await this.runner({
|
|
3509
|
-
executable: settings.executable,
|
|
3510
|
-
args: ["-version"],
|
|
3511
|
-
cwd: versionStage,
|
|
3512
|
-
env: { ...process.env, JAVA_HOME: settings.javaHome },
|
|
3513
|
-
timeoutMs: 15e3
|
|
3514
|
-
});
|
|
3515
|
-
} finally {
|
|
3516
|
-
await this.discardStage(versionStage);
|
|
3517
|
-
}
|
|
3518
|
-
oracleDiagnostics(version);
|
|
3519
|
-
const help = (await this.session(
|
|
3520
|
-
"help apex",
|
|
3521
|
-
void 0,
|
|
3522
|
-
false,
|
|
3523
|
-
void 0,
|
|
3524
|
-
void 0,
|
|
3525
|
-
"text",
|
|
3526
|
-
void 0,
|
|
3527
|
-
false,
|
|
3528
|
-
"capability"
|
|
3529
|
-
)).output;
|
|
3530
|
-
if (key && key !== await this.capabilityKey(settings)) capabilityCache.delete(key);
|
|
3531
|
-
const commands = Object.fromEntries(
|
|
3532
|
-
["generate", "export", "validate", "import"].map((command) => [
|
|
3533
|
-
command,
|
|
3534
|
-
new RegExp("\\b" + command + "\\b", "i").test(help)
|
|
3535
|
-
])
|
|
3536
|
-
);
|
|
3537
|
-
return { version: version.stdout.trim(), commands, helpHash: hash(help), help };
|
|
3538
|
-
}
|
|
3539
|
-
async capabilities(signal) {
|
|
3540
|
-
const settings = await this.settings();
|
|
3541
|
-
const key = await this.capabilityKey(settings);
|
|
3542
|
-
let pending = key ? capabilityCache.get(key) : void 0;
|
|
3543
|
-
if (!pending) {
|
|
3544
|
-
pending = this.probeCapabilities(settings, key);
|
|
3545
|
-
if (key) {
|
|
3546
|
-
capabilityCache.set(key, pending);
|
|
3547
|
-
pending.catch(() => {
|
|
3548
|
-
if (capabilityCache.get(key) === pending) capabilityCache.delete(key);
|
|
3549
|
-
});
|
|
3550
|
-
} else pending.catch(() => {
|
|
3551
|
-
});
|
|
3552
|
-
}
|
|
3553
|
-
return raceCancellation(pending, signal, "Capability check cancelled.");
|
|
3554
|
-
}
|
|
3555
|
-
async requireCapability(name, signal) {
|
|
3556
|
-
const capabilities = await this.capabilities(signal);
|
|
3557
|
-
if (!capabilities.commands[name])
|
|
3558
|
-
throw new Fault("UNSUPPORTED_CAPABILITY", `This SQLcl does not advertise apex ${name}.`, 3, "blocked");
|
|
3559
|
-
return { version: capabilities.version, helpHash: capabilities.helpHash };
|
|
3560
|
-
}
|
|
3561
|
-
/** Inspect selected-file support without connecting or trusting the generic APEX help. */
|
|
3562
|
-
async importHelp(signal) {
|
|
3563
|
-
const key = await this.capabilityKey(await this.settings());
|
|
3564
|
-
let pending = key ? importHelpCache.get(key) : void 0;
|
|
3565
|
-
if (!pending) {
|
|
3566
|
-
pending = this.session("help apex import").then(
|
|
3567
|
-
(result) => result.output.replace(/\x1b\[[0-9;]*m/g, "")
|
|
3568
|
-
);
|
|
3569
|
-
if (key) {
|
|
3570
|
-
importHelpCache.set(key, pending);
|
|
3571
|
-
pending.catch(() => importHelpCache.delete(key));
|
|
3572
|
-
}
|
|
3573
|
-
}
|
|
3574
|
-
return raceCancellation(pending, signal, "Import capability check cancelled.");
|
|
3575
|
-
}
|
|
3576
|
-
async partialImportCapabilities(source, target, signal) {
|
|
3577
|
-
const compiler = await this.requireCapability("import", signal);
|
|
3578
|
-
const settings = await this.settings();
|
|
3579
|
-
const help = await this.importHelp(signal);
|
|
3580
|
-
return evaluatePartialImportCompatibility({
|
|
3581
|
-
...target,
|
|
3582
|
-
compilerVersion: compiler.version,
|
|
3583
|
-
mmdVersion: await sourceMmdVersion(source),
|
|
3584
|
-
importFiles: /(?:^|\s)-files(?:\s|\|)/m.test(help),
|
|
3585
|
-
mode: settings.mode,
|
|
3586
|
-
databaseTransport: settings.databaseTransport ?? "direct",
|
|
3587
|
-
helpHash: hash(help)
|
|
3588
|
-
});
|
|
3589
|
-
}
|
|
3590
|
-
async codeScan(source, signal) {
|
|
3591
|
-
const compiler = await this.capabilities(signal);
|
|
3592
|
-
if (!/Release 26\.3\./.test(compiler.version))
|
|
3593
|
-
return {
|
|
3594
|
-
status: "unavailable",
|
|
3595
|
-
findings: [],
|
|
3596
|
-
reason: "APEXlang CodeScan is qualified only for SQLcl 26.3."
|
|
3597
|
-
};
|
|
3598
|
-
const stage = await this.stage(), copy = path11.join(stage, "application");
|
|
3599
|
-
try {
|
|
3600
|
-
await cp3(source, copy, { recursive: true });
|
|
3601
|
-
const help = (await this.session("help codescan", void 0, false, signal)).output;
|
|
3602
|
-
if (!/\.apx\b/i.test(help) || !/-extensions\b/i.test(help))
|
|
3603
|
-
return {
|
|
3604
|
-
status: "unavailable",
|
|
3605
|
-
findings: [],
|
|
3606
|
-
reason: "Selected SQLcl does not advertise APEXlang CodeScan."
|
|
3607
|
-
};
|
|
3608
|
-
const result = await this.session(
|
|
3609
|
-
`codescan -path ${sqlclToken(copy)} -extensions apx -format json`,
|
|
3610
|
-
void 0,
|
|
3611
|
-
false,
|
|
3612
|
-
signal
|
|
3613
|
-
);
|
|
3614
|
-
return { status: "advisory", findings: parseCodeScan(result.output, copy) };
|
|
3615
|
-
} catch (error) {
|
|
3616
|
-
if (signal?.aborted || error instanceof Fault && error.code === "CANCELLED") throw error;
|
|
3617
|
-
return {
|
|
3618
|
-
status: "unavailable",
|
|
3619
|
-
findings: [],
|
|
3620
|
-
reason: error instanceof Error ? error.message : "CodeScan did not complete."
|
|
3621
|
-
};
|
|
3622
|
-
} finally {
|
|
3623
|
-
await this.discardStage(stage);
|
|
3624
|
-
}
|
|
3625
|
-
}
|
|
3626
|
-
async generate(name, alias) {
|
|
3627
|
-
const compiler = await this.requireCapability("generate");
|
|
3628
|
-
const stage = await this.stage();
|
|
3629
|
-
const result = await this.session(
|
|
3630
|
-
`apex generate -name ${sqlclToken(name)} -alias ${sqlclToken(parse(refName, alias))} -dir ${sqlclToken(stage)}`,
|
|
3631
|
-
void 0,
|
|
3632
|
-
false,
|
|
3633
|
-
void 0,
|
|
3634
|
-
stage,
|
|
3635
|
-
"text",
|
|
3636
|
-
void 0,
|
|
3637
|
-
// SQLcl 26.3 rejects freshly generated MMD when generation and validation
|
|
3638
|
-
// share a JVM. The cause is in the vendor process state. Keep
|
|
3639
|
-
// generation disposable; do not close pools used by other callers.
|
|
3640
|
-
/Release 26\.3\./.test(compiler.version)
|
|
3641
|
-
);
|
|
3642
|
-
const directory = await this.findApplication(stage);
|
|
3643
|
-
return { directory, compiler, output: result.output, files: await inventory(directory) };
|
|
3644
|
-
}
|
|
3645
|
-
async findApplication(root) {
|
|
3646
|
-
if (await exists(path11.join(root, "application.apx"))) return root;
|
|
3647
|
-
const found = [];
|
|
3648
|
-
for (const entry of await readdir2(root, { withFileTypes: true }))
|
|
3649
|
-
if (entry.isDirectory()) {
|
|
3650
|
-
const dir = path11.join(root, entry.name);
|
|
3651
|
-
if (await exists(path11.join(dir, "application.apx"))) found.push(dir);
|
|
3652
|
-
else
|
|
3653
|
-
for (const sub of await readdir2(dir, { withFileTypes: true }))
|
|
3654
|
-
if (sub.isDirectory() && await exists(path11.join(dir, sub.name, "application.apx")))
|
|
3655
|
-
found.push(path11.join(dir, sub.name));
|
|
3656
|
-
}
|
|
3657
|
-
if (found.length !== 1)
|
|
3658
|
-
throw new Fault(
|
|
3659
|
-
"ORACLE_OUTPUT_MISSING",
|
|
3660
|
-
"Expected exactly one generated/exported APEXlang application.",
|
|
3661
|
-
1
|
|
3662
|
-
);
|
|
3663
|
-
return found[0];
|
|
3664
|
-
}
|
|
3665
|
-
async validate(source, signal) {
|
|
3666
|
-
const compiler = await this.requireCapability("validate", signal);
|
|
3667
|
-
const before = await inventory(source);
|
|
3668
|
-
if (!before[".apex/apexlang.json"])
|
|
3669
|
-
throw new Fault(
|
|
3670
|
-
"MMD_METADATA_REQUIRED",
|
|
3671
|
-
"Preserve Oracle-generated .apex/apexlang.json before validation.",
|
|
3672
|
-
3
|
|
3673
|
-
);
|
|
3674
|
-
const stage = await this.stage(), copy = path11.join(stage, "application");
|
|
3675
|
-
let result;
|
|
3676
|
-
try {
|
|
3677
|
-
await cp3(source, copy, { recursive: true });
|
|
3678
|
-
result = await this.session(
|
|
3679
|
-
`apex validate -input ${sqlclToken(copy)}`,
|
|
3680
|
-
void 0,
|
|
3681
|
-
false,
|
|
3682
|
-
signal,
|
|
3683
|
-
stage,
|
|
3684
|
-
"text",
|
|
3685
|
-
void 0,
|
|
3686
|
-
false,
|
|
3687
|
-
"validate"
|
|
3688
|
-
);
|
|
3689
|
-
} catch (error) {
|
|
3690
|
-
if (error instanceof Fault && error.code === "ORACLE_COMMAND_FAILED" && !error.details) {
|
|
3691
|
-
const details = await compilerDetails(error.message, source);
|
|
3692
|
-
if (details) throw new Fault("VALIDATION_FAILED", error.message, 1, "failed", details);
|
|
3693
|
-
}
|
|
3694
|
-
throw error;
|
|
3695
|
-
} finally {
|
|
3696
|
-
await this.discardStage(stage);
|
|
3697
|
-
}
|
|
3698
|
-
if (!compilerSucceeded(result.output)) throw await compilerFault(result.output, source);
|
|
3699
|
-
if (canonical(before) !== canonical(await inventory(source)))
|
|
3700
|
-
throw new Fault("SOURCE_DRIFT", "Source changed during validation.", 5);
|
|
3701
|
-
return {
|
|
3702
|
-
status: "passed",
|
|
3703
|
-
compiler,
|
|
3704
|
-
mmd: JSON.parse(await readFile5(path11.join(source, ".apex/apexlang.json"), "utf8")),
|
|
3705
|
-
sourceDigest: hash(canonical(before)),
|
|
3706
|
-
output: result.output
|
|
1287
|
+
destroyed = true;
|
|
1288
|
+
refUnrefFilter.unpipe(byteCounter);
|
|
1289
|
+
refUnrefFilter.destroy();
|
|
1290
|
+
});
|
|
1291
|
+
return stream.pipe(refUnrefFilter).pipe(byteCounter);
|
|
3707
1292
|
};
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
const compiler = await this.requireCapability("export");
|
|
3711
|
-
const stage = await this.stage();
|
|
3712
|
-
const ords = (await this.settings()).databaseTransport === "ords";
|
|
3713
|
-
const exportRoot = ords ? path11.join(stage, "export") : stage;
|
|
3714
|
-
const result = ords ? {
|
|
3715
|
-
output: String(
|
|
3716
|
-
(await this.ordsBridge(
|
|
3717
|
-
{
|
|
3718
|
-
operation: "export",
|
|
3719
|
-
applicationId: env.applicationId,
|
|
3720
|
-
exportType: format,
|
|
3721
|
-
split: format === "APEXLANG",
|
|
3722
|
-
outputDirectory: exportRoot
|
|
3723
|
-
},
|
|
3724
|
-
connection,
|
|
3725
|
-
void 0,
|
|
3726
|
-
stage
|
|
3727
|
-
)).message ?? "Export successful"
|
|
3728
|
-
)
|
|
3729
|
-
} : await this.session(
|
|
3730
|
-
`apex export -applicationid ${env.applicationId} -exptype ${format} -skipExportDate -expOriginalIds -dir ${sqlclToken(stage)}`,
|
|
3731
|
-
connection,
|
|
3732
|
-
false,
|
|
3733
|
-
void 0,
|
|
3734
|
-
stage,
|
|
3735
|
-
"text",
|
|
3736
|
-
void 0,
|
|
3737
|
-
false,
|
|
3738
|
-
"export"
|
|
3739
|
-
);
|
|
3740
|
-
const directory = format === "APEXLANG" ? await this.findApplication(exportRoot) : exportRoot;
|
|
3741
|
-
const files = await inventory(directory);
|
|
3742
|
-
if (!Object.keys(files).length || format === "SQL" && !Object.keys(files).some((f2) => f2.endsWith(".sql")))
|
|
3743
|
-
throw new Fault("EMPTY_BACKUP", "Oracle export produced no usable files.", 1);
|
|
3744
|
-
return {
|
|
3745
|
-
directory,
|
|
3746
|
-
files,
|
|
3747
|
-
digest: hash(canonical(files)),
|
|
3748
|
-
format,
|
|
3749
|
-
compiler,
|
|
3750
|
-
output: result.output,
|
|
3751
|
-
stage
|
|
1293
|
+
RandomAccessReader.prototype._readStreamForRange = function(start, end) {
|
|
1294
|
+
throw new Error("not implemented");
|
|
3752
1295
|
};
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
);
|
|
3762
|
-
const settings = await this.settings();
|
|
3763
|
-
if (settings.mode !== "cli" || (settings.databaseTransport ?? "direct") !== "direct")
|
|
3764
|
-
throw new Fault(
|
|
3765
|
-
"PARTIAL_EXPORT_UNSUPPORTED",
|
|
3766
|
-
"Component export requires direct SQLcl CLI transport.",
|
|
3767
|
-
3
|
|
3768
|
-
);
|
|
3769
|
-
const compiler = await this.requireCapability("export");
|
|
3770
|
-
const stage = await this.stage(), directory = path11.join(stage, "selection");
|
|
3771
|
-
await mkdir4(directory, { mode: 448 });
|
|
3772
|
-
try {
|
|
3773
|
-
if (exportScope === "full") {
|
|
3774
|
-
const exported = await this.exportApplication(env, connection, "APEXLANG");
|
|
3775
|
-
try {
|
|
3776
|
-
for (const file of selected) {
|
|
3777
|
-
const pageId = /^pages\/p(\d{5})/.exec(file)?.[1];
|
|
3778
|
-
const matches = Object.keys(exported.files).filter(
|
|
3779
|
-
(candidate) => pageId ? /^pages\/p(\d{5})/.exec(candidate)?.[1] === pageId : candidate === file
|
|
3780
|
-
);
|
|
3781
|
-
if (matches.length > 1)
|
|
3782
|
-
throw new Fault("PARTIAL_EXPORT_AMBIGUOUS", "Export has duplicate selected identities.", 5);
|
|
3783
|
-
if (!matches.length) continue;
|
|
3784
|
-
const target = await contained(directory, file);
|
|
3785
|
-
await mkdir4(path11.dirname(target), { recursive: true, mode: 448 });
|
|
3786
|
-
await cp3(await contained(exported.directory, matches[0]), target);
|
|
3787
|
-
}
|
|
3788
|
-
const files2 = await inventory(directory);
|
|
3789
|
-
return {
|
|
3790
|
-
directory,
|
|
3791
|
-
files: files2,
|
|
3792
|
-
digest: hash(canonical(files2)),
|
|
3793
|
-
format: "APEXLANG",
|
|
3794
|
-
compiler,
|
|
3795
|
-
output: exported.output,
|
|
3796
|
-
stage
|
|
3797
|
-
};
|
|
3798
|
-
} finally {
|
|
3799
|
-
await this.discardStage(exported.stage);
|
|
3800
|
-
}
|
|
3801
|
-
}
|
|
3802
|
-
const mappings = [];
|
|
3803
|
-
const queries = [];
|
|
3804
|
-
if (selected.some((file) => file.startsWith("pages/") && !knownFiles[file]))
|
|
3805
|
-
queries.push(
|
|
3806
|
-
"select 'PAGE' component_type, to_char(page_id) component_id, to_char(page_id) component_name from apex_application_pages where application_id = :p_app"
|
|
3807
|
-
);
|
|
3808
|
-
const metadata = queries.length ? await this.jsonQuery(queries.join(" union all "), connection, { p_app: env.applicationId }) : [];
|
|
3809
|
-
for (const file of selected) {
|
|
3810
|
-
const page = /^pages\/p(\d{5})/.exec(file);
|
|
3811
|
-
if (page) {
|
|
3812
|
-
const id = String(Number(page[1]));
|
|
3813
|
-
if (knownFiles[file] || metadata.some((row) => row.component_type === "PAGE" && row.component_id === id))
|
|
3814
|
-
mappings.push({ file, type: "PAGE", id });
|
|
3815
|
-
}
|
|
3816
|
-
}
|
|
3817
|
-
if (new Set(mappings.map((entry) => entry.type + ":" + entry.id)).size !== mappings.length)
|
|
3818
|
-
throw new Fault(
|
|
3819
|
-
"PARTIAL_EXPORT_AMBIGUOUS",
|
|
3820
|
-
"Multiple selected files map to one server component.",
|
|
3821
|
-
5
|
|
3822
|
-
);
|
|
3823
|
-
let output = "Selected components are absent; no previous source export required.";
|
|
3824
|
-
const outputs = [];
|
|
3825
|
-
const observed = /* @__PURE__ */ new Set();
|
|
3826
|
-
for (const [index, mapping] of mappings.entries()) {
|
|
3827
|
-
const exportDirectory = path11.join(stage, "component-" + (index + 1));
|
|
3828
|
-
await mkdir4(exportDirectory, { mode: 448 });
|
|
3829
|
-
const result = await this.session(
|
|
3830
|
-
`apex export -applicationid ${env.applicationId} -exptype APEXLANG -skipExportDate -expOriginalIds -dir ${sqlclToken(exportDirectory)} -expComponents ${sqlclToken(mapping.type + ":" + mapping.id)}`,
|
|
3831
|
-
connection,
|
|
3832
|
-
false,
|
|
3833
|
-
void 0,
|
|
3834
|
-
exportDirectory
|
|
3835
|
-
);
|
|
3836
|
-
outputs.push(result.output);
|
|
3837
|
-
const emitted = await inventory(exportDirectory);
|
|
3838
|
-
for (const [file] of Object.entries(emitted)) {
|
|
3839
|
-
if (!file.endsWith(".apx"))
|
|
3840
|
-
throw new Fault(
|
|
3841
|
-
"PARTIAL_EXPORT_SCOPE_FAILED",
|
|
3842
|
-
"Native export emitted an unexpected artifact.",
|
|
3843
|
-
5
|
|
3844
|
-
);
|
|
3845
|
-
const exportedPage = /(?:^|\/)pages\/p(\d{5})[-\w]*\.apx$/.exec(file);
|
|
3846
|
-
if (mapping.type !== "PAGE" || !exportedPage || mapping.id !== String(Number(exportedPage[1])) || observed.has(mapping.file))
|
|
3847
|
-
throw new Fault(
|
|
3848
|
-
"PARTIAL_EXPORT_SCOPE_FAILED",
|
|
3849
|
-
"Native export emitted an unselected or ambiguous page identity.",
|
|
3850
|
-
5
|
|
3851
|
-
);
|
|
3852
|
-
observed.add(mapping.file);
|
|
3853
|
-
const target = await contained(directory, mapping.file);
|
|
3854
|
-
await mkdir4(path11.dirname(target), { recursive: true, mode: 448 });
|
|
3855
|
-
await cp3(await contained(exportDirectory, file), target);
|
|
3856
|
-
}
|
|
3857
|
-
}
|
|
3858
|
-
if (outputs.length) output = outputs.join("\n");
|
|
3859
|
-
const files = await inventory(directory);
|
|
3860
|
-
return {
|
|
3861
|
-
directory,
|
|
3862
|
-
files,
|
|
3863
|
-
digest: hash(canonical(files)),
|
|
3864
|
-
format: "APEXLANG",
|
|
3865
|
-
compiler,
|
|
3866
|
-
output,
|
|
3867
|
-
stage
|
|
1296
|
+
RandomAccessReader.prototype.read = function(buffer, offset, length, position, callback) {
|
|
1297
|
+
var readStream = this.createReadStream({ start: position, end: position + length });
|
|
1298
|
+
var writeStream = new Writable();
|
|
1299
|
+
var written = 0;
|
|
1300
|
+
writeStream._write = function(chunk, encoding, cb) {
|
|
1301
|
+
chunk.copy(buffer, offset + written, 0, chunk.length);
|
|
1302
|
+
written += chunk.length;
|
|
1303
|
+
cb();
|
|
3868
1304
|
};
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
async connectionLocality(connection) {
|
|
3875
|
-
const selected = await this.selectedConnection(connection);
|
|
3876
|
-
if (selected.ords) {
|
|
3877
|
-
const host = new URL(selected.ords.url).hostname;
|
|
3878
|
-
if (!["localhost", "127.0.0.1", "[::1]"].includes(host))
|
|
3879
|
-
return { local: false, evidence: "remote-ords-endpoint" };
|
|
3880
|
-
}
|
|
3881
|
-
const endpoint = selected.ords ? { local: true, evidence: "effective-loopback-ords-endpoint" } : localConnectionEndpoint((await this.session("show connection", connection)).output);
|
|
3882
|
-
if (!endpoint.local) return endpoint;
|
|
3883
|
-
const rows = await this.jsonQuery(
|
|
3884
|
-
"select sys_context('USERENV','SERVER_HOST') server_host from dual",
|
|
3885
|
-
connection
|
|
3886
|
-
);
|
|
3887
|
-
const verified = typeof rows[0]?.server_host === "string" && await localServerHost(rows[0].server_host);
|
|
3888
|
-
return {
|
|
3889
|
-
local: verified,
|
|
3890
|
-
evidence: verified ? endpoint.evidence + "+local-server-identity" : "loopback-server-identity-unconfirmed"
|
|
1305
|
+
writeStream.on("finish", callback);
|
|
1306
|
+
readStream.on("error", function(error) {
|
|
1307
|
+
callback(error);
|
|
1308
|
+
});
|
|
1309
|
+
readStream.pipe(writeStream);
|
|
3891
1310
|
};
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
const identifier2 = /^(?:"(?:[^"]|"")+"|[A-Za-z][A-Za-z0-9_$#]*)$/;
|
|
3895
|
-
const parts = object.match(/"(?:[^"]|"")+"|[A-Za-z][A-Za-z0-9_$#]*/g) ?? [];
|
|
3896
|
-
if (!parts.length || parts.length > 2 || parts.join(".") !== object || !parts.every((part) => identifier2.test(part)))
|
|
3897
|
-
throw new Fault(
|
|
3898
|
-
"DATABASE_DEPENDENCY_UNRESOLVED",
|
|
3899
|
-
"Cannot resolve the reviewed object name for dependency inspection.",
|
|
3900
|
-
4
|
|
3901
|
-
);
|
|
3902
|
-
const value = (part) => part.startsWith('"') ? part.slice(1, -1).replaceAll('""', '"') : part.toUpperCase();
|
|
3903
|
-
if (parts.length === 2) schema = value(parts[0]);
|
|
3904
|
-
object = value(parts.at(-1));
|
|
3905
|
-
return this.jsonQuery(
|
|
3906
|
-
"select owner, name, type from all_dependencies where referenced_owner=:p_owner and referenced_name=:p_name order by owner,name,type",
|
|
3907
|
-
connection,
|
|
3908
|
-
{ p_owner: schema, p_name: object }
|
|
3909
|
-
);
|
|
3910
|
-
}
|
|
3911
|
-
async savedConnections(signal) {
|
|
3912
|
-
const marker = `APEXREST_CONNECTIONS_${randomUUID().replaceAll("-", "")}`;
|
|
3913
|
-
const result = await this.session(
|
|
3914
|
-
`prompt ${marker}_BEGIN
|
|
3915
|
-
connmgr list -flat
|
|
3916
|
-
prompt ${marker}_END`,
|
|
3917
|
-
void 0,
|
|
3918
|
-
false,
|
|
3919
|
-
signal
|
|
3920
|
-
);
|
|
3921
|
-
const lines = result.output.split(/\r?\n/).map((line) => line.trim());
|
|
3922
|
-
const start = lines.indexOf(`${marker}_BEGIN`), end = lines.indexOf(`${marker}_END`);
|
|
3923
|
-
if (start < 0 || end <= start)
|
|
3924
|
-
throw new Fault(
|
|
3925
|
-
"CONNECTION_LIST_UNCONFIRMED",
|
|
3926
|
-
"SQLcl did not return a complete saved connection list.",
|
|
3927
|
-
3
|
|
3928
|
-
);
|
|
3929
|
-
const names = [...new Set(lines.slice(start + 1, end).filter(Boolean))];
|
|
3930
|
-
return {
|
|
3931
|
-
source: "sqlcl-store",
|
|
3932
|
-
connections: names.map((name) => ({ name: parse(savedConnectionName, name) }))
|
|
1311
|
+
RandomAccessReader.prototype.close = function(callback) {
|
|
1312
|
+
setImmediate(callback);
|
|
3933
1313
|
};
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
if (ords) {
|
|
3941
|
-
if (typeof value === "string" && /[\x00-\x1f\x7f-\x9f]/.test(value))
|
|
3942
|
-
throw new Fault(
|
|
3943
|
-
"INVALID_BIND",
|
|
3944
|
-
"ORDS metadata bind values cannot contain control characters.",
|
|
3945
|
-
2
|
|
3946
|
-
);
|
|
3947
|
-
return `${declaration} = ${typeof value === "number" ? value : `'${value}'`}`;
|
|
3948
|
-
}
|
|
3949
|
-
return `${declaration}
|
|
3950
|
-
exec :${key} := ${literal};`;
|
|
3951
|
-
}).join("\n");
|
|
3952
|
-
}
|
|
3953
|
-
parseRows(output) {
|
|
3954
|
-
const start = output.indexOf("{"), end = output.lastIndexOf("}");
|
|
3955
|
-
if (start < 0) throw new Fault("EMPTY_QUERY_RESULT", "SQLcl did not return its JSON result envelope.", 1);
|
|
3956
|
-
let json;
|
|
3957
|
-
try {
|
|
3958
|
-
json = JSON.parse(output.slice(start, end + 1));
|
|
3959
|
-
} catch {
|
|
3960
|
-
throw new Fault("INVALID_ORACLE_JSON", "Cannot decode Oracle metadata result.", 1);
|
|
3961
|
-
}
|
|
3962
|
-
const resultSets = json.results;
|
|
3963
|
-
if (!Array.isArray(resultSets) || !Array.isArray(resultSets[0]?.items))
|
|
3964
|
-
throw new Fault("INVALID_ORACLE_JSON", "SQLcl result has no items collection.", 1);
|
|
3965
|
-
return resultSets[0].items;
|
|
3966
|
-
}
|
|
3967
|
-
async jsonQuery(sql, connection, bindings = {}, signal, label = "metadata-batch") {
|
|
3968
|
-
const ords = (await this.settings()).databaseTransport === "ords";
|
|
3969
|
-
const result = await this.session(
|
|
3970
|
-
`${this.bindPreamble(bindings, ords)}
|
|
3971
|
-
set sqlformat json
|
|
3972
|
-
${sql};`,
|
|
3973
|
-
connection,
|
|
3974
|
-
false,
|
|
3975
|
-
signal,
|
|
3976
|
-
void 0,
|
|
3977
|
-
"json",
|
|
3978
|
-
void 0,
|
|
3979
|
-
false,
|
|
3980
|
-
label
|
|
3981
|
-
);
|
|
3982
|
-
return this.parseRows(result.output);
|
|
3983
|
-
}
|
|
3984
|
-
/**
|
|
3985
|
-
* Several read-only queries in one SQLcl session. Each query's rows are
|
|
3986
|
-
* delimited by a private marker; a missing marker fails the whole batch and
|
|
3987
|
-
* never yields a partial result.
|
|
3988
|
-
*/
|
|
3989
|
-
async jsonQueryBatch(queries, connection, signal, label = "metadata-batch", debugTimings = false) {
|
|
3990
|
-
if (!queries.length) return [];
|
|
3991
|
-
const ords = (await this.settings()).databaseTransport === "ords";
|
|
3992
|
-
const token = `APEXREST_ROWS_${randomUUID().replaceAll("-", "")}`;
|
|
3993
|
-
const input = queries.map(
|
|
3994
|
-
(query, index) => `${this.bindPreamble(query.bindings ?? {}, ords)}
|
|
3995
|
-
set sqlformat json
|
|
3996
|
-
${debugTimings ? "set timing on\n" : ""}${query.sql};
|
|
3997
|
-
${debugTimings ? "set timing off\n" : ""}prompt ${token}_${index}`
|
|
3998
|
-
).join("\n");
|
|
3999
|
-
const result = await this.session(
|
|
4000
|
-
input,
|
|
4001
|
-
connection,
|
|
4002
|
-
false,
|
|
4003
|
-
signal,
|
|
4004
|
-
void 0,
|
|
4005
|
-
"json",
|
|
4006
|
-
void 0,
|
|
4007
|
-
false,
|
|
4008
|
-
label
|
|
4009
|
-
);
|
|
4010
|
-
const lines = result.output.replace(new RegExp(`}(?=${token}_\\d+[ \\t]*(?:\\r?\\n|$))`, "g"), "}\n").split(/\r?\n/);
|
|
4011
|
-
const rows = [];
|
|
4012
|
-
const statementMs = [];
|
|
4013
|
-
let from = 0;
|
|
4014
|
-
for (let index = 0; index < queries.length; index++) {
|
|
4015
|
-
const at2 = lines.findIndex((line, i) => i >= from && line.trim() === `${token}_${index}`);
|
|
4016
|
-
if (at2 < 0)
|
|
4017
|
-
throw new Fault("EMPTY_QUERY_RESULT", "SQLcl did not return every JSON result envelope.", 1);
|
|
4018
|
-
const block = lines.slice(from, at2).join("\n");
|
|
4019
|
-
rows.push(this.parseRows(block));
|
|
4020
|
-
if (debugTimings) statementMs.push(parseStatementMs(block));
|
|
4021
|
-
from = at2 + 1;
|
|
1314
|
+
util.inherits(RefUnrefFilter, PassThrough);
|
|
1315
|
+
function RefUnrefFilter(context) {
|
|
1316
|
+
PassThrough.call(this);
|
|
1317
|
+
this.context = context;
|
|
1318
|
+
this.context.ref();
|
|
1319
|
+
this.unreffedYet = false;
|
|
4022
1320
|
}
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
async identity(connection, signal) {
|
|
4027
|
-
const rows = await this.jsonQuery(
|
|
4028
|
-
"select sys_context('USERENV','DB_UNIQUE_NAME') db_unique_name, sys_context('USERENV','SERVICE_NAME') service_name, sys_context('USERENV','CURRENT_SCHEMA') parsing_schema from dual",
|
|
4029
|
-
connection,
|
|
4030
|
-
{},
|
|
4031
|
-
signal
|
|
4032
|
-
);
|
|
4033
|
-
if (rows.length !== 1) throw new Fault("IDENTITY_UNCONFIRMED", "Database identity was not confirmed.", 3);
|
|
4034
|
-
return rows[0];
|
|
4035
|
-
}
|
|
4036
|
-
/** Read-only release discovery, separate from identity checks for legacy callers. */
|
|
4037
|
-
async targetVersions(connection, signal) {
|
|
4038
|
-
const rows = await this.jsonQuery(targetVersionSql, connection, {}, signal);
|
|
4039
|
-
return this.parseTargetVersions(rows);
|
|
4040
|
-
}
|
|
4041
|
-
parseTargetVersions(rows) {
|
|
4042
|
-
const row = rows[0];
|
|
4043
|
-
if (rows.length !== 1 || typeof row?.apex_version !== "string" || typeof row.database_version !== "string" || !/^\d+\.\d+(?:\.\d+)*$/.test(row.apex_version) || !/^\d+\.\d+(?:\.\d+)*$/.test(row.database_version))
|
|
4044
|
-
throw new Fault(
|
|
4045
|
-
"TARGET_VERSION_UNCONFIRMED",
|
|
4046
|
-
"APEX and database releases could not be confirmed.",
|
|
4047
|
-
3,
|
|
4048
|
-
"blocked"
|
|
4049
|
-
);
|
|
4050
|
-
return { apexVersion: row.apex_version, databaseVersion: row.database_version };
|
|
4051
|
-
}
|
|
4052
|
-
async verifyTarget(env, connection, observed) {
|
|
4053
|
-
const rows = observed ?? await this.jsonQuery(
|
|
4054
|
-
targetIdentitySql,
|
|
4055
|
-
connection,
|
|
4056
|
-
{
|
|
4057
|
-
p_workspace: env.workspace,
|
|
4058
|
-
p_app_id: env.applicationId
|
|
4059
|
-
},
|
|
4060
|
-
void 0,
|
|
4061
|
-
"verifyTarget"
|
|
4062
|
-
);
|
|
4063
|
-
const identities = rows.filter((row) => row.target_record === "identity");
|
|
4064
|
-
if (identities.length !== 1)
|
|
4065
|
-
throw new Fault("IDENTITY_UNCONFIRMED", "Database identity was not confirmed.", 3);
|
|
4066
|
-
const identity = {
|
|
4067
|
-
db_unique_name: identities[0].db_unique_name,
|
|
4068
|
-
service_name: identities[0].service_name,
|
|
4069
|
-
parsing_schema: identities[0].parsing_schema
|
|
1321
|
+
RefUnrefFilter.prototype._flush = function(cb) {
|
|
1322
|
+
this.unref();
|
|
1323
|
+
cb();
|
|
4070
1324
|
};
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
5,
|
|
4076
|
-
"conflict"
|
|
4077
|
-
);
|
|
4078
|
-
const workspaces = rows.filter((row) => row.target_record === "workspace").map((row) => ({ workspace_id: row.workspace_id, workspace: row.workspace }));
|
|
4079
|
-
if (workspaces.length !== 1)
|
|
4080
|
-
throw new Fault(
|
|
4081
|
-
"WORKSPACE_UNCONFIRMED",
|
|
4082
|
-
"Configured workspace is absent or inaccessible.",
|
|
4083
|
-
4,
|
|
4084
|
-
"blocked"
|
|
4085
|
-
);
|
|
4086
|
-
const applications = rows.filter((row) => row.target_record === "application").map((row) => ({
|
|
4087
|
-
application_id: row.application_id,
|
|
4088
|
-
alias: row.alias,
|
|
4089
|
-
owner: row.owner,
|
|
4090
|
-
workspace: row.workspace
|
|
4091
|
-
}));
|
|
4092
|
-
if (applications.length > 1 || applications.some((a) => a.workspace !== env.workspace || a.owner !== env.parsingSchema))
|
|
4093
|
-
throw new Fault(
|
|
4094
|
-
"APPLICATION_TARGET_MISMATCH",
|
|
4095
|
-
"Application belongs to a different workspace or parsing schema.",
|
|
4096
|
-
5
|
|
4097
|
-
);
|
|
4098
|
-
return { identity, workspace: workspaces[0], application: applications[0] ?? null };
|
|
4099
|
-
}
|
|
4100
|
-
/** Fresh identity and versions share one read-only SQLcl session. */
|
|
4101
|
-
async versionedTarget(env, connection) {
|
|
4102
|
-
const [identity, versions] = await this.jsonQueryBatch(
|
|
4103
|
-
[
|
|
4104
|
-
{ sql: targetIdentitySql, bindings: { p_workspace: env.workspace, p_app_id: env.applicationId } },
|
|
4105
|
-
{ sql: targetVersionSql }
|
|
4106
|
-
],
|
|
4107
|
-
connection
|
|
4108
|
-
);
|
|
4109
|
-
return {
|
|
4110
|
-
target: await this.verifyTarget(env, connection, identity),
|
|
4111
|
-
versions: this.parseTargetVersions(versions)
|
|
1325
|
+
RefUnrefFilter.prototype.unref = function(cb) {
|
|
1326
|
+
if (this.unreffedYet) return;
|
|
1327
|
+
this.unreffedYet = true;
|
|
1328
|
+
this.context.unref();
|
|
4112
1329
|
};
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
);
|
|
4122
|
-
return parseApplicationMetadata(rows);
|
|
4123
|
-
}
|
|
4124
|
-
async targetWithMetadata(env, connection) {
|
|
4125
|
-
const rows = await this.jsonQueryBatch(
|
|
4126
|
-
[
|
|
4127
|
-
{ sql: targetIdentitySql, bindings: { p_workspace: env.workspace, p_app_id: env.applicationId } },
|
|
4128
|
-
{
|
|
4129
|
-
sql: applicationMetadataSql,
|
|
4130
|
-
bindings: { p_app_id: env.applicationId, p_workspace: env.workspace, p_owner: env.parsingSchema }
|
|
4131
|
-
}
|
|
4132
|
-
],
|
|
4133
|
-
connection,
|
|
4134
|
-
void 0,
|
|
4135
|
-
"targetWithMetadata"
|
|
4136
|
-
);
|
|
4137
|
-
if (rows.length !== 2)
|
|
4138
|
-
throw new Fault("EMPTY_QUERY_RESULT", "SQLcl did not answer the complete target observation.", 1);
|
|
4139
|
-
const target = await this.verifyTarget(env, connection, rows[0]);
|
|
4140
|
-
return { target, metadata: parseApplicationMetadata(rows[1]) };
|
|
4141
|
-
}
|
|
4142
|
-
async nativeDeployment(ctx, env, source) {
|
|
4143
|
-
const output = path11.join(await this.stage(), "deployment.json");
|
|
4144
|
-
const defaults = path11.join(source, "deployments/default.json");
|
|
4145
|
-
const native = await exists(defaults) ? JSON.parse(await readFile5(defaults, "utf8")) : {};
|
|
4146
|
-
const oldApp = native.app ?? {};
|
|
4147
|
-
await writeJson(output, {
|
|
4148
|
-
...native,
|
|
4149
|
-
app: {
|
|
4150
|
-
...oldApp,
|
|
4151
|
-
id: env.applicationId,
|
|
4152
|
-
alias: ctx.config.application.alias,
|
|
4153
|
-
databaseSession: { ...oldApp.databaseSession ?? {}, parsingSchema: env.parsingSchema }
|
|
4154
|
-
},
|
|
4155
|
-
workspace: { name: env.workspace }
|
|
4156
|
-
});
|
|
4157
|
-
return output;
|
|
4158
|
-
}
|
|
4159
|
-
async importApplication(ctx, env, connection, source, signal, selectedFiles) {
|
|
4160
|
-
await this.requireCapability("import", signal);
|
|
4161
|
-
if (selectedFiles !== void 0) {
|
|
4162
|
-
const settings = await this.settings();
|
|
4163
|
-
if (settings.mode !== "cli" || (settings.databaseTransport ?? "direct") !== "direct")
|
|
4164
|
-
throw new Fault(
|
|
4165
|
-
"PARTIAL_IMPORT_TRANSPORT_UNSUPPORTED",
|
|
4166
|
-
"Partial import requires direct SQLcl CLI transport.",
|
|
4167
|
-
3,
|
|
4168
|
-
"blocked"
|
|
4169
|
-
);
|
|
4170
|
-
if (!selectedFiles.length || new Set(selectedFiles).size !== selectedFiles.length)
|
|
4171
|
-
throw new Fault(
|
|
4172
|
-
"PARTIAL_IMPORT_FILES_INVALID",
|
|
4173
|
-
"Select a nonempty, unique list of APEXlang files.",
|
|
4174
|
-
2
|
|
4175
|
-
);
|
|
4176
|
-
for (const file of selectedFiles) {
|
|
4177
|
-
if (!/^[A-Za-z0-9_./-]+\.apx$/.test(file) || path11.isAbsolute(file) || file.split("/").some((part) => !part || part === "." || part === ".."))
|
|
4178
|
-
throw new Fault(
|
|
4179
|
-
"PARTIAL_IMPORT_FILES_INVALID",
|
|
4180
|
-
"Partial-import files must be literal contained APEXlang paths without globs.",
|
|
4181
|
-
2
|
|
4182
|
-
);
|
|
4183
|
-
let valid = false;
|
|
4184
|
-
try {
|
|
4185
|
-
const physical = await realpath4(await contained(source, file));
|
|
4186
|
-
valid = path11.relative(await realpath4(source), physical).replaceAll(path11.sep, "/") === file && (await stat3(physical)).isFile();
|
|
4187
|
-
} catch {
|
|
1330
|
+
var cp437 = "\0\u263A\u263B\u2665\u2666\u2663\u2660\u2022\u25D8\u25CB\u25D9\u2642\u2640\u266A\u266B\u263C\u25BA\u25C4\u2195\u203C\xB6\xA7\u25AC\u21A8\u2191\u2193\u2192\u2190\u221F\u2194\u25B2\u25BC !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u2302\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0";
|
|
1331
|
+
function decodeBuffer(buffer, isUtf8) {
|
|
1332
|
+
if (isUtf8) {
|
|
1333
|
+
return buffer.toString("utf8");
|
|
1334
|
+
} else {
|
|
1335
|
+
var result = "";
|
|
1336
|
+
for (var i = 0; i < buffer.length; i++) {
|
|
1337
|
+
result += cp437[buffer[i]];
|
|
4188
1338
|
}
|
|
4189
|
-
|
|
4190
|
-
throw new Fault(
|
|
4191
|
-
"PARTIAL_IMPORT_FILES_INVALID",
|
|
4192
|
-
"Partial-import files must be regular contained files without aliases.",
|
|
4193
|
-
2
|
|
4194
|
-
);
|
|
1339
|
+
return result;
|
|
4195
1340
|
}
|
|
4196
|
-
const help = await this.importHelp(signal);
|
|
4197
|
-
if (!/(?:^|\s)-files(?:\s|\|)/m.test(help))
|
|
4198
|
-
throw new Fault(
|
|
4199
|
-
"PARTIAL_IMPORT_UNSUPPORTED",
|
|
4200
|
-
"The selected SQLcl does not advertise apex import -files.",
|
|
4201
|
-
3,
|
|
4202
|
-
"blocked"
|
|
4203
|
-
);
|
|
4204
|
-
}
|
|
4205
|
-
const config = await this.nativeDeployment(ctx, env, source);
|
|
4206
|
-
try {
|
|
4207
|
-
return await this.importWith(env, connection, source, config, signal, selectedFiles);
|
|
4208
|
-
} finally {
|
|
4209
|
-
await this.discardStage(path11.dirname(config));
|
|
4210
1341
|
}
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
const result2 = await this.ordsBridge(
|
|
4216
|
-
{
|
|
4217
|
-
operation: "import",
|
|
4218
|
-
input: source,
|
|
4219
|
-
deployment: config,
|
|
4220
|
-
applicationId: env.applicationId,
|
|
4221
|
-
workspace: env.workspace,
|
|
4222
|
-
parsingSchema: env.parsingSchema
|
|
4223
|
-
},
|
|
4224
|
-
connection,
|
|
4225
|
-
signal
|
|
4226
|
-
);
|
|
4227
|
-
return String(result2.message ?? "Import successful");
|
|
1342
|
+
function readUInt64LE(buffer, offset) {
|
|
1343
|
+
var lower32 = buffer.readUInt32LE(offset);
|
|
1344
|
+
var upper32 = buffer.readUInt32LE(offset + 4);
|
|
1345
|
+
return upper32 * 4294967296 + lower32;
|
|
4228
1346
|
}
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
SCRIPT_RESTRICT_LEVEL,
|
|
4239
|
-
false,
|
|
4240
|
-
"import"
|
|
4241
|
-
);
|
|
4242
|
-
} catch (error) {
|
|
4243
|
-
if (error instanceof Fault && error.code === "ORACLE_COMMAND_FAILED" && !error.details)
|
|
4244
|
-
error.details = await compilerDetails(error.message, source);
|
|
4245
|
-
throw error;
|
|
1347
|
+
var newBuffer;
|
|
1348
|
+
if (typeof Buffer.allocUnsafe === "function") {
|
|
1349
|
+
newBuffer = function(len) {
|
|
1350
|
+
return Buffer.allocUnsafe(len);
|
|
1351
|
+
};
|
|
1352
|
+
} else {
|
|
1353
|
+
newBuffer = function(len) {
|
|
1354
|
+
return new Buffer(len);
|
|
1355
|
+
};
|
|
4246
1356
|
}
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
}
|
|
4256
|
-
async restoreApplication(env, connection, file, signal) {
|
|
4257
|
-
const setup = `begin
|
|
4258
|
-
apex_application_install.set_workspace(${sqlLiteral(env.workspace)});
|
|
4259
|
-
apex_application_install.set_schema(${sqlLiteral(env.parsingSchema)});
|
|
4260
|
-
apex_application_install.set_application_id(${env.applicationId});
|
|
4261
|
-
end;
|
|
4262
|
-
/
|
|
4263
|
-
`;
|
|
4264
|
-
if ((await this.settings()).databaseTransport === "ords") {
|
|
4265
|
-
await this.requireMutationSupport();
|
|
4266
|
-
const stage = await this.stage();
|
|
4267
|
-
try {
|
|
4268
|
-
const input = path11.join(stage, "restore.sql");
|
|
4269
|
-
await (await import("./chunk-A7ESH6F5.mjs")).atomicWrite(input, setup + await readFile5(file, "utf8"));
|
|
4270
|
-
return await this.ordsBridge({ operation: "script", input }, connection, signal, stage);
|
|
4271
|
-
} finally {
|
|
4272
|
-
await this.discardStage(stage);
|
|
1357
|
+
function installDestroyFn(stream, fn) {
|
|
1358
|
+
if (typeof stream.destroy === "function") {
|
|
1359
|
+
stream._destroy = function(err, cb) {
|
|
1360
|
+
fn();
|
|
1361
|
+
if (cb != null) cb(err);
|
|
1362
|
+
};
|
|
1363
|
+
} else {
|
|
1364
|
+
stream.destroy = fn;
|
|
4273
1365
|
}
|
|
4274
1366
|
}
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
connection,
|
|
4278
|
-
true,
|
|
4279
|
-
signal,
|
|
4280
|
-
void 0,
|
|
4281
|
-
"text",
|
|
4282
|
-
SCRIPT_RESTRICT_LEVEL
|
|
4283
|
-
);
|
|
4284
|
-
}
|
|
4285
|
-
};
|
|
4286
|
-
function parseCompilerDiagnostics(output) {
|
|
4287
|
-
const diagnostics = [];
|
|
4288
|
-
let current, values;
|
|
4289
|
-
const flush = () => {
|
|
4290
|
-
if (current?.file && current.type && current.message !== void 0)
|
|
4291
|
-
diagnostics.push({
|
|
4292
|
-
code: current.type,
|
|
4293
|
-
severity: "error",
|
|
4294
|
-
file: current.file,
|
|
4295
|
-
line: current.line ?? 0,
|
|
4296
|
-
column: current.column ?? 0,
|
|
4297
|
-
type: current.type,
|
|
4298
|
-
message: current.message,
|
|
4299
|
-
...values?.length ? { validValues: values } : {}
|
|
4300
|
-
});
|
|
4301
|
-
current = void 0;
|
|
4302
|
-
values = void 0;
|
|
4303
|
-
};
|
|
4304
|
-
for (const raw of output.replace(/\x1b\[[0-9;]*m/g, "").split(/\r?\n/)) {
|
|
4305
|
-
const line = raw.trimEnd();
|
|
4306
|
-
const field = line.match(/^(File|Line|Column|Type|Error):\s?(.*)$/);
|
|
4307
|
-
if (field?.[1] === "File") {
|
|
4308
|
-
flush();
|
|
4309
|
-
current = { file: field[2].trim() };
|
|
4310
|
-
} else if (!current) continue;
|
|
4311
|
-
else if (field?.[1] === "Line") current.line = Number(field[2]);
|
|
4312
|
-
else if (field?.[1] === "Column") current.column = Number(field[2]);
|
|
4313
|
-
else if (field?.[1] === "Type") current.type = field[2].trim();
|
|
4314
|
-
else if (field?.[1] === "Error") current.message = field[2].trim();
|
|
4315
|
-
else if (!line.trim()) flush();
|
|
4316
|
-
else if (current.message === void 0) continue;
|
|
4317
|
-
else {
|
|
4318
|
-
const valid = line.match(/^Valid (?:parameters|values|options) are:\s*(.*)$/i);
|
|
4319
|
-
if (valid) values = valid[1].trim() ? [valid[1].trim()] : [];
|
|
4320
|
-
else if (values && /^-\S/.test(line.trim())) values.push(line.trim().slice(1));
|
|
4321
|
-
else current.message += " " + line.trim();
|
|
4322
|
-
}
|
|
4323
|
-
}
|
|
4324
|
-
flush();
|
|
4325
|
-
return diagnostics;
|
|
4326
|
-
}
|
|
4327
|
-
async function diagnosticHint(root, diagnostic) {
|
|
4328
|
-
if (!diagnostic.line || !/^INVALID_PROPERTY|MISSING_REQUIRED|_NOT_FOUND$|INVALID_/.test(diagnostic.type))
|
|
4329
|
-
return;
|
|
4330
|
-
try {
|
|
4331
|
-
const file = await contained(root, diagnostic.file);
|
|
4332
|
-
const lines = (await readFile5(file, "utf8")).split(/\r?\n/);
|
|
4333
|
-
const indent = (text) => text.match(/^\s*/)[0].length;
|
|
4334
|
-
const open4 = /^\s*([A-Za-z][\w-]*)(?:\s+([^\s({]+))?\s*[({]\s*$/;
|
|
4335
|
-
const chain = [];
|
|
4336
|
-
let level = indent(lines[diagnostic.line - 1] ?? "");
|
|
4337
|
-
for (let i = diagnostic.line - 2; i >= 0 && chain.length < 3; i--) {
|
|
4338
|
-
const text = lines[i];
|
|
4339
|
-
if (!text.trim() || indent(text) >= level) continue;
|
|
4340
|
-
const match = text.match(open4);
|
|
4341
|
-
if (!match) continue;
|
|
4342
|
-
level = indent(text);
|
|
4343
|
-
const kind = match[1], name = match[2];
|
|
4344
|
-
let label = name ? `${kind} ${name}` : kind;
|
|
4345
|
-
if (name) {
|
|
4346
|
-
for (let j2 = i + 1; j2 < lines.length && j2 < i + 40; j2++) {
|
|
4347
|
-
const property = lines[j2].match(/^\s*type:\s*(\S+)/);
|
|
4348
|
-
if (indent(lines[j2]) <= level && lines[j2].trim()) break;
|
|
4349
|
-
if (property && indent(lines[j2]) === level + (indent(lines[i + 1] ?? "") - level || 4)) {
|
|
4350
|
-
label += ` (type: ${property[1]})`;
|
|
4351
|
-
break;
|
|
4352
|
-
}
|
|
4353
|
-
}
|
|
4354
|
-
}
|
|
4355
|
-
chain.push(label);
|
|
1367
|
+
function defaultCallback(err) {
|
|
1368
|
+
if (err) throw err;
|
|
4356
1369
|
}
|
|
4357
|
-
return chain.length ? `inside ${chain.join(" of ")}` : void 0;
|
|
4358
|
-
} catch {
|
|
4359
|
-
return;
|
|
4360
1370
|
}
|
|
4361
|
-
}
|
|
4362
|
-
async function compilerDetails(output, root) {
|
|
4363
|
-
const diagnostics = parseCompilerDiagnostics(output);
|
|
4364
|
-
if (root)
|
|
4365
|
-
for (const diagnostic of diagnostics) {
|
|
4366
|
-
const hint = await diagnosticHint(root, diagnostic);
|
|
4367
|
-
if (hint) diagnostic.hint = hint;
|
|
4368
|
-
}
|
|
4369
|
-
return diagnostics.length ? { diagnostics } : void 0;
|
|
4370
|
-
}
|
|
4371
|
-
async function compilerFault(output, root) {
|
|
4372
|
-
const details = await compilerDetails(output, root);
|
|
4373
|
-
return new Fault(
|
|
4374
|
-
details ? "VALIDATION_FAILED" : "VALIDATION_UNCONFIRMED",
|
|
4375
|
-
output.slice(0, 4e3) || "Compiler returned no success marker.",
|
|
4376
|
-
1,
|
|
4377
|
-
"failed",
|
|
4378
|
-
details
|
|
4379
|
-
);
|
|
4380
|
-
}
|
|
4381
|
-
function compilerSucceeded(output) {
|
|
4382
|
-
const success = /validat(?:ion|ed).*?(?:success|complete)|successfully.*validat|compil(?:ation|ed).*?(?:success|complete)|successfully.*compil/is.test(
|
|
4383
|
-
output
|
|
4384
|
-
);
|
|
4385
|
-
const counted = [...output.matchAll(/\b(\d+)\s+(?:errors?|failures?)\b/gi)].some(
|
|
4386
|
-
(match) => Number(match[1]) > 0
|
|
4387
|
-
);
|
|
4388
|
-
const failed = /(?:^|\n)\s*(?:error\b|errors?:)|\bwith\s+errors?\b|compile\s+errors?|\bfail(?:ed|ure)\b|\bunsuccessful\b|\bnot\s+successful\b/i.test(
|
|
4389
|
-
output
|
|
4390
|
-
);
|
|
4391
|
-
return success && !counted && !failed;
|
|
4392
|
-
}
|
|
4393
|
-
async function installSources(source, root, destination) {
|
|
4394
|
-
const target = await contained(root, destination);
|
|
4395
|
-
if (await exists(target))
|
|
4396
|
-
throw new Fault(
|
|
4397
|
-
"LOCAL_EDITS_CONFLICT",
|
|
4398
|
-
"Destination already exists; export remains in staging. Review and merge explicitly.",
|
|
4399
|
-
5,
|
|
4400
|
-
"conflict"
|
|
4401
|
-
);
|
|
4402
|
-
await mkdir4(path11.dirname(target), { recursive: true });
|
|
4403
|
-
const staging = await mkdtemp(path11.join(path11.dirname(target), ".apexrest-copy-"));
|
|
4404
|
-
await inventory(source);
|
|
4405
|
-
await cp3(source, staging, { recursive: true });
|
|
4406
|
-
await rename2(staging, target);
|
|
4407
|
-
return { directory: target, files: await inventory(target) };
|
|
4408
|
-
}
|
|
1371
|
+
});
|
|
4409
1372
|
|
|
4410
|
-
// packages/
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
}
|
|
4414
|
-
async function projectInit(directory, template, alias) {
|
|
4415
|
-
parse(refName, alias);
|
|
4416
|
-
const destination = path12.resolve(directory);
|
|
4417
|
-
await mkdir5(path12.dirname(destination), { recursive: true });
|
|
4418
|
-
return withLock(destination + ".init.lock", async () => {
|
|
4419
|
-
if (await exists(destination)) {
|
|
4420
|
-
if (!(await lstat3(destination)).isDirectory() || (await readdir3(destination)).length)
|
|
4421
|
-
throw new Fault("LOCAL_EDITS_CONFLICT", "Project init requires an empty directory.", 5, "conflict");
|
|
4422
|
-
}
|
|
4423
|
-
const root = await mkdtemp2(destination + ".init-");
|
|
4424
|
-
try {
|
|
4425
|
-
const conflict = () => new Fault(
|
|
4426
|
-
"LOCAL_EDITS_CONFLICT",
|
|
4427
|
-
"Project init requires an empty folder or a new directory. Existing files were left unchanged.",
|
|
4428
|
-
5,
|
|
4429
|
-
"conflict"
|
|
4430
|
-
);
|
|
4431
|
-
if (!await exists(root)) await mkdir5(root, { recursive: true, mode: 448 });
|
|
4432
|
-
if (!(await lstat3(root)).isDirectory() || (await readdir3(root)).length !== 0) throw conflict();
|
|
4433
|
-
const createFile = async (file, content) => {
|
|
4434
|
-
try {
|
|
4435
|
-
await writeFile(file, content, { flag: "wx", mode: 384 });
|
|
4436
|
-
} catch (error) {
|
|
4437
|
-
if (error.code === "EEXIST") throw conflict();
|
|
4438
|
-
throw error;
|
|
4439
|
-
}
|
|
4440
|
-
};
|
|
4441
|
-
const config = {
|
|
4442
|
-
schemaVersion: 1,
|
|
4443
|
-
projectId: alias,
|
|
4444
|
-
application: { sourceDir: "src/apex/" + alias, alias },
|
|
4445
|
-
database: {
|
|
4446
|
-
migrationsDir: "src/database/migrations",
|
|
4447
|
-
packagesDir: "src/database/packages"
|
|
4448
|
-
},
|
|
4449
|
-
toolchain: { lockFile: "apexrest.toolchain.lock.json" },
|
|
4450
|
-
environments: {},
|
|
4451
|
-
artifacts: { directory: ".apexrest/artifacts", retentionDays: 7 }
|
|
4452
|
-
};
|
|
4453
|
-
await createFile(path12.join(root, "apexrest.json"), JSON.stringify(config, null, 2) + "\n");
|
|
4454
|
-
await createFile(path12.join(root, ".gitignore"), ".apexrest/\nnode_modules/\n.env\n");
|
|
4455
|
-
for (const dir of Object.values(config.database))
|
|
4456
|
-
await mkdir5(path12.join(root, dir), { recursive: true });
|
|
4457
|
-
await cp4(
|
|
4458
|
-
path12.join(resourceRoot(), "toolchains/toolchain.lock.json"),
|
|
4459
|
-
path12.join(root, config.toolchain.lockFile),
|
|
4460
|
-
{ force: false, errorOnExist: true }
|
|
4461
|
-
);
|
|
4462
|
-
if (template !== "existing-app") {
|
|
4463
|
-
const generated = await new OracleAdapter().generate(alias, alias);
|
|
4464
|
-
await installSources(generated.directory, root, config.application.sourceDir);
|
|
4465
|
-
const release = await sourceRelease(path12.join(root, config.application.sourceDir));
|
|
4466
|
-
if (release === "26.2") {
|
|
4467
|
-
config.toolchain.profile = "26.2";
|
|
4468
|
-
await cp4(
|
|
4469
|
-
path12.join(resourceRoot(), "toolchains/toolchain-26.2.lock.json"),
|
|
4470
|
-
path12.join(root, config.toolchain.lockFile)
|
|
4471
|
-
);
|
|
4472
|
-
await atomicWrite(path12.join(root, "apexrest.json"), JSON.stringify(config, null, 2) + "\n");
|
|
4473
|
-
}
|
|
4474
|
-
if (template === "customer-crm") {
|
|
4475
|
-
await cp4(path12.join(resourceRoot(), "templates/customer-crm/project"), root, { recursive: true });
|
|
4476
|
-
await cp4(
|
|
4477
|
-
path12.join(
|
|
4478
|
-
resourceRoot(),
|
|
4479
|
-
"templates/customer-crm",
|
|
4480
|
-
release === "26.2" ? "apex-overlay-26.2" : "apex-overlay"
|
|
4481
|
-
),
|
|
4482
|
-
path12.join(root, config.application.sourceDir),
|
|
4483
|
-
{ recursive: true }
|
|
4484
|
-
);
|
|
4485
|
-
const { readFile: readFile6 } = await import("node:fs/promises");
|
|
4486
|
-
const file = path12.join(
|
|
4487
|
-
root,
|
|
4488
|
-
config.application.sourceDir,
|
|
4489
|
-
release === "26.2" ? "shared-components/lists/navigation-menu.apx" : "shared-components/lists.apx"
|
|
4490
|
-
);
|
|
4491
|
-
const lists = await readFile6(file, "utf8"), index = lists.lastIndexOf(")");
|
|
4492
|
-
if (index < 0 || !lists.includes("list navigation-menu ("))
|
|
4493
|
-
throw new Fault(
|
|
4494
|
-
"UNSUPPORTED_TEMPLATE",
|
|
4495
|
-
"Starter navigation does not match the reviewed fixture.",
|
|
4496
|
-
3
|
|
4497
|
-
);
|
|
4498
|
-
const entries = ["customers", "dashboard"].map(
|
|
4499
|
-
(label, i) => ` entry ${label} (
|
|
4500
|
-
label: ${label[0].toUpperCase() + label.slice(1)}
|
|
4501
|
-
layout {
|
|
4502
|
-
sequence: ${(i + 2) * 10}
|
|
4503
|
-
}
|
|
4504
|
-
link {
|
|
4505
|
-
target: {
|
|
4506
|
-
page: ${(i + 1) * 10}
|
|
4507
|
-
}
|
|
4508
|
-
}
|
|
4509
|
-
)
|
|
4510
|
-
`
|
|
4511
|
-
).join("");
|
|
4512
|
-
await atomicWrite(file, lists.slice(0, index) + entries + lists.slice(index));
|
|
4513
|
-
}
|
|
4514
|
-
}
|
|
4515
|
-
if (await exists(destination)) {
|
|
4516
|
-
if ((await readdir3(destination)).length) throw conflict();
|
|
4517
|
-
const moved = [];
|
|
4518
|
-
try {
|
|
4519
|
-
for (const entry of await readdir3(root)) {
|
|
4520
|
-
await rename3(path12.join(root, entry), path12.join(destination, entry));
|
|
4521
|
-
moved.push(entry);
|
|
4522
|
-
}
|
|
4523
|
-
} catch (error) {
|
|
4524
|
-
for (const entry of moved.reverse())
|
|
4525
|
-
await rename3(path12.join(destination, entry), path12.join(root, entry));
|
|
4526
|
-
throw error;
|
|
4527
|
-
}
|
|
4528
|
-
} else await rename3(root, destination);
|
|
4529
|
-
return {
|
|
4530
|
-
root: destination,
|
|
4531
|
-
template,
|
|
4532
|
-
configuration: config,
|
|
4533
|
-
nextActions: [
|
|
4534
|
-
"Configure explicit target identity and connection references.",
|
|
4535
|
-
"Review the target and sources; the application task authorizes its dev/QA/test import."
|
|
4536
|
-
]
|
|
4537
|
-
};
|
|
4538
|
-
} finally {
|
|
4539
|
-
await rm6(root, { recursive: true, force: true });
|
|
4540
|
-
}
|
|
4541
|
-
}).catch((error) => {
|
|
4542
|
-
if (error instanceof Fault && error.code === "LOCKED")
|
|
4543
|
-
throw new Fault(
|
|
4544
|
-
"LOCAL_EDITS_CONFLICT",
|
|
4545
|
-
"Another project initialization owns this directory.",
|
|
4546
|
-
5,
|
|
4547
|
-
"conflict"
|
|
4548
|
-
);
|
|
4549
|
-
throw error;
|
|
4550
|
-
});
|
|
4551
|
-
}
|
|
4552
|
-
function projectSummary(ctx) {
|
|
4553
|
-
const environments = Object.entries(ctx.config.environments);
|
|
4554
|
-
return {
|
|
4555
|
-
projectId: ctx.config.projectId,
|
|
4556
|
-
root: ctx.root,
|
|
4557
|
-
sourceDirectories: {
|
|
4558
|
-
apex: ctx.config.application.sourceDir,
|
|
4559
|
-
...ctx.config.database
|
|
4560
|
-
},
|
|
4561
|
-
toolchainLock: ctx.config.toolchain.lockFile,
|
|
4562
|
-
verification: "host-browser",
|
|
4563
|
-
environments: environments.slice(0, 8).map(([name, env]) => ({
|
|
4564
|
-
name,
|
|
4565
|
-
kind: env.kind,
|
|
4566
|
-
applicationId: env.applicationId,
|
|
4567
|
-
workspace: env.workspace,
|
|
4568
|
-
parsingSchema: env.parsingSchema
|
|
4569
|
-
})),
|
|
4570
|
-
environmentsOmitted: Math.max(0, environments.length - 8),
|
|
4571
|
-
targetVerified: false
|
|
4572
|
-
};
|
|
4573
|
-
}
|
|
4574
|
-
async function projectInspect(ctx, detail = "full") {
|
|
4575
|
-
return detail === "summary" ? projectSummary(ctx) : projectInventory(ctx);
|
|
4576
|
-
}
|
|
4577
|
-
async function projectInventory(ctx) {
|
|
4578
|
-
const sources = {};
|
|
4579
|
-
for (const [kind, relative] of Object.entries({
|
|
4580
|
-
apex: ctx.config.application.sourceDir,
|
|
4581
|
-
...ctx.config.database
|
|
4582
|
-
})) {
|
|
4583
|
-
const dir = await contained(ctx.root, relative);
|
|
4584
|
-
sources[kind] = await exists(dir) ? await inventory(dir) : null;
|
|
4585
|
-
}
|
|
4586
|
-
return {
|
|
4587
|
-
projectId: ctx.config.projectId,
|
|
4588
|
-
root: ctx.root,
|
|
4589
|
-
environments: Object.entries(ctx.config.environments).map(([name, env]) => ({
|
|
4590
|
-
name,
|
|
4591
|
-
kind: env.kind,
|
|
4592
|
-
applicationId: env.applicationId,
|
|
4593
|
-
workspace: env.workspace
|
|
4594
|
-
})),
|
|
4595
|
-
sources
|
|
4596
|
-
};
|
|
4597
|
-
}
|
|
1373
|
+
// packages/installer/src/toolchain.ts
|
|
1374
|
+
import path4 from "node:path";
|
|
1375
|
+
import { mkdir as mkdir3, mkdtemp as mkdtemp2, readdir, readlink, rename, rm as rm2, chmod, statfs, realpath as realpath2 } from "node:fs/promises";
|
|
4598
1376
|
|
|
4599
1377
|
// packages/installer/src/download.ts
|
|
4600
|
-
import
|
|
1378
|
+
import path from "node:path";
|
|
4601
1379
|
import http from "node:http";
|
|
4602
1380
|
import { createHash } from "node:crypto";
|
|
4603
|
-
import { lstat
|
|
1381
|
+
import { lstat, mkdir, realpath, stat } from "node:fs/promises";
|
|
4604
1382
|
var proxyVariables = ["https_proxy", "HTTPS_PROXY", "http_proxy", "HTTP_PROXY"];
|
|
4605
1383
|
var proxyApplied = false;
|
|
4606
1384
|
function proxyStatus(env = process.env, execArgv = process.execArgv) {
|
|
@@ -4627,10 +1405,10 @@ function applyEnvironmentProxy() {
|
|
|
4627
1405
|
return status;
|
|
4628
1406
|
}
|
|
4629
1407
|
async function assertPrivateCache(cache, platform = process.platform) {
|
|
4630
|
-
await
|
|
1408
|
+
await mkdir(cache, { recursive: true, mode: 448 });
|
|
4631
1409
|
if (platform === "win32") return;
|
|
4632
|
-
const physical = (await
|
|
4633
|
-
const info = await
|
|
1410
|
+
const physical = (await lstat(cache)).isSymbolicLink() ? await realpath(cache) : cache;
|
|
1411
|
+
const info = await stat(physical);
|
|
4634
1412
|
if (!info.isDirectory() || info.mode & 18 || info.uid !== process.getuid?.())
|
|
4635
1413
|
throw new Fault(
|
|
4636
1414
|
"UNSAFE_CACHE_DIRECTORY",
|
|
@@ -4662,7 +1440,7 @@ async function download(artifact, cache, offline = false, fetcher = fetch, optio
|
|
|
4662
1440
|
if (!/^[a-f0-9]{64}$/.test(artifact.sha256) || /(?:latest|main)(?:[./?]|$)/.test(artifact.url))
|
|
4663
1441
|
throw new Fault("UNPINNED_ARTIFACT", "Downloads require an immutable version URL and SHA-256.", 2);
|
|
4664
1442
|
await assertPrivateCache(cache);
|
|
4665
|
-
const file =
|
|
1443
|
+
const file = path.join(cache, artifact.sha256);
|
|
4666
1444
|
if (await exists(file)) {
|
|
4667
1445
|
if (await hashFile(file) !== artifact.sha256)
|
|
4668
1446
|
throw new Fault(
|
|
@@ -4726,7 +1504,7 @@ async function download(artifact, cache, offline = false, fetcher = fetch, optio
|
|
|
4726
1504
|
const reader = response.body.getReader();
|
|
4727
1505
|
async function* verifiedChunks() {
|
|
4728
1506
|
let size = 0;
|
|
4729
|
-
const
|
|
1507
|
+
const digest = createHash("sha256");
|
|
4730
1508
|
for (; ; ) {
|
|
4731
1509
|
let chunk;
|
|
4732
1510
|
try {
|
|
@@ -4743,10 +1521,10 @@ async function download(artifact, cache, offline = false, fetcher = fetch, optio
|
|
|
4743
1521
|
if (chunk.done) break;
|
|
4744
1522
|
size += chunk.value.length;
|
|
4745
1523
|
if (size > 512 * 1024 * 1024) throw new Fault("DOWNLOAD_LIMIT", "Download exceeds 512 MiB.", 3);
|
|
4746
|
-
|
|
1524
|
+
digest.update(chunk.value);
|
|
4747
1525
|
yield chunk.value;
|
|
4748
1526
|
}
|
|
4749
|
-
if (
|
|
1527
|
+
if (digest.digest("hex") !== artifact.sha256)
|
|
4750
1528
|
throw new Fault(
|
|
4751
1529
|
"INTEGRITY_FAILURE",
|
|
4752
1530
|
"Download SHA-256 does not match the trusted lock. Nothing was executed.",
|
|
@@ -4776,8 +1554,8 @@ async function download(artifact, cache, offline = false, fetcher = fetch, optio
|
|
|
4776
1554
|
}
|
|
4777
1555
|
|
|
4778
1556
|
// packages/installer/src/archive.ts
|
|
4779
|
-
import
|
|
4780
|
-
import { mkdir as
|
|
1557
|
+
import path2 from "node:path";
|
|
1558
|
+
import { mkdir as mkdir2, mkdtemp, lstat as lstat2, rm, symlink, link } from "node:fs/promises";
|
|
4781
1559
|
import { createReadStream, createWriteStream } from "node:fs";
|
|
4782
1560
|
import { createHash as createHash2 } from "node:crypto";
|
|
4783
1561
|
import { pipeline } from "node:stream/promises";
|
|
@@ -7765,10 +4543,10 @@ function archivePath(name) {
|
|
|
7765
4543
|
return clean;
|
|
7766
4544
|
}
|
|
7767
4545
|
function entryKey(clean) {
|
|
7768
|
-
return
|
|
4546
|
+
return path2.posix.normalize(clean).replace(/\/$/, "");
|
|
7769
4547
|
}
|
|
7770
4548
|
async function extractArchive(file, target, type, allowLinks = false) {
|
|
7771
|
-
await
|
|
4549
|
+
await mkdir2(target, { recursive: true, mode: 448 });
|
|
7772
4550
|
let total = 0, count = 0;
|
|
7773
4551
|
const seen = /* @__PURE__ */ new Set();
|
|
7774
4552
|
const check = (name, size) => {
|
|
@@ -7798,12 +4576,12 @@ async function extractArchive(file, target, type, allowLinks = false) {
|
|
|
7798
4576
|
if (!allowLinks)
|
|
7799
4577
|
throw new Fault("UNSAFE_ARCHIVE", "Links are not allowed in native packages.", 2);
|
|
7800
4578
|
if (!entry.linkpath) throw new Fault("UNSAFE_ARCHIVE", "Link has no target.", 2);
|
|
7801
|
-
const linkTarget = entry.type === "Link" ? entry.linkpath :
|
|
7802
|
-
if (
|
|
4579
|
+
const linkTarget = entry.type === "Link" ? entry.linkpath : path2.posix.join(path2.posix.dirname(name), entry.linkpath);
|
|
4580
|
+
if (path2.isAbsolute(entry.linkpath))
|
|
7803
4581
|
throw new Fault("UNSAFE_ARCHIVE", "Absolute link target.", 2);
|
|
7804
4582
|
links.push({
|
|
7805
4583
|
name: entryKey(name),
|
|
7806
|
-
target: entryKey(archivePath(
|
|
4584
|
+
target: entryKey(archivePath(path2.posix.normalize(linkTarget))),
|
|
7807
4585
|
hard: entry.type === "Link"
|
|
7808
4586
|
});
|
|
7809
4587
|
} else if (!["File", "Directory", "OldFile", "ExtendedHeader", "GlobalExtendedHeader"].includes(entry.type))
|
|
@@ -7832,14 +4610,14 @@ async function extractArchive(file, target, type, allowLinks = false) {
|
|
|
7832
4610
|
for (const entry of pending) {
|
|
7833
4611
|
const destination = await contained(target, entry.name), source = await contained(target, entry.target);
|
|
7834
4612
|
try {
|
|
7835
|
-
await
|
|
4613
|
+
await lstat2(source);
|
|
7836
4614
|
} catch {
|
|
7837
4615
|
remaining.push(entry);
|
|
7838
4616
|
continue;
|
|
7839
4617
|
}
|
|
7840
|
-
await
|
|
4618
|
+
await mkdir2(path2.dirname(destination), { recursive: true });
|
|
7841
4619
|
if (entry.hard) await link(source, destination);
|
|
7842
|
-
else await symlink(
|
|
4620
|
+
else await symlink(path2.relative(path2.dirname(destination), source), destination);
|
|
7843
4621
|
}
|
|
7844
4622
|
if (remaining.length === pending.length)
|
|
7845
4623
|
throw new Fault("UNSAFE_ARCHIVE", "Archive link target is missing or cyclic.", 2);
|
|
@@ -7866,9 +4644,9 @@ async function extractArchive(file, target, type, allowLinks = false) {
|
|
|
7866
4644
|
if ((mode & 61440) === 40960 || entry.generalPurposeBitFlag & 1)
|
|
7867
4645
|
throw new Fault("UNSAFE_ARCHIVE", "Encrypted entries and symlinks are not accepted.", 2);
|
|
7868
4646
|
const destination = await contained(target, name || ".");
|
|
7869
|
-
if (!name || name.endsWith("/")) await
|
|
4647
|
+
if (!name || name.endsWith("/")) await mkdir2(destination, { recursive: true, mode: 448 });
|
|
7870
4648
|
else {
|
|
7871
|
-
await
|
|
4649
|
+
await mkdir2(path2.dirname(destination), { recursive: true, mode: 448 });
|
|
7872
4650
|
const stream = await new Promise(
|
|
7873
4651
|
(res, rej) => zip.openReadStream(entry, (e, s3) => e || !s3 ? rej(e) : res(s3))
|
|
7874
4652
|
);
|
|
@@ -7884,23 +4662,23 @@ async function extractArchive(file, target, type, allowLinks = false) {
|
|
|
7884
4662
|
});
|
|
7885
4663
|
});
|
|
7886
4664
|
}
|
|
7887
|
-
async function extractVerifiedArchive(file, sha256, target, type, allowLinks = false, privateRoot =
|
|
7888
|
-
await
|
|
7889
|
-
const directory = await
|
|
4665
|
+
async function extractVerifiedArchive(file, sha256, target, type, allowLinks = false, privateRoot = path2.dirname(target)) {
|
|
4666
|
+
await mkdir2(privateRoot, { recursive: true, mode: 448 });
|
|
4667
|
+
const directory = await mkdtemp(path2.join(privateRoot, ".archive-"));
|
|
7890
4668
|
try {
|
|
7891
|
-
const copy =
|
|
7892
|
-
const
|
|
4669
|
+
const copy = path2.join(directory, "archive");
|
|
4670
|
+
const digest = createHash2("sha256");
|
|
7893
4671
|
await pipeline(
|
|
7894
4672
|
createReadStream(file),
|
|
7895
4673
|
async function* (source) {
|
|
7896
4674
|
for await (const chunk of source) {
|
|
7897
|
-
|
|
4675
|
+
digest.update(chunk);
|
|
7898
4676
|
yield chunk;
|
|
7899
4677
|
}
|
|
7900
4678
|
},
|
|
7901
4679
|
createWriteStream(copy, { flags: "wx", mode: 384 })
|
|
7902
4680
|
);
|
|
7903
|
-
if (
|
|
4681
|
+
if (digest.digest("hex") !== sha256)
|
|
7904
4682
|
throw new Fault(
|
|
7905
4683
|
"INTEGRITY_FAILURE",
|
|
7906
4684
|
"Archive SHA-256 changed after verification. Nothing was extracted.",
|
|
@@ -7909,18 +4687,18 @@ async function extractVerifiedArchive(file, sha256, target, type, allowLinks = f
|
|
|
7909
4687
|
);
|
|
7910
4688
|
await extractArchive(copy, target, type, allowLinks);
|
|
7911
4689
|
} finally {
|
|
7912
|
-
await
|
|
4690
|
+
await rm(directory, { recursive: true, force: true });
|
|
7913
4691
|
}
|
|
7914
4692
|
}
|
|
7915
4693
|
|
|
7916
4694
|
// packages/installer/src/command.ts
|
|
7917
|
-
import
|
|
7918
|
-
import { stat as
|
|
4695
|
+
import path3 from "node:path";
|
|
4696
|
+
import { stat as stat2 } from "node:fs/promises";
|
|
7919
4697
|
var windowsExtensions = [".exe", ".cmd", ".bat"];
|
|
7920
4698
|
var cmdUnsafe = /[&|<>^%"!\x00-\x1f]/;
|
|
7921
4699
|
async function isFile(file) {
|
|
7922
4700
|
try {
|
|
7923
|
-
return (await
|
|
4701
|
+
return (await stat2(file)).isFile();
|
|
7924
4702
|
} catch {
|
|
7925
4703
|
return false;
|
|
7926
4704
|
}
|
|
@@ -7933,12 +4711,12 @@ async function searchPath(name, host = {}) {
|
|
|
7933
4711
|
const platform = host.platform ?? process.platform, env = host.env ?? process.env;
|
|
7934
4712
|
const windows = platform === "win32";
|
|
7935
4713
|
const pathValue = (windows ? env.Path ?? env.PATH ?? env.path : env.PATH) ?? "";
|
|
7936
|
-
const suffixes = windows ? windowsExtensions.includes(
|
|
7937
|
-
for (const directory of pathValue.split(windows ? ";" :
|
|
4714
|
+
const suffixes = windows ? windowsExtensions.includes(path3.extname(name).toLowerCase()) ? [""] : windowsSuffixes(env) : [""];
|
|
4715
|
+
for (const directory of pathValue.split(windows ? ";" : path3.delimiter)) {
|
|
7938
4716
|
const entry = directory.trim().replace(/^"(.*)"$/, "$1");
|
|
7939
|
-
if (!entry || !(
|
|
4717
|
+
if (!entry || !(path3.isAbsolute(entry) || path3.win32.isAbsolute(entry))) continue;
|
|
7940
4718
|
for (const suffix of suffixes) {
|
|
7941
|
-
const candidate =
|
|
4719
|
+
const candidate = path3.join(entry, name + suffix);
|
|
7942
4720
|
if (await isFile(candidate)) return candidate;
|
|
7943
4721
|
}
|
|
7944
4722
|
}
|
|
@@ -7957,17 +4735,22 @@ function cmdQuote(value) {
|
|
|
7957
4735
|
async function resolveCommand(command, args, host = {}) {
|
|
7958
4736
|
const platform = host.platform ?? process.platform, env = host.env ?? process.env;
|
|
7959
4737
|
if (platform !== "win32") return { executable: command, args, verbatim: false };
|
|
7960
|
-
|
|
7961
|
-
if (/[\\/]/.test(command) || path15.win32.isAbsolute(command)) {
|
|
7962
|
-
const extension = path15.extname(command).toLowerCase();
|
|
7963
|
-
for (const suffix of windowsExtensions.includes(extension) ? [""] : windowsSuffixes(env))
|
|
7964
|
-
if (await isFile(command + suffix)) {
|
|
7965
|
-
resolved = command + suffix;
|
|
7966
|
-
break;
|
|
7967
|
-
}
|
|
7968
|
-
} else resolved = await searchPath(command, { platform, env });
|
|
4738
|
+
const resolved = await locateCommand(command, { platform, env });
|
|
7969
4739
|
if (!resolved) return { executable: command, args, verbatim: false };
|
|
7970
|
-
|
|
4740
|
+
return batchCommand(resolved, args, env);
|
|
4741
|
+
}
|
|
4742
|
+
async function locateCommand(command, host = {}) {
|
|
4743
|
+
const platform = host.platform ?? process.platform, env = host.env ?? process.env;
|
|
4744
|
+
if (/[\\/]/.test(command) || path3.win32.isAbsolute(command)) {
|
|
4745
|
+
const extension = path3.extname(command).toLowerCase();
|
|
4746
|
+
for (const suffix of windowsExtensions.includes(extension) ? [""] : windowsSuffixes(env))
|
|
4747
|
+
if (await isFile(command + suffix)) return command + suffix;
|
|
4748
|
+
return void 0;
|
|
4749
|
+
}
|
|
4750
|
+
return searchPath(command, { platform, env });
|
|
4751
|
+
}
|
|
4752
|
+
function batchCommand(resolved, args, env = process.env) {
|
|
4753
|
+
if (![".cmd", ".bat"].includes(path3.extname(resolved).toLowerCase()))
|
|
7971
4754
|
return { executable: resolved, args, verbatim: false };
|
|
7972
4755
|
const line = [resolved, ...args].map(cmdQuote).join(" ");
|
|
7973
4756
|
return {
|
|
@@ -8008,18 +4791,18 @@ var lockSchema = external_exports.strictObject({
|
|
|
8008
4791
|
provenance: external_exports.record(external_exports.string(), external_exports.unknown())
|
|
8009
4792
|
});
|
|
8010
4793
|
async function canonicalHome(home) {
|
|
8011
|
-
let existing =
|
|
4794
|
+
let existing = path4.resolve(home);
|
|
8012
4795
|
const rest = [];
|
|
8013
4796
|
while (!await exists(existing)) {
|
|
8014
|
-
const parent =
|
|
4797
|
+
const parent = path4.dirname(existing);
|
|
8015
4798
|
if (parent === existing) break;
|
|
8016
|
-
rest.unshift(
|
|
4799
|
+
rest.unshift(path4.basename(existing));
|
|
8017
4800
|
existing = parent;
|
|
8018
4801
|
}
|
|
8019
|
-
return
|
|
4802
|
+
return path4.join(await realpath2(existing), ...rest);
|
|
8020
4803
|
}
|
|
8021
4804
|
async function runtimeState(home = managedHome()) {
|
|
8022
|
-
const file =
|
|
4805
|
+
const file = path4.join(home, "runtime.json");
|
|
8023
4806
|
return await exists(file) ? await readJson(file) : { schemaVersion: 1, components: {} };
|
|
8024
4807
|
}
|
|
8025
4808
|
function platformProfile(os2 = process.platform, arch = process.arch) {
|
|
@@ -8038,13 +4821,13 @@ function platformProfile(os2 = process.platform, arch = process.arch) {
|
|
|
8038
4821
|
}
|
|
8039
4822
|
async function findExecutable(name) {
|
|
8040
4823
|
const found = await searchPath(name);
|
|
8041
|
-
return found ?
|
|
4824
|
+
return found ? realpath2(found) : void 0;
|
|
8042
4825
|
}
|
|
8043
4826
|
async function treeDigest(root) {
|
|
8044
4827
|
const entries = [];
|
|
8045
4828
|
async function walk(directory) {
|
|
8046
|
-
for (const entry of await
|
|
8047
|
-
const file =
|
|
4829
|
+
for (const entry of await readdir(directory, { withFileTypes: true })) {
|
|
4830
|
+
const file = path4.join(directory, entry.name), name = path4.relative(root, file).split(path4.sep).join("/");
|
|
8048
4831
|
if (entry.isSymbolicLink()) entries.push([name, "link:" + await readlink(file)]);
|
|
8049
4832
|
else if (entry.isDirectory()) await walk(file);
|
|
8050
4833
|
else if (entry.isFile()) entries.push([name, "file:" + await hashFile(file)]);
|
|
@@ -8058,7 +4841,7 @@ async function treeDigest(root) {
|
|
|
8058
4841
|
async function renameWithRetry(from, to2, platform = process.platform, attempts = 6) {
|
|
8059
4842
|
for (let attempt = 1; ; attempt++) {
|
|
8060
4843
|
try {
|
|
8061
|
-
await
|
|
4844
|
+
await rename(from, to2);
|
|
8062
4845
|
return;
|
|
8063
4846
|
} catch (error) {
|
|
8064
4847
|
const code = error.code;
|
|
@@ -8071,7 +4854,7 @@ async function renameWithRetry(from, to2, platform = process.platform, attempts
|
|
|
8071
4854
|
async function moveAside(destination) {
|
|
8072
4855
|
const broken = `${destination}.broken-${Date.now()}`;
|
|
8073
4856
|
await renameWithRetry(destination, broken);
|
|
8074
|
-
await
|
|
4857
|
+
await rm2(broken, { recursive: true, force: true }).catch(() => {
|
|
8075
4858
|
});
|
|
8076
4859
|
}
|
|
8077
4860
|
async function intactInstallation(destination, executable, recorded) {
|
|
@@ -8086,11 +4869,11 @@ async function intactInstallation(destination, executable, recorded) {
|
|
|
8086
4869
|
}
|
|
8087
4870
|
async function installArtifact(artifact, destination, cache, offline) {
|
|
8088
4871
|
const file = await download(artifact, cache, offline);
|
|
8089
|
-
await
|
|
8090
|
-
const staging = await
|
|
4872
|
+
await mkdir3(path4.dirname(destination), { recursive: true, mode: 448 });
|
|
4873
|
+
const staging = await mkdtemp2(destination + ".staging-");
|
|
8091
4874
|
try {
|
|
8092
4875
|
await extractVerifiedArchive(file, artifact.sha256, staging, artifact.type, artifact.id !== "sqlcl");
|
|
8093
|
-
if (!await exists(
|
|
4876
|
+
if (!await exists(path4.join(staging, artifact.executable)))
|
|
8094
4877
|
throw new Fault(
|
|
8095
4878
|
"ARTIFACT_LAYOUT_MISMATCH",
|
|
8096
4879
|
"Vendor executable is missing from the locked archive layout.",
|
|
@@ -8098,7 +4881,7 @@ async function installArtifact(artifact, destination, cache, offline) {
|
|
|
8098
4881
|
);
|
|
8099
4882
|
await renameWithRetry(staging, destination);
|
|
8100
4883
|
} finally {
|
|
8101
|
-
await
|
|
4884
|
+
await rm2(staging, { recursive: true, force: true });
|
|
8102
4885
|
}
|
|
8103
4886
|
}
|
|
8104
4887
|
var ToolchainService = class {
|
|
@@ -8109,13 +4892,13 @@ var ToolchainService = class {
|
|
|
8109
4892
|
const platform = platformProfile();
|
|
8110
4893
|
const lock = parse(
|
|
8111
4894
|
lockSchema,
|
|
8112
|
-
await readJson(
|
|
4895
|
+
await readJson(path4.join(resourceRoot(), "toolchains/toolchain.lock.json"))
|
|
8113
4896
|
);
|
|
8114
|
-
const home = await canonicalHome(r.home ?? managedHome()), cache =
|
|
4897
|
+
const home = await canonicalHome(r.home ?? managedHome()), cache = path4.resolve(r.cacheDir ?? path4.join(home, "cache"));
|
|
8115
4898
|
const artifacts = lock.artifacts.filter((a) => a.os === platform.os && a.arch === platform.arch);
|
|
8116
4899
|
const steps = await Promise.all(
|
|
8117
4900
|
artifacts.map(async (artifact) => {
|
|
8118
|
-
const candidate = artifact.id === "node" ? process.execPath : artifact.id === "sqlcl" ? process.env.APEXREST_SQLCL ?? await findExecutable("sql") : process.env.APEXREST_JAVA_HOME ?
|
|
4901
|
+
const candidate = artifact.id === "node" ? process.execPath : artifact.id === "sqlcl" ? process.env.APEXREST_SQLCL ?? await findExecutable("sql") : process.env.APEXREST_JAVA_HOME ? path4.join(
|
|
8119
4902
|
process.env.APEXREST_JAVA_HOME,
|
|
8120
4903
|
"bin",
|
|
8121
4904
|
process.platform === "win32" ? "java.exe" : "java"
|
|
@@ -8136,13 +4919,13 @@ var ToolchainService = class {
|
|
|
8136
4919
|
} catch {
|
|
8137
4920
|
}
|
|
8138
4921
|
}
|
|
8139
|
-
const destination =
|
|
4922
|
+
const destination = path4.join(home, "toolchains", artifact.id, artifact.version);
|
|
8140
4923
|
return {
|
|
8141
4924
|
artifact,
|
|
8142
4925
|
destination,
|
|
8143
4926
|
reuse,
|
|
8144
4927
|
...candidate && r.dryRun ? { candidate, candidateStatus: "found, not probed" } : {},
|
|
8145
|
-
action: reuse ? "reuse" : await exists(
|
|
4928
|
+
action: reuse ? "reuse" : await exists(path4.join(destination, artifact.executable)) ? "verify" : "download-install",
|
|
8146
4929
|
consent: artifact.consentRequired && !r.acceptOracleLicense && !reuse ? "required" : "not-required"
|
|
8147
4930
|
};
|
|
8148
4931
|
})
|
|
@@ -8168,16 +4951,16 @@ var ToolchainService = class {
|
|
|
8168
4951
|
4,
|
|
8169
4952
|
"needs-user-action"
|
|
8170
4953
|
);
|
|
8171
|
-
await
|
|
4954
|
+
await mkdir3(plan.home, { recursive: true, mode: 448 });
|
|
8172
4955
|
const disk = await statfs(plan.home);
|
|
8173
4956
|
if (disk.bavail * disk.bsize < 1024 * 1024 * 1024)
|
|
8174
4957
|
throw new Fault("INSUFFICIENT_DISK", "At least 1 GiB of free local space is required.", 3);
|
|
8175
|
-
return withLock(
|
|
4958
|
+
return withLock(path4.join(plan.home, "toolchain.lock"), async () => {
|
|
8176
4959
|
const state = await runtimeState(plan.home);
|
|
8177
4960
|
const actions = [];
|
|
8178
4961
|
for (const step of plan.steps) {
|
|
8179
4962
|
const artifact = step.artifact;
|
|
8180
|
-
const executable = step.reuse ??
|
|
4963
|
+
const executable = step.reuse ?? path4.join(step.destination, artifact.executable);
|
|
8181
4964
|
const intact = Boolean(step.reuse) || await intactInstallation(step.destination, executable, state.integrity?.[artifact.id]);
|
|
8182
4965
|
if (!intact && step.consent === "required") {
|
|
8183
4966
|
state.components[artifact.id] = "needs-consent";
|
|
@@ -8192,8 +4975,8 @@ var ToolchainService = class {
|
|
|
8192
4975
|
if (await exists(step.destination)) await moveAside(step.destination);
|
|
8193
4976
|
await installArtifact(artifact, step.destination, plan.cache, r.offline);
|
|
8194
4977
|
}
|
|
8195
|
-
if (process.platform !== "win32" && !step.reuse) await
|
|
8196
|
-
const javaHome = state.java ?
|
|
4978
|
+
if (process.platform !== "win32" && !step.reuse) await chmod(executable, 448);
|
|
4979
|
+
const javaHome = state.java ? path4.dirname(path4.dirname(state.java)) : void 0;
|
|
8197
4980
|
const result = await runProcess({
|
|
8198
4981
|
executable,
|
|
8199
4982
|
args: artifact.id === "node" ? ["--version"] : ["-version"],
|
|
@@ -8217,9 +5000,9 @@ var ToolchainService = class {
|
|
|
8217
5000
|
treeSha256: await treeDigest(step.destination)
|
|
8218
5001
|
}
|
|
8219
5002
|
};
|
|
8220
|
-
await writeJson(
|
|
5003
|
+
await writeJson(path4.join(plan.home, "runtime.json"), state);
|
|
8221
5004
|
}
|
|
8222
|
-
await writeJson(
|
|
5005
|
+
await writeJson(path4.join(plan.home, "runtime.json"), state);
|
|
8223
5006
|
return {
|
|
8224
5007
|
schemaVersion: 1,
|
|
8225
5008
|
status: actions.length ? "needs-user-action" : "toolchain-verified",
|
|
@@ -8232,53 +5015,8 @@ var ToolchainService = class {
|
|
|
8232
5015
|
};
|
|
8233
5016
|
|
|
8234
5017
|
export {
|
|
8235
|
-
|
|
8236
|
-
|
|
8237
|
-
ordsUsername,
|
|
8238
|
-
connections,
|
|
8239
|
-
resolveConnection,
|
|
8240
|
-
editConnection,
|
|
8241
|
-
configureConnection,
|
|
8242
|
-
sqlclMode,
|
|
8243
|
-
sqlclRestriction,
|
|
8244
|
-
databaseTransport,
|
|
8245
|
-
sqlclConfig,
|
|
8246
|
-
configureSqlcl,
|
|
8247
|
-
coordination,
|
|
8248
|
-
LocalDeploymentControl,
|
|
8249
|
-
VERSION,
|
|
8250
|
-
syncPath,
|
|
8251
|
-
privateCopy,
|
|
8252
|
-
checkSnapshot,
|
|
8253
|
-
checkSyncBackup,
|
|
8254
|
-
checkpoint,
|
|
8255
|
-
SyncStore,
|
|
8256
|
-
APEXLANG_EQUIVALENCE_POLICY,
|
|
8257
|
-
compareApplicationExports,
|
|
8258
|
-
importSelectionSchema,
|
|
8259
|
-
importOptions,
|
|
8260
|
-
sourceRelease,
|
|
8261
|
-
supportedFile,
|
|
8262
|
-
scopedExportFile,
|
|
8263
|
-
pickFiles,
|
|
8264
|
-
overlaySelection,
|
|
8265
|
-
changedFiles,
|
|
8266
|
-
selectImport,
|
|
8267
|
-
persistSnapshot,
|
|
8268
|
-
stageSelection,
|
|
8269
|
-
rebaseAfterImport,
|
|
8270
|
-
resourceRoot,
|
|
8271
|
-
projectInit,
|
|
8272
|
-
projectInspect,
|
|
8273
|
-
APEX_262_PROFILE,
|
|
8274
|
-
databaseMeetsApex262Minimum,
|
|
8275
|
-
auditUpgradeSource,
|
|
8276
|
-
targetIdentitySql,
|
|
8277
|
-
sqlclToken,
|
|
8278
|
-
SCRIPT_RESTRICT_LEVEL,
|
|
8279
|
-
OracleAdapter,
|
|
8280
|
-
installSources,
|
|
8281
|
-
oracle_exports,
|
|
5018
|
+
locateCommand,
|
|
5019
|
+
batchCommand,
|
|
8282
5020
|
runCommand,
|
|
8283
5021
|
lockSchema,
|
|
8284
5022
|
canonicalHome,
|