@cdmbase/wiki-browser 12.0.18-alpha.10
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,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
meta:
|
|
3
|
+
title: Dependency Injection
|
|
4
|
+
description: Dependency Injection
|
|
5
|
+
date: '2023-06-02T00:00:00'
|
|
6
|
+
updated: '2024-06-02T00:00:00'
|
|
7
|
+
excerpt: Dependency Injection...
|
|
8
|
+
headers:
|
|
9
|
+
Cache-Control: no-cache
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Dependency Injection
|
|
13
|
+
|
|
14
|
+
## What is DI
|
|
15
|
+
|
|
16
|
+
As our applications grow and evolves, each one of our code entities will internally require instances of other objects,
|
|
17
|
+
which are better known as dependencies
|
|
18
|
+
in the world of software engineering. The action of passing such `dependencies` to the dependent client is known
|
|
19
|
+
as `injection`, and it also entails the participation
|
|
20
|
+
of another code entity, named the `injector`. The injector will take responsibility for instantiating and bootstrapping
|
|
21
|
+
the required dependencies so they are ready for
|
|
22
|
+
use from the very moment they are successfully injected in the client. This is very important since the client knows
|
|
23
|
+
nothing about how to instantiate its own dependencies
|
|
24
|
+
and is only aware of the interface they implement in order to use them.
|
|
25
|
+
|
|
26
|
+
In short, `DI` helps you write code in a loosely coupled way and makes your code more testable and reusable.”
|
|
27
|
+
|
|
28
|
+
### How to register
|
|
29
|
+
|
|
30
|
+
To achieve `DI` in our Ap, we are using [InversifyJS](https://inversify.io/). This doc will walk you through on how to
|
|
31
|
+
register your entities such
|
|
32
|
+
as classes (services,repositories) and constants with the dependency injection.
|
|
33
|
+
`Feature` server API exposes two ways to register entities with the DI, which are following using
|
|
34
|
+
either `createContainerFunc` and `createHemeraContainerFunc`.
|
|
35
|
+
|
|
36
|
+
- `createContainerFunc` entities registered via this options will be registered locally inside the gateway
|
|
37
|
+
- `createHemeraContainerFunc`entities registered via this options will be registered as external to gateway and local to
|
|
38
|
+
micro service.
|
|
39
|
+
|
|
40
|
+
Both of these options take a function which has inversify `settings` as param and expects and
|
|
41
|
+
Inverisfy `ContainerModule` as return value `(settings) => interfaces.ContainerModule`
|
|
42
|
+
These functions by convention resides inside `container/container.ts` file
|
|
43
|
+
|
|
44
|
+
### Example
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import { ContainerModule, interfaces } from 'inversify';
|
|
48
|
+
|
|
49
|
+
export const localContainerModule: (settings) => interfaces.ContainerModule = () =>
|
|
50
|
+
new ContainerModule((bind: interfaces.Bind) => {
|
|
51
|
+
bind(TYPES.UserRepository).to(UserRepository).inSingletonScope().whenTargetIsDefault();
|
|
52
|
+
bind('MongodbMigration').to(DefaultUserMigration).whenTargetNamed(DefaultUserMigration.name);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export const externalContainerModule: (settings) => interfaces.ContainerModule = () =>
|
|
56
|
+
new ContainerModule((bind: interfaces.Bind) => {
|
|
57
|
+
bind(TYPES.UserRepository).to(UserRepository).inSingletonScope().whenTargetIsDefault();
|
|
58
|
+
bind(TYPES.UserService).to(UserService).inSingletonScope().whenTargetIsDefault();
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export default new Feature({
|
|
62
|
+
//... Other options
|
|
63
|
+
createContainerFunc: [localContainerModule],
|
|
64
|
+
createHemeraContainerFunc: [externalContainerModule],
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Once the entities are registered, those can be easily injected anywhere when needed.
|
|
69
|
+
|
|
70
|
+
### Usage
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
export class UserService extends BaseService<IUser> {
|
|
74
|
+
constructor(
|
|
75
|
+
@inject(TYPES.UserRepository)
|
|
76
|
+
repository: IUserRepository,
|
|
77
|
+
) {
|
|
78
|
+
super(repository);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
meta:
|
|
3
|
+
title: Feature Server API
|
|
4
|
+
description: Feature Server API
|
|
5
|
+
date: '2023-06-02T00:00:00'
|
|
6
|
+
updated: '2024-06-02T00:00:00'
|
|
7
|
+
excerpt: Feature Server API...
|
|
8
|
+
headers:
|
|
9
|
+
Cache-Control: no-cache
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Feature Server API
|
|
13
|
+
|
|
14
|
+
Similar to Feature Browser API, the backend Feature API support all that need to run the backend application.
|
|
15
|
+
|
|
16
|
+
It is opiniated and it supports
|
|
17
|
+
|
|
18
|
+
- graphql-server such as resolvers, schema, directives, datasource
|
|
19
|
+
- express middleware
|
|
20
|
+
- preferences configuration
|
|
21
|
+
- permissions configuration
|
|
22
|
+
- policy configuration
|
|
23
|
+
- roles configuraton
|
|
24
|
+
- Graphql Rules
|
|
25
|
+
- Moleculer broker services
|
|
26
|
+
|
|
27
|
+
Each of these packaged module is used in the `backend-server` like below
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
import CounterModule from '@sample-stack/counter-module-server';
|
|
31
|
+
import AccountModule from '@sample-stack/account-module-server';
|
|
32
|
+
import PaymentModule from '@sample-stack/payment-module-server';
|
|
33
|
+
|
|
34
|
+
const feature = new Feature(DefaultFeature, CounterModule, AccountModule, PaymentModule);
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
For example provide all the required configuration to the `Feature` like below.
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
const module = new Feature({
|
|
41
|
+
schema,
|
|
42
|
+
createDirectivesFUnc: paymentContextDirectives,
|
|
43
|
+
createDataSourceFunc: () => ({
|
|
44
|
+
stripeManager: new StripeDataSourceService(),
|
|
45
|
+
}),
|
|
46
|
+
createResolversFunc: resolver,
|
|
47
|
+
createServcieFunc: billingSErviceFunc,
|
|
48
|
+
middleware: stripeWebhookMiddleware,
|
|
49
|
+
createContainerFunc: [billingPorxyModule],
|
|
50
|
+
createHemeraContainerFunc: [billingModule],
|
|
51
|
+
postStartFunc: [(container, ctx) => initStripe(container, ctx)],
|
|
52
|
+
addBrokerClientServiceClass: [BillingMoleculerService],
|
|
53
|
+
createPreference: settings,
|
|
54
|
+
rolesUpdate: {
|
|
55
|
+
overwriteRolesPermissions: rolePermissionOverwrite,
|
|
56
|
+
},
|
|
57
|
+
addPermissions: {
|
|
58
|
+
createPermissions: billingRoleContribution,
|
|
59
|
+
},
|
|
60
|
+
addPolicies: {
|
|
61
|
+
createPolicies: BillingPolicyContribution,
|
|
62
|
+
},
|
|
63
|
+
rules,
|
|
64
|
+
});
|
|
65
|
+
```
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
meta:
|
|
3
|
+
title: Using DataLoader in Common Stack
|
|
4
|
+
description: Using DataLoader in Common Stack
|
|
5
|
+
date: '2023-06-02T00:00:00'
|
|
6
|
+
updated: '2024-06-02T00:00:00'
|
|
7
|
+
excerpt: Using DataLoader in Common Stack...
|
|
8
|
+
headers:
|
|
9
|
+
Cache-Control: no-cache
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
### Using DataLoader in Common Stack
|
|
13
|
+
|
|
14
|
+
In Common Stack, DataLoader is used to optimize data fetching by batching and caching requests. This document explains how to set up and use DataLoader, specifically focusing on `AccountUserDataLoader` and its integration with a GraphQL resolver.
|
|
15
|
+
You can reader further about DataLoaders [here](https://github.com/graphql/dataloader)
|
|
16
|
+
|
|
17
|
+
#### 1. BulkDataLoader Implementation
|
|
18
|
+
|
|
19
|
+
The `BulkDataLoader` class is a generic implementation of DataLoader, designed to work with any service that implements the `IBaseService` interface.
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import DataLoader from 'dataloader';
|
|
23
|
+
import { injectable, unmanaged } from 'inversify';
|
|
24
|
+
import { DataLoaderOptions, IBaseService, IDataLoader } from '../interfaces';
|
|
25
|
+
|
|
26
|
+
@injectable()
|
|
27
|
+
export class BulkDataLoader<T extends { id: string }> extends DataLoader<string, T | null> implements IDataLoader<T> {
|
|
28
|
+
constructor(@unmanaged() private readonly service: IBaseService<T>) {
|
|
29
|
+
super(async (ids: string[]) => {
|
|
30
|
+
const data = await this.service.getByIds(ids);
|
|
31
|
+
return ids.map((id) => data.find((record) => record.id === id) || null);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
withOptions = new DataLoader<DataLoaderOptions<T>, T[]>(async (options) => {
|
|
36
|
+
const [{ searchKey, comparator, ...rest }] = options;
|
|
37
|
+
const ids = options.map((option) => option.id);
|
|
38
|
+
const results = await this.service.getAll({
|
|
39
|
+
...rest,
|
|
40
|
+
criteria: {
|
|
41
|
+
...rest.criteria,
|
|
42
|
+
[searchKey]: { $in: ids },
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
return ids.map((modelId) =>
|
|
46
|
+
results.filter((item) => {
|
|
47
|
+
if (typeof comparator === 'function') return comparator(modelId, item);
|
|
48
|
+
return item[searchKey].toString() === modelId.toString();
|
|
49
|
+
}),
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
#### 2. DataLoader Interface
|
|
56
|
+
|
|
57
|
+
The `IDataLoader` interface extends the basic DataLoader functionality to include additional options.
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import DataLoader from 'dataloader';
|
|
61
|
+
import { IBaseService } from './base-service';
|
|
62
|
+
|
|
63
|
+
export type DataLoaderOptions<T> = Parameters<IBaseService<T>['getAll']>[0] & {
|
|
64
|
+
id: string;
|
|
65
|
+
searchKey: keyof T;
|
|
66
|
+
comparator?: (source: unknown, target: T) => boolean;
|
|
67
|
+
};
|
|
68
|
+
export type IDataLoader<T> = DataLoader<string, T> & {
|
|
69
|
+
withOptions: DataLoader<DataLoaderOptions<T>, T[]>;
|
|
70
|
+
};
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
#### 3. DataLoader with Service
|
|
74
|
+
|
|
75
|
+
Creating a DataLoader is easy, all you have to do is
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
@injectable()
|
|
79
|
+
export class AccountUserDataLoader extends BulkDataLoader<IUserAccount> {
|
|
80
|
+
constructor(
|
|
81
|
+
@inject(TYPES.IAccountService)
|
|
82
|
+
accountService: IAccountService,
|
|
83
|
+
) {
|
|
84
|
+
super(accountService);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@injectable()
|
|
89
|
+
export class TeamsDataLoader extends BulkDataLoader<ITeam> {
|
|
90
|
+
constructor(
|
|
91
|
+
@inject(TYPES.ITeamService)
|
|
92
|
+
teamService: ITeamService,
|
|
93
|
+
) {
|
|
94
|
+
super(teamService);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
and you will have a fully functional data loader with advanced functionality.
|
|
100
|
+
Thanks to the `BulkDataLoader` parent class
|
|
101
|
+
|
|
102
|
+
#### 4. GraphQL Resolver Integration
|
|
103
|
+
|
|
104
|
+
You can use these data loaders in your field resolvers to batch requests, the below example will explain
|
|
105
|
+
both simple and advanced use cases of account and teams data loaders.
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
export const resolvers: (options: IResolverOptions) => IResolvers<IContext & MyContext> = (options) => ({
|
|
109
|
+
OrgUser: {
|
|
110
|
+
// # This will batch all ids and make a single call to db with all the ids
|
|
111
|
+
user: (root, args, { accountUserDataLoader }) => accountUserDataLoader.load(root.userId),
|
|
112
|
+
// # If you have a use case where you need to fetch other than the Id you use `withOptions`
|
|
113
|
+
// method, where you can define any key and pass additonal citeria
|
|
114
|
+
// comparator function is optional, which will help filter related result for the specific resolver
|
|
115
|
+
teamNames: async (root, args, { teamsDataLoader }) => {
|
|
116
|
+
const teams = await teamsDataLoader.withOptions.load({
|
|
117
|
+
id: root.orgName,
|
|
118
|
+
searchKey: 'orgName',
|
|
119
|
+
criteria: {
|
|
120
|
+
'teamMembers.userId': root.userId,
|
|
121
|
+
},
|
|
122
|
+
comparator(userId: string, team) {
|
|
123
|
+
return (
|
|
124
|
+
team.orgName === root.orgName &&
|
|
125
|
+
team.teamMembers.findIndex((i) => i.userId === root.userId) >= 0
|
|
126
|
+
);
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
return teams.map((team) => (team as ITeam)?.name);
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
This document outlines the setup and usage of DataLoader in the Common Stack, focusing on the `BulkDataLoader` class, its interface, a specific implementation for user accounts, and its integration into GraphQL resolvers.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
meta:
|
|
3
|
+
title: Feature Server
|
|
4
|
+
description: Feature Server
|
|
5
|
+
date: '2023-06-02T00:00:00'
|
|
6
|
+
updated: '2024-06-02T00:00:00'
|
|
7
|
+
excerpt: Feature Server...
|
|
8
|
+
headers:
|
|
9
|
+
Cache-Control: no-cache
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Feature Server
|
|
13
|
+
|
|
14
|
+
**[Feature Server API](/docs/feature-api/feature-server/feature)**
|
|
15
|
+
|
|
16
|
+
**[Dependency Injection](/docs/feature-api/feature-server/dependency-injection)**
|
|
17
|
+
|
|
18
|
+
**[Mongo Model](/docs/feature-api/feature-server/mongo-model)**
|
|
19
|
+
|
|
20
|
+
**[Permissions](/docs/feature-api/feature-server/permissions)**
|
|
21
|
+
|
|
22
|
+
**[Policies](/docs/feature-api/feature-server/policies)**
|
|
23
|
+
|
|
24
|
+
**[Preferences](/docs/feature-api/feature-server/preferences)**
|
|
25
|
+
|
|
26
|
+
**[Repositories](/docs/feature-api/feature-server/repositories)**
|
|
27
|
+
|
|
28
|
+
**[Resolvers](/docs/feature-api/feature-server/resolvers)**
|
|
29
|
+
|
|
30
|
+
**[Rules](/docs/feature-api/feature-server/rules)**
|
|
31
|
+
|
|
32
|
+
**[Schema](/docs/feature-api/feature-server/schema)**
|
|
33
|
+
|
|
34
|
+
**[Service](/docs/feature-api/feature-server/services)**
|
|
35
|
+
|
|
36
|
+
**[Dataloader](/docs/feature-api/feature-server/dataloader)**
|
|
37
|
+
|
|
38
|
+
**[Setup Resource CRUD](/docs/feature-api/feature-server/setup-resource-crud)**
|
|
39
|
+
|
|
40
|
+
**[Migration](/docs/feature-api/feature-server/migration)**
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
meta:
|
|
3
|
+
title: Migration
|
|
4
|
+
description: Migration
|
|
5
|
+
date: '2023-06-02T00:00:00'
|
|
6
|
+
updated: '2024-06-02T00:00:00'
|
|
7
|
+
excerpt: Migration...
|
|
8
|
+
headers:
|
|
9
|
+
Cache-Control: no-cache
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Migration
|
|
13
|
+
|
|
14
|
+
## Add migration id
|
|
15
|
+
|
|
16
|
+
Migrtion Id should be unique and usually it follow date version for example `<MIGRATION_NAME>_<yyyymmdd>`. Migration script only runs once and it stores the migration id in the database, if you need to rerun the migration you need to change the version by updating `yyyymmdd`.
|
|
17
|
+
|
|
18
|
+
## Add `up/down` scripts to execute
|
|
19
|
+
|
|
20
|
+
### up is for loading
|
|
21
|
+
|
|
22
|
+
### down is for unloading.
|
|
23
|
+
|
|
24
|
+
In this example, we are renaming `status` field in Property.
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
// MongoDB field to update
|
|
29
|
+
const fieldToUpdate = 'status';
|
|
30
|
+
|
|
31
|
+
// Update values mapping
|
|
32
|
+
const updateMapping = {
|
|
33
|
+
CREATED: 'created',
|
|
34
|
+
LISTED: 'listed',
|
|
35
|
+
INCOMPLETE: 'incomplete'
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Updates the "status" field in a collection from "CREATED" to "created" and from "LISTED" to "listed":
|
|
40
|
+
*/
|
|
41
|
+
@injectable()
|
|
42
|
+
export class PropertyStatusMigration {
|
|
43
|
+
private readonly logger: CdmLogger.ILogger;
|
|
44
|
+
|
|
45
|
+
constructor(
|
|
46
|
+
@inject(TYPES.PropertyRepository)
|
|
47
|
+
private propertyRepository: IBaseRepository<IPropertyType>,
|
|
48
|
+
@inject('Logger')
|
|
49
|
+
logger: CdmLogger.ILogger,
|
|
50
|
+
) {
|
|
51
|
+
this.logger = logger.child({ className: PropertyStatusMigration.name });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
get id(): string {
|
|
55
|
+
return 'PropertyStatusMigration_20230603';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
get data(): IPropertyTypeInput[] {
|
|
59
|
+
return propertyTypes;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async up(): Promise<void> {
|
|
63
|
+
await this.down();
|
|
64
|
+
this.propertyRepository.bulkUpdate( { [fieldToUpdate]: { $in: ['CREATED', 'LISTED', 'INCOMPLETE'] } },
|
|
65
|
+
[
|
|
66
|
+
{
|
|
67
|
+
$set: {
|
|
68
|
+
[fieldToUpdate]: {
|
|
69
|
+
$cond: {
|
|
70
|
+
if: { $eq: [`$${fieldToUpdate}`, 'CREATED'] },
|
|
71
|
+
then: updateMapping.CREATED,
|
|
72
|
+
else: {
|
|
73
|
+
$cond: {
|
|
74
|
+
if: { $eq: [`$${fieldToUpdate}`, 'LISTED'] },
|
|
75
|
+
then: updateMapping.LISTED,
|
|
76
|
+
else: updateMapping.INCOMPLETE
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
function(err, result) {
|
|
85
|
+
if (err) {
|
|
86
|
+
this.logger.error('Error updating documents:', err);
|
|
87
|
+
} else {
|
|
88
|
+
this.logger.debug('Documents updated successfully.');
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
this.logger.info(`PropertyStatusMigration_20230603 Property Status migration done!`);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
async down(): Promise<void> {
|
|
95
|
+
this.logger.info(`Nothing to do`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Migration scritp runs when the backend server start and it runs `down` first before `up` script.
|
|
102
|
+
|
|
103
|
+
## Bind to Migration Container
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
/**
|
|
107
|
+
* Local services and exposed microservices to serve remote connections.
|
|
108
|
+
* Operates within in the Gateway.
|
|
109
|
+
*
|
|
110
|
+
*/
|
|
111
|
+
export const localContainerModule: (settings) => interfaces.ContainerModule = () =>
|
|
112
|
+
new ContainerModule((bind: interfaces.Bind) => {
|
|
113
|
+
..... rest of the code ...
|
|
114
|
+
bind('MongodbMigration').to(PropertyStatusMigration).whenTargetNamed(PropertyStatusMigration.name);
|
|
115
|
+
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Add to the feature
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
export default new Feature(
|
|
123
|
+
{
|
|
124
|
+
... rest...
|
|
125
|
+
createContainerFunc: [localContainerModule],
|
|
126
|
+
});
|
|
127
|
+
```
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
meta:
|
|
3
|
+
title: Mongo Model
|
|
4
|
+
description: Mongo Model
|
|
5
|
+
date: '2023-06-02T00:00:00'
|
|
6
|
+
updated: '2024-06-02T00:00:00'
|
|
7
|
+
excerpt: Mongo Model...
|
|
8
|
+
headers:
|
|
9
|
+
Cache-Control: no-cache
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Mongo Model
|
|
13
|
+
|
|
14
|
+
## Overview
|
|
15
|
+
|
|
16
|
+
We are following the `ODM` object data modeling pattern, which dictate that for each document in the mongo db, we'll
|
|
17
|
+
have a `Model` in our codebase which will contain the definition regarding how our database document will look like, what fields it'll have and how to
|
|
18
|
+
validate them like `unique` , `required` validations. We are using [Mongoose](https://mongoosejs.com/) to define these models
|
|
19
|
+
and to communicate with the MongoDB.
|
|
20
|
+
|
|
21
|
+
## Mongoose
|
|
22
|
+
|
|
23
|
+
In order to communicate with the database we are using [Mongoose](https://mongoosejs.com/). An object data modeling (
|
|
24
|
+
ODM) library
|
|
25
|
+
specifically designed for NodeJS to work with the [MongoDB](https://www.mongodb.com/). What this means in practical
|
|
26
|
+
terms is that you can define your data model in
|
|
27
|
+
just one place, in your code. It allows defining schemas for our data to fit into, while also abstracting the access
|
|
28
|
+
to MongoDB. This way we can ensure all saved documents share a structure and contain required properties.
|
|
29
|
+
|
|
30
|
+
### Schema
|
|
31
|
+
|
|
32
|
+
While Mongo is schema-less, SQL defines a schema via the table definition. A
|
|
33
|
+
Mongoose [Schema](https://mongoosejs.com/docs/guide.html) is a document data structure
|
|
34
|
+
(or shape of the document) that is enforced via the application layer.
|
|
35
|
+
|
|
36
|
+
### Models
|
|
37
|
+
|
|
38
|
+
[Models](https://mongoosejs.com/docs/models.html) are fancy constructors compiled from Schema definitions. An instance of a model is called a [document](https://mongoosejs.com/docs/documents.html).
|
|
39
|
+
Models are responsible for creating and reading documents from the underlying MongoDB database.
|
|
40
|
+
|
|
41
|
+
### Defining Model
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
import { Connection, Document, Model, Schema } from 'mongoose';
|
|
45
|
+
import { addIdVirtualFields, commonModeSchemaOptions } from '@common-stack/store-mongo'; // Common Utility funtion, for common opeations
|
|
46
|
+
import { IUser } from 'generated-modals'; // Typescript definiton for the Model
|
|
47
|
+
|
|
48
|
+
export type IUserMongoModel = Document & IUser;
|
|
49
|
+
export type UserModelType = Model<IUserMongoModel>;
|
|
50
|
+
|
|
51
|
+
// First Step is to Define Schmea
|
|
52
|
+
export const userScehma = new Schema<IUserMongoModel>(
|
|
53
|
+
{
|
|
54
|
+
firstName: { type: Schema.Types.String },
|
|
55
|
+
lastName: { type: Schema.Types.String },
|
|
56
|
+
email: { type: Schema.Types.String, required: true, unique: true },
|
|
57
|
+
active: { type: Schema.Types.Boolean, default: false },
|
|
58
|
+
// For collection you just need to pass the field definiton inside brackets []
|
|
59
|
+
comments: [{ type: Schema.Types.ObjectId, ref: 'commments' }], // Just to explain, how we can have cross document ref
|
|
60
|
+
},
|
|
61
|
+
commonModeSchemaOptions, // Adds timestamos (createdAt, updatedAt)
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
// Once schema is defined we can add/override methods on the schmea object
|
|
65
|
+
addIdVirtualFields(userScehma); // Add `id` field which will contain document objectId, instead of `_id`
|
|
66
|
+
|
|
67
|
+
// By calling `.model` on active db connection we instantiate a `model` instance (document).
|
|
68
|
+
// Firs param is the name of the `collection`, which should always be plural whereas the second one is the schema definition of that model
|
|
69
|
+
export const UserModelFunc: (db: Connection) => UserModelType = (db) => db.model<IUserMongoModel>('users', userScehma);
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The next step is to [Define Repository](repositories) for this model.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
meta:
|
|
3
|
+
title: Policies
|
|
4
|
+
description: Policies
|
|
5
|
+
date: '2023-06-02T00:00:00'
|
|
6
|
+
updated: '2024-06-02T00:00:00'
|
|
7
|
+
excerpt: Policies...
|
|
8
|
+
headers:
|
|
9
|
+
Cache-Control: no-cache
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Policies
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
const connector = new Feature({
|
|
16
|
+
createPreference: {
|
|
17
|
+
'files.trimTrailingWhitespace': {
|
|
18
|
+
type: 'boolean',
|
|
19
|
+
default: false,
|
|
20
|
+
description: 'When enabled, will trim trailing whitespace when saving a file.',
|
|
21
|
+
settings: 'both',
|
|
22
|
+
enum: [],
|
|
23
|
+
enumDescriptions: [],
|
|
24
|
+
overridable: true,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
const connector2 = new Feature({
|
|
29
|
+
createPreference: {
|
|
30
|
+
'files.autosave': {
|
|
31
|
+
type: 'boolean',
|
|
32
|
+
default: false,
|
|
33
|
+
description: 'Some Description',
|
|
34
|
+
settings: 'both',
|
|
35
|
+
enum: [],
|
|
36
|
+
enumDescriptions: [],
|
|
37
|
+
overridable: true,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const connector3 = new Feature({
|
|
43
|
+
overwritePreference: {
|
|
44
|
+
'files.trimTrailingWhitespace.default': true,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
const connector4 = new Feature({
|
|
48
|
+
overwritePreference: {
|
|
49
|
+
'files.autosave.description': 'new one',
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const feature = new Feature(connector, connector2, connector3, connector4);
|
|
54
|
+
const finalPreferences = feature.getPreferences();
|
|
55
|
+
|
|
56
|
+
expect(finalPreferences).toEqual(finalSettings);
|
|
57
|
+
```
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
meta:
|
|
3
|
+
title: Preferences
|
|
4
|
+
description: Preferences
|
|
5
|
+
date: '2023-06-02T00:00:00'
|
|
6
|
+
updated: '2024-06-02T00:00:00'
|
|
7
|
+
excerpt: Preferences...
|
|
8
|
+
headers:
|
|
9
|
+
Cache-Control: no-cache
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Preferences
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
const connector = new Feature({
|
|
16
|
+
createPreference: {
|
|
17
|
+
'files.trimTrailingWhitespace': {
|
|
18
|
+
type: 'boolean',
|
|
19
|
+
default: false,
|
|
20
|
+
description: 'When enabled, will trim trailing whitespace when saving a file.',
|
|
21
|
+
settings: 'both',
|
|
22
|
+
enum: [],
|
|
23
|
+
enumDescriptions: [],
|
|
24
|
+
overridable: true,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
const connector2 = new Feature({
|
|
29
|
+
createPreference: {
|
|
30
|
+
'files.autosave': {
|
|
31
|
+
type: 'boolean',
|
|
32
|
+
default: false,
|
|
33
|
+
description: 'Some Description',
|
|
34
|
+
settings: 'both',
|
|
35
|
+
enum: [],
|
|
36
|
+
enumDescriptions: [],
|
|
37
|
+
overridable: true,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const connector3 = new Feature({
|
|
43
|
+
overwritePreference: {
|
|
44
|
+
'files.trimTrailingWhitespace.default': true,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
const connector4 = new Feature({
|
|
48
|
+
overwritePreference: {
|
|
49
|
+
'files.autosave.description': 'new one',
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const feature = new Feature(connector, connector2, connector3, connector4);
|
|
54
|
+
const finalPreferences = feature.getPreferences();
|
|
55
|
+
|
|
56
|
+
expect(finalPreferences).toEqual(finalSettings);
|
|
57
|
+
```
|