@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,113 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type {
|
|
3
|
+
GoogleButtonOptions,
|
|
4
|
+
GoogleCredentialResponse,
|
|
5
|
+
} from "../../composables/useGoogleIdentity";
|
|
6
|
+
|
|
7
|
+
const props = withDefaults(
|
|
8
|
+
defineProps<{
|
|
9
|
+
label?: string;
|
|
10
|
+
disabledLabel?: string;
|
|
11
|
+
options?: GoogleButtonOptions;
|
|
12
|
+
autoExchange?: boolean;
|
|
13
|
+
oneTap?: boolean;
|
|
14
|
+
}>(),
|
|
15
|
+
{
|
|
16
|
+
label: "Continue with Google",
|
|
17
|
+
disabledLabel: "Google sign-in is not configured",
|
|
18
|
+
options: () => ({ theme: "outline", size: "large", text: "continue_with", shape: "rectangular" }),
|
|
19
|
+
autoExchange: false,
|
|
20
|
+
oneTap: false,
|
|
21
|
+
},
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const emit = defineEmits<{
|
|
25
|
+
credential: [response: GoogleCredentialResponse];
|
|
26
|
+
authenticated: [payload: unknown];
|
|
27
|
+
error: [error: Error];
|
|
28
|
+
}>();
|
|
29
|
+
|
|
30
|
+
const identity = useGoogleIdentity();
|
|
31
|
+
const analytics = useAnalytics();
|
|
32
|
+
const buttonRef = ref<HTMLElement | null>(null);
|
|
33
|
+
const errorMessage = ref("");
|
|
34
|
+
const loading = ref(false);
|
|
35
|
+
|
|
36
|
+
async function handleCredential(response: GoogleCredentialResponse) {
|
|
37
|
+
emit("credential", response);
|
|
38
|
+
analytics.track("identity_google_credential", {
|
|
39
|
+
select_by: response.select_by,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
if (!props.autoExchange || !response.credential) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
loading.value = true;
|
|
47
|
+
try {
|
|
48
|
+
const payload = await identity.exchangeCredential(response.credential);
|
|
49
|
+
emit("authenticated", payload);
|
|
50
|
+
} catch (error) {
|
|
51
|
+
const nextError = error instanceof Error ? error : new Error("Google credential exchange failed");
|
|
52
|
+
errorMessage.value = nextError.message;
|
|
53
|
+
emit("error", nextError);
|
|
54
|
+
} finally {
|
|
55
|
+
loading.value = false;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async function renderGoogleButton() {
|
|
60
|
+
if (!import.meta.client || !buttonRef.value || !identity.enabled.value) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
errorMessage.value = "";
|
|
65
|
+
try {
|
|
66
|
+
await identity.renderButton(buttonRef.value, handleCredential, props.options);
|
|
67
|
+
if (props.oneTap && identity.oneTapEnabled.value) {
|
|
68
|
+
await identity.promptOneTap(handleCredential);
|
|
69
|
+
}
|
|
70
|
+
} catch (error) {
|
|
71
|
+
const nextError = error instanceof Error ? error : new Error("Google sign-in failed to initialize");
|
|
72
|
+
errorMessage.value = nextError.message;
|
|
73
|
+
emit("error", nextError);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
onMounted(renderGoogleButton);
|
|
78
|
+
|
|
79
|
+
watch(
|
|
80
|
+
() => [identity.enabled.value, props.options, props.oneTap] as const,
|
|
81
|
+
() => {
|
|
82
|
+
nextTick(renderGoogleButton);
|
|
83
|
+
},
|
|
84
|
+
);
|
|
85
|
+
</script>
|
|
86
|
+
|
|
87
|
+
<template>
|
|
88
|
+
<div class="google-sign-in">
|
|
89
|
+
<div v-if="identity.enabled" ref="buttonRef" class="google-sign-in__button" />
|
|
90
|
+
<BaseButton
|
|
91
|
+
v-else
|
|
92
|
+
color="neutral"
|
|
93
|
+
variant="outline"
|
|
94
|
+
leading-icon="i-lucide-lock"
|
|
95
|
+
:label="disabledLabel"
|
|
96
|
+
disabled
|
|
97
|
+
/>
|
|
98
|
+
<BaseText v-if="loading" as="p" size="sm" tone="muted">Completing sign-in...</BaseText>
|
|
99
|
+
<BaseText v-if="errorMessage" as="p" size="sm" tone="danger">{{ errorMessage }}</BaseText>
|
|
100
|
+
</div>
|
|
101
|
+
</template>
|
|
102
|
+
|
|
103
|
+
<style scoped>
|
|
104
|
+
.google-sign-in {
|
|
105
|
+
display: grid;
|
|
106
|
+
gap: 8px;
|
|
107
|
+
justify-items: start;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.google-sign-in__button {
|
|
111
|
+
min-height: 40px;
|
|
112
|
+
}
|
|
113
|
+
</style>
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const props = withDefaults(
|
|
3
|
+
defineProps<{
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
loading?: boolean;
|
|
6
|
+
hasMore?: boolean;
|
|
7
|
+
rootMargin?: string;
|
|
8
|
+
threshold?: number;
|
|
9
|
+
}>(),
|
|
10
|
+
{
|
|
11
|
+
disabled: false,
|
|
12
|
+
loading: false,
|
|
13
|
+
hasMore: true,
|
|
14
|
+
rootMargin: "320px 0px",
|
|
15
|
+
threshold: 0,
|
|
16
|
+
},
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const emit = defineEmits<{
|
|
20
|
+
"load-more": [];
|
|
21
|
+
intersect: [entry: IntersectionObserverEntry];
|
|
22
|
+
}>();
|
|
23
|
+
|
|
24
|
+
const sentinelRef = ref<HTMLElement | null>(null);
|
|
25
|
+
const lastIntersecting = ref(false);
|
|
26
|
+
const requestInFlight = ref(false);
|
|
27
|
+
let observer: IntersectionObserver | null = null;
|
|
28
|
+
|
|
29
|
+
function canRequest(): boolean {
|
|
30
|
+
return !props.disabled && !props.loading && props.hasMore && !requestInFlight.value;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function requestMore(): void {
|
|
34
|
+
if (!lastIntersecting.value || !canRequest()) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
requestInFlight.value = true;
|
|
38
|
+
emit("load-more");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function connectObserver(): void {
|
|
42
|
+
if (!import.meta.client || !sentinelRef.value) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
observer?.disconnect();
|
|
47
|
+
observer = new IntersectionObserver(
|
|
48
|
+
([entry]) => {
|
|
49
|
+
if (!entry) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
lastIntersecting.value = entry.isIntersecting;
|
|
53
|
+
emit("intersect", entry);
|
|
54
|
+
requestMore();
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
root: null,
|
|
58
|
+
rootMargin: props.rootMargin,
|
|
59
|
+
threshold: props.threshold,
|
|
60
|
+
},
|
|
61
|
+
);
|
|
62
|
+
observer.observe(sentinelRef.value);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
onMounted(connectObserver);
|
|
66
|
+
onBeforeUnmount(() => observer?.disconnect());
|
|
67
|
+
|
|
68
|
+
watch(
|
|
69
|
+
() => props.loading,
|
|
70
|
+
(loading, previousLoading) => {
|
|
71
|
+
if (previousLoading && !loading) {
|
|
72
|
+
requestInFlight.value = false;
|
|
73
|
+
nextTick(requestMore);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
watch(
|
|
79
|
+
() => [props.disabled, props.hasMore, props.rootMargin, props.threshold] as const,
|
|
80
|
+
() => {
|
|
81
|
+
requestInFlight.value = false;
|
|
82
|
+
nextTick(() => {
|
|
83
|
+
connectObserver();
|
|
84
|
+
requestMore();
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
);
|
|
88
|
+
</script>
|
|
89
|
+
|
|
90
|
+
<template>
|
|
91
|
+
<div class="infinite-scroll">
|
|
92
|
+
<slot />
|
|
93
|
+
<div ref="sentinelRef" class="infinite-scroll__sentinel" aria-hidden="true" />
|
|
94
|
+
<div v-if="loading" class="infinite-scroll__state">
|
|
95
|
+
<slot name="loading">
|
|
96
|
+
<BaseText as="p" size="sm" tone="muted">Loading more...</BaseText>
|
|
97
|
+
</slot>
|
|
98
|
+
</div>
|
|
99
|
+
<div v-else-if="!hasMore" class="infinite-scroll__state">
|
|
100
|
+
<slot name="complete">
|
|
101
|
+
<BaseText as="p" size="sm" tone="muted">All items loaded.</BaseText>
|
|
102
|
+
</slot>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
</template>
|
|
106
|
+
|
|
107
|
+
<style scoped>
|
|
108
|
+
.infinite-scroll {
|
|
109
|
+
display: grid;
|
|
110
|
+
gap: 12px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.infinite-scroll__sentinel {
|
|
114
|
+
width: 100%;
|
|
115
|
+
height: 1px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.infinite-scroll__state {
|
|
119
|
+
display: grid;
|
|
120
|
+
min-height: 32px;
|
|
121
|
+
place-items: center;
|
|
122
|
+
}
|
|
123
|
+
</style>
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const props = withDefaults(
|
|
3
|
+
defineProps<{
|
|
4
|
+
source: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
aspectRatio?: string;
|
|
7
|
+
privacyEnhanced?: boolean;
|
|
8
|
+
controls?: boolean;
|
|
9
|
+
autoplay?: boolean;
|
|
10
|
+
start?: number;
|
|
11
|
+
playlist?: string;
|
|
12
|
+
}>(),
|
|
13
|
+
{
|
|
14
|
+
title: "Embedded video",
|
|
15
|
+
aspectRatio: "16 / 9",
|
|
16
|
+
privacyEnhanced: undefined,
|
|
17
|
+
controls: true,
|
|
18
|
+
autoplay: false,
|
|
19
|
+
start: undefined,
|
|
20
|
+
playlist: "",
|
|
21
|
+
},
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const config = useRuntimeConfig();
|
|
25
|
+
|
|
26
|
+
function extractYoutubeId(source: string): string {
|
|
27
|
+
if (/^[a-zA-Z0-9_-]{11}$/.test(source)) {
|
|
28
|
+
return source;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
const url = new URL(source, "https://www.youtube.com");
|
|
33
|
+
if (url.hostname === "youtu.be") {
|
|
34
|
+
return url.pathname.replace("/", "").slice(0, 11);
|
|
35
|
+
}
|
|
36
|
+
if (url.pathname.startsWith("/embed/") || url.pathname.startsWith("/shorts/")) {
|
|
37
|
+
return url.pathname.split("/")[2]?.slice(0, 11) || "";
|
|
38
|
+
}
|
|
39
|
+
return url.searchParams.get("v")?.slice(0, 11) || "";
|
|
40
|
+
} catch {
|
|
41
|
+
return "";
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const videoId = computed(() => extractYoutubeId(props.source));
|
|
46
|
+
const usePrivacyHost = computed(() => {
|
|
47
|
+
if (typeof props.privacyEnhanced === "boolean") {
|
|
48
|
+
return props.privacyEnhanced;
|
|
49
|
+
}
|
|
50
|
+
return config.public.media?.youtube?.privacyEnhanced !== false;
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const embedSrc = computed(() => {
|
|
54
|
+
if (!videoId.value) {
|
|
55
|
+
return "";
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const host = usePrivacyHost.value ? "www.youtube-nocookie.com" : "www.youtube.com";
|
|
59
|
+
const url = new URL(`https://${host}/embed/${videoId.value}`);
|
|
60
|
+
url.searchParams.set("playsinline", "1");
|
|
61
|
+
url.searchParams.set("rel", "0");
|
|
62
|
+
url.searchParams.set("controls", props.controls ? "1" : "0");
|
|
63
|
+
|
|
64
|
+
if (props.autoplay) {
|
|
65
|
+
url.searchParams.set("autoplay", "1");
|
|
66
|
+
url.searchParams.set("mute", "1");
|
|
67
|
+
}
|
|
68
|
+
if (Number.isInteger(props.start) && Number(props.start) > 0) {
|
|
69
|
+
url.searchParams.set("start", String(props.start));
|
|
70
|
+
}
|
|
71
|
+
if (props.playlist) {
|
|
72
|
+
url.searchParams.set("playlist", props.playlist);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return url.toString();
|
|
76
|
+
});
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<template>
|
|
80
|
+
<figure class="youtube-embed" :style="{ '--youtube-embed-ratio': aspectRatio }">
|
|
81
|
+
<iframe
|
|
82
|
+
v-if="embedSrc"
|
|
83
|
+
class="youtube-embed__frame"
|
|
84
|
+
:src="embedSrc"
|
|
85
|
+
:title="title"
|
|
86
|
+
loading="lazy"
|
|
87
|
+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
|
88
|
+
referrerpolicy="strict-origin-when-cross-origin"
|
|
89
|
+
allowfullscreen
|
|
90
|
+
/>
|
|
91
|
+
<div v-else class="youtube-embed__fallback">
|
|
92
|
+
<BaseText tone="danger" size="sm">Invalid YouTube source.</BaseText>
|
|
93
|
+
</div>
|
|
94
|
+
</figure>
|
|
95
|
+
</template>
|
|
96
|
+
|
|
97
|
+
<style scoped>
|
|
98
|
+
.youtube-embed {
|
|
99
|
+
width: 100%;
|
|
100
|
+
min-width: 200px;
|
|
101
|
+
margin: 0;
|
|
102
|
+
overflow: hidden;
|
|
103
|
+
border: 1px solid var(--site-color-border);
|
|
104
|
+
border-radius: 12px;
|
|
105
|
+
background: var(--site-color-surface-muted);
|
|
106
|
+
aspect-ratio: var(--youtube-embed-ratio);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.youtube-embed__frame,
|
|
110
|
+
.youtube-embed__fallback {
|
|
111
|
+
width: 100%;
|
|
112
|
+
height: 100%;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.youtube-embed__frame {
|
|
116
|
+
display: block;
|
|
117
|
+
border: 0;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.youtube-embed__fallback {
|
|
121
|
+
display: grid;
|
|
122
|
+
min-height: 200px;
|
|
123
|
+
place-items: center;
|
|
124
|
+
padding: 16px;
|
|
125
|
+
}
|
|
126
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface AnalyticsEvent {
|
|
2
|
+
name: string;
|
|
3
|
+
properties?: Record<string, unknown>;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export function useAnalytics() {
|
|
7
|
+
function track(event: AnalyticsEvent | string, properties?: Record<string, unknown>): void {
|
|
8
|
+
if (!import.meta.client) return;
|
|
9
|
+
const detail = typeof event === "string" ? { name: event, properties } : event;
|
|
10
|
+
window.dispatchEvent(new CustomEvent("site:analytics", { detail }));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function pageView(path: string, title?: string): void {
|
|
14
|
+
track({
|
|
15
|
+
name: "page_view",
|
|
16
|
+
properties: {
|
|
17
|
+
page_path: path,
|
|
18
|
+
page_title: title,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return { track, pageView };
|
|
24
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
export type CheckoutStatusValue = "idle" | "pending" | "succeeded" | "cancelled" | "failed";
|
|
2
|
+
|
|
3
|
+
export interface CheckoutLineItem {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
quantity: number;
|
|
7
|
+
amountMinor: number;
|
|
8
|
+
currency: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface CheckoutUrlInput {
|
|
13
|
+
checkoutUrl?: string;
|
|
14
|
+
attemptId: string;
|
|
15
|
+
lineItems: CheckoutLineItem[];
|
|
16
|
+
locale?: string;
|
|
17
|
+
successUrl?: string;
|
|
18
|
+
cancelUrl?: string;
|
|
19
|
+
customer?: {
|
|
20
|
+
id?: string;
|
|
21
|
+
email?: string;
|
|
22
|
+
};
|
|
23
|
+
metadata?: Record<string, string | number | boolean>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function assertMinorAmount(value: number): void {
|
|
27
|
+
if (!Number.isInteger(value)) {
|
|
28
|
+
throw new Error("Checkout amounts must use integer minor units");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function assertLineItem(item: CheckoutLineItem): void {
|
|
33
|
+
if (!item.id) {
|
|
34
|
+
throw new Error("Checkout line item id is required");
|
|
35
|
+
}
|
|
36
|
+
if (!item.label) {
|
|
37
|
+
throw new Error("Checkout line item label is required");
|
|
38
|
+
}
|
|
39
|
+
if (!Number.isInteger(item.quantity) || item.quantity <= 0) {
|
|
40
|
+
throw new Error("Checkout line item quantity must be a positive integer");
|
|
41
|
+
}
|
|
42
|
+
if (!item.currency) {
|
|
43
|
+
throw new Error("Checkout line item currency is required");
|
|
44
|
+
}
|
|
45
|
+
assertMinorAmount(item.amountMinor);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function useCheckout() {
|
|
49
|
+
const config = useRuntimeConfig();
|
|
50
|
+
|
|
51
|
+
function formatMoney(amountMinor: number, currency: string, locale = "en"): string {
|
|
52
|
+
assertMinorAmount(amountMinor);
|
|
53
|
+
return new Intl.NumberFormat(locale, {
|
|
54
|
+
style: "currency",
|
|
55
|
+
currency,
|
|
56
|
+
}).format(amountMinor / 100);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function getTotalAmountMinor(items: CheckoutLineItem[]): number {
|
|
60
|
+
return items.reduce((total, item) => {
|
|
61
|
+
assertLineItem(item);
|
|
62
|
+
return total + item.amountMinor * item.quantity;
|
|
63
|
+
}, 0);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function buildCheckoutUrl(input: CheckoutUrlInput): string {
|
|
67
|
+
const base = input.checkoutUrl || config.public.checkout?.url;
|
|
68
|
+
if (!base) {
|
|
69
|
+
throw new Error("Checkout URL is not configured");
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (!input.attemptId) {
|
|
73
|
+
throw new Error("Checkout attemptId is required");
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
input.lineItems.forEach(assertLineItem);
|
|
77
|
+
|
|
78
|
+
const url = new URL(base, import.meta.client ? window.location.origin : "http://localhost");
|
|
79
|
+
url.searchParams.set("attempt_id", input.attemptId);
|
|
80
|
+
url.searchParams.set("line_items", JSON.stringify(input.lineItems));
|
|
81
|
+
|
|
82
|
+
if (input.locale) url.searchParams.set("locale", input.locale);
|
|
83
|
+
if (input.successUrl) url.searchParams.set("success_url", input.successUrl);
|
|
84
|
+
if (input.cancelUrl) url.searchParams.set("cancel_url", input.cancelUrl);
|
|
85
|
+
if (input.customer?.id) url.searchParams.set("customer_id", input.customer.id);
|
|
86
|
+
if (input.customer?.email) url.searchParams.set("customer_email", input.customer.email);
|
|
87
|
+
if (input.metadata) url.searchParams.set("metadata", JSON.stringify(input.metadata));
|
|
88
|
+
|
|
89
|
+
return url.toString();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function openCheckout(input: CheckoutUrlInput, target = "_blank"): void {
|
|
93
|
+
if (!import.meta.client) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
window.open(buildCheckoutUrl(input), target, "noopener,noreferrer");
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function parseCheckoutStatus(
|
|
100
|
+
search = import.meta.client ? window.location.search : "",
|
|
101
|
+
): CheckoutStatusValue {
|
|
102
|
+
const params = new URLSearchParams(search);
|
|
103
|
+
const resultParam = config.public.checkout?.resultParam || "checkout_status";
|
|
104
|
+
const raw = params.get(resultParam) || params.get("payment_status") || params.get("payment");
|
|
105
|
+
|
|
106
|
+
if (raw === "success" || raw === "succeeded" || raw === "paid") return "succeeded";
|
|
107
|
+
if (raw === "cancel" || raw === "cancelled" || raw === "canceled") return "cancelled";
|
|
108
|
+
if (raw === "failed" || raw === "error") return "failed";
|
|
109
|
+
if (raw === "pending" || raw === "processing") return "pending";
|
|
110
|
+
return "idle";
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return {
|
|
114
|
+
checkoutUrl: computed(() => config.public.checkout?.url || ""),
|
|
115
|
+
formatMoney,
|
|
116
|
+
getTotalAmountMinor,
|
|
117
|
+
buildCheckoutUrl,
|
|
118
|
+
openCheckout,
|
|
119
|
+
parseCheckoutStatus,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type ConsentValue = "accepted" | "rejected";
|
|
2
|
+
|
|
3
|
+
export function useConsent(storageKey?: string) {
|
|
4
|
+
const site = useSiteShell();
|
|
5
|
+
const resolvedStorageKey = computed(() => storageKey ?? site.value.consent.storageKey);
|
|
6
|
+
const value = ref<ConsentValue | null>(null);
|
|
7
|
+
const ready = ref(false);
|
|
8
|
+
|
|
9
|
+
onMounted(() => {
|
|
10
|
+
const stored = window.localStorage.getItem(resolvedStorageKey.value);
|
|
11
|
+
value.value = stored === "accepted" || stored === "rejected" ? stored : null;
|
|
12
|
+
ready.value = true;
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const visible = computed(() => site.value.consent.enabled && ready.value && value.value === null);
|
|
16
|
+
|
|
17
|
+
function setConsent(next: ConsentValue): void {
|
|
18
|
+
value.value = next;
|
|
19
|
+
if (import.meta.client) {
|
|
20
|
+
window.localStorage.setItem(resolvedStorageKey.value, next);
|
|
21
|
+
window.dispatchEvent(new CustomEvent("site:consent", { detail: { value: next } }));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
value: readonly(value),
|
|
27
|
+
visible,
|
|
28
|
+
accept: () => setConsent("accepted"),
|
|
29
|
+
reject: () => setConsent("rejected"),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
export interface GoogleCredentialResponse {
|
|
2
|
+
credential?: string;
|
|
3
|
+
select_by?: string;
|
|
4
|
+
clientId?: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface GoogleButtonOptions {
|
|
8
|
+
type?: "standard" | "icon";
|
|
9
|
+
theme?: "outline" | "filled_blue" | "filled_black";
|
|
10
|
+
size?: "large" | "medium" | "small";
|
|
11
|
+
text?: "signin_with" | "signup_with" | "continue_with" | "signin";
|
|
12
|
+
shape?: "rectangular" | "pill" | "circle" | "square";
|
|
13
|
+
logo_alignment?: "left" | "center";
|
|
14
|
+
width?: string | number;
|
|
15
|
+
locale?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface GoogleIdentityApi {
|
|
19
|
+
accounts: {
|
|
20
|
+
id: {
|
|
21
|
+
initialize: (options: {
|
|
22
|
+
client_id: string;
|
|
23
|
+
callback: (response: GoogleCredentialResponse) => void;
|
|
24
|
+
use_fedcm_for_prompt?: boolean;
|
|
25
|
+
cancel_on_tap_outside?: boolean;
|
|
26
|
+
}) => void;
|
|
27
|
+
prompt: () => void;
|
|
28
|
+
renderButton: (element: HTMLElement, options: GoogleButtonOptions) => void;
|
|
29
|
+
cancel: () => void;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
type GoogleIdentityWindow = Window &
|
|
35
|
+
typeof globalThis & {
|
|
36
|
+
google?: GoogleIdentityApi;
|
|
37
|
+
__siteGoogleIdentityScript?: Promise<void>;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
function getGoogleWindow(): GoogleIdentityWindow {
|
|
41
|
+
return window as GoogleIdentityWindow;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function loadGoogleIdentityScript(): Promise<void> {
|
|
45
|
+
if (!import.meta.client) {
|
|
46
|
+
return Promise.resolve();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const googleWindow = getGoogleWindow();
|
|
50
|
+
|
|
51
|
+
if (googleWindow.google?.accounts?.id) {
|
|
52
|
+
return Promise.resolve();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (googleWindow.__siteGoogleIdentityScript) {
|
|
56
|
+
return googleWindow.__siteGoogleIdentityScript;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
googleWindow.__siteGoogleIdentityScript = new Promise<void>((resolve, reject) => {
|
|
60
|
+
const existing = document.querySelector<HTMLScriptElement>(
|
|
61
|
+
'script[src="https://accounts.google.com/gsi/client"]',
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
if (existing) {
|
|
65
|
+
existing.addEventListener("load", () => resolve(), { once: true });
|
|
66
|
+
existing.addEventListener(
|
|
67
|
+
"error",
|
|
68
|
+
() => reject(new Error("Google Identity failed to load")),
|
|
69
|
+
{
|
|
70
|
+
once: true,
|
|
71
|
+
},
|
|
72
|
+
);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const script = document.createElement("script");
|
|
77
|
+
script.src = "https://accounts.google.com/gsi/client";
|
|
78
|
+
script.async = true;
|
|
79
|
+
script.defer = true;
|
|
80
|
+
script.addEventListener("load", () => resolve(), { once: true });
|
|
81
|
+
script.addEventListener("error", () => reject(new Error("Google Identity failed to load")), {
|
|
82
|
+
once: true,
|
|
83
|
+
});
|
|
84
|
+
document.head.appendChild(script);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
return googleWindow.__siteGoogleIdentityScript;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function useGoogleIdentity() {
|
|
91
|
+
const config = useRuntimeConfig();
|
|
92
|
+
const googleConfig = computed(() => config.public.identity?.google);
|
|
93
|
+
const enabled = computed(() =>
|
|
94
|
+
Boolean(googleConfig.value?.enabled && googleConfig.value.clientId),
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
async function initialize(callback: (response: GoogleCredentialResponse) => void) {
|
|
98
|
+
const clientId = googleConfig.value?.clientId;
|
|
99
|
+
|
|
100
|
+
if (!enabled.value || !clientId) {
|
|
101
|
+
throw new Error("Google Identity is not configured");
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
await loadGoogleIdentityScript();
|
|
105
|
+
|
|
106
|
+
const googleWindow = getGoogleWindow();
|
|
107
|
+
|
|
108
|
+
if (!googleWindow.google?.accounts?.id) {
|
|
109
|
+
throw new Error("Google Identity is unavailable");
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
googleWindow.google.accounts.id.initialize({
|
|
113
|
+
client_id: clientId,
|
|
114
|
+
callback,
|
|
115
|
+
use_fedcm_for_prompt: false,
|
|
116
|
+
cancel_on_tap_outside: true,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
async function renderButton(
|
|
121
|
+
element: HTMLElement,
|
|
122
|
+
callback: (response: GoogleCredentialResponse) => void,
|
|
123
|
+
options: GoogleButtonOptions = {},
|
|
124
|
+
) {
|
|
125
|
+
await initialize(callback);
|
|
126
|
+
getGoogleWindow().google?.accounts.id.renderButton(element, options);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
async function promptOneTap(callback: (response: GoogleCredentialResponse) => void) {
|
|
130
|
+
await initialize(callback);
|
|
131
|
+
getGoogleWindow().google?.accounts.id.prompt();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function cancel() {
|
|
135
|
+
getGoogleWindow().google?.accounts.id.cancel();
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
async function exchangeCredential<T = unknown>(
|
|
139
|
+
credential: string,
|
|
140
|
+
endpoint = googleConfig.value?.credentialEndpoint,
|
|
141
|
+
): Promise<T> {
|
|
142
|
+
if (!endpoint) {
|
|
143
|
+
throw new Error("Google credential endpoint is not configured");
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const response = await $fetch(endpoint, {
|
|
147
|
+
method: "POST",
|
|
148
|
+
body: { credential },
|
|
149
|
+
});
|
|
150
|
+
return response as T;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return {
|
|
154
|
+
enabled,
|
|
155
|
+
clientId: computed(() => googleConfig.value?.clientId || ""),
|
|
156
|
+
oneTapEnabled: computed(() => Boolean(googleConfig.value?.oneTap)),
|
|
157
|
+
initialize,
|
|
158
|
+
renderButton,
|
|
159
|
+
promptOneTap,
|
|
160
|
+
cancel,
|
|
161
|
+
exchangeCredential,
|
|
162
|
+
};
|
|
163
|
+
}
|