@sigmaott/base-next 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/hyrd-ui.preset.ts +463 -0
- package/i18n.config.ts +3 -0
- package/locales/en.yaml +719 -0
- package/locales/vi.yaml +726 -0
- package/nuxt-config.ts +23 -0
- package/nuxt.config.ts +267 -0
- package/package.json +119 -0
- package/public/routes.json +34 -0
- package/src/MediaInfoModule.wasm +0 -0
- package/src/api/api.ts +15 -0
- package/src/api/axios.ts +125 -0
- package/src/api/service-loading.ts +50 -0
- package/src/api-client-auth/.openapi-generator/FILES +83 -0
- package/src/api-client-auth/.openapi-generator/VERSION +1 -0
- package/src/api-client-auth/.openapi-generator-ignore +23 -0
- package/src/api-client-auth/api/admin-groups-api.ts +612 -0
- package/src/api-client-auth/api/admin-members-api.ts +708 -0
- package/src/api-client-auth/api/administration-api-groups-api.ts +547 -0
- package/src/api-client-auth/api/administration-apps-api.ts +709 -0
- package/src/api-client-auth/api/administration-packages-api.ts +547 -0
- package/src/api-client-auth/api/api-groups-api.ts +296 -0
- package/src/api-client-auth/api/apps-api.ts +1613 -0
- package/src/api-client-auth/api/basic-credential-api.ts +950 -0
- package/src/api-client-auth/api/groups-api.ts +702 -0
- package/src/api-client-auth/api/members-api.ts +708 -0
- package/src/api-client-auth/api/members-on-premise-api.ts +351 -0
- package/src/api-client-auth/api/packages-api.ts +296 -0
- package/src/api-client-auth/api/users-api.ts +1387 -0
- package/src/api-client-auth/api.ts +30 -0
- package/src/api-client-auth/base.ts +72 -0
- package/src/api-client-auth/common.ts +150 -0
- package/src/api-client-auth/configuration.ts +101 -0
- package/src/api-client-auth/git_push.sh +57 -0
- package/src/api-client-auth/index.ts +18 -0
- package/src/api-client-auth/models/add-member-dto.ts +42 -0
- package/src/api-client-auth/models/admin-permission.ts +44 -0
- package/src/api-client-auth/models/api-group-collection.ts +57 -0
- package/src/api-client-auth/models/api-group.ts +80 -0
- package/src/api-client-auth/models/api.ts +44 -0
- package/src/api-client-auth/models/app-collection.ts +57 -0
- package/src/api-client-auth/models/app.ts +147 -0
- package/src/api-client-auth/models/backdoor-cred.ts +39 -0
- package/src/api-client-auth/models/basic-cred-collection.ts +57 -0
- package/src/api-client-auth/models/basic-cred.ts +83 -0
- package/src/api-client-auth/models/change-password-dto.ts +42 -0
- package/src/api-client-auth/models/create-admin-group-dto.ts +39 -0
- package/src/api-client-auth/models/create-api-group-dto.ts +42 -0
- package/src/api-client-auth/models/create-app-by-user-dto.ts +36 -0
- package/src/api-client-auth/models/create-app-dto.ts +65 -0
- package/src/api-client-auth/models/create-basic-cred-dto.ts +39 -0
- package/src/api-client-auth/models/create-group-dto.ts +39 -0
- package/src/api-client-auth/models/create-package-dto.ts +48 -0
- package/src/api-client-auth/models/create-user-dto.ts +60 -0
- package/src/api-client-auth/models/free-trial.ts +54 -0
- package/src/api-client-auth/models/general-app.ts +48 -0
- package/src/api-client-auth/models/generate-app-id.ts +30 -0
- package/src/api-client-auth/models/group-collection.ts +57 -0
- package/src/api-client-auth/models/group.ts +75 -0
- package/src/api-client-auth/models/index.ts +60 -0
- package/src/api-client-auth/models/invite-email-dto.ts +30 -0
- package/src/api-client-auth/models/invite-member-dto.ts +36 -0
- package/src/api-client-auth/models/live-stream-quota.ts +42 -0
- package/src/api-client-auth/models/login-dto.ts +36 -0
- package/src/api-client-auth/models/login-result.ts +39 -0
- package/src/api-client-auth/models/member-collection.ts +57 -0
- package/src/api-client-auth/models/member.ts +92 -0
- package/src/api-client-auth/models/package-collection.ts +57 -0
- package/src/api-client-auth/models/package-permission.ts +44 -0
- package/src/api-client-auth/models/package.ts +66 -0
- package/src/api-client-auth/models/permission.ts +44 -0
- package/src/api-client-auth/models/quota.ts +45 -0
- package/src/api-client-auth/models/re-get-password-dto.ts +30 -0
- package/src/api-client-auth/models/register-dto.ts +54 -0
- package/src/api-client-auth/models/register-through-email-dto.ts +36 -0
- package/src/api-client-auth/models/rename-app-dto.ts +30 -0
- package/src/api-client-auth/models/resend-confirmation-dto.ts +30 -0
- package/src/api-client-auth/models/resend-invitation-dto.ts +30 -0
- package/src/api-client-auth/models/resend-result.ts +36 -0
- package/src/api-client-auth/models/reset-password-dto.ts +36 -0
- package/src/api-client-auth/models/revoke-basic-dto.ts +38 -0
- package/src/api-client-auth/models/signup-result.ts +45 -0
- package/src/api-client-auth/models/token-check-result.ts +36 -0
- package/src/api-client-auth/models/trial-remaining-days.ts +42 -0
- package/src/api-client-auth/models/update-admin-group-dto.ts +39 -0
- package/src/api-client-auth/models/update-api-group-dto.ts +30 -0
- package/src/api-client-auth/models/update-app-by-admin-dto.ts +48 -0
- package/src/api-client-auth/models/update-app-by-user-dto.ts +36 -0
- package/src/api-client-auth/models/update-basic-cred-dto.ts +30 -0
- package/src/api-client-auth/models/update-group-dto.ts +39 -0
- package/src/api-client-auth/models/update-member-dto.ts +30 -0
- package/src/api-client-auth/models/update-package-dto.ts +42 -0
- package/src/api-client-auth/models/update-password-member-dto.ts +30 -0
- package/src/api-client-auth/models/update-user-by-user-dto.ts +48 -0
- package/src/api-client-auth/models/user.ts +120 -0
- package/src/api-client-auth/models/validate-app-id.ts +36 -0
- package/src/api-client-billing/.openapi-generator/FILES +38 -0
- package/src/api-client-billing/.openapi-generator/VERSION +1 -0
- package/src/api-client-billing/.openapi-generator-ignore +23 -0
- package/src/api-client-billing/api/invoice-api.ts +363 -0
- package/src/api-client-billing/api/payment-methods-api.ts +414 -0
- package/src/api-client-billing/api/payment-plan-api.ts +121 -0
- package/src/api-client-billing/api/subscriptions-api.ts +121 -0
- package/src/api-client-billing/api/usages-api.ts +121 -0
- package/src/api-client-billing/api/vnpay-provider-api.ts +327 -0
- package/src/api-client-billing/api.ts +23 -0
- package/src/api-client-billing/base.ts +72 -0
- package/src/api-client-billing/common.ts +150 -0
- package/src/api-client-billing/configuration.ts +101 -0
- package/src/api-client-billing/git_push.sh +57 -0
- package/src/api-client-billing/index.ts +18 -0
- package/src/api-client-billing/models/common-paginate-response.ts +48 -0
- package/src/api-client-billing/models/dto-billing-item-info.ts +60 -0
- package/src/api-client-billing/models/dto-billing-item.ts +36 -0
- package/src/api-client-billing/models/dto-create-draft-invoice-request.ts +33 -0
- package/src/api-client-billing/models/dto-create-draft-invoice-response.ts +57 -0
- package/src/api-client-billing/models/dto-create-vnpay-card-form.ts +48 -0
- package/src/api-client-billing/models/dto-return-uri-response.ts +30 -0
- package/src/api-client-billing/models/index.ts +22 -0
- package/src/api-client-billing/models/invoices-get200-response.ts +42 -0
- package/src/api-client-billing/models/model-charge.ts +47 -0
- package/src/api-client-billing/models/model-charges-usage.ts +57 -0
- package/src/api-client-billing/models/model-graduated-range.ts +48 -0
- package/src/api-client-billing/models/model-info.ts +42 -0
- package/src/api-client-billing/models/model-invoice.ts +105 -0
- package/src/api-client-billing/models/model-item-usage.ts +54 -0
- package/src/api-client-billing/models/model-payment-method.ts +135 -0
- package/src/api-client-billing/models/model-product.ts +51 -0
- package/src/api-client-billing/models/model-properties.ts +39 -0
- package/src/api-client-billing/models/model-quota.ts +48 -0
- package/src/api-client-billing/models/model-subscription.ts +51 -0
- package/src/api-client-billing/models/model-usage-payment.ts +87 -0
- package/src/api-client-billing/models/payment-methods-get200-response.ts +42 -0
- package/src/api-client-billing/models/subscriptions-get200-response.ts +42 -0
- package/src/api-client-machine/.openapi-generator/FILES +90 -0
- package/src/api-client-machine/.openapi-generator/VERSION +1 -0
- package/src/api-client-machine/.openapi-generator-ignore +23 -0
- package/src/api-client-machine/api/apps-config-api.ts +523 -0
- package/src/api-client-machine/api/component-clusters-api.ts +741 -0
- package/src/api-client-machine/api/expose-api.ts +141 -0
- package/src/api-client-machine/api/machine-actions-api.ts +850 -0
- package/src/api-client-machine/api/machines-api.ts +524 -0
- package/src/api-client-machine/api/networks-api.ts +375 -0
- package/src/api-client-machine/api/sigma-clusters-api.ts +741 -0
- package/src/api-client-machine/api/sigma-machine-actions-api.ts +292 -0
- package/src/api-client-machine/api/sigma-machine-apps-configuration-api.ts +523 -0
- package/src/api-client-machine/api/sigma-machines-api.ts +557 -0
- package/src/api-client-machine/api/sigma-vod-server-api.ts +478 -0
- package/src/api-client-machine/api/sigma-vod-server-app-config-api.ts +980 -0
- package/src/api-client-machine/api/transcoder-configuration-api.ts +359 -0
- package/src/api-client-machine/api.ts +30 -0
- package/src/api-client-machine/base.ts +72 -0
- package/src/api-client-machine/common.ts +150 -0
- package/src/api-client-machine/configuration.ts +101 -0
- package/src/api-client-machine/git_push.sh +57 -0
- package/src/api-client-machine/index.ts +18 -0
- package/src/api-client-machine/models/actions-to-app-dto.ts +38 -0
- package/src/api-client-machine/models/add-license-machine-dto.ts +30 -0
- package/src/api-client-machine/models/app-status.ts +47 -0
- package/src/api-client-machine/models/check-quota-limit-result.ts +36 -0
- package/src/api-client-machine/models/cluster-log.ts +54 -0
- package/src/api-client-machine/models/component-cluster-collection.ts +57 -0
- package/src/api-client-machine/models/component-cluster.ts +116 -0
- package/src/api-client-machine/models/create-component-machine-cluster-dto.ts +86 -0
- package/src/api-client-machine/models/create-sigma-machine-cluster-dto.ts +77 -0
- package/src/api-client-machine/models/create-vodroute-dto.ts +42 -0
- package/src/api-client-machine/models/decklink-collection.ts +57 -0
- package/src/api-client-machine/models/decklink.ts +42 -0
- package/src/api-client-machine/models/http-app.ts +45 -0
- package/src/api-client-machine/models/https-config.ts +42 -0
- package/src/api-client-machine/models/index.ts +67 -0
- package/src/api-client-machine/models/info-channel.ts +42 -0
- package/src/api-client-machine/models/ingest-app.ts +60 -0
- package/src/api-client-machine/models/ingest-config.ts +74 -0
- package/src/api-client-machine/models/ingest-update-config-dto.ts +68 -0
- package/src/api-client-machine/models/machine-cluster-collection.ts +57 -0
- package/src/api-client-machine/models/machine-cluster.ts +120 -0
- package/src/api-client-machine/models/machine-details-license.ts +42 -0
- package/src/api-client-machine/models/machine-details.ts +127 -0
- package/src/api-client-machine/models/machine-dto.ts +42 -0
- package/src/api-client-machine/models/machine-dump.ts +108 -0
- package/src/api-client-machine/models/machine.ts +42 -0
- package/src/api-client-machine/models/network-collection.ts +57 -0
- package/src/api-client-machine/models/network-interface.ts +36 -0
- package/src/api-client-machine/models/network.ts +66 -0
- package/src/api-client-machine/models/origin-config.ts +50 -0
- package/src/api-client-machine/models/origin-update-config-dto.ts +59 -0
- package/src/api-client-machine/models/packager-component-cluster.ts +42 -0
- package/src/api-client-machine/models/packager-live-cluster.ts +42 -0
- package/src/api-client-machine/models/packager-to-component-cluster.ts +51 -0
- package/src/api-client-machine/models/quotas-result.ts +30 -0
- package/src/api-client-machine/models/registration-config.ts +48 -0
- package/src/api-client-machine/models/sigma-cluster-ingest-config.ts +42 -0
- package/src/api-client-machine/models/sigma-cluster-origin-config.ts +30 -0
- package/src/api-client-machine/models/sigma-ingest-config-entity.ts +42 -0
- package/src/api-client-machine/models/sigma-ingest-config.ts +42 -0
- package/src/api-client-machine/models/sigma-origin-config-entity.ts +30 -0
- package/src/api-client-machine/models/sigma-origin-config.ts +30 -0
- package/src/api-client-machine/models/stats.ts +57 -0
- package/src/api-client-machine/models/status.ts +36 -0
- package/src/api-client-machine/models/stop-channel.ts +48 -0
- package/src/api-client-machine/models/transcoder-apps.ts +42 -0
- package/src/api-client-machine/models/transcoder-collection.ts +57 -0
- package/src/api-client-machine/models/transcoder-component-cluster.ts +42 -0
- package/src/api-client-machine/models/transcoder-license.ts +42 -0
- package/src/api-client-machine/models/transcoder-live-cluster.ts +42 -0
- package/src/api-client-machine/models/transcoder-live-to-component-cluster.ts +45 -0
- package/src/api-client-machine/models/transcoder-network.ts +42 -0
- package/src/api-client-machine/models/transcoder.ts +276 -0
- package/src/api-client-machine/models/update-app-config-dto-config-data.ts +33 -0
- package/src/api-client-machine/models/update-app-config-dto.ts +33 -0
- package/src/api-client-machine/models/update-app-config-of-sigma-vod-server-dto-config-data.ts +30 -0
- package/src/api-client-machine/models/update-app-config-of-sigma-vod-server-dto.ts +33 -0
- package/src/api-client-machine/models/update-component-cluster-dto.ts +72 -0
- package/src/api-client-machine/models/update-machine-cluster-dto.ts +63 -0
- package/src/api-client-machine/models/update-machine-dto.ts +42 -0
- package/src/api-client-machine/models/update-packager-live-cluster.ts +42 -0
- package/src/api-client-machine/models/update-packager-to-component-cluster.ts +51 -0
- package/src/api-client-machine/models/update-route-config-of-sigma-vod-server.ts +33 -0
- package/src/api-client-machine/models/update-route-config-sigma-machine.ts +42 -0
- package/src/api-client-machine/models/update-transcoder-live-cluster.ts +42 -0
- package/src/api-client-machine/models/update-transcoder-to-component-cluster.ts +45 -0
- package/src/api-client-machine/models/video-encoder.ts +56 -0
- package/src/api-client-machine/models/vodroute.ts +60 -0
- package/src/api-client-noti/.openapi-generator/FILES +13 -0
- package/src/api-client-noti/.openapi-generator/VERSION +1 -0
- package/src/api-client-noti/.openapi-generator-ignore +23 -0
- package/src/api-client-noti/api/notification-api.ts +386 -0
- package/src/api-client-noti/api.ts +18 -0
- package/src/api-client-noti/base.ts +72 -0
- package/src/api-client-noti/common.ts +150 -0
- package/src/api-client-noti/configuration.ts +101 -0
- package/src/api-client-noti/git_push.sh +57 -0
- package/src/api-client-noti/index.ts +18 -0
- package/src/api-client-noti/models/index.ts +2 -0
- package/src/api-client-noti/models/notification-collection.ts +57 -0
- package/src/api-client-noti/models/notification.ts +101 -0
- package/src/api-client-transcode/.openapi-generator/FILES +129 -0
- package/src/api-client-transcode/.openapi-generator/VERSION +1 -0
- package/src/api-client-transcode/.openapi-generator-ignore +23 -0
- package/src/api-client-transcode/api/alert-logs-apiapi.ts +281 -0
- package/src/api-client-transcode/api/channel-package-inputs-apiapi.ts +650 -0
- package/src/api-client-transcode/api/channel-transcode-inputs-apiapi.ts +650 -0
- package/src/api-client-transcode/api/channels-crudapiapi.ts +869 -0
- package/src/api-client-transcode/api/channels-job-action-apiapi.ts +434 -0
- package/src/api-client-transcode/api/drm-credentials-api.ts +525 -0
- package/src/api-client-transcode/api/event-channel-action-apiapi.ts +363 -0
- package/src/api-client-transcode/api/event-channel-crudapiapi.ts +545 -0
- package/src/api-client-transcode/api/fast-channel-action-apiapi.ts +301 -0
- package/src/api-client-transcode/api/fast-channel-apiapi.ts +525 -0
- package/src/api-client-transcode/api/fast-channel-programs-api-api.ts +525 -0
- package/src/api-client-transcode/api/multi-channel-action-apiapi.ts +387 -0
- package/src/api-client-transcode/api/sigma-transcode-live-interactive-action-api.ts +152 -0
- package/src/api-client-transcode/api/single-channel-action-apiapi.ts +1155 -0
- package/src/api-client-transcode/api/transcode-templates-apiapi.ts +541 -0
- package/src/api-client-transcode/api.ts +32 -0
- package/src/api-client-transcode/base.ts +71 -0
- package/src/api-client-transcode/common.ts +138 -0
- package/src/api-client-transcode/configuration.ts +101 -0
- package/src/api-client-transcode/git_push.sh +57 -0
- package/src/api-client-transcode/index.ts +18 -0
- package/src/api-client-transcode/models/ads-dto.ts +137 -0
- package/src/api-client-transcode/models/alert-log-collection.ts +55 -0
- package/src/api-client-transcode/models/audio-watermark-dto.ts +59 -0
- package/src/api-client-transcode/models/blackout-slate-dto.ts +36 -0
- package/src/api-client-transcode/models/catchup-dto.ts +43 -0
- package/src/api-client-transcode/models/channel-collection.ts +55 -0
- package/src/api-client-transcode/models/channel-config-advance-dto-info.ts +25 -0
- package/src/api-client-transcode/models/channel-config-advance-dto.ts +121 -0
- package/src/api-client-transcode/models/channel-config-advance-info-dto.ts +78 -0
- package/src/api-client-transcode/models/channel-config-base.ts +69 -0
- package/src/api-client-transcode/models/channel-config-blackout-entity.ts +36 -0
- package/src/api-client-transcode/models/channel-config-dto.ts +72 -0
- package/src/api-client-transcode/models/channel-config-interactive-entity.ts +30 -0
- package/src/api-client-transcode/models/channel-config-template-dto.ts +66 -0
- package/src/api-client-transcode/models/channel-detail-catchup-dto.ts +37 -0
- package/src/api-client-transcode/models/channel-detail-dto.ts +69 -0
- package/src/api-client-transcode/models/channel-detail-input.ts +43 -0
- package/src/api-client-transcode/models/channel-detail-package.ts +50 -0
- package/src/api-client-transcode/models/channel-detail-transcode.ts +37 -0
- package/src/api-client-transcode/models/channel-job-detail.ts +84 -0
- package/src/api-client-transcode/models/channel-stats.ts +36 -0
- package/src/api-client-transcode/models/channel-template-data-dto.ts +59 -0
- package/src/api-client-transcode/models/channel-template-dto-data.ts +28 -0
- package/src/api-client-transcode/models/channel-template-dto.ts +63 -0
- package/src/api-client-transcode/models/channel.ts +168 -0
- package/src/api-client-transcode/models/create-alert-log-dto.ts +138 -0
- package/src/api-client-transcode/models/create-channel-dto.ts +84 -0
- package/src/api-client-transcode/models/create-drm-credential-dto.ts +63 -0
- package/src/api-client-transcode/models/create-event-channel-dto-targets.ts +26 -0
- package/src/api-client-transcode/models/create-event-channel-dto.ts +76 -0
- package/src/api-client-transcode/models/create-fast-channel-dto.ts +42 -0
- package/src/api-client-transcode/models/create-fast-program-dto.ts +72 -0
- package/src/api-client-transcode/models/drm-credential-collection.ts +55 -0
- package/src/api-client-transcode/models/drm-credential-entity.ts +87 -0
- package/src/api-client-transcode/models/drm-data-dto.ts +54 -0
- package/src/api-client-transcode/models/drm-data-entity.ts +54 -0
- package/src/api-client-transcode/models/drm-dto.ts +103 -0
- package/src/api-client-transcode/models/event-channel-collection.ts +55 -0
- package/src/api-client-transcode/models/event-channel-config-dto.ts +78 -0
- package/src/api-client-transcode/models/event-channel-config-entity.ts +75 -0
- package/src/api-client-transcode/models/event-channel-input-dto.ts +45 -0
- package/src/api-client-transcode/models/event-channel-input-entity.ts +45 -0
- package/src/api-client-transcode/models/event-channel-transcoder-dto.ts +56 -0
- package/src/api-client-transcode/models/event-channel.ts +147 -0
- package/src/api-client-transcode/models/event-profile-dto.ts +62 -0
- package/src/api-client-transcode/models/event-target-data-dto.ts +95 -0
- package/src/api-client-transcode/models/event-target-dto.ts +49 -0
- package/src/api-client-transcode/models/fast-channel-collection.ts +55 -0
- package/src/api-client-transcode/models/fast-channel.ts +75 -0
- package/src/api-client-transcode/models/fast-program-collection.ts +55 -0
- package/src/api-client-transcode/models/fast-program.ts +84 -0
- package/src/api-client-transcode/models/fingerprint-dto.ts +42 -0
- package/src/api-client-transcode/models/index.ts +104 -0
- package/src/api-client-transcode/models/input-collection.ts +55 -0
- package/src/api-client-transcode/models/input-data-dto.ts +104 -0
- package/src/api-client-transcode/models/input-data-item-dto.ts +42 -0
- package/src/api-client-transcode/models/input-dto.ts +30 -0
- package/src/api-client-transcode/models/input-entity.ts +30 -0
- package/src/api-client-transcode/models/input-info-response.ts +31 -0
- package/src/api-client-transcode/models/input-info.ts +123 -0
- package/src/api-client-transcode/models/input-machine-config.ts +45 -0
- package/src/api-client-transcode/models/input-program.ts +66 -0
- package/src/api-client-transcode/models/interactive-dto.ts +30 -0
- package/src/api-client-transcode/models/interactive-publish-dto.ts +30 -0
- package/src/api-client-transcode/models/job-entity.ts +102 -0
- package/src/api-client-transcode/models/low-latency-dto.ts +68 -0
- package/src/api-client-transcode/models/machine-config-dto.ts +75 -0
- package/src/api-client-transcode/models/main-input-dto.ts +62 -0
- package/src/api-client-transcode/models/main-input-entity.ts +54 -0
- package/src/api-client-transcode/models/maintenance-dto.ts +30 -0
- package/src/api-client-transcode/models/manifest-dto.ts +62 -0
- package/src/api-client-transcode/models/package-input-collection.ts +55 -0
- package/src/api-client-transcode/models/package-input-data-dto.ts +99 -0
- package/src/api-client-transcode/models/package-input-list.ts +36 -0
- package/src/api-client-transcode/models/package-input.ts +115 -0
- package/src/api-client-transcode/models/post-input-dto.ts +48 -0
- package/src/api-client-transcode/models/post-input-entity.ts +48 -0
- package/src/api-client-transcode/models/pre-input-dto.ts +54 -0
- package/src/api-client-transcode/models/pre-input-entity.ts +54 -0
- package/src/api-client-transcode/models/preset-dto.ts +247 -0
- package/src/api-client-transcode/models/profile-default-response-dto.ts +30 -0
- package/src/api-client-transcode/models/profile-dto.ts +62 -0
- package/src/api-client-transcode/models/profile-entity.ts +60 -0
- package/src/api-client-transcode/models/scte35-dto.ts +36 -0
- package/src/api-client-transcode/models/start-over-dto.ts +30 -0
- package/src/api-client-transcode/models/switch-input-dto.ts +56 -0
- package/src/api-client-transcode/models/switch-input-entity.ts +44 -0
- package/src/api-client-transcode/models/target-data-dto.ts +101 -0
- package/src/api-client-transcode/models/target-dto.ts +44 -0
- package/src/api-client-transcode/models/target-entity.ts +55 -0
- package/src/api-client-transcode/models/target-profile-dto.ts +71 -0
- package/src/api-client-transcode/models/target-profile.ts +71 -0
- package/src/api-client-transcode/models/target-template-dto.ts +44 -0
- package/src/api-client-transcode/models/target-update-dto.ts +50 -0
- package/src/api-client-transcode/models/transcode-input.ts +144 -0
- package/src/api-client-transcode/models/transcoder.ts +36 -0
- package/src/api-client-transcode/models/trick-play-dto.ts +54 -0
- package/src/api-client-transcode/models/update-channel-dto-targets.ts +27 -0
- package/src/api-client-transcode/models/update-channel-dto.ts +84 -0
- package/src/api-client-transcode/models/update-drm-management-dto.ts +63 -0
- package/src/api-client-transcode/models/update-event-channel-dto.ts +76 -0
- package/src/api-client-transcode/models/update-fast-channel-dto.ts +42 -0
- package/src/api-client-transcode/models/update-fast-program-dto.ts +30 -0
- package/src/api-client-transcode/models/watermark-dto.ts +66 -0
- package/src/api-client-transcode/models/watermark-entity.ts +102 -0
- package/src/app/spa-loading-template.html +127 -0
- package/src/app.config.ts +2 -0
- package/src/assets/global.css.ts +3 -0
- package/src/assets/scss/element/dark.scss +13 -0
- package/src/assets/scss/element/index.scss +26 -0
- package/src/assets/scss/index.scss +181 -0
- package/src/components/AdvancedFilter/SSAdvancedFilterItem.vue +180 -0
- package/src/components/AdvancedFilter/SSAdvancedFilterItemCustom.vue +165 -0
- package/src/components/AdvancedFilter/SSAdvancedFilterItemDefined.vue +298 -0
- package/src/components/AdvancedFilter/SSAdvancedFilterItemSchedule.vue +293 -0
- package/src/components/AdvancedFilter/SSAdvancedFilterMain.vue +196 -0
- package/src/components/AdvancedFilter/types.ts +37 -0
- package/src/components/AdvancedFilterReport/SSAdvancedFilterReportItem.vue +110 -0
- package/src/components/AdvancedFilterReport/SSAdvancedFilterReportItemDefined.vue +159 -0
- package/src/components/AdvancedFilterReport/SSAdvancedFilterReportMain.vue +197 -0
- package/src/components/AdvancedFilterReport/types.ts +19 -0
- package/src/components/AdvancedFilterSsai/SSAdvancedFilterSsaiItem.vue +102 -0
- package/src/components/AdvancedFilterSsai/SSAdvancedFilterSsaiItemDefined.vue +119 -0
- package/src/components/AdvancedFilterSsai/SSAdvancedFilterSsaiMain.vue +194 -0
- package/src/components/AdvancedFilterSsai/types.ts +19 -0
- package/src/components/Asset/AssetAddPlaylist.vue +169 -0
- package/src/components/Asset/AssetExtra.vue +46 -0
- package/src/components/Asset/AssetImportLinks.vue +281 -0
- package/src/components/Asset/AssetInfiniteSelect.vue +62 -0
- package/src/components/Asset/AssetItem.vue +194 -0
- package/src/components/Asset/AssetItemPreview.vue +117 -0
- package/src/components/Asset/AssetList.vue +869 -0
- package/src/components/Asset/AssetMeta.vue +97 -0
- package/src/components/Asset/AssetPicker.vue +204 -0
- package/src/components/Asset/AssetPlaylist.vue +414 -0
- package/src/components/Asset/AssetPlaylistInfiniteSelect.vue +136 -0
- package/src/components/Asset/AssetPlaylistModalAdd.vue +138 -0
- package/src/components/Asset/AssetPreview.vue +89 -0
- package/src/components/Asset/AssetShareModal.vue +131 -0
- package/src/components/Asset/AssetTable.vue +365 -0
- package/src/components/Asset/FormUploadAsset.vue +647 -0
- package/src/components/Asset/FormUploadAssetItem.vue +115 -0
- package/src/components/Asset/FormUploadAssetProgress.vue +161 -0
- package/src/components/Asset/Scrubber.vue +57 -0
- package/src/components/Asset/VideoPlayer.vue +226 -0
- package/src/components/Asset/VideoPreview.vue +102 -0
- package/src/components/Asset/VideoPreviewConfig.vue +329 -0
- package/src/components/Asset/VideoPreviewConfigMessage.vue +120 -0
- package/src/components/Asset/VideoPreviewConfigVod.vue +287 -0
- package/src/components/Asset/VideoPreviewNew.vue +66 -0
- package/src/components/Asset/VideoPreviewNewLoader.vue +144 -0
- package/src/components/Asset/VideoPreviewWrapper.vue +208 -0
- package/src/components/Asset/asset-context.ts +24 -0
- package/src/components/Asset/usePickerStore.ts +55 -0
- package/src/components/AuthLayout/AuthLayoutSimple.vue +150 -0
- package/src/components/AuthLayout/index.vue +151 -0
- package/src/components/AutoRefresh/AutoRefresh.vue +91 -0
- package/src/components/AutoRefresh/AutoRefreshOld.vue +87 -0
- package/src/components/AutoRefresh/useRefresh.ts +93 -0
- package/src/components/BackButton.vue +13 -0
- package/src/components/Card/CardInfo.vue +21 -0
- package/src/components/Channel/AIConfig.vue +101 -0
- package/src/components/Channel/AdvancedForm.vue +542 -0
- package/src/components/Channel/ChannelListGrid.vue +154 -0
- package/src/components/Channel/ConfigBlackout.vue +98 -0
- package/src/components/Channel/ConfigCensorship.vue +387 -0
- package/src/components/Channel/ConfigForensicWatermark.vue +152 -0
- package/src/components/Channel/ConfigForm.vue +102 -0
- package/src/components/Channel/ConfigInformation.vue +191 -0
- package/src/components/Channel/ConfigInteraction.vue +11 -0
- package/src/components/Channel/ConfigNameModifier.vue +15 -0
- package/src/components/Channel/ConfigOptionItem.vue +114 -0
- package/src/components/Channel/ConfigOptions.vue +181 -0
- package/src/components/Channel/ConfigPte.vue +368 -0
- package/src/components/Channel/ConfigScte.vue +442 -0
- package/src/components/Channel/ConfigTranscoder.vue +353 -0
- package/src/components/Channel/ConfigWaterMarkAudio.vue +52 -0
- package/src/components/Channel/ConfigWatermark.vue +76 -0
- package/src/components/Channel/ConfigWatermarkEventChannel.vue +86 -0
- package/src/components/Channel/ConfigWatermarkItem.vue +239 -0
- package/src/components/Channel/HeaderItem.vue +75 -0
- package/src/components/Channel/InputDetail.vue +68 -0
- package/src/components/Channel/InputForm.vue +175 -0
- package/src/components/Channel/InputList.vue +38 -0
- package/src/components/Channel/InputPackageDetail.vue +125 -0
- package/src/components/Channel/MediaProfileFormModal.vue +79 -0
- package/src/components/Channel/MediaProfileModify.vue +229 -0
- package/src/components/Channel/MessageButtonGetHelp.vue +30 -0
- package/src/components/Channel/MessageTooltipAi.vue +29 -0
- package/src/components/Channel/MultipleSelectProfile.vue +312 -0
- package/src/components/Channel/PackageInputItem.vue +13 -0
- package/src/components/Channel/PresetConfigItem.vue +1957 -0
- package/src/components/Channel/PresetConfigItemExtra.vue +59 -0
- package/src/components/Channel/PresetConfigItemPId.vue +145 -0
- package/src/components/Channel/ProfileConfigItem.vue +829 -0
- package/src/components/Channel/ProfileDetailsList.vue +160 -0
- package/src/components/Channel/ProfileForm.vue +134 -0
- package/src/components/Channel/ProfileList.vue +228 -0
- package/src/components/Channel/SelectServer.vue +134 -0
- package/src/components/Channel/SignalLoss.vue +92 -0
- package/src/components/Channel/SwitchInputButton.vue +38 -0
- package/src/components/Channel/TargetCatchup.vue +75 -0
- package/src/components/Channel/TargetDataInfo.vue +100 -0
- package/src/components/Channel/TargetDestination.vue +375 -0
- package/src/components/Channel/TargetDrm.vue +518 -0
- package/src/components/Channel/TargetForm.vue +136 -0
- package/src/components/Channel/TargetList.vue +159 -0
- package/src/components/Channel/TargetLowLatency.vue +107 -0
- package/src/components/Channel/TargetMabrOutput.vue +58 -0
- package/src/components/Channel/TargetMabrOutputItem.vue +91 -0
- package/src/components/Channel/TargetManifest.vue +94 -0
- package/src/components/Channel/TargetNetworkInterface.vue +95 -0
- package/src/components/Channel/TargetOutputMultiplex.vue +237 -0
- package/src/components/Channel/TargetOutputType.vue +201 -0
- package/src/components/Channel/TargetOutputUdp.vue +200 -0
- package/src/components/Channel/TargetPreset.vue +541 -0
- package/src/components/Channel/TargetProfileAudioGroup.vue +27 -0
- package/src/components/Channel/TargetProfileProgram.vue +43 -0
- package/src/components/Channel/TargetProfileURI.vue +68 -0
- package/src/components/Channel/TargetSrtOutput.vue +35 -0
- package/src/components/Channel/TargetSrtOutputItem.vue +83 -0
- package/src/components/Channel/TargetStartover.vue +40 -0
- package/src/components/Channel/WarningName.vue +39 -0
- package/src/components/Channel/WarningOutput.vue +40 -0
- package/src/components/CollapseTagsTooltip/CollapseTagsTooltip.vue +87 -0
- package/src/components/CollapseTagsTooltip/index.ts +1 -0
- package/src/components/CopyButton.vue +46 -0
- package/src/components/CopyText.vue +40 -0
- package/src/components/CopyTextButton.vue +40 -0
- package/src/components/DefaultLayout/DefaultLayout.vue +134 -0
- package/src/components/DefaultLayout/GlobalASide.vue +75 -0
- package/src/components/DefaultLayout/GlobalFooter.vue +15 -0
- package/src/components/DefaultLayout/GlobalHeader.vue +43 -0
- package/src/components/DefaultLayout/Logo.vue +35 -0
- package/src/components/DefaultLayout/Menu.vue +464 -0
- package/src/components/DefaultLayout/RightMenu.vue +93 -0
- package/src/components/DialogWarningAddLicense.vue +37 -0
- package/src/components/Epg/Epg.vue +24 -0
- package/src/components/Epg/components/Channel.vue +28 -0
- package/src/components/Epg/components/Channels.vue +33 -0
- package/src/components/Epg/components/Layout.vue +121 -0
- package/src/components/Epg/components/Line.vue +41 -0
- package/src/components/Epg/components/Loader.vue +23 -0
- package/src/components/Epg/components/Program.vue +101 -0
- package/src/components/Epg/components/SideBar.vue +18 -0
- package/src/components/Epg/components/Timeline.vue +72 -0
- package/src/components/Epg/helpers/common.ts +68 -0
- package/src/components/Epg/helpers/epg.ts +192 -0
- package/src/components/Epg/helpers/index.ts +5 -0
- package/src/components/Epg/helpers/interfaces.ts +54 -0
- package/src/components/Epg/helpers/time.ts +51 -0
- package/src/components/Epg/helpers/types.ts +26 -0
- package/src/components/Epg/helpers/variables.ts +33 -0
- package/src/components/Epg/hooks/index.ts +2 -0
- package/src/components/Epg/hooks/useEpg.ts +160 -0
- package/src/components/Epg/hooks/useLayout.ts +187 -0
- package/src/components/Epg/hooks/useProgram.ts +63 -0
- package/src/components/Epg/hooks/useTimeline.ts +35 -0
- package/src/components/Epg/index.ts +4 -0
- package/src/components/Epg/store.ts +85 -0
- package/src/components/Epg/theme.ts +44 -0
- package/src/components/Exception/403.png +0 -0
- package/src/components/Exception/403.vue +58 -0
- package/src/components/Exception/404.png +0 -0
- package/src/components/Exception/404.vue +59 -0
- package/src/components/Exception/500.png +0 -0
- package/src/components/Exception/500.vue +39 -0
- package/src/components/Exception/index.scss +30 -0
- package/src/components/Field.vue +193 -0
- package/src/components/FilterQuerySchema/FilterQuerySchemaForm.vue +200 -0
- package/src/components/FilterQuerySchema/QueryTag.vue +109 -0
- package/src/components/FilterQuerySchema/Tag.vue +68 -0
- package/src/components/FilterTimeDimensions.vue +265 -0
- package/src/components/FilterTimeDimensionsSingle.vue +214 -0
- package/src/components/HelpPanel.vue +87 -0
- package/src/components/HexagonPro.vue +7 -0
- package/src/components/IconCopyButton.vue +43 -0
- package/src/components/InformationLabel.vue +67 -0
- package/src/components/Input/InputTags.vue +136 -0
- package/src/components/Input/index.ts +1 -0
- package/src/components/MainDefaultLayout/index.vue +120 -0
- package/src/components/NoticeAddLicense.vue +20 -0
- package/src/components/NoticeRunningOutResources.vue +20 -0
- package/src/components/Pagination.vue +61 -0
- package/src/components/QueryBuilder/QueryBuilder.vue +141 -0
- package/src/components/QueryBuilder/components/inputs/DateInputField.vue +105 -0
- package/src/components/QueryBuilder/components/inputs/FieldSelect.vue +44 -0
- package/src/components/QueryBuilder/components/inputs/InputMultiSelect.vue +60 -0
- package/src/components/QueryBuilder/components/inputs/InputSelect.vue +39 -0
- package/src/components/QueryBuilder/components/inputs/NumberInputField.vue +91 -0
- package/src/components/QueryBuilder/components/inputs/OperatorSelect.vue +59 -0
- package/src/components/QueryBuilder/components/inputs/TextInput.vue +40 -0
- package/src/components/QueryBuilder/components/inputs/TimeInputField.vue +114 -0
- package/src/components/QueryBuilder/components/inputs/logics.ts +27 -0
- package/src/components/QueryBuilder/components/item/InputMultiOptions.vue +56 -0
- package/src/components/QueryBuilder/components/item/QueryGroup.vue +71 -0
- package/src/components/QueryBuilder/components/item/QueryGroupActions.vue +76 -0
- package/src/components/QueryBuilder/components/item/QueryRule.vue +233 -0
- package/src/components/QueryBuilder/useConfigStore.ts +27 -0
- package/src/components/QueryBuilder/utils/config.ts +194 -0
- package/src/components/QueryBuilder/utils/index.ts +3 -0
- package/src/components/QueryBuilder/utils/mongodb.ts +175 -0
- package/src/components/QueryBuilder/utils/rules.ts +213 -0
- package/src/components/RecommendedConfigurationPTE.vue +238 -0
- package/src/components/Server/MachineConfig.vue +333 -0
- package/src/components/Server/ServerConfig.vue +599 -0
- package/src/components/Server/useQueryMachine.ts +380 -0
- package/src/components/Server/validator.ts +13 -0
- package/src/components/SwitchDark.vue +19 -0
- package/src/components/SwitchLang.vue +31 -0
- package/src/components/TableEmpty.vue +50 -0
- package/src/components/Toast/ToastNoti.vue +52 -0
- package/src/components/Tool/ForensicWatermarkingDialog.vue +39 -0
- package/src/components/Tool/FormRecord.vue +162 -0
- package/src/components/Tool/FormUpload.vue +118 -0
- package/src/components/Tool/ResultChecking.vue +103 -0
- package/src/components/Tool/Watermarking.vue +159 -0
- package/src/components/Tool/record.js +92 -0
- package/src/components/Tooltip/Ellipsis.vue +52 -0
- package/src/components/Tooltip/index.vue +47 -0
- package/src/components/app/AppList.vue +50 -0
- package/src/components/button/Button.vue +27 -0
- package/src/components/button/index.ts +37 -0
- package/src/components/context-menu/ContextMenu.vue +15 -0
- package/src/components/context-menu/ContextMenuCheckboxItem.vue +39 -0
- package/src/components/context-menu/ContextMenuContent.vue +35 -0
- package/src/components/context-menu/ContextMenuGroup.vue +11 -0
- package/src/components/context-menu/ContextMenuItem.vue +33 -0
- package/src/components/context-menu/ContextMenuLabel.vue +24 -0
- package/src/components/context-menu/ContextMenuPortal.vue +11 -0
- package/src/components/context-menu/ContextMenuRadioGroup.vue +19 -0
- package/src/components/context-menu/ContextMenuRadioItem.vue +39 -0
- package/src/components/context-menu/ContextMenuSeparator.vue +19 -0
- package/src/components/context-menu/ContextMenuShortcut.vue +13 -0
- package/src/components/context-menu/ContextMenuSub.vue +19 -0
- package/src/components/context-menu/ContextMenuSubContent.vue +34 -0
- package/src/components/context-menu/ContextMenuSubTrigger.vue +33 -0
- package/src/components/context-menu/ContextMenuTrigger.vue +13 -0
- package/src/components/context-menu/index.ts +14 -0
- package/src/components/dashboard/SSDashboardChartRoot.vue +18 -0
- package/src/components/dashboard/SSDashboardDocument.vue +45 -0
- package/src/components/dashboard/SSDashboardEmpty.vue +16 -0
- package/src/components/dashboard/SSDashboardGuideline.vue +45 -0
- package/src/components/dashboard/SSDashboardInfo.vue +36 -0
- package/src/components/dashboard/SSDashboardInfoRoot.vue +9 -0
- package/src/components/dashboard/SSDashboardInfoTime.vue +38 -0
- package/src/components/markdown/Markdown.vue +295 -0
- package/src/components/tabs/Tabs.vue +15 -0
- package/src/components/tabs/TabsContent.vue +22 -0
- package/src/components/tabs/TabsList.vue +22 -0
- package/src/components/tabs/TabsTrigger.vue +26 -0
- package/src/composables/asset.ts +13 -0
- package/src/composables/channel.ts +333 -0
- package/src/composables/country.ts +788 -0
- package/src/composables/error.ts +24 -0
- package/src/composables/form.ts +351 -0
- package/src/composables/getBuildTime.ts +7 -0
- package/src/composables/micro.ts +113 -0
- package/src/composables/microState.ts +22 -0
- package/src/composables/notiGlobal.ts +19 -0
- package/src/composables/plan.ts +162 -0
- package/src/composables/refReset.ts +12 -0
- package/src/composables/resetInfiniteQueryPagination.ts +18 -0
- package/src/composables/route.ts +19 -0
- package/src/composables/toast.ts +21 -0
- package/src/composables/useApp.ts +6 -0
- package/src/composables/useAsyncSchema.ts +58 -0
- package/src/composables/useChannelActions.ts +151 -0
- package/src/composables/useComplexSearchParam.ts +293 -0
- package/src/composables/useFilterSchema.ts +106 -0
- package/src/composables/useGetInputDetail.ts +36 -0
- package/src/composables/useGetServerAddLicense.ts +21 -0
- package/src/composables/useJobPreview.ts +438 -0
- package/src/composables/useLayoutStore.ts +106 -0
- package/src/composables/usePermission.ts +5 -0
- package/src/composables/usePickerStore.ts +53 -0
- package/src/composables/useQueryAssets.ts +56 -0
- package/src/composables/useQueryParams.ts +20 -0
- package/src/composables/useRouteParams.ts +36 -0
- package/src/composables/useRouteQueries.ts +54 -0
- package/src/composables/useRouterHistory.ts +76 -0
- package/src/composables/useSearchQuery.ts +27 -0
- package/src/composables/useTooltipEllipsis.ts +12 -0
- package/src/constants/env.ts +11 -0
- package/src/constants/filterable.ts +32 -0
- package/src/constants/languageCode.ts +185 -0
- package/src/constants/micro.ts +1 -0
- package/src/constants/queryKeys.ts +11 -0
- package/src/constants/regex.ts +8 -0
- package/src/constants/storage.ts +41 -0
- package/src/enums/index.ts +24 -0
- package/src/layouts/empty.vue +7 -0
- package/src/modules/api-party/kit.ts +30 -0
- package/src/modules/api-party/module.ts +259 -0
- package/src/modules/api-party/openapi.ts +74 -0
- package/src/modules/api-party/runtime/composables/$api.ts +157 -0
- package/src/modules/api-party/runtime/composables/useApiData.ts +229 -0
- package/src/modules/api-party/runtime/constants.ts +1 -0
- package/src/modules/api-party/runtime/formData.ts +85 -0
- package/src/modules/api-party/runtime/server/$api.ts +29 -0
- package/src/modules/api-party/runtime/server/handler.ts +92 -0
- package/src/modules/api-party/runtime/types.ts +97 -0
- package/src/modules/api-party/runtime/utils.ts +43 -0
- package/src/pages/403.vue +11 -0
- package/src/pages/500.vue +11 -0
- package/src/pages/[...all].vue +11 -0
- package/src/pages/login.vue +67 -0
- package/src/plugins/auth.ts +10 -0
- package/src/plugins/build-time.ts +5 -0
- package/src/plugins/dayjs.ts +14 -0
- package/src/plugins/i18n.ts +6 -0
- package/src/plugins/router.ts +6 -0
- package/src/plugins/vue-json-pretty.ts +5 -0
- package/src/plugins/vue-query.ts +41 -0
- package/src/plugins/wujie.ts +19 -0
- package/src/public/apple-touch-icon.png +0 -0
- package/src/public/audio-recorder.js +31 -0
- package/src/public/build-time.json +1 -0
- package/src/public/favicon.ico +0 -0
- package/src/public/icon-block-free-app.png +0 -0
- package/src/public/maskable-icon.png +0 -0
- package/src/public/nuxt.svg +3 -0
- package/src/public/preview/step-1.png +0 -0
- package/src/public/preview/step-2.png +0 -0
- package/src/public/preview/step-3.png +0 -0
- package/src/public/pwa-192x192.png +0 -0
- package/src/public/pwa-512x512.png +0 -0
- package/src/public/robots.txt +2 -0
- package/src/public/vite.png +0 -0
- package/src/pwa/config.ts +61 -0
- package/src/pwa/index.ts +194 -0
- package/src/pwa/runtime/VitePwaManifest.ts +33 -0
- package/src/pwa/types.ts +56 -0
- package/src/pwa/utils.ts +16 -0
- package/src/schemas/authServiceApi.json +6709 -0
- package/src/schemas/billingApi.json +1083 -0
- package/src/schemas/chatApi.json +497 -0
- package/src/schemas/libraryApi.json +2009 -0
- package/src/schemas/licenseApi.json +772 -0
- package/src/schemas/livestreamApi.json +3354 -0
- package/src/schemas/lrmApi.json +2848 -0
- package/src/schemas/machineApi.json +4604 -0
- package/src/schemas/metricApi.json +141 -0
- package/src/schemas/notificationApi.json +1 -0
- package/src/schemas/playoutApi.json +8315 -0
- package/src/schemas/ssaiApi.json +1108 -0
- package/src/schemas/transcodeApi.json +9670 -0
- package/src/schemas/vastControlApi.json +961 -0
- package/src/schemas/vodApi.json +3974 -0
- package/src/server/plugins/loading.css +111 -0
- package/src/server/plugins/loading.html +12 -0
- package/src/server/plugins/loading.ts +134 -0
- package/src/templates/pwa.client.ts +136 -0
- package/src/utils/$apiOptions.ts +79 -0
- package/src/utils/app.ts +23 -0
- package/src/utils/cn.ts +3 -0
- package/src/utils/format.ts +88 -0
- package/src/utils/gen-routes.ts +100 -0
- package/src/utils/helper.ts +56 -0
- package/src/utils/micro.ts +207 -0
- package/src/utils/popoverSelectAttrs.ts +24 -0
- package/src/utils/popup.ts +96 -0
- package/src/utils/pwa.ts +86 -0
- package/src/utils/query-filter.ts +111 -0
- package/src/utils/table.ts +35 -0
- package/src/utils/tryCatch.ts +25 -0
- package/src/utils/utils.ts +58 -0
- package/src/utils/validator.ts +185 -0
- package/src/utils/videojs.ts +490 -0
- package/src/utils/wujie.ts +1 -0
- package/tsconfig.json +3 -0
- package/uno.config.ts +375 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { computed, reactive } from 'vue'
|
|
2
|
+
import { hash } from 'ohash'
|
|
3
|
+
import type { FetchError } from 'ofetch'
|
|
4
|
+
import type { NitroFetchOptions } from 'nitropack'
|
|
5
|
+
import type { WatchSource } from 'vue'
|
|
6
|
+
import type { AsyncData, AsyncDataOptions } from 'nuxt/app'
|
|
7
|
+
import type { ModuleOptions } from '../../module'
|
|
8
|
+
import { CACHE_KEY_PREFIX } from '../constants'
|
|
9
|
+
import { headersToObject, resolvePath, serializeMaybeEncodedBody, toValue } from '../utils'
|
|
10
|
+
import { isFormData } from '../formData'
|
|
11
|
+
import type { AllPaths, EndpointFetchOptions, GETPaths, GETPlainPaths, HttpMethod, IgnoreCase, MaybeRef, MaybeRefOrGetter, OpenApiError, OpenApiRequestOptions, OpenApiResponse, PathItemObject } from '../types'
|
|
12
|
+
import { useAsyncData, useRequestHeaders, useRuntimeConfig } from '#imports'
|
|
13
|
+
|
|
14
|
+
type ComputedOptions<T extends Record<string, any>> = {
|
|
15
|
+
[K in keyof T]: T[K] extends (...args: any[]) => any
|
|
16
|
+
? T[K]
|
|
17
|
+
: T[K] extends Record<string, any>
|
|
18
|
+
? ComputedOptions<T[K]> | MaybeRef<T[K]>
|
|
19
|
+
: MaybeRef<T[K]>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type BaseUseApiDataOptions<ResT, DataT = ResT> = Omit<AsyncDataOptions<ResT, DataT>, 'watch'> & {
|
|
23
|
+
/**
|
|
24
|
+
* Skip the Nuxt server proxy and fetch directly from the API.
|
|
25
|
+
* Requires `allowClient` to be enabled in the module options as well.
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
client?: boolean
|
|
29
|
+
/**
|
|
30
|
+
* Cache the response for the same request.
|
|
31
|
+
* You can customize the cache key with the `key` option.
|
|
32
|
+
* @default true
|
|
33
|
+
*/
|
|
34
|
+
cache?: boolean
|
|
35
|
+
/**
|
|
36
|
+
* By default, a cache key will be generated from the request options.
|
|
37
|
+
* With this option, you can provide a custom cache key.
|
|
38
|
+
* @default undefined
|
|
39
|
+
*/
|
|
40
|
+
key?: MaybeRefOrGetter<string>
|
|
41
|
+
/**
|
|
42
|
+
* Watch an array of reactive sources and auto-refresh the fetch result when they change.
|
|
43
|
+
* Fetch options and URL are watched by default. You can completely ignore reactive sources by using `watch: false`.
|
|
44
|
+
* @default undefined
|
|
45
|
+
*/
|
|
46
|
+
watch?: (WatchSource<unknown> | object)[] | false
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type UseApiDataOptions<T> = Pick<
|
|
50
|
+
ComputedOptions<NitroFetchOptions<string>>,
|
|
51
|
+
| 'onRequest'
|
|
52
|
+
| 'onRequestError'
|
|
53
|
+
| 'onResponse'
|
|
54
|
+
| 'onResponseError'
|
|
55
|
+
| 'query'
|
|
56
|
+
| 'headers'
|
|
57
|
+
| 'method'
|
|
58
|
+
| 'retry'
|
|
59
|
+
| 'retryDelay'
|
|
60
|
+
| 'timeout'
|
|
61
|
+
> & {
|
|
62
|
+
pathParams?: MaybeRefOrGetter<Record<string, string>>
|
|
63
|
+
body?: MaybeRef<string | Record<string, any> | FormData | null>
|
|
64
|
+
} & BaseUseApiDataOptions<T>
|
|
65
|
+
|
|
66
|
+
export type UseOpenApiDataOptions<
|
|
67
|
+
P extends PathItemObject,
|
|
68
|
+
M extends IgnoreCase<keyof P & HttpMethod> = IgnoreCase<keyof P & 'get'>,
|
|
69
|
+
ResT = OpenApiResponse<P[Lowercase<M>]>,
|
|
70
|
+
DataT = ResT,
|
|
71
|
+
> = BaseUseApiDataOptions<ResT, DataT> & ComputedOptions<OpenApiRequestOptions<P, M>>
|
|
72
|
+
|
|
73
|
+
export type UseApiData = <T = any>(
|
|
74
|
+
path: MaybeRefOrGetter<string>,
|
|
75
|
+
opts?: UseApiDataOptions<T>,
|
|
76
|
+
) => AsyncData<T | undefined, FetchError>
|
|
77
|
+
|
|
78
|
+
export interface UseOpenApiData<Paths extends Record<string, PathItemObject>> {
|
|
79
|
+
<P extends GETPlainPaths<Paths>, ResT = OpenApiResponse<Paths[`/${P}`]['get']>, DataT = ResT>(
|
|
80
|
+
path: MaybeRefOrGetter<P>,
|
|
81
|
+
opts?: Omit<UseOpenApiDataOptions<Paths[`/${P}`], IgnoreCase<keyof Paths[`/${P}`] & HttpMethod>, ResT, DataT>, 'method'>,
|
|
82
|
+
): AsyncData<DataT, FetchError<OpenApiError<Paths[`/${P}`]['get']>>>
|
|
83
|
+
<P extends GETPaths<Paths>, ResT = OpenApiResponse<Paths[`/${P}`]['get']>, DataT = ResT>(
|
|
84
|
+
path: MaybeRefOrGetter<P>,
|
|
85
|
+
opts: Omit<UseOpenApiDataOptions<Paths[`/${P}`], IgnoreCase<keyof Paths[`/${P}`] & HttpMethod>, ResT, DataT>, 'method'>,
|
|
86
|
+
): AsyncData<DataT, FetchError<OpenApiError<Paths[`/${P}`]['get']>>>
|
|
87
|
+
<P extends AllPaths<Paths>, M extends IgnoreCase<keyof Paths[`/${P}`] & HttpMethod>, ResT = OpenApiResponse<Paths[`/${P}`][Lowercase<M>]>, DataT = ResT>(
|
|
88
|
+
path: MaybeRefOrGetter<P>,
|
|
89
|
+
opts: UseOpenApiDataOptions<Paths[`/${P}`], M, ResT, DataT> & { method: M },
|
|
90
|
+
): AsyncData<DataT, FetchError<OpenApiError<Paths[`/${P}`][Lowercase<M>]>>>
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function _useApiData<T = any>(
|
|
94
|
+
endpointId: string,
|
|
95
|
+
path: MaybeRefOrGetter<string>,
|
|
96
|
+
opts: UseApiDataOptions<T> = {},
|
|
97
|
+
) {
|
|
98
|
+
const { apiParty } = useRuntimeConfig().public
|
|
99
|
+
const {
|
|
100
|
+
server,
|
|
101
|
+
lazy,
|
|
102
|
+
default: defaultFn,
|
|
103
|
+
transform,
|
|
104
|
+
pick,
|
|
105
|
+
watch,
|
|
106
|
+
immediate,
|
|
107
|
+
pathParams,
|
|
108
|
+
query,
|
|
109
|
+
headers,
|
|
110
|
+
method,
|
|
111
|
+
body,
|
|
112
|
+
client = false,
|
|
113
|
+
cache = true,
|
|
114
|
+
key,
|
|
115
|
+
...fetchOptions
|
|
116
|
+
} = opts
|
|
117
|
+
|
|
118
|
+
const _path = computed(() => resolvePath(toValue(path), toValue(pathParams)))
|
|
119
|
+
const _key = computed(key === undefined
|
|
120
|
+
? () => CACHE_KEY_PREFIX + hash([
|
|
121
|
+
endpointId,
|
|
122
|
+
_path.value,
|
|
123
|
+
toValue(query),
|
|
124
|
+
toValue(method),
|
|
125
|
+
...(isFormData(toValue(body)) ? [] : [toValue(body)]),
|
|
126
|
+
])
|
|
127
|
+
: () => CACHE_KEY_PREFIX + toValue(key),
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
if (client && !apiParty.allowClient)
|
|
131
|
+
throw new Error('Client-side API requests are disabled. Set "allowClient: true" in the module options to enable them.')
|
|
132
|
+
|
|
133
|
+
const endpoints = (apiParty as unknown as ModuleOptions).endpoints || {}
|
|
134
|
+
const endpoint = endpoints[endpointId]
|
|
135
|
+
|
|
136
|
+
const _fetchOptions = reactive(fetchOptions)
|
|
137
|
+
|
|
138
|
+
const _endpointFetchOptions: EndpointFetchOptions = reactive({
|
|
139
|
+
path: _path,
|
|
140
|
+
query,
|
|
141
|
+
headers: computed(() => ({
|
|
142
|
+
...headersToObject(toValue(headers)),
|
|
143
|
+
...(endpoint.cookies && useRequestHeaders(['cookie'])),
|
|
144
|
+
})),
|
|
145
|
+
method,
|
|
146
|
+
body,
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
const _asyncDataOptions: AsyncDataOptions<T> = {
|
|
150
|
+
server,
|
|
151
|
+
lazy,
|
|
152
|
+
default: defaultFn,
|
|
153
|
+
transform,
|
|
154
|
+
pick,
|
|
155
|
+
watch: watch === false
|
|
156
|
+
? []
|
|
157
|
+
: [
|
|
158
|
+
_endpointFetchOptions,
|
|
159
|
+
...(watch || []),
|
|
160
|
+
],
|
|
161
|
+
immediate,
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
let controller: AbortController | undefined
|
|
165
|
+
|
|
166
|
+
return useAsyncData<T, FetchError>(
|
|
167
|
+
_key.value,
|
|
168
|
+
async (nuxt) => {
|
|
169
|
+
controller?.abort?.()
|
|
170
|
+
|
|
171
|
+
// Workaround to persist response client-side
|
|
172
|
+
// https://github.com/nuxt/nuxt/issues/15445
|
|
173
|
+
if ((nuxt!.isHydrating || cache) && _key.value in nuxt!.payload.data)
|
|
174
|
+
return nuxt!.payload.data[_key.value]
|
|
175
|
+
|
|
176
|
+
controller = new AbortController()
|
|
177
|
+
|
|
178
|
+
let result: T | undefined
|
|
179
|
+
|
|
180
|
+
try {
|
|
181
|
+
if (client) {
|
|
182
|
+
result = (await globalThis.$fetch<T>(_path.value, {
|
|
183
|
+
..._fetchOptions,
|
|
184
|
+
signal: controller.signal,
|
|
185
|
+
baseURL: endpoint.url,
|
|
186
|
+
method: _endpointFetchOptions.method,
|
|
187
|
+
query: {
|
|
188
|
+
...endpoint.query,
|
|
189
|
+
..._endpointFetchOptions.query,
|
|
190
|
+
},
|
|
191
|
+
headers: {
|
|
192
|
+
...(endpoint.token && { Authorization: `Bearer ${endpoint.token}` }),
|
|
193
|
+
...endpoint.headers,
|
|
194
|
+
..._endpointFetchOptions.headers,
|
|
195
|
+
},
|
|
196
|
+
body: _endpointFetchOptions.body,
|
|
197
|
+
})) as T
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
result = (await globalThis.$fetch<T>(
|
|
201
|
+
`/api/__api_party/${endpointId}`,
|
|
202
|
+
{
|
|
203
|
+
..._fetchOptions,
|
|
204
|
+
signal: controller.signal,
|
|
205
|
+
method: 'POST',
|
|
206
|
+
body: {
|
|
207
|
+
..._endpointFetchOptions,
|
|
208
|
+
body: await serializeMaybeEncodedBody(_endpointFetchOptions.body),
|
|
209
|
+
} satisfies EndpointFetchOptions,
|
|
210
|
+
},
|
|
211
|
+
)) as T
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
// Invalidate cache if request fails
|
|
216
|
+
if (_key.value in nuxt!.payload.data)
|
|
217
|
+
delete nuxt!.payload.data[_key.value]
|
|
218
|
+
|
|
219
|
+
throw error
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (cache)
|
|
223
|
+
nuxt!.payload.data[_key.value] = result
|
|
224
|
+
|
|
225
|
+
return result
|
|
226
|
+
},
|
|
227
|
+
_asyncDataOptions,
|
|
228
|
+
) as AsyncData<T | undefined, FetchError>
|
|
229
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const CACHE_KEY_PREFIX = '$apiParty'
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export interface SerializedBlob {
|
|
2
|
+
data: string
|
|
3
|
+
type: string
|
|
4
|
+
size: number
|
|
5
|
+
name?: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type SerializedFormData = Record<
|
|
9
|
+
string,
|
|
10
|
+
string | (SerializedBlob & { __type: 'blob' })
|
|
11
|
+
>
|
|
12
|
+
|
|
13
|
+
export function isFormData(obj: unknown): obj is FormData {
|
|
14
|
+
return obj instanceof FormData
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function isSerializedFormData(obj: unknown): obj is SerializedFormData {
|
|
18
|
+
return (
|
|
19
|
+
typeof obj === 'object'
|
|
20
|
+
&& obj !== null
|
|
21
|
+
&& '__type' in obj
|
|
22
|
+
&& obj.__type === 'form-data'
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export async function formDataToObject(formData: FormData) {
|
|
27
|
+
const obj: SerializedFormData = {
|
|
28
|
+
__type: 'form-data',
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
for (const [key, value] of formData.entries()) {
|
|
32
|
+
if (value instanceof Blob) {
|
|
33
|
+
obj[key] = {
|
|
34
|
+
__type: 'blob',
|
|
35
|
+
...(await serializeBlob(value)),
|
|
36
|
+
name: value.name,
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
obj[key] = value
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return obj
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export async function objectToFormData(obj: SerializedFormData) {
|
|
48
|
+
const formData = new FormData()
|
|
49
|
+
const entries = Object.entries(obj).filter(([key]) => key !== '__type')
|
|
50
|
+
|
|
51
|
+
for (const [key, value] of entries) {
|
|
52
|
+
if (isSerializedBlob(value)) {
|
|
53
|
+
const arrayBuffer = Uint8Array.from(atob(value.data), c => c.charCodeAt(0))
|
|
54
|
+
const blob = new Blob([arrayBuffer], { type: value.type })
|
|
55
|
+
formData.append(key, blob, value.name)
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
formData.append(key, value)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return formData
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function isSerializedBlob(obj: unknown): obj is SerializedBlob {
|
|
66
|
+
return (
|
|
67
|
+
typeof obj === 'object'
|
|
68
|
+
&& obj !== null
|
|
69
|
+
&& '__type' in obj
|
|
70
|
+
&& obj.__type === 'blob'
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function serializeBlob(blob: Blob) {
|
|
75
|
+
const arrayBuffer = await blob.arrayBuffer()
|
|
76
|
+
const bytes = new Uint8Array(arrayBuffer)
|
|
77
|
+
const binary = bytes.reduce((acc, byte) => acc + String.fromCharCode(byte), '')
|
|
78
|
+
const base64 = btoa(binary)
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
data: base64,
|
|
82
|
+
type: blob.type,
|
|
83
|
+
size: blob.size,
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { headersToObject, resolvePath } from '../utils'
|
|
2
|
+
import type { ModuleOptions } from '../../module'
|
|
3
|
+
import type { ApiFetchOptions } from '../composables/$api'
|
|
4
|
+
import { useRuntimeConfig } from '#imports'
|
|
5
|
+
|
|
6
|
+
export function _$api<T = any>(
|
|
7
|
+
endpointId: string,
|
|
8
|
+
path: string,
|
|
9
|
+
opts: ApiFetchOptions = {},
|
|
10
|
+
): Promise<T> {
|
|
11
|
+
const { pathParams, query, headers, ...fetchOptions } = opts
|
|
12
|
+
const { apiParty } = useRuntimeConfig()
|
|
13
|
+
const endpoints = (apiParty as unknown as ModuleOptions).endpoints || {}
|
|
14
|
+
const endpoint = endpoints[endpointId]
|
|
15
|
+
|
|
16
|
+
return globalThis.$fetch<T>(resolvePath(path, pathParams), {
|
|
17
|
+
...fetchOptions,
|
|
18
|
+
baseURL: endpoint.url,
|
|
19
|
+
query: {
|
|
20
|
+
...endpoint.query,
|
|
21
|
+
...query,
|
|
22
|
+
},
|
|
23
|
+
headers: {
|
|
24
|
+
...(endpoint.token && { Authorization: `Bearer ${endpoint.token}` }),
|
|
25
|
+
...endpoint.headers,
|
|
26
|
+
...headersToObject(headers),
|
|
27
|
+
},
|
|
28
|
+
}) as Promise<T>
|
|
29
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { createError, defineEventHandler, getRequestHeader, getRouterParam, readBody, removeResponseHeader, send, setResponseHeaders, setResponseStatus } from 'h3'
|
|
2
|
+
import { deserializeMaybeEncodedBody } from '../utils'
|
|
3
|
+
import type { ModuleOptions } from '../../module'
|
|
4
|
+
import type { EndpointFetchOptions } from '../types'
|
|
5
|
+
import { useRuntimeConfig } from '#imports'
|
|
6
|
+
|
|
7
|
+
export default defineEventHandler(async (event): Promise<any> => {
|
|
8
|
+
const endpointId = getRouterParam(event, 'endpointId')!
|
|
9
|
+
const { apiParty } = useRuntimeConfig()
|
|
10
|
+
const endpoints = (apiParty as unknown as ModuleOptions).endpoints || {}
|
|
11
|
+
const endpoint = endpoints[endpointId]
|
|
12
|
+
|
|
13
|
+
if (!endpoint) {
|
|
14
|
+
throw createError({
|
|
15
|
+
statusCode: 404,
|
|
16
|
+
statusMessage: `Unknown API endpoint "${endpointId}"`,
|
|
17
|
+
})
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const _body = await readBody<EndpointFetchOptions>(event)
|
|
21
|
+
|
|
22
|
+
const {
|
|
23
|
+
path,
|
|
24
|
+
query,
|
|
25
|
+
headers,
|
|
26
|
+
body,
|
|
27
|
+
...fetchOptions
|
|
28
|
+
} = _body
|
|
29
|
+
|
|
30
|
+
// Check if the path is an absolute URL
|
|
31
|
+
if (new URL(path, 'http://localhost').origin !== 'http://localhost') {
|
|
32
|
+
throw createError({
|
|
33
|
+
statusCode: 400,
|
|
34
|
+
statusMessage: 'Absolute URLs are not allowed',
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Allows to overwrite the backend url with a custom header
|
|
39
|
+
// (e.g. `jsonPlaceholder` endpoint becomes `Json-Placeholder-Endpoint-Url`)
|
|
40
|
+
const baseURL = new Headers(headers).get(`${endpointId}-endpoint-url`) || endpoint.url
|
|
41
|
+
|
|
42
|
+
// Check if the base URL is in the allow list
|
|
43
|
+
if (
|
|
44
|
+
baseURL !== endpoint.url
|
|
45
|
+
&& !endpoint.allowedUrls?.includes(baseURL)
|
|
46
|
+
) {
|
|
47
|
+
throw createError({
|
|
48
|
+
statusCode: 400,
|
|
49
|
+
statusMessage: `Base URL "${baseURL}" is not allowed`,
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
const response = await globalThis.$fetch.raw<ArrayBuffer>(
|
|
55
|
+
path,
|
|
56
|
+
{
|
|
57
|
+
...fetchOptions,
|
|
58
|
+
baseURL,
|
|
59
|
+
query: {
|
|
60
|
+
...endpoint.query,
|
|
61
|
+
...query,
|
|
62
|
+
},
|
|
63
|
+
headers: {
|
|
64
|
+
...(endpoint.token && { Authorization: `Bearer ${endpoint.token}` }),
|
|
65
|
+
...(endpoint.cookies && { cookie: getRequestHeader(event, 'cookie') }),
|
|
66
|
+
...endpoint.headers,
|
|
67
|
+
...headers,
|
|
68
|
+
},
|
|
69
|
+
...(body && { body: await deserializeMaybeEncodedBody(body) }),
|
|
70
|
+
ignoreResponseError: true,
|
|
71
|
+
responseType: 'arrayBuffer',
|
|
72
|
+
},
|
|
73
|
+
)
|
|
74
|
+
setResponseStatus(event, response.status, response.statusText)
|
|
75
|
+
setResponseHeaders(event, Object.fromEntries(response.headers.entries()))
|
|
76
|
+
|
|
77
|
+
// ofetch has already decoded the response. Leaving this header can cause the
|
|
78
|
+
// client issues when decoding and may create a conflict if a compression
|
|
79
|
+
// middleware is used
|
|
80
|
+
removeResponseHeader(event, 'content-encoding')
|
|
81
|
+
|
|
82
|
+
await send(event, new Uint8Array(response._data ?? []))
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
console.error(error)
|
|
86
|
+
|
|
87
|
+
throw createError({
|
|
88
|
+
statusCode: 503,
|
|
89
|
+
statusMessage: 'Service Unavailable',
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
})
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { NitroFetchOptions } from 'nitropack'
|
|
2
|
+
import type { Ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
export type EndpointFetchOptions = NitroFetchOptions<string> & {
|
|
5
|
+
path: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type MaybeRef<T> = T | Ref<T>
|
|
9
|
+
export type MaybeRefOrGetter<T> = MaybeRef<T> | (() => T)
|
|
10
|
+
|
|
11
|
+
export type IgnoreCase<T extends string> = Lowercase<T> | Uppercase<T>
|
|
12
|
+
export type RemovePrefix<T extends string, P extends string> = T extends `${P}${infer S}` ? S : never
|
|
13
|
+
|
|
14
|
+
export type PathItemObject = { [M in HttpMethod]?: any } & { parameters?: any }
|
|
15
|
+
|
|
16
|
+
// HTTP status codes and methods
|
|
17
|
+
export type HttpMethod = 'get' | 'put' | 'post' | 'delete' | 'options' | 'head' | 'patch' | 'trace'
|
|
18
|
+
export type OkStatus = 200 | 201 | 202 | 203 | 204 | 206 | 207 | '2XX' | 'default'
|
|
19
|
+
export type ErrorStatus = 500 | '5XX' | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 429 | 431 | 444 | 450 | 451 | 497 | 498 | 499 | '4XX'
|
|
20
|
+
|
|
21
|
+
// General purpose types
|
|
22
|
+
export type RequestBody<T> = T extends { requestBody?: { content: infer Body } }
|
|
23
|
+
?
|
|
24
|
+
| (Body extends { 'application/octet-stream': any }
|
|
25
|
+
? {
|
|
26
|
+
body: string | Blob
|
|
27
|
+
headers: { 'content-type': 'application/octet-stream' }
|
|
28
|
+
}
|
|
29
|
+
: Record<string, any>)
|
|
30
|
+
| (Body extends { 'application/json': infer Schema }
|
|
31
|
+
? { body: Schema; headers?: { 'content-type'?: 'application/json' } }
|
|
32
|
+
: Record<string, any>)
|
|
33
|
+
| (Body extends { '*/*': infer Schema }
|
|
34
|
+
? { body: Schema; headers?: { 'content-type'?: 'application/json' } }
|
|
35
|
+
: Record<string, any>)
|
|
36
|
+
| (Body extends { 'application/x-www-form-urlencoded': any }
|
|
37
|
+
? {
|
|
38
|
+
body: FormData
|
|
39
|
+
headers: { 'content-type': 'application/x-www-form-urlencoded' }
|
|
40
|
+
}
|
|
41
|
+
: Record<string, any>)
|
|
42
|
+
: unknown
|
|
43
|
+
|
|
44
|
+
export type Method<M extends IgnoreCase<HttpMethod>> =
|
|
45
|
+
'get' extends Lowercase<M> ? { method?: M } : { method: M }
|
|
46
|
+
|
|
47
|
+
export type Param<T, N extends string, K extends string = N> = T extends {
|
|
48
|
+
parameters: { [_ in N]?: any }
|
|
49
|
+
}
|
|
50
|
+
? { [_ in keyof Pick<T['parameters'], N> as K]: T['parameters'][N] }
|
|
51
|
+
: unknown
|
|
52
|
+
|
|
53
|
+
export type PathParameters<T> = Param<T, 'path', 'pathParams'>
|
|
54
|
+
export type QueryParameters<T> = Param<T, 'query'>
|
|
55
|
+
export type HeaderParameters<T> = Param<T, 'header', 'headers'>
|
|
56
|
+
|
|
57
|
+
export type OpenApiRequestOptions<
|
|
58
|
+
P extends PathItemObject,
|
|
59
|
+
M extends IgnoreCase<keyof P & HttpMethod> = IgnoreCase<keyof P & 'get'>,
|
|
60
|
+
> = Omit<
|
|
61
|
+
NitroFetchOptions<any, Lowercase<M>>,
|
|
62
|
+
'params' | 'query' | 'headers' | 'method' | 'body' | 'cache'
|
|
63
|
+
> & RequestBody<P[Lowercase<M>]> & PathParameters<P[Lowercase<M>]> & QueryParameters<P[Lowercase<M>]> & Method<M>
|
|
64
|
+
|
|
65
|
+
type MediaTypes<T, Status extends keyof any> = {
|
|
66
|
+
[S in Status]: T extends {
|
|
67
|
+
responses: {
|
|
68
|
+
[_ in S]: {
|
|
69
|
+
content: {
|
|
70
|
+
'application/json': infer Model
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
? Model
|
|
76
|
+
: never;
|
|
77
|
+
}[Status]
|
|
78
|
+
|
|
79
|
+
// Fetch types
|
|
80
|
+
export type OpenApiResponse<T> = MediaTypes<T, OkStatus>
|
|
81
|
+
export type OpenApiError<T> = MediaTypes<T, ErrorStatus>
|
|
82
|
+
|
|
83
|
+
export type AllPaths<Paths> = RemovePrefix<keyof Paths & string, '/'>
|
|
84
|
+
|
|
85
|
+
/** All endpoints that don't require a `method` property */
|
|
86
|
+
export type GETPaths<Paths> = {
|
|
87
|
+
[P in keyof Paths]: Paths[P] extends { get: any } ? RemovePrefix<P & string, '/'> : never;
|
|
88
|
+
}[keyof Paths]
|
|
89
|
+
|
|
90
|
+
/** All endpoints that don't require additional options */
|
|
91
|
+
export type GETPlainPaths<Paths> = {
|
|
92
|
+
[P in keyof Paths]: Paths[P] extends { get: infer O }
|
|
93
|
+
? O extends { parameters: { query: any } | { header: any } | { path: any } }
|
|
94
|
+
? never
|
|
95
|
+
: RemovePrefix<P & string, '/'>
|
|
96
|
+
: never;
|
|
97
|
+
}[keyof Paths]
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { unref } from 'vue'
|
|
2
|
+
import { formDataToObject, isFormData, isSerializedFormData, objectToFormData } from './formData'
|
|
3
|
+
import type { MaybeRefOrGetter } from './types'
|
|
4
|
+
import type { ApiFetchOptions } from './composables/$api'
|
|
5
|
+
|
|
6
|
+
export function toValue<T>(r: MaybeRefOrGetter<T>): T {
|
|
7
|
+
return typeof r === 'function'
|
|
8
|
+
? (r as (...args: any[]) => any)()
|
|
9
|
+
: unref(r)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function headersToObject(headers: HeadersInit = {}): Record<string, string> {
|
|
13
|
+
if (headers instanceof Headers || Array.isArray(headers))
|
|
14
|
+
return Object.fromEntries(headers)
|
|
15
|
+
|
|
16
|
+
return headers
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export async function serializeMaybeEncodedBody(value: ApiFetchOptions['body']) {
|
|
20
|
+
if (isFormData(value))
|
|
21
|
+
return await formDataToObject(value)
|
|
22
|
+
|
|
23
|
+
return value
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export async function deserializeMaybeEncodedBody(value: ApiFetchOptions['body']) {
|
|
27
|
+
if (isSerializedFormData(value))
|
|
28
|
+
return await objectToFormData(value)
|
|
29
|
+
|
|
30
|
+
return value
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function resolvePath(path: string, params?: Record<string, MaybeRefOrGetter<unknown>>) {
|
|
34
|
+
// To simplify typings, OpenAPI path parameters can be expanded here
|
|
35
|
+
if (params) {
|
|
36
|
+
return Object.entries(params).reduce(
|
|
37
|
+
(path, [name, value]) => path.replace(`{${name}}`, encodeURIComponent(String(toValue(value)))),
|
|
38
|
+
path,
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return path
|
|
43
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
definePageMeta({
|
|
3
|
+
title: 'Login',
|
|
4
|
+
key: 'Login',
|
|
5
|
+
icon: 'i-carbon:user-avatar',
|
|
6
|
+
requiresAuth: false,
|
|
7
|
+
keepAlive: true,
|
|
8
|
+
notAsMenu: true,
|
|
9
|
+
order: 4,
|
|
10
|
+
isHideSubApp: true,
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
const router = useRouter()
|
|
14
|
+
const token = ref('')
|
|
15
|
+
const appId = ref(APP_ID_STORAGE.value || 'd48b652d-b023-449a-8690-30be16b98934')
|
|
16
|
+
|
|
17
|
+
function setLogin() {
|
|
18
|
+
TOKEN_PROP_STORAGE.value = 'Authorization'
|
|
19
|
+
TOKEN_STORAGE.value = `Bearer ${token.value}`
|
|
20
|
+
APP_ID_STORAGE.value = appId.value
|
|
21
|
+
router.push('/')
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const { t } = useI18n()
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<el-card shadow="never" class="lg:h-full" :body-style="{ height: 'calc(100% - 61px)' }">
|
|
29
|
+
<template #header>
|
|
30
|
+
<div class="card-header">
|
|
31
|
+
<span>{{ t('title') }}</span>
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
<el-form label-width="120px">
|
|
35
|
+
<el-form-item :label="t('token')">
|
|
36
|
+
<el-input v-model="token" :placeholder="t('placeholder.token')" />
|
|
37
|
+
</el-form-item>
|
|
38
|
+
<el-form-item :label="t('appId')">
|
|
39
|
+
<el-input v-model="appId" :placeholder="t('placeholder.appId')" />
|
|
40
|
+
</el-form-item>
|
|
41
|
+
<el-form-item>
|
|
42
|
+
<el-button type="primary" @click="setLogin">
|
|
43
|
+
{{ t('submit') }}
|
|
44
|
+
</el-button>
|
|
45
|
+
</el-form-item>
|
|
46
|
+
</el-form>
|
|
47
|
+
</el-card>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<i18n lang="yaml">
|
|
51
|
+
en:
|
|
52
|
+
title: Login
|
|
53
|
+
submit: Submit
|
|
54
|
+
token: Token
|
|
55
|
+
appId: App ID
|
|
56
|
+
placeholder:
|
|
57
|
+
token: Please input token
|
|
58
|
+
appId: Please input app id
|
|
59
|
+
vi:
|
|
60
|
+
title: Đăng nhập
|
|
61
|
+
submit: Đăng nhập
|
|
62
|
+
token: Khóa
|
|
63
|
+
appId: ID ứng dụng
|
|
64
|
+
placeholder:
|
|
65
|
+
token: Vui lòng nhập khóa
|
|
66
|
+
appId: Vui lòng nhập ID ứng dụng
|
|
67
|
+
</i18n>
|