@cdmbase/wiki-browser 12.0.18-alpha.5
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/LICENSE +21 -0
- package/lib/components/Logo.d.ts +4 -0
- package/lib/components/Logo.d.ts.map +1 -0
- package/lib/components/Logo.js +16 -0
- package/lib/components/Logo.js.map +1 -0
- package/lib/components/help/SidebarSearch.d.ts +8 -0
- package/lib/components/help/SidebarSearch.d.ts.map +1 -0
- package/lib/components/help/SidebarSearch.js +111 -0
- package/lib/components/help/SidebarSearch.js.map +1 -0
- package/lib/components/help/index.d.ts +2 -0
- package/lib/components/help/index.d.ts.map +1 -0
- package/lib/components/landing/FeatureCard.d.ts +13 -0
- package/lib/components/landing/FeatureCard.d.ts.map +1 -0
- package/lib/components/landing/FeatureCard.js +85 -0
- package/lib/components/landing/FeatureCard.js.map +1 -0
- package/lib/components/landing/QuickLinkCard.d.ts +8 -0
- package/lib/components/landing/QuickLinkCard.d.ts.map +1 -0
- package/lib/components/landing/QuickLinkCard.js +26 -0
- package/lib/components/landing/QuickLinkCard.js.map +1 -0
- package/lib/components/landing/SearchInput.d.ts +10 -0
- package/lib/components/landing/SearchInput.d.ts.map +1 -0
- package/lib/components/landing/SearchInput.js +223 -0
- package/lib/components/landing/SearchInput.js.map +1 -0
- package/lib/components/landing/index.d.ts +4 -0
- package/lib/components/landing/index.d.ts.map +1 -0
- package/lib/components/welcome.d.ts +3 -0
- package/lib/components/welcome.d.ts.map +1 -0
- package/lib/compute.d.ts +4 -0
- package/lib/compute.d.ts.map +1 -0
- package/lib/compute.js +96 -0
- package/lib/compute.js.map +1 -0
- package/lib/config/env-config.d.ts +4 -0
- package/lib/config/env-config.d.ts.map +1 -0
- package/lib/config/env-config.js +7 -0
- package/lib/config/env-config.js.map +1 -0
- package/lib/docs.config.d.ts +48 -0
- package/lib/docs.config.d.ts.map +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -0
- package/lib/loaders/search.d.ts +1 -0
- package/lib/loaders/search.d.ts.map +1 -0
- package/lib/module.d.ts +4 -0
- package/lib/module.d.ts.map +1 -0
- package/lib/module.js +11 -0
- package/lib/module.js.map +1 -0
- package/lib/pages/ArticlePage/ArticlePage.d.ts +4 -0
- package/lib/pages/ArticlePage/ArticlePage.d.ts.map +1 -0
- package/lib/pages/ArticlePage/ArticlePage.js +222 -0
- package/lib/pages/ArticlePage/ArticlePage.js.map +1 -0
- package/lib/pages/ArticlePage/index.d.ts +3 -0
- package/lib/pages/ArticlePage/index.d.ts.map +1 -0
- package/lib/pages/ArticlePage/index.js +3 -0
- package/lib/pages/ArticlePage/index.js.map +1 -0
- package/lib/pages/CategoryCollection/CategoryCollection.d.ts +4 -0
- package/lib/pages/CategoryCollection/CategoryCollection.d.ts.map +1 -0
- package/lib/pages/CategoryCollection/CategoryCollection.js +103 -0
- package/lib/pages/CategoryCollection/CategoryCollection.js.map +1 -0
- package/lib/pages/CategoryCollection/index.d.ts +3 -0
- package/lib/pages/CategoryCollection/index.d.ts.map +1 -0
- package/lib/pages/CategoryCollection/index.js +3 -0
- package/lib/pages/CategoryCollection/index.js.map +1 -0
- package/lib/pages/Help/HelpIndex.d.ts +4 -0
- package/lib/pages/Help/HelpIndex.d.ts.map +1 -0
- package/lib/pages/Help/HelpIndex.js +44 -0
- package/lib/pages/Help/HelpIndex.js.map +1 -0
- package/lib/pages/Help/index.d.ts +4 -0
- package/lib/pages/Help/index.d.ts.map +1 -0
- package/lib/pages/Help/index.js +226 -0
- package/lib/pages/Help/index.js.map +1 -0
- package/lib/pages/Landing/index.d.ts +3 -0
- package/lib/pages/Landing/index.d.ts.map +1 -0
- package/lib/pages/Landing/index.js +281 -0
- package/lib/pages/Landing/index.js.map +1 -0
- package/lib/routes.json +2533 -0
- package/lib/seo.d.ts +22 -0
- package/lib/seo.d.ts.map +1 -0
- package/lib/slot-fill/FooterFill.d.ts +3 -0
- package/lib/slot-fill/FooterFill.d.ts.map +1 -0
- package/lib/slot-fill/FooterFill.js +18 -0
- package/lib/slot-fill/FooterFill.js.map +1 -0
- package/lib/slot-fill/LogoFill.d.ts +5 -0
- package/lib/slot-fill/LogoFill.d.ts.map +1 -0
- package/lib/slot-fill/LogoFill.js +74 -0
- package/lib/slot-fill/LogoFill.js.map +1 -0
- package/lib/slot-fill/consts.d.ts +5 -0
- package/lib/slot-fill/consts.d.ts.map +1 -0
- package/lib/slot-fill/consts.js +1 -0
- package/lib/slot-fill/consts.js.map +1 -0
- package/lib/slot-fill/index.d.ts +4 -0
- package/lib/slot-fill/index.d.ts.map +1 -0
- package/lib/templates/assets/images/add-link-frontend.png +0 -0
- package/lib/templates/assets/images/add-package-backend.png +0 -0
- package/lib/templates/assets/images/add-to-backend-module.png +0 -0
- package/lib/templates/assets/images/add-upload-client-frontend.png +0 -0
- package/lib/templates/assets/images/additional-parameters.png +0 -0
- package/lib/templates/assets/images/aeh-implementation.png +0 -0
- package/lib/templates/assets/images/aeh-usage.png +0 -0
- package/lib/templates/assets/images/apollo-client/recommendation_cache_mgmt.png +0 -0
- package/lib/templates/assets/images/app-deploy-new-version/jenkins1.PNG +0 -0
- package/lib/templates/assets/images/app-deploy-new-version/jenkins2.PNG +0 -0
- package/lib/templates/assets/images/auth-wrapper-code.png +0 -0
- package/lib/templates/assets/images/cdebase.png +0 -0
- package/lib/templates/assets/images/cdm-locales-directory.png +0 -0
- package/lib/templates/assets/images/client-settings.png +0 -0
- package/lib/templates/assets/images/codegen_file_update.png +0 -0
- package/lib/templates/assets/images/configuration.png +0 -0
- package/lib/templates/assets/images/copy-plugin.png +0 -0
- package/lib/templates/assets/images/docusaurus.png +0 -0
- package/lib/templates/assets/images/error-link.png +0 -0
- package/lib/templates/assets/images/error-sample.png +0 -0
- package/lib/templates/assets/images/extension copy.png +0 -0
- package/lib/templates/assets/images/extension.png +0 -0
- package/lib/templates/assets/images/graphql/graphql-folder-backend.png +0 -0
- package/lib/templates/assets/images/graphql/graphql-folder-with-gql.png +0 -0
- package/lib/templates/assets/images/i18n-config.png +0 -0
- package/lib/templates/assets/images/image.png +0 -0
- package/lib/templates/assets/images/logo.svg +10 -0
- package/lib/templates/assets/images/logo1.svg +1 -0
- package/lib/templates/assets/images/modify-upload-false-server.png +0 -0
- package/lib/templates/assets/images/navigation-auth-enabled.png +0 -0
- package/lib/templates/assets/images/org-dashboard-navigation.png +0 -0
- package/lib/templates/assets/images/org-navigation.png +0 -0
- package/lib/templates/assets/images/preferences_graphql_type.png +0 -0
- package/lib/templates/assets/images/provider.png +0 -0
- package/lib/templates/assets/images/route-config.png +0 -0
- package/lib/templates/assets/images/service-accounts.png +0 -0
- package/lib/templates/assets/images/source-code/source-code-environments.png +0 -0
- package/lib/templates/assets/images/source-code/source-code-organization.png +0 -0
- package/lib/templates/assets/images/spin-clone-develop-deployment/jenkins-changes.png +0 -0
- package/lib/templates/assets/images/spin-clone-develop-deployment/lerna-changes.png +0 -0
- package/lib/templates/assets/images/spin-clone-develop-deployment/root-package-json-changes.png +0 -0
- package/lib/templates/assets/images/spin-clone-develop-deployment/values-dev-changes.png +0 -0
- package/lib/templates/assets/images/sso-mappers.png +0 -0
- package/lib/templates/assets/images/sso-picture-mapper.png +0 -0
- package/lib/templates/assets/images/sso-settings.png +0 -0
- package/lib/templates/assets/images/timesheet_apollo_cache.png +0 -0
- package/lib/templates/assets/images/timesheet_query.png +0 -0
- package/lib/templates/assets/images/tutorial/docsVersionDropdown.png +0 -0
- package/lib/templates/assets/images/tutorial/localeDropdown.png +0 -0
- package/lib/templates/assets/images/unauthenticated.png +0 -0
- package/lib/templates/assets/images/undraw_docusaurus_mountain.svg +170 -0
- package/lib/templates/assets/images/undraw_docusaurus_react.svg +169 -0
- package/lib/templates/assets/images/undraw_docusaurus_tree.svg +1 -0
- package/lib/templates/assets/images/vite-plugin-config.png +0 -0
- package/lib/templates/content/docs/Generators/Project/generate-fullproject.md +12 -0
- package/lib/templates/content/docs/LLM/Logger.llm.md +194 -0
- package/lib/templates/content/docs/LLM/backend-proxies-services-llm.md +2687 -0
- package/lib/templates/content/docs/LLM/backend-service-llm.md +3384 -0
- package/lib/templates/content/docs/LLM/db_migration_llm.md +954 -0
- package/lib/templates/content/docs/LLM/frontend/REMIX-15.3-upgrade-llm.md +1245 -0
- package/lib/templates/content/docs/LLM/inngest/INNGEST_FUNCTION_DEVELOPMENT_GUIDE_LLM.md +1241 -0
- package/lib/templates/content/docs/LLM/inngest/INNGEST_NAMESPACE_LLM.md +384 -0
- package/lib/templates/content/docs/LLM/llm_workflow_namespace.md +384 -0
- package/lib/templates/content/docs/LLM/organization-components-form-llm.md +1395 -0
- package/lib/templates/content/docs/LLM/page-component-llm.md +173 -0
- package/lib/templates/content/docs/LLM/preferences-settings-llm.md +2781 -0
- package/lib/templates/content/docs/LLM/tailwind-css-llm.md +502 -0
- package/lib/templates/content/docs/UI/SchemaBasedUI.md +334 -0
- package/lib/templates/content/docs/UI/SlotFillComponent.md +334 -0
- package/lib/templates/content/docs/adminide-modules/account/auth0-login.md +31 -0
- package/lib/templates/content/docs/adminide-modules/account/index.md +14 -0
- package/lib/templates/content/docs/adminide-modules/account/keycloak-remix-setup.md +86 -0
- package/lib/templates/content/docs/adminide-modules/account/remix-auth-setup.md +79 -0
- package/lib/templates/content/docs/adminide-modules/account/various-auth-qatest.md +157 -0
- package/lib/templates/content/docs/adminide-modules/api-builders/graphql.md +906 -0
- package/lib/templates/content/docs/adminide-modules/billing/payments/index.md +14 -0
- package/lib/templates/content/docs/adminide-modules/billing/payments/stripe/index.md +14 -0
- package/lib/templates/content/docs/adminide-modules/billing/payments/stripe/settingup-stripe-locally.md +25 -0
- package/lib/templates/content/docs/adminide-modules/billing/tier-config.md +293 -0
- package/lib/templates/content/docs/adminide-modules/connectors/Connector.md +207 -0
- package/lib/templates/content/docs/adminide-modules/file-upload/index.md +16 -0
- package/lib/templates/content/docs/adminide-modules/file-upload/setup.md +435 -0
- package/lib/templates/content/docs/adminide-modules/file-upload/upload-file-using-signed-url.md +161 -0
- package/lib/templates/content/docs/adminide-modules/preferences/AddAdditionalPermissions.md +151 -0
- package/lib/templates/content/docs/adminide-modules/preferences/Configuration.md +241 -0
- package/lib/templates/content/docs/adminide-modules/preferences/Policy-Configuration.md +61 -0
- package/lib/templates/content/docs/adminide-modules/preferences/UI-components/ResourceSettingsLoader.md +319 -0
- package/lib/templates/content/docs/adminide-modules/preferences/contribute_scope_target.md +280 -0
- package/lib/templates/content/docs/adminide-modules/preferences/generate-urii.md +94 -0
- package/lib/templates/content/docs/adminide-modules/preferences/index.md +28 -0
- package/lib/templates/content/docs/adminide-modules/preferences/machine-configuration.md +157 -0
- package/lib/templates/content/docs/adminide-modules/preferences/pageSettings/generateCdecodeUri.md +1289 -0
- package/lib/templates/content/docs/adminide-modules/preferences/pageSettings/migratingFromUseSettings.md +215 -0
- package/lib/templates/content/docs/adminide-modules/preferences/permissions/Roles-Permissions.md +72 -0
- package/lib/templates/content/docs/adminide-modules/preferences/permissions/settingUserPermissions.md +139 -0
- package/lib/templates/content/docs/adminide-modules/preferences/preference-dependency.md +138 -0
- package/lib/templates/content/docs/adminide-modules/preferences/route-based-configuration.md +41 -0
- package/lib/templates/content/docs/adminide-modules/preferences/schema-configuration.md +71 -0
- package/lib/templates/content/docs/adminide-modules/preferences/supported.md +24 -0
- package/lib/templates/content/docs/adminide-modules/preferences/useSettingsLoader.md +248 -0
- package/lib/templates/content/docs/adminide-modules/project-tools/auth-providers.md +1317 -0
- package/lib/templates/content/docs/adminide-modules/project-tools/keycloak-guide.md +543 -0
- package/lib/templates/content/docs/adminide-modules/project-tools/tenant-management/tenant-based-authentication.md +846 -0
- package/lib/templates/content/docs/adminide-modules/project-tools/tenant-management/tenant-management.md +708 -0
- package/lib/templates/content/docs/adminide-modules/project-tools/tenant-management/tenants.md +1117 -0
- package/lib/templates/content/docs/chrome-extension/index.md +14 -0
- package/lib/templates/content/docs/chrome-extension/setup.md +30 -0
- package/lib/templates/content/docs/contributing/adding-package.md +23 -0
- package/lib/templates/content/docs/contributing/adding_new_modules.md +99 -0
- package/lib/templates/content/docs/contributing/architecture-updates.md +19 -0
- package/lib/templates/content/docs/contributing/avoid-using-promises-ui.md +116 -0
- package/lib/templates/content/docs/contributing/coding-guidelines.md +111 -0
- package/lib/templates/content/docs/contributing/do-and-dont.md +42 -0
- package/lib/templates/content/docs/contributing/faq.md +22 -0
- package/lib/templates/content/docs/contributing/folder-setup/browser.md +12 -0
- package/lib/templates/content/docs/contributing/folder-setup/config.md +12 -0
- package/lib/templates/content/docs/contributing/folder-setup/containers-server.md +12 -0
- package/lib/templates/content/docs/contributing/folder-setup/core.md +12 -0
- package/lib/templates/content/docs/contributing/folder-setup/graphql.md +12 -0
- package/lib/templates/content/docs/contributing/folder-setup/index.md +30 -0
- package/lib/templates/content/docs/contributing/folder-setup/module.md +12 -0
- package/lib/templates/content/docs/contributing/folder-setup/server.md +12 -0
- package/lib/templates/content/docs/contributing/folder-setup/services.md +12 -0
- package/lib/templates/content/docs/contributing/folder-setup/store.md +12 -0
- package/lib/templates/content/docs/contributing/frontend-coding.md +30 -0
- package/lib/templates/content/docs/contributing/git-subtree-sharing.md +73 -0
- package/lib/templates/content/docs/contributing/graphql-subscriptions.md +69 -0
- package/lib/templates/content/docs/contributing/how-to-contribute.md +30 -0
- package/lib/templates/content/docs/contributing/how_to_check_pure_esm.md +29 -0
- package/lib/templates/content/docs/contributing/index.md +60 -0
- package/lib/templates/content/docs/contributing/installation-issues.md +23 -0
- package/lib/templates/content/docs/contributing/keyboard-shortcut.md +131 -0
- package/lib/templates/content/docs/contributing/language/locale-support.md +12 -0
- package/lib/templates/content/docs/contributing/lerna-build-tools.md +516 -0
- package/lib/templates/content/docs/contributing/lerna-yarn-workspaces.md +95 -0
- package/lib/templates/content/docs/contributing/lint-and-formatter.md +20 -0
- package/lib/templates/content/docs/contributing/mobile-setup.md +16 -0
- package/lib/templates/content/docs/contributing/project-setup.md +233 -0
- package/lib/templates/content/docs/contributing/react/index.md +14 -0
- package/lib/templates/content/docs/contributing/react/lazy-component.md +70 -0
- package/lib/templates/content/docs/contributing/run-various-options.md +124 -0
- package/lib/templates/content/docs/contributing/schema-first-graphql-types.md +37 -0
- package/lib/templates/content/docs/contributing/source-code-organization.md +57 -0
- package/lib/templates/content/docs/contributing/staging-docker.md +88 -0
- package/lib/templates/content/docs/contributing/third-party/apollo-client-v3-tutorials.md +28 -0
- package/lib/templates/content/docs/contributing/third-party/index.md +18 -0
- package/lib/templates/content/docs/contributing/typescript-contribution.md +16 -0
- package/lib/templates/content/docs/devops/app-deploy-new-version.md +30 -0
- package/lib/templates/content/docs/devops/index.md +14 -0
- package/lib/templates/content/docs/devops/mobile-jenkins-build.md +40 -0
- package/lib/templates/content/docs/devops/versioning-the-project.md +128 -0
- package/lib/templates/content/docs/error-handler/application-error-handler.md +40 -0
- package/lib/templates/content/docs/error-handler/error-handling.md +26 -0
- package/lib/templates/content/docs/error-handler/index.md +16 -0
- package/lib/templates/content/docs/error-handler/logging-errors.md +14 -0
- package/lib/templates/content/docs/feature-api/copy-operation.md +427 -0
- package/lib/templates/content/docs/feature-api/feature-browser/assets.md +46 -0
- package/lib/templates/content/docs/feature-api/feature-browser/auth-permissions.md +12 -0
- package/lib/templates/content/docs/feature-api/feature-browser/feature.md +131 -0
- package/lib/templates/content/docs/feature-api/feature-browser/index.md +22 -0
- package/lib/templates/content/docs/feature-api/feature-browser/routes-menu.md +110 -0
- package/lib/templates/content/docs/feature-api/feature-browser/routing-convention.md +124 -0
- package/lib/templates/content/docs/feature-api/feature-browser/routing.md +338 -0
- package/lib/templates/content/docs/feature-api/feature-mobile/auth-permissions.md +20 -0
- package/lib/templates/content/docs/feature-api/feature-mobile/feature.md +130 -0
- package/lib/templates/content/docs/feature-api/feature-mobile/index.md +18 -0
- package/lib/templates/content/docs/feature-api/feature-mobile/navigation.md +187 -0
- package/lib/templates/content/docs/feature-api/feature-server/Scheduling.md +44 -0
- package/lib/templates/content/docs/feature-api/feature-server/dataloader.md +320 -0
- package/lib/templates/content/docs/feature-api/feature-server/dependency-injection.md +81 -0
- package/lib/templates/content/docs/feature-api/feature-server/feature.md +65 -0
- package/lib/templates/content/docs/feature-api/feature-server/generic-dataloader.md +135 -0
- package/lib/templates/content/docs/feature-api/feature-server/index.md +40 -0
- package/lib/templates/content/docs/feature-api/feature-server/migration.md +127 -0
- package/lib/templates/content/docs/feature-api/feature-server/mongo-model.md +72 -0
- package/lib/templates/content/docs/feature-api/feature-server/permissions.md +12 -0
- package/lib/templates/content/docs/feature-api/feature-server/policies.md +57 -0
- package/lib/templates/content/docs/feature-api/feature-server/preferences.md +57 -0
- package/lib/templates/content/docs/feature-api/feature-server/repositories.md +114 -0
- package/lib/templates/content/docs/feature-api/feature-server/resolvers.md +126 -0
- package/lib/templates/content/docs/feature-api/feature-server/rules.md +132 -0
- package/lib/templates/content/docs/feature-api/feature-server/schema.md +12 -0
- package/lib/templates/content/docs/feature-api/feature-server/services.md +102 -0
- package/lib/templates/content/docs/feature-api/feature-server/setup-resource-crud.md +359 -0
- package/lib/templates/content/docs/feature-api/index.md +18 -0
- package/lib/templates/content/docs/graphql/apolloClient-mutation.md +94 -0
- package/lib/templates/content/docs/graphql/index.md +14 -0
- package/lib/templates/content/docs/graphql/scalars.md +15 -0
- package/lib/templates/content/docs/help/index.md +14 -0
- package/lib/templates/content/docs/help/intro.md +16 -0
- package/lib/templates/content/docs/intl/ant-design-menu-translation.md +74 -0
- package/lib/templates/content/docs/intl/intl-namespace.md +129 -0
- package/lib/templates/content/docs/intl/vite-plugin-intl.md +87 -0
- package/lib/templates/content/docs/intl/webpack-plugin-intl.md +12 -0
- package/lib/templates/content/docs/intro.md +18 -0
- package/lib/templates/content/docs/knowledge/basic-fullstack.md +238 -0
- package/lib/templates/content/docs/mailing/index.md +14 -0
- package/lib/templates/content/docs/mailing/mailing-template.md +148 -0
- package/lib/templates/content/docs/mobile/App-navigation-generator.md +410 -0
- package/lib/templates/content/docs/mobile/MobileTestCases.md +264 -0
- package/lib/templates/content/docs/mobile/eas-profile-build.md +107 -0
- package/lib/templates/content/docs/mobile/expo-push-notification-setup.md +216 -0
- package/lib/templates/content/docs/mobile/index.md +14 -0
- package/lib/templates/content/docs/mobile/routes.md +83 -0
- package/lib/templates/content/docs/organization/adding-account-context.md +116 -0
- package/lib/templates/content/docs/organization/adding-org-mobile-navigation.md +22 -0
- package/lib/templates/content/docs/organization/adding-org-web-navigation.md +12 -0
- package/lib/templates/content/docs/organization/index.md +20 -0
- package/lib/templates/content/docs/organization/initialization.md +20 -0
- package/lib/templates/content/docs/organization/organization-resource-vs-resource.md +112 -0
- package/lib/templates/content/docs/remix/configuration/component-structure-best-practices.md +152 -0
- package/lib/templates/content/docs/remix/configuration/configurations.md +218 -0
- package/lib/templates/content/docs/remix/configuration/css-import-and-stylesheets.md +142 -0
- package/lib/templates/content/docs/remix/configuration/dont-subcomponent-network.md +166 -0
- package/lib/templates/content/docs/remix/configuration/generated-data-loaders.md +122 -0
- package/lib/templates/content/docs/remix/configuration/generated-resource-loaders.md +257 -0
- package/lib/templates/content/docs/remix/configuration/query-params-generator.md +216 -0
- package/lib/templates/content/docs/remix/configuration/routes-extra-icons.md +103 -0
- package/lib/templates/content/docs/remix/configuration/routes-json-advanced.md +86 -0
- package/lib/templates/content/docs/remix/configuration/routes-json-auth.md +113 -0
- package/lib/templates/content/docs/remix/configuration/routes-json-best-practices.md +55 -0
- package/lib/templates/content/docs/remix/configuration/routes-json-fields.md +79 -0
- package/lib/templates/content/docs/remix/configuration/routes-json-graphql.md +79 -0
- package/lib/templates/content/docs/remix/configuration/routes-json-index.md +112 -0
- package/lib/templates/content/docs/remix/configuration/routes-json-loaders.md +165 -0
- package/lib/templates/content/docs/remix/configuration/routes-json-middleware.md +196 -0
- package/lib/templates/content/docs/remix/configuration/routes-json-overview.md +53 -0
- package/lib/templates/content/docs/remix/data-loaders.md +43 -0
- package/lib/templates/content/docs/remix/devtools/remix-devtools.md +58 -0
- package/lib/templates/content/docs/remix/examples/changes-using-servercode.md +79 -0
- package/lib/templates/content/docs/remix/extra-icons.md +62 -0
- package/lib/templates/content/docs/remix/extra-links.md +65 -0
- package/lib/templates/content/docs/remix/generated-data-loaders.md +114 -0
- package/lib/templates/content/docs/remix/queryParamsGenerator.md +89 -0
- package/lib/templates/content/docs/remix/resources.md +16 -0
- package/lib/templates/content/docs/remix/styles.md +132 -0
- package/lib/templates/content/docs/remix/wiki.md +12 -0
- package/lib/templates/content/docs/security/auth-wrapper/auth-wrapper.md +24 -0
- package/lib/templates/content/docs/security/index.md +18 -0
- package/lib/templates/content/docs/security/secure-button-mobilenative.md +88 -0
- package/lib/templates/content/docs/security/secure-button-web.md +89 -0
- package/lib/templates/content/docs/server-side/account-customization.md +82 -0
- package/lib/templates/content/docs/server-side/apollo/caching.md +164 -0
- package/lib/templates/content/docs/server-side/backend-architecture/FINAL-DECISION.md +209 -0
- package/lib/templates/content/docs/server-side/backend-architecture/TRUE-FINAL-ARCHITECTURE.md +603 -0
- package/lib/templates/content/docs/server-side/backend-architecture/index1.md +0 -0
- package/lib/templates/content/docs/server-side/backend-coding.md +839 -0
- package/lib/templates/content/docs/server-side/e2b/manageing-template.md +197 -0
- package/lib/templates/content/docs/server-side/index.md +14 -0
- package/lib/templates/content/docs/server-side/inngest-functions-module.md +309 -0
- package/lib/templates/content/docs/server-side/listen-stripe-events.md +43 -0
- package/lib/templates/content/docs/server-side/slug-service.md +323 -0
- package/lib/templates/content/docs/tests/index.md +18 -0
- package/lib/templates/content/docs/tests/jest-test-debug-vscode.md +40 -0
- package/lib/templates/content/docs/tests/known-errors.md +116 -0
- package/lib/templates/content/docs/tests/service-test-template.md +118 -0
- package/lib/templates/content/docs/tests/test-setup.md +93 -0
- package/lib/templates/content/docs/xstate.md +23 -0
- package/lib/types.d.ts +37 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/utils/docsNavigation.d.ts +9 -0
- package/lib/utils/docsNavigation.d.ts.map +1 -0
- package/lib/utils/docsNavigation.js +37 -0
- package/lib/utils/docsNavigation.js.map +1 -0
- package/lib/utils/helpCenterUtils.d.ts +26 -0
- package/lib/utils/helpCenterUtils.d.ts.map +1 -0
- package/lib/utils/index.d.ts +3 -0
- package/lib/utils/index.d.ts.map +1 -0
- package/lib/utils/index.js +3 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/markdownLoader.d.ts +36 -0
- package/lib/utils/markdownLoader.d.ts.map +1 -0
- package/lib/utils/markdownLoader.js +2242 -0
- package/lib/utils/markdownLoader.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
---
|
|
2
|
+
meta:
|
|
3
|
+
title: Setup
|
|
4
|
+
description: Setup
|
|
5
|
+
date: '2023-06-02T00:00:00'
|
|
6
|
+
updated: '2024-06-02T00:00:00'
|
|
7
|
+
excerpt: Setup...
|
|
8
|
+
headers:
|
|
9
|
+
Cache-Control: no-cache
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Setup
|
|
13
|
+
|
|
14
|
+
1. Add env variables to `config/development/dev.env`. Ask your admin for details.
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
# AWS S3
|
|
18
|
+
AWS_S3_ACCESS_KEY_ID=
|
|
19
|
+
AWS_S3_BUCKET=
|
|
20
|
+
AWS_S3_REGION=ca-central-1
|
|
21
|
+
AWS_S3_SECRET_ACCESS_KEY=
|
|
22
|
+
AWS_S3_SIGNATURE_VERSION=v4
|
|
23
|
+
# Image Processing Credentials
|
|
24
|
+
IMAGE_PROCESSING_SERVICE=
|
|
25
|
+
PROPERTY_IMAGE_WIDTH=800
|
|
26
|
+
PROPERTY_IMAGE_WIDTH=800
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
2. (backend) Add File Info Server package to backend package.json
|
|
30
|
+

