@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.
Files changed (367) hide show
  1. package/LICENSE +21 -0
  2. package/lib/components/Logo.d.ts +4 -0
  3. package/lib/components/Logo.d.ts.map +1 -0
  4. package/lib/components/Logo.js +16 -0
  5. package/lib/components/Logo.js.map +1 -0
  6. package/lib/components/help/SidebarSearch.d.ts +8 -0
  7. package/lib/components/help/SidebarSearch.d.ts.map +1 -0
  8. package/lib/components/help/SidebarSearch.js +111 -0
  9. package/lib/components/help/SidebarSearch.js.map +1 -0
  10. package/lib/components/help/index.d.ts +2 -0
  11. package/lib/components/help/index.d.ts.map +1 -0
  12. package/lib/components/landing/FeatureCard.d.ts +13 -0
  13. package/lib/components/landing/FeatureCard.d.ts.map +1 -0
  14. package/lib/components/landing/FeatureCard.js +85 -0
  15. package/lib/components/landing/FeatureCard.js.map +1 -0
  16. package/lib/components/landing/QuickLinkCard.d.ts +8 -0
  17. package/lib/components/landing/QuickLinkCard.d.ts.map +1 -0
  18. package/lib/components/landing/QuickLinkCard.js +26 -0
  19. package/lib/components/landing/QuickLinkCard.js.map +1 -0
  20. package/lib/components/landing/SearchInput.d.ts +10 -0
  21. package/lib/components/landing/SearchInput.d.ts.map +1 -0
  22. package/lib/components/landing/SearchInput.js +223 -0
  23. package/lib/components/landing/SearchInput.js.map +1 -0
  24. package/lib/components/landing/index.d.ts +4 -0
  25. package/lib/components/landing/index.d.ts.map +1 -0
  26. package/lib/components/welcome.d.ts +3 -0
  27. package/lib/components/welcome.d.ts.map +1 -0
  28. package/lib/compute.d.ts +4 -0
  29. package/lib/compute.d.ts.map +1 -0
  30. package/lib/compute.js +96 -0
  31. package/lib/compute.js.map +1 -0
  32. package/lib/config/env-config.d.ts +4 -0
  33. package/lib/config/env-config.d.ts.map +1 -0
  34. package/lib/config/env-config.js +7 -0
  35. package/lib/config/env-config.js.map +1 -0
  36. package/lib/docs.config.d.ts +48 -0
  37. package/lib/docs.config.d.ts.map +1 -0
  38. package/lib/index.d.ts +4 -0
  39. package/lib/index.d.ts.map +1 -0
  40. package/lib/index.js +2 -0
  41. package/lib/index.js.map +1 -0
  42. package/lib/loaders/search.d.ts +1 -0
  43. package/lib/loaders/search.d.ts.map +1 -0
  44. package/lib/module.d.ts +4 -0
  45. package/lib/module.d.ts.map +1 -0
  46. package/lib/module.js +11 -0
  47. package/lib/module.js.map +1 -0
  48. package/lib/pages/ArticlePage/ArticlePage.d.ts +4 -0
  49. package/lib/pages/ArticlePage/ArticlePage.d.ts.map +1 -0
  50. package/lib/pages/ArticlePage/ArticlePage.js +222 -0
  51. package/lib/pages/ArticlePage/ArticlePage.js.map +1 -0
  52. package/lib/pages/ArticlePage/index.d.ts +3 -0
  53. package/lib/pages/ArticlePage/index.d.ts.map +1 -0
  54. package/lib/pages/ArticlePage/index.js +3 -0
  55. package/lib/pages/ArticlePage/index.js.map +1 -0
  56. package/lib/pages/CategoryCollection/CategoryCollection.d.ts +4 -0
  57. package/lib/pages/CategoryCollection/CategoryCollection.d.ts.map +1 -0
  58. package/lib/pages/CategoryCollection/CategoryCollection.js +103 -0
  59. package/lib/pages/CategoryCollection/CategoryCollection.js.map +1 -0
  60. package/lib/pages/CategoryCollection/index.d.ts +3 -0
  61. package/lib/pages/CategoryCollection/index.d.ts.map +1 -0
  62. package/lib/pages/CategoryCollection/index.js +3 -0
  63. package/lib/pages/CategoryCollection/index.js.map +1 -0
  64. package/lib/pages/Help/HelpIndex.d.ts +4 -0
  65. package/lib/pages/Help/HelpIndex.d.ts.map +1 -0
  66. package/lib/pages/Help/HelpIndex.js +44 -0
  67. package/lib/pages/Help/HelpIndex.js.map +1 -0
  68. package/lib/pages/Help/index.d.ts +4 -0
  69. package/lib/pages/Help/index.d.ts.map +1 -0
  70. package/lib/pages/Help/index.js +226 -0
  71. package/lib/pages/Help/index.js.map +1 -0
  72. package/lib/pages/Landing/index.d.ts +3 -0
  73. package/lib/pages/Landing/index.d.ts.map +1 -0
  74. package/lib/pages/Landing/index.js +281 -0
  75. package/lib/pages/Landing/index.js.map +1 -0
  76. package/lib/routes.json +2533 -0
  77. package/lib/seo.d.ts +22 -0
  78. package/lib/seo.d.ts.map +1 -0
  79. package/lib/slot-fill/FooterFill.d.ts +3 -0
  80. package/lib/slot-fill/FooterFill.d.ts.map +1 -0
  81. package/lib/slot-fill/FooterFill.js +18 -0
  82. package/lib/slot-fill/FooterFill.js.map +1 -0
  83. package/lib/slot-fill/LogoFill.d.ts +5 -0
  84. package/lib/slot-fill/LogoFill.d.ts.map +1 -0
  85. package/lib/slot-fill/LogoFill.js +74 -0
  86. package/lib/slot-fill/LogoFill.js.map +1 -0
  87. package/lib/slot-fill/consts.d.ts +5 -0
  88. package/lib/slot-fill/consts.d.ts.map +1 -0
  89. package/lib/slot-fill/consts.js +1 -0
  90. package/lib/slot-fill/consts.js.map +1 -0
  91. package/lib/slot-fill/index.d.ts +4 -0
  92. package/lib/slot-fill/index.d.ts.map +1 -0
  93. package/lib/templates/assets/images/add-link-frontend.png +0 -0
  94. package/lib/templates/assets/images/add-package-backend.png +0 -0
  95. package/lib/templates/assets/images/add-to-backend-module.png +0 -0
  96. package/lib/templates/assets/images/add-upload-client-frontend.png +0 -0
  97. package/lib/templates/assets/images/additional-parameters.png +0 -0
  98. package/lib/templates/assets/images/aeh-implementation.png +0 -0
  99. package/lib/templates/assets/images/aeh-usage.png +0 -0
  100. package/lib/templates/assets/images/apollo-client/recommendation_cache_mgmt.png +0 -0
  101. package/lib/templates/assets/images/app-deploy-new-version/jenkins1.PNG +0 -0
  102. package/lib/templates/assets/images/app-deploy-new-version/jenkins2.PNG +0 -0
  103. package/lib/templates/assets/images/auth-wrapper-code.png +0 -0
  104. package/lib/templates/assets/images/cdebase.png +0 -0
  105. package/lib/templates/assets/images/cdm-locales-directory.png +0 -0
  106. package/lib/templates/assets/images/client-settings.png +0 -0
  107. package/lib/templates/assets/images/codegen_file_update.png +0 -0
  108. package/lib/templates/assets/images/configuration.png +0 -0
  109. package/lib/templates/assets/images/copy-plugin.png +0 -0
  110. package/lib/templates/assets/images/docusaurus.png +0 -0
  111. package/lib/templates/assets/images/error-link.png +0 -0
  112. package/lib/templates/assets/images/error-sample.png +0 -0
  113. package/lib/templates/assets/images/extension copy.png +0 -0
  114. package/lib/templates/assets/images/extension.png +0 -0
  115. package/lib/templates/assets/images/graphql/graphql-folder-backend.png +0 -0
  116. package/lib/templates/assets/images/graphql/graphql-folder-with-gql.png +0 -0
  117. package/lib/templates/assets/images/i18n-config.png +0 -0
  118. package/lib/templates/assets/images/image.png +0 -0
  119. package/lib/templates/assets/images/logo.svg +10 -0
  120. package/lib/templates/assets/images/logo1.svg +1 -0
  121. package/lib/templates/assets/images/modify-upload-false-server.png +0 -0
  122. package/lib/templates/assets/images/navigation-auth-enabled.png +0 -0
  123. package/lib/templates/assets/images/org-dashboard-navigation.png +0 -0
  124. package/lib/templates/assets/images/org-navigation.png +0 -0
  125. package/lib/templates/assets/images/preferences_graphql_type.png +0 -0
  126. package/lib/templates/assets/images/provider.png +0 -0
  127. package/lib/templates/assets/images/route-config.png +0 -0
  128. package/lib/templates/assets/images/service-accounts.png +0 -0
  129. package/lib/templates/assets/images/source-code/source-code-environments.png +0 -0
  130. package/lib/templates/assets/images/source-code/source-code-organization.png +0 -0
  131. package/lib/templates/assets/images/spin-clone-develop-deployment/jenkins-changes.png +0 -0
  132. package/lib/templates/assets/images/spin-clone-develop-deployment/lerna-changes.png +0 -0
  133. package/lib/templates/assets/images/spin-clone-develop-deployment/root-package-json-changes.png +0 -0
  134. package/lib/templates/assets/images/spin-clone-develop-deployment/values-dev-changes.png +0 -0
  135. package/lib/templates/assets/images/sso-mappers.png +0 -0
  136. package/lib/templates/assets/images/sso-picture-mapper.png +0 -0
  137. package/lib/templates/assets/images/sso-settings.png +0 -0
  138. package/lib/templates/assets/images/timesheet_apollo_cache.png +0 -0
  139. package/lib/templates/assets/images/timesheet_query.png +0 -0
  140. package/lib/templates/assets/images/tutorial/docsVersionDropdown.png +0 -0
  141. package/lib/templates/assets/images/tutorial/localeDropdown.png +0 -0
  142. package/lib/templates/assets/images/unauthenticated.png +0 -0
  143. package/lib/templates/assets/images/undraw_docusaurus_mountain.svg +170 -0
  144. package/lib/templates/assets/images/undraw_docusaurus_react.svg +169 -0
  145. package/lib/templates/assets/images/undraw_docusaurus_tree.svg +1 -0
  146. package/lib/templates/assets/images/vite-plugin-config.png +0 -0
  147. package/lib/templates/content/docs/Generators/Project/generate-fullproject.md +12 -0
  148. package/lib/templates/content/docs/LLM/Logger.llm.md +194 -0
  149. package/lib/templates/content/docs/LLM/backend-proxies-services-llm.md +2687 -0
  150. package/lib/templates/content/docs/LLM/backend-service-llm.md +3384 -0
  151. package/lib/templates/content/docs/LLM/db_migration_llm.md +954 -0
  152. package/lib/templates/content/docs/LLM/frontend/REMIX-15.3-upgrade-llm.md +1245 -0
  153. package/lib/templates/content/docs/LLM/inngest/INNGEST_FUNCTION_DEVELOPMENT_GUIDE_LLM.md +1241 -0
  154. package/lib/templates/content/docs/LLM/inngest/INNGEST_NAMESPACE_LLM.md +384 -0
  155. package/lib/templates/content/docs/LLM/llm_workflow_namespace.md +384 -0
  156. package/lib/templates/content/docs/LLM/organization-components-form-llm.md +1395 -0
  157. package/lib/templates/content/docs/LLM/page-component-llm.md +173 -0
  158. package/lib/templates/content/docs/LLM/preferences-settings-llm.md +2781 -0
  159. package/lib/templates/content/docs/LLM/tailwind-css-llm.md +502 -0
  160. package/lib/templates/content/docs/UI/SchemaBasedUI.md +334 -0
  161. package/lib/templates/content/docs/UI/SlotFillComponent.md +334 -0
  162. package/lib/templates/content/docs/adminide-modules/account/auth0-login.md +31 -0
  163. package/lib/templates/content/docs/adminide-modules/account/index.md +14 -0
  164. package/lib/templates/content/docs/adminide-modules/account/keycloak-remix-setup.md +86 -0
  165. package/lib/templates/content/docs/adminide-modules/account/remix-auth-setup.md +79 -0
  166. package/lib/templates/content/docs/adminide-modules/account/various-auth-qatest.md +157 -0
  167. package/lib/templates/content/docs/adminide-modules/api-builders/graphql.md +906 -0
  168. package/lib/templates/content/docs/adminide-modules/billing/payments/index.md +14 -0
  169. package/lib/templates/content/docs/adminide-modules/billing/payments/stripe/index.md +14 -0
  170. package/lib/templates/content/docs/adminide-modules/billing/payments/stripe/settingup-stripe-locally.md +25 -0
  171. package/lib/templates/content/docs/adminide-modules/billing/tier-config.md +293 -0
  172. package/lib/templates/content/docs/adminide-modules/connectors/Connector.md +207 -0
  173. package/lib/templates/content/docs/adminide-modules/file-upload/index.md +16 -0
  174. package/lib/templates/content/docs/adminide-modules/file-upload/setup.md +435 -0
  175. package/lib/templates/content/docs/adminide-modules/file-upload/upload-file-using-signed-url.md +161 -0
  176. package/lib/templates/content/docs/adminide-modules/preferences/AddAdditionalPermissions.md +151 -0
  177. package/lib/templates/content/docs/adminide-modules/preferences/Configuration.md +241 -0
  178. package/lib/templates/content/docs/adminide-modules/preferences/Policy-Configuration.md +61 -0
  179. package/lib/templates/content/docs/adminide-modules/preferences/UI-components/ResourceSettingsLoader.md +319 -0
  180. package/lib/templates/content/docs/adminide-modules/preferences/contribute_scope_target.md +280 -0
  181. package/lib/templates/content/docs/adminide-modules/preferences/generate-urii.md +94 -0
  182. package/lib/templates/content/docs/adminide-modules/preferences/index.md +28 -0
  183. package/lib/templates/content/docs/adminide-modules/preferences/machine-configuration.md +157 -0
  184. package/lib/templates/content/docs/adminide-modules/preferences/pageSettings/generateCdecodeUri.md +1289 -0
  185. package/lib/templates/content/docs/adminide-modules/preferences/pageSettings/migratingFromUseSettings.md +215 -0
  186. package/lib/templates/content/docs/adminide-modules/preferences/permissions/Roles-Permissions.md +72 -0
  187. package/lib/templates/content/docs/adminide-modules/preferences/permissions/settingUserPermissions.md +139 -0
  188. package/lib/templates/content/docs/adminide-modules/preferences/preference-dependency.md +138 -0
  189. package/lib/templates/content/docs/adminide-modules/preferences/route-based-configuration.md +41 -0
  190. package/lib/templates/content/docs/adminide-modules/preferences/schema-configuration.md +71 -0
  191. package/lib/templates/content/docs/adminide-modules/preferences/supported.md +24 -0
  192. package/lib/templates/content/docs/adminide-modules/preferences/useSettingsLoader.md +248 -0
  193. package/lib/templates/content/docs/adminide-modules/project-tools/auth-providers.md +1317 -0
  194. package/lib/templates/content/docs/adminide-modules/project-tools/keycloak-guide.md +543 -0
  195. package/lib/templates/content/docs/adminide-modules/project-tools/tenant-management/tenant-based-authentication.md +846 -0
  196. package/lib/templates/content/docs/adminide-modules/project-tools/tenant-management/tenant-management.md +708 -0
  197. package/lib/templates/content/docs/adminide-modules/project-tools/tenant-management/tenants.md +1117 -0
  198. package/lib/templates/content/docs/chrome-extension/index.md +14 -0
  199. package/lib/templates/content/docs/chrome-extension/setup.md +30 -0
  200. package/lib/templates/content/docs/contributing/adding-package.md +23 -0
  201. package/lib/templates/content/docs/contributing/adding_new_modules.md +99 -0
  202. package/lib/templates/content/docs/contributing/architecture-updates.md +19 -0
  203. package/lib/templates/content/docs/contributing/avoid-using-promises-ui.md +116 -0
  204. package/lib/templates/content/docs/contributing/coding-guidelines.md +111 -0
  205. package/lib/templates/content/docs/contributing/do-and-dont.md +42 -0
  206. package/lib/templates/content/docs/contributing/faq.md +22 -0
  207. package/lib/templates/content/docs/contributing/folder-setup/browser.md +12 -0
  208. package/lib/templates/content/docs/contributing/folder-setup/config.md +12 -0
  209. package/lib/templates/content/docs/contributing/folder-setup/containers-server.md +12 -0
  210. package/lib/templates/content/docs/contributing/folder-setup/core.md +12 -0
  211. package/lib/templates/content/docs/contributing/folder-setup/graphql.md +12 -0
  212. package/lib/templates/content/docs/contributing/folder-setup/index.md +30 -0
  213. package/lib/templates/content/docs/contributing/folder-setup/module.md +12 -0
  214. package/lib/templates/content/docs/contributing/folder-setup/server.md +12 -0
  215. package/lib/templates/content/docs/contributing/folder-setup/services.md +12 -0
  216. package/lib/templates/content/docs/contributing/folder-setup/store.md +12 -0
  217. package/lib/templates/content/docs/contributing/frontend-coding.md +30 -0
  218. package/lib/templates/content/docs/contributing/git-subtree-sharing.md +73 -0
  219. package/lib/templates/content/docs/contributing/graphql-subscriptions.md +69 -0
  220. package/lib/templates/content/docs/contributing/how-to-contribute.md +30 -0
  221. package/lib/templates/content/docs/contributing/how_to_check_pure_esm.md +29 -0
  222. package/lib/templates/content/docs/contributing/index.md +60 -0
  223. package/lib/templates/content/docs/contributing/installation-issues.md +23 -0
  224. package/lib/templates/content/docs/contributing/keyboard-shortcut.md +131 -0
  225. package/lib/templates/content/docs/contributing/language/locale-support.md +12 -0
  226. package/lib/templates/content/docs/contributing/lerna-build-tools.md +516 -0
  227. package/lib/templates/content/docs/contributing/lerna-yarn-workspaces.md +95 -0
  228. package/lib/templates/content/docs/contributing/lint-and-formatter.md +20 -0
  229. package/lib/templates/content/docs/contributing/mobile-setup.md +16 -0
  230. package/lib/templates/content/docs/contributing/project-setup.md +233 -0
  231. package/lib/templates/content/docs/contributing/react/index.md +14 -0
  232. package/lib/templates/content/docs/contributing/react/lazy-component.md +70 -0
  233. package/lib/templates/content/docs/contributing/run-various-options.md +124 -0
  234. package/lib/templates/content/docs/contributing/schema-first-graphql-types.md +37 -0
  235. package/lib/templates/content/docs/contributing/source-code-organization.md +57 -0
  236. package/lib/templates/content/docs/contributing/staging-docker.md +88 -0
  237. package/lib/templates/content/docs/contributing/third-party/apollo-client-v3-tutorials.md +28 -0
  238. package/lib/templates/content/docs/contributing/third-party/index.md +18 -0
  239. package/lib/templates/content/docs/contributing/typescript-contribution.md +16 -0
  240. package/lib/templates/content/docs/devops/app-deploy-new-version.md +30 -0
  241. package/lib/templates/content/docs/devops/index.md +14 -0
  242. package/lib/templates/content/docs/devops/mobile-jenkins-build.md +40 -0
  243. package/lib/templates/content/docs/devops/versioning-the-project.md +128 -0
  244. package/lib/templates/content/docs/error-handler/application-error-handler.md +40 -0
  245. package/lib/templates/content/docs/error-handler/error-handling.md +26 -0
  246. package/lib/templates/content/docs/error-handler/index.md +16 -0
  247. package/lib/templates/content/docs/error-handler/logging-errors.md +14 -0
  248. package/lib/templates/content/docs/feature-api/copy-operation.md +427 -0
  249. package/lib/templates/content/docs/feature-api/feature-browser/assets.md +46 -0
  250. package/lib/templates/content/docs/feature-api/feature-browser/auth-permissions.md +12 -0
  251. package/lib/templates/content/docs/feature-api/feature-browser/feature.md +131 -0
  252. package/lib/templates/content/docs/feature-api/feature-browser/index.md +22 -0
  253. package/lib/templates/content/docs/feature-api/feature-browser/routes-menu.md +110 -0
  254. package/lib/templates/content/docs/feature-api/feature-browser/routing-convention.md +124 -0
  255. package/lib/templates/content/docs/feature-api/feature-browser/routing.md +338 -0
  256. package/lib/templates/content/docs/feature-api/feature-mobile/auth-permissions.md +20 -0
  257. package/lib/templates/content/docs/feature-api/feature-mobile/feature.md +130 -0
  258. package/lib/templates/content/docs/feature-api/feature-mobile/index.md +18 -0
  259. package/lib/templates/content/docs/feature-api/feature-mobile/navigation.md +187 -0
  260. package/lib/templates/content/docs/feature-api/feature-server/Scheduling.md +44 -0
  261. package/lib/templates/content/docs/feature-api/feature-server/dataloader.md +320 -0
  262. package/lib/templates/content/docs/feature-api/feature-server/dependency-injection.md +81 -0
  263. package/lib/templates/content/docs/feature-api/feature-server/feature.md +65 -0
  264. package/lib/templates/content/docs/feature-api/feature-server/generic-dataloader.md +135 -0
  265. package/lib/templates/content/docs/feature-api/feature-server/index.md +40 -0
  266. package/lib/templates/content/docs/feature-api/feature-server/migration.md +127 -0
  267. package/lib/templates/content/docs/feature-api/feature-server/mongo-model.md +72 -0
  268. package/lib/templates/content/docs/feature-api/feature-server/permissions.md +12 -0
  269. package/lib/templates/content/docs/feature-api/feature-server/policies.md +57 -0
  270. package/lib/templates/content/docs/feature-api/feature-server/preferences.md +57 -0
  271. package/lib/templates/content/docs/feature-api/feature-server/repositories.md +114 -0
  272. package/lib/templates/content/docs/feature-api/feature-server/resolvers.md +126 -0
  273. package/lib/templates/content/docs/feature-api/feature-server/rules.md +132 -0
  274. package/lib/templates/content/docs/feature-api/feature-server/schema.md +12 -0
  275. package/lib/templates/content/docs/feature-api/feature-server/services.md +102 -0
  276. package/lib/templates/content/docs/feature-api/feature-server/setup-resource-crud.md +359 -0
  277. package/lib/templates/content/docs/feature-api/index.md +18 -0
  278. package/lib/templates/content/docs/graphql/apolloClient-mutation.md +94 -0
  279. package/lib/templates/content/docs/graphql/index.md +14 -0
  280. package/lib/templates/content/docs/graphql/scalars.md +15 -0
  281. package/lib/templates/content/docs/help/index.md +14 -0
  282. package/lib/templates/content/docs/help/intro.md +16 -0
  283. package/lib/templates/content/docs/intl/ant-design-menu-translation.md +74 -0
  284. package/lib/templates/content/docs/intl/intl-namespace.md +129 -0
  285. package/lib/templates/content/docs/intl/vite-plugin-intl.md +87 -0
  286. package/lib/templates/content/docs/intl/webpack-plugin-intl.md +12 -0
  287. package/lib/templates/content/docs/intro.md +18 -0
  288. package/lib/templates/content/docs/knowledge/basic-fullstack.md +238 -0
  289. package/lib/templates/content/docs/mailing/index.md +14 -0
  290. package/lib/templates/content/docs/mailing/mailing-template.md +148 -0
  291. package/lib/templates/content/docs/mobile/App-navigation-generator.md +410 -0
  292. package/lib/templates/content/docs/mobile/MobileTestCases.md +264 -0
  293. package/lib/templates/content/docs/mobile/eas-profile-build.md +107 -0
  294. package/lib/templates/content/docs/mobile/expo-push-notification-setup.md +216 -0
  295. package/lib/templates/content/docs/mobile/index.md +14 -0
  296. package/lib/templates/content/docs/mobile/routes.md +83 -0
  297. package/lib/templates/content/docs/organization/adding-account-context.md +116 -0
  298. package/lib/templates/content/docs/organization/adding-org-mobile-navigation.md +22 -0
  299. package/lib/templates/content/docs/organization/adding-org-web-navigation.md +12 -0
  300. package/lib/templates/content/docs/organization/index.md +20 -0
  301. package/lib/templates/content/docs/organization/initialization.md +20 -0
  302. package/lib/templates/content/docs/organization/organization-resource-vs-resource.md +112 -0
  303. package/lib/templates/content/docs/remix/configuration/component-structure-best-practices.md +152 -0
  304. package/lib/templates/content/docs/remix/configuration/configurations.md +218 -0
  305. package/lib/templates/content/docs/remix/configuration/css-import-and-stylesheets.md +142 -0
  306. package/lib/templates/content/docs/remix/configuration/dont-subcomponent-network.md +166 -0
  307. package/lib/templates/content/docs/remix/configuration/generated-data-loaders.md +122 -0
  308. package/lib/templates/content/docs/remix/configuration/generated-resource-loaders.md +257 -0
  309. package/lib/templates/content/docs/remix/configuration/query-params-generator.md +216 -0
  310. package/lib/templates/content/docs/remix/configuration/routes-extra-icons.md +103 -0
  311. package/lib/templates/content/docs/remix/configuration/routes-json-advanced.md +86 -0
  312. package/lib/templates/content/docs/remix/configuration/routes-json-auth.md +113 -0
  313. package/lib/templates/content/docs/remix/configuration/routes-json-best-practices.md +55 -0
  314. package/lib/templates/content/docs/remix/configuration/routes-json-fields.md +79 -0
  315. package/lib/templates/content/docs/remix/configuration/routes-json-graphql.md +79 -0
  316. package/lib/templates/content/docs/remix/configuration/routes-json-index.md +112 -0
  317. package/lib/templates/content/docs/remix/configuration/routes-json-loaders.md +165 -0
  318. package/lib/templates/content/docs/remix/configuration/routes-json-middleware.md +196 -0
  319. package/lib/templates/content/docs/remix/configuration/routes-json-overview.md +53 -0
  320. package/lib/templates/content/docs/remix/data-loaders.md +43 -0
  321. package/lib/templates/content/docs/remix/devtools/remix-devtools.md +58 -0
  322. package/lib/templates/content/docs/remix/examples/changes-using-servercode.md +79 -0
  323. package/lib/templates/content/docs/remix/extra-icons.md +62 -0
  324. package/lib/templates/content/docs/remix/extra-links.md +65 -0
  325. package/lib/templates/content/docs/remix/generated-data-loaders.md +114 -0
  326. package/lib/templates/content/docs/remix/queryParamsGenerator.md +89 -0
  327. package/lib/templates/content/docs/remix/resources.md +16 -0
  328. package/lib/templates/content/docs/remix/styles.md +132 -0
  329. package/lib/templates/content/docs/remix/wiki.md +12 -0
  330. package/lib/templates/content/docs/security/auth-wrapper/auth-wrapper.md +24 -0
  331. package/lib/templates/content/docs/security/index.md +18 -0
  332. package/lib/templates/content/docs/security/secure-button-mobilenative.md +88 -0
  333. package/lib/templates/content/docs/security/secure-button-web.md +89 -0
  334. package/lib/templates/content/docs/server-side/account-customization.md +82 -0
  335. package/lib/templates/content/docs/server-side/apollo/caching.md +164 -0
  336. package/lib/templates/content/docs/server-side/backend-architecture/FINAL-DECISION.md +209 -0
  337. package/lib/templates/content/docs/server-side/backend-architecture/TRUE-FINAL-ARCHITECTURE.md +603 -0
  338. package/lib/templates/content/docs/server-side/backend-architecture/index1.md +0 -0
  339. package/lib/templates/content/docs/server-side/backend-coding.md +839 -0
  340. package/lib/templates/content/docs/server-side/e2b/manageing-template.md +197 -0
  341. package/lib/templates/content/docs/server-side/index.md +14 -0
  342. package/lib/templates/content/docs/server-side/inngest-functions-module.md +309 -0
  343. package/lib/templates/content/docs/server-side/listen-stripe-events.md +43 -0
  344. package/lib/templates/content/docs/server-side/slug-service.md +323 -0
  345. package/lib/templates/content/docs/tests/index.md +18 -0
  346. package/lib/templates/content/docs/tests/jest-test-debug-vscode.md +40 -0
  347. package/lib/templates/content/docs/tests/known-errors.md +116 -0
  348. package/lib/templates/content/docs/tests/service-test-template.md +118 -0
  349. package/lib/templates/content/docs/tests/test-setup.md +93 -0
  350. package/lib/templates/content/docs/xstate.md +23 -0
  351. package/lib/types.d.ts +37 -0
  352. package/lib/types.d.ts.map +1 -0
  353. package/lib/utils/docsNavigation.d.ts +9 -0
  354. package/lib/utils/docsNavigation.d.ts.map +1 -0
  355. package/lib/utils/docsNavigation.js +37 -0
  356. package/lib/utils/docsNavigation.js.map +1 -0
  357. package/lib/utils/helpCenterUtils.d.ts +26 -0
  358. package/lib/utils/helpCenterUtils.d.ts.map +1 -0
  359. package/lib/utils/index.d.ts +3 -0
  360. package/lib/utils/index.d.ts.map +1 -0
  361. package/lib/utils/index.js +3 -0
  362. package/lib/utils/index.js.map +1 -0
  363. package/lib/utils/markdownLoader.d.ts +36 -0
  364. package/lib/utils/markdownLoader.d.ts.map +1 -0
  365. package/lib/utils/markdownLoader.js +2242 -0
  366. package/lib/utils/markdownLoader.js.map +1 -0
  367. package/package.json +71 -0
