@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,270 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import test from 'node:test';
|
|
3
|
+
|
|
4
|
+
import { canonicalJSON, projectDocument, projectOperationSet, validateDocument, validateRegistry } from '../project.mjs';
|
|
5
|
+
|
|
6
|
+
test('public projection keeps reachable components and owner evidence while stripping routing metadata', () => {
|
|
7
|
+
const projected = projectDocument(fixtureDocument(), 'public');
|
|
8
|
+
|
|
9
|
+
assert.deepEqual(Object.keys(projected.paths), ['/api/v1/widgets/{id}']);
|
|
10
|
+
assert.deepEqual(Object.keys(projected.components.schemas), ['Widget']);
|
|
11
|
+
assert.deepEqual(Object.keys(projected.components.securitySchemes), ['BearerAuth']);
|
|
12
|
+
assert.equal(projected.paths['/api/v1/widgets/{id}'].get['x-onex-owner'], 'widgets');
|
|
13
|
+
assert.equal(projected.paths['/api/v1/widgets/{id}'].get['x-onex-audience'], undefined);
|
|
14
|
+
assert.doesNotThrow(() => validateDocument(projected, { audience: 'public', requireMetadata: false, service: 'fixture' }));
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('projection rejects a stable operation that references a beta component', () => {
|
|
18
|
+
const document = fixtureDocument();
|
|
19
|
+
document.components.schemas.Widget['x-onex-stability'] = 'beta';
|
|
20
|
+
|
|
21
|
+
assert.throws(() => projectDocument(document, 'public'), /stability is lower than its consumer/);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test('external projection removes complete internal authentication alternatives', () => {
|
|
25
|
+
const document = fixtureDocument();
|
|
26
|
+
document.components.securitySchemes.InternalServiceToken = {
|
|
27
|
+
bearerFormat: 'OneX-IAM-Service-Token',
|
|
28
|
+
scheme: 'bearer',
|
|
29
|
+
type: 'http',
|
|
30
|
+
'x-onex-audience': 'internal',
|
|
31
|
+
'x-onex-stability': 'stable',
|
|
32
|
+
};
|
|
33
|
+
document.paths['/api/v1/widgets/{id}'].get.security = [
|
|
34
|
+
{},
|
|
35
|
+
{ BearerAuth: [], InternalServiceToken: [] },
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
const projected = projectDocument(document, 'public');
|
|
39
|
+
|
|
40
|
+
assert.deepEqual(projected.paths['/api/v1/widgets/{id}'].get.security, [{}]);
|
|
41
|
+
assert.equal(projected.components.securitySchemes, undefined);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('external projection rejects operations secured only by internal authentication', () => {
|
|
45
|
+
const document = fixtureDocument();
|
|
46
|
+
document.components.securitySchemes.InternalServiceToken = {
|
|
47
|
+
bearerFormat: 'OneX-IAM-Service-Token',
|
|
48
|
+
scheme: 'bearer',
|
|
49
|
+
type: 'http',
|
|
50
|
+
'x-onex-audience': 'internal',
|
|
51
|
+
'x-onex-stability': 'stable',
|
|
52
|
+
};
|
|
53
|
+
document.paths['/api/v1/widgets/{id}'].get.security = [{ InternalServiceToken: [] }];
|
|
54
|
+
|
|
55
|
+
assert.throws(
|
|
56
|
+
() => projectDocument(document, 'public'),
|
|
57
|
+
/GET \/api\/v1\/widgets\/\{id\} has no security alternative available in public projection/,
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test('operation projection keeps only selected operations and reachable components', () => {
|
|
62
|
+
const projected = projectOperationSet(fixtureDocument(), new Set(['getWidget']));
|
|
63
|
+
|
|
64
|
+
assert.deepEqual(Object.keys(projected.paths), ['/api/v1/widgets/{id}']);
|
|
65
|
+
assert.deepEqual(Object.keys(projected.components.schemas), ['Widget']);
|
|
66
|
+
assert.deepEqual(Object.keys(projected.components.securitySchemes), ['BearerAuth']);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test('localized projection keeps only navigation groups used by the audience', () => {
|
|
70
|
+
const projected = projectDocument(localizedFixtureDocument(), 'public');
|
|
71
|
+
|
|
72
|
+
assert.deepEqual(projected.tags.map(({ name }) => name), ['组件']);
|
|
73
|
+
assert.deepEqual(projected['x-tagGroups'], [{ name: '公开能力', tags: ['组件'] }]);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test('localized document validation rejects English copy and incomplete navigation taxonomy', () => {
|
|
77
|
+
const englishCopy = localizedFixtureDocument();
|
|
78
|
+
englishCopy.paths['/api/v1/widgets/{id}'].get.summary = 'Get a widget';
|
|
79
|
+
assert.throws(
|
|
80
|
+
() => validateDocument(englishCopy, { audience: 'internal', service: 'fixture' }),
|
|
81
|
+
/documentation text must use Chinese copy/,
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const leakedHandlerName = localizedFixtureDocument();
|
|
85
|
+
leakedHandlerName.paths['/api/v1/widgets/{id}'].get.summary = 'GetWidget 查询组件详情';
|
|
86
|
+
assert.throws(
|
|
87
|
+
() => validateDocument(leakedHandlerName, { audience: 'internal', service: 'fixture' }),
|
|
88
|
+
/must not expose a handler or English action prefix/,
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
const incompleteTaxonomy = localizedFixtureDocument();
|
|
92
|
+
incompleteTaxonomy['x-tagGroups'][1].tags = [];
|
|
93
|
+
assert.throws(
|
|
94
|
+
() => validateDocument(incompleteTaxonomy, { audience: 'internal', service: 'fixture' }),
|
|
95
|
+
/x-tagGroups\[1\] must contain at least one tag/,
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const multipleTags = localizedFixtureDocument();
|
|
99
|
+
multipleTags.paths['/api/v1/widgets/{id}'].get.tags.push('内部任务');
|
|
100
|
+
assert.throws(
|
|
101
|
+
() => validateDocument(multipleTags, { audience: 'internal', service: 'fixture' }),
|
|
102
|
+
/must declare exactly one navigation tag/,
|
|
103
|
+
);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test('document validation rejects nullable and unconstrained external objects', () => {
|
|
107
|
+
const document = fixtureDocument();
|
|
108
|
+
document.components.schemas.Widget.properties.name.nullable = true;
|
|
109
|
+
|
|
110
|
+
assert.throws(() => validateDocument(document, { audience: 'public', service: 'fixture' }), /nullable keyword/);
|
|
111
|
+
delete document.components.schemas.Widget.properties.name.nullable;
|
|
112
|
+
document.components.schemas.Widget.additionalProperties = true;
|
|
113
|
+
assert.throws(() => validateDocument(document, { audience: 'public', service: 'fixture' }), /unconstrained object/);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test('document validation requires the canonical OneX idempotency header', () => {
|
|
117
|
+
for (const name of ['Idempotency-Key', 'idempotency-key', 'IDEMPOTENCY-KEY', 'IdEmPoTeNcY-kEy']) {
|
|
118
|
+
const document = fixtureDocument();
|
|
119
|
+
document.paths['/internal/v1/jobs'].post.parameters = [{
|
|
120
|
+
in: 'header',
|
|
121
|
+
name,
|
|
122
|
+
required: true,
|
|
123
|
+
schema: { type: 'string' },
|
|
124
|
+
}];
|
|
125
|
+
|
|
126
|
+
assert.throws(
|
|
127
|
+
() => validateDocument(document, { audience: 'internal', service: 'fixture' }),
|
|
128
|
+
/provider idempotency header instead of X-Idempotency-Key/,
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const document = fixtureDocument();
|
|
133
|
+
document.paths['/internal/v1/jobs'].post.parameters = [{
|
|
134
|
+
in: 'header',
|
|
135
|
+
name: 'X-Idempotency-Key',
|
|
136
|
+
required: true,
|
|
137
|
+
schema: { type: 'string' },
|
|
138
|
+
}];
|
|
139
|
+
assert.doesNotThrow(() => validateDocument(document, { audience: 'internal', service: 'fixture' }));
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
test('document validation reserves trailing slashes for provider webhook contracts', () => {
|
|
143
|
+
const rejected = fixtureDocument();
|
|
144
|
+
rejected.paths['/api/v1/widgets/'] = rejected.paths['/api/v1/widgets/{id}'];
|
|
145
|
+
delete rejected.paths['/api/v1/widgets/{id}'];
|
|
146
|
+
assert.throws(
|
|
147
|
+
() => validateDocument(rejected, { audience: 'internal', service: 'fixture' }),
|
|
148
|
+
/trailing slash outside the provider webhook contract/,
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
const accepted = fixtureDocument();
|
|
152
|
+
accepted.paths['/api/v1/webhooks/{product_code}/stripe/'] = accepted.paths['/api/v1/widgets/{id}'];
|
|
153
|
+
delete accepted.paths['/api/v1/widgets/{id}'];
|
|
154
|
+
assert.doesNotThrow(() => validateDocument(accepted, { audience: 'internal', service: 'fixture' }));
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
test('registry rejects business route exclusions', () => {
|
|
158
|
+
assert.throws(() => validateRegistry({
|
|
159
|
+
schema_version: 1,
|
|
160
|
+
services: [{
|
|
161
|
+
display_name: '示例 API',
|
|
162
|
+
documentation_locale: 'zh-CN',
|
|
163
|
+
id: 'fixture-api',
|
|
164
|
+
publications: ['internal'],
|
|
165
|
+
route_exclusions: ['/api/v1/widgets'],
|
|
166
|
+
runtime_conformance: 'services/fixture-api/conformance/runtime.arazzo.yaml',
|
|
167
|
+
source: 'services/fixture-api/openapi.yaml',
|
|
168
|
+
}],
|
|
169
|
+
}), /forbidden route exclusion/);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
test('canonical serialization is deterministic', () => {
|
|
173
|
+
assert.equal(canonicalJSON({ z: 1, a: { y: 2, b: 3 } }), '{\n "a": {\n "b": 3,\n "y": 2\n },\n "z": 1\n}\n');
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
function fixtureDocument() {
|
|
177
|
+
return {
|
|
178
|
+
components: {
|
|
179
|
+
schemas: {
|
|
180
|
+
InternalJob: {
|
|
181
|
+
properties: { id: { type: 'string' } },
|
|
182
|
+
type: 'object',
|
|
183
|
+
'x-onex-audience': 'internal',
|
|
184
|
+
'x-onex-stability': 'stable',
|
|
185
|
+
},
|
|
186
|
+
Widget: {
|
|
187
|
+
properties: { id: { type: 'string' }, name: { type: 'string' } },
|
|
188
|
+
required: ['id', 'name'],
|
|
189
|
+
type: 'object',
|
|
190
|
+
'x-onex-audience': 'public',
|
|
191
|
+
'x-onex-stability': 'stable',
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
securitySchemes: {
|
|
195
|
+
BearerAuth: {
|
|
196
|
+
bearerFormat: 'JWT',
|
|
197
|
+
scheme: 'bearer',
|
|
198
|
+
type: 'http',
|
|
199
|
+
'x-onex-audience': 'public',
|
|
200
|
+
'x-onex-stability': 'stable',
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
info: { title: 'Fixture API', version: '1.0.0' },
|
|
205
|
+
jsonSchemaDialect: 'https://json-schema.org/draft/2020-12/schema',
|
|
206
|
+
openapi: '3.1.1',
|
|
207
|
+
paths: {
|
|
208
|
+
'/api/v1/widgets/{id}': {
|
|
209
|
+
get: {
|
|
210
|
+
operationId: 'getWidget',
|
|
211
|
+
parameters: [{ in: 'path', name: 'id', required: true, schema: { type: 'string' } }],
|
|
212
|
+
responses: {
|
|
213
|
+
200: {
|
|
214
|
+
content: { 'application/json': { schema: { $ref: '#/components/schemas/Widget' } } },
|
|
215
|
+
description: 'OK',
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
security: [{ BearerAuth: [] }],
|
|
219
|
+
summary: 'Get a widget',
|
|
220
|
+
tags: ['Widgets'],
|
|
221
|
+
'x-onex-audience': 'public',
|
|
222
|
+
'x-onex-lifecycle': {
|
|
223
|
+
deprecated: null,
|
|
224
|
+
introduced: '2026-07-16',
|
|
225
|
+
migrationUrl: null,
|
|
226
|
+
replacementOperationId: null,
|
|
227
|
+
sunset: null,
|
|
228
|
+
},
|
|
229
|
+
'x-onex-owner': 'widgets',
|
|
230
|
+
'x-onex-stability': 'stable',
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
'/internal/v1/jobs': {
|
|
234
|
+
post: {
|
|
235
|
+
operationId: 'createInternalJob',
|
|
236
|
+
responses: { 202: { description: 'Accepted' } },
|
|
237
|
+
security: [{ ServiceCredential: [] }],
|
|
238
|
+
summary: 'Create an internal job',
|
|
239
|
+
tags: ['Jobs'],
|
|
240
|
+
'x-onex-audience': 'internal',
|
|
241
|
+
'x-onex-owner': 'jobs',
|
|
242
|
+
'x-onex-stability': 'stable',
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
servers: [{ url: '/' }],
|
|
247
|
+
tags: [{ name: 'Jobs' }, { name: 'Widgets' }],
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function localizedFixtureDocument() {
|
|
252
|
+
const document = fixtureDocument();
|
|
253
|
+
document.info.title = '示例 API';
|
|
254
|
+
document.paths['/api/v1/widgets/{id}'].get.responses[200].description = '请求成功';
|
|
255
|
+
document.paths['/api/v1/widgets/{id}'].get.summary = '查询组件详情';
|
|
256
|
+
document.paths['/api/v1/widgets/{id}'].get.tags = ['组件'];
|
|
257
|
+
document.paths['/internal/v1/jobs'].post.responses[202].description = '请求已受理';
|
|
258
|
+
document.paths['/internal/v1/jobs'].post.summary = '创建内部任务';
|
|
259
|
+
document.paths['/internal/v1/jobs'].post.tags = ['内部任务'];
|
|
260
|
+
document.tags = [
|
|
261
|
+
{ description: '内部任务相关接口。', name: '内部任务' },
|
|
262
|
+
{ description: '组件相关接口。', name: '组件' },
|
|
263
|
+
];
|
|
264
|
+
document['x-onex-documentation-locale'] = 'zh-CN';
|
|
265
|
+
document['x-tagGroups'] = [
|
|
266
|
+
{ name: '内部能力', tags: ['内部任务'] },
|
|
267
|
+
{ name: '公开能力', tags: ['组件'] },
|
|
268
|
+
];
|
|
269
|
+
return document;
|
|
270
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { tmpdir } from 'node:os';
|
|
5
|
+
import { dirname, resolve } from 'node:path';
|
|
6
|
+
import test from 'node:test';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
|
|
9
|
+
import { parse, stringify } from 'yaml';
|
|
10
|
+
|
|
11
|
+
const apiRoot = resolve(dirname(fileURLToPath(import.meta.url)), '../..');
|
|
12
|
+
const publicationConfigPath = resolve(apiRoot, 'redocly.yaml');
|
|
13
|
+
const sourceConfigPath = resolve(apiRoot, 'redocly-source.yaml');
|
|
14
|
+
const redoclyBin = resolve(apiRoot, 'node_modules', '.bin', 'redocly');
|
|
15
|
+
|
|
16
|
+
const publicationRules = Object.freeze([
|
|
17
|
+
'operation-description',
|
|
18
|
+
'parameter-description',
|
|
19
|
+
'no-invalid-media-type-examples',
|
|
20
|
+
'no-invalid-parameter-examples',
|
|
21
|
+
'no-invalid-schema-examples',
|
|
22
|
+
]);
|
|
23
|
+
|
|
24
|
+
test('documentation profiles are valid and separate source and publication rules', () => {
|
|
25
|
+
const publication = parse(readFileSync(publicationConfigPath, 'utf8'));
|
|
26
|
+
const source = parse(readFileSync(sourceConfigPath, 'utf8'));
|
|
27
|
+
|
|
28
|
+
for (const configPath of [publicationConfigPath, sourceConfigPath]) {
|
|
29
|
+
const result = runRedocly(['check-config', '--config', configPath]);
|
|
30
|
+
assert.equal(result.error, undefined);
|
|
31
|
+
assert.equal(result.status, 0, redoclyOutput(result));
|
|
32
|
+
}
|
|
33
|
+
for (const rule of publicationRules) {
|
|
34
|
+
assert.equal(publication.rules[rule], 'error', `${rule} must block publication`);
|
|
35
|
+
}
|
|
36
|
+
assert.deepEqual(publication.extends, ['./redocly-source.yaml']);
|
|
37
|
+
assert.deepEqual(source.extends, ['recommended-strict']);
|
|
38
|
+
assert.deepEqual(
|
|
39
|
+
{
|
|
40
|
+
'operation-description': source.rules['operation-description'],
|
|
41
|
+
'parameter-description': source.rules['parameter-description'],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
'operation-description': 'off',
|
|
45
|
+
'parameter-description': 'off',
|
|
46
|
+
},
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test('publication profile rejects invalid media examples and accepts valid described examples', (t) => {
|
|
51
|
+
const fixtureDirectory = mkdtempSync(resolve(tmpdir(), 'onex-redocly-documentation-'));
|
|
52
|
+
t.after(() => rmSync(fixtureDirectory, { force: true, recursive: true }));
|
|
53
|
+
|
|
54
|
+
const invalidPath = resolve(fixtureDirectory, 'invalid.openapi.yaml');
|
|
55
|
+
const validPath = resolve(fixtureDirectory, 'valid.openapi.yaml');
|
|
56
|
+
writeFileSync(invalidPath, stringify(documentationFixture('2026')));
|
|
57
|
+
writeFileSync(validPath, stringify(documentationFixture(2026)));
|
|
58
|
+
|
|
59
|
+
const invalidResult = lint(invalidPath);
|
|
60
|
+
assert.equal(invalidResult.error, undefined);
|
|
61
|
+
assert.notEqual(invalidResult.status, 0, redoclyOutput(invalidResult));
|
|
62
|
+
assert.match(redoclyOutput(invalidResult), /no-invalid-media-type-examples/);
|
|
63
|
+
|
|
64
|
+
const validResult = lint(validPath);
|
|
65
|
+
assert.equal(validResult.error, undefined);
|
|
66
|
+
assert.equal(validResult.status, 0, redoclyOutput(validResult));
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
function lint(apiPath) {
|
|
70
|
+
return runRedocly([
|
|
71
|
+
'lint',
|
|
72
|
+
apiPath,
|
|
73
|
+
'--config',
|
|
74
|
+
publicationConfigPath,
|
|
75
|
+
'--format',
|
|
76
|
+
'stylish',
|
|
77
|
+
'--lint-config',
|
|
78
|
+
'error',
|
|
79
|
+
]);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function runRedocly(args) {
|
|
83
|
+
return spawnSync(redoclyBin, args, { cwd: apiRoot, encoding: 'utf8' });
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function redoclyOutput(result) {
|
|
87
|
+
return [result.stdout, result.stderr].filter(Boolean).join('\n');
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function documentationFixture(year) {
|
|
91
|
+
return {
|
|
92
|
+
openapi: '3.1.1',
|
|
93
|
+
info: {
|
|
94
|
+
title: 'Documentation Rules Fixture',
|
|
95
|
+
version: '1.0.0',
|
|
96
|
+
license: {
|
|
97
|
+
name: 'MIT',
|
|
98
|
+
identifier: 'MIT',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
servers: [{ url: 'https://api.onex.test' }],
|
|
102
|
+
tags: [{ name: 'Widgets', description: 'Widget operations.' }],
|
|
103
|
+
paths: {
|
|
104
|
+
'/widgets': {
|
|
105
|
+
get: {
|
|
106
|
+
operationId: 'listWidgets',
|
|
107
|
+
summary: 'List widgets',
|
|
108
|
+
description: 'Returns the available widgets.',
|
|
109
|
+
tags: ['Widgets'],
|
|
110
|
+
security: [],
|
|
111
|
+
parameters: [
|
|
112
|
+
{
|
|
113
|
+
name: 'limit',
|
|
114
|
+
in: 'query',
|
|
115
|
+
description: 'Maximum widgets to return.',
|
|
116
|
+
schema: { type: 'integer', minimum: 1 },
|
|
117
|
+
example: 1,
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
responses: {
|
|
121
|
+
200: {
|
|
122
|
+
description: 'Widgets returned.',
|
|
123
|
+
content: {
|
|
124
|
+
'application/json': {
|
|
125
|
+
schema: {
|
|
126
|
+
type: 'object',
|
|
127
|
+
required: ['year'],
|
|
128
|
+
properties: {
|
|
129
|
+
year: { type: 'integer', description: 'Publication year.' },
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
examples: {
|
|
133
|
+
release: {
|
|
134
|
+
summary: 'Widget release',
|
|
135
|
+
value: { year },
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
}
|
package/dist/resources/templates/go-backend/api/openapi/tooling/test/release_manifest.test.mjs
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { gunzipSync } from 'node:zlib';
|
|
3
|
+
import test from 'node:test';
|
|
4
|
+
|
|
5
|
+
import { createDeterministicTGZ } from '../deterministic_archive.mjs';
|
|
6
|
+
import { artifactURN, fileArtifactRecord, releaseManifest } from '../manifest.mjs';
|
|
7
|
+
|
|
8
|
+
const gitRevision = 'a'.repeat(40);
|
|
9
|
+
const toolVersions = Object.freeze({ node: '24.18.0' });
|
|
10
|
+
|
|
11
|
+
test('release manifest separates logical artifact identity from identical content bytes', () => {
|
|
12
|
+
const content = '{"openapi":"3.1.1"}\n';
|
|
13
|
+
const contract = record({ content, kind: 'openapi-contract', path: 'services/platform-api/dist/public.openapi.json' });
|
|
14
|
+
const raw = record({
|
|
15
|
+
content,
|
|
16
|
+
derivedFrom: [artifactURN(contract)],
|
|
17
|
+
extra: { source_contract_sha256: contract.sha256 },
|
|
18
|
+
kind: 'raw-openapi',
|
|
19
|
+
path: 'publish/raw/platform-api/1.0.0/public/openapi.json',
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
assert.equal(contract.sha256, raw.sha256);
|
|
23
|
+
assert.notEqual(contract.artifact_id, raw.artifact_id);
|
|
24
|
+
assert.notEqual(artifactURN(contract), artifactURN(raw));
|
|
25
|
+
const manifest = releaseManifest([raw, contract], {
|
|
26
|
+
gitRevision,
|
|
27
|
+
sourceSha256: 'b'.repeat(64),
|
|
28
|
+
toolVersions,
|
|
29
|
+
});
|
|
30
|
+
assert.equal(manifest.schema_version, 2);
|
|
31
|
+
assert.equal(manifest.reproducible_build.artifact_count, 2);
|
|
32
|
+
assert.match(manifest.release_id, /^[a-f0-9]{64}$/);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test('release manifest rejects duplicate paths, dangling dependencies, and self-dependencies', () => {
|
|
36
|
+
const contract = record({ kind: 'openapi-contract', path: 'services/platform-api/dist/public.openapi.json' });
|
|
37
|
+
const duplicate = record({ kind: 'raw-openapi', path: contract.path });
|
|
38
|
+
const options = { gitRevision, sourceSha256: 'b'.repeat(64), toolVersions };
|
|
39
|
+
assert.throws(() => releaseManifest([contract, duplicate], options), /share path/);
|
|
40
|
+
|
|
41
|
+
const dangling = { ...record({ kind: 'conformance-matrix', path: 'dist/conformance-matrix.json' }), derived_from: [`urn:onex:artifact:sha256:${'c'.repeat(64)}`] };
|
|
42
|
+
assert.throws(() => releaseManifest([contract, dangling], options), /unresolved dependency/);
|
|
43
|
+
|
|
44
|
+
const self = { ...contract, derived_from: [artifactURN(contract)] };
|
|
45
|
+
assert.throws(() => releaseManifest([self], options), /derives from itself/);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('TypeScript SDK archive is a deterministic USTAR gzip with package-prefixed files', () => {
|
|
49
|
+
const files = new Map([
|
|
50
|
+
['README.md', Buffer.from('# SDK\n')],
|
|
51
|
+
['package.json', Buffer.from('{"private":true}\n')],
|
|
52
|
+
]);
|
|
53
|
+
const first = createDeterministicTGZ(files);
|
|
54
|
+
const second = createDeterministicTGZ(new Map([...files].reverse()));
|
|
55
|
+
assert.deepEqual(first, second);
|
|
56
|
+
|
|
57
|
+
const tar = gunzipSync(first);
|
|
58
|
+
assert.equal(tar.subarray(0, 100).toString('utf8').replaceAll('\0', ''), 'package/README.md');
|
|
59
|
+
assert.equal(tar.subarray(257, 263).toString('utf8'), 'ustar\0');
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
function record({ content = '{}\n', derivedFrom = [], extra = {}, kind, path }) {
|
|
63
|
+
return fileArtifactRecord({
|
|
64
|
+
api_version: '1.0.0',
|
|
65
|
+
audience: 'public',
|
|
66
|
+
content,
|
|
67
|
+
derived_from: derivedFrom,
|
|
68
|
+
extra,
|
|
69
|
+
git_revision: gitRevision,
|
|
70
|
+
kind,
|
|
71
|
+
media_type: 'application/json',
|
|
72
|
+
path,
|
|
73
|
+
service: 'platform-api',
|
|
74
|
+
tool_versions: toolVersions,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import test from 'node:test';
|
|
3
|
+
|
|
4
|
+
import { routeContract } from '../route_contract.mjs';
|
|
5
|
+
|
|
6
|
+
test('route contract normalizes operations into deterministic method and path records', () => {
|
|
7
|
+
const routes = routeContract({
|
|
8
|
+
paths: {
|
|
9
|
+
'/api/v1/widgets/{id}': {
|
|
10
|
+
get: {
|
|
11
|
+
operationId: 'getWidget',
|
|
12
|
+
parameters: [{ in: 'path', name: 'id', required: true }],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
assert.deepEqual(routes, [{ method: 'GET', operation_id: 'getWidget', path: '/api/v1/widgets/{id}' }]);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('route contract uses the runtime UTF-8 byte ordering for prefixes and Unicode paths', () => {
|
|
22
|
+
const routes = routeContract({
|
|
23
|
+
paths: {
|
|
24
|
+
'/api/onex/account/deletion/cancel': { post: { operationId: 'cancelAccountDeletion' } },
|
|
25
|
+
'/api/onex/account/deletion': { post: { operationId: 'deleteAccount' } },
|
|
26
|
+
'/api/v1/\u{10000}': { get: { operationId: 'getAstralPath' } },
|
|
27
|
+
'/api/v1/\uE000': { get: { operationId: 'getPrivateUsePath' } },
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
assert.deepEqual(routes.map(({ method, path }) => ({ method, path })), [
|
|
32
|
+
{ method: 'POST', path: '/api/onex/account/deletion' },
|
|
33
|
+
{ method: 'POST', path: '/api/onex/account/deletion/cancel' },
|
|
34
|
+
{ method: 'GET', path: '/api/v1/\uE000' },
|
|
35
|
+
{ method: 'GET', path: '/api/v1/\u{10000}' },
|
|
36
|
+
]);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('route contract rejects undeclared and wildcard parameters', () => {
|
|
40
|
+
assert.throws(() => routeContract({ paths: { '/api/v1/widgets/{id}': { get: { operationId: 'getWidget' } } } }), /must be declared and required/);
|
|
41
|
+
assert.throws(() => routeContract({ paths: { '/api/v1/data/*path': { get: { operationId: 'getData' } } } }), /cannot contain a wildcard/);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('route contract resolves reusable local path parameters', () => {
|
|
45
|
+
const routes = routeContract({
|
|
46
|
+
components: {
|
|
47
|
+
parameters: {
|
|
48
|
+
WidgetID: pathParameter('id', { type: 'string' }),
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
paths: {
|
|
52
|
+
'/api/v1/widgets/{id}': {
|
|
53
|
+
get: {
|
|
54
|
+
operationId: 'getWidget',
|
|
55
|
+
parameters: [{ $ref: '#/components/parameters/WidgetID' }],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
assert.deepEqual(routes, [{ method: 'GET', operation_id: 'getWidget', path: '/api/v1/widgets/{id}' }]);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test('route contract rejects method and schema overlapping paths', () => {
|
|
65
|
+
assert.throws(() => routeContract({
|
|
66
|
+
paths: {
|
|
67
|
+
'/api/v1/widgets/{id}/events': {
|
|
68
|
+
get: { operationId: 'getWidgetEvents', parameters: [pathParameter('id', { type: 'string' })] },
|
|
69
|
+
},
|
|
70
|
+
'/api/v1/widgets/special/{event}': {
|
|
71
|
+
get: { operationId: 'getSpecialEvent', parameters: [pathParameter('event', { type: 'string' })] },
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
}), /ambiguous routes:[\s\S]*GET/);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test('route contract accepts method-separated or schema-disjoint paths', () => {
|
|
78
|
+
assert.equal(routeContract({
|
|
79
|
+
paths: {
|
|
80
|
+
'/api/v1/widgets/{id}/events': {
|
|
81
|
+
get: { operationId: 'getWidgetEvents', parameters: [pathParameter('id', { type: 'integer' })] },
|
|
82
|
+
},
|
|
83
|
+
'/api/v1/widgets/special/{event}': {
|
|
84
|
+
get: { operationId: 'getSpecialEvent', parameters: [pathParameter('event', { type: 'string' })] },
|
|
85
|
+
post: { operationId: 'createSpecialEvent', parameters: [pathParameter('event', { type: 'string' })] },
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
}).length, 3);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test('route contract preserves trailing slash route identities', () => {
|
|
92
|
+
const document = {
|
|
93
|
+
paths: {
|
|
94
|
+
'/api/v1/webhooks/{product_code}/stripe': {
|
|
95
|
+
post: { operationId: 'postStripeWebhook', parameters: [pathParameter('product_code', { type: 'string' })] },
|
|
96
|
+
},
|
|
97
|
+
'/api/v1/webhooks/{product_code}/stripe/': {
|
|
98
|
+
post: { operationId: 'postStripeWebhookWithSlash', parameters: [pathParameter('product_code', { type: 'string' })] },
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
assert.equal(routeContract(document).length, 2);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test('route contract honors explicit static route exclusions', () => {
|
|
107
|
+
assert.equal(routeContract({
|
|
108
|
+
paths: {
|
|
109
|
+
'/api/v1/settings/{key}': {
|
|
110
|
+
put: { operationId: 'putSetting', parameters: [pathParameter('key', { type: 'string', not: { enum: ['batch'] } })] },
|
|
111
|
+
},
|
|
112
|
+
'/api/v1/settings/batch': { put: { operationId: 'putSettings' } },
|
|
113
|
+
},
|
|
114
|
+
}).length, 2);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
function pathParameter(name, schema) {
|
|
118
|
+
return { in: 'path', name, required: true, schema };
|
|
119
|
+
}
|
package/dist/resources/templates/go-backend/api/openapi/tooling/test/runtime_conformance.test.mjs
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import test from 'node:test';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
buildRespectChildEnv,
|
|
6
|
+
parseInputMap,
|
|
7
|
+
parseServerMap,
|
|
8
|
+
} from '../runtime_conformance.mjs';
|
|
9
|
+
|
|
10
|
+
test('runtime server map requires one safe URL per registered service', () => {
|
|
11
|
+
assert.deepEqual(
|
|
12
|
+
parseServerMap('{"admin-api":"http://127.0.0.1:3003/"}', ['admin-api']),
|
|
13
|
+
{ 'admin-api': 'http://127.0.0.1:3003' },
|
|
14
|
+
);
|
|
15
|
+
assert.throws(
|
|
16
|
+
() => parseServerMap('{}', ['admin-api']),
|
|
17
|
+
/missing=admin-api/,
|
|
18
|
+
);
|
|
19
|
+
assert.throws(
|
|
20
|
+
() => parseServerMap('{"admin-api":"https://user:secret@example.com"}', ['admin-api']),
|
|
21
|
+
/without credentials/,
|
|
22
|
+
);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('runtime server map rejects unknown service keys', () => {
|
|
26
|
+
assert.throws(
|
|
27
|
+
() => parseServerMap('{"admin-api":"http://localhost:3003","other":"http://localhost:4000"}', ['admin-api']),
|
|
28
|
+
/unknown=other/,
|
|
29
|
+
);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('runtime input map isolates credential-bearing workflow inputs by service', () => {
|
|
33
|
+
assert.deepEqual(
|
|
34
|
+
parseInputMap(
|
|
35
|
+
'{"platform-api":{"checkoutProviderReturnSessionToken":"secret","checkoutProviderReturnOperationNo":"cpo_1"}}',
|
|
36
|
+
['admin-api', 'platform-api'],
|
|
37
|
+
),
|
|
38
|
+
{
|
|
39
|
+
'platform-api': {
|
|
40
|
+
checkoutProviderReturnOperationNo: 'cpo_1',
|
|
41
|
+
checkoutProviderReturnSessionToken: 'secret',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
);
|
|
45
|
+
assert.throws(
|
|
46
|
+
() => parseInputMap('{"other":{}}', ['platform-api']),
|
|
47
|
+
/unknown services: other/,
|
|
48
|
+
);
|
|
49
|
+
assert.throws(
|
|
50
|
+
() => parseInputMap('{"platform-api":[]}', ['platform-api']),
|
|
51
|
+
/platform-api conformance inputs must be a JSON object/,
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('Respect child environment receives only the current service inputs', () => {
|
|
56
|
+
const childEnv = buildRespectChildEnv(
|
|
57
|
+
{ checkoutProviderReturnSessionToken: 'platform-secret' },
|
|
58
|
+
{
|
|
59
|
+
ONEX_OPENAPI_CONFORMANCE_INPUTS: '{"platform-api":{"token":"platform-secret"},"admin-api":{"token":"admin-secret"}}',
|
|
60
|
+
PATH: '/usr/bin',
|
|
61
|
+
REDOCLY_CLI_RESPECT_INPUT: '{"token":"stale-secret"}',
|
|
62
|
+
},
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
assert.equal(childEnv.ONEX_OPENAPI_CONFORMANCE_INPUTS, undefined);
|
|
66
|
+
assert.equal(childEnv.PATH, '/usr/bin');
|
|
67
|
+
assert.deepEqual(JSON.parse(childEnv.REDOCLY_CLI_RESPECT_INPUT), {
|
|
68
|
+
checkoutProviderReturnSessionToken: 'platform-secret',
|
|
69
|
+
});
|
|
70
|
+
assert.equal(childEnv.REDOCLY_CLI_RESPECT_INPUT.includes('admin-secret'), false);
|
|
71
|
+
|
|
72
|
+
const childWithoutInputs = buildRespectChildEnv(undefined, childEnv);
|
|
73
|
+
assert.equal(childWithoutInputs.ONEX_OPENAPI_CONFORMANCE_INPUTS, undefined);
|
|
74
|
+
assert.equal(childWithoutInputs.REDOCLY_CLI_RESPECT_INPUT, undefined);
|
|
75
|
+
});
|