@ojiepermana/angular 22.1.11 → 22.1.13
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 +32 -26
- package/chart/README.md +272 -0
- package/component/README.md +89 -0
- package/component/accordion/README.md +195 -0
- package/component/alert/README.md +184 -0
- package/component/alert-dialog/README.md +255 -0
- package/component/aspect-ratio/README.md +116 -0
- package/component/avatar/README.md +182 -0
- package/component/badge/README.md +143 -0
- package/component/breadcrumb/README.md +223 -0
- package/component/button/README.md +141 -0
- package/component/button-group/README.md +214 -0
- package/component/calendar/README.md +137 -0
- package/component/card/README.md +232 -0
- package/component/carousel/README.md +276 -0
- package/component/checkbox/README.md +153 -0
- package/component/collapsible/README.md +216 -0
- package/component/combobox/README.md +202 -0
- package/component/command/README.md +287 -0
- package/component/composer/README.md +241 -0
- package/component/context-menu/README.md +268 -0
- package/component/date-picker/README.md +202 -0
- package/component/dialog/README.md +276 -0
- package/component/drawer/README.md +147 -0
- package/component/dropdown-menu/README.md +336 -0
- package/component/editor/README.md +152 -0
- package/component/empty/README.md +193 -0
- package/component/form/README.md +216 -0
- package/component/hover-card/README.md +150 -0
- package/component/icon/README.md +25 -0
- package/component/input/README.md +160 -0
- package/component/input-group/README.md +245 -0
- package/component/input-otp/README.md +331 -0
- package/component/item/README.md +254 -0
- package/component/kanban/README.md +81 -0
- package/component/kbd/README.md +141 -0
- package/component/label/README.md +137 -0
- package/component/menubar/README.md +270 -0
- package/component/native-select/README.md +176 -0
- package/component/navigation-menu/README.md +165 -0
- package/component/pagination/README.md +151 -0
- package/component/pillbox/README.md +68 -0
- package/component/popover/README.md +54 -0
- package/component/progress/README.md +160 -0
- package/component/radio/README.md +212 -0
- package/component/resizable/README.md +178 -0
- package/component/scroll-area/README.md +150 -0
- package/component/select/README.md +228 -0
- package/component/separator/README.md +175 -0
- package/component/sheet/README.md +190 -0
- package/component/skeleton/README.md +158 -0
- package/component/slider/README.md +207 -0
- package/component/spinner/README.md +160 -0
- package/component/switch/README.md +170 -0
- package/component/table/README.md +292 -0
- package/component/tabs/README.md +220 -0
- package/component/textarea/README.md +169 -0
- package/component/timeline/README.md +94 -0
- package/component/toast/README.md +173 -0
- package/component/toggle/README.md +133 -0
- package/component/toggle-group/README.md +234 -0
- package/component/tooltip/README.md +230 -0
- package/fesm2022/ojiepermana-angular-chart-area.mjs +289 -3
- package/fesm2022/ojiepermana-angular-chart-bar.mjs +722 -3
- package/fesm2022/ojiepermana-angular-chart-core.mjs +1482 -3
- package/fesm2022/ojiepermana-angular-chart-line.mjs +294 -3
- package/fesm2022/ojiepermana-angular-chart-pie.mjs +291 -3
- package/fesm2022/ojiepermana-angular-chart-primitives.mjs +1301 -3
- package/fesm2022/ojiepermana-angular-chart-radar.mjs +421 -3
- package/fesm2022/ojiepermana-angular-chart-radial.mjs +295 -3
- package/fesm2022/ojiepermana-angular-chart-scatter.mjs +306 -3
- package/fesm2022/ojiepermana-angular-chart.mjs +12 -3
- package/fesm2022/ojiepermana-angular-component-accordion.mjs +267 -3
- package/fesm2022/ojiepermana-angular-component-alert-dialog.mjs +359 -3
- package/fesm2022/ojiepermana-angular-component-alert.mjs +101 -3
- package/fesm2022/ojiepermana-angular-component-aspect-ratio.mjs +31 -3
- package/fesm2022/ojiepermana-angular-component-avatar.mjs +139 -3
- package/fesm2022/ojiepermana-angular-component-badge.mjs +57 -3
- package/fesm2022/ojiepermana-angular-component-breadcrumb.mjs +192 -3
- package/fesm2022/ojiepermana-angular-component-button-group.mjs +95 -3
- package/fesm2022/ojiepermana-angular-component-button.mjs +73 -3
- package/fesm2022/ojiepermana-angular-component-calendar.mjs +718 -3
- package/fesm2022/ojiepermana-angular-component-card.mjs +167 -3
- package/fesm2022/ojiepermana-angular-component-carousel.mjs +326 -3
- package/fesm2022/ojiepermana-angular-component-checkbox.mjs +190 -3
- package/fesm2022/ojiepermana-angular-component-collapsible.mjs +117 -3
- package/fesm2022/ojiepermana-angular-component-combobox.mjs +327 -3
- package/fesm2022/ojiepermana-angular-component-command.mjs +351 -3
- package/fesm2022/ojiepermana-angular-component-composer.mjs +359 -3
- package/fesm2022/ojiepermana-angular-component-context-menu.mjs +158 -3
- package/fesm2022/ojiepermana-angular-component-date-picker.mjs +482 -3
- package/fesm2022/ojiepermana-angular-component-dialog.mjs +400 -3
- package/fesm2022/ojiepermana-angular-component-drawer.mjs +1 -3
- package/fesm2022/ojiepermana-angular-component-dropdown-menu.mjs +689 -3
- package/fesm2022/ojiepermana-angular-component-editor.mjs +511 -3
- package/fesm2022/ojiepermana-angular-component-empty.mjs +134 -3
- package/fesm2022/ojiepermana-angular-component-form.mjs +438 -3
- package/fesm2022/ojiepermana-angular-component-hover-card.mjs +273 -3
- package/fesm2022/ojiepermana-angular-component-icon.mjs +139 -3
- package/fesm2022/ojiepermana-angular-component-input-group.mjs +176 -3
- package/fesm2022/ojiepermana-angular-component-input-otp.mjs +550 -3
- package/fesm2022/ojiepermana-angular-component-input.mjs +52 -3
- package/fesm2022/ojiepermana-angular-component-item.mjs +264 -3
- package/fesm2022/ojiepermana-angular-component-kanban.mjs +310 -3
- package/fesm2022/ojiepermana-angular-component-kbd.mjs +48 -3
- package/fesm2022/ojiepermana-angular-component-label.mjs +27 -3
- package/fesm2022/ojiepermana-angular-component-menubar.mjs +327 -3
- package/fesm2022/ojiepermana-angular-component-native-select.mjs +62 -3
- package/fesm2022/ojiepermana-angular-component-navigation-menu.mjs +378 -3
- package/fesm2022/ojiepermana-angular-component-pagination.mjs +238 -3
- package/fesm2022/ojiepermana-angular-component-pillbox.mjs +999 -3
- package/fesm2022/ojiepermana-angular-component-popover.mjs +201 -3
- package/fesm2022/ojiepermana-angular-component-progress.mjs +57 -3
- package/fesm2022/ojiepermana-angular-component-radio.mjs +180 -3
- package/fesm2022/ojiepermana-angular-component-resizable.mjs +493 -3
- package/fesm2022/ojiepermana-angular-component-scroll-area.mjs +51 -3
- package/fesm2022/ojiepermana-angular-component-segmented-control.mjs +227 -3
- package/fesm2022/ojiepermana-angular-component-select.mjs +609 -3
- package/fesm2022/ojiepermana-angular-component-separator.mjs +31 -3
- package/fesm2022/ojiepermana-angular-component-sheet.mjs +407 -3
- package/fesm2022/ojiepermana-angular-component-skeleton.mjs +25 -3
- package/fesm2022/ojiepermana-angular-component-slider.mjs +456 -3
- package/fesm2022/ojiepermana-angular-component-spinner.mjs +56 -3
- package/fesm2022/ojiepermana-angular-component-switch.mjs +145 -3
- package/fesm2022/ojiepermana-angular-component-table.mjs +155 -3
- package/fesm2022/ojiepermana-angular-component-tabs.mjs +315 -3
- package/fesm2022/ojiepermana-angular-component-textarea.mjs +46 -3
- package/fesm2022/ojiepermana-angular-component-timeline.mjs +237 -3
- package/fesm2022/ojiepermana-angular-component-toast.mjs +241 -3
- package/fesm2022/ojiepermana-angular-component-toggle-group.mjs +290 -3
- package/fesm2022/ojiepermana-angular-component-toggle.mjs +76 -3
- package/fesm2022/ojiepermana-angular-component-tooltip.mjs +519 -3
- package/fesm2022/ojiepermana-angular-component-utils-core.mjs +310 -3
- package/fesm2022/ojiepermana-angular-component-utils-overlay.mjs +62 -3
- package/fesm2022/ojiepermana-angular-component-utils-scale.mjs +34 -3
- package/fesm2022/ojiepermana-angular-component-utils.mjs +3 -2
- package/fesm2022/ojiepermana-angular-component.mjs +4 -4
- package/fesm2022/ojiepermana-angular-navigation-core.mjs +21 -3
- package/fesm2022/ojiepermana-angular-navigation-icon.mjs +20 -3
- package/fesm2022/ojiepermana-angular-navigation-navigation-badge-count.component-CDBxQ8rk.mjs +91 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-dockbar-menu.component-DBQHdvGa.mjs +512 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-entry-grid.component-Cd-jh6tg.mjs +623 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-flyout-menu.component-BCGvhoYj.mjs +404 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-horizontal.component-Dk_03e-6.mjs +466 -0
- package/fesm2022/ojiepermana-angular-navigation-ojiepermana-angular-navigation-DNKU6viC.mjs +2642 -0
- package/fesm2022/ojiepermana-angular-navigation-service.mjs +725 -3
- package/fesm2022/ojiepermana-angular-navigation-types.mjs +65 -4
- package/fesm2022/ojiepermana-angular-navigation.mjs +4 -10
- package/fesm2022/ojiepermana-angular-sdk.mjs +204 -4
- package/fesm2022/ojiepermana-angular-theme-component-settings.mjs +1387 -3
- package/fesm2022/ojiepermana-angular-theme-layout-services.mjs +331 -3
- package/fesm2022/ojiepermana-angular-theme-layout-types.mjs +45 -4
- package/fesm2022/ojiepermana-angular-theme-layout-wrapper.mjs +1044 -3
- package/fesm2022/ojiepermana-angular-theme-layout.mjs +729 -3
- package/fesm2022/ojiepermana-angular-theme-page-core.mjs +381 -3
- package/fesm2022/ojiepermana-angular-theme-page-filter.mjs +267 -3
- package/fesm2022/ojiepermana-angular-theme-page-root.mjs +361 -3
- package/fesm2022/ojiepermana-angular-theme-page-side.mjs +198 -3
- package/fesm2022/ojiepermana-angular-theme-page-slots.mjs +110 -3
- package/fesm2022/ojiepermana-angular-theme-page.mjs +7 -2
- package/fesm2022/ojiepermana-angular-theme-shell-services.mjs +338 -3
- package/fesm2022/ojiepermana-angular-theme-shell-types.mjs +160 -4
- package/fesm2022/ojiepermana-angular-theme-shell.mjs +811 -3
- package/fesm2022/ojiepermana-angular-theme-styles.mjs +783 -3
- package/fesm2022/ojiepermana-angular-theme.mjs +4 -4
- package/fesm2022/ojiepermana-angular.mjs +6 -11
- package/navigation/README.md +374 -0
- package/package.json +81 -20
- package/sdk/README.md +212 -0
- package/sdk/schematics/collection.json +20 -0
- package/sdk/schematics/init/index.js +83 -0
- package/sdk/schematics/init/schema.json +19 -0
- package/sdk/schematics/ng-add/index.js +147 -0
- package/sdk/schematics/ng-add/schema.json +14 -0
- package/sdk/schematics/package.json +3 -0
- package/sdk/schematics/sdk/index.js +175 -0
- package/sdk/schematics/sdk/schema.json +19 -0
- package/sdk/sdk.config.example.json +24 -0
- package/sdk/src/config/loader.js +43 -0
- package/sdk/src/config/schema.js +59 -0
- package/sdk/src/emit/client.js +251 -0
- package/sdk/src/emit/metadata.js +310 -0
- package/sdk/src/emit/models.js +104 -0
- package/sdk/src/emit/navigation.js +56 -0
- package/sdk/src/emit/operations.js +118 -0
- package/sdk/src/emit/public-api.js +54 -0
- package/sdk/src/emit/services.js +110 -0
- package/sdk/src/engine.js +67 -0
- package/sdk/src/layout/per-domain.js +360 -0
- package/sdk/src/package.json +3 -0
- package/sdk/src/parser/bundle.js +25 -0
- package/sdk/src/parser/ir.js +429 -0
- package/sdk/src/parser/types.js +7 -0
- package/sdk/src/render/template.js +152 -0
- package/sdk/src/writer/index.js +286 -0
- package/theme/README.md +126 -0
- package/theme/component/settings/README.md +135 -0
- package/theme/layout/README.md +539 -0
- package/theme/page/README.md +453 -0
- package/theme/shell/README.md +340 -0
- package/theme/styles/README.md +178 -0
- package/theme/styles/css/base/components.css +553 -0
- package/theme/styles/css/base/index.css +14 -0
- package/theme/styles/css/base/package.css +9 -0
- package/theme/styles/css/base/prefers-dark.css +86 -0
- package/theme/styles/css/base/print.css +62 -0
- package/theme/styles/css/base/status.css +38 -0
- package/theme/styles/css/base/tailwind.css +165 -0
- package/theme/styles/css/base/theme.css +374 -0
- package/theme/styles/css/base/tokens.css +361 -0
- package/theme/styles/css/color/amber.css +72 -0
- package/theme/styles/css/color/blue.css +72 -0
- package/theme/styles/css/color/brand.css +38 -0
- package/theme/styles/css/color/cyan.css +72 -0
- package/theme/styles/css/color/emerald.css +72 -0
- package/theme/styles/css/color/fuchsia.css +72 -0
- package/theme/styles/css/color/green.css +72 -0
- package/theme/styles/css/color/index.css +19 -0
- package/theme/styles/css/color/indigo.css +72 -0
- package/theme/styles/css/color/lime.css +72 -0
- package/theme/styles/css/color/orange.css +72 -0
- package/theme/styles/css/color/pink.css +72 -0
- package/theme/styles/css/color/purple.css +72 -0
- package/theme/styles/css/color/red.css +72 -0
- package/theme/styles/css/color/rose.css +72 -0
- package/theme/styles/css/color/sky.css +72 -0
- package/theme/styles/css/color/teal.css +72 -0
- package/theme/styles/css/color/violet.css +72 -0
- package/theme/styles/css/color/yellow.css +72 -0
- package/theme/styles/css/index.css +18 -0
- package/theme/styles/css/neutral/gray.css +63 -0
- package/theme/styles/css/neutral/index.css +11 -0
- package/theme/styles/css/neutral/mauve.css +63 -0
- package/theme/styles/css/neutral/mist.css +63 -0
- package/theme/styles/css/neutral/neutral.css +63 -0
- package/theme/styles/css/neutral/olive.css +63 -0
- package/theme/styles/css/neutral/slate.css +63 -0
- package/theme/styles/css/neutral/stone.css +63 -0
- package/theme/styles/css/neutral/taupe.css +63 -0
- package/theme/styles/css/neutral/zinc.css +63 -0
- package/theme/styles/css/radius/index.css +30 -0
- package/theme/styles/css/space/index.css +20 -0
- package/types/ojiepermana-angular-chart-area.d.ts +76 -1
- package/types/ojiepermana-angular-chart-bar.d.ts +201 -1
- package/types/ojiepermana-angular-chart-core.d.ts +811 -1
- package/types/ojiepermana-angular-chart-line.d.ts +75 -1
- package/types/ojiepermana-angular-chart-pie.d.ts +131 -1
- package/types/ojiepermana-angular-chart-primitives.d.ts +291 -1
- package/types/ojiepermana-angular-chart-radar.d.ts +116 -1
- package/types/ojiepermana-angular-chart-radial.d.ts +116 -1
- package/types/ojiepermana-angular-chart-scatter.d.ts +125 -1
- package/types/ojiepermana-angular-chart.d.ts +2 -1
- package/types/ojiepermana-angular-component-accordion.d.ts +85 -1
- package/types/ojiepermana-angular-component-alert-dialog.d.ts +140 -1
- package/types/ojiepermana-angular-component-alert.d.ts +42 -1
- package/types/ojiepermana-angular-component-aspect-ratio.d.ts +12 -1
- package/types/ojiepermana-angular-component-avatar.d.ts +56 -1
- package/types/ojiepermana-angular-component-badge.d.ts +24 -1
- package/types/ojiepermana-angular-component-breadcrumb.d.ts +46 -1
- package/types/ojiepermana-angular-component-button-group.d.ts +26 -1
- package/types/ojiepermana-angular-component-button.d.ts +27 -1
- package/types/ojiepermana-angular-component-calendar.d.ts +111 -1
- package/types/ojiepermana-angular-component-card.d.ts +69 -1
- package/types/ojiepermana-angular-component-carousel.d.ts +86 -1
- package/types/ojiepermana-angular-component-checkbox.d.ts +42 -1
- package/types/ojiepermana-angular-component-collapsible.d.ts +42 -1
- package/types/ojiepermana-angular-component-combobox.d.ts +60 -1
- package/types/ojiepermana-angular-component-command.d.ts +130 -1
- package/types/ojiepermana-angular-component-composer.d.ts +90 -1
- package/types/ojiepermana-angular-component-context-menu.d.ts +54 -1
- package/types/ojiepermana-angular-component-date-picker.d.ts +109 -1
- package/types/ojiepermana-angular-component-dialog.d.ts +136 -1
- package/types/ojiepermana-angular-component-drawer.d.ts +1 -1
- package/types/ojiepermana-angular-component-dropdown-menu.d.ts +248 -1
- package/types/ojiepermana-angular-component-editor.d.ts +135 -1
- package/types/ojiepermana-angular-component-empty.d.ts +50 -1
- package/types/ojiepermana-angular-component-form.d.ts +159 -1
- package/types/ojiepermana-angular-component-hover-card.d.ts +75 -1
- package/types/ojiepermana-angular-component-icon.d.ts +89 -1
- package/types/ojiepermana-angular-component-input-group.d.ts +51 -1
- package/types/ojiepermana-angular-component-input-otp.d.ts +155 -1
- package/types/ojiepermana-angular-component-input.d.ts +21 -1
- package/types/ojiepermana-angular-component-item.d.ts +93 -1
- package/types/ojiepermana-angular-component-kanban.d.ts +70 -1
- package/types/ojiepermana-angular-component-kbd.d.ts +16 -1
- package/types/ojiepermana-angular-component-label.d.ts +11 -1
- package/types/ojiepermana-angular-component-menubar.d.ts +93 -1
- package/types/ojiepermana-angular-component-native-select.d.ts +26 -1
- package/types/ojiepermana-angular-component-navigation-menu.d.ts +104 -1
- package/types/ojiepermana-angular-component-pagination.d.ts +33 -1
- package/types/ojiepermana-angular-component-pillbox.d.ts +222 -1
- package/types/ojiepermana-angular-component-popover.d.ts +66 -1
- package/types/ojiepermana-angular-component-progress.d.ts +17 -1
- package/types/ojiepermana-angular-component-radio.d.ts +60 -1
- package/types/ojiepermana-angular-component-resizable.d.ts +117 -1
- package/types/ojiepermana-angular-component-scroll-area.d.ts +19 -1
- package/types/ojiepermana-angular-component-segmented-control.d.ts +58 -1
- package/types/ojiepermana-angular-component-select.d.ts +122 -1
- package/types/ojiepermana-angular-component-separator.d.ts +14 -1
- package/types/ojiepermana-angular-component-sheet.d.ts +130 -1
- package/types/ojiepermana-angular-component-skeleton.d.ts +10 -1
- package/types/ojiepermana-angular-component-slider.d.ts +83 -1
- package/types/ojiepermana-angular-component-spinner.d.ts +13 -1
- package/types/ojiepermana-angular-component-switch.d.ts +44 -1
- package/types/ojiepermana-angular-component-table.d.ts +57 -1
- package/types/ojiepermana-angular-component-tabs.d.ts +124 -1
- package/types/ojiepermana-angular-component-textarea.d.ts +17 -1
- package/types/ojiepermana-angular-component-timeline.d.ts +64 -1
- package/types/ojiepermana-angular-component-toast.d.ts +64 -1
- package/types/ojiepermana-angular-component-toggle-group.d.ts +90 -1
- package/types/ojiepermana-angular-component-toggle.d.ts +25 -1
- package/types/ojiepermana-angular-component-tooltip.d.ts +143 -1
- package/types/ojiepermana-angular-component-utils-core.d.ts +184 -1
- package/types/ojiepermana-angular-component-utils-overlay.d.ts +21 -1
- package/types/ojiepermana-angular-component-utils-scale.d.ts +19 -1
- package/types/ojiepermana-angular-component-utils.d.ts +2 -1
- package/types/ojiepermana-angular-component.d.ts +2 -1
- package/types/ojiepermana-angular-navigation-core.d.ts +59 -1
- package/types/ojiepermana-angular-navigation-icon.d.ts +12 -1
- package/types/ojiepermana-angular-navigation-service.d.ts +116 -1
- package/types/ojiepermana-angular-navigation-types.d.ts +144 -1
- package/types/ojiepermana-angular-navigation.d.ts +507 -1
- package/types/ojiepermana-angular-sdk.d.ts +89 -1
- package/types/ojiepermana-angular-theme-component-settings.d.ts +154 -1
- package/types/ojiepermana-angular-theme-layout-services.d.ts +147 -1
- package/types/ojiepermana-angular-theme-layout-types.d.ts +40 -1
- package/types/ojiepermana-angular-theme-layout-wrapper.d.ts +299 -1
- package/types/ojiepermana-angular-theme-layout.d.ts +129 -1
- package/types/ojiepermana-angular-theme-page-core.d.ts +157 -1
- package/types/ojiepermana-angular-theme-page-filter.d.ts +77 -1
- package/types/ojiepermana-angular-theme-page-root.d.ts +88 -1
- package/types/ojiepermana-angular-theme-page-side.d.ts +50 -1
- package/types/ojiepermana-angular-theme-page-slots.d.ts +40 -1
- package/types/ojiepermana-angular-theme-page.d.ts +5 -1
- package/types/ojiepermana-angular-theme-shell-services.d.ts +193 -1
- package/types/ojiepermana-angular-theme-shell-types.d.ts +105 -1
- package/types/ojiepermana-angular-theme-shell.d.ts +100 -1
- package/types/ojiepermana-angular-theme-styles.d.ts +319 -1
- package/types/ojiepermana-angular-theme.d.ts +2 -1
- package/types/ojiepermana-angular.d.ts +5 -5
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.operationRulesVarName = operationRulesVarName;
|
|
4
|
+
exports.validationSchemasVarName = validationSchemasVarName;
|
|
5
|
+
exports.emitMetadata = emitMetadata;
|
|
6
|
+
const template_1 = require("../render/template");
|
|
7
|
+
const OPERATION_RULES_AGGREGATE = 'apiOperationRules';
|
|
8
|
+
const VALIDATION_SCHEMAS_AGGREGATE = 'apiValidationSchemas';
|
|
9
|
+
/**
|
|
10
|
+
* A tag named `Api` (or a schema group like `ApiError`) camel-cases straight
|
|
11
|
+
* onto the aggregate names this emitter declares itself, which would make the
|
|
12
|
+
* aggregate file import, re-export and declare the same binding. A trailing
|
|
13
|
+
* underscore is unreachable from `camelCase`, so the fallback cannot collide
|
|
14
|
+
* with another group either.
|
|
15
|
+
*/
|
|
16
|
+
function groupVarName(group, suffix, aggregate) {
|
|
17
|
+
const name = `${(0, template_1.camelCase)(group) || 'shared'}${suffix}`;
|
|
18
|
+
return name === aggregate ? `${name}_` : name;
|
|
19
|
+
}
|
|
20
|
+
/** The exported binding holding one tag's operation rules. */
|
|
21
|
+
function operationRulesVarName(tag) {
|
|
22
|
+
return groupVarName(tag, 'OperationRules', OPERATION_RULES_AGGREGATE);
|
|
23
|
+
}
|
|
24
|
+
/** The exported binding holding one schema group's validation rules. */
|
|
25
|
+
function validationSchemasVarName(group) {
|
|
26
|
+
return groupVarName(group, 'ValidationSchemas', VALIDATION_SCHEMAS_AGGREGATE);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Emit frontend-friendly metadata:
|
|
30
|
+
* - `metadata-types.ts` shared rule types
|
|
31
|
+
* - `permissions/<tag>.ts` operation rules (per tag) + `index.ts`
|
|
32
|
+
* - `validators/<tag>.ts` schema validation rules (per tag) + `index.ts`
|
|
33
|
+
* - `metadata.ts` aggregate export
|
|
34
|
+
* - `openapi-helpers.ts` small helpers (`getRequiredPermissions`, etc)
|
|
35
|
+
*/
|
|
36
|
+
function emitMetadata(ir, target) {
|
|
37
|
+
const files = [];
|
|
38
|
+
files.push({ path: 'metadata-types.ts', content: (0, template_1.finalize)(metadataTypesFile(target)) });
|
|
39
|
+
const opsByTag = groupOps(ir.operations);
|
|
40
|
+
for (const [tag, ops] of opsByTag) {
|
|
41
|
+
files.push({
|
|
42
|
+
path: `permissions/${(0, template_1.kebabCase)(tag)}.ts`,
|
|
43
|
+
content: (0, template_1.finalize)(permissionFile(tag, ops, target)),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
const permTags = Array.from(opsByTag.keys());
|
|
47
|
+
files.push({
|
|
48
|
+
path: 'permissions/index.ts',
|
|
49
|
+
content: (0, template_1.finalize)(buildAggregateFile(target, permTags, 'ApiOperationRule', OPERATION_RULES_AGGREGATE, operationRulesVarName)),
|
|
50
|
+
});
|
|
51
|
+
const schemasByPrefix = groupSchemas(ir.schemas);
|
|
52
|
+
for (const [group, schemas] of schemasByPrefix) {
|
|
53
|
+
files.push({
|
|
54
|
+
path: `validators/${(0, template_1.kebabCase)(group)}.ts`,
|
|
55
|
+
content: (0, template_1.finalize)(validatorFile(group, schemas, target)),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
const valGroups = Array.from(schemasByPrefix.keys());
|
|
59
|
+
files.push({
|
|
60
|
+
path: 'validators/index.ts',
|
|
61
|
+
content: (0, template_1.finalize)(buildAggregateFile(target, valGroups, 'ApiSchemaRule', VALIDATION_SCHEMAS_AGGREGATE, validationSchemasVarName)),
|
|
62
|
+
});
|
|
63
|
+
files.push({ path: 'metadata.ts', content: (0, template_1.finalize)(metadataFile(target)) });
|
|
64
|
+
files.push({ path: 'openapi-helpers.ts', content: (0, template_1.finalize)(helpersFile(target)) });
|
|
65
|
+
return files;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Emit a per-feature `index.ts` that re-exports each per-tag module plus a
|
|
69
|
+
* single aggregated record (`apiOperationRules`, `apiValidationSchemas`).
|
|
70
|
+
*/
|
|
71
|
+
function buildAggregateFile(target, groups, typeName, aggregateName, varNameFor) {
|
|
72
|
+
const reexports = groups
|
|
73
|
+
.map((g) => `export { ${varNameFor(g)} } from './${(0, template_1.kebabCase)(g)}';`)
|
|
74
|
+
.join('\n');
|
|
75
|
+
const imports = groups
|
|
76
|
+
.map((g) => `import { ${varNameFor(g)} } from './${(0, template_1.kebabCase)(g)}';`)
|
|
77
|
+
.join('\n');
|
|
78
|
+
const spreads = groups.map((g) => ` ...${varNameFor(g)},`).join('\n');
|
|
79
|
+
return `${target.banner}
|
|
80
|
+
|
|
81
|
+
import type { ${typeName} } from '../metadata-types';
|
|
82
|
+
${imports}
|
|
83
|
+
|
|
84
|
+
${reexports}
|
|
85
|
+
|
|
86
|
+
export const ${aggregateName}: Record<string, ${typeName}> = {
|
|
87
|
+
${spreads}
|
|
88
|
+
};
|
|
89
|
+
`;
|
|
90
|
+
}
|
|
91
|
+
function metadataTypesFile(target) {
|
|
92
|
+
return `${target.banner}
|
|
93
|
+
|
|
94
|
+
export interface ApiFieldRule {
|
|
95
|
+
required?: boolean;
|
|
96
|
+
type?: string;
|
|
97
|
+
format?: string;
|
|
98
|
+
description?: string;
|
|
99
|
+
nullable?: boolean;
|
|
100
|
+
minLength?: number;
|
|
101
|
+
maxLength?: number;
|
|
102
|
+
minimum?: number;
|
|
103
|
+
maximum?: number;
|
|
104
|
+
pattern?: string;
|
|
105
|
+
enumValues?: readonly (string | number)[];
|
|
106
|
+
ref?: string;
|
|
107
|
+
itemsRef?: string;
|
|
108
|
+
itemsType?: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface ApiSchemaRule {
|
|
112
|
+
required: readonly string[];
|
|
113
|
+
properties: Record<string, ApiFieldRule>;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface ApiOperationRule {
|
|
117
|
+
method: string;
|
|
118
|
+
path: string;
|
|
119
|
+
tags: readonly string[];
|
|
120
|
+
summary?: string;
|
|
121
|
+
description?: string;
|
|
122
|
+
requiredPermissions: readonly string[];
|
|
123
|
+
authorizationNotes: readonly string[];
|
|
124
|
+
securitySchemes: readonly string[];
|
|
125
|
+
pathParams: Record<string, ApiFieldRule>;
|
|
126
|
+
queryParams: Record<string, ApiFieldRule>;
|
|
127
|
+
bodySchema?: string;
|
|
128
|
+
responseSchemas: Record<string, string | undefined>;
|
|
129
|
+
}
|
|
130
|
+
`;
|
|
131
|
+
}
|
|
132
|
+
function permissionFile(tag, ops, target) {
|
|
133
|
+
const entries = ops
|
|
134
|
+
.slice()
|
|
135
|
+
.sort((a, b) => a.operationId.localeCompare(b.operationId))
|
|
136
|
+
.map((op) => renderOperationRule(op));
|
|
137
|
+
return `${target.banner}
|
|
138
|
+
|
|
139
|
+
import type { ApiOperationRule } from '../metadata-types';
|
|
140
|
+
|
|
141
|
+
export const ${operationRulesVarName(tag)}: Record<string, ApiOperationRule> = {
|
|
142
|
+
${entries.join(',\n')},
|
|
143
|
+
};
|
|
144
|
+
`;
|
|
145
|
+
}
|
|
146
|
+
function renderOperationRule(op) {
|
|
147
|
+
const pathParams = {};
|
|
148
|
+
const queryParams = {};
|
|
149
|
+
for (const p of op.params) {
|
|
150
|
+
const rule = trimRule(p.rule, p.required);
|
|
151
|
+
if (p.in === 'path')
|
|
152
|
+
pathParams[p.name] = rule;
|
|
153
|
+
else if (p.in === 'query')
|
|
154
|
+
queryParams[p.name] = rule;
|
|
155
|
+
}
|
|
156
|
+
const obj = {
|
|
157
|
+
method: op.method.toUpperCase(),
|
|
158
|
+
path: op.path,
|
|
159
|
+
tags: op.tags,
|
|
160
|
+
summary: op.summary,
|
|
161
|
+
description: op.description,
|
|
162
|
+
requiredPermissions: op.requiredPermissions,
|
|
163
|
+
authorizationNotes: op.authorizationNotes,
|
|
164
|
+
securitySchemes: op.securitySchemes,
|
|
165
|
+
pathParams,
|
|
166
|
+
queryParams,
|
|
167
|
+
bodySchema: op.bodySchemaRef,
|
|
168
|
+
responseSchemas: op.responses,
|
|
169
|
+
};
|
|
170
|
+
return ` ${JSON.stringify(op.operationId)}: ${toInlineJson(obj, 2)}`;
|
|
171
|
+
}
|
|
172
|
+
function validatorFile(group, schemas, target) {
|
|
173
|
+
const entries = schemas
|
|
174
|
+
.slice()
|
|
175
|
+
.sort((a, b) => a.name.localeCompare(b.name))
|
|
176
|
+
.map((s) => renderSchemaRule(s));
|
|
177
|
+
return `${target.banner}
|
|
178
|
+
|
|
179
|
+
import type { ApiSchemaRule } from '../metadata-types';
|
|
180
|
+
|
|
181
|
+
export const ${validationSchemasVarName(group)}: Record<string, ApiSchemaRule> = {
|
|
182
|
+
${entries.join(',\n')},
|
|
183
|
+
};
|
|
184
|
+
`;
|
|
185
|
+
}
|
|
186
|
+
function renderSchemaRule(schema) {
|
|
187
|
+
const properties = {};
|
|
188
|
+
for (const [name, rule] of Object.entries(schema.properties)) {
|
|
189
|
+
properties[name] = trimRule(rule, rule.required === true);
|
|
190
|
+
}
|
|
191
|
+
const obj = {
|
|
192
|
+
required: schema.required,
|
|
193
|
+
properties,
|
|
194
|
+
};
|
|
195
|
+
return ` ${JSON.stringify(schema.name)}: ${toInlineJson(obj, 2)}`;
|
|
196
|
+
}
|
|
197
|
+
function metadataFile(target) {
|
|
198
|
+
return `${target.banner}
|
|
199
|
+
|
|
200
|
+
export * from './metadata-types';
|
|
201
|
+
export * from './permissions';
|
|
202
|
+
export * from './validators';
|
|
203
|
+
`;
|
|
204
|
+
}
|
|
205
|
+
function helpersFile(target) {
|
|
206
|
+
return `${target.banner}
|
|
207
|
+
|
|
208
|
+
import { apiOperationRules, apiValidationSchemas } from './metadata';
|
|
209
|
+
import type { ApiFieldRule, ApiOperationRule, ApiSchemaRule } from './metadata-types';
|
|
210
|
+
|
|
211
|
+
export function getSchemaRule(schemaName: string): ApiSchemaRule | undefined {
|
|
212
|
+
return apiValidationSchemas[schemaName];
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export function getFieldRule(schemaName: string, fieldName: string): ApiFieldRule | undefined {
|
|
216
|
+
return apiValidationSchemas[schemaName]?.properties[fieldName];
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export function getOperationRule(operationId: string): ApiOperationRule | undefined {
|
|
220
|
+
return apiOperationRules[operationId];
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export function getRequiredPermissions(operationId: string): readonly string[] {
|
|
224
|
+
return apiOperationRules[operationId]?.requiredPermissions ?? [];
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export function hasRequiredPermissions(
|
|
228
|
+
operationId: string,
|
|
229
|
+
ownedPermissions: readonly string[],
|
|
230
|
+
): boolean {
|
|
231
|
+
return getRequiredPermissions(operationId).every((p) => ownedPermissions.includes(p));
|
|
232
|
+
}
|
|
233
|
+
`;
|
|
234
|
+
}
|
|
235
|
+
// ---------------------------------------------------------------------------
|
|
236
|
+
// Helpers
|
|
237
|
+
// ---------------------------------------------------------------------------
|
|
238
|
+
function groupOps(operations) {
|
|
239
|
+
const map = new Map();
|
|
240
|
+
for (const op of operations) {
|
|
241
|
+
const bucket = map.get(op.tag) ?? [];
|
|
242
|
+
bucket.push(op);
|
|
243
|
+
map.set(op.tag, bucket);
|
|
244
|
+
}
|
|
245
|
+
return map;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Group schemas for validator output by a common prefix tag. We use a simple
|
|
249
|
+
* heuristic: first PascalCase word of the schema name (e.g. `UserListResponse`
|
|
250
|
+
* → `User`, `AuthTokenResponse` → `Auth`). Keeps file sizes small and mirrors
|
|
251
|
+
* the reference layout.
|
|
252
|
+
*/
|
|
253
|
+
function groupSchemas(schemas) {
|
|
254
|
+
const map = new Map();
|
|
255
|
+
for (const s of schemas) {
|
|
256
|
+
const prefix = detectSchemaGroup(s.name);
|
|
257
|
+
const bucket = map.get(prefix) ?? [];
|
|
258
|
+
bucket.push(s);
|
|
259
|
+
map.set(prefix, bucket);
|
|
260
|
+
}
|
|
261
|
+
return map;
|
|
262
|
+
}
|
|
263
|
+
function detectSchemaGroup(name) {
|
|
264
|
+
const match = name.match(/^([A-Z][a-z]+)/);
|
|
265
|
+
return match ? match[1] : 'Shared';
|
|
266
|
+
}
|
|
267
|
+
function trimRule(rule, required) {
|
|
268
|
+
const out = {};
|
|
269
|
+
if (required)
|
|
270
|
+
out['required'] = true;
|
|
271
|
+
else
|
|
272
|
+
out['required'] = false;
|
|
273
|
+
if (rule.type)
|
|
274
|
+
out['type'] = rule.type;
|
|
275
|
+
if (rule.format)
|
|
276
|
+
out['format'] = rule.format;
|
|
277
|
+
if (rule.description)
|
|
278
|
+
out['description'] = rule.description;
|
|
279
|
+
if (rule.nullable)
|
|
280
|
+
out['nullable'] = true;
|
|
281
|
+
if (typeof rule.minLength === 'number')
|
|
282
|
+
out['minLength'] = rule.minLength;
|
|
283
|
+
if (typeof rule.maxLength === 'number')
|
|
284
|
+
out['maxLength'] = rule.maxLength;
|
|
285
|
+
if (typeof rule.minimum === 'number')
|
|
286
|
+
out['minimum'] = rule.minimum;
|
|
287
|
+
if (typeof rule.maximum === 'number')
|
|
288
|
+
out['maximum'] = rule.maximum;
|
|
289
|
+
if (rule.pattern)
|
|
290
|
+
out['pattern'] = rule.pattern;
|
|
291
|
+
if (rule.enumValues && rule.enumValues.length)
|
|
292
|
+
out['enumValues'] = rule.enumValues;
|
|
293
|
+
if (rule.ref)
|
|
294
|
+
out['ref'] = rule.ref;
|
|
295
|
+
if (rule.itemsRef)
|
|
296
|
+
out['itemsRef'] = rule.itemsRef;
|
|
297
|
+
if (rule.itemsType)
|
|
298
|
+
out['itemsType'] = rule.itemsType;
|
|
299
|
+
return out;
|
|
300
|
+
}
|
|
301
|
+
/** Stable JSON output with stripped `undefined` values. */
|
|
302
|
+
function toInlineJson(value, indent) {
|
|
303
|
+
const pretty = JSON.stringify(value, (_key, val) => (val === undefined ? undefined : val), 2);
|
|
304
|
+
if (!pretty)
|
|
305
|
+
return 'undefined';
|
|
306
|
+
return pretty
|
|
307
|
+
.split('\n')
|
|
308
|
+
.map((line, i) => (i === 0 ? line : ' '.repeat(indent) + line))
|
|
309
|
+
.join('\n');
|
|
310
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.emitModels = emitModels;
|
|
4
|
+
exports.renderFieldType = renderFieldType;
|
|
5
|
+
const template_1 = require("../render/template");
|
|
6
|
+
/**
|
|
7
|
+
* Emit one `interface` per schema into `models/<kebab>.ts` — type-only, no
|
|
8
|
+
* runtime footprint.
|
|
9
|
+
*/
|
|
10
|
+
function emitModels(ir, target) {
|
|
11
|
+
const files = [];
|
|
12
|
+
for (const schema of ir.schemas) {
|
|
13
|
+
const fileName = `${(0, template_1.kebabCase)(schema.name)}.ts`;
|
|
14
|
+
files.push({
|
|
15
|
+
path: `models/${fileName}`,
|
|
16
|
+
content: (0, template_1.finalize)(renderModel(schema, ir, target)),
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return files;
|
|
20
|
+
}
|
|
21
|
+
function renderModel(schema, ir, target) {
|
|
22
|
+
const imports = collectModelImports(schema).filter((name) => name !== schema.name);
|
|
23
|
+
const importLines = imports.map((name) => `import type { ${name} } from './${(0, template_1.kebabCase)(name)}';`);
|
|
24
|
+
let body = '';
|
|
25
|
+
if (schema.enumValues) {
|
|
26
|
+
// Primitive enum alias.
|
|
27
|
+
body = `export type ${(0, template_1.pascalCase)(schema.name)} = ${schema.enumValues
|
|
28
|
+
.map((v) => (typeof v === 'string' ? (0, template_1.quote)(v) : String(v)))
|
|
29
|
+
.join(' | ')};`;
|
|
30
|
+
}
|
|
31
|
+
else if (schema.arrayItemRef || schema.arrayItemType) {
|
|
32
|
+
const itemType = schema.arrayItemRef
|
|
33
|
+
? (0, template_1.pascalCase)(schema.arrayItemRef)
|
|
34
|
+
: tsPrimitive(schema.arrayItemType);
|
|
35
|
+
body = `export type ${(0, template_1.pascalCase)(schema.name)} = ${itemType}[];`;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
body = renderInterface(schema);
|
|
39
|
+
}
|
|
40
|
+
return [target.banner, '', ...importLines, importLines.length ? '' : '', body].join('\n');
|
|
41
|
+
}
|
|
42
|
+
function renderInterface(schema) {
|
|
43
|
+
const lines = [];
|
|
44
|
+
lines.push(`export interface ${(0, template_1.pascalCase)(schema.name)} {`);
|
|
45
|
+
for (const [propName, rule] of Object.entries(schema.properties)) {
|
|
46
|
+
const optional = rule.required ? '' : '?';
|
|
47
|
+
const type = renderFieldType(rule);
|
|
48
|
+
lines.push(` ${(0, template_1.propertyKey)(propName)}${optional}: ${type};`);
|
|
49
|
+
}
|
|
50
|
+
lines.push(`}`);
|
|
51
|
+
return lines.join('\n');
|
|
52
|
+
}
|
|
53
|
+
function renderFieldType(rule) {
|
|
54
|
+
let base;
|
|
55
|
+
if (rule.ref) {
|
|
56
|
+
base = (0, template_1.pascalCase)(rule.ref);
|
|
57
|
+
}
|
|
58
|
+
else if (rule.type === 'array') {
|
|
59
|
+
const item = rule.itemsRef
|
|
60
|
+
? (0, template_1.pascalCase)(rule.itemsRef)
|
|
61
|
+
: rule.enumValues
|
|
62
|
+
? rule.enumValues.map((v) => (typeof v === 'string' ? (0, template_1.quote)(v) : String(v))).join(' | ')
|
|
63
|
+
: tsPrimitive(rule.itemsType);
|
|
64
|
+
base = rule.enumValues && !rule.itemsRef ? `(${item})[]` : `${item}[]`;
|
|
65
|
+
}
|
|
66
|
+
else if (rule.enumValues && rule.enumValues.length > 0) {
|
|
67
|
+
base = rule.enumValues.map((v) => (typeof v === 'string' ? (0, template_1.quote)(v) : String(v))).join(' | ');
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
base = tsPrimitive(rule.type);
|
|
71
|
+
}
|
|
72
|
+
return rule.nullable ? `${base} | null` : base;
|
|
73
|
+
}
|
|
74
|
+
function tsPrimitive(type) {
|
|
75
|
+
switch (type) {
|
|
76
|
+
case 'string':
|
|
77
|
+
return 'string';
|
|
78
|
+
case 'integer':
|
|
79
|
+
case 'number':
|
|
80
|
+
return 'number';
|
|
81
|
+
case 'boolean':
|
|
82
|
+
return 'boolean';
|
|
83
|
+
case 'array':
|
|
84
|
+
return 'unknown[]';
|
|
85
|
+
case 'object':
|
|
86
|
+
return 'Record<string, unknown>';
|
|
87
|
+
case undefined:
|
|
88
|
+
case 'unknown':
|
|
89
|
+
default:
|
|
90
|
+
return 'unknown';
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function collectModelImports(schema) {
|
|
94
|
+
const set = new Set();
|
|
95
|
+
if (schema.arrayItemRef)
|
|
96
|
+
set.add(schema.arrayItemRef);
|
|
97
|
+
for (const rule of Object.values(schema.properties)) {
|
|
98
|
+
if (rule.ref)
|
|
99
|
+
set.add(rule.ref);
|
|
100
|
+
if (rule.itemsRef)
|
|
101
|
+
set.add(rule.itemsRef);
|
|
102
|
+
}
|
|
103
|
+
return [...set].sort();
|
|
104
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.emitNavigation = emitNavigation;
|
|
4
|
+
const template_1 = require("../render/template");
|
|
5
|
+
/**
|
|
6
|
+
* Emit `api.navigation.ts` exporting `NavigationItem[]` data that plugs
|
|
7
|
+
* directly into `NavigationService.registerItems(...)` from
|
|
8
|
+
* `@ojiepermana/angular/navigation`.
|
|
9
|
+
*/
|
|
10
|
+
function emitNavigation(ir, target) {
|
|
11
|
+
return [
|
|
12
|
+
{
|
|
13
|
+
path: 'api.navigation.ts',
|
|
14
|
+
content: (0, template_1.finalize)(renderNavigation(ir.navigation, target)),
|
|
15
|
+
},
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
function renderNavigation(nodes, target) {
|
|
19
|
+
return `${target.banner}
|
|
20
|
+
|
|
21
|
+
import type { NavigationItem } from '@ojiepermana/angular/navigation/types';
|
|
22
|
+
|
|
23
|
+
export const ApiNavigation: NavigationItem[] = ${stringifyNodes(nodes, 0, [])};
|
|
24
|
+
`;
|
|
25
|
+
}
|
|
26
|
+
function stringifyNodes(nodes, depth, lineage) {
|
|
27
|
+
if (!nodes.length)
|
|
28
|
+
return '[]';
|
|
29
|
+
const pad = ' '.repeat(depth + 1);
|
|
30
|
+
const closePad = ' '.repeat(depth);
|
|
31
|
+
return `[\n${nodes
|
|
32
|
+
.map((node) => pad + stringifyNode(node, depth + 1, [...lineage, node.name]))
|
|
33
|
+
.join(',\n')},\n${closePad}]`;
|
|
34
|
+
}
|
|
35
|
+
function stringifyNode(node, depth, lineage) {
|
|
36
|
+
const hasChildren = node.children.length > 0;
|
|
37
|
+
const pad = ' '.repeat(depth + 1);
|
|
38
|
+
const closePad = ' '.repeat(depth);
|
|
39
|
+
const fields = [
|
|
40
|
+
`${pad}id: ${JSON.stringify(lineage.map(template_1.kebabCase).filter(Boolean).join('-'))}`,
|
|
41
|
+
`${pad}title: ${JSON.stringify(node.name)}`,
|
|
42
|
+
`${pad}type: ${JSON.stringify(resolveItemType(lineage.length - 1, hasChildren))}`,
|
|
43
|
+
];
|
|
44
|
+
if (node.description)
|
|
45
|
+
fields.push(`${pad}subtitle: ${JSON.stringify(node.description)}`);
|
|
46
|
+
if (node.xIcon)
|
|
47
|
+
fields.push(`${pad}icon: ${JSON.stringify(node.xIcon)}`);
|
|
48
|
+
if (hasChildren)
|
|
49
|
+
fields.push(`${pad}children: ${stringifyNodes(node.children, depth + 1, lineage)}`);
|
|
50
|
+
return `{\n${fields.join(',\n')},\n${closePad}}`;
|
|
51
|
+
}
|
|
52
|
+
function resolveItemType(depth, hasChildren) {
|
|
53
|
+
if (!hasChildren)
|
|
54
|
+
return 'basic';
|
|
55
|
+
return depth === 0 ? 'group' : 'collapsable';
|
|
56
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.emitOperations = emitOperations;
|
|
4
|
+
const template_1 = require("../render/template");
|
|
5
|
+
const models_1 = require("./models");
|
|
6
|
+
/**
|
|
7
|
+
* Emit one tree-shakeable operation function per operationId at
|
|
8
|
+
* `fn/<tag-kebab>/<operation-kebab>.ts`.
|
|
9
|
+
*
|
|
10
|
+
* Each file exports:
|
|
11
|
+
* - `<operationId>$Params` interface
|
|
12
|
+
* - `<operationId>` function returning `Observable<StrictHttpResponse<R>>`
|
|
13
|
+
* - `<operationId>.PATH` constant
|
|
14
|
+
*/
|
|
15
|
+
function emitOperations(ir, target) {
|
|
16
|
+
return ir.operations.map((op) => ({
|
|
17
|
+
path: `fn/${(0, template_1.kebabCase)(op.tag)}/${(0, template_1.kebabCase)(op.operationId)}.ts`,
|
|
18
|
+
content: (0, template_1.finalize)(renderOperation(op, target)),
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
function renderOperation(op, target) {
|
|
22
|
+
const fnName = (0, template_1.camelCase)(op.operationId);
|
|
23
|
+
const paramsName = `${(0, template_1.pascalCase)(op.operationId)}$Params`;
|
|
24
|
+
const responseType = op.successRef ? (0, template_1.pascalCase)(op.successRef) : 'unknown';
|
|
25
|
+
const paramImports = collectParamImports(op);
|
|
26
|
+
const imports = [
|
|
27
|
+
`import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';`,
|
|
28
|
+
`import { Observable } from 'rxjs';`,
|
|
29
|
+
`import { filter, map } from 'rxjs/operators';`,
|
|
30
|
+
``,
|
|
31
|
+
`import { RequestBuilder } from '../../request-builder';`,
|
|
32
|
+
`import { StrictHttpResponse } from '../../strict-http-response';`,
|
|
33
|
+
];
|
|
34
|
+
for (const name of paramImports) {
|
|
35
|
+
imports.push(`import type { ${(0, template_1.pascalCase)(name)} } from '../../models/${(0, template_1.kebabCase)(name)}';`);
|
|
36
|
+
}
|
|
37
|
+
const paramsInterface = renderParamsInterface(op, paramsName);
|
|
38
|
+
const hasAnyParams = paramsInterface.hasAnyField;
|
|
39
|
+
const paramsOptional = !paramsInterface.anyRequired;
|
|
40
|
+
const bodyCT = op.bodySchemaRef ? "'application/json'" : '';
|
|
41
|
+
const pathCalls = op.params
|
|
42
|
+
.filter((p) => p.in === 'path')
|
|
43
|
+
.map((p) => ` rb.path(${(0, template_1.quote)(p.name)}, params${(0, template_1.propertyAccess)(p.name)});`);
|
|
44
|
+
const queryCalls = op.params
|
|
45
|
+
.filter((p) => p.in === 'query')
|
|
46
|
+
.map((p) => ` rb.query(${(0, template_1.quote)(p.name)}, params${(0, template_1.propertyAccess)(p.name)});`);
|
|
47
|
+
const headerCalls = op.params
|
|
48
|
+
.filter((p) => p.in === 'header')
|
|
49
|
+
.map((p) => ` rb.header(${(0, template_1.quote)(p.name)}, params${(0, template_1.propertyAccess)(p.name)});`);
|
|
50
|
+
const bodyCall = op.bodySchemaRef ? ` rb.body(params.body, ${bodyCT});` : '';
|
|
51
|
+
const populate = pathCalls.length || queryCalls.length || headerCalls.length || bodyCall
|
|
52
|
+
? ` if (params) {
|
|
53
|
+
${[...pathCalls, ...queryCalls, ...headerCalls, bodyCall].filter(Boolean).join('\n')}
|
|
54
|
+
}`
|
|
55
|
+
: '';
|
|
56
|
+
const paramsArg = hasAnyParams
|
|
57
|
+
? `params${paramsOptional ? '?' : ''}: ${paramsName}`
|
|
58
|
+
: `_params?: Record<string, never>`;
|
|
59
|
+
return `${target.banner}
|
|
60
|
+
|
|
61
|
+
${imports.join('\n')}
|
|
62
|
+
|
|
63
|
+
${paramsInterface.source}
|
|
64
|
+
export function ${fnName}(
|
|
65
|
+
http: HttpClient,
|
|
66
|
+
rootUrl: string,
|
|
67
|
+
${paramsArg},
|
|
68
|
+
context?: HttpContext,
|
|
69
|
+
): Observable<StrictHttpResponse<${responseType}>> {
|
|
70
|
+
const rb = new RequestBuilder(rootUrl, ${fnName}.PATH, ${(0, template_1.quote)(op.method)});
|
|
71
|
+
${populate}
|
|
72
|
+
return http.request(rb.build({ responseType: 'json', accept: 'application/json', context })).pipe(
|
|
73
|
+
filter((r: unknown): r is HttpResponse<unknown> => r instanceof HttpResponse),
|
|
74
|
+
map((r) => r as StrictHttpResponse<${responseType}>),
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
${fnName}.PATH = ${(0, template_1.quote)(op.path)};
|
|
79
|
+
`;
|
|
80
|
+
}
|
|
81
|
+
function collectParamImports(op) {
|
|
82
|
+
const set = new Set();
|
|
83
|
+
for (const p of op.params) {
|
|
84
|
+
if (p.rule.ref)
|
|
85
|
+
set.add(p.rule.ref);
|
|
86
|
+
if (p.rule.itemsRef)
|
|
87
|
+
set.add(p.rule.itemsRef);
|
|
88
|
+
}
|
|
89
|
+
if (op.bodySchemaRef)
|
|
90
|
+
set.add(op.bodySchemaRef);
|
|
91
|
+
if (op.successRef)
|
|
92
|
+
set.add(op.successRef);
|
|
93
|
+
return [...set].sort();
|
|
94
|
+
}
|
|
95
|
+
function renderParamsInterface(op, paramsName) {
|
|
96
|
+
const lines = [];
|
|
97
|
+
let anyRequired = false;
|
|
98
|
+
const pushField = (p) => {
|
|
99
|
+
const optional = p.required ? '' : '?';
|
|
100
|
+
if (p.required)
|
|
101
|
+
anyRequired = true;
|
|
102
|
+
const type = (0, models_1.renderFieldType)(p.rule);
|
|
103
|
+
lines.push(` ${(0, template_1.propertyKey)(p.name)}${optional}: ${type};`);
|
|
104
|
+
};
|
|
105
|
+
for (const p of op.params)
|
|
106
|
+
pushField(p);
|
|
107
|
+
if (op.bodySchemaRef) {
|
|
108
|
+
const optional = op.bodyRequired ? '' : '?';
|
|
109
|
+
if (op.bodyRequired)
|
|
110
|
+
anyRequired = true;
|
|
111
|
+
lines.push(` body${optional}: ${(0, template_1.pascalCase)(op.bodySchemaRef)};`);
|
|
112
|
+
}
|
|
113
|
+
const hasAnyField = lines.length > 0;
|
|
114
|
+
const source = hasAnyField
|
|
115
|
+
? `export interface ${paramsName} {\n${lines.join('\n')}\n}\n`
|
|
116
|
+
: `export type ${paramsName} = Record<string, never>;\n`;
|
|
117
|
+
return { source, hasAnyField, anyRequired };
|
|
118
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.emitPublicApi = emitPublicApi;
|
|
4
|
+
const template_1 = require("../render/template");
|
|
5
|
+
/**
|
|
6
|
+
* Emit `public-api.ts` — the barrel that re-exports every generated artifact
|
|
7
|
+
* based on the resolved feature flags. Mirrors the convention used by the
|
|
8
|
+
* reference output in `old/api/index.ts`.
|
|
9
|
+
*/
|
|
10
|
+
function emitPublicApi(ir, target) {
|
|
11
|
+
const lines = [target.banner, ''];
|
|
12
|
+
if (target.features.client) {
|
|
13
|
+
lines.push(`export { ApiConfiguration, provideApiConfiguration } from './api-configuration';`);
|
|
14
|
+
lines.push(`export { BaseService } from './base-service';`);
|
|
15
|
+
lines.push(`export { RequestBuilder } from './request-builder';`);
|
|
16
|
+
lines.push(`export type { StrictHttpResponse } from './strict-http-response';`);
|
|
17
|
+
lines.push(`export { ${target.clientName} } from './api';`);
|
|
18
|
+
lines.push('');
|
|
19
|
+
}
|
|
20
|
+
if (target.features.models) {
|
|
21
|
+
for (const schema of ir.schemas) {
|
|
22
|
+
lines.push(`export type { ${(0, template_1.pascalCase)(schema.name)} } from './models/${(0, template_1.kebabCase)(schema.name)}';`);
|
|
23
|
+
}
|
|
24
|
+
lines.push('');
|
|
25
|
+
}
|
|
26
|
+
if (target.features.services) {
|
|
27
|
+
const tags = Array.from(new Set(ir.operations.map((o) => o.tag))).sort();
|
|
28
|
+
for (const tag of tags) {
|
|
29
|
+
lines.push(`export { ${(0, template_1.pascalCase)(tag)}Service } from './services/${(0, template_1.kebabCase)(tag)}.service';`);
|
|
30
|
+
}
|
|
31
|
+
lines.push('');
|
|
32
|
+
}
|
|
33
|
+
if (target.features.operations) {
|
|
34
|
+
const sorted = [...ir.operations].sort((a, b) => a.operationId.localeCompare(b.operationId));
|
|
35
|
+
for (const op of sorted) {
|
|
36
|
+
lines.push(renderFnReexport(op));
|
|
37
|
+
}
|
|
38
|
+
lines.push('');
|
|
39
|
+
}
|
|
40
|
+
if (target.features.metadata) {
|
|
41
|
+
lines.push(`export * from './metadata';`);
|
|
42
|
+
lines.push(`export * from './openapi-helpers';`);
|
|
43
|
+
lines.push('');
|
|
44
|
+
}
|
|
45
|
+
if (target.features.navigation) {
|
|
46
|
+
lines.push(`export { ApiNavigation } from './api.navigation';`);
|
|
47
|
+
}
|
|
48
|
+
return [{ path: 'public-api.ts', content: (0, template_1.finalize)(lines.join('\n')) }];
|
|
49
|
+
}
|
|
50
|
+
function renderFnReexport(op) {
|
|
51
|
+
const fnName = (0, template_1.camelCase)(op.operationId);
|
|
52
|
+
const paramsName = `${(0, template_1.pascalCase)(op.operationId)}$Params`;
|
|
53
|
+
return `export { ${fnName}, type ${paramsName} } from './fn/${(0, template_1.kebabCase)(op.tag)}/${(0, template_1.kebabCase)(op.operationId)}';`;
|
|
54
|
+
}
|