|
|
31
|
+
3. (backend) Update the module to include the `FileInfoModule` in the `External Modules`
|
|
32
|
+

|
|
33
|
+
4. Disable ApolloServer native upload by setting to false.
|
|
34
|
+

|
|
35
|
+
5. (frontend) Add or Make sure `apollo-upload-client` package with version `@16.0.0` is in the forntend's package.json.
|
|
36
|
+

|
|
37
|
+
6. (frontend) Modify the `base-apollo-client.ts` file to make upload link as termination link as followed.
|
|
38
|
+

|
|
39
|
+
7. Run `yarn` to install the added packages.
|
|
40
|
+
|
|
41
|
+
The above code adds `Upload` resolver and Schema Scalar that you use in the Graphql Schema
|
|
42
|
+
|
|
43
|
+
## Backend Coding
|
|
44
|
+
|
|
45
|
+
1. Add required Mutation and Query in the `server` package.
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
type Profile {
|
|
49
|
+
id: ID!
|
|
50
|
+
user: UserAccount!
|
|
51
|
+
photos: [FileInfo!] <--- To get File Links
|
|
52
|
+
about: String
|
|
53
|
+
location: String
|
|
54
|
+
work: String
|
|
55
|
+
languages: [Language!]
|
|
56
|
+
createdAt: String!
|
|
57
|
+
updatedAt: String!
|
|
58
|
+
}
|
|
59
|
+
input ProfileInput {
|
|
60
|
+
about: String
|
|
61
|
+
user: String
|
|
62
|
+
location: String
|
|
63
|
+
work: String
|
|
64
|
+
languages: [String!]
|
|
65
|
+
photos: [String!]
|
|
66
|
+
}
|
|
67
|
+
input ProfileUpdateInput {
|
|
68
|
+
about: String
|
|
69
|
+
location: String
|
|
70
|
+
work: String
|
|
71
|
+
languages: [String!]
|
|
72
|
+
photos: [String!]
|
|
73
|
+
}
|
|
74
|
+
extend type Query {
|
|
75
|
+
profile: Profile! @isAuthenticated @addAccountContext
|
|
76
|
+
}
|
|
77
|
+
extend enum IFIleRefType {
|
|
78
|
+
Profile
|
|
79
|
+
}
|
|
80
|
+
extend type Mutation {
|
|
81
|
+
updateProfile(id: ID!, profile: ProfileUpdateInput!): Profile! @isAuthenticated @addAccountContext
|
|
82
|
+
uploadPhoto(id: ID!, image: Upload!): String! @isAuthenticated @addAccountContext <-- Image are passed
|
|
83
|
+
deletePhoto(url: String!): Boolean @isAuthenticated @addAccountContext
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
2. Use graphql code generate to generate queries and mutation and run build on the packages where it changes.
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
yarn generateGraphql
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
3. Add model to have reference to the file info
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
const profileModelSchema = new Schema<IProfileModel>(
|
|
97
|
+
{
|
|
98
|
+
user: { type: Schema.Types.ObjectId, ref: 'users', required: true },
|
|
99
|
+
about: { type: Schema.Types.String, default: '', required: false },
|
|
100
|
+
location: { type: Schema.Types.String, default: '', required: false },
|
|
101
|
+
work: { type: Schema.Types.String, default: '', required: false },
|
|
102
|
+
photos: [{ type: Schema.Types.ObjectId }], <-----reference ID of the FileInfo
|
|
103
|
+
languages: [{ type: Schema.Types.ObjectId, ref: 'languages' }],
|
|
104
|
+
},
|
|
105
|
+
commonModeSchemaOptions,
|
|
106
|
+
);
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
4. Update service to use fileinfo service for uploading and retrieving images.
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
import { inject, injectable } from 'inversify';
|
|
113
|
+
import { IAccountService, TYPES as AccountTypes } from '@adminide-stack/account-api-core';
|
|
114
|
+
import { File, IFileInfoService, IFileInfo, TYPES as FileUploadTypes } from '@container-stack/file-info-core';
|
|
115
|
+
import { IIFIleRefType, IProfile, IProfileInput, IProfileUpdateInput } from '@container-stack/core';
|
|
116
|
+
import { IBaseService, BaseService } from '@common-stack/store-mongo';
|
|
117
|
+
import { TYPES } from '../constants';
|
|
118
|
+
import { ProfileRepository } from '../store/repositories';
|
|
119
|
+
@injectable()
|
|
120
|
+
export class ProfileService
|
|
121
|
+
extends BaseService<IProfile, IProfileInput, IProfileUpdateInput>
|
|
122
|
+
implements IBaseService<IProfile, IProfileInput, IProfileUpdateInput>
|
|
123
|
+
{
|
|
124
|
+
constructor(
|
|
125
|
+
@inject(TYPES.ProfileRepository)
|
|
126
|
+
repository: ProfileRepository,
|
|
127
|
+
@inject(AccountTypes.IAccountService)
|
|
128
|
+
private readonly accountService: IAccountService,
|
|
129
|
+
@inject(FileUploadTypes.FileInfoService)
|
|
130
|
+
private readonly fileInfoService: IFileInfoService,
|
|
131
|
+
) {
|
|
132
|
+
super(repository);
|
|
133
|
+
}
|
|
134
|
+
async detachImage(url: string): Promise<boolean> {
|
|
135
|
+
const image = await this.fileInfoService.getByUrl(url);
|
|
136
|
+
const profileId = image.ref.toString();
|
|
137
|
+
const session = await this.repository.model.db.startSession();
|
|
138
|
+
session.startTransaction();
|
|
139
|
+
try {
|
|
140
|
+
await this.update(profileId, {
|
|
141
|
+
$pull: {
|
|
142
|
+
photos: image.id,
|
|
143
|
+
},
|
|
144
|
+
} as unknown as IProfileUpdateInput);
|
|
145
|
+
await this.fileInfoService.delete(image.id);
|
|
146
|
+
await session.commitTransaction();
|
|
147
|
+
} catch (e) {
|
|
148
|
+
await session.abortTransaction();
|
|
149
|
+
throw e;
|
|
150
|
+
} finally {
|
|
151
|
+
session.endSession();
|
|
152
|
+
}
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
async deletePhoto(url: string): Promise<boolean> {
|
|
156
|
+
console.log('==========DELETE PHOTO===========');
|
|
157
|
+
console.log(url);
|
|
158
|
+
const session = await this.repository.model.db.startSession();
|
|
159
|
+
session.startTransaction();
|
|
160
|
+
const image = await this.fileInfoService.getByUrl(url);
|
|
161
|
+
console.log(image);
|
|
162
|
+
const profileId = image.ref.toString();
|
|
163
|
+
console.log(profileId);
|
|
164
|
+
try {
|
|
165
|
+
await this.fileInfoService.delete(image.id);
|
|
166
|
+
console.log(image.id);
|
|
167
|
+
await this.update(profileId, {
|
|
168
|
+
$pull: {
|
|
169
|
+
photos: image.id,
|
|
170
|
+
},
|
|
171
|
+
} as unknown as IProfileUpdateInput);
|
|
172
|
+
await session.commitTransaction();
|
|
173
|
+
} catch (e) {
|
|
174
|
+
console.log(e);
|
|
175
|
+
await session.abortTransaction();
|
|
176
|
+
throw e;
|
|
177
|
+
} finally {
|
|
178
|
+
session.endSession();
|
|
179
|
+
}
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
async uploadPhoto(profileId: string, userId: string, image: Promise<File>): Promise<string> {
|
|
183
|
+
const session = await this.repository.model.db.startSession();
|
|
184
|
+
session.startTransaction();
|
|
185
|
+
let storedImage: IFileInfo;
|
|
186
|
+
try {
|
|
187
|
+
storedImage = await this.fileInfoService.create({
|
|
188
|
+
file: image,
|
|
189
|
+
createdBy: userId,
|
|
190
|
+
ref: profileId,
|
|
191
|
+
refType: IIFIleRefType.Profile,
|
|
192
|
+
});
|
|
193
|
+
await this.update(profileId, {
|
|
194
|
+
$push: { photos: storedImage.id },
|
|
195
|
+
} as unknown as IProfileUpdateInput);
|
|
196
|
+
await session.commitTransaction();
|
|
197
|
+
} catch (e) {
|
|
198
|
+
await session.abortTransaction();
|
|
199
|
+
if (storedImage?.url) {
|
|
200
|
+
await this.detachImage(storedImage.url);
|
|
201
|
+
}
|
|
202
|
+
throw e;
|
|
203
|
+
} finally {
|
|
204
|
+
session.endSession();
|
|
205
|
+
}
|
|
206
|
+
return storedImage?.url;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
5. Update resolver for `Profile` type we map the photo reference ID to pull the Photo URLs.
|
|
212
|
+
|
|
213
|
+
```
|
|
214
|
+
export const resolver = () => ({
|
|
215
|
+
Profile: {
|
|
216
|
+
async photos(src, args, { fileInfoService }) {
|
|
217
|
+
if (!src.photos || src.photos.length === 0) return [];
|
|
218
|
+
const res = await Promise.all(
|
|
219
|
+
src.photos.map(async (photo) => {
|
|
220
|
+
const p = await fileInfoService.get(photo);
|
|
221
|
+
return p;
|
|
222
|
+
}),
|
|
223
|
+
);
|
|
224
|
+
return res;
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
Query: {
|
|
228
|
+
async profile(_, args, { profileService, userContext }) {
|
|
229
|
+
const profiles = await profileService.getAll({ criteria: { user: userContext.accountId } });
|
|
230
|
+
if (profiles.length) return profiles[0];
|
|
231
|
+
const profile = await profileService.create({
|
|
232
|
+
user: userContext.accountId,
|
|
233
|
+
});
|
|
234
|
+
return profile;
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
Mutation: {
|
|
238
|
+
uploadPhoto(_, { id, image }, { profileService, userContext }) {
|
|
239
|
+
return profileService.uploadPhoto(id, userContext.accountId, image, userContext.accountId);
|
|
240
|
+
},
|
|
241
|
+
deletePhoto(_, { url }, { profileService }) {
|
|
242
|
+
return profileService.deletePhoto(url);
|
|
243
|
+
},
|
|
244
|
+
async updateProfile(_, { id, profile }, { profileService }) {
|
|
245
|
+
console.log('====================UPDATE PROFILE====================');
|
|
246
|
+
console.log(profile);
|
|
247
|
+
try {
|
|
248
|
+
const updated = await profileService.update(id, { ...profile });
|
|
249
|
+
console.log('====================UPDATED PROFILE====================');
|
|
250
|
+
console.log(updated);
|
|
251
|
+
return updated;
|
|
252
|
+
} catch (err) {
|
|
253
|
+
console.log(err);
|
|
254
|
+
return null;
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
});
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## Frontend Coding
|
|
262
|
+
|
|
263
|
+
1. Add required dependency `graphql-upload and @container-stack/file-info-core` in the package `package.json` and run `yarn` to install it.
|
|
264
|
+
|
|
265
|
+
For example if you using in profile package, then in the package.json file add below required packages.
|
|
266
|
+
|
|
267
|
+
`<sample-stack>/package-modules/profile/browser/package.json`
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
"dependencies": {
|
|
271
|
+
"graphql-upload": "12.0.0",
|
|
272
|
+
"@container-stack/file-info-core": "0.0.27",
|
|
273
|
+
.....
|
|
274
|
+
},
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
2. Write React Component to upload the image. Below code is based on `Chakra` UI.
|
|
278
|
+
|
|
279
|
+
```
|
|
280
|
+
import React from 'react';
|
|
281
|
+
import {
|
|
282
|
+
Box, Button, Flex, Image, AspectRatio, HStack, IconButton, useColorModeValue
|
|
283
|
+
} from '@chakra-ui/react';
|
|
284
|
+
import { DeleteIcon } from '@chakra-ui/icons';
|
|
285
|
+
import { Link as RouterLink } from 'react-router-dom';
|
|
286
|
+
import { HTML5Backend } from 'react-dnd-html5-backend';
|
|
287
|
+
import { ChevronRightIcon } from '@chakra-ui/icons';
|
|
288
|
+
import { DndProvider } from 'react-dnd';
|
|
289
|
+
import {
|
|
290
|
+
useUploadProfilePhotoMutation,
|
|
291
|
+
useProfileQuery,
|
|
292
|
+
useUpdateProfileMutation,
|
|
293
|
+
useDeleteProfilePhotoMutation,
|
|
294
|
+
} from '../../../../components/generated';
|
|
295
|
+
import { ImageCard } from '../components/ImageCard';
|
|
296
|
+
const ProfilePhoto = () => {
|
|
297
|
+
const { data: profileInfo, error: profileInfoError } = useProfileQuery({
|
|
298
|
+
variables: {}
|
|
299
|
+
});
|
|
300
|
+
const [isUploading, setIsUploading] = React.useState(false);
|
|
301
|
+
const [isDeleting, setIsDeleting] = React.useState(false);
|
|
302
|
+
const [uploadProfilePhoto] = useUploadProfilePhotoMutation();
|
|
303
|
+
const [updateProfile] = useUpdateProfileMutation();
|
|
304
|
+
const [deleteProfilePhoto] = useDeleteProfilePhotoMutation();
|
|
305
|
+
let hiddenInput = null;
|
|
306
|
+
const deletePhoto = () => {
|
|
307
|
+
deleteProfilePhoto({
|
|
308
|
+
variables: {
|
|
309
|
+
url: profileInfo?.profile?.photos[0].url
|
|
310
|
+
},
|
|
311
|
+
update: (cache, { data, errors }) => {
|
|
312
|
+
if (data) {
|
|
313
|
+
cache.modify({
|
|
314
|
+
fields: {
|
|
315
|
+
profile() { },
|
|
316
|
+
},
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
})
|
|
321
|
+
}
|
|
322
|
+
const handlePhotoSelect = (image: File) => {
|
|
323
|
+
setIsUploading(true);
|
|
324
|
+
uploadProfilePhoto({
|
|
325
|
+
variables: {
|
|
326
|
+
id: profileInfo?.profile?.id,
|
|
327
|
+
image
|
|
328
|
+
},
|
|
329
|
+
update: (cache, { data, errors }) => {
|
|
330
|
+
if (data) {
|
|
331
|
+
cache.modify({
|
|
332
|
+
fields: {
|
|
333
|
+
profile() { },
|
|
334
|
+
},
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
setIsUploading(false);
|
|
338
|
+
},
|
|
339
|
+
})
|
|
340
|
+
}
|
|
341
|
+
const moveImageCard = (dragIndex: number, hoverIndex: number) => {
|
|
342
|
+
let photos = profileInfo?.profile?.photos?.map(p => p.id);
|
|
343
|
+
let dragPhoto = photos[dragIndex];
|
|
344
|
+
photos.splice(dragIndex, 1);
|
|
345
|
+
photos.splice(hoverIndex, 0, dragPhoto);
|
|
346
|
+
updateProfile({
|
|
347
|
+
variables: {
|
|
348
|
+
id: profileInfo?.profile?.id,
|
|
349
|
+
profile: {
|
|
350
|
+
photos,
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
update: (cache, { data, errors }) => {
|
|
354
|
+
if (data) {
|
|
355
|
+
cache.modify({
|
|
356
|
+
fields: {
|
|
357
|
+
profile() { },
|
|
358
|
+
},
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
})
|
|
363
|
+
}
|
|
364
|
+
return (
|
|
365
|
+
<Box>
|
|
366
|
+
<DndProvider backend={HTML5Backend}>
|
|
367
|
+
<Flex px={{ base: '15px', md: '60px', lg: '120px' }} flexDir="column">
|
|
368
|
+
{/* Breadcrumb */}
|
|
369
|
+
<Box mt="30px">
|
|
370
|
+
<Flex direction="row" fontSize="14px" alignItems="center">
|
|
371
|
+
<RouterLink to="/profile"> Profile </RouterLink>
|
|
372
|
+
<ChevronRightIcon w={7} h={7} mx={1} />
|
|
373
|
+
<Box> Profile photos </Box>
|
|
374
|
+
</Flex>
|
|
375
|
+
<Box fontWeight="bold" fontSize="32px">
|
|
376
|
+
Profile photos
|
|
377
|
+
</Box>
|
|
378
|
+
</Box>
|
|
379
|
+
<Box w="100%" maxW="800px" mt="15px">
|
|
380
|
+
<Box borderWidth="1px" color={useColorModeValue('gray.500', 'gray.300')}>
|
|
381
|
+
<Box p="20px" backgroundColor={useColorModeValue("gray.200", "gray.600")} w="100%" fontSize="16px" borderBottomWidth={'1px'}>Profile Photo</Box>
|
|
382
|
+
<HStack w="100%" spacing={5} mb="30px" p="15px">
|
|
383
|
+
<Box width={{ base: '100%', lg: '250px' }} d="flex" alignItems="center" justifyContent="center">
|
|
384
|
+
<Box w="250px" h="250px" position="relative">
|
|
385
|
+
<AspectRatio ratio={1} width="250px" position="absolute">
|
|
386
|
+
<Image alt="photo" objectFit="cover" src={profileInfo?.profile?.photos && profileInfo?.profile?.photos.length > 0 ? profileInfo.profile.photos[0].url : 'https://a0.muscache.com/defaults/user_pic-225x225.png?v=3'} opacity={0.3}></Image>
|
|
387
|
+
</AspectRatio>
|
|
388
|
+
<AspectRatio ratio={1} width="250px" position="absolute">
|
|
389
|
+
<Image borderRadius="50%" alt="photo" objectFit="cover" src={profileInfo?.profile?.photos && profileInfo?.profile?.photos.length > 0 ? profileInfo.profile.photos[0].url : 'https://a0.muscache.com/defaults/user_pic-225x225.png?v=3'}></Image>
|
|
390
|
+
</AspectRatio>
|
|
391
|
+
{profileInfo?.profile?.photos && profileInfo?.profile?.photos.length !== 0 && <IconButton position="absolute" aria-label="photo-delete" icon={<DeleteIcon />} top="0px" right="0px" onClick={() => deletePhoto()}></IconButton>}
|
|
392
|
+
</Box>
|
|
393
|
+
</Box>
|
|
394
|
+
<Box flexGrow={1}>
|
|
395
|
+
<Box d="flex" width="100%" flexWrap="wrap">
|
|
396
|
+
{profileInfo?.profile?.photos && profileInfo?.profile?.photos?.map((photo, index) => (
|
|
397
|
+
<ImageCard
|
|
398
|
+
photo={photo.url}
|
|
399
|
+
id={photo.url}
|
|
400
|
+
index={index}
|
|
401
|
+
key={`photo_${index}`}
|
|
402
|
+
moveImageCard={moveImageCard}
|
|
403
|
+
/>
|
|
404
|
+
))}
|
|
405
|
+
</Box>
|
|
406
|
+
<Box mt="3" mb="3" letterSpacing="wide" fontSize={14} w="100%">
|
|
407
|
+
A profile photo that shows your face can help other hosts and guests get to know you. Airbnb requires all hosts to have a profile photo. We don’t require guests to have a profile photo, but hosts can. If you’re a guest, even if a host requires you to have a photo, they won’t be able to see it until your booking is confirmed.
|
|
408
|
+
</Box>
|
|
409
|
+
<Button
|
|
410
|
+
w="100%"
|
|
411
|
+
isLoading={isUploading}
|
|
412
|
+
loadingText={'Uploading...'}
|
|
413
|
+
onClick={() => hiddenInput.click()}
|
|
414
|
+
>
|
|
415
|
+
Upload a file from your computer
|
|
416
|
+
</Button>
|
|
417
|
+
</Box>
|
|
418
|
+
</HStack>
|
|
419
|
+
<input
|
|
420
|
+
hidden
|
|
421
|
+
multiple={false}
|
|
422
|
+
type="file"
|
|
423
|
+
accept="image/*"
|
|
424
|
+
ref={(el) => (hiddenInput = el)}
|
|
425
|
+
onChange={(e) => handlePhotoSelect(e.target.files[0])}
|
|
426
|
+
/>
|
|
427
|
+
</Box>
|
|
428
|
+
</Box>
|
|
429
|
+
</Flex>
|
|
430
|
+
</DndProvider>
|
|
431
|
+
</Box>
|
|
432
|
+
)
|
|
433
|
+
}
|
|
434
|
+
export default React.memo(ProfilePhoto);
|
|
435
|
+
```
|
package/lib/templates/content/docs/adminide-modules/file-upload/upload-file-using-signed-url.md
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
---
|
|
2
|
+
meta:
|
|
3
|
+
title: File Uploads
|
|
4
|
+
description: File Uploads
|
|
5
|
+
date: '2023-06-02T00:00:00'
|
|
6
|
+
updated: '2024-06-02T00:00:00'
|
|
7
|
+
excerpt: File Uploads...
|
|
8
|
+
headers:
|
|
9
|
+
Cache-Control: no-cache
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# File Uploads
|
|
13
|
+
|
|
14
|
+
File upload is the basic functionality for any application it is required to upload assets such as user avatar, files and other kind of documents.
|
|
15
|
+
In PubNGo the file upload feature is required for
|
|
16
|
+
|
|
17
|
+
- User Avatars
|
|
18
|
+
- Government IDs and related legal documents
|
|
19
|
+
- Property images
|
|
20
|
+
|
|
21
|
+
there are several options available when it comes to decide how an application will upload files, where it will store them for later use and how fast it can retrieve them for
|
|
22
|
+
later use. The retrieval of these files should be quick for better UX and overall application performance.
|
|
23
|
+
|
|
24
|
+
## AWS S3
|
|
25
|
+
|
|
26
|
+
For file uploads we are using [AWS S3](https://aws.amazon.com/s3/). Amazon S3 or Amazon Simple Storage Service is a service offered by Amazon Web Services
|
|
27
|
+
that provides object storage through a web service interface.
|
|
28
|
+
|
|
29
|
+
### Bucket
|
|
30
|
+
|
|
31
|
+
To upload your data (photos, videos, documents, etc.) to Amazon S3, you must first create an S3 bucket in one of the AWS Regions.
|
|
32
|
+
A bucket is a container for objects stored in Amazon S3. You can store any number of objects in a bucket and can have up to 100 buckets in your account.
|
|
33
|
+
[Read more](https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingBucket.html)
|
|
34
|
+
|
|
35
|
+
### Pre signed URL
|
|
36
|
+
|
|
37
|
+
All objects and buckets by default are private. The presigned URLs are useful if you want your
|
|
38
|
+
user/customer to be able to upload a specific object to your bucket, but you don't require them
|
|
39
|
+
to have AWS security credentials or permissions. [Read more](https://docs.aws.amazon.com/AmazonS3/latest/userguide/PresignedUrlUploadObject.html)
|
|
40
|
+
|
|
41
|
+
## Enabling File Uploads
|
|
42
|
+
|
|
43
|
+
To enable Pubngo to upload files, you should start with writing the supporting
|
|
44
|
+
mutations at the backend, for this documentation we'll follow the example of the Government ID.
|
|
45
|
+
|
|
46
|
+
### Server Side
|
|
47
|
+
|
|
48
|
+
In backend, we need to write mutations and respective resolvers for those. See Government ID
|
|
49
|
+
related [mutations](https://github.com/cdebase/pubngo/blob/develop/packages-modules/account-api/server/src/graphql/schema/user-schema.graphql#L76)
|
|
50
|
+
|
|
51
|
+
In general, you need two type of mutations
|
|
52
|
+
|
|
53
|
+
1. To generate Signed Upload Link
|
|
54
|
+
2. To attach uploaded image to resource
|
|
55
|
+
|
|
56
|
+
the names of the mutations can whatever you want but the argument should match
|
|
57
|
+
because all this information is required to fill up the underlying data model.
|
|
58
|
+
|
|
59
|
+
```graphql
|
|
60
|
+
input UploadedFileInput {
|
|
61
|
+
name: String!
|
|
62
|
+
mimeType: String!
|
|
63
|
+
size: Float!
|
|
64
|
+
width: Float
|
|
65
|
+
height: Float
|
|
66
|
+
url: String!
|
|
67
|
+
}
|
|
68
|
+
extend type Mutation {
|
|
69
|
+
# generate Signed Upload Link
|
|
70
|
+
createFileUploadLinks(filenames: [String!]!): [String!]! @isAuthenticated @addAccountContext
|
|
71
|
+
# To attach uploaded image to resource
|
|
72
|
+
attachGovernmentID(idType: IDType, images: [UploadedFileInput!]!): GovernmentID @isAuthenticated @addAccountContext
|
|
73
|
+
uploadVerifyImage(image: UploadedFileInput!): String @isAuthenticated @addAccountContext
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
createFileUploadLinks(_, { filenames }, { fileInfoService, userContext }) {
|
|
79
|
+
return Promise.all(
|
|
80
|
+
filenames.map((filename) =>
|
|
81
|
+
fileInfoService.uploadByUrl({
|
|
82
|
+
filename,
|
|
83
|
+
// ID of the resource
|
|
84
|
+
ref: userContext.accountId,
|
|
85
|
+
// Type of resource
|
|
86
|
+
refType: IFileRefType.Account as never,
|
|
87
|
+
// ID of the user who requested the upload
|
|
88
|
+
userId: userContext.accountId,
|
|
89
|
+
}),
|
|
90
|
+
),
|
|
91
|
+
);
|
|
92
|
+
},
|
|
93
|
+
attachGovernmentID(_, { idType, images }, { extendedAccountService, userContext }) {
|
|
94
|
+
return extendedAccountService.attachGovernmentID(idType, images, userContext.accountId);
|
|
95
|
+
},
|
|
96
|
+
uploadVerifyImage(_, { image }, { extendedAccountService, userContext }) {
|
|
97
|
+
return extendedAccountService.uploadVerifyImage(image, userContext.accountId);
|
|
98
|
+
},
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Client Side
|
|
102
|
+
|
|
103
|
+
From the client side all you need is to call these mutations in sequence and upload the image in between, following the above example
|
|
104
|
+
the sequence will look something like the following
|
|
105
|
+
|
|
106
|
+
1. Call `createFileUploadLinks` and you will receive an array of Signed URLS
|
|
107
|
+
2. Make an HTTP `put` request on the url with the actual file to upload the file directly to the AWS
|
|
108
|
+
3. Call `attachGovernmentID` and attach uploaded file with the meta information to the actual resource.
|
|
109
|
+
|
|
110
|
+
to avoid this repetitive effort we've already created a
|
|
111
|
+
React [hook](https://github.com/cdebase/pubngo/blob/develop/packages/pubngo-platform/browser/src/hooks/use-upload-image.ts#L46)
|
|
112
|
+
which takes care of everything. For usage of the hook we can look at the example of
|
|
113
|
+
Government ID [use case](https://github.com/cdebase/pubngo/blob/4cb4555866e66e8d8dfadf48fef9cee43e39b5e0/packages-modules/account-api/browser/src/components/PersonalInfo/AddGovernmentID.tsx#L48).
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
const { startUpload: attachID, called: governmentIDUploaded } = useUploadImage<never, { idType: IIDType }>({
|
|
117
|
+
createUploadLink: {
|
|
118
|
+
name: 'createFileUploadLinks',
|
|
119
|
+
mutation: useCreateFileUploadLinksMutation,
|
|
120
|
+
processVariables: (files) => ({
|
|
121
|
+
filenames: Array.isArray(files) ? files.map(({ name }) => name) : [files.name],
|
|
122
|
+
}),
|
|
123
|
+
},
|
|
124
|
+
saveUploadedFile: {
|
|
125
|
+
name: 'attachGovernmentID',
|
|
126
|
+
mutation: useAttachGovernmentIDMutation,
|
|
127
|
+
processVariables: (images, { idType }) => ({
|
|
128
|
+
idType,
|
|
129
|
+
images,
|
|
130
|
+
}),
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
const { startUpload: uploadFace, called: faceUploaded } = useUploadImage({
|
|
134
|
+
createUploadLink: {
|
|
135
|
+
name: 'createFileUploadLinks',
|
|
136
|
+
mutation: useCreateFileUploadLinksMutation,
|
|
137
|
+
processVariables: (files) => ({
|
|
138
|
+
filenames: Array.isArray(files) ? files.map(({ name }) => name) : [files.name],
|
|
139
|
+
}),
|
|
140
|
+
},
|
|
141
|
+
saveUploadedFile: {
|
|
142
|
+
name: 'uploadVerifyImage',
|
|
143
|
+
mutation: useUploadVerifyImageMutation,
|
|
144
|
+
processVariables: (image) => ({
|
|
145
|
+
image: Array.isArray(image) ? image[0] : image,
|
|
146
|
+
}),
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
The hook takes two arguments
|
|
152
|
+
|
|
153
|
+
- createUploadLink
|
|
154
|
+
- saveUploadedFile
|
|
155
|
+
|
|
156
|
+
both of them have same object structure
|
|
157
|
+
|
|
158
|
+
- name (Name of the mutation being called)
|
|
159
|
+
- mutation (Apollo Mutation Hook)
|
|
160
|
+
- processVariables
|
|
161
|
+
- This function will return the exact variables needed by the mutation.
|