@equinor/fusion-framework-cli 10.7.5-apploader-be21a6b60eb13eee8bf869e75002d8634e9c50a9 → 11.0.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -2
- package/README.md +144 -17
- package/bin/build/bin.js +21 -0
- package/bin/build/cli.js +9868 -0
- package/bin/build/create-auth-client-7P8K_6Vu.js +89 -0
- package/bin/build/portal-pack-CAsnV44B.js +12069 -0
- package/bin/cli.mjs +4 -1
- package/dist/esm/bin/app-build.js +34 -0
- package/dist/esm/bin/app-build.js.map +1 -0
- package/dist/esm/bin/app-check.js +63 -0
- package/dist/esm/bin/app-check.js.map +1 -0
- package/dist/esm/bin/app-config-publish.js +89 -0
- package/dist/esm/bin/app-config-publish.js.map +1 -0
- package/dist/esm/bin/app-config.js +48 -0
- package/dist/esm/bin/app-config.js.map +1 -0
- package/dist/esm/bin/app-dev.js +92 -0
- package/dist/esm/bin/app-dev.js.map +1 -0
- package/dist/esm/bin/app-manifest.js +38 -0
- package/dist/esm/bin/app-manifest.js.map +1 -0
- package/dist/esm/bin/app-pack.js +51 -0
- package/dist/esm/bin/app-pack.js.map +1 -0
- package/dist/esm/bin/app-tag.js +89 -0
- package/dist/esm/bin/app-tag.js.map +1 -0
- package/dist/esm/bin/app-upload.js +109 -0
- package/dist/esm/bin/app-upload.js.map +1 -0
- package/dist/esm/bin/helpers/load-bundle-metadata.js +32 -0
- package/dist/esm/bin/helpers/load-bundle-metadata.js.map +1 -0
- package/dist/esm/bin/helpers/load-vite-config.js +55 -0
- package/dist/esm/bin/helpers/load-vite-config.js.map +1 -0
- package/dist/esm/bin/helpers/resolve-app-config.js +46 -0
- package/dist/esm/bin/helpers/resolve-app-config.js.map +1 -0
- package/dist/esm/bin/helpers/resolve-app-manifest.js +55 -0
- package/dist/esm/bin/helpers/resolve-app-manifest.js.map +1 -0
- package/dist/esm/bin/helpers/resolve-portal-manifest.js +55 -0
- package/dist/esm/bin/helpers/resolve-portal-manifest.js.map +1 -0
- package/dist/esm/bin/helpers/resolve-project-package.js +32 -0
- package/dist/esm/bin/helpers/resolve-project-package.js.map +1 -0
- package/dist/esm/bin/index.js +10 -0
- package/dist/esm/bin/index.js.map +1 -0
- package/dist/esm/bin/pack.js +70 -0
- package/dist/esm/bin/pack.js.map +1 -0
- package/dist/esm/bin/portal-build.js +40 -0
- package/dist/esm/bin/portal-build.js.map +1 -0
- package/dist/esm/bin/portal-dev.js +69 -0
- package/dist/esm/bin/portal-dev.js.map +1 -0
- package/dist/esm/bin/portal-manifest.js +38 -0
- package/dist/esm/bin/portal-manifest.js.map +1 -0
- package/dist/esm/bin/portal-pack.js +60 -0
- package/dist/esm/bin/portal-pack.js.map +1 -0
- package/dist/esm/bin/portal-tag.js +96 -0
- package/dist/esm/bin/portal-tag.js.map +1 -0
- package/dist/esm/bin/portal-upload.js +99 -0
- package/dist/esm/bin/portal-upload.js.map +1 -0
- package/dist/esm/bin/utils/ConsoleLogger.js +112 -0
- package/dist/esm/bin/utils/ConsoleLogger.js.map +1 -0
- package/dist/esm/bin/utils/create-dev-server.js +167 -0
- package/dist/esm/bin/utils/create-dev-server.js.map +1 -0
- package/dist/esm/bin/utils/format.js +47 -0
- package/dist/esm/bin/utils/format.js.map +1 -0
- package/dist/esm/bin/utils/index.js +5 -0
- package/dist/esm/bin/utils/index.js.map +1 -0
- package/dist/esm/bin/utils/spinner.js +142 -0
- package/dist/esm/bin/utils/spinner.js.map +1 -0
- package/dist/esm/cli/commands/app/alias.js +42 -0
- package/dist/esm/cli/commands/app/alias.js.map +1 -0
- package/dist/esm/cli/commands/app/build.js +46 -0
- package/dist/esm/cli/commands/app/build.js.map +1 -0
- package/dist/esm/cli/commands/app/check.js +47 -0
- package/dist/esm/cli/commands/app/check.js.map +1 -0
- package/dist/esm/cli/commands/app/config.js +91 -0
- package/dist/esm/cli/commands/app/config.js.map +1 -0
- package/dist/esm/cli/commands/app/dev.js +61 -0
- package/dist/esm/cli/commands/app/dev.js.map +1 -0
- package/dist/esm/cli/commands/app/index.js +25 -0
- package/dist/esm/cli/commands/app/index.js.map +1 -0
- package/dist/esm/cli/commands/app/manifest.js +73 -0
- package/dist/esm/cli/commands/app/manifest.js.map +1 -0
- package/dist/esm/cli/commands/app/pack.js +64 -0
- package/dist/esm/cli/commands/app/pack.js.map +1 -0
- package/dist/esm/cli/commands/app/publish.js +119 -0
- package/dist/esm/cli/commands/app/publish.js.map +1 -0
- package/dist/esm/cli/commands/app/tag.js +101 -0
- package/dist/esm/cli/commands/app/tag.js.map +1 -0
- package/dist/esm/cli/commands/app/upload.js +80 -0
- package/dist/esm/cli/commands/app/upload.js.map +1 -0
- package/dist/esm/cli/commands/auth/index.js +10 -0
- package/dist/esm/cli/commands/auth/index.js.map +1 -0
- package/dist/esm/cli/commands/auth/login.js +68 -0
- package/dist/esm/cli/commands/auth/login.js.map +1 -0
- package/dist/esm/cli/commands/auth/logout.js +55 -0
- package/dist/esm/cli/commands/auth/logout.js.map +1 -0
- package/dist/esm/cli/commands/auth/token.js +74 -0
- package/dist/esm/cli/commands/auth/token.js.map +1 -0
- package/dist/esm/cli/commands/disco/index.js +6 -0
- package/dist/esm/cli/commands/disco/index.js.map +1 -0
- package/dist/esm/cli/commands/disco/resolve.js +61 -0
- package/dist/esm/cli/commands/disco/resolve.js.map +1 -0
- package/dist/esm/cli/commands/index.js +11 -0
- package/dist/esm/cli/commands/index.js.map +1 -0
- package/dist/esm/cli/commands/portal/build.js +22 -0
- package/dist/esm/cli/commands/portal/build.js.map +1 -0
- package/dist/esm/cli/commands/portal/dev.js +24 -0
- package/dist/esm/cli/commands/portal/dev.js.map +1 -0
- package/dist/esm/cli/commands/portal/index.js +21 -0
- package/dist/esm/cli/commands/portal/index.js.map +1 -0
- package/dist/esm/cli/commands/portal/manifest.js +45 -0
- package/dist/esm/cli/commands/portal/manifest.js.map +1 -0
- package/dist/esm/cli/commands/portal/pack.js +35 -0
- package/dist/esm/cli/commands/portal/pack.js.map +1 -0
- package/dist/esm/cli/commands/portal/publish.js +73 -0
- package/dist/esm/cli/commands/portal/publish.js.map +1 -0
- package/dist/esm/cli/commands/portal/schema.js +68 -0
- package/dist/esm/cli/commands/portal/schema.js.map +1 -0
- package/dist/esm/cli/commands/portal/tag.js +69 -0
- package/dist/esm/cli/commands/portal/tag.js.map +1 -0
- package/dist/esm/cli/commands/portal/upload.js +40 -0
- package/dist/esm/cli/commands/portal/upload.js.map +1 -0
- package/dist/esm/cli/main.js +52 -0
- package/dist/esm/cli/main.js.map +1 -0
- package/dist/esm/cli/options/auth.js +96 -0
- package/dist/esm/cli/options/auth.js.map +1 -0
- package/dist/esm/cli/options/env.js +30 -0
- package/dist/esm/cli/options/env.js.map +1 -0
- package/dist/esm/lib/app/app-config.js +12 -0
- package/dist/esm/lib/app/app-config.js.map +1 -0
- package/dist/esm/lib/app/app-manifest.js +15 -0
- package/dist/esm/lib/app/app-manifest.js.map +1 -0
- package/dist/{lib → esm/lib/app}/app-package.js +30 -10
- package/dist/esm/lib/app/app-package.js.map +1 -0
- package/dist/esm/lib/app/create-app-manifest.js +72 -0
- package/dist/esm/lib/app/create-app-manifest.js.map +1 -0
- package/dist/esm/lib/app/index.js +9 -0
- package/dist/esm/lib/app/index.js.map +1 -0
- package/dist/esm/lib/app/load-app-config.js +47 -0
- package/dist/esm/lib/app/load-app-config.js.map +1 -0
- package/dist/esm/lib/app/load-app-manifest.js +61 -0
- package/dist/esm/lib/app/load-app-manifest.js.map +1 -0
- package/dist/esm/lib/app/merge-app-config.js +21 -0
- package/dist/esm/lib/app/merge-app-config.js.map +1 -0
- package/dist/esm/lib/app/merge-app-manifest.js +31 -0
- package/dist/esm/lib/app/merge-app-manifest.js.map +1 -0
- package/dist/esm/lib/app/schemas.js +28 -0
- package/dist/esm/lib/app/schemas.js.map +1 -0
- package/dist/esm/lib/dev-server.js +3 -0
- package/dist/esm/lib/dev-server.js.map +1 -0
- package/dist/esm/lib/framework.node.js +104 -0
- package/dist/esm/lib/framework.node.js.map +1 -0
- package/dist/esm/lib/index.js +5 -0
- package/dist/esm/lib/index.js.map +1 -0
- package/dist/esm/lib/legacy.js +38 -0
- package/dist/esm/lib/legacy.js.map +1 -0
- package/dist/esm/lib/load-dev-server-config.js +43 -0
- package/dist/esm/lib/load-dev-server-config.js.map +1 -0
- package/dist/esm/lib/merge-dev-server-config.js +37 -0
- package/dist/esm/lib/merge-dev-server-config.js.map +1 -0
- package/dist/esm/lib/portal/create-portal-manifest.js +93 -0
- package/dist/esm/lib/portal/create-portal-manifest.js.map +1 -0
- package/dist/esm/lib/portal/index.js +3 -0
- package/dist/esm/lib/portal/index.js.map +1 -0
- package/dist/esm/lib/portal/load-portal-manifest.js +54 -0
- package/dist/esm/lib/portal/load-portal-manifest.js.map +1 -0
- package/dist/esm/lib/portal/load-portal-schema.js +49 -0
- package/dist/esm/lib/portal/load-portal-schema.js.map +1 -0
- package/dist/esm/lib/portal/portal-manifest.js +21 -0
- package/dist/esm/lib/portal/portal-manifest.js.map +1 -0
- package/dist/esm/lib/portal/portal-manifest.schema.js +134 -0
- package/dist/esm/lib/portal/portal-manifest.schema.js.map +1 -0
- package/dist/esm/lib/static.js +20 -0
- package/dist/esm/lib/static.js.map +1 -0
- package/dist/{lib/utils → esm/lib}/types.js.map +1 -1
- package/dist/esm/lib/utils/assert.js +87 -0
- package/dist/esm/lib/utils/assert.js.map +1 -0
- package/dist/esm/lib/utils/expect.js.map +1 -0
- package/dist/{lib/plugins/app-assets/extension-filter-pattern.js → esm/lib/utils/extension-filter.js} +1 -1
- package/dist/esm/lib/utils/extension-filter.js.map +1 -0
- package/dist/esm/lib/utils/file-exists.js.map +1 -0
- package/dist/esm/lib/utils/index.js +6 -0
- package/dist/esm/lib/utils/index.js.map +1 -0
- package/dist/{lib → esm/lib}/utils/parse-json-request.js +3 -1
- package/dist/esm/lib/utils/parse-json-request.js.map +1 -0
- package/dist/esm/lib/utils/resolve-annotations.js +28 -0
- package/dist/esm/lib/utils/resolve-annotations.js.map +1 -0
- package/dist/esm/lib/utils/resolve-devops-annotations.js +59 -0
- package/dist/esm/lib/utils/resolve-devops-annotations.js.map +1 -0
- package/dist/esm/lib/utils/resolve-git-commit-sha.js +23 -0
- package/dist/esm/lib/utils/resolve-git-commit-sha.js.map +1 -0
- package/dist/esm/lib/utils/resolve-git-remote-url.js +24 -0
- package/dist/esm/lib/utils/resolve-git-remote-url.js.map +1 -0
- package/dist/esm/lib/utils/resolve-github-annotations.js +127 -0
- package/dist/esm/lib/utils/resolve-github-annotations.js.map +1 -0
- package/dist/esm/lib/utils/resolve-package-repo.js +14 -0
- package/dist/esm/lib/utils/resolve-package-repo.js.map +1 -0
- package/dist/esm/lib/utils/resolve-package.js +18 -0
- package/dist/esm/lib/utils/resolve-package.js.map +1 -0
- package/dist/esm/lib/utils/resolve-source-entry-point.js +39 -0
- package/dist/esm/lib/utils/resolve-source-entry-point.js.map +1 -0
- package/dist/esm/lib/utils/types.js.map +1 -0
- package/dist/esm/lib/utils/write-file.js +25 -0
- package/dist/esm/lib/utils/write-file.js.map +1 -0
- package/dist/esm/version.js +3 -0
- package/dist/esm/version.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/bin/app-build.d.ts +52 -0
- package/dist/types/bin/app-check.d.ts +31 -0
- package/dist/types/bin/app-config-publish.d.ts +23 -0
- package/dist/types/bin/app-config.d.ts +52 -0
- package/dist/types/bin/app-dev.d.ts +45 -0
- package/dist/types/bin/app-manifest.d.ts +42 -0
- package/dist/types/bin/app-pack.d.ts +38 -0
- package/dist/types/bin/app-tag.d.ts +51 -0
- package/dist/types/bin/app-upload.d.ts +40 -0
- package/dist/types/bin/helpers/load-bundle-metadata.d.ts +15 -0
- package/dist/types/bin/helpers/load-vite-config.d.ts +12 -0
- package/dist/types/bin/helpers/resolve-app-config.d.ts +18 -0
- package/dist/types/bin/helpers/resolve-app-manifest.d.ts +17 -0
- package/dist/types/bin/helpers/resolve-portal-manifest.d.ts +27 -0
- package/dist/types/bin/helpers/resolve-project-package.d.ts +13 -0
- package/dist/types/bin/index.d.ts +9 -0
- package/dist/types/bin/pack.d.ts +36 -0
- package/dist/types/bin/portal-build.d.ts +54 -0
- package/dist/types/bin/portal-dev.d.ts +37 -0
- package/dist/types/bin/portal-manifest.d.ts +60 -0
- package/dist/types/bin/portal-pack.d.ts +54 -0
- package/dist/types/bin/portal-tag.d.ts +51 -0
- package/dist/types/bin/portal-upload.d.ts +37 -0
- package/dist/types/bin/utils/ConsoleLogger.d.ts +84 -0
- package/dist/types/bin/utils/create-dev-server.d.ts +49 -0
- package/dist/types/bin/utils/format.d.ts +27 -0
- package/dist/types/bin/utils/index.d.ts +3 -13
- package/dist/types/bin/utils/spinner.d.ts +75 -0
- package/dist/types/cli/commands/app/alias.d.ts +6 -0
- package/dist/types/cli/commands/app/build.d.ts +27 -0
- package/dist/types/cli/commands/app/check.d.ts +26 -0
- package/dist/types/cli/commands/app/config.d.ts +34 -0
- package/dist/types/cli/commands/app/dev.d.ts +29 -0
- package/dist/types/cli/commands/app/index.d.ts +3 -0
- package/dist/types/cli/commands/app/manifest.d.ts +30 -0
- package/dist/types/cli/commands/app/pack.d.ts +31 -0
- package/dist/types/cli/commands/app/publish.d.ts +31 -0
- package/dist/types/cli/commands/app/tag.d.ts +33 -0
- package/dist/types/cli/commands/app/upload.d.ts +29 -0
- package/dist/types/cli/commands/auth/index.d.ts +3 -0
- package/dist/types/cli/commands/auth/login.d.ts +2 -0
- package/dist/types/cli/commands/auth/logout.d.ts +12 -0
- package/dist/types/cli/commands/auth/token.d.ts +13 -0
- package/dist/types/cli/commands/disco/index.d.ts +2 -0
- package/dist/types/cli/commands/disco/resolve.d.ts +25 -0
- package/dist/types/cli/commands/portal/build.d.ts +2 -0
- package/dist/types/cli/commands/portal/dev.d.ts +2 -0
- package/dist/types/cli/commands/portal/index.d.ts +2 -0
- package/dist/types/cli/commands/portal/manifest.d.ts +2 -0
- package/dist/types/cli/commands/portal/pack.d.ts +2 -0
- package/dist/types/cli/commands/portal/publish.d.ts +2 -0
- package/dist/types/cli/commands/portal/schema.d.ts +2 -0
- package/dist/types/cli/commands/portal/tag.d.ts +2 -0
- package/dist/types/cli/commands/portal/upload.d.ts +2 -0
- package/dist/types/cli/main.d.ts +21 -0
- package/dist/types/cli/options/auth.d.ts +37 -0
- package/dist/types/cli/options/env.d.ts +19 -0
- package/dist/types/lib/app/app-config.d.ts +31 -0
- package/dist/types/lib/app/app-manifest.d.ts +39 -0
- package/dist/types/lib/{app-package.d.ts → app/app-package.d.ts} +27 -10
- package/dist/types/lib/app/create-app-manifest.d.ts +17 -0
- package/dist/types/lib/app/index.d.ts +8 -0
- package/dist/types/lib/app/load-app-config.d.ts +54 -0
- package/dist/types/lib/app/load-app-manifest.d.ts +57 -0
- package/dist/types/lib/app/merge-app-config.d.ts +13 -0
- package/dist/types/lib/app/merge-app-manifest.d.ts +25 -0
- package/dist/types/{schemas.d.ts → lib/app/schemas.d.ts} +10 -1
- package/dist/types/lib/dev-server.d.ts +2 -0
- package/dist/types/lib/framework.node.d.ts +77 -0
- package/dist/types/lib/index.d.ts +4 -3
- package/dist/types/lib/legacy.d.ts +24 -0
- package/dist/types/lib/load-dev-server-config.d.ts +40 -0
- package/dist/types/lib/merge-dev-server-config.d.ts +16 -0
- package/dist/types/lib/portal/create-portal-manifest.d.ts +22 -0
- package/dist/types/lib/portal/index.d.ts +2 -0
- package/dist/types/lib/portal/load-portal-manifest.d.ts +65 -0
- package/dist/types/lib/portal/load-portal-schema.d.ts +43 -0
- package/dist/types/lib/portal/portal-manifest.d.ts +16 -0
- package/dist/types/lib/portal/portal-manifest.schema.d.ts +154 -0
- package/dist/types/lib/static.d.ts +10 -0
- package/dist/types/lib/types.d.ts +34 -0
- package/dist/types/lib/utils/assert.d.ts +48 -0
- package/dist/types/lib/utils/index.d.ts +5 -0
- package/dist/types/lib/utils/resolve-annotations.d.ts +11 -0
- package/dist/types/lib/utils/resolve-devops-annotations.d.ts +30 -0
- package/dist/types/lib/utils/resolve-git-commit-sha.d.ts +13 -0
- package/dist/types/lib/utils/resolve-git-remote-url.d.ts +13 -0
- package/dist/types/lib/utils/resolve-github-annotations.d.ts +65 -0
- package/dist/types/lib/utils/resolve-package-repo.d.ts +9 -0
- package/dist/types/lib/utils/resolve-package.d.ts +15 -0
- package/dist/types/lib/utils/resolve-source-entry-point.d.ts +17 -0
- package/dist/types/lib/utils/types.d.ts +1 -1
- package/dist/types/lib/utils/write-file.d.ts +14 -0
- package/dist/types/version.d.ts +1 -1
- package/docs/application.md +644 -0
- package/docs/auth.md +190 -0
- package/docs/libsecret.md +97 -0
- package/docs/migration-v10-to-v11.md +74 -0
- package/docs/portal.md +278 -0
- package/package.json +60 -69
- package/dist/bin/build-application.js +0 -55
- package/dist/bin/build-application.js.map +0 -1
- package/dist/bin/bundle-application.js +0 -41
- package/dist/bin/bundle-application.js.map +0 -1
- package/dist/bin/create-dev-serve.js +0 -127
- package/dist/bin/create-dev-serve.js.map +0 -1
- package/dist/bin/create-export-config.js +0 -40
- package/dist/bin/create-export-config.js.map +0 -1
- package/dist/bin/create-export-manifest.js +0 -67
- package/dist/bin/create-export-manifest.js.map +0 -1
- package/dist/bin/dev-portal/AppLoader.js +0 -80
- package/dist/bin/dev-portal/AppLoader.js.map +0 -1
- package/dist/bin/dev-portal/BookMarkSideSheet.js +0 -13
- package/dist/bin/dev-portal/BookMarkSideSheet.js.map +0 -1
- package/dist/bin/dev-portal/ContextSelector/ContextSelector.js +0 -40
- package/dist/bin/dev-portal/ContextSelector/ContextSelector.js.map +0 -1
- package/dist/bin/dev-portal/ContextSelector/index.js +0 -2
- package/dist/bin/dev-portal/ContextSelector/index.js.map +0 -1
- package/dist/bin/dev-portal/ContextSelector/useContextResolver.js +0 -216
- package/dist/bin/dev-portal/ContextSelector/useContextResolver.js.map +0 -1
- package/dist/bin/dev-portal/EquinorLoader.js +0 -14
- package/dist/bin/dev-portal/EquinorLoader.js.map +0 -1
- package/dist/bin/dev-portal/ErrorViewer.js +0 -7
- package/dist/bin/dev-portal/ErrorViewer.js.map +0 -1
- package/dist/bin/dev-portal/FusionLogo.js +0 -4
- package/dist/bin/dev-portal/FusionLogo.js.map +0 -1
- package/dist/bin/dev-portal/Header.Actions.js +0 -12
- package/dist/bin/dev-portal/Header.Actions.js.map +0 -1
- package/dist/bin/dev-portal/Header.js +0 -41
- package/dist/bin/dev-portal/Header.js.map +0 -1
- package/dist/bin/dev-portal/PersonSideSheet/index.js +0 -32
- package/dist/bin/dev-portal/PersonSideSheet/index.js.map +0 -1
- package/dist/bin/dev-portal/PersonSideSheet/sheets/FeatureSheetContent.js +0 -16
- package/dist/bin/dev-portal/PersonSideSheet/sheets/FeatureSheetContent.js.map +0 -1
- package/dist/bin/dev-portal/PersonSideSheet/sheets/FeatureTogglerApp.js +0 -15
- package/dist/bin/dev-portal/PersonSideSheet/sheets/FeatureTogglerApp.js.map +0 -1
- package/dist/bin/dev-portal/PersonSideSheet/sheets/FeatureTogglerPortal.js +0 -13
- package/dist/bin/dev-portal/PersonSideSheet/sheets/FeatureTogglerPortal.js.map +0 -1
- package/dist/bin/dev-portal/PersonSideSheet/sheets/LandingSheetContent.js +0 -19
- package/dist/bin/dev-portal/PersonSideSheet/sheets/LandingSheetContent.js.map +0 -1
- package/dist/bin/dev-portal/PersonSideSheet/sheets/Styled.js +0 -30
- package/dist/bin/dev-portal/PersonSideSheet/sheets/Styled.js.map +0 -1
- package/dist/bin/dev-portal/PersonSideSheet/sheets/index.js +0 -3
- package/dist/bin/dev-portal/PersonSideSheet/sheets/index.js.map +0 -1
- package/dist/bin/dev-portal/PersonSideSheet/sheets/types.js.map +0 -1
- package/dist/bin/dev-portal/Router.js +0 -59
- package/dist/bin/dev-portal/Router.js.map +0 -1
- package/dist/bin/dev-portal/config.js +0 -79
- package/dist/bin/dev-portal/config.js.map +0 -1
- package/dist/bin/dev-portal/main.js +0 -13
- package/dist/bin/dev-portal/main.js.map +0 -1
- package/dist/bin/dev-portal/resources/fallback-photo.svg.js +0 -3
- package/dist/bin/dev-portal/resources/fallback-photo.svg.js.map +0 -1
- package/dist/bin/dev-portal/useAppContextNavigation.js +0 -87
- package/dist/bin/dev-portal/useAppContextNavigation.js.map +0 -1
- package/dist/bin/main.app.js +0 -172
- package/dist/bin/main.app.js.map +0 -1
- package/dist/bin/main.js +0 -20
- package/dist/bin/main.js.map +0 -1
- package/dist/bin/public/assets/index-B7SVn0UQ.js +0 -3686
- package/dist/bin/public/index.html +0 -37
- package/dist/bin/publish-application.js +0 -96
- package/dist/bin/publish-application.js.map +0 -1
- package/dist/bin/tag-application.js +0 -73
- package/dist/bin/tag-application.js.map +0 -1
- package/dist/bin/upload-application.js +0 -63
- package/dist/bin/upload-application.js.map +0 -1
- package/dist/bin/upload-export-config.js +0 -78
- package/dist/bin/upload-export-config.js.map +0 -1
- package/dist/bin/utils/execute-command.js +0 -14
- package/dist/bin/utils/execute-command.js.map +0 -1
- package/dist/bin/utils/format.js +0 -16
- package/dist/bin/utils/format.js.map +0 -1
- package/dist/bin/utils/getEndpointUrl.js +0 -40
- package/dist/bin/utils/getEndpointUrl.js.map +0 -1
- package/dist/bin/utils/index.js +0 -14
- package/dist/bin/utils/index.js.map +0 -1
- package/dist/bin/utils/isAppRegistered.js +0 -26
- package/dist/bin/utils/isAppRegistered.js.map +0 -1
- package/dist/bin/utils/load-app-config.js +0 -26
- package/dist/bin/utils/load-app-config.js.map +0 -1
- package/dist/bin/utils/load-manifest.js +0 -31
- package/dist/bin/utils/load-manifest.js.map +0 -1
- package/dist/bin/utils/load-package.js +0 -18
- package/dist/bin/utils/load-package.js.map +0 -1
- package/dist/bin/utils/load-vite-config.js +0 -45
- package/dist/bin/utils/load-vite-config.js.map +0 -1
- package/dist/bin/utils/proxy-request-logger.js +0 -33
- package/dist/bin/utils/proxy-request-logger.js.map +0 -1
- package/dist/bin/utils/publishAppConfig.js +0 -29
- package/dist/bin/utils/publishAppConfig.js.map +0 -1
- package/dist/bin/utils/requireToken.js +0 -9
- package/dist/bin/utils/requireToken.js.map +0 -1
- package/dist/bin/utils/spinner.js +0 -65
- package/dist/bin/utils/spinner.js.map +0 -1
- package/dist/bin/utils/tagAppBundle.js +0 -26
- package/dist/bin/utils/tagAppBundle.js.map +0 -1
- package/dist/bin/utils/uploadAppBundle.js +0 -45
- package/dist/bin/utils/uploadAppBundle.js.map +0 -1
- package/dist/lib/app-config.js +0 -32
- package/dist/lib/app-config.js.map +0 -1
- package/dist/lib/app-manifest.js +0 -142
- package/dist/lib/app-manifest.js.map +0 -1
- package/dist/lib/app-package.js.map +0 -1
- package/dist/lib/index.js +0 -4
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/plugins/app-assets/app-asset-plugin.js +0 -96
- package/dist/lib/plugins/app-assets/app-asset-plugin.js.map +0 -1
- package/dist/lib/plugins/app-assets/emit-asset.js +0 -46
- package/dist/lib/plugins/app-assets/emit-asset.js.map +0 -1
- package/dist/lib/plugins/app-assets/extension-filter-pattern.js.map +0 -1
- package/dist/lib/plugins/app-assets/index.js +0 -4
- package/dist/lib/plugins/app-assets/index.js.map +0 -1
- package/dist/lib/plugins/app-assets/read-asset-content.js +0 -34
- package/dist/lib/plugins/app-assets/read-asset-content.js.map +0 -1
- package/dist/lib/plugins/app-assets/resolve-asset-id.js +0 -54
- package/dist/lib/plugins/app-assets/resolve-asset-id.js.map +0 -1
- package/dist/lib/plugins/app-assets/static.js +0 -15
- package/dist/lib/plugins/app-assets/static.js.map +0 -1
- package/dist/lib/plugins/app-proxy/app-proxy-plugin.js +0 -125
- package/dist/lib/plugins/app-proxy/app-proxy-plugin.js.map +0 -1
- package/dist/lib/plugins/app-proxy/index.js +0 -2
- package/dist/lib/plugins/app-proxy/index.js.map +0 -1
- package/dist/lib/plugins/app-settings/index.js +0 -36
- package/dist/lib/plugins/app-settings/index.js.map +0 -1
- package/dist/lib/plugins/external-public/external-public-plugin.js +0 -101
- package/dist/lib/plugins/external-public/external-public-plugin.js.map +0 -1
- package/dist/lib/plugins/external-public/index.js +0 -2
- package/dist/lib/plugins/external-public/index.js.map +0 -1
- package/dist/lib/plugins/help-proxy/help-proxy-plugin.js +0 -78
- package/dist/lib/plugins/help-proxy/help-proxy-plugin.js.map +0 -1
- package/dist/lib/plugins/help-proxy/index.js +0 -2
- package/dist/lib/plugins/help-proxy/index.js.map +0 -1
- package/dist/lib/utils/assert.js +0 -28
- package/dist/lib/utils/assert.js.map +0 -1
- package/dist/lib/utils/config.js +0 -67
- package/dist/lib/utils/config.js.map +0 -1
- package/dist/lib/utils/expect.js.map +0 -1
- package/dist/lib/utils/file-exists.js.map +0 -1
- package/dist/lib/utils/parse-json-request.js.map +0 -1
- package/dist/lib/utils/ts-transpile.js +0 -45
- package/dist/lib/utils/ts-transpile.js.map +0 -1
- package/dist/lib/vite-config.js +0 -76
- package/dist/lib/vite-config.js.map +0 -1
- package/dist/lib/vite-logger.js +0 -21
- package/dist/lib/vite-logger.js.map +0 -1
- package/dist/schemas.js +0 -14
- package/dist/schemas.js.map +0 -1
- package/dist/types/bin/build-application.d.ts +0 -13
- package/dist/types/bin/bundle-application.d.ts +0 -4
- package/dist/types/bin/create-dev-serve.d.ts +0 -12
- package/dist/types/bin/create-export-config.d.ts +0 -13
- package/dist/types/bin/create-export-manifest.d.ts +0 -16
- package/dist/types/bin/dev-portal/AppLoader.d.ts +0 -11
- package/dist/types/bin/dev-portal/BookMarkSideSheet.d.ts +0 -6
- package/dist/types/bin/dev-portal/ContextSelector/ContextSelector.d.ts +0 -8
- package/dist/types/bin/dev-portal/ContextSelector/index.d.ts +0 -1
- package/dist/types/bin/dev-portal/ContextSelector/useContextResolver.d.ts +0 -15
- package/dist/types/bin/dev-portal/EquinorLoader.d.ts +0 -5
- package/dist/types/bin/dev-portal/ErrorViewer.d.ts +0 -4
- package/dist/types/bin/dev-portal/FusionLogo.d.ts +0 -6
- package/dist/types/bin/dev-portal/Header.Actions.d.ts +0 -7
- package/dist/types/bin/dev-portal/Header.d.ts +0 -2
- package/dist/types/bin/dev-portal/PersonSideSheet/index.d.ts +0 -11
- package/dist/types/bin/dev-portal/PersonSideSheet/sheets/FeatureSheetContent.d.ts +0 -6
- package/dist/types/bin/dev-portal/PersonSideSheet/sheets/FeatureTogglerApp.d.ts +0 -5
- package/dist/types/bin/dev-portal/PersonSideSheet/sheets/FeatureTogglerPortal.d.ts +0 -5
- package/dist/types/bin/dev-portal/PersonSideSheet/sheets/LandingSheetContent.d.ts +0 -5
- package/dist/types/bin/dev-portal/PersonSideSheet/sheets/Styled.d.ts +0 -6
- package/dist/types/bin/dev-portal/PersonSideSheet/sheets/index.d.ts +0 -2
- package/dist/types/bin/dev-portal/PersonSideSheet/sheets/types.d.ts +0 -5
- package/dist/types/bin/dev-portal/Router.d.ts +0 -1
- package/dist/types/bin/dev-portal/config.d.ts +0 -3
- package/dist/types/bin/dev-portal/main.d.ts +0 -1
- package/dist/types/bin/dev-portal/resources/fallback-photo.svg.d.ts +0 -2
- package/dist/types/bin/dev-portal/useAppContextNavigation.d.ts +0 -5
- package/dist/types/bin/main.d.ts +0 -1
- package/dist/types/bin/publish-application.d.ts +0 -6
- package/dist/types/bin/tag-application.d.ts +0 -12
- package/dist/types/bin/upload-application.d.ts +0 -6
- package/dist/types/bin/upload-export-config.d.ts +0 -10
- package/dist/types/bin/utils/execute-command.d.ts +0 -8
- package/dist/types/bin/utils/getEndpointUrl.d.ts +0 -10
- package/dist/types/bin/utils/isAppRegistered.d.ts +0 -5
- package/dist/types/bin/utils/load-app-config.d.ts +0 -10
- package/dist/types/bin/utils/load-manifest.d.ts +0 -10
- package/dist/types/bin/utils/load-package.d.ts +0 -5
- package/dist/types/bin/utils/load-vite-config.d.ts +0 -10
- package/dist/types/bin/utils/proxy-request-logger.d.ts +0 -15
- package/dist/types/bin/utils/publishAppConfig.d.ts +0 -9
- package/dist/types/bin/utils/requireToken.d.ts +0 -4
- package/dist/types/bin/utils/tagAppBundle.d.ts +0 -7
- package/dist/types/bin/utils/uploadAppBundle.d.ts +0 -7
- package/dist/types/lib/app-config.d.ts +0 -27
- package/dist/types/lib/app-manifest.d.ts +0 -52
- package/dist/types/lib/plugins/app-assets/app-asset-plugin.d.ts +0 -36
- package/dist/types/lib/plugins/app-assets/emit-asset.d.ts +0 -18
- package/dist/types/lib/plugins/app-assets/index.d.ts +0 -3
- package/dist/types/lib/plugins/app-assets/read-asset-content.d.ts +0 -14
- package/dist/types/lib/plugins/app-assets/resolve-asset-id.d.ts +0 -16
- package/dist/types/lib/plugins/app-assets/static.d.ts +0 -5
- package/dist/types/lib/plugins/app-proxy/app-proxy-plugin.d.ts +0 -89
- package/dist/types/lib/plugins/app-proxy/index.d.ts +0 -1
- package/dist/types/lib/plugins/app-settings/index.d.ts +0 -32
- package/dist/types/lib/plugins/external-public/external-public-plugin.d.ts +0 -30
- package/dist/types/lib/plugins/external-public/index.d.ts +0 -1
- package/dist/types/lib/plugins/help-proxy/help-proxy-plugin.d.ts +0 -42
- package/dist/types/lib/plugins/help-proxy/index.d.ts +0 -1
- package/dist/types/lib/utils/config.d.ts +0 -32
- package/dist/types/lib/utils/ts-transpile.d.ts +0 -2
- package/dist/types/lib/vite-config.d.ts +0 -17
- package/dist/types/lib/vite-logger.d.ts +0 -2
- package/dist/version.js +0 -3
- package/dist/version.js.map +0 -1
- /package/dist/{bin/dev-portal/PersonSideSheet/sheets → esm/lib}/types.js +0 -0
- /package/dist/{lib → esm/lib}/utils/expect.js +0 -0
- /package/dist/{lib → esm/lib}/utils/file-exists.js +0 -0
- /package/dist/{lib → esm/lib}/utils/types.js +0 -0
- /package/dist/types/{bin/main.app.d.ts → cli/commands/index.d.ts} +0 -0
- /package/dist/types/lib/{plugins/app-assets/extension-filter-pattern.d.ts → utils/extension-filter.d.ts} +0 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { createOption, InvalidOptionArgumentError } from 'commander';
|
|
2
|
+
// UUID validation regex (v4 UUID format)
|
|
3
|
+
const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
4
|
+
export const tenantOption = createOption('--tenantId <string>', 'The Azure Active Directory tenant ID')
|
|
5
|
+
.env('FUSION_TENANT_ID')
|
|
6
|
+
.default('3aa4a235-b6e2-48d5-9195-7fcf05b459b0');
|
|
7
|
+
export const clientOption = createOption('--clientId <string>', 'The client ID of the application registered in Azure AD')
|
|
8
|
+
.env('FUSION_CLIENT_ID')
|
|
9
|
+
.default('a318b8e1-0295-4e17-98d5-35f67dfeba14');
|
|
10
|
+
export const tokenOption = createOption('--token <string>', 'The Azure AD access token. If provided, the --tenant and --client options are ignored')
|
|
11
|
+
.env('FUSION_TOKEN')
|
|
12
|
+
.default(undefined);
|
|
13
|
+
export const scopeOption = createOption('--scope <scopes...>', 'Azure audience scope, normally the application ID URI of the API you want to access and `.default`')
|
|
14
|
+
.env('FUSION_AUTH_SCOPE')
|
|
15
|
+
.default(['5a842df8-3238-415d-b168-9f16a6a6031b/.default']);
|
|
16
|
+
/**
|
|
17
|
+
* Enhances a given command with authentication-related options.
|
|
18
|
+
*
|
|
19
|
+
* This function adds the following options to the provided command:
|
|
20
|
+
* - `tenantId`: Specifies the tenant identifier.
|
|
21
|
+
* - `clientId`: Specifies the client identifier.
|
|
22
|
+
* - `token`: Specifies the authentication token.
|
|
23
|
+
*
|
|
24
|
+
* @param command - The command to which authentication options will be added.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { createCommand } from 'commander';
|
|
29
|
+
* import { withAuthOptions } from './path/to/this/file';
|
|
30
|
+
* const command = withAuthOptions(
|
|
31
|
+
* createCommand('my-command')
|
|
32
|
+
* .description('My command description')
|
|
33
|
+
* .action((options) => {
|
|
34
|
+
* console.log('tenantId:', options.tenant);
|
|
35
|
+
* console.log('clientId:', options.client);
|
|
36
|
+
* console.log('token:', options.token);
|
|
37
|
+
* })
|
|
38
|
+
* );
|
|
39
|
+
*
|
|
40
|
+
* withAuthOptions(command);
|
|
41
|
+
* ```
|
|
42
|
+
**/
|
|
43
|
+
export const withAuthOptions = (command, args) => {
|
|
44
|
+
command.addOption(tenantOption);
|
|
45
|
+
command.addOption(clientOption);
|
|
46
|
+
if (!args?.excludeToken) {
|
|
47
|
+
command.addOption(tokenOption);
|
|
48
|
+
}
|
|
49
|
+
if (args?.includeScope) {
|
|
50
|
+
command.addOption(scopeOption);
|
|
51
|
+
}
|
|
52
|
+
command.hook('preAction', (thisCommand) => {
|
|
53
|
+
const options = thisCommand.opts();
|
|
54
|
+
// If token is provided, skip other validations
|
|
55
|
+
if (options.token) {
|
|
56
|
+
if (typeof options.token !== 'string' || options.token.trim() === '') {
|
|
57
|
+
throw new InvalidOptionArgumentError('Token must be a non-empty string.');
|
|
58
|
+
}
|
|
59
|
+
// Remove tenantId, clientId, and scope by setting them to undefined
|
|
60
|
+
thisCommand.setOptionValue('tenantId', undefined);
|
|
61
|
+
thisCommand.setOptionValue('clientId', undefined);
|
|
62
|
+
if (args?.includeScope) {
|
|
63
|
+
thisCommand.setOptionValue('scope', undefined);
|
|
64
|
+
}
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
// Validate tenantId
|
|
68
|
+
if (!options.tenantId || typeof options.tenantId !== 'string') {
|
|
69
|
+
throw new InvalidOptionArgumentError('Tenant ID must be a non-empty string.');
|
|
70
|
+
}
|
|
71
|
+
if (!UUID_REGEX.test(options.tenantId)) {
|
|
72
|
+
throw new InvalidOptionArgumentError('Tenant ID must be a valid UUID.');
|
|
73
|
+
}
|
|
74
|
+
// Validate clientId
|
|
75
|
+
if (!options.clientId || typeof options.clientId !== 'string') {
|
|
76
|
+
throw new InvalidOptionArgumentError('Client ID must be a non-empty string.');
|
|
77
|
+
}
|
|
78
|
+
if (!UUID_REGEX.test(options.clientId)) {
|
|
79
|
+
throw new InvalidOptionArgumentError('Client ID must be a valid UUID.');
|
|
80
|
+
}
|
|
81
|
+
// Validate scope if included
|
|
82
|
+
if (args?.includeScope) {
|
|
83
|
+
if (!Array.isArray(options.scope) || options.scope.length === 0) {
|
|
84
|
+
throw new InvalidOptionArgumentError('Scope must be a non-empty array of strings.');
|
|
85
|
+
}
|
|
86
|
+
for (const scope of options.scope) {
|
|
87
|
+
if (typeof scope !== 'string' || scope.trim() === '') {
|
|
88
|
+
throw new InvalidOptionArgumentError('Each scope must be a non-empty string.');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
return command;
|
|
94
|
+
};
|
|
95
|
+
export default withAuthOptions;
|
|
96
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../src/cli/options/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAEnF,yCAAyC;AACzC,MAAM,UAAU,GAAG,wEAAwE,CAAC;AAE5F,MAAM,CAAC,MAAM,YAAY,GAAG,YAAY,CACtC,qBAAqB,EACrB,sCAAsC,CACvC;KACE,GAAG,CAAC,kBAAkB,CAAC;KACvB,OAAO,CAAC,sCAAsC,CAAC,CAAC;AAEnD,MAAM,CAAC,MAAM,YAAY,GAAG,YAAY,CACtC,qBAAqB,EACrB,yDAAyD,CAC1D;KACE,GAAG,CAAC,kBAAkB,CAAC;KACvB,OAAO,CAAC,sCAAsC,CAAC,CAAC;AAEnD,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CACrC,kBAAkB,EAClB,uFAAuF,CACxF;KACE,GAAG,CAAC,cAAc,CAAC;KACnB,OAAO,CAAC,SAAS,CAAC,CAAC;AAEtB,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CACrC,qBAAqB,EACrB,oGAAoG,CACrG;KACE,GAAG,CAAC,mBAAmB,CAAC;KACxB,OAAO,CAAC,CAAC,+CAA+C,CAAC,CAAC,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;IA0BI;AACJ,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,OAAgB,EAChB,IAAgE,EACvD,EAAE;IACX,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IAChC,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IAEhC,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC;QACxB,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC;IAED,IAAI,IAAI,EAAE,YAAY,EAAE,CAAC;QACvB,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,WAAW,EAAE,EAAE;QACxC,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC;QACnC,+CAA+C;QAC/C,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YAClB,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;gBACrE,MAAM,IAAI,0BAA0B,CAAC,mCAAmC,CAAC,CAAC;YAC5E,CAAC;YACD,oEAAoE;YACpE,WAAW,CAAC,cAAc,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;YAClD,WAAW,CAAC,cAAc,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;YAClD,IAAI,IAAI,EAAE,YAAY,EAAE,CAAC;gBACvB,WAAW,CAAC,cAAc,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;YACjD,CAAC;YACD,OAAO;QACT,CAAC;QAED,oBAAoB;QACpB,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YAC9D,MAAM,IAAI,0BAA0B,CAAC,uCAAuC,CAAC,CAAC;QAChF,CAAC;QACD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YACvC,MAAM,IAAI,0BAA0B,CAAC,iCAAiC,CAAC,CAAC;QAC1E,CAAC;QAED,oBAAoB;QACpB,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YAC9D,MAAM,IAAI,0BAA0B,CAAC,uCAAuC,CAAC,CAAC;QAChF,CAAC;QACD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YACvC,MAAM,IAAI,0BAA0B,CAAC,iCAAiC,CAAC,CAAC;QAC1E,CAAC;QAED,6BAA6B;QAC7B,IAAI,IAAI,EAAE,YAAY,EAAE,CAAC;YACvB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAChE,MAAM,IAAI,0BAA0B,CAAC,6CAA6C,CAAC,CAAC;YACtF,CAAC;YACD,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;gBAClC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;oBACrD,MAAM,IAAI,0BAA0B,CAAC,wCAAwC,CAAC,CAAC;gBACjF,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createOption } from 'commander';
|
|
2
|
+
import { resolveDefaultEnv, FusionEnv } from '../../lib/framework.node.js';
|
|
3
|
+
/**
|
|
4
|
+
* Creates an environment option for Fusion Framework CLI commands.
|
|
5
|
+
*
|
|
6
|
+
* @param options - Configuration options for the environment option.
|
|
7
|
+
* @param options.default - The default environment to use if not specified.
|
|
8
|
+
* @param options.allowDev - Whether to allow the development environment.
|
|
9
|
+
* @returns A configured Commander option for the environment.
|
|
10
|
+
*/
|
|
11
|
+
export const createEnvOption = (options) => {
|
|
12
|
+
const allowedEnvs = Object.values(FusionEnv).filter((env) => env === FusionEnv.Development ? options.allowDev : true);
|
|
13
|
+
return createOption('-e, --env <string>', [
|
|
14
|
+
'Specify the environment to use for the Fusion Framework command.',
|
|
15
|
+
`Allowed values: [${allowedEnvs.join(', ')}, custom]`,
|
|
16
|
+
'You can also set the environment using the FUSION_ENV environment variable.',
|
|
17
|
+
`Defaults to ${options.default ?? resolveDefaultEnv(options.allowDev)}.`,
|
|
18
|
+
options.allowDev
|
|
19
|
+
? 'Development environment is allowed.'
|
|
20
|
+
: 'Development environment is not allowed for this command.',
|
|
21
|
+
].join(' '))
|
|
22
|
+
.env('FUSION_ENV')
|
|
23
|
+
.default(options.default ?? resolveDefaultEnv(options.allowDev));
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Default environment option that allows the development environment.
|
|
27
|
+
*/
|
|
28
|
+
export const envOption = createEnvOption({ allowDev: true });
|
|
29
|
+
export default envOption;
|
|
30
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../../../src/cli/options/env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAI3E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAmD,EAAE,EAAE;IACrF,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAC1D,GAAG,KAAK,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CACxD,CAAC;IACF,OAAO,YAAY,CACjB,oBAAoB,EACpB;QACE,kEAAkE;QAClE,oBAAoB,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW;QACrD,6EAA6E;QAC7E,eAAe,OAAO,CAAC,OAAO,IAAI,iBAAiB,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG;QACxE,OAAO,CAAC,QAAQ;YACd,CAAC,CAAC,qCAAqC;YACvC,CAAC,CAAC,0DAA0D;KAC/D,CAAC,IAAI,CAAC,GAAG,CAAC,CACZ;SACE,GAAG,CAAC,YAAY,CAAC;SACjB,OAAO,CAAC,OAAO,CAAC,OAAO,IAAI,iBAAiB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;AACrE,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,eAAe,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AAE7D,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { mergeAppConfig } from './merge-app-config.js';
|
|
2
|
+
/**
|
|
3
|
+
* Defines the application configuration by accepting a function that returns the configuration object.
|
|
4
|
+
*
|
|
5
|
+
* This utility is typically used to encapsulate and organize application-specific settings
|
|
6
|
+
* in a structured and type-safe manner.
|
|
7
|
+
*
|
|
8
|
+
* @param fn - A function that returns the application configuration object.
|
|
9
|
+
* @returns The result of invoking the provided configuration function.
|
|
10
|
+
*/
|
|
11
|
+
export const defineAppConfig = (fn) => fn;
|
|
12
|
+
//# sourceMappingURL=app-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-config.js","sourceRoot":"","sources":["../../../../src/lib/app/app-config.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAoBvD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAe,EAAE,EAAE,CAAC,EAAE,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility to define an application manifest in a type-safe and organized manner.
|
|
3
|
+
*
|
|
4
|
+
* @param fn - A function conforming to AppManifestFn that generates the manifest configuration.
|
|
5
|
+
* @returns The result of the provided function, representing the application manifest.
|
|
6
|
+
*
|
|
7
|
+
* Usage: Use this to encapsulate manifest logic, enabling better maintainability and discoverability for RAG systems.
|
|
8
|
+
*
|
|
9
|
+
* Inline notes:
|
|
10
|
+
* - This function is a higher-order utility for manifest definition, not execution.
|
|
11
|
+
* - It does not invoke the function immediately; it simply returns it for later use.
|
|
12
|
+
* - Helps with static analysis and RAG-based documentation extraction.
|
|
13
|
+
*/
|
|
14
|
+
export const defineAppManifest = (fn) => fn;
|
|
15
|
+
//# sourceMappingURL=app-manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-manifest.js","sourceRoot":"","sources":["../../../../src/lib/app/app-manifest.ts"],"names":[],"mappings":"AA4BA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAAiB,EAAE,EAAE,CAAC,EAAE,CAAC"}
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import { dirname, relative } from 'node:path';
|
|
3
3
|
import { readPackageUp, } from 'read-package-up';
|
|
4
|
-
import { assert } from '
|
|
5
|
-
//
|
|
4
|
+
import { assert } from '../utils/assert.js';
|
|
5
|
+
// Implementation for defineAppPackage, returns the input as-is.
|
|
6
6
|
export function defineAppPackage(fnOrObject) {
|
|
7
|
+
// This function is intentionally a passthrough for both object and function types.
|
|
7
8
|
return fnOrObject;
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
10
11
|
* Resolves the entry point of a given package.
|
|
11
12
|
*
|
|
12
|
-
* This function
|
|
13
|
-
*
|
|
14
|
-
* and `module`. If none of these properties are found, it defaults to checking for
|
|
15
|
-
* common entry files like `src/index.ts`, `src/index.tsx`, `src/index.js`, and `src/index.jsx`.
|
|
13
|
+
* This function checks for common entry point fields in the package.json (entrypoint, main, module),
|
|
14
|
+
* and falls back to typical source files if not found. It returns the first existing entry.
|
|
16
15
|
*
|
|
17
|
-
* @param
|
|
16
|
+
* @param packageJson - The package.json object to resolve from.
|
|
17
|
+
* @param pkgPath - The path to the package.json file (used for relative resolution).
|
|
18
18
|
* @returns The relative path to the resolved entry point.
|
|
19
19
|
* @throws Will throw an error if no entry point can be resolved.
|
|
20
20
|
*/
|
|
21
21
|
export const resolveEntryPoint = (packageJson, pkgPath = '') => {
|
|
22
|
+
// List of possible entry points, prioritized by common convention.
|
|
22
23
|
const entrypoint = [
|
|
23
24
|
packageJson.entrypoint,
|
|
24
25
|
packageJson.main,
|
|
@@ -28,45 +29,64 @@ export const resolveEntryPoint = (packageJson, pkgPath = '') => {
|
|
|
28
29
|
'src/index.js',
|
|
29
30
|
'src/index.jsx',
|
|
30
31
|
]
|
|
32
|
+
// Filter out undefined/null values.
|
|
31
33
|
.filter((x) => !!x)
|
|
34
|
+
// Map to relative paths from the package root.
|
|
32
35
|
.map((x) => relative(dirname(pkgPath), x))
|
|
36
|
+
// Find the first entry that actually exists on disk.
|
|
33
37
|
.find((entry) => existsSync(entry));
|
|
38
|
+
// Assert that an entry point was found, otherwise throw.
|
|
34
39
|
assert(entrypoint, 'failed to resolve entrypoint');
|
|
35
40
|
return entrypoint;
|
|
36
41
|
};
|
|
37
42
|
/**
|
|
38
43
|
* Resolves the application key from the given package.json object.
|
|
39
44
|
*
|
|
45
|
+
* This function strips any leading '@' or scope from the package name, returning a normalized key.
|
|
46
|
+
*
|
|
40
47
|
* @param packageJson - An object containing the 'name' property from the package.json.
|
|
41
48
|
* @returns The resolved application key, which is the package name with any leading '@' or scope removed.
|
|
42
49
|
* @throws Will throw an error if the 'name' property is not present in the packageJson.
|
|
43
50
|
*/
|
|
44
51
|
export const resolveAppKey = (packageJson) => {
|
|
52
|
+
// Ensure the package has a name property.
|
|
45
53
|
assert(packageJson.name, 'expected [name] in packageJson');
|
|
54
|
+
// Remove leading '@' or scope from the name for normalization.
|
|
46
55
|
return packageJson.name.replace(/^@|\w.*\//gm, '');
|
|
47
56
|
};
|
|
48
57
|
/**
|
|
49
58
|
* Asserts the validity of a given package by resolving its application key and entry point.
|
|
50
59
|
*
|
|
60
|
+
* This function is useful for validating that a package is correctly structured and can be used by the framework.
|
|
61
|
+
*
|
|
51
62
|
* @param pkg - A partial representation of the application's package JSON.
|
|
63
|
+
* @throws Will throw if the package is missing a valid name or entry point.
|
|
52
64
|
*/
|
|
53
65
|
export const assertPackage = (pkg) => {
|
|
66
|
+
// Validate that the package has a valid key and entry point.
|
|
54
67
|
assert(resolveAppKey(pkg));
|
|
55
68
|
assert(resolveEntryPoint(pkg));
|
|
56
69
|
};
|
|
57
70
|
/**
|
|
58
71
|
* Resolves the application package by searching for the nearest `package.json` file.
|
|
59
72
|
*
|
|
73
|
+
* This function uses `read-package-up` to traverse up the directory tree and find the closest package.json.
|
|
74
|
+
* It returns the package contents, its path, and the root directory.
|
|
75
|
+
*
|
|
60
76
|
* @param options - Optional parameters to customize the search behavior.
|
|
61
77
|
* @returns A promise that resolves to the found package information.
|
|
62
78
|
* @throws Will throw an error if the `package.json` file is not found.
|
|
63
79
|
*/
|
|
64
80
|
export const resolveAppPackage = async (options) => {
|
|
65
|
-
|
|
66
|
-
|
|
81
|
+
// Attempt to find the nearest package.json using read-package-up.
|
|
82
|
+
const pkg = await readPackageUp(options);
|
|
83
|
+
if (!pkg) {
|
|
84
|
+
// Throw if no package.json is found in the directory tree.
|
|
67
85
|
throw Error('failed to find package.json');
|
|
68
86
|
}
|
|
69
|
-
|
|
87
|
+
// Return the resolved package, including its root directory.
|
|
88
|
+
return { ...pkg, root: dirname(pkg.path) };
|
|
70
89
|
};
|
|
90
|
+
// Export the main package resolver as the default export for convenience.
|
|
71
91
|
export default resolveAppPackage;
|
|
72
92
|
//# sourceMappingURL=app-package.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-package.js","sourceRoot":"","sources":["../../../../src/lib/app/app-package.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EAEL,aAAa,GAEd,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AA0C5C,gEAAgE;AAChE,MAAM,UAAU,gBAAgB,CAAC,UAAiC;IAChE,mFAAmF;IACnF,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,WAAwB,EAAE,OAAO,GAAG,EAAE,EAAU,EAAE;IAClF,mEAAmE;IACnE,MAAM,UAAU,GAAG;QACjB,WAAW,CAAC,UAAU;QACtB,WAAW,CAAC,IAAI;QAChB,WAAW,CAAC,MAAM;QAClB,cAAc;QACd,eAAe;QACf,cAAc;QACd,eAAe;KAChB;QACC,oCAAoC;SACnC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAChC,+CAA+C;SAC9C,GAAG,CAAC,CAAC,CAAC,EAAU,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;QAClD,qDAAqD;SACpD,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IAEtC,yDAAyD;IACzD,MAAM,CAAC,UAAU,EAAE,8BAA8B,CAAC,CAAC;IAEnD,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,WAAsC,EAAE,EAAE;IACtE,0CAA0C;IAC1C,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,gCAAgC,CAAC,CAAC;IAC3D,+DAA+D;IAC/D,OAAO,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;AACrD,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAA4B,EAAE,EAAE;IAC5D,6DAA6D;IAC7D,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,MAAM,CAAC,iBAAiB,CAAC,GAAqB,CAAC,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EACpC,OAAkC,EACL,EAAE;IAC/B,kEAAkE;IAClE,MAAM,GAAG,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,CAAC;IACzC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,2DAA2D;QAC3D,MAAM,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAC7C,CAAC;IACD,6DAA6D;IAC7D,OAAO,EAAE,GAAG,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAwB,CAAC;AACnE,CAAC,CAAC;AAEF,0EAA0E;AAC1E,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { assert, assertObject } from '../utils/assert.js';
|
|
2
|
+
import { resolveEntryPoint } from '../utils/resolve-source-entry-point.js';
|
|
3
|
+
import { resolveRepoFromPackage } from '../utils/resolve-package-repo.js';
|
|
4
|
+
import { resolveGitRemoteUrl } from '../utils/resolve-git-remote-url.js';
|
|
5
|
+
import { resolveGitCommitSha } from '../utils/resolve-git-commit-sha.js';
|
|
6
|
+
import { resolveAnnotations } from '../utils/resolve-annotations.js';
|
|
7
|
+
import { ASSET_EXTENSIONS } from '../static.js';
|
|
8
|
+
/**
|
|
9
|
+
* Resolves the entry point for the application based on the environment and package.json.
|
|
10
|
+
*
|
|
11
|
+
* Uses the compiled entry point for production/preview builds, otherwise uses the source entry point.
|
|
12
|
+
*
|
|
13
|
+
* @param env - The runtime environment.
|
|
14
|
+
* @param packageJson - The application's package.json object.
|
|
15
|
+
* @returns The resolved entry point path as a string.
|
|
16
|
+
*/
|
|
17
|
+
const resolveAppEntryPoint = (env, packageJson) => {
|
|
18
|
+
// use compiled entry point when building for production or preview
|
|
19
|
+
if (env.command === 'build' || env.isPreview) {
|
|
20
|
+
return packageJson.main || packageJson.module || 'dist/app-bundle.js';
|
|
21
|
+
}
|
|
22
|
+
// use source entry point when developing
|
|
23
|
+
return resolveEntryPoint(env.root);
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Creates an AppManifest object from the given runtime environment and package.json.
|
|
27
|
+
*
|
|
28
|
+
* This function extracts and normalizes manifest fields, resolves the entry point, asset path,
|
|
29
|
+
* and repository information, and includes build metadata. It is the main entry for generating
|
|
30
|
+
* a manifest for Fusion Framework applications.
|
|
31
|
+
*
|
|
32
|
+
* @param env - The runtime environment.
|
|
33
|
+
* @param packageJson - The application's package.json object.
|
|
34
|
+
* @returns The generated AppManifest object.
|
|
35
|
+
* @throws If required fields are missing in packageJson.
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
export const createAppManifestFromPackage = (env, packageJson) => {
|
|
39
|
+
// Validate input objects
|
|
40
|
+
assertObject(packageJson, 'expected packageJson');
|
|
41
|
+
assert(packageJson.name, 'expected [name] in packageJson');
|
|
42
|
+
assert(packageJson.version, 'expected [version] in packageJson');
|
|
43
|
+
// Resolve the entry point for the app
|
|
44
|
+
const entryPoint = resolveAppEntryPoint(env, packageJson);
|
|
45
|
+
// Extract appKey from package name by removing the scope and leading @
|
|
46
|
+
// This ensures a normalized, unique key for the app
|
|
47
|
+
const appKey = packageJson.name.replace(/^@|\w.*\//gm, '');
|
|
48
|
+
const version = packageJson.version;
|
|
49
|
+
// Try to resolve the GitHub repo from package or git config
|
|
50
|
+
const githubRepo = resolveRepoFromPackage(packageJson) ?? resolveGitRemoteUrl();
|
|
51
|
+
// Return the manifest object, using satisfies for type safety
|
|
52
|
+
return {
|
|
53
|
+
appKey,
|
|
54
|
+
displayName: packageJson.name,
|
|
55
|
+
description: packageJson.description || '',
|
|
56
|
+
keywords: packageJson.keywords,
|
|
57
|
+
type: 'standalone',
|
|
58
|
+
build: {
|
|
59
|
+
entryPoint,
|
|
60
|
+
githubRepo,
|
|
61
|
+
version,
|
|
62
|
+
timestamp: new Date().toISOString(), // Build timestamp for traceability
|
|
63
|
+
commitSha: resolveGitCommitSha(), // Current git commit SHA for traceability
|
|
64
|
+
annotations: resolveAnnotations(), // Resolve any build annotations
|
|
65
|
+
projectPage: packageJson.homepage,
|
|
66
|
+
allowedExtensions: ASSET_EXTENSIONS.map(
|
|
67
|
+
// TODO: @jaysencpp, this is just 🫤, extensions should not require leading dot
|
|
68
|
+
(ext) => `.${ext}`),
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=create-app-manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-app-manifest.js","sourceRoot":"","sources":["../../../../src/lib/app/create-app-manifest.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAIhD;;;;;;;;GAQG;AACH,MAAM,oBAAoB,GAAG,CAAC,GAAe,EAAE,WAAwB,EAAU,EAAE;IACjF,mEAAmE;IACnE,IAAI,GAAG,CAAC,OAAO,KAAK,OAAO,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;QAC7C,OAAO,WAAW,CAAC,IAAI,IAAI,WAAW,CAAC,MAAM,IAAI,oBAAoB,CAAC;IACxE,CAAC;IACD,yCAAyC;IACzC,OAAO,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAC1C,GAAe,EACf,WAAwB,EACX,EAAE;IACf,yBAAyB;IACzB,YAAY,CAAC,WAAW,EAAE,sBAAsB,CAAC,CAAC;IAClD,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,gCAAgC,CAAC,CAAC;IAC3D,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,mCAAmC,CAAC,CAAC;IAEjE,sCAAsC;IACtC,MAAM,UAAU,GAAG,oBAAoB,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;IAE1D,uEAAuE;IACvE,oDAAoD;IACpD,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;IAC3D,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC;IAEpC,4DAA4D;IAC5D,MAAM,UAAU,GAAG,sBAAsB,CAAC,WAAW,CAAC,IAAI,mBAAmB,EAAE,CAAC;IAEhF,8DAA8D;IAC9D,OAAO;QACL,MAAM;QACN,WAAW,EAAE,WAAW,CAAC,IAAI;QAC7B,WAAW,EAAE,WAAW,CAAC,WAAW,IAAI,EAAE;QAC1C,QAAQ,EAAE,WAAW,CAAC,QAAQ;QAC9B,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE;YACL,UAAU;YACV,UAAU;YACV,OAAO;YACP,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,mCAAmC;YACxE,SAAS,EAAE,mBAAmB,EAAE,EAAE,0CAA0C;YAC5E,WAAW,EAAE,kBAAkB,EAAE,EAAE,gCAAgC;YACnE,WAAW,EAAE,WAAW,CAAC,QAAQ;YACjC,iBAAiB,EAAE,gBAAgB,CAAC,GAAG;YACrC,+EAA+E;YAC/E,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,GAAG,EAAE,CACnB;SACF;KACoB,CAAC;AAC1B,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { defineAppManifest } from './app-manifest.js';
|
|
2
|
+
export { createAppManifestFromPackage } from './create-app-manifest.js';
|
|
3
|
+
export { mergeAppManifests } from './merge-app-manifest.js';
|
|
4
|
+
export { loadAppManifest } from './load-app-manifest.js';
|
|
5
|
+
export { mergeAppConfig } from './merge-app-config.js';
|
|
6
|
+
export { defineAppConfig } from './app-config.js';
|
|
7
|
+
export { loadAppConfig } from './load-app-config.js';
|
|
8
|
+
export { ApiAppConfigSchema } from './schemas.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAwC,MAAM,mBAAmB,CAAC;AAC5F,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAA0B,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAoC,MAAM,iBAAiB,CAAC;AACpF,OAAO,EAAE,aAAa,EAAwB,MAAM,sBAAsB,CAAC;AAE3E,OAAO,EAAE,kBAAkB,EAAqB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { importConfig } from '@equinor/fusion-imports';
|
|
2
|
+
import { ApiAppConfigSchema } from './schemas.js';
|
|
3
|
+
/**
|
|
4
|
+
* Loads and resolves the application configuration from a file or function export.
|
|
5
|
+
*
|
|
6
|
+
* This function uses a script resolver to handle dynamic imports. If the imported module's default export
|
|
7
|
+
* is a function, it will be invoked with the runtime environment and the base configuration. The result
|
|
8
|
+
* is validated against the `ApiAppConfigSchema`. If the export is an object, it is validated directly.
|
|
9
|
+
*
|
|
10
|
+
* @param env - The runtime environment containing the root directory and other environment-specific settings.
|
|
11
|
+
* @param options - Optional parameters for configuring the import process.
|
|
12
|
+
* @returns A promise that resolves to the imported and validated application configuration.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* - Supports both static and dynamic config authoring patterns.
|
|
16
|
+
* - Ensures all configs are validated against the schema for type safety.
|
|
17
|
+
* - Designed for maintainability and RAG-based documentation extraction.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const config = await loadAppConfig(env, { file: 'custom.config.ts' });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export const loadAppConfig = (env, options) => {
|
|
25
|
+
// Suggest config filenames based on environment, fallback to default
|
|
26
|
+
const suggestions = options?.file ?? [`app.config.${env.environment}`, 'app.config'];
|
|
27
|
+
return importConfig(suggestions, {
|
|
28
|
+
baseDir: env.root, // Set the base directory for config resolution
|
|
29
|
+
extensions: options?.extensions, // Allow custom file extensions
|
|
30
|
+
script: {
|
|
31
|
+
// Custom resolver for the imported config module
|
|
32
|
+
resolve: async (module) => {
|
|
33
|
+
const base = options?.base ?? { environment: {} }; // Use provided base or default
|
|
34
|
+
// If the module's default export is a function, invoke it with the environment and base config
|
|
35
|
+
// and validate the result against the schema
|
|
36
|
+
if (typeof module.default === 'function') {
|
|
37
|
+
const result = (await module.default(env, { base })) ?? base;
|
|
38
|
+
return ApiAppConfigSchema.parse(result ?? base); // Validate and return
|
|
39
|
+
}
|
|
40
|
+
// If the module's default export is not a function, treat it as a configuration object
|
|
41
|
+
// and validate it against the schema
|
|
42
|
+
return ApiAppConfigSchema.parse(module.default ?? base); // Validate and return
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=load-app-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-app-config.js","sourceRoot":"","sources":["../../../../src/lib/app/load-app-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA2B,MAAM,yBAAyB,CAAC;AAEhF,OAAO,EAAqB,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAmCrE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,GAAe,EACf,OAA8B,EACa,EAAE;IAC7C,qEAAqE;IACrE,MAAM,WAAW,GAAG,OAAO,EAAE,IAAI,IAAI,CAAC,cAAc,GAAG,CAAC,WAAW,EAAE,EAAE,YAAY,CAAC,CAAC;IACrF,OAAO,YAAY,CAAC,WAAW,EAAE;QAC/B,OAAO,EAAE,GAAG,CAAC,IAAI,EAAE,+CAA+C;QAClE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,+BAA+B;QAChE,MAAM,EAAE;YACN,iDAAiD;YACjD,OAAO,EAAE,KAAK,EAAE,MAAoC,EAAyB,EAAE;gBAC7E,MAAM,IAAI,GAAiB,OAAO,EAAE,IAAI,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC,+BAA+B;gBAEhG,+FAA+F;gBAC/F,6CAA6C;gBAC7C,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;oBACzC,MAAM,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC;oBAC7D,OAAO,kBAAkB,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,sBAAsB;gBACzE,CAAC;gBACD,uFAAuF;gBACvF,qCAAqC;gBACrC,OAAO,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,sBAAsB;YACjF,CAAC;SACF;KACF,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { importConfig } from '@equinor/fusion-imports';
|
|
2
|
+
import mergeAppManifests from './merge-app-manifest.js';
|
|
3
|
+
/**
|
|
4
|
+
* Loads an application manifest file and processes its contents.
|
|
5
|
+
*
|
|
6
|
+
* This function attempts to load a configuration file (defaulting to `app.manifest`) and resolves
|
|
7
|
+
* its contents using a provided script resolver. The manifest can either be a static object
|
|
8
|
+
* or a function that dynamically generates the manifest based on the runtime environment.
|
|
9
|
+
*
|
|
10
|
+
* If the specified file is not found and the runtime environment includes an `environment` property,
|
|
11
|
+
* the function will attempt to load a manifest file specific to that environment (e.g., `app.manifest.<environment>`).
|
|
12
|
+
*
|
|
13
|
+
* @param env - The runtime environment object, containing information such as the root directory and environment name.
|
|
14
|
+
* @param options - Optional parameters for loading the manifest.
|
|
15
|
+
* @returns A promise that resolves to an object containing the loaded manifest, the file path, and the file extension.
|
|
16
|
+
* @throws {FileNotFoundError} If the manifest file cannot be found and no fallback is available.
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export const loadAppManifest = async (env, options) => {
|
|
20
|
+
// Suggest config filenames based on environment
|
|
21
|
+
const suggestions = options?.file ?? [
|
|
22
|
+
`app.manifest.${env.environment}`,
|
|
23
|
+
'app.manifest',
|
|
24
|
+
'app.manifest.config',
|
|
25
|
+
];
|
|
26
|
+
// Use importConfig to dynamically import and resolve the manifest
|
|
27
|
+
const importResult = await importConfig(suggestions, {
|
|
28
|
+
baseDir: env.root,
|
|
29
|
+
extensions: options?.extensions,
|
|
30
|
+
script: {
|
|
31
|
+
/**
|
|
32
|
+
* Custom resolver for the imported manifest module.
|
|
33
|
+
*
|
|
34
|
+
* This function determines if the imported module's default export is a function or an object.
|
|
35
|
+
* If it's a function, it is invoked with the runtime environment and the base manifest, allowing
|
|
36
|
+
* for dynamic manifest generation. If it's an object, it is used directly as the manifest.
|
|
37
|
+
*
|
|
38
|
+
* @param module - The imported module containing the manifest export (either function or object).
|
|
39
|
+
* @returns The resolved manifest of type T.
|
|
40
|
+
*/
|
|
41
|
+
resolve: async (module) => {
|
|
42
|
+
const base = options?.base ?? {}; // Use provided base or fallback to empty object
|
|
43
|
+
// If the module's default export is a function, invoke it with the environment and base manifest
|
|
44
|
+
if (typeof module.default === 'function') {
|
|
45
|
+
const result = await module.default(env, { base });
|
|
46
|
+
return mergeAppManifests(base, result ?? {}); // Merge and cast to Record<string, unknown>
|
|
47
|
+
}
|
|
48
|
+
// If the module's default export is not a function, treat it as a manifest object
|
|
49
|
+
return mergeAppManifests(base, module.default ?? {});
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
// Return the loaded manifest, file path, and extension for further use
|
|
54
|
+
// Maintainers: This return structure is used by downstream consumers to access the manifest and its metadata
|
|
55
|
+
return {
|
|
56
|
+
manifest: importResult.config,
|
|
57
|
+
path: importResult.path,
|
|
58
|
+
extension: importResult.extension,
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=load-app-manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-app-manifest.js","sourceRoot":"","sources":["../../../../src/lib/app/load-app-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAMvD,OAAO,iBAAiB,MAAM,yBAAyB,CAAC;AAyCxD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAClC,GAAe,EACf,OAAgC,EACA,EAAE;IAClC,gDAAgD;IAChD,MAAM,WAAW,GAAG,OAAO,EAAE,IAAI,IAAI;QACnC,gBAAgB,GAAG,CAAC,WAAW,EAAE;QACjC,cAAc;QACd,qBAAqB;KACtB,CAAC;IACF,kEAAkE;IAClE,MAAM,YAAY,GAAG,MAAM,YAAY,CACrC,WAAW,EACX;QACE,OAAO,EAAE,GAAG,CAAC,IAAI;QACjB,UAAU,EAAE,OAAO,EAAE,UAAU;QAC/B,MAAM,EAAE;YACN;;;;;;;;;eASG;YACH,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;gBACxB,MAAM,IAAI,GAAgB,OAAO,EAAE,IAAI,IAAK,EAAkB,CAAC,CAAC,gDAAgD;gBAChH,iGAAiG;gBACjG,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;oBACzC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;oBACnD,OAAO,iBAAiB,CAAC,IAAI,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,4CAA4C;gBAC5F,CAAC;gBACD,kFAAkF;gBAClF,OAAO,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;YACvD,CAAC;SACF;KACF,CACF,CAAC;IACF,uEAAuE;IACvE,6GAA6G;IAC7G,OAAO;QACL,QAAQ,EAAE,YAAY,CAAC,MAAM;QAC7B,IAAI,EAAE,YAAY,CAAC,IAAI;QACvB,SAAS,EAAE,YAAY,CAAC,SAAS;KAClC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import mergeWith from 'lodash.mergewith';
|
|
2
|
+
/**
|
|
3
|
+
* Merges a base application configuration object with an overrides object,
|
|
4
|
+
* returning a new configuration object. If the `scopes` property is present
|
|
5
|
+
* in the overrides, it will replace the corresponding property in the base
|
|
6
|
+
* configuration instead of merging deeply.
|
|
7
|
+
*
|
|
8
|
+
* @typeParam T - The type of the application configuration object, extending `AppConfig`.
|
|
9
|
+
* @param base - The base configuration object to merge into.
|
|
10
|
+
* @param overrides - An object containing properties to override in the base configuration.
|
|
11
|
+
* @returns A new configuration object resulting from merging `base` and `overrides`.
|
|
12
|
+
*/
|
|
13
|
+
export const mergeAppConfig = (base, overrides) => {
|
|
14
|
+
// if scopes are provided in overrides, use the new scopes
|
|
15
|
+
return mergeWith(base, overrides, (_, value, key) => {
|
|
16
|
+
if (key === 'scopes') {
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=merge-app-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-app-config.js","sourceRoot":"","sources":["../../../../src/lib/app/merge-app-config.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAGzC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAsB,IAAO,EAAE,SAAqB,EAAK,EAAE;IACvF,0DAA0D;IAC1D,OAAO,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QAClD,IAAI,GAAG,KAAK,QAAQ,EAAE,CAAC;YACrB,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC,CAAM,CAAC;AACV,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import mergeWith from 'lodash.mergewith';
|
|
2
|
+
/**
|
|
3
|
+
* Deeply merges two application manifests using lodash's mergeWith.
|
|
4
|
+
*
|
|
5
|
+
* This utility is intended for combining a base manifest with an override manifest,
|
|
6
|
+
* supporting recursive merging of nested properties. It is commonly used in scenarios
|
|
7
|
+
* where environment-specific or user-specific manifest customizations are required.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* export default defineAppManifest(base => mergeAppManifests(base, { prop: value }));
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* @param base - The base manifest to merge with. Typically the default or environment-agnostic manifest.
|
|
15
|
+
* @param overrides - The manifest containing properties to override or extend the base manifest.
|
|
16
|
+
* @returns The deeply merged manifest object.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* - Maintainers: This function does not perform schema validation. Ensure validation is handled elsewhere.
|
|
20
|
+
* - Future: Consider adding assertions or schema checks after merging for safety.
|
|
21
|
+
*/
|
|
22
|
+
export const mergeAppManifests = (base, // The base manifest (may be partial)
|
|
23
|
+
overrides) => {
|
|
24
|
+
// Use lodash.mergeWith for deep merging of manifest objects
|
|
25
|
+
const manifest = mergeWith(base, overrides);
|
|
26
|
+
// TODO: Add assertions or schema validation here if needed
|
|
27
|
+
return manifest;
|
|
28
|
+
};
|
|
29
|
+
// Export as default for convenience in import statements
|
|
30
|
+
export default mergeAppManifests;
|
|
31
|
+
//# sourceMappingURL=merge-app-manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-app-manifest.js","sourceRoot":"","sources":["../../../../src/lib/app/merge-app-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAIzC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,IAAmC,EAAE,qCAAqC;AAC1E,SAAwC,EAC3B,EAAE;IACf,4DAA4D;IAC5D,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,EAAE,SAAS,CAAgB,CAAC;IAC3D,2DAA2D;IAC3D,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,yDAAyD;AACzD,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schema for validating the API application configuration object.
|
|
4
|
+
*
|
|
5
|
+
* This schema defines the structure and types for the app config used in the Fusion Framework CLI.
|
|
6
|
+
* It ensures that the configuration adheres to expected types and provides sensible defaults.
|
|
7
|
+
*/
|
|
8
|
+
export const ApiAppConfigSchema = z
|
|
9
|
+
.object({
|
|
10
|
+
environment: z
|
|
11
|
+
.record(z.any())
|
|
12
|
+
.describe('Key-value map of environment-specific variables for the application. Defaults to an empty object if not provided.')
|
|
13
|
+
.optional()
|
|
14
|
+
.default({}), // Arbitrary environment variables, default empty
|
|
15
|
+
endpoints: z
|
|
16
|
+
.record(z.object({
|
|
17
|
+
url: z.string().describe('The endpoint URL. This field is required.'),
|
|
18
|
+
scopes: z
|
|
19
|
+
.array(z.string())
|
|
20
|
+
.optional()
|
|
21
|
+
.default([])
|
|
22
|
+
.describe('List of scopes required for accessing this endpoint. Defaults to an empty array.'),
|
|
23
|
+
}))
|
|
24
|
+
.describe('A mapping of endpoint names to their configuration objects. Each endpoint must specify a URL and may specify scopes.')
|
|
25
|
+
.optional(), // Endpoints are optional
|
|
26
|
+
})
|
|
27
|
+
.describe('The API application configuration schema, defining environment variables and endpoints for the application.');
|
|
28
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../../src/lib/app/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAChC,MAAM,CAAC;IACN,WAAW,EAAE,CAAC;SACX,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;SACf,QAAQ,CACP,mHAAmH,CACpH;SACA,QAAQ,EAAE;SACV,OAAO,CAAC,EAAE,CAAC,EAAE,iDAAiD;IACjE,SAAS,EAAE,CAAC;SACT,MAAM,CACL,CAAC,CAAC,MAAM,CAAC;QACP,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2CAA2C,CAAC;QACrE,MAAM,EAAE,CAAC;aACN,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;aACjB,QAAQ,EAAE;aACV,OAAO,CAAC,EAAE,CAAC;aACX,QAAQ,CACP,kFAAkF,CACnF;KACJ,CAAC,CACH;SACA,QAAQ,CACP,sHAAsH,CACvH;SACA,QAAQ,EAAE,EAAE,yBAAyB;CACzC,CAAC;KACD,QAAQ,CACP,6GAA6G,CAC9G,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-server.js","sourceRoot":"","sources":["../../../src/lib/dev-server.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,qBAAqB,GAGtB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC"}
|