@@ -0,0 +1,323 @@
1
+ # Developer Guide: Slug-Based URL Resolution System
2
+
3
+ ## Overview
4
+
5
+ This document provides guidelines on implementing and using our slug-based URL resolution system. This system allows us to use human-readable identifiers in URLs (e.g., `/o/acme-corp/p/web-project`) while preserving the use of database IDs for internal operations.
6
+
7
+ ## Key Benefits
8
+
9
+ - **User-Friendly URLs**: URLs contain readable names instead of database IDs
10
+ - **SEO Optimization**: Improved search engine indexing with meaningful URLs
11
+ - **Consistent API**: GraphQL queries accept slugs directly from URL parameters
12
+ - **Clean Separation**: Resolution happens in the service layer, keeping API and data access layers clean
13
+
14
+ ## Architecture
15
+
16
+ Our slug resolution system consists of:
17
+
18
+ 1. **Slug Resolvers**: Individual components that translate slugs to IDs for specific entity types
19
+ 2. **Slug Service**: Centralized service that coordinates all resolvers
20
+ 3. **Service Integration**: Entity services (Project, Organization, etc.) that utilize the slug service
21
+
22
+ ## Implementation Guide
23
+
24
+ ### 1. Slug Resolver Interface
25
+
26
+ All slug resolvers implement a common interface:
27
+
28
+ ```typescript
29
+ interface ISlugResolver {
30
+ type: string; // Entity type this resolver handles
31
+ resolve(slug: string, context?: any): Promise<string | null>; // Resolve slug to ID
32
+ validate?(slug: string): boolean; // Optional slug validation
33
+ }
34
+ ```
35
+
36
+ ### 2. Creating a New Slug Resolver
37
+
38
+ To add support for a new entity type (e.g., "feature"):
39
+
40
+ ```typescript
41
+ @injectable()
42
+ export class FeatureSlugResolver implements ISlugResolver {
43
+ public readonly type = 'feature';
44
+
45
+ constructor(
46
+ @inject('FeatureModel') private featureModel: mongoose.Model<any>,
47
+ @inject('Logger') private logger: CdmLogger.ILogger,
48
+ ) {
49
+ this.logger = logger.child({ className: FeatureSlugResolver.name });
50
+ }
51
+
52
+ async resolve(slug: string, context?: { projectId?: string }): Promise<string | null> {
53
+ try {
54
+ const query: any = { slug };
55
+
56
+ // Add project filter if provided
57
+ if (context?.projectId) {
58
+ query.project = new mongoose.Types.ObjectId(context.projectId);
59
+ }
60
+
61
+ const feature = await this.featureModel.findOne(query).lean();
62
+ return feature?._id?.toString() || null;
63
+ } catch (error) {
64
+ this.logger.error(`Error resolving feature slug '${slug}':`, error);
65
+ return null;
66
+ }
67
+ }
68
+
69
+ validate(slug: string): boolean {
70
+ return /^[a-z0-9-]{3,50}$/i.test(slug);
71
+ }
72
+ }
73
+ ```
74
+
75
+ ### 3. Registering the Resolver
76
+
77
+ Register your new resolver in the dependency injection container:
78
+
79
+ ```typescript
80
+ // In your container configuration
81
+ container.bind('SlugResolver').to(FeatureSlugResolver).whenTargetNamed('feature');
82
+ container.bind('SlugResolver').to(FeatureSlugResolver); // Also bind without name for multiInject
83
+ ```
84
+
85
+ ### 4. Service Integration
86
+
87
+ Update your service to leverage slug resolution:
88
+
89
+ ```typescript
90
+ @injectable()
91
+ export class FeatureService {
92
+ constructor(
93
+ @inject(SERVER_TYPES.IFeatureRepository) private featureRepository: IFeatureRepository,
94
+ @inject(SERVER_TYPES.SlugService) private slugService: SlugService,
95
+ @inject('Logger') private logger: CdmLogger.ILogger,
96
+ ) {
97
+ this.logger = logger.child({ className: FeatureService.name });
98
+ }
99
+
100
+ /**
101
+ * Get a feature using project and feature slugs
102
+ */
103
+ async getFeatureBySlug(featureSlug: string, projectSlug: string, orgSlug: string): Promise<IFeature> {
104
+ // First resolve the organization ID
105
+ const orgId = await this.slugService.resolveSlug('organization', orgSlug);
106
+ if (!orgId) {
107
+ throw new Error(`Organization with slug '${orgSlug}' not found`);
108
+ }
109
+
110
+ // Then resolve the project ID
111
+ const projectId = await this.slugService.resolveSlug('project', projectSlug, { orgId });
112
+ if (!projectId) {
113
+ throw new Error(`Project with slug '${projectSlug}' not found in organization '${orgSlug}'`);
114
+ }
115
+
116
+ // Finally resolve the feature ID
117
+ const featureId = await this.slugService.resolveSlug('feature', featureSlug, { projectId });
118
+ if (!featureId) {
119
+ throw new Error(`Feature with slug '${featureSlug}' not found in project '${projectSlug}'`);
120
+ }
121
+
122
+ // Get the feature by ID
123
+ return this.featureRepository.findById(featureId);
124
+ }
125
+
126
+ // Other methods...
127
+ }
128
+ ```
129
+
130
+ ### 5. GraphQL Resolver Integration
131
+
132
+ Create GraphQL resolvers that work directly with slugs:
133
+
134
+ ```typescript
135
+ // In your GraphQL resolvers
136
+ const resolvers = {
137
+ Query: {
138
+ getFeatureBySlug: async (_, { orgSlug, projectSlug, featureSlug }, { featureService }) => {
139
+ return featureService.getFeatureBySlug(featureSlug, projectSlug, orgSlug);
140
+ },
141
+
142
+ // Other resolvers...
143
+ },
144
+ };
145
+ ```
146
+
147
+ ### 6. GraphQL Schema Definition
148
+
149
+ Define GraphQL types that accept slugs:
150
+
151
+ ```graphql
152
+ extend type Query {
153
+ getFeatureBySlug(orgSlug: String!, projectSlug: String!, featureSlug: String!): Feature
154
+
155
+ # Other queries...
156
+ }
157
+ ```
158
+
159
+ ## Best Practices
160
+
161
+ ### Slug Format Guidelines
162
+
163
+ - **Length**: 3-50 characters
164
+ - **Characters**: Lowercase letters, numbers, hyphens
165
+ - **Validation**: Implement `validate()` in your resolver to enforce rules
166
+ - **Uniqueness**: Ensure slugs are unique within their parent context (e.g., projects within an organization)
167
+
168
+ ### Error Handling
169
+
170
+ Always provide clear error messages when slugs can't be resolved:
171
+
172
+ ```typescript
173
+ if (!projectId) {
174
+ throw new Error(`Project with slug '${projectSlug}' not found in organization '${orgSlug}'`);
175
+ }
176
+ ```
177
+
178
+ ### Performance Considerations
179
+
180
+ 1. **Caching**: Consider caching frequently used slug resolutions
181
+ 2. **Database Indexes**: Ensure slug fields are indexed in your database schema
182
+ 3. **Batch Resolution**: Resolve multiple slugs in a single database query when possible
183
+
184
+ ### URL Structure Standards
185
+
186
+ Follow these URL structure patterns:
187
+
188
+ - `/o/:orgSlug` - Organization context
189
+ - `/o/:orgSlug/w/:workspaceSlug` - Workspace within organization
190
+ - `/o/:orgSlug/p/:projectSlug` - Project within organization
191
+ - `/o/:orgSlug/p/:projectSlug/f/:featureSlug` - Feature within project
192
+
193
+ ### Security Considerations
194
+
195
+ - **Validate Input**: Always validate slug format before querying the database
196
+ - **Access Control**: Apply authorization checks after slug resolution
197
+ - **Injection Prevention**: Use parameterized queries when resolving slugs
198
+
199
+ ## Testing
200
+
201
+ ### Unit Testing Resolvers
202
+
203
+ ```typescript
204
+ describe('ProjectSlugResolver', () => {
205
+ it('should resolve a valid project slug', async () => {
206
+ // Setup test
207
+ const mockProjectModel = {
208
+ findOne: jest.fn().mockReturnValue({
209
+ lean: jest.fn().mockResolvedValue({ _id: 'project123', slug: 'web-app' }),
210
+ }),
211
+ };
212
+
213
+ const resolver = new ProjectSlugResolver(mockProjectModel, mockLogger);
214
+
215
+ // Test
216
+ const result = await resolver.resolve('web-app', { orgId: 'org123' });
217
+
218
+ // Assertions
219
+ expect(result).toBe('project123');
220
+ expect(mockProjectModel.findOne).toHaveBeenCalledWith({
221
+ slug: 'web-app',
222
+ organization: expect.any(Object), // MongoDB ObjectId
223
+ });
224
+ });
225
+
226
+ // Other tests...
227
+ });
228
+ ```
229
+
230
+ ### Integration Testing
231
+
232
+ Test the full flow from GraphQL resolver to database:
233
+
234
+ ```typescript
235
+ describe('Feature GraphQL API', () => {
236
+ it('should fetch a feature by slugs', async () => {
237
+ // Setup test data in database
238
+
239
+ // Execute query
240
+ const result = await graphql({
241
+ schema,
242
+ source: `
243
+ query {
244
+ getFeatureBySlug(
245
+ orgSlug: "acme-corp",
246
+ projectSlug: "web-app",
247
+ featureSlug: "login-page"
248
+ ) {
249
+ id
250
+ name
251
+ description
252
+ }
253
+ }
254
+ `,
255
+ });
256
+
257
+ // Assertions
258
+ expect(result.errors).toBeUndefined();
259
+ expect(result.data.getFeatureBySlug).toEqual({
260
+ id: expect.any(String),
261
+ name: 'Login Page',
262
+ description: 'User authentication feature',
263
+ });
264
+ });
265
+ });
266
+ ```
267
+
268
+ ## Troubleshooting
269
+
270
+ ### Common Issues
271
+
272
+ 1. **Slug Not Found**: Verify the slug exists in the database and check case sensitivity
273
+ 2. **Hierarchical Resolution Failing**: Ensure parent entities exist and are correctly linked
274
+ 3. **Performance Issues**: Check database indexes on slug fields
275
+
276
+ ### Debugging Tips
277
+
278
+ 1. Enable debug logging in the slug service:
279
+
280
+ ```typescript
281
+ this.logger.debug(`Resolving ${type} slug: ${slug} with context:`, context);
282
+ ```
283
+
284
+ 2. Use the MongoDB shell to verify slug existence:
285
+
286
+ ```
287
+ db.projects.findOne({ slug: "web-app", organization: ObjectId("...") })
288
+ ```
289
+
290
+ ## Example Implementation Walkthrough
291
+
292
+ ### 1. Resolve Organization Slug
293
+
294
+ ```typescript
295
+ // Get the organization ID from the slug
296
+ const orgId = await slugService.resolveOrganizationSlug('acme-corp');
297
+ // orgId = "507f1f77bcf86cd799439011"
298
+ ```
299
+
300
+ ### 2. Resolve Project Slug Within Organization
301
+
302
+ ```typescript
303
+ // Get the project ID from the slug, within the organization context
304
+ const projectId = await slugService.resolveProjectSlug('web-app', orgId);
305
+ // projectId = "507f1f77bcf86cd799439012"
306
+ ```
307
+
308
+ ### 3. Use IDs for Database Operations
309
+
310
+ ```typescript
311
+ // Now use the IDs for your database operations
312
+ const project = await projectRepository.findById(projectId);
313
+ ```
314
+
315
+ ## Further Resources
316
+
317
+ - Dependency Injection: [InversifyJS Documentation](https://inversify.io/)
318
+ - GraphQL: [Apollo Server Documentation](https://www.apollographql.com/docs/apollo-server/)
319
+ - MongoDB: [Mongoose Documentation](https://mongoosejs.com/)
320
+
321
+ ## Conclusion
322
+
323
+ By following these guidelines, you can implement a clean, efficient slug resolution system that provides user-friendly URLs while maintaining type safety and performance in your backend operations. This system scales well with the addition of new entity types and maintains a clear separation of concerns across your application layers.
@@ -0,0 +1,18 @@
1
+ ---
2
+ meta:
3
+ title: Tests
4
+ description: Tests
5
+ date: '2023-06-02T00:00:00'
6
+ updated: '2024-06-02T00:00:00'
7
+ excerpt: Tests...
8
+ headers:
9
+ Cache-Control: no-cache
10
+ ---
11
+
12
+ ## Tests
13
+
14
+ **[Known Errors](/docs/tests/known-errors)**
15
+
16
+ **[Jest template for Backend Services that connects to Mock MongoDB](/docs/tests/service-test-template)**
17
+
18
+ **[Test Setup](/docs/tests/test-setup)**
@@ -0,0 +1,40 @@
1
+ ---
2
+ meta:
3
+ title: Jest Test Debug
4
+ description: Jest Test Debug
5
+ date: '2023-06-02T00:00:00'
6
+ updated: '2024-06-02T00:00:00'
7
+ excerpt: Jest Test Debug...
8
+ headers:
9
+ Cache-Control: no-cache
10
+ ---
11
+
12
+ ## Jest Test Debug VScode
13
+
14
+ 1. Find the test file and test pattern you want to test.
15
+
16
+ It is good to debug individual "test"
17
+
18
+ for example:
19
+
20
+ If I want to test only below
21
+
22
+ <img width="1425" alt="image" src="https://user-images.githubusercontent.com/3382355/234813745-c05bc64d-10c1-4257-95f4-8729aa9fc578.png"/>
23
+
24
+ Using lerna we use following command
25
+
26
+ `lerna exec --scope=<package_name> 'yarn test Configuration.test -- -t "Test update value"'`
27
+
28
+ 2. To test with vscode debugger update the package path and test args under `.vscode/launch.json`
29
+
30
+ <img width="1426" alt="image" src="https://user-images.githubusercontent.com/3382355/234815929-08111211-4d03-4117-865c-16b85e47fb23.png"/>
31
+
32
+ 3. And run the default test.
33
+
34
+ Don't push the changes as it is for your internal testing only.
35
+
36
+ <img width="597" alt="image" src="https://user-images.githubusercontent.com/3382355/234816355-280ba401-964f-48aa-930a-dae3fafba03d.png"/>
37
+
38
+ 4. Put debugger where you want to debug.
39
+
40
+ <img width="1665" alt="image" src="https://user-images.githubusercontent.com/3382355/234816878-d0eeb3aa-4bea-45b1-a7be-0f60d5e6251f.png"/>
@@ -0,0 +1,116 @@
1
+ ---
2
+ meta:
3
+ title: Known Errors
4
+ description: Known Errors
5
+ date: '2023-06-02T00:00:00'
6
+ updated: '2024-06-02T00:00:00'
7
+ excerpt: Known Errors...
8
+ headers:
9
+ Cache-Control: no-cache
10
+ ---
11
+
12
+ ## Known Errors
13
+
14
+ #### TypeError: Reflect.hasOwnMetadata is not a function
15
+
16
+ ```
17
+ $ jest compatible.test
18
+ FAIL src/components/Layout/components/compatible.test.tsx
19
+ ● Test suite failed to run
20
+
21
+ TypeError: Reflect.hasOwnMetadata is not a function
22
+
23
+ at ../../node_modules/inversify/src/annotation/injectable.ts:7:17
24
+ ```
25
+
26
+ Solution:
27
+
28
+ Include `import 'reflect-metadata';` at the top of the test file.
29
+
30
+ #### ESM files need to be added to transformation
31
+
32
+ ```
33
+ $ jest compatible.test
34
+ FAIL src/components/Layout/components/compatible.test.tsx
35
+ ● Test suite failed to run
36
+
37
+ Jest encountered an unexpected token
38
+
39
+ This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
40
+
41
+ By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
42
+
43
+ Here's what you can do:
44
+ • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/en/ecmascript-modules for how to enable it.
45
+ • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
46
+ • If you need a custom transformation specify a "transform" option in your config.
47
+ • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
48
+
49
+ You'll find more details and examples of these config options in the docs:
50
+ https://jestjs.io/docs/en/configuration.html
51
+
52
+ Details:
53
+
54
+ /Users/veeramarni/Documents/development/workspace/projects/IDE/admin-layout/node_modules/@adminide-stack/user-auth0-client/lib/index.js:1
55
+ ```
56
+
57
+ Solution:
58
+
59
+ Jest throws error when `esm` files are used. They need to be added to `transformIgnorePatterns` in `jest.config.js` file.
60
+
61
+ For example
62
+
63
+ ```
64
+ transformIgnorePatterns: [
65
+ '/node_modules/(?!(@vscode-alt/monaco-editor|@files-stack/server-core|@adminide-stack/platform-browser|@adminide-stack/platform-client|abortable-rx|@adminide-stack/user-auth0-client|lodash-es|react-dnd-html5-backend|react-sortable-tree|react-dnd|dnd-core)/).+\\.js$',
66
+ ],
67
+ ```
68
+
69
+ #### Envalid need the required env variables to be available
70
+
71
+ ```
72
+ $ jest compatible.test
73
+ ● process.exit called with "1"
74
+
75
+ at defaultReporter (../../node_modules/envalid/src/reporter.ts:67:13
76
+ ```
77
+
78
+ Solution:
79
+
80
+ Test cases also need to have environment variables available when you using a package that uses `envalid`.
81
+
82
+ ```
83
+ // make sure `processe.env.ENV_FILE` points
84
+ // to `config/test/test.env` and file should exist.
85
+
86
+ // package.json will have script for
87
+ // `"test": "cross-env ENV_FILE=../../config/test/test.env jest",`
88
+
89
+ require('dotenv').config({ path: process.env.ENV_FILE });
90
+ ```
91
+
92
+ #### Cannot read property 'child' of undefined on React 17
93
+
94
+ ```
95
+ TypeError: Cannot read property 'child' of undefined
96
+
97
+ 25 |
98
+ 26 |
99
+ > 27 | const wrapper = mount(
100
+ | ^
101
+ 28 | <Provider store={ store } >
102
+ 29 | <DeleteEventFab />
103
+ 30 | </Provider>
104
+
105
+ at getFiber (node_modules/enzyme-adapter-react-16/src/detectFiberTags.js:15:35)
106
+ at detectFiberTags (node_modules/enzyme-adapter-react-16/src/detectFiberTags.js:76:15)
107
+ at ReactSixteenAdapter.createMountRenderer (node_modules/enzyme-adapter-react-16/src/ReactSixteenAdapter.js:465:19)
108
+ at ReactSixteenAdapter.createRenderer (node_modules/enzyme-adapter-react-16/src/ReactSixteenAdapter.js:820:51)
109
+ at new ReactWrapper (node_modules/enzyme/src/ReactWrapper.js:113:32)
110
+ at mount (node_modules/enzyme/src/mount.js:10:10)
111
+ at Object.<anonymous> (src/tests/components/DeleteEventFab.test.js:27:17)
112
+ ```
113
+
114
+ Solution:
115
+
116
+ Enzyme adapter and react needs to be on same version. Inorder to make it work for react-17 we need to utilize this import `import Adapter from '@wojtekmaj/enzyme-adapter-react-17';`
@@ -0,0 +1,118 @@
1
+ ---
2
+ meta:
3
+ title: Service Test Template
4
+ description: Service Test Template
5
+ date: '2023-06-02T00:00:00'
6
+ updated: '2024-06-02T00:00:00'
7
+ excerpt: Service Test Template...
8
+ headers:
9
+ Cache-Control: no-cache
10
+ ---
11
+
12
+ ## Service Test Template
13
+
14
+ # Jest template for Backend Services that connects to Mock MongoDB
15
+
16
+ ### Step 1. Jest config file within the package
17
+
18
+ Provide the related jest configuration and mock mongo configuration.
19
+
20
+ Here are relative path (`../../../`) is based on the package related to the root.
21
+
22
+ ```
23
+ const base = require('../../../jest.config.base');
24
+ const packageJson = require('./package');
25
+ const merge = require('merge')
26
+ const baseConfig = require('../../../jest.config.base');
27
+ const mongodbConfig = require('../../../jest.config.mongodb');
28
+
29
+ const mergeData = merge.recursive(
30
+ baseConfig,
31
+ {
32
+ "transform": {
33
+ "\\.(js|jsx)?$": "../../../transform.js",
34
+ },
35
+ moduleNameMapper: {
36
+ '^__mocks__/(.*)$': '<rootDir>/../../__mocks__/$1',
37
+ // we'll use commonjs version of lodash for tests 👌
38
+ // because we don't need to use any kind of tree shaking right?!
39
+ '^lodash-es$': '<rootDir>/../../../node_modules/lodash/index.js',
40
+ '@adminide-stack\/core': '<rootDir>/../../adminide-core/src/index.ts',
41
+ },
42
+ roots: [
43
+ "src",
44
+ ],
45
+ },
46
+ mongodbConfig,
47
+ {
48
+ globals: {
49
+
50
+ }
51
+ }
52
+ );
53
+
54
+ module.exports = mergeData;
55
+ ```
56
+
57
+ ### Step 2. Make sure you have test.env file under `config/test`
58
+
59
+ You can copy the existing `dev.env` values in `test.env` unless you want to modify anything based on your testing need.
60
+
61
+ ### Step 3. Create test file like `AccountService.test.ts` within the same folder where you have `AccountService.ts`
62
+
63
+ ```
64
+ import 'reflect-metadata';
65
+ import * as MongoDB from 'mongodb';
66
+ import { connection as mongooseConnection } from 'mongoose';
67
+ import mongoose from 'mongoose';
68
+ import { config } from 'dotenv';
69
+ import { logger } from '@cdm-logger/server';
70
+ import { AccountRepository } from '../../store/repositories/account-repository';
71
+ import { AccountService } from './account-service';
72
+ import * as data from './fixtures/account-fixture.json';
73
+ config({ path: process.env.ENV_FILE });
74
+
75
+ // needed for all test cases
76
+ async function dropAllCollections() {
77
+ const collections = Object.keys(mongooseConnection.collections);
78
+ for (const collectionName of collections) {
79
+ const collection = mongooseConnection.collections[collectionName];
80
+ try {
81
+ await collection.drop();
82
+ } catch (error) {
83
+ // Sometimes this error happens, but you can safely ignore it
84
+ if (error.message === 'ns not found') return;
85
+ // This error occurs when you use it.todo. You can
86
+ // safely ignore this error too
87
+ if (error.message.includes('a background operation is currently running')) return;
88
+ console.log(error.message);
89
+ }
90
+ }
91
+ }
92
+
93
+ describe('test Create/Update/Delete Account Service', () => {
94
+ let db: MongoDB.Db;
95
+ let connection: MongoDB.MongoClient;
96
+ let accountRepo: AccountRepository;
97
+ let accountService: AccountService;
98
+ beforeAll(async () => {
99
+ const conn = mongoose.createConnection(process.env.MONGO_URL, { dbName: 'jest' });
100
+ accountRepo = new AccountRepository(conn, logger);
101
+ accountService = new AccountService(logger, accountRepo);
102
+ });
103
+ afterAll(async () => {
104
+ await dropAllCollections();
105
+ connection.close();
106
+ });
107
+
108
+ it('service ', async() => {
109
+ await accountRepo.create(data);
110
+ const result = await accountRepo.getAll({});
111
+ ........
112
+
113
+ });
114
+ });
115
+
116
+ ```
117
+
118
+ ### Step 4. Now run test using `lerna exec --scope=<package name\> yarn test <test file\>`