@stackonward/cli 0.0.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4588 -205
- package/dist/index.js.map +1 -1
- package/dist/resources/apple/.claude/docs/architecture-template.md +54 -0
- package/dist/resources/apple/.claude/docs/architecture.md +52 -0
- package/dist/resources/apple/.claude/docs/index.md +13 -0
- package/dist/resources/apple/.claude/docs/security-lifecycle.md +57 -0
- package/dist/resources/apple/.claude/docs/stack.md +93 -0
- package/dist/resources/apple/.claude/docs/verification.md +63 -0
- package/dist/resources/apple/AGENTS.md +397 -0
- package/dist/resources/apple/CLAUDE.md +397 -0
- package/dist/resources/apple/Gemfile +2 -0
- package/dist/resources/apple/Gemfile.lock +365 -0
- package/dist/resources/apple/_gitignore +14 -0
- package/dist/resources/apple/fastlane/Fastfile +123 -0
- package/dist/resources/components/nuxt/site-source/app/app.vue +42 -0
- package/dist/resources/components/nuxt/site-source/app/assets/css/site-shell.css +1035 -0
- package/dist/resources/components/nuxt/site-source/app/assets/icons/brand/.gitkeep +0 -0
- package/dist/resources/components/nuxt/site-source/app/assets/icons/common/.gitkeep +0 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/ApplicationHeader.vue +35 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/ApplicationShell.vue +56 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/ApplicationSidebar.vue +40 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/BackToTop.vue +42 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/ContentArticlePage.vue +40 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/ContentListPage.vue +30 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/CookieConsent.vue +18 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/MarketingFooter.vue +52 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/MarketingHeader.vue +106 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/MarketingShell.vue +35 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/SiteBrand.vue +10 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/StaticPage.vue +21 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/ToastViewport.vue +25 -0
- package/dist/resources/components/nuxt/site-source/app/components/ui/BaseButton.vue +86 -0
- package/dist/resources/components/nuxt/site-source/app/components/ui/BaseGradientBorder.vue +59 -0
- package/dist/resources/components/nuxt/site-source/app/components/ui/BaseModal.vue +131 -0
- package/dist/resources/components/nuxt/site-source/app/components/ui/BasePopover.vue +150 -0
- package/dist/resources/components/nuxt/site-source/app/components/ui/BaseText.vue +138 -0
- package/dist/resources/components/nuxt/site-source/app/components/ui/CheckoutStatus.vue +112 -0
- package/dist/resources/components/nuxt/site-source/app/components/ui/CheckoutSummary.vue +172 -0
- package/dist/resources/components/nuxt/site-source/app/components/ui/GoogleSignInButton.vue +113 -0
- package/dist/resources/components/nuxt/site-source/app/components/ui/InfiniteScroll.vue +123 -0
- package/dist/resources/components/nuxt/site-source/app/components/ui/YoutubeEmbed.vue +126 -0
- package/dist/resources/components/nuxt/site-source/app/composables/useAnalytics.ts +24 -0
- package/dist/resources/components/nuxt/site-source/app/composables/useCheckout.ts +121 -0
- package/dist/resources/components/nuxt/site-source/app/composables/useConsent.ts +31 -0
- package/dist/resources/components/nuxt/site-source/app/composables/useGoogleIdentity.ts +163 -0
- package/dist/resources/components/nuxt/site-source/app/composables/useNavigation.ts +11 -0
- package/dist/resources/components/nuxt/site-source/app/composables/useSeo.ts +33 -0
- package/dist/resources/components/nuxt/site-source/app/composables/useSiteShell.ts +58 -0
- package/dist/resources/components/nuxt/site-source/app/composables/useToasts.ts +48 -0
- package/dist/resources/components/nuxt/site-source/app/layouts/app.vue +5 -0
- package/dist/resources/components/nuxt/site-source/app/layouts/default.vue +5 -0
- package/dist/resources/components/nuxt/site-source/app/plugins/analytics.client.ts +121 -0
- package/dist/resources/components/nuxt/site-source/app/plugins/google-identity.client.ts +24 -0
- package/dist/resources/components/nuxt/site-source/app/theme/accordion.ts +9 -0
- package/dist/resources/components/nuxt/site-source/app/theme/breadcrumb.ts +8 -0
- package/dist/resources/components/nuxt/site-source/app/theme/button.ts +92 -0
- package/dist/resources/components/nuxt/site-source/app/theme/carousel.ts +11 -0
- package/dist/resources/components/nuxt/site-source/app/theme/checkbox.ts +12 -0
- package/dist/resources/components/nuxt/site-source/app/theme/index.ts +30 -0
- package/dist/resources/components/nuxt/site-source/app/theme/input.ts +47 -0
- package/dist/resources/components/nuxt/site-source/app/theme/modal.ts +9 -0
- package/dist/resources/components/nuxt/site-source/app/theme/pagination.ts +6 -0
- package/dist/resources/components/nuxt/site-source/app/theme/select.ts +23 -0
- package/dist/resources/components/nuxt/site-source/app/theme/stepper.ts +10 -0
- package/dist/resources/components/nuxt/site-source/app/theme/toast.ts +8 -0
- package/dist/resources/components/nuxt/site-source/app/theme/tooltip.ts +6 -0
- package/dist/resources/components/nuxt/site-source/app/types/site-shell.ts +85 -0
- package/dist/resources/components/react/ui/Button.tsx +73 -0
- package/dist/resources/components/react/ui/Input.tsx +44 -0
- package/dist/resources/components/registry.json +355 -0
- package/dist/resources/components/vue/feedback/Toast.vue +120 -0
- package/dist/resources/components/vue/feedback/useToast.ts +70 -0
- package/dist/resources/components/vue/media/FileUpload.vue +229 -0
- package/dist/resources/components/vue/media/VideoPlayer.vue +157 -0
- package/dist/resources/components/vue/ui/AppImage.vue +147 -0
- package/dist/resources/components/vue/ui/BottomSheet.vue +217 -0
- package/dist/resources/components/vue/ui/Button.vue +154 -0
- package/dist/resources/components/vue/ui/Card.vue +111 -0
- package/dist/resources/components/vue/ui/Input.vue +113 -0
- package/dist/resources/components/vue/ui/Modal.vue +193 -0
- package/dist/resources/components/vue/ui/ScrollArea.vue +163 -0
- package/dist/resources/components/vue/ui/Tooltip.vue +115 -0
- package/dist/resources/registry.json +158 -0
- package/dist/resources/snippets/node/cache.ts +116 -0
- package/dist/resources/snippets/node/date.ts +126 -0
- package/dist/resources/snippets/node/logger.ts +104 -0
- package/dist/resources/snippets/node/validation.ts +132 -0
- package/dist/resources/snippets/react/useDebounce.ts +90 -0
- package/dist/resources/snippets/registry.json +65 -0
- package/dist/resources/snippets/vue/useAsync.ts +96 -0
- package/dist/resources/snippets/vue/usePagination.ts +102 -0
- package/dist/resources/templates/base/.claude/docs/architecture-template.md +459 -0
- package/dist/resources/templates/base/.claude/docs/architecture.md +137 -0
- package/dist/resources/templates/base/.claude/docs/index.md +42 -0
- package/dist/resources/templates/base/.claude/docs/security-lifecycle.md +129 -0
- package/dist/resources/templates/base/.claude/docs/verification.md +121 -0
- package/dist/resources/templates/base/AGENTS.md +415 -0
- package/dist/resources/templates/base/CLAUDE.md +415 -0
- package/dist/resources/templates/go-backend/.claude/docs/api-design.md +486 -0
- package/dist/resources/templates/go-backend/.claude/docs/architecture-template.md +449 -0
- package/dist/resources/templates/go-backend/.claude/docs/check-list.md +155 -0
- package/dist/resources/templates/go-backend/.claude/docs/database.md +369 -0
- package/dist/resources/templates/go-backend/.claude/docs/e2e-standards.md +161 -0
- package/dist/resources/templates/go-backend/.claude/docs/error-handling.md +558 -0
- package/dist/resources/templates/go-backend/.claude/docs/event-runtime-boundary.md +124 -0
- package/dist/resources/templates/go-backend/.claude/docs/identifier-contract.md +195 -0
- package/dist/resources/templates/go-backend/.claude/docs/index.md +22 -0
- package/dist/resources/templates/go-backend/.claude/docs/logging.md +314 -0
- package/dist/resources/templates/go-backend/.claude/docs/mediagen-provider-onboarding-sop.md +917 -0
- package/dist/resources/templates/go-backend/.claude/docs/mediagen-provider-quick-reference.md +195 -0
- package/dist/resources/templates/go-backend/.claude/docs/module-standards.md +309 -0
- package/dist/resources/templates/go-backend/.claude/docs/openapi-contract.md +141 -0
- package/dist/resources/templates/go-backend/.claude/docs/payment-gateway-onboarding.md +283 -0
- package/dist/resources/templates/go-backend/.claude/docs/platform-boundary.md +191 -0
- package/dist/resources/templates/go-backend/.claude/docs/quality-gates.md +112 -0
- package/dist/resources/templates/go-backend/.dockerignore +6 -0
- package/dist/resources/templates/go-backend/.env.example +13 -0
- package/dist/resources/templates/go-backend/.gitattributes +2 -0
- package/dist/resources/templates/go-backend/AGENTS.md +1139 -0
- package/dist/resources/templates/go-backend/CLAUDE.md +1139 -0
- package/dist/resources/templates/go-backend/Dockerfile +14 -0
- package/dist/resources/templates/go-backend/Makefile +71 -0
- package/dist/resources/templates/go-backend/README.md +66 -0
- package/dist/resources/templates/go-backend/_gitignore +10 -0
- package/dist/resources/templates/go-backend/api/openapi/README.md +29 -0
- package/dist/resources/templates/go-backend/api/openapi/dist/artifact-manifest.json +19 -0
- package/dist/resources/templates/go-backend/api/openapi/dist/conformance-matrix.json +276 -0
- package/dist/resources/templates/go-backend/api/openapi/document.go +30 -0
- package/dist/resources/templates/go-backend/api/openapi/package.json +28 -0
- package/dist/resources/templates/go-backend/api/openapi/pnpm-lock.yaml +3052 -0
- package/dist/resources/templates/go-backend/api/openapi/redocly-source.yaml +18 -0
- package/dist/resources/templates/go-backend/api/openapi/redocly.yaml +8 -0
- package/dist/resources/templates/go-backend/api/openapi/sdk-generators.json +16 -0
- package/dist/resources/templates/go-backend/api/openapi/service-registry.json +39 -0
- package/dist/resources/templates/go-backend/api/openapi/services/product-api/conformance/runtime.arazzo.yaml +65 -0
- package/dist/resources/templates/go-backend/api/openapi/services/product-api/dist/internal.openapi.json +327 -0
- package/dist/resources/templates/go-backend/api/openapi/services/product-api/dist/runtime-contract.json +56 -0
- package/dist/resources/templates/go-backend/api/openapi/services/product-api/openapi.yaml +222 -0
- package/dist/resources/templates/go-backend/api/openapi/services/worker/conformance/runtime.arazzo.yaml +65 -0
- package/dist/resources/templates/go-backend/api/openapi/services/worker/dist/internal.openapi.json +327 -0
- package/dist/resources/templates/go-backend/api/openapi/services/worker/dist/runtime-contract.json +56 -0
- package/dist/resources/templates/go-backend/api/openapi/services/worker/openapi.yaml +222 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/breaking.mjs +416 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/build.mjs +103 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/conformance_coverage.mjs +111 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/contract_compiler.mjs +62 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/contract_policy.mjs +208 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/delegated_contract.mjs +302 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/deterministic_archive.mjs +69 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/documentation_example_privacy.mjs +93 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/documentation_projection.mjs +498 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/documentation_quality.mjs +346 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/git_artifact_history.mjs +188 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/manifest.mjs +170 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/overlay.mjs +98 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/project.mjs +549 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/route_contract.mjs +156 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/runtime_conformance.mjs +193 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/scalar_asset_localization.mjs +164 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/sdk_generator.mjs +229 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/semantic_version.mjs +64 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/service_contract_inputs.mjs +16 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/breaking.test.mjs +365 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/build.test.mjs +42 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/conformance_coverage.test.mjs +88 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/contract_policy.test.mjs +257 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/delegated_contract.test.mjs +205 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/documentation_example_privacy.test.mjs +51 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/documentation_projection.test.mjs +368 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/documentation_quality.test.mjs +151 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/git_artifact_history.test.mjs +60 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/head_policy.test.mjs +8 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/overlay.test.mjs +44 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/projection.test.mjs +270 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/redocly_documentation_rules.test.mjs +146 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/release_manifest.test.mjs +76 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/route_contract.test.mjs +119 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/runtime_conformance.test.mjs +75 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/scalar_asset_localization.test.mjs +50 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/sdk_generator.test.mjs +31 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/semantic_version.test.mjs +60 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/service_contract_inputs.test.mjs +27 -0
- package/dist/resources/templates/go-backend/cmd/internal/runtime/resources.go +125 -0
- package/dist/resources/templates/go-backend/cmd/internal/runtime/runtime.go +102 -0
- package/dist/resources/templates/go-backend/cmd/internal/runtime/runtime_test.go +70 -0
- package/dist/resources/templates/go-backend/cmd/product-api/lifecycle_test.go +58 -0
- package/dist/resources/templates/go-backend/cmd/product-api/main.go +32 -0
- package/dist/resources/templates/go-backend/cmd/product-api/wire.go +13 -0
- package/dist/resources/templates/go-backend/cmd/product-api/wire_gen.go +94 -0
- package/dist/resources/templates/go-backend/cmd/worker/main.go +47 -0
- package/dist/resources/templates/go-backend/cmd/worker/wire.go +14 -0
- package/dist/resources/templates/go-backend/cmd/worker/wire_gen.go +111 -0
- package/dist/resources/templates/go-backend/configs/config.yaml +37 -0
- package/dist/resources/templates/go-backend/deployments/compose.yaml +71 -0
- package/dist/resources/templates/go-backend/docs/openapi-provenance.json +489 -0
- package/dist/resources/templates/go-backend/docs/runtime-provenance.json +175 -0
- package/dist/resources/templates/go-backend/docs/source-provenance.json +3568 -0
- package/dist/resources/templates/go-backend/docs/standards-provenance.json +1624 -0
- package/dist/resources/templates/go-backend/go.mod +256 -0
- package/dist/resources/templates/go-backend/go.sum +805 -0
- package/dist/resources/templates/go-backend/internal/common/canonicaljson/canonical.go +370 -0
- package/dist/resources/templates/go-backend/internal/common/canonicaljson/canonical_test.go +223 -0
- package/dist/resources/templates/go-backend/internal/common/checkoutbff/contracts.go +125 -0
- package/dist/resources/templates/go-backend/internal/common/checkoutbff/platform_client.go +212 -0
- package/dist/resources/templates/go-backend/internal/common/checkoutbff/platform_client_test.go +319 -0
- package/dist/resources/templates/go-backend/internal/common/contentaccess/contentaccess.go +50 -0
- package/dist/resources/templates/go-backend/internal/common/contracts/contact.go +85 -0
- package/dist/resources/templates/go-backend/internal/common/ctxutil/identity.go +20 -0
- package/dist/resources/templates/go-backend/internal/common/ctxutil/product.go +53 -0
- package/dist/resources/templates/go-backend/internal/common/enumdomain/payment.go +12 -0
- package/dist/resources/templates/go-backend/internal/common/enums/dto_admin.go +9 -0
- package/dist/resources/templates/go-backend/internal/common/enums/enum.go +1247 -0
- package/dist/resources/templates/go-backend/internal/common/enums/handler_admin.go +66 -0
- package/dist/resources/templates/go-backend/internal/common/enums/module.go +46 -0
- package/dist/resources/templates/go-backend/internal/common/enums/provider.go +10 -0
- package/dist/resources/templates/go-backend/internal/common/enums/register.go +11 -0
- package/dist/resources/templates/go-backend/internal/common/enums/register_audit.go +274 -0
- package/dist/resources/templates/go-backend/internal/common/enums/register_command_replay.go +12 -0
- package/dist/resources/templates/go-backend/internal/common/enums/register_config.go +27 -0
- package/dist/resources/templates/go-backend/internal/common/enums/register_locale.go +37 -0
- package/dist/resources/templates/go-backend/internal/common/enums/register_ops.go +14 -0
- package/dist/resources/templates/go-backend/internal/common/enums/register_outbox.go +15 -0
- package/dist/resources/templates/go-backend/internal/common/enums/register_rule_expression.go +63 -0
- package/dist/resources/templates/go-backend/internal/common/enums/registry.go +77 -0
- package/dist/resources/templates/go-backend/internal/common/httporigin/origin.go +62 -0
- package/dist/resources/templates/go-backend/internal/common/httporigin/origin_test.go +38 -0
- package/dist/resources/templates/go-backend/internal/common/iamcredential/plaintext.go +35 -0
- package/dist/resources/templates/go-backend/internal/common/iamcredential/plaintext_test.go +29 -0
- package/dist/resources/templates/go-backend/internal/common/iamscope/scope.go +212 -0
- package/dist/resources/templates/go-backend/internal/common/iamscope/scope_binding.go +26 -0
- package/dist/resources/templates/go-backend/internal/common/iamscope/scope_filter.go +173 -0
- package/dist/resources/templates/go-backend/internal/common/iamscope/scope_filter_test.go +279 -0
- package/dist/resources/templates/go-backend/internal/common/internalapi/authorization_details.go +10 -0
- package/dist/resources/templates/go-backend/internal/common/internalapi/route_permission_policies.go +660 -0
- package/dist/resources/templates/go-backend/internal/common/internalapi/route_permission_policies_test.go +331 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/audience_token_source.go +166 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/bootstrap_token_exchanger.go +183 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/bound_service_token_signer.go +52 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/delegated_access_token_exchanger.go +189 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/delegated_access_token_exchanger_test.go +159 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/product_scoped_service_token_signer.go +92 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/provider.go +25 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/request_signer.go +86 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/resolver.go +69 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/resolver_test.go +42 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/route_scope.go +95 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/route_scope_test.go +78 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/service_identity_test.go +387 -0
- package/dist/resources/templates/go-backend/internal/common/jsonschema/compiler.go +100 -0
- package/dist/resources/templates/go-backend/internal/common/jsonschema/compiler_test.go +41 -0
- package/dist/resources/templates/go-backend/internal/common/jwksapi/handler.go +83 -0
- package/dist/resources/templates/go-backend/internal/common/jwksapi/handler_test.go +104 -0
- package/dist/resources/templates/go-backend/internal/common/locale/locale.go +145 -0
- package/dist/resources/templates/go-backend/internal/common/locale/locale_test.go +75 -0
- package/dist/resources/templates/go-backend/internal/common/mediaref/mediaref.go +54 -0
- package/dist/resources/templates/go-backend/internal/common/mediaref/mediaref_test.go +77 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/apikey_auth.go +320 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/apikey_throttle.go +158 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/auth.go +40 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/auth_test.go +50 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/client_context.go +86 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/cors.go +68 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/event_context.go +18 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/gateway_identity.go +279 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/helpers.go +159 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/iam_delegated_route_permission.go +171 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/iam_delegated_token_auth.go +151 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/iam_delegated_token_auth_test.go +99 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/iam_service_identity.go +138 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/iam_service_token_auth.go +74 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/idempotent.go +273 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/idempotent_test.go +83 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/internal_route_permission.go +45 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/internal_route_permission_test.go +186 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/logging.go +191 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/metrics.go +45 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/middleware_test.go +1516 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/principal_context.go +160 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/principal_context_test.go +355 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/product_context.go +100 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/recovery.go +40 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/referral_attribution.go +178 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/requestid.go +48 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/resource_permission.go +790 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/resource_permission_test.go +440 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/service_credential_auth.go +67 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/tenant.go +148 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/throttle.go +310 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/trusted_client_ip.go +23 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/trusted_client_ip_test.go +60 -0
- package/dist/resources/templates/go-backend/internal/common/money/currency.go +25 -0
- package/dist/resources/templates/go-backend/internal/common/money/errors.go +23 -0
- package/dist/resources/templates/go-backend/internal/common/money/format.go +123 -0
- package/dist/resources/templates/go-backend/internal/common/money/format_test.go +204 -0
- package/dist/resources/templates/go-backend/internal/common/money/gateway.go +144 -0
- package/dist/resources/templates/go-backend/internal/common/money/gateway_test.go +165 -0
- package/dist/resources/templates/go-backend/internal/common/money/rounding.go +56 -0
- package/dist/resources/templates/go-backend/internal/common/money/rounding_test.go +51 -0
- package/dist/resources/templates/go-backend/internal/common/principal/context.go +56 -0
- package/dist/resources/templates/go-backend/internal/common/principal/principal.go +49 -0
- package/dist/resources/templates/go-backend/internal/common/productcode/code.go +24 -0
- package/dist/resources/templates/go-backend/internal/common/productcode/code_test.go +35 -0
- package/dist/resources/templates/go-backend/internal/common/providerconfig/schema.go +577 -0
- package/dist/resources/templates/go-backend/internal/common/providerconfig/schema_test.go +47 -0
- package/dist/resources/templates/go-backend/internal/common/requestprivacy/request.go +246 -0
- package/dist/resources/templates/go-backend/internal/common/requestprivacy/request_test.go +170 -0
- package/dist/resources/templates/go-backend/internal/common/response/pagination.go +60 -0
- package/dist/resources/templates/go-backend/internal/common/response/response.go +110 -0
- package/dist/resources/templates/go-backend/internal/common/response/response_test.go +463 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/ast.go +141 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/ast_test.go +81 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/canonical.go +184 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/canonical_test.go +319 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/decoder.go +555 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/decoder_test.go +260 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/errors.go +55 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/evaluator.go +96 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/evaluator_test.go +220 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/fuzz_test.go +116 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/limits.go +331 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/schema.go +412 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/schema_test.go +164 -0
- package/dist/resources/templates/go-backend/internal/common/runtimeinput/runtime_input.go +627 -0
- package/dist/resources/templates/go-backend/internal/common/runtimeinput/runtime_input_test.go +245 -0
- package/dist/resources/templates/go-backend/internal/common/semver/errors.go +6 -0
- package/dist/resources/templates/go-backend/internal/common/semver/semver.go +125 -0
- package/dist/resources/templates/go-backend/internal/common/semver/semver_test.go +205 -0
- package/dist/resources/templates/go-backend/internal/common/serviceidentity/audience.go +48 -0
- package/dist/resources/templates/go-backend/internal/common/serviceidentity/audience_test.go +35 -0
- package/dist/resources/templates/go-backend/internal/common/serviceidentity/resource_identifier.go +33 -0
- package/dist/resources/templates/go-backend/internal/common/serviceidentity/resource_identifier_test.go +32 -0
- package/dist/resources/templates/go-backend/internal/common/tradeno/generator.go +99 -0
- package/dist/resources/templates/go-backend/internal/common/tradeno/generator_test.go +396 -0
- package/dist/resources/templates/go-backend/internal/common/tradeno/prefix.go +247 -0
- package/dist/resources/templates/go-backend/internal/common/types/asset_url.go +11 -0
- package/dist/resources/templates/go-backend/internal/common/types/billing.go +89 -0
- package/dist/resources/templates/go-backend/internal/common/types/billing_test.go +77 -0
- package/dist/resources/templates/go-backend/internal/common/types/country.go +74 -0
- package/dist/resources/templates/go-backend/internal/common/types/country_test.go +28 -0
- package/dist/resources/templates/go-backend/internal/common/types/currency.go +60 -0
- package/dist/resources/templates/go-backend/internal/common/types/identifiers.go +41 -0
- package/dist/resources/templates/go-backend/internal/common/types/operator.go +28 -0
- package/dist/resources/templates/go-backend/internal/common/types/subscription_entitlement.go +24 -0
- package/dist/resources/templates/go-backend/internal/common/types/subscription_entitlement_test.go +35 -0
- package/dist/resources/templates/go-backend/internal/common/types/tier.go +72 -0
- package/dist/resources/templates/go-backend/internal/common/types/types.go +411 -0
- package/dist/resources/templates/go-backend/internal/common/types/types_test.go +295 -0
- package/dist/resources/templates/go-backend/internal/common/utils/constants.go +100 -0
- package/dist/resources/templates/go-backend/internal/common/utils/crypto.go +158 -0
- package/dist/resources/templates/go-backend/internal/common/utils/crypto_test.go +345 -0
- package/dist/resources/templates/go-backend/internal/common/utils/duration.go +25 -0
- package/dist/resources/templates/go-backend/internal/common/utils/helpers.go +18 -0
- package/dist/resources/templates/go-backend/internal/common/utils/json.go +62 -0
- package/dist/resources/templates/go-backend/internal/common/utils/json_test.go +76 -0
- package/dist/resources/templates/go-backend/internal/common/utils/pagination.go +51 -0
- package/dist/resources/templates/go-backend/internal/common/utils/pagination_test.go +45 -0
- package/dist/resources/templates/go-backend/internal/common/utils/pointer.go +107 -0
- package/dist/resources/templates/go-backend/internal/common/utils/pointer_test.go +15 -0
- package/dist/resources/templates/go-backend/internal/common/utils/slice.go +24 -0
- package/dist/resources/templates/go-backend/internal/common/utils/snowflake.go +110 -0
- package/dist/resources/templates/go-backend/internal/common/utils/snowflake_test.go +316 -0
- package/dist/resources/templates/go-backend/internal/common/utils/string.go +16 -0
- package/dist/resources/templates/go-backend/internal/common/utils/timefmt.go +42 -0
- package/dist/resources/templates/go-backend/internal/common/validator/validator.go +136 -0
- package/dist/resources/templates/go-backend/internal/common/validator/validator_test.go +240 -0
- package/dist/resources/templates/go-backend/internal/common/youtubeapi/client.go +224 -0
- package/dist/resources/templates/go-backend/internal/core/apicontract/document.go +269 -0
- package/dist/resources/templates/go-backend/internal/core/apicontract/document_test.go +104 -0
- package/dist/resources/templates/go-backend/internal/core/apicontract/route_validator.go +78 -0
- package/dist/resources/templates/go-backend/internal/core/apicontract/route_validator_test.go +108 -0
- package/dist/resources/templates/go-backend/internal/core/apidocs/assets/scalar-api-reference.js +2385 -0
- package/dist/resources/templates/go-backend/internal/core/apidocs/assets/scalar-api-reference.metadata.json +10 -0
- package/dist/resources/templates/go-backend/internal/core/apidocs/route.go +107 -0
- package/dist/resources/templates/go-backend/internal/core/apidocs/route_test.go +200 -0
- package/dist/resources/templates/go-backend/internal/core/apidocs/scalar.go +117 -0
- package/dist/resources/templates/go-backend/internal/core/apidocs/scalar_test.go +99 -0
- package/dist/resources/templates/go-backend/internal/core/audit/access_log_policy.go +91 -0
- package/dist/resources/templates/go-backend/internal/core/audit/access_log_policy_test.go +51 -0
- package/dist/resources/templates/go-backend/internal/core/audit/actor_resolver.go +36 -0
- package/dist/resources/templates/go-backend/internal/core/audit/constants.go +30 -0
- package/dist/resources/templates/go-backend/internal/core/audit/context.go +119 -0
- package/dist/resources/templates/go-backend/internal/core/audit/context_test.go +310 -0
- package/dist/resources/templates/go-backend/internal/core/audit/dto.go +468 -0
- package/dist/resources/templates/go-backend/internal/core/audit/dto_admin.go +172 -0
- package/dist/resources/templates/go-backend/internal/core/audit/enum.go +460 -0
- package/dist/resources/templates/go-backend/internal/core/audit/enum_test.go +314 -0
- package/dist/resources/templates/go-backend/internal/core/audit/errors.go +9 -0
- package/dist/resources/templates/go-backend/internal/core/audit/handler.go +568 -0
- package/dist/resources/templates/go-backend/internal/core/audit/listener.go +319 -0
- package/dist/resources/templates/go-backend/internal/core/audit/listener_test.go +98 -0
- package/dist/resources/templates/go-backend/internal/core/audit/middleware.go +669 -0
- package/dist/resources/templates/go-backend/internal/core/audit/middleware_test.go +268 -0
- package/dist/resources/templates/go-backend/internal/core/audit/model.go +306 -0
- package/dist/resources/templates/go-backend/internal/core/audit/partition_job.go +316 -0
- package/dist/resources/templates/go-backend/internal/core/audit/ports.go +9 -0
- package/dist/resources/templates/go-backend/internal/core/audit/provider.go +30 -0
- package/dist/resources/templates/go-backend/internal/core/audit/repository.go +1007 -0
- package/dist/resources/templates/go-backend/internal/core/audit/repository_test.go +934 -0
- package/dist/resources/templates/go-backend/internal/core/audit/router.go +85 -0
- package/dist/resources/templates/go-backend/internal/core/audit/service.go +770 -0
- package/dist/resources/templates/go-backend/internal/core/audit/service_test.go +331 -0
- package/dist/resources/templates/go-backend/internal/core/audit/vo_admin.go +475 -0
- package/dist/resources/templates/go-backend/internal/core/cache/config.go +30 -0
- package/dist/resources/templates/go-backend/internal/core/cache/key.go +41 -0
- package/dist/resources/templates/go-backend/internal/core/cache/key_test.go +62 -0
- package/dist/resources/templates/go-backend/internal/core/cache/l1.go +153 -0
- package/dist/resources/templates/go-backend/internal/core/cache/l1_test.go +212 -0
- package/dist/resources/templates/go-backend/internal/core/cache/manager.go +278 -0
- package/dist/resources/templates/go-backend/internal/core/cache/manager_provider.go +24 -0
- package/dist/resources/templates/go-backend/internal/core/cache/metrics.go +126 -0
- package/dist/resources/templates/go-backend/internal/core/cache/namespace.go +46 -0
- package/dist/resources/templates/go-backend/internal/core/cache/namespace_test.go +90 -0
- package/dist/resources/templates/go-backend/internal/core/cache/options.go +39 -0
- package/dist/resources/templates/go-backend/internal/core/cache/options_test.go +96 -0
- package/dist/resources/templates/go-backend/internal/core/cache/redis.go +311 -0
- package/dist/resources/templates/go-backend/internal/core/cache/redis_test.go +51 -0
- package/dist/resources/templates/go-backend/internal/core/cache/serializer.go +31 -0
- package/dist/resources/templates/go-backend/internal/core/cache/serializer_test.go +139 -0
- package/dist/resources/templates/go-backend/internal/core/cache/singleflight.go +53 -0
- package/dist/resources/templates/go-backend/internal/core/cache/singleflight_test.go +211 -0
- package/dist/resources/templates/go-backend/internal/core/cache/warming.go +86 -0
- package/dist/resources/templates/go-backend/internal/core/clock/clock.go +66 -0
- package/dist/resources/templates/go-backend/internal/core/clock/clock_test.go +26 -0
- package/dist/resources/templates/go-backend/internal/core/clock/runtime_clock.go +283 -0
- package/dist/resources/templates/go-backend/internal/core/clock/runtime_clock_test.go +98 -0
- package/dist/resources/templates/go-backend/internal/core/commandreplay/errors.go +6 -0
- package/dist/resources/templates/go-backend/internal/core/commandreplay/model.go +90 -0
- package/dist/resources/templates/go-backend/internal/core/commandreplay/model_test.go +79 -0
- package/dist/resources/templates/go-backend/internal/core/commandreplay/namespace.go +7 -0
- package/dist/resources/templates/go-backend/internal/core/commandreplay/persistence.go +269 -0
- package/dist/resources/templates/go-backend/internal/core/commandreplay/persistence_test.go +185 -0
- package/dist/resources/templates/go-backend/internal/core/commandreplay/provider.go +9 -0
- package/dist/resources/templates/go-backend/internal/core/commandreplay/repository.go +22 -0
- package/dist/resources/templates/go-backend/internal/core/commandreplay/service.go +853 -0
- package/dist/resources/templates/go-backend/internal/core/commandreplay/service_persistence_test.go +432 -0
- package/dist/resources/templates/go-backend/internal/core/commandreplay/service_test.go +891 -0
- package/dist/resources/templates/go-backend/internal/core/commandreplay/types.go +121 -0
- package/dist/resources/templates/go-backend/internal/core/config/config.go +2069 -0
- package/dist/resources/templates/go-backend/internal/core/config/config_test.go +1122 -0
- package/dist/resources/templates/go-backend/internal/core/config/contract/contract_test.go +388 -0
- package/dist/resources/templates/go-backend/internal/core/config/contract/docs.go +198 -0
- package/dist/resources/templates/go-backend/internal/core/config/contract/verify.go +424 -0
- package/dist/resources/templates/go-backend/internal/core/config/enum.go +46 -0
- package/dist/resources/templates/go-backend/internal/core/config/metadata.go +717 -0
- package/dist/resources/templates/go-backend/internal/core/config/metadata_test.go +228 -0
- package/dist/resources/templates/go-backend/internal/core/config/product_admin_config_test.go +210 -0
- package/dist/resources/templates/go-backend/internal/core/crypto/aes_gcm.go +111 -0
- package/dist/resources/templates/go-backend/internal/core/crypto/aes_gcm_test.go +364 -0
- package/dist/resources/templates/go-backend/internal/core/crypto/encryptor.go +12 -0
- package/dist/resources/templates/go-backend/internal/core/crypto/envelope_encryptor.go +134 -0
- package/dist/resources/templates/go-backend/internal/core/crypto/envelope_encryptor_test.go +118 -0
- package/dist/resources/templates/go-backend/internal/core/crypto/pem.go +112 -0
- package/dist/resources/templates/go-backend/internal/core/crypto/pem_test.go +44 -0
- package/dist/resources/templates/go-backend/internal/core/crypto/provider.go +130 -0
- package/dist/resources/templates/go-backend/internal/core/crypto/provider_test.go +92 -0
- package/dist/resources/templates/go-backend/internal/core/database/base_model.go +24 -0
- package/dist/resources/templates/go-backend/internal/core/database/clickhouse.go +121 -0
- package/dist/resources/templates/go-backend/internal/core/database/database.go +112 -0
- package/dist/resources/templates/go-backend/internal/core/database/database_logger_test.go +95 -0
- package/dist/resources/templates/go-backend/internal/core/database/errors.go +25 -0
- package/dist/resources/templates/go-backend/internal/core/database/metrics_plugin.go +105 -0
- package/dist/resources/templates/go-backend/internal/core/database/pool_collector.go +71 -0
- package/dist/resources/templates/go-backend/internal/core/database/read_replica.go +520 -0
- package/dist/resources/templates/go-backend/internal/core/database/transaction.go +170 -0
- package/dist/resources/templates/go-backend/internal/core/database/transaction_test.go +282 -0
- package/dist/resources/templates/go-backend/internal/core/distlock/lock.go +353 -0
- package/dist/resources/templates/go-backend/internal/core/distlock/lock_test.go +106 -0
- package/dist/resources/templates/go-backend/internal/core/errors/handler.go +189 -0
- package/dist/resources/templates/go-backend/internal/core/errors/handler_test.go +515 -0
- package/dist/resources/templates/go-backend/internal/core/eventbus/eventbus.go +667 -0
- package/dist/resources/templates/go-backend/internal/core/eventbus/eventbus_test.go +792 -0
- package/dist/resources/templates/go-backend/internal/core/eventstream/noop.go +22 -0
- package/dist/resources/templates/go-backend/internal/core/eventstream/provider.go +20 -0
- package/dist/resources/templates/go-backend/internal/core/eventstream/publisher.go +38 -0
- package/dist/resources/templates/go-backend/internal/core/eventstream/redis.go +109 -0
- package/dist/resources/templates/go-backend/internal/core/eventstream/routing.go +104 -0
- package/dist/resources/templates/go-backend/internal/core/eventstream/routing_test.go +71 -0
- package/dist/resources/templates/go-backend/internal/core/geoip/model.go +19 -0
- package/dist/resources/templates/go-backend/internal/core/geoip/service.go +88 -0
- package/dist/resources/templates/go-backend/internal/core/health/health.go +333 -0
- package/dist/resources/templates/go-backend/internal/core/health/health_test.go +27 -0
- package/dist/resources/templates/go-backend/internal/core/httpclient/client.go +772 -0
- package/dist/resources/templates/go-backend/internal/core/httpclient/client_test.go +287 -0
- package/dist/resources/templates/go-backend/internal/core/httpclient/download.go +578 -0
- package/dist/resources/templates/go-backend/internal/core/httpclient/download_test.go +374 -0
- package/dist/resources/templates/go-backend/internal/core/jwtkeyring/jwk.go +38 -0
- package/dist/resources/templates/go-backend/internal/core/jwtkeyring/keyring.go +144 -0
- package/dist/resources/templates/go-backend/internal/core/jwtkeyring/keyring_test.go +128 -0
- package/dist/resources/templates/go-backend/internal/core/jwtkeyring/registry.go +60 -0
- package/dist/resources/templates/go-backend/internal/core/logger/logger.go +53 -0
- package/dist/resources/templates/go-backend/internal/core/logger/logger_test.go +194 -0
- package/dist/resources/templates/go-backend/internal/core/observability/metrics.go +358 -0
- package/dist/resources/templates/go-backend/internal/core/observability/sentry.go +445 -0
- package/dist/resources/templates/go-backend/internal/core/observability/sentry_privacy_test.go +175 -0
- package/dist/resources/templates/go-backend/internal/core/observability/tracing.go +187 -0
- package/dist/resources/templates/go-backend/internal/core/outbox/model.go +314 -0
- package/dist/resources/templates/go-backend/internal/core/outbox/model_test.go +77 -0
- package/dist/resources/templates/go-backend/internal/core/outbox/persistence.go +51 -0
- package/dist/resources/templates/go-backend/internal/core/outbox/provider.go +23 -0
- package/dist/resources/templates/go-backend/internal/core/outbox/relay.go +1138 -0
- package/dist/resources/templates/go-backend/internal/core/outbox/relay_postgres_test.go +257 -0
- package/dist/resources/templates/go-backend/internal/core/outbox/relay_test.go +690 -0
- package/dist/resources/templates/go-backend/internal/core/outbox/rescheduler.go +164 -0
- package/dist/resources/templates/go-backend/internal/core/outbox/rescheduler_test.go +209 -0
- package/dist/resources/templates/go-backend/internal/core/outbox/writer.go +249 -0
- package/dist/resources/templates/go-backend/internal/core/outbox/writer_postgres_test.go +170 -0
- package/dist/resources/templates/go-backend/internal/core/outbox/writer_test.go +123 -0
- package/dist/resources/templates/go-backend/internal/core/provider.go +198 -0
- package/dist/resources/templates/go-backend/internal/core/queue/metrics_middleware.go +38 -0
- package/dist/resources/templates/go-backend/internal/core/queue/metrics_middleware_test.go +12 -0
- package/dist/resources/templates/go-backend/internal/core/queue/queue.go +288 -0
- package/dist/resources/templates/go-backend/internal/core/queue/queue_test.go +159 -0
- package/dist/resources/templates/go-backend/internal/core/resilience/bulkhead.go +514 -0
- package/dist/resources/templates/go-backend/internal/core/resilience/bulkhead_test.go +984 -0
- package/dist/resources/templates/go-backend/internal/core/resilience/circuitbreaker.go +358 -0
- package/dist/resources/templates/go-backend/internal/core/resilience/circuitbreaker_test.go +788 -0
- package/dist/resources/templates/go-backend/internal/core/resilience/retry.go +318 -0
- package/dist/resources/templates/go-backend/internal/core/resilience/retry_test.go +735 -0
- package/dist/resources/templates/go-backend/internal/core/schedule/recorder.go +305 -0
- package/dist/resources/templates/go-backend/internal/core/schedule/run_context.go +124 -0
- package/dist/resources/templates/go-backend/internal/core/schedule/run_context_test.go +85 -0
- package/dist/resources/templates/go-backend/internal/core/schedule/scheduler.go +1589 -0
- package/dist/resources/templates/go-backend/internal/core/schedule/scheduler_control_test.go +808 -0
- package/dist/resources/templates/go-backend/internal/core/storage/oss_provider.go +398 -0
- package/dist/resources/templates/go-backend/internal/core/storage/oss_provider_test.go +89 -0
- package/dist/resources/templates/go-backend/internal/core/storage/path.go +110 -0
- package/dist/resources/templates/go-backend/internal/core/storage/path_test.go +301 -0
- package/dist/resources/templates/go-backend/internal/core/storage/s3_provider.go +489 -0
- package/dist/resources/templates/go-backend/internal/core/storage/s3_provider_test.go +60 -0
- package/dist/resources/templates/go-backend/internal/core/storage/storage.go +268 -0
- package/dist/resources/templates/go-backend/internal/core/storage/validation.go +225 -0
- package/dist/resources/templates/go-backend/internal/core/storage/validation_test.go +495 -0
- package/dist/resources/templates/go-backend/internal/core/temporal/logger.go +38 -0
- package/dist/resources/templates/go-backend/internal/core/temporal/provider.go +126 -0
- package/dist/resources/templates/go-backend/internal/core/temporal/provider_test.go +67 -0
- package/dist/resources/templates/go-backend/internal/core/websocket/client.go +282 -0
- package/dist/resources/templates/go-backend/internal/core/websocket/client_test.go +81 -0
- package/dist/resources/templates/go-backend/internal/core/websocket/config.go +58 -0
- package/dist/resources/templates/go-backend/internal/core/websocket/handler.go +53 -0
- package/dist/resources/templates/go-backend/internal/core/websocket/hub.go +269 -0
- package/dist/resources/templates/go-backend/internal/core/websocket/message.go +273 -0
- package/dist/resources/templates/go-backend/internal/core/websocket/notifier.go +92 -0
- package/dist/resources/templates/go-backend/internal/core/websocket/provider.go +33 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/iam/action.go +77 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/iam/action_test.go +238 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/iam/condition.go +107 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/iam/decision.go +256 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/iam/enum.go +643 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/iam/errors.go +102 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/iam/principal_record.go +21 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/iam/product_context.go +486 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/iam/resource.go +215 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/iam/resource_test.go +242 -0
- package/dist/resources/templates/go-backend/internal/products/README.md +5 -0
- package/dist/resources/templates/go-backend/internal/sharedevents/README.md +5 -0
- package/dist/resources/templates/go-backend/migrations/000001_infrastructure.down.sql +13 -0
- package/dist/resources/templates/go-backend/migrations/000001_infrastructure.up.sql +886 -0
- package/dist/resources/templates/go-backend/pkg/apierror/error.go +327 -0
- package/dist/resources/templates/go-backend/pkg/apierror/error_code.go +65 -0
- package/dist/resources/templates/go-backend/pkg/apierror/error_test.go +41 -0
- package/dist/resources/templates/go-backend/pkg/apierror/error_type.go +14 -0
- package/dist/resources/templates/go-backend/pkg/apierror/http_response.go +216 -0
- package/dist/resources/templates/go-backend/pkg/apierror/http_response_test.go +216 -0
- package/dist/resources/templates/go-backend/scripts/check-openapi-clean-deletion.sh +54 -0
- package/dist/resources/templates/go-backend/scripts/test-migrations.sh +32 -0
- package/dist/resources/templates/go-backend/tests/infrastructure.sql +69 -0
- package/dist/resources/templates/mcp-server/.claude/docs/stack.md +338 -0
- package/dist/resources/templates/mcp-server/.editorconfig +13 -0
- package/dist/resources/templates/mcp-server/.env.example +8 -0
- package/dist/resources/templates/mcp-server/.github/ISSUE_TEMPLATE/bug_report.yml +104 -0
- package/dist/resources/templates/mcp-server/.github/ISSUE_TEMPLATE/feature_request.yml +54 -0
- package/dist/resources/templates/mcp-server/.github/PULL_REQUEST_TEMPLATE.md +36 -0
- package/dist/resources/templates/mcp-server/.github/workflows/ci.yml +78 -0
- package/dist/resources/templates/mcp-server/.husky/commit-msg +1 -0
- package/dist/resources/templates/mcp-server/.husky/pre-commit +1 -0
- package/dist/resources/templates/mcp-server/.lintstagedrc.json +4 -0
- package/dist/resources/templates/mcp-server/.nvmrc +1 -0
- package/dist/resources/templates/mcp-server/.prettierrc +8 -0
- package/dist/resources/templates/mcp-server/CONTRIBUTING.md +184 -0
- package/dist/resources/templates/mcp-server/Dockerfile +23 -0
- package/dist/resources/templates/mcp-server/LICENSE +21 -0
- package/dist/resources/templates/mcp-server/README.md +123 -0
- package/dist/resources/templates/mcp-server/_gitignore +26 -0
- package/dist/resources/templates/mcp-server/commitlint.config.js +24 -0
- package/dist/resources/templates/mcp-server/eslint.config.js +30 -0
- package/dist/resources/templates/mcp-server/package.json +72 -0
- package/dist/resources/templates/mcp-server/src/index.ts +27 -0
- package/dist/resources/templates/mcp-server/src/resources.ts +33 -0
- package/dist/resources/templates/mcp-server/src/services/.gitkeep +0 -0
- package/dist/resources/templates/mcp-server/src/tools.ts +43 -0
- package/dist/resources/templates/mcp-server/src/types/index.ts +19 -0
- package/dist/resources/templates/mcp-server/src/utils/index.ts +31 -0
- package/dist/resources/templates/mcp-server/tsconfig.json +22 -0
- package/dist/resources/templates/mcp-server/tsup.config.ts +14 -0
- package/dist/resources/templates/mcp-server/vitest.config.ts +15 -0
- package/dist/resources/templates/nuxt/.claude/docs/stack.md +666 -0
- package/dist/resources/templates/nuxt/.editorconfig +15 -0
- package/dist/resources/templates/nuxt/.env.example +22 -0
- package/dist/resources/templates/nuxt/.github/workflows/ci.yml +34 -0
- package/dist/resources/templates/nuxt/.husky/commit-msg +1 -0
- package/dist/resources/templates/nuxt/.husky/pre-commit +1 -0
- package/dist/resources/templates/nuxt/.nvmrc +1 -0
- package/dist/resources/templates/nuxt/.prettierignore +9 -0
- package/dist/resources/templates/nuxt/.prettierrc +1 -0
- package/dist/resources/templates/nuxt/README.md +23 -0
- package/dist/resources/templates/nuxt/_gitignore +7 -0
- package/dist/resources/templates/nuxt/app/app.config.ts +105 -0
- package/dist/resources/templates/nuxt/app/i18n/locales/en.json +5 -0
- package/dist/resources/templates/nuxt/app/pages/app/index.vue +224 -0
- package/dist/resources/templates/nuxt/app/pages/authors/[slug].vue +37 -0
- package/dist/resources/templates/nuxt/app/pages/blog/[slug].vue +55 -0
- package/dist/resources/templates/nuxt/app/pages/blog/category/[category].vue +38 -0
- package/dist/resources/templates/nuxt/app/pages/blog/index.vue +46 -0
- package/dist/resources/templates/nuxt/app/pages/index.vue +626 -0
- package/dist/resources/templates/nuxt/app/pages/legal/privacy.vue +21 -0
- package/dist/resources/templates/nuxt/app/pages/legal/terms.vue +21 -0
- package/dist/resources/templates/nuxt/app/pages/ui/index.vue +397 -0
- package/dist/resources/templates/nuxt/commitlint.config.mjs +1 -0
- package/dist/resources/templates/nuxt/eslint.config.mjs +4 -0
- package/dist/resources/templates/nuxt/lint-staged.config.mjs +8 -0
- package/dist/resources/templates/nuxt/nuxt.config.ts +71 -0
- package/dist/resources/templates/nuxt/package.json +67 -0
- package/dist/resources/templates/nuxt/public/apple-touch-icon.png +0 -0
- package/dist/resources/templates/nuxt/public/favicon.ico +0 -0
- package/dist/resources/templates/nuxt/public/favicon.svg +5 -0
- package/dist/resources/templates/nuxt/public/icon-16x16.png +0 -0
- package/dist/resources/templates/nuxt/public/icon-192x192.png +0 -0
- package/dist/resources/templates/nuxt/public/icon-32x32.png +0 -0
- package/dist/resources/templates/nuxt/public/icon-512x512.png +0 -0
- package/dist/resources/templates/nuxt/public/logo.svg +6 -0
- package/dist/resources/templates/nuxt/public/media/hero-product-gallery.png +0 -0
- package/dist/resources/templates/nuxt/server/api/content/sitemap-urls.get.ts +12 -0
- package/dist/resources/templates/nuxt/server/api/preview.get.ts +9 -0
- package/dist/resources/templates/nuxt/stylelint.config.mjs +3 -0
- package/dist/resources/templates/nuxt/test/e2e/rendering.test.ts +13 -0
- package/dist/resources/templates/nuxt/tsconfig.json +3 -0
- package/dist/resources/templates/nuxt/vitest.config.ts +8 -0
- package/package.json +16 -12
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { operationEntries } from './project.mjs';
|
|
2
|
+
|
|
3
|
+
export function routeContract(document) {
|
|
4
|
+
const routes = operationEntries(document).map(({ method, operation, path, pathItem }) => {
|
|
5
|
+
const parameters = [...(pathItem.parameters ?? []), ...(operation.parameters ?? [])]
|
|
6
|
+
.map((parameter) => resolveParameter(document, parameter));
|
|
7
|
+
validatePathParameters(path, parameters);
|
|
8
|
+
if (path.includes('*')) throw new Error(`OpenAPI business path cannot contain a wildcard: ${path}`);
|
|
9
|
+
return { method: method.toUpperCase(), operation_id: operation.operationId, path, parameters };
|
|
10
|
+
});
|
|
11
|
+
const identities = new Set();
|
|
12
|
+
for (const route of routes) {
|
|
13
|
+
const identity = `${route.method} ${route.path}`;
|
|
14
|
+
if (identities.has(identity)) throw new Error(`duplicate route contract: ${identity}`);
|
|
15
|
+
identities.add(identity);
|
|
16
|
+
}
|
|
17
|
+
validateAmbiguousRoutes(routes);
|
|
18
|
+
return routes.map(({ method, operation_id, path }) => ({ method, operation_id, path }));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function resolveParameter(document, parameter) {
|
|
22
|
+
if (!parameter?.$ref) return parameter;
|
|
23
|
+
const match = /^#\/components\/parameters\/([^/]+)$/.exec(parameter.$ref);
|
|
24
|
+
if (!match) throw new Error(`route contract contains unsupported parameter reference: ${parameter.$ref}`);
|
|
25
|
+
const name = match[1].replaceAll('~1', '/').replaceAll('~0', '~');
|
|
26
|
+
const resolved = document.components?.parameters?.[name];
|
|
27
|
+
if (!resolved || resolved.$ref) throw new Error(`route contract cannot resolve parameter reference: ${parameter.$ref}`);
|
|
28
|
+
return resolved;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function validateRouteExclusions(exclusions) {
|
|
32
|
+
for (const exclusion of exclusions ?? []) {
|
|
33
|
+
if (!exclusion.startsWith('/') || /^\/(api|admin|internal)(\/|$)/.test(exclusion)) {
|
|
34
|
+
throw new Error(`forbidden route exclusion: ${exclusion}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function reserveStaticRouteSegments(paths) {
|
|
40
|
+
const entries = Object.entries(paths ?? {});
|
|
41
|
+
for (let leftIndex = 0; leftIndex < entries.length; leftIndex += 1) {
|
|
42
|
+
for (let rightIndex = leftIndex + 1; rightIndex < entries.length; rightIndex += 1) {
|
|
43
|
+
const [leftPath, leftItem] = entries[leftIndex];
|
|
44
|
+
const [rightPath, rightItem] = entries[rightIndex];
|
|
45
|
+
const leftSegments = pathSegments(leftPath);
|
|
46
|
+
const rightSegments = pathSegments(rightPath);
|
|
47
|
+
if (leftSegments.length !== rightSegments.length) continue;
|
|
48
|
+
if (leftSegments.some((segment, index) => !isParameterSegment(segment) && !isParameterSegment(rightSegments[index]) && segment !== rightSegments[index])) continue;
|
|
49
|
+
for (const method of Object.keys(leftItem).filter((key) => rightItem[key] && !['parameters'].includes(key))) {
|
|
50
|
+
if (!leftItem[method]?.responses || !rightItem[method]?.responses) continue;
|
|
51
|
+
leftSegments.forEach((leftSegment, index) => {
|
|
52
|
+
const rightSegment = rightSegments[index];
|
|
53
|
+
if (isParameterSegment(leftSegment) && !isParameterSegment(rightSegment)) excludePathValue(leftItem, method, leftSegment, rightSegment);
|
|
54
|
+
if (!isParameterSegment(leftSegment) && isParameterSegment(rightSegment)) excludePathValue(rightItem, method, rightSegment, leftSegment);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return paths;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function validatePathParameters(path, parameters) {
|
|
63
|
+
const declared = new Map(parameters.filter((parameter) => parameter.in === 'path').map((parameter) => [parameter.name, parameter]));
|
|
64
|
+
const templated = [...path.matchAll(/\{([^{}]+)\}/g)].map((match) => match[1]);
|
|
65
|
+
for (const name of templated) {
|
|
66
|
+
const parameter = declared.get(name);
|
|
67
|
+
if (!parameter || parameter.required !== true) throw new Error(`path parameter ${name} must be declared and required for ${path}`);
|
|
68
|
+
}
|
|
69
|
+
for (const name of declared.keys()) if (!templated.includes(name)) throw new Error(`path parameter ${name} is not present in ${path}`);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function excludePathValue(pathItem, method, parameterSegment, value) {
|
|
73
|
+
const name = parameterSegment.slice(1, -1);
|
|
74
|
+
const parameters = [...(pathItem.parameters ?? []), ...(pathItem[method].parameters ?? [])];
|
|
75
|
+
const parameter = parameters.find((candidate) => candidate.in === 'path' && candidate.name === name);
|
|
76
|
+
if (!parameter) throw new Error(`path parameter ${name} is missing while reserving static route value`);
|
|
77
|
+
parameter.schema.not ??= { enum: [] };
|
|
78
|
+
parameter.schema.not.enum ??= [];
|
|
79
|
+
if (!parameter.schema.not.enum.includes(value)) parameter.schema.not.enum.push(value);
|
|
80
|
+
parameter.schema.not.enum.sort();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function isParameterSegment(segment) {
|
|
84
|
+
return /^\{[^{}]+\}$/.test(segment);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function validateAmbiguousRoutes(routes) {
|
|
88
|
+
const errors = [];
|
|
89
|
+
for (let leftIndex = 0; leftIndex < routes.length; leftIndex += 1) {
|
|
90
|
+
for (let rightIndex = leftIndex + 1; rightIndex < routes.length; rightIndex += 1) {
|
|
91
|
+
const left = routes[leftIndex];
|
|
92
|
+
const right = routes[rightIndex];
|
|
93
|
+
if (left.method !== right.method || left.path === right.path) continue;
|
|
94
|
+
if (routesOverlap(left, right)) {
|
|
95
|
+
errors.push(`${left.method} ${left.path} and ${right.path}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (errors.length > 0) throw new Error(`ambiguous routes:\n- ${errors.join('\n- ')}`);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function routesOverlap(left, right) {
|
|
103
|
+
const leftSegments = pathSegments(left.path);
|
|
104
|
+
const rightSegments = pathSegments(right.path);
|
|
105
|
+
if (leftSegments.length !== rightSegments.length) return false;
|
|
106
|
+
return leftSegments.every((leftSegment, index) => segmentsOverlap(
|
|
107
|
+
leftSegment,
|
|
108
|
+
rightSegments[index],
|
|
109
|
+
left.parameters,
|
|
110
|
+
right.parameters,
|
|
111
|
+
));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function pathSegments(path) {
|
|
115
|
+
return path.split('/').slice(1);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function segmentsOverlap(left, right, leftParameters, rightParameters) {
|
|
119
|
+
const leftName = parameterName(left);
|
|
120
|
+
const rightName = parameterName(right);
|
|
121
|
+
if (!leftName && !rightName) return left === right;
|
|
122
|
+
if (leftName && rightName) return parameterSchemasOverlap(parameterSchema(leftName, leftParameters), parameterSchema(rightName, rightParameters));
|
|
123
|
+
if (leftName) return schemaAcceptsLiteral(parameterSchema(leftName, leftParameters), right);
|
|
124
|
+
return schemaAcceptsLiteral(parameterSchema(rightName, rightParameters), left);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function parameterName(segment) {
|
|
128
|
+
return /^\{([^{}]+)\}$/.exec(segment)?.[1] ?? null;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function parameterSchema(name, parameters) {
|
|
132
|
+
return parameters.find((parameter) => parameter.in === 'path' && parameter.name === name)?.schema ?? {};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function schemaAcceptsLiteral(schema, literal) {
|
|
136
|
+
if (Array.isArray(schema.not?.enum) && schema.not.enum.some((value) => String(value) === literal)) return false;
|
|
137
|
+
if (Object.hasOwn(schema, 'const')) return String(schema.const) === literal;
|
|
138
|
+
if (Array.isArray(schema.enum)) return schema.enum.some((value) => String(value) === literal);
|
|
139
|
+
const types = Array.isArray(schema.type) ? schema.type : [schema.type].filter(Boolean);
|
|
140
|
+
if (types.includes('integer') && !/^-?\d+$/.test(literal)) return false;
|
|
141
|
+
if (types.includes('number') && !Number.isFinite(Number(literal))) return false;
|
|
142
|
+
if (schema.format === 'uuid' && !/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(literal)) return false;
|
|
143
|
+
if (schema.pattern) return new RegExp(schema.pattern).test(literal);
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function parameterSchemasOverlap(left, right) {
|
|
148
|
+
if (Array.isArray(left.enum) && Array.isArray(right.enum)) {
|
|
149
|
+
return left.enum.some((value) => right.enum.includes(value));
|
|
150
|
+
}
|
|
151
|
+
const leftTypes = new Set(Array.isArray(left.type) ? left.type : [left.type].filter(Boolean));
|
|
152
|
+
const rightTypes = new Set(Array.isArray(right.type) ? right.type : [right.type].filter(Boolean));
|
|
153
|
+
if (leftTypes.size === 0 || rightTypes.size === 0) return true;
|
|
154
|
+
if ([...leftTypes].some((type) => rightTypes.has(type))) return true;
|
|
155
|
+
return (leftTypes.has('integer') && rightTypes.has('number')) || (leftTypes.has('number') && rightTypes.has('integer'));
|
|
156
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import { mkdir, readFile, rm, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { relative, resolve } from 'node:path';
|
|
4
|
+
import { pathToFileURL } from 'node:url';
|
|
5
|
+
|
|
6
|
+
import { contractArtifacts, readCurrentManifest } from './git_artifact_history.mjs';
|
|
7
|
+
import { apiRoot, canonicalJSON, readRegistry } from './project.mjs';
|
|
8
|
+
|
|
9
|
+
const backendRoot = resolve(apiRoot, '../..');
|
|
10
|
+
const redoclyBin = resolve(apiRoot, 'node_modules/.bin/redocly');
|
|
11
|
+
|
|
12
|
+
export async function runRuntimeConformance({ inputs, outputRoot, servers }) {
|
|
13
|
+
const registry = await readRegistry();
|
|
14
|
+
const normalizedServers = parseServerMap(servers, registry.services.map((service) => service.id));
|
|
15
|
+
const normalizedInputs = parseInputMap(inputs, registry.services.map((service) => service.id));
|
|
16
|
+
const artifactManifest = await readCurrentManifest();
|
|
17
|
+
const destination = resolve(outputRoot ?? resolve(backendRoot, 'tmp/openapi-conformance'));
|
|
18
|
+
await rm(destination, { force: true, recursive: true });
|
|
19
|
+
await mkdir(destination, { recursive: true });
|
|
20
|
+
|
|
21
|
+
const services = [];
|
|
22
|
+
for (const service of registry.services) {
|
|
23
|
+
const workflowPath = resolve(apiRoot, service.runtime_conformance);
|
|
24
|
+
const rawReportPath = resolve(destination, `${service.id}.respect.json`);
|
|
25
|
+
const result = executeRespect({
|
|
26
|
+
inputs: normalizedInputs[service.id],
|
|
27
|
+
reportPath: rawReportPath,
|
|
28
|
+
server: normalizedServers[service.id],
|
|
29
|
+
workflowPath,
|
|
30
|
+
});
|
|
31
|
+
const rawReport = await readReport(rawReportPath);
|
|
32
|
+
const matches = contractArtifacts(artifactManifest).filter((entry) => entry.service === service.id && entry.audience === 'internal');
|
|
33
|
+
if (matches.length !== 1) throw new Error(`expected one internal artifact manifest entry for ${service.id}; found ${matches.length}`);
|
|
34
|
+
const [artifact] = matches;
|
|
35
|
+
services.push({
|
|
36
|
+
artifact_sha256: artifact.sha256,
|
|
37
|
+
exit_code: result.status,
|
|
38
|
+
raw_report: relative(backendRoot, rawReportPath).replaceAll('\\', '/'),
|
|
39
|
+
request_count: reportRequestCount(rawReport),
|
|
40
|
+
server: normalizedServers[service.id],
|
|
41
|
+
service: service.id,
|
|
42
|
+
status: rawReport?.status ?? 'error',
|
|
43
|
+
workflow_count: reportWorkflowCount(rawReport),
|
|
44
|
+
workflow_file: service.runtime_conformance,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const report = {
|
|
49
|
+
generated_at: new Date().toISOString(),
|
|
50
|
+
schema_version: 1,
|
|
51
|
+
service_count: services.length,
|
|
52
|
+
services,
|
|
53
|
+
status: services.every((service) => service.exit_code === 0 && service.status === 'success') ? 'success' : 'error',
|
|
54
|
+
};
|
|
55
|
+
const reportPath = resolve(destination, 'runtime-conformance-report.json');
|
|
56
|
+
await writeFile(reportPath, canonicalJSON(report));
|
|
57
|
+
if (report.status !== 'success') {
|
|
58
|
+
const failed = services.filter((service) => service.exit_code !== 0 || service.status !== 'success');
|
|
59
|
+
throw new Error(`runtime conformance failed for: ${failed.map((service) => service.service).join(', ')}`);
|
|
60
|
+
}
|
|
61
|
+
return { report, reportPath };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function parseServerMap(value, serviceIds) {
|
|
65
|
+
let parsed = value;
|
|
66
|
+
if (typeof value === 'string') {
|
|
67
|
+
try {
|
|
68
|
+
parsed = JSON.parse(value);
|
|
69
|
+
} catch (error) {
|
|
70
|
+
throw new Error(`ONEX_OPENAPI_CONFORMANCE_SERVERS must be valid JSON: ${error.message}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
74
|
+
throw new Error('ONEX_OPENAPI_CONFORMANCE_SERVERS must be a JSON object');
|
|
75
|
+
}
|
|
76
|
+
const expected = new Set(serviceIds);
|
|
77
|
+
const unknown = Object.keys(parsed).filter((service) => !expected.has(service));
|
|
78
|
+
const missing = serviceIds.filter((service) => !Object.hasOwn(parsed, service));
|
|
79
|
+
if (unknown.length > 0 || missing.length > 0) {
|
|
80
|
+
throw new Error(`runtime conformance server map mismatch; missing=${missing.join(',') || '-'} unknown=${unknown.join(',') || '-'}`);
|
|
81
|
+
}
|
|
82
|
+
return Object.fromEntries(serviceIds.map((service) => [service, normalizeServerURL(parsed[service], service)]));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function parseInputMap(value, serviceIds) {
|
|
86
|
+
let parsed = value;
|
|
87
|
+
if (typeof value === 'string') {
|
|
88
|
+
try {
|
|
89
|
+
parsed = JSON.parse(value);
|
|
90
|
+
} catch (error) {
|
|
91
|
+
throw new Error(`ONEX_OPENAPI_CONFORMANCE_INPUTS must be valid JSON: ${error.message}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
95
|
+
throw new Error('ONEX_OPENAPI_CONFORMANCE_INPUTS must be a JSON object');
|
|
96
|
+
}
|
|
97
|
+
const expected = new Set(serviceIds);
|
|
98
|
+
const unknown = Object.keys(parsed).filter((service) => !expected.has(service));
|
|
99
|
+
if (unknown.length > 0) {
|
|
100
|
+
throw new Error(`runtime conformance input map contains unknown services: ${unknown.join(',')}`);
|
|
101
|
+
}
|
|
102
|
+
const normalized = {};
|
|
103
|
+
for (const [service, serviceInputs] of Object.entries(parsed)) {
|
|
104
|
+
if (!serviceInputs || typeof serviceInputs !== 'object' || Array.isArray(serviceInputs)) {
|
|
105
|
+
throw new Error(`${service} conformance inputs must be a JSON object`);
|
|
106
|
+
}
|
|
107
|
+
normalized[service] = serviceInputs;
|
|
108
|
+
}
|
|
109
|
+
return normalized;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function buildRespectChildEnv(inputs, baseEnv = process.env) {
|
|
113
|
+
const childEnv = { ...baseEnv, FORCE_COLOR: '0', NO_COLOR: '1' };
|
|
114
|
+
delete childEnv.ONEX_OPENAPI_CONFORMANCE_INPUTS;
|
|
115
|
+
delete childEnv.REDOCLY_CLI_RESPECT_INPUT;
|
|
116
|
+
if (inputs !== undefined) childEnv.REDOCLY_CLI_RESPECT_INPUT = JSON.stringify(inputs);
|
|
117
|
+
return childEnv;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function executeRespect({ inputs, reportPath, server, workflowPath }) {
|
|
121
|
+
const result = spawnSync(redoclyBin, [
|
|
122
|
+
'respect',
|
|
123
|
+
workflowPath,
|
|
124
|
+
'--server',
|
|
125
|
+
`service=${server}`,
|
|
126
|
+
'--json-output',
|
|
127
|
+
reportPath,
|
|
128
|
+
'--max-steps',
|
|
129
|
+
'2000',
|
|
130
|
+
'--max-fetch-timeout',
|
|
131
|
+
'40000',
|
|
132
|
+
'--execution-timeout',
|
|
133
|
+
'3600000',
|
|
134
|
+
], {
|
|
135
|
+
cwd: apiRoot,
|
|
136
|
+
encoding: 'utf8',
|
|
137
|
+
env: buildRespectChildEnv(inputs),
|
|
138
|
+
});
|
|
139
|
+
if (result.stdout) process.stdout.write(result.stdout);
|
|
140
|
+
if (result.stderr) process.stderr.write(result.stderr);
|
|
141
|
+
if (result.error) throw result.error;
|
|
142
|
+
return { status: result.status ?? 1 };
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function normalizeServerURL(value, service) {
|
|
146
|
+
if (typeof value !== 'string') throw new Error(`${service} conformance server must be a URL string`);
|
|
147
|
+
let url;
|
|
148
|
+
try {
|
|
149
|
+
url = new URL(value);
|
|
150
|
+
} catch {
|
|
151
|
+
throw new Error(`${service} conformance server is not a valid URL`);
|
|
152
|
+
}
|
|
153
|
+
if (!['http:', 'https:'].includes(url.protocol) || url.username || url.password || url.search || url.hash) {
|
|
154
|
+
throw new Error(`${service} conformance server must be an HTTP(S) base URL without credentials, query, or fragment`);
|
|
155
|
+
}
|
|
156
|
+
return url.toString().replace(/\/$/, '');
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
async function readReport(path) {
|
|
160
|
+
try {
|
|
161
|
+
return JSON.parse(await readFile(path, 'utf8'));
|
|
162
|
+
} catch {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function reportRequestCount(report) {
|
|
168
|
+
return Object.values(report?.files ?? {}).reduce((total, file) => total + (file.totalRequests ?? 0), 0);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function reportWorkflowCount(report) {
|
|
172
|
+
return Object.values(report?.files ?? {}).reduce((total, file) => total + (file.executedWorkflows?.length ?? 0), 0);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function cliServerMap() {
|
|
176
|
+
const value = process.env.ONEX_OPENAPI_CONFORMANCE_SERVERS;
|
|
177
|
+
if (!value) throw new Error('ONEX_OPENAPI_CONFORMANCE_SERVERS is required');
|
|
178
|
+
return value;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function cliInputMap() {
|
|
182
|
+
const value = process.env.ONEX_OPENAPI_CONFORMANCE_INPUTS;
|
|
183
|
+
if (!value) throw new Error('ONEX_OPENAPI_CONFORMANCE_INPUTS is required');
|
|
184
|
+
return value;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
188
|
+
const { reportPath } = await runRuntimeConformance({
|
|
189
|
+
inputs: cliInputMap(),
|
|
190
|
+
servers: cliServerMap(),
|
|
191
|
+
});
|
|
192
|
+
process.stdout.write(`Runtime conformance report: ${reportPath}\n`);
|
|
193
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
export const scalarAssetLocale = 'zh-CN';
|
|
2
|
+
export const scalarAssetLocalizationRevision = 'onex-zh-CN-v1';
|
|
3
|
+
|
|
4
|
+
const sectionLabels = '{All:`全部`,Auth:`身份验证`,Variables:`路径参数`,Cookies:`Cookie`,Headers:`请求头`,Query:`查询参数`,Body:`请求体`}';
|
|
5
|
+
|
|
6
|
+
const localizationRules = Object.freeze([
|
|
7
|
+
replacement('`Selected Auth Type:`', '`已选身份验证方式:`'),
|
|
8
|
+
replacement('` Multiple `', '` 多种 `'),
|
|
9
|
+
replacement('`Auth Types Selected`', '`已选择多种身份验证方式`'),
|
|
10
|
+
replacement('R(`span`,{class:`sr-only`},`Select`,-1),m[6]||=z(` Auth Type `,-1)', 'R(`span`,{class:`sr-only`},`选择`,-1),m[6]||=z(`身份验证方式`,-1)'),
|
|
11
|
+
replacement('` No authentication selected `', '` 未选择身份验证方式 `'),
|
|
12
|
+
replacement('`Request Example for`', '`请求示例:`'),
|
|
13
|
+
replacement('`API Client`', '`API 调试客户端`'),
|
|
14
|
+
replacement('options:{hideOperationDefaultExamples:e.layout===`modal`}', 'options:{hideOperationDefaultExamples:e.layout===`modal`,labels:{closeGroup:`关闭分组`,httpMethod:`HTTP 方法`,openGroup:`打开分组`}}'),
|
|
15
|
+
replacement('label:`Search`,size:`sm`,onClick', 'label:`搜索`,size:`sm`,onClick'),
|
|
16
|
+
replacement('autofocus:e.layout!==`web`},null,8,[`modelValue`,`autofocus`])', 'autofocus:e.layout!==`web`,label:`输入搜索关键词`,placeholder:`搜索...`},null,8,[`modelValue`,`autofocus`])'),
|
|
17
|
+
replacement('k(t.value?`Hide`:`Show`)+` sidebar`', 'k(t.value?`隐藏侧边栏`:`显示侧边栏`)'),
|
|
18
|
+
replacement('`Server:`', '`服务器:`', 3),
|
|
19
|
+
replacement('`Copy URL`', '`复制 URL`', 2),
|
|
20
|
+
replacement('`Send`', '`发送`', 2),
|
|
21
|
+
replacement('` Send `+k(e.method)+` request to `', '`发送 `+k(e.method)+` 请求到 `', 2),
|
|
22
|
+
replacement('` Open API Client `', '` 打开 API 调试客户端 `'),
|
|
23
|
+
replacement('`Close Client`', '`关闭客户端`', 3),
|
|
24
|
+
replacement('`Request: ${', '`请求:${'),
|
|
25
|
+
replacement('`Operation settings`', '`操作设置`'),
|
|
26
|
+
replacement('default:M(()=>[z(k(n),1)])', `default:M(()=>[z(k((${sectionLabels})[n]??n),1)])`),
|
|
27
|
+
replacement('R(`span`,uQe,k(t.value),1)', `R(\`span\`,uQe,k((${sectionLabels})[t.value]??t.value),1)`),
|
|
28
|
+
replacement('title:`Authentication`', 'title:`身份验证`', 3),
|
|
29
|
+
replacement('title:`Variables`', 'title:`路径参数`'),
|
|
30
|
+
replacement('title:`Cookies`', 'title:`Cookie`'),
|
|
31
|
+
replacement('title:`Headers`', 'title:`请求头`'),
|
|
32
|
+
replacement('title:`Query Parameters`', 'title:`查询参数`'),
|
|
33
|
+
replacement('title:`Request Body`', 'title:`请求体`'),
|
|
34
|
+
replacement('text:t?`Optional`:`Required`', 'text:t?`可选`:`必需`'),
|
|
35
|
+
replacement('s.value.text===`Required`', 's.value.text===`必需`'),
|
|
36
|
+
replacement('content:"Required"', 'content:"必需"'),
|
|
37
|
+
replacement('` Bearer Token `', '` Bearer 令牌 `'),
|
|
38
|
+
replacement('placeholder:`Token`', 'placeholder:`令牌`'),
|
|
39
|
+
replacement('label:i.value?`Show Password`:`Hide Password`', 'label:i.value?`显示密码`:`隐藏密码`'),
|
|
40
|
+
replacement('k(e.label)+` Enabled`', '(e.label?k(e.label)+` `:``)+`已启用`'),
|
|
41
|
+
replacement('k(e.label)+` Key`', '(e.label?k(e.label)+` `:``)+`键`'),
|
|
42
|
+
replacement('k(e.label)+` Value`', '(e.label?k(e.label)+` `:``)+`值`'),
|
|
43
|
+
replacement('`${e.label} Key`', '(e.label?e.label+` `:``)+`键`'),
|
|
44
|
+
replacement('`${e.label} Value`', '(e.label?e.label+` `:``)+`值`'),
|
|
45
|
+
replacement('placeholder:`Key`', 'placeholder:`键`'),
|
|
46
|
+
replacement('placeholder:`Value`', 'placeholder:`值`', 2),
|
|
47
|
+
replacement('n.value?`Input is invalid`:`More Information`', 'n.value?`输入无效`:`更多信息`'),
|
|
48
|
+
replacement('content:`Clear optional parameters`', 'content:`清除可选参数`'),
|
|
49
|
+
replacement('label:`Clear Value`', 'label:`清除值`'),
|
|
50
|
+
replacement('label:e.clearLabel??`Clear Search`', 'label:e.clearLabel??`清除搜索`'),
|
|
51
|
+
replacement('label:`Clear Search`', 'label:`清除搜索`'),
|
|
52
|
+
replacement('` Clear `', '` 清除 `', 3),
|
|
53
|
+
replacement('`All `+k(e.title)', '`全部`+k(e.title)'),
|
|
54
|
+
replacement('`Code Snippet`', '`代码片段`'),
|
|
55
|
+
replacement('` (Collapsed) `', '`(已折叠)`'),
|
|
56
|
+
replacement('`Request Headers`', '`请求头`'),
|
|
57
|
+
replacement('`Response Headers`', '`响应头`'),
|
|
58
|
+
replacement('"aria-label":`Response`', '"aria-label":`响应`'),
|
|
59
|
+
replacement('` Response `', '` 响应 `'),
|
|
60
|
+
replacement('` Send Request `', '` 发送请求 `'),
|
|
61
|
+
replacement('`Header Key`', '`请求头名称`'),
|
|
62
|
+
replacement('`Header Value`', '`请求头值`'),
|
|
63
|
+
replacement('`Cookie Name`', '`Cookie 名称`'),
|
|
64
|
+
replacement('`Cookie Value`', '`Cookie 值`'),
|
|
65
|
+
replacement('` No cookies `', '` 无 Cookie `'),
|
|
66
|
+
replacement('` No headers `', '` 无请求头 `'),
|
|
67
|
+
replacement('`Global cookies are shared across the whole workspace. Click to navigate.`', '`全局 Cookie 在整个工作区共享。点击可前往管理。`'),
|
|
68
|
+
replacement('`This is a readonly property and you can not modify it! If you want to change it you have to override it or disable it using the checkbox`', '`这是只读属性,不能直接修改。如需更改,请覆盖该值或通过复选框禁用。`'),
|
|
69
|
+
replacement('`Computed at request execution`', '`在请求执行时计算`'),
|
|
70
|
+
replacement('`Select File`', '`选择文件`', 2),
|
|
71
|
+
replacement('`No Body`', '`无请求体`', 2),
|
|
72
|
+
replacement('` Delete `', '` 删除 `', 3),
|
|
73
|
+
replacement('label:`Delete ${', 'label:`删除 ${', 2),
|
|
74
|
+
replacement('label:`Edit ${', 'label:`编辑 ${'),
|
|
75
|
+
replacement('`Variable suggestions`', '`变量建议`'),
|
|
76
|
+
replacement('`Request Name`', '`请求名称`'),
|
|
77
|
+
replacement('`Path parameters must have values.`', '`路径参数必须填写值。`'),
|
|
78
|
+
replacement('` Discovery URL `', '` 发现文档 URL `'),
|
|
79
|
+
replacement('` Fetch Configuration `', '` 获取配置 `'),
|
|
80
|
+
replacement('` Access Token `', '` 访问令牌 `'),
|
|
81
|
+
replacement('` Refresh URL `', '` 刷新 URL `'),
|
|
82
|
+
replacement('` Refresh `', '` 刷新 `'),
|
|
83
|
+
replacement('` Auth URL `', '` 授权 URL `'),
|
|
84
|
+
replacement('` Token URL `', '` 令牌 URL `'),
|
|
85
|
+
replacement('` Redirect URL `', '` 重定向 URL `'),
|
|
86
|
+
replacement('` Username `', '` 用户名 `', 2),
|
|
87
|
+
replacement('` Password `', '` 密码 `', 2),
|
|
88
|
+
replacement('` Client ID `', '` 客户端 ID `'),
|
|
89
|
+
replacement('` Client Secret `', '` 客户端密钥 `'),
|
|
90
|
+
replacement('` Use PKCE `', '` 使用 PKCE `'),
|
|
91
|
+
replacement('` Credentials Location `', '` 凭证位置 `'),
|
|
92
|
+
replacement('` Authorize `', '` 授权 `', 2),
|
|
93
|
+
replacement('`Optional redirect URL`', '`可选的重定向 URL`'),
|
|
94
|
+
replacement('` Name `', '` 名称 `'),
|
|
95
|
+
replacement('` Value `', '` 值 `'),
|
|
96
|
+
replacement('` Scopes Selected `', '` 已选权限范围 `'),
|
|
97
|
+
replacement('` No Scopes Defined `', '` 未定义权限范围 `'),
|
|
98
|
+
replacement('`Add Scope`', '`添加权限范围`', 2),
|
|
99
|
+
replacement('` Deselect All `', '` 取消全选 `'),
|
|
100
|
+
replacement('` Select All `', '` 全选 `'),
|
|
101
|
+
replacement('` Name: `', '` 名称:`'),
|
|
102
|
+
replacement('` Description: `', '` 描述:`'),
|
|
103
|
+
replacement('`Read user data`', '`读取用户数据`'),
|
|
104
|
+
replacement('`Save`', '`保存`'),
|
|
105
|
+
replacement('`Edit Scope`', '`编辑权限范围`'),
|
|
106
|
+
replacement('`Scope name is required.`', '`权限范围名称为必填项。`'),
|
|
107
|
+
replacement('`Delete Security Scheme`', '`删除安全方案`'),
|
|
108
|
+
replacement('` Cancel `', '` 取消 `', 3),
|
|
109
|
+
replacement("` This cannot be undone. You're about to delete the `+k(e.label)+` security scheme from the collection. `", '`此操作无法撤销。即将从集合中删除 `+k(e.label)+` 安全方案。`'),
|
|
110
|
+
replacement('` security scheme type is not supported yet. `', '` 安全方案类型暂不支持。`'),
|
|
111
|
+
replacement('` The security scheme is missing a type, please double check your `', '`安全方案缺少类型,请检查 `'),
|
|
112
|
+
replacement('` document or Authentication Configuration `', '` 文档或身份验证配置。`'),
|
|
113
|
+
replacement('`Failed to authorize`', '`授权失败`'),
|
|
114
|
+
replacement('`Failed to refresh token`', '`刷新令牌失败`'),
|
|
115
|
+
replacement('`Failed to fetch OpenID Connect configuration`', '`获取 OpenID Connect 配置失败`'),
|
|
116
|
+
replacement('`Add Environment`', '`添加环境`'),
|
|
117
|
+
replacement('`Select Environment`', '`选择环境`'),
|
|
118
|
+
replacement('`No Environment`', '`无环境`'),
|
|
119
|
+
replacement('` Not available in this context `', '` 当前上下文不可用 `'),
|
|
120
|
+
replacement('`New Environment`', '`新建环境`'),
|
|
121
|
+
replacement('`Create Environment`', '`创建环境`'),
|
|
122
|
+
replacement('` Environments let you manage variables like API keys and base URLs across different contexts. `', '` 环境用于管理不同上下文中的 API 密钥、基础 URL 等变量。 `'),
|
|
123
|
+
replacement('`Current environment: ${', '`当前环境:${'),
|
|
124
|
+
replacement('` Add Variable `', '` 添加变量 `'),
|
|
125
|
+
replacement('`Enter a URL`', '`输入 URL`'),
|
|
126
|
+
replacement('`Request History`', '`请求历史`'),
|
|
127
|
+
replacement('`History`', '`历史记录`'),
|
|
128
|
+
replacement('`Add Server`', '`添加服务器`'),
|
|
129
|
+
replacement('`Update Servers`', '`更新服务器`'),
|
|
130
|
+
replacement('`Unknown server`', '`未知服务器`'),
|
|
131
|
+
replacement('`Response Body`', '`响应体`'),
|
|
132
|
+
replacement('`Preview unavailable`', '`无法预览`', 2),
|
|
133
|
+
replacement('` Preview `', '` 预览 `', 2),
|
|
134
|
+
replacement('` Raw `', '` 原始内容 `', 2),
|
|
135
|
+
replacement('` Binary file `', '` 二进制文件 `', 2),
|
|
136
|
+
replacement("` This response body is massive! Syntax highlighting won't work here. `", '` 响应体过大,已关闭语法高亮。 `'),
|
|
137
|
+
replacement('`Response Information, Duration:`', '`响应信息,耗时:`'),
|
|
138
|
+
replacement('`, Size:`', '`,大小:`'),
|
|
139
|
+
replacement('` Settings `', '` 设置 `'),
|
|
140
|
+
replacement('`No document selected`', '`未选择 API 文档`'),
|
|
141
|
+
replacement('`Select an operation to view details`', '`选择一个操作以查看详情`'),
|
|
142
|
+
replacement('containerAriaLabel:{default:`Notifications`}', 'containerAriaLabel:{default:`通知`}'),
|
|
143
|
+
]);
|
|
144
|
+
|
|
145
|
+
export function localizeScalarBrowserAsset(asset, locale = scalarAssetLocale) {
|
|
146
|
+
if (locale !== scalarAssetLocale) throw new Error(`Scalar asset locale ${locale} is not supported`);
|
|
147
|
+
let output = Buffer.isBuffer(asset) ? asset.toString('utf8') : String(asset);
|
|
148
|
+
for (const rule of localizationRules) {
|
|
149
|
+
const count = countOccurrences(output, rule.source);
|
|
150
|
+
if (count !== rule.expectedCount) {
|
|
151
|
+
throw new Error(`Scalar localization source drift for ${JSON.stringify(rule.source)}: expected ${rule.expectedCount}, found ${count}`);
|
|
152
|
+
}
|
|
153
|
+
output = output.replaceAll(rule.source, rule.target);
|
|
154
|
+
}
|
|
155
|
+
return Buffer.from(output);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function replacement(source, target, expectedCount = 1) {
|
|
159
|
+
return Object.freeze({ expectedCount, source, target });
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function countOccurrences(value, search) {
|
|
163
|
+
return value.split(search).length - 1;
|
|
164
|
+
}
|