studiocms 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (263) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/dist/cli/add/index.d.ts +2 -2
  3. package/dist/cli/add/npm-utils.d.ts +6 -6
  4. package/dist/cli/add/tryToInstallPlugins.d.ts +1 -1
  5. package/dist/cli/add/updateStudioCMSConfig.d.ts +1 -1
  6. package/dist/cli/add/validatePlugins.d.ts +1 -1
  7. package/dist/cli/crypto/genJWT/index.d.ts +1 -1
  8. package/dist/cli/crypto/index.d.ts +1 -1
  9. package/dist/cli/init/steps/env.js +12 -2
  10. package/dist/cli/init/steps/next.d.ts +1 -1
  11. package/dist/cli/migrator/index.d.ts +1 -1
  12. package/dist/cli/users/index.d.ts +1 -1
  13. package/dist/cli/users/steps/createUsers.js +3 -3
  14. package/dist/cli/users/steps/next.d.ts +1 -1
  15. package/dist/cli/utils/context.d.ts +1 -1
  16. package/dist/cli/utils/getCliDbClient.d.ts +1 -1
  17. package/dist/cli/utils/intro.d.ts +1 -1
  18. package/dist/cli/utils/loadConfig.d.ts +54 -49
  19. package/dist/cli/utils/loadConfig.js +5 -8
  20. package/dist/cli/utils/user-utils.d.ts +1 -1
  21. package/dist/client/apiClient.d.ts +4923 -0
  22. package/dist/client/apiClient.js +72 -0
  23. package/dist/config.d.ts +1734 -1
  24. package/dist/consts.d.ts +5 -5
  25. package/dist/consts.js +3 -2
  26. package/dist/db/plugins.d.ts +1 -1
  27. package/dist/db/plugins.js +5 -8
  28. package/dist/handlers/frontend/routes.d.ts +4 -18
  29. package/dist/handlers/frontend/routes.js +13 -152
  30. package/dist/handlers/frontend/types.d.ts +1 -1
  31. package/dist/handlers/frontend/utils.js +0 -18
  32. package/dist/handlers/pluginHandler.d.ts +34 -257
  33. package/dist/handlers/pluginHandler.js +92 -46
  34. package/dist/handlers/routeHandler.js +32 -11
  35. package/dist/handlers/setupDbStudio.d.ts +1 -1
  36. package/dist/handlers/storage-manager/core/effectify-astro-context.d.ts +25 -0
  37. package/dist/handlers/storage-manager/core/effectify-astro-context.js +78 -0
  38. package/dist/handlers/storage-manager/no-op.d.ts +2 -2
  39. package/dist/handlers/storage-manager/no-op.js +2 -3
  40. package/dist/index.d.ts +0 -1
  41. package/dist/index.js +9 -5
  42. package/dist/integrations/robots/index.d.ts +2 -2
  43. package/dist/integrations/robots/index.js +1 -3
  44. package/dist/integrations/robots/schema.d.ts +102 -273
  45. package/dist/integrations/robots/schema.js +220 -209
  46. package/dist/plugins/analytics/assets/schemas.d.ts +14 -9
  47. package/dist/plugins/analytics/assets/schemas.js +25 -17
  48. package/dist/plugins/analytics/db-client.d.ts +1 -1
  49. package/dist/plugins/analytics/index.d.ts +823 -3
  50. package/dist/plugins/analytics/index.js +4 -5
  51. package/dist/plugins/analytics/schemas.d.ts +54 -62
  52. package/dist/plugins/analytics/schemas.js +64 -13
  53. package/dist/plugins/analytics/table.d.ts +1 -1
  54. package/dist/plugins.d.ts +0 -1
  55. package/dist/schemas/config/api.d.ts +17 -0
  56. package/dist/schemas/config/api.js +14 -0
  57. package/dist/schemas/config/auth.d.ts +55 -59
  58. package/dist/schemas/config/auth.js +34 -11
  59. package/dist/schemas/config/dashboard.d.ts +43 -79
  60. package/dist/schemas/config/dashboard.js +43 -12
  61. package/dist/schemas/config/db.d.ts +15 -17
  62. package/dist/schemas/config/db.js +13 -5
  63. package/dist/schemas/config/developer.d.ts +33 -45
  64. package/dist/schemas/config/developer.js +22 -5
  65. package/dist/schemas/config/index.d.ts +398 -521
  66. package/dist/schemas/config/index.js +115 -57
  67. package/dist/schemas/config/sdk.d.ts +50 -196
  68. package/dist/schemas/config/sdk.js +61 -73
  69. package/dist/schemas/custom.d.ts +40 -0
  70. package/dist/schemas/custom.js +41 -0
  71. package/dist/schemas/external-schemas.d.ts +171 -0
  72. package/dist/schemas/external-schemas.js +179 -0
  73. package/dist/schemas/index.d.ts +2 -0
  74. package/dist/schemas/index.js +2 -0
  75. package/dist/schemas/plugins/i18n.d.ts +59 -39
  76. package/dist/schemas/plugins/i18n.js +42 -5
  77. package/dist/schemas/plugins/index.d.ts +7126 -10296
  78. package/dist/schemas/plugins/index.js +260 -276
  79. package/dist/schemas/plugins/shared.d.ts +1293 -3718
  80. package/dist/schemas/plugins/shared.js +320 -329
  81. package/dist/test-utils.d.ts +15 -4
  82. package/dist/test-utils.js +27 -11
  83. package/dist/toolbar/db-viewer/db-shared-types.d.ts +6 -6
  84. package/dist/toolbar/db-viewer/viewer.js +20 -21
  85. package/dist/types.d.ts +30 -0
  86. package/dist/utils/effects/smtp.d.ts +1 -1
  87. package/dist/utils/lang-helper.d.ts +10 -2
  88. package/dist/virtual.d.ts +23 -0
  89. package/dist/virtuals/auth/core.d.ts +5 -5
  90. package/dist/virtuals/auth/verify-email.d.ts +6 -6
  91. package/dist/virtuals/components/Generator.astro +2 -2
  92. package/dist/virtuals/components/Renderer.astro +9 -1
  93. package/dist/virtuals/components/renderFn.d.ts +3 -1
  94. package/dist/virtuals/components/renderFn.js +18 -0
  95. package/dist/virtuals/lib/headDefaults.d.ts +4 -2
  96. package/dist/virtuals/lib/headDefaults.js +0 -2
  97. package/dist/virtuals/lib/routeMap.d.ts +0 -12
  98. package/dist/virtuals/lib/routeMap.js +2 -14
  99. package/dist/virtuals/mailer/index.d.ts +3 -3
  100. package/dist/virtuals/notifier/index.d.ts +5 -5
  101. package/dist/virtuals/plugins/dashboard-pages.d.ts +2 -64
  102. package/dist/virtuals/scripts/StorageFileBrowser.d.ts +1 -172
  103. package/dist/virtuals/scripts/StorageFileBrowser.js +216 -119
  104. package/dist/virtuals/template-engine/index.d.ts +4 -4
  105. package/frontend/components/dashboard/configuration/ConfigForm.astro +218 -110
  106. package/frontend/components/dashboard/content-mgmt/ContentSearch.astro +21 -22
  107. package/frontend/components/dashboard/content-mgmt/CreateFolder.astro +66 -54
  108. package/frontend/components/dashboard/content-mgmt/CreatePage.astro +58 -104
  109. package/frontend/components/dashboard/content-mgmt/EditFolder.astro +65 -67
  110. package/frontend/components/dashboard/content-mgmt/EditPage.astro +86 -134
  111. package/frontend/components/dashboard/content-mgmt/InnerSidebarElement.astro +0 -1
  112. package/frontend/components/dashboard/content-mgmt/PageHeader.astro +33 -52
  113. package/frontend/components/dashboard/content-mgmt/PageTypeHandler.astro +2 -2
  114. package/frontend/components/dashboard/profile/APITokens.astro +219 -158
  115. package/frontend/components/dashboard/profile/BasicInfo.astro +165 -106
  116. package/frontend/components/dashboard/profile/Notifications.astro +27 -18
  117. package/frontend/components/dashboard/profile/UpdatePassword.astro +134 -94
  118. package/frontend/components/dashboard/sidebar/VersionCheck.astro +31 -16
  119. package/frontend/components/dashboard/sidebar/VersionCheckChangelog.astro +18 -11
  120. package/frontend/components/dashboard/sidebar-modals/VersionModal.astro +2 -2
  121. package/frontend/components/dashboard/smtp-config/TemplateEditor.astro +14 -14
  122. package/frontend/components/dashboard/taxonomy/InnerSidebarElement.astro +0 -1
  123. package/frontend/components/dashboard/taxonomy/MetaContainer.astro +0 -2
  124. package/frontend/components/dashboard/taxonomy/PageHeader.astro +16 -24
  125. package/frontend/components/dashboard/taxonomy/TaxonomySearch.astro +23 -27
  126. package/frontend/components/dashboard/user-mgmt/InnerSidebarElement.astro +111 -104
  127. package/frontend/components/dashboard/user-mgmt/UserListItem.astro +9 -22
  128. package/frontend/components/dashboard/user-mgmt/UserListItems.astro +18 -0
  129. package/frontend/components/first-time-setup/snippets/{opt2-studiocms.config.diff → studiocms.config.diff} +1 -0
  130. package/frontend/components/shared/Code.astro +1 -4
  131. package/frontend/components/shared/DynamicSettingsRenderer.astro +1 -1
  132. package/frontend/components/shared/SSRUser.astro +2 -4
  133. package/frontend/components/shared/foldertree/FolderTreeNode.astro +0 -6
  134. package/frontend/components/shared/storage-manager/StorageCopyOutput.astro +0 -1
  135. package/frontend/components/shared/taxonomy/TaxonomyTreeNode.astro +0 -6
  136. package/frontend/layouts/DashboardLayout.astro +0 -9
  137. package/frontend/layouts/TaxonomyLayout.astro +0 -1
  138. package/frontend/middleware/index.ts +102 -61
  139. package/frontend/pages/404.astro +0 -1
  140. package/frontend/pages/[dashboard]/[...pluginPage].astro +10 -1
  141. package/frontend/pages/[dashboard]/configuration.astro +10 -1
  142. package/frontend/pages/[dashboard]/content-management/createfolder.astro +10 -1
  143. package/frontend/pages/[dashboard]/content-management/createpage.astro +10 -1
  144. package/frontend/pages/[dashboard]/content-management/diff.astro +39 -14
  145. package/frontend/pages/[dashboard]/content-management/editfolder.astro +10 -1
  146. package/frontend/pages/[dashboard]/content-management/editpage.astro +10 -1
  147. package/frontend/pages/[dashboard]/content-management/index.astro +10 -1
  148. package/frontend/pages/[dashboard]/index.astro +10 -1
  149. package/frontend/pages/[dashboard]/login.astro +86 -25
  150. package/frontend/pages/[dashboard]/password-reset.astro +22 -16
  151. package/frontend/pages/[dashboard]/plugins/[plugin].astro +10 -1
  152. package/frontend/pages/[dashboard]/profile.astro +10 -1
  153. package/frontend/pages/[dashboard]/signup.astro +153 -52
  154. package/frontend/pages/[dashboard]/smtp-configuration.astro +77 -75
  155. package/frontend/pages/[dashboard]/system-management.astro +10 -1
  156. package/frontend/pages/[dashboard]/taxonomy/categories.astro +30 -41
  157. package/frontend/pages/[dashboard]/taxonomy/index.astro +10 -0
  158. package/frontend/pages/[dashboard]/taxonomy/tags.astro +33 -43
  159. package/frontend/pages/[dashboard]/unverified-email.astro +29 -21
  160. package/frontend/pages/[dashboard]/user-management/edit.astro +170 -90
  161. package/frontend/pages/[dashboard]/user-management/index.astro +10 -1
  162. package/frontend/pages/studiocms_api/[...all].ts +106 -0
  163. package/frontend/pages/studiocms_api/_handlers/_utils/auth.ts +26 -0
  164. package/frontend/pages/studiocms_api/_handlers/_utils/changelog.ts +147 -0
  165. package/frontend/pages/studiocms_api/_handlers/_utils/db-studio-driver.ts +46 -0
  166. package/frontend/pages/studiocms_api/_handlers/_utils/parseLogLevel.ts +27 -0
  167. package/frontend/pages/studiocms_api/_handlers/auth/auth.ts +459 -0
  168. package/frontend/pages/studiocms_api/_handlers/auth/index.ts +17 -0
  169. package/frontend/pages/studiocms_api/_handlers/auth/oauth.ts +91 -0
  170. package/frontend/pages/studiocms_api/_handlers/dashboard/_shared.ts +57 -0
  171. package/frontend/pages/studiocms_api/_handlers/dashboard/apiTokens.ts +134 -0
  172. package/frontend/pages/studiocms_api/_handlers/dashboard/config.ts +64 -0
  173. package/frontend/pages/studiocms_api/_handlers/dashboard/content.ts +741 -0
  174. package/frontend/pages/studiocms_api/_handlers/dashboard/create.ts +480 -0
  175. package/frontend/pages/studiocms_api/_handlers/dashboard/emailNotifications.ts +49 -0
  176. package/frontend/pages/studiocms_api/_handlers/dashboard/index.ts +45 -0
  177. package/frontend/pages/studiocms_api/_handlers/dashboard/mailer.ts +136 -0
  178. package/frontend/pages/studiocms_api/_handlers/dashboard/plugins.ts +80 -0
  179. package/frontend/pages/studiocms_api/_handlers/dashboard/profile.ts +275 -0
  180. package/frontend/pages/studiocms_api/_handlers/dashboard/resetPassword.ts +140 -0
  181. package/frontend/pages/studiocms_api/_handlers/dashboard/search.ts +63 -0
  182. package/frontend/pages/studiocms_api/_handlers/dashboard/taxonomy.ts +285 -0
  183. package/frontend/pages/studiocms_api/_handlers/dashboard/templates.ts +75 -0
  184. package/frontend/pages/studiocms_api/_handlers/dashboard/users.ts +312 -0
  185. package/frontend/pages/studiocms_api/_handlers/dashboard/verifyEndpoints.ts +307 -0
  186. package/frontend/pages/studiocms_api/_handlers/integration/dbStudio.ts +98 -0
  187. package/frontend/pages/studiocms_api/_handlers/integration/index.ts +17 -0
  188. package/frontend/pages/studiocms_api/_handlers/integration/storageManager.ts +107 -0
  189. package/frontend/pages/studiocms_api/_handlers/rest-api/index.ts +8 -0
  190. package/frontend/pages/studiocms_api/_handlers/rest-api/v1/_shared.ts +41 -0
  191. package/frontend/pages/studiocms_api/_handlers/rest-api/v1/index.ts +17 -0
  192. package/frontend/pages/studiocms_api/_handlers/rest-api/v1/public.ts +195 -0
  193. package/frontend/pages/studiocms_api/_handlers/rest-api/v1/secure.ts +1726 -0
  194. package/frontend/pages/studiocms_api/_handlers/sdk.ts +129 -0
  195. package/frontend/pages/studiocms_api/_middleware/astroLocals.ts +36 -0
  196. package/frontend/pages/studiocms_api/_middleware/restApi.ts +56 -0
  197. package/frontend/pages/studiocms_api/integrations/[...all].ts +8 -0
  198. package/frontend/scripts/formdata.ts +219 -0
  199. package/frontend/setup-pages/3-done.astro +4 -20
  200. package/frontend/setup-pages/studiocms_api/dashboard/step-2.ts +3 -6
  201. package/frontend/styles/dashboard-base.css +0 -1
  202. package/frontend/web-vitals/endpoint.ts +2 -1
  203. package/package.json +34 -29
  204. package/dist/global.d.ts +0 -9
  205. package/frontend/components/dashboard/LoginChecker.astro +0 -68
  206. package/frontend/components/dashboard/user-mgmt/RankCheck.astro +0 -57
  207. package/frontend/components/first-time-setup/snippets/opt1-astro.config.diff +0 -14
  208. package/frontend/components/first-time-setup/snippets/opt2-astro.config.diff +0 -9
  209. package/frontend/middleware/_authmap.ts +0 -63
  210. package/frontend/pages/studiocms_api/auth/[path].ts +0 -384
  211. package/frontend/pages/studiocms_api/auth/[provider]/[...id].ts +0 -64
  212. package/frontend/pages/studiocms_api/auth/[provider]/_effects/index.ts +0 -101
  213. package/frontend/pages/studiocms_api/auth/_shared.ts +0 -52
  214. package/frontend/pages/studiocms_api/dashboard/api-tokens.ts +0 -115
  215. package/frontend/pages/studiocms_api/dashboard/config.ts +0 -74
  216. package/frontend/pages/studiocms_api/dashboard/content/diff.ts +0 -73
  217. package/frontend/pages/studiocms_api/dashboard/content/folder.ts +0 -220
  218. package/frontend/pages/studiocms_api/dashboard/content/page.ts +0 -359
  219. package/frontend/pages/studiocms_api/dashboard/create-reset-link.ts +0 -77
  220. package/frontend/pages/studiocms_api/dashboard/create-user-invite.ts +0 -231
  221. package/frontend/pages/studiocms_api/dashboard/create-user.ts +0 -186
  222. package/frontend/pages/studiocms_api/dashboard/email-notification-settings-site.ts +0 -74
  223. package/frontend/pages/studiocms_api/dashboard/mailer/check-email.ts +0 -75
  224. package/frontend/pages/studiocms_api/dashboard/mailer/config.ts +0 -136
  225. package/frontend/pages/studiocms_api/dashboard/plugins/[plugin].ts +0 -80
  226. package/frontend/pages/studiocms_api/dashboard/profile.ts +0 -245
  227. package/frontend/pages/studiocms_api/dashboard/resend-verify-email.ts +0 -77
  228. package/frontend/pages/studiocms_api/dashboard/reset-password.ts +0 -124
  229. package/frontend/pages/studiocms_api/dashboard/search-list.ts +0 -59
  230. package/frontend/pages/studiocms_api/dashboard/taxonomy-search.ts +0 -47
  231. package/frontend/pages/studiocms_api/dashboard/taxonomy.ts +0 -230
  232. package/frontend/pages/studiocms_api/dashboard/templates.ts +0 -74
  233. package/frontend/pages/studiocms_api/dashboard/update-user-notifications.ts +0 -86
  234. package/frontend/pages/studiocms_api/dashboard/users.ts +0 -236
  235. package/frontend/pages/studiocms_api/dashboard/verify-email.ts +0 -83
  236. package/frontend/pages/studiocms_api/dashboard/verify-session.ts +0 -187
  237. package/frontend/pages/studiocms_api/integrations/[type]/[...id].ts +0 -15
  238. package/frontend/pages/studiocms_api/integrations/[type]/_routes/db-studio.ts +0 -173
  239. package/frontend/pages/studiocms_api/integrations/[type]/_routes/storage.ts +0 -88
  240. package/frontend/pages/studiocms_api/partials/editor.astro +0 -74
  241. package/frontend/pages/studiocms_api/partials/render.astro +0 -39
  242. package/frontend/pages/studiocms_api/partials/user-list-items.astro +0 -43
  243. package/frontend/pages/studiocms_api/rest/utils/auth-token.ts +0 -59
  244. package/frontend/pages/studiocms_api/rest/v1/[type]/[...id].ts +0 -23
  245. package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/categories.ts +0 -267
  246. package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/folders.ts +0 -283
  247. package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/pages.ts +0 -505
  248. package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/settings.ts +0 -100
  249. package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/tags.ts +0 -229
  250. package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/users.ts +0 -553
  251. package/frontend/pages/studiocms_api/rest/v1/public/[type]/[...id].ts +0 -19
  252. package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/categories.ts +0 -74
  253. package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/folders.ts +0 -85
  254. package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/pages.ts +0 -103
  255. package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/tags.ts +0 -67
  256. package/frontend/pages/studiocms_api/sdk/[...path].ts +0 -97
  257. package/frontend/pages/studiocms_api/sdk/utils/changelog.ts +0 -119
  258. package/frontend/scripts/auth/formListener.ts +0 -81
  259. package/frontend/scripts/formdata-utils.ts +0 -116
  260. package/frontend/utils/build-partial-schema.ts +0 -46
  261. package/frontend/utils/errors.ts +0 -6
  262. package/frontend/utils/param-extractor.ts +0 -83
  263. package/frontend/utils/rest-router.ts +0 -444
@@ -1,6 +1,17 @@
1
1
  import type { AstroIntegration, AstroIntegrationLogger } from 'astro';
2
- import type { SCMSAuthServiceFnOpts, SCMSDashboardAugmentFnOpts, SCMSDashboardFnOpts, SCMSFrontendFnOpts, SCMSImageServiceFnOpts, SCMSRenderingFnOpts, SCMSSiteMapFnOpts, StudioCMSPlugin } from './schemas/index.js';
2
+ import { type SCMSAuthServiceFnOpts, type SCMSDashboardAugmentFnOpts, type SCMSDashboardFnOpts, type SCMSFrontendFnOpts, type SCMSImageServiceFnOpts, type SCMSRenderingFnOpts, type SCMSSiteMapFnOpts, type StudioCMSPlugin, type StudioCMSPluginDef } from './schemas/index.js';
3
3
  import type { PluginRenderer } from './types.js';
4
+ /**
5
+ * Factory function to create a test instance of the StudioCMS UI plugin with predefined icon sets.
6
+ *
7
+ * This function initializes the StudioCMS UI plugin with the `noInjectCSS` option set to `true`
8
+ * and includes a selection of icons from the `flat-color-icons`, `simple-icons`, and `circle-flags` icon sets.
9
+ * It is intended for use in testing environments where the full UI functionality is not required, but access to
10
+ * the plugin's features and icons is necessary for validating plugin behavior.
11
+ *
12
+ * @returns A configured instance of the StudioCMS UI plugin for testing purposes.
13
+ */
14
+ export declare const TestStudioCmsUiInstance: () => AstroIntegration;
4
15
  type HookRun<T> = {
5
16
  hasHook: boolean;
6
17
  hookResults: T;
@@ -39,9 +50,9 @@ export interface PluginHookResults {
39
50
  * ```
40
51
  */
41
52
  export declare class StudioCMSPluginTester {
42
- private readonly plugin;
53
+ readonly plugin: StudioCMSPlugin;
43
54
  private readonly injectedLogger?;
44
- constructor(plugin: StudioCMSPlugin, logger?: AstroIntegrationLogger);
55
+ constructor(plugin: StudioCMSPluginDef, logger?: AstroIntegrationLogger);
45
56
  /**
46
57
  * Creates a mock logger object for testing purposes.
47
58
  *
@@ -97,7 +108,7 @@ export declare class StudioCMSPluginTester {
97
108
  *
98
109
  * @returns An object containing the plugin's identifier, name, minimum required StudioCMS version, and dependencies.
99
110
  */
100
- getPluginInfo(): Pick<StudioCMSPlugin, 'identifier' | 'name' | 'studiocmsMinimumVersion' | 'requires'>;
111
+ getPluginInfo(): Pick<StudioCMSPlugin, 'identifier' | 'name' | 'requires'>;
101
112
  /**
102
113
  * Checks if the plugin has any StudioCMS-specific hooks defined.
103
114
  *
@@ -1,8 +1,24 @@
1
+ import { icons as circleFlags } from "@iconify-json/circle-flags";
2
+ import { icons as flatColorIcons } from "@iconify-json/flat-color-icons";
3
+ import { icons as simpleIcons } from "@iconify-json/simple-icons";
4
+ import studiocmsUi from "@studiocms/ui";
5
+ import { Schema } from "effect";
6
+ import {
7
+ StudioCMSPluginSchema
8
+ } from "./schemas/index.js";
9
+ const TestStudioCmsUiInstance = () => studiocmsUi({
10
+ noInjectCSS: true,
11
+ icons: {
12
+ flatcoloricons: flatColorIcons,
13
+ simpleicons: simpleIcons,
14
+ "lang-flags": circleFlags
15
+ }
16
+ });
1
17
  class StudioCMSPluginTester {
2
18
  plugin;
3
19
  injectedLogger;
4
20
  constructor(plugin, logger) {
5
- this.plugin = plugin;
21
+ this.plugin = Schema.decodeSync(StudioCMSPluginSchema)(plugin);
6
22
  this.injectedLogger = logger;
7
23
  }
8
24
  /**
@@ -47,7 +63,7 @@ class StudioCMSPluginTester {
47
63
  if (typeof this.plugin.hooks["studiocms:astro-config"] === "function") {
48
64
  await this.plugin.hooks["studiocms:astro-config"]({
49
65
  logger: this.createMockLogger(),
50
- addIntegrations: (newIntegrations) => {
66
+ addIntegrations: async (newIntegrations) => {
51
67
  const toAdd = Array.isArray(newIntegrations) ? newIntegrations : [newIntegrations];
52
68
  integrations.push(...toAdd);
53
69
  }
@@ -85,7 +101,7 @@ class StudioCMSPluginTester {
85
101
  if (typeof hooks["studiocms:auth"] === "function") {
86
102
  await hooks["studiocms:auth"]({
87
103
  logger,
88
- setAuthService: ({ oAuthProvider }) => {
104
+ setAuthService: async ({ oAuthProvider }) => {
89
105
  if (oAuthProvider !== void 0) {
90
106
  authService.oAuthProvider = oAuthProvider;
91
107
  }
@@ -95,7 +111,7 @@ class StudioCMSPluginTester {
95
111
  if (typeof hooks["studiocms:dashboard"] === "function") {
96
112
  await hooks["studiocms:dashboard"]({
97
113
  logger,
98
- setDashboard: ({ dashboardGridItems, dashboardPages }) => {
114
+ setDashboard: async ({ dashboardGridItems, dashboardPages }) => {
99
115
  if (dashboardGridItems !== void 0) {
100
116
  dashboard.dashboardGridItems = dashboardGridItems;
101
117
  }
@@ -103,7 +119,7 @@ class StudioCMSPluginTester {
103
119
  dashboard.dashboardPages = dashboardPages;
104
120
  }
105
121
  },
106
- augmentDashboard: ({ components, scripts }) => {
122
+ augmentDashboard: async ({ components, scripts }) => {
107
123
  if (components !== void 0) {
108
124
  dashboardAugments.components = components;
109
125
  }
@@ -116,7 +132,7 @@ class StudioCMSPluginTester {
116
132
  if (typeof hooks["studiocms:frontend"] === "function") {
117
133
  await hooks["studiocms:frontend"]({
118
134
  logger,
119
- setFrontend: ({ frontendNavigationLinks }) => {
135
+ setFrontend: async ({ frontendNavigationLinks }) => {
120
136
  if (frontendNavigationLinks !== void 0) {
121
137
  frontend.frontendNavigationLinks = frontendNavigationLinks;
122
138
  }
@@ -126,7 +142,7 @@ class StudioCMSPluginTester {
126
142
  if (typeof hooks["studiocms:image-service"] === "function") {
127
143
  await hooks["studiocms:image-service"]({
128
144
  logger,
129
- setImageService: ({ imageService: imgService }) => {
145
+ setImageService: async ({ imageService: imgService }) => {
130
146
  if (imgService !== void 0) {
131
147
  imageService.imageService = imgService;
132
148
  }
@@ -136,7 +152,7 @@ class StudioCMSPluginTester {
136
152
  if (typeof hooks["studiocms:rendering"] === "function") {
137
153
  await hooks["studiocms:rendering"]({
138
154
  logger,
139
- setRendering: ({ pageTypes, augments }) => {
155
+ setRendering: async ({ pageTypes, augments }) => {
140
156
  if (pageTypes !== void 0) {
141
157
  rendering.pageTypes = pageTypes;
142
158
  }
@@ -149,7 +165,7 @@ class StudioCMSPluginTester {
149
165
  if (typeof hooks["studiocms:sitemap"] === "function") {
150
166
  await hooks["studiocms:sitemap"]({
151
167
  logger,
152
- setSitemap: ({ sitemaps, triggerSitemap }) => {
168
+ setSitemap: async ({ sitemaps, triggerSitemap }) => {
153
169
  if (sitemaps !== void 0) {
154
170
  sitemap.sitemaps = sitemaps;
155
171
  }
@@ -178,7 +194,6 @@ class StudioCMSPluginTester {
178
194
  return {
179
195
  identifier: this.plugin.identifier,
180
196
  name: this.plugin.name,
181
- studiocmsMinimumVersion: this.plugin.studiocmsMinimumVersion,
182
197
  requires: this.plugin.requires
183
198
  };
184
199
  }
@@ -269,5 +284,6 @@ class StudioCMSPluginTester {
269
284
  }
270
285
  }
271
286
  export {
272
- StudioCMSPluginTester
287
+ StudioCMSPluginTester,
288
+ TestStudioCmsUiInstance
273
289
  };
@@ -1,11 +1,11 @@
1
1
  export type QueryRequest = {
2
- type: 'query';
3
- id: number;
4
- statement: string;
2
+ readonly type: 'query';
3
+ readonly id: number;
4
+ readonly statement: string;
5
5
  };
6
6
  export type TransactionRequest = {
7
- type: 'transaction';
8
- id: number;
9
- statements: string[];
7
+ readonly type: 'transaction';
8
+ readonly id: number;
9
+ readonly statements: readonly string[];
10
10
  };
11
11
  export type DbQueryRequest = QueryRequest | TransactionRequest;
@@ -1,3 +1,5 @@
1
+ import { integrationsClient } from "studiocms:client/apiClients";
2
+ import * as Effect from "effect/Effect";
1
3
  class DbStudioElement extends HTMLElement {
2
4
  // biome-ignore lint/complexity/noUselessConstructor: This is needed for custom elements.
3
5
  constructor() {
@@ -42,36 +44,33 @@ class DbStudioElement extends HTMLElement {
42
44
  if (event.origin !== "https://studio.outerbase.com") {
43
45
  return;
44
46
  }
45
- const data = event.data;
46
- switch (data?.type) {
47
+ const payload = event.data;
48
+ switch (payload?.type) {
47
49
  case "transaction":
48
50
  case "query": {
49
- console.debug("Executing %s:", data.type, data);
50
- const result = await this.#executeQuery(data);
51
+ console.debug("Executing %s:", payload.type, payload);
52
+ const result = await this.#effectExecuteQuery({ payload });
51
53
  this.#iframe?.contentWindow?.postMessage(result, "*");
52
54
  break;
53
55
  }
54
56
  }
55
57
  }
56
58
  /**
57
- * Executes a SQL request and returns the result.
59
+ * Executes a SQL query or transaction
58
60
  */
59
- async #executeQuery(request) {
60
- const response = await fetch("/studiocms_api/integrations/db-studio/query", {
61
- method: "POST",
62
- headers: {
63
- "Content-Type": "application/json"
64
- },
65
- body: JSON.stringify(request)
66
- });
67
- if (response.ok) {
68
- const result = await response.json();
69
- console.debug("Query result:", result);
70
- return result;
71
- }
72
- const error = await response.text();
73
- console.error("Error executing query:", error);
74
- return { type: request.type, id: request.id, error };
61
+ async #effectExecuteQuery(request) {
62
+ return await integrationsClient.pipe(
63
+ Effect.flatMap((client) => client.dbStudio.dbStudioQuery(request)),
64
+ Effect.catchAll((error) => {
65
+ console.error("Error executing query:", error);
66
+ return Effect.succeed({
67
+ type: request.payload.type,
68
+ id: request.payload.id,
69
+ error: error instanceof Error ? error.message : String(error)
70
+ });
71
+ }),
72
+ Effect.runPromise
73
+ );
75
74
  }
76
75
  }
77
76
  export {
package/dist/types.d.ts CHANGED
@@ -143,4 +143,34 @@ export type PrefixSuffixAugment = PrefixRenderAugment | SuffixRenderAugment;
143
143
  * Represents a union type for different kinds of render augmentations.
144
144
  */
145
145
  export type RenderAugment = PrefixSuffixAugment | ComponentRenderAugment;
146
+ /**
147
+ * Represents a Post-Processor function used in the rendering process, which takes a string input and returns a Promise that resolves to a string output.
148
+ *
149
+ * @param input - The string input to be processed by the post-processor.
150
+ * @returns A Promise that resolves to the processed string output.
151
+ *
152
+ * @remarks Post-processors can be used in site-wide plugins, or augment plugins, and are executed after the main rendering process to allow for modifications to the rendered content before it is sent to the client.
153
+ */
154
+ export type StudioCMSPostProcessor = GenericAsyncFn<string>;
155
+ /**
156
+ * Represents an augmentation for rendering with a post-processor.
157
+ */
158
+ export interface PluginPostProcessor {
159
+ id: string;
160
+ safeId: string;
161
+ postProcessor: StudioCMSPostProcessor;
162
+ }
163
+ /**
164
+ * Represents an augmentation for post-processing rendered content.
165
+ */
166
+ export interface PostProcessorRenderAugment extends PluginPostProcessor {
167
+ type: 'post-processor';
168
+ }
169
+ /**
170
+ * Represents a safe plugin list item with an identifier and a safe string version of the identifier.
171
+ */
172
+ export interface AugmentListItem {
173
+ id: string;
174
+ safeId: string;
175
+ }
146
176
  export {};
@@ -21,7 +21,7 @@ declare const SMTPMailer_base: Effect.Service.Class<SMTPMailer, "studiocms/lib/e
21
21
  sendMail: (mailOptions: Mail.Options) => Effect.Effect<SMTPTransport.SentMessageInfo, Error, never>;
22
22
  isIdle: () => Effect.Effect<boolean, Error, never>;
23
23
  getVersionString: () => Effect.Effect<string, Error, never>;
24
- }, import("../../virtuals/sdk/index.js").DBClientInitializationError | import("../../virtuals/sdk/index.js").SDKInitializationError | import("@withstudiocms/kysely/client").DBCallbackFailure | import("@withstudiocms/kysely/core/errors").DatabaseError | import("effect/Cause").UnknownException | import("effect/ConfigError").ConfigError | import("@withstudiocms/effect/smtp").SMTPError, never>;
24
+ }, import("effect/ConfigError").ConfigError | import("../../virtuals/sdk/index.js").DBClientInitializationError | import("../../virtuals/sdk/index.js").SDKInitializationError | import("@withstudiocms/kysely/client").DBCallbackFailure | import("@withstudiocms/kysely/core/errors").DatabaseError | import("effect/Cause").UnknownException | import("@withstudiocms/effect/smtp").SMTPError, never>;
25
25
  }>;
26
26
  /**
27
27
  * SMTPMailer service for sending emails.
@@ -17,7 +17,13 @@ export declare function buildTranslations(translations: PluginTranslations): Pro
17
17
  /**
18
18
  * Get raw translations.
19
19
  */
20
- rawTranslations: PluginTranslations;
20
+ rawTranslations: {
21
+ [x: string]: {
22
+ [x: string]: {
23
+ [x: string]: string;
24
+ };
25
+ };
26
+ };
21
27
  /**
22
28
  * Get component translations.
23
29
  *
@@ -25,7 +31,9 @@ export declare function buildTranslations(translations: PluginTranslations): Pro
25
31
  * @param comp - The component name.
26
32
  * @returns The component translations.
27
33
  */
28
- getComponent: (lang: string, comp: string) => import("../schemas/plugins/i18n.js").TranslationsJSON | undefined;
34
+ getComponent: (lang: string, comp: string) => {
35
+ [x: string]: string;
36
+ } | undefined;
29
37
  /**
30
38
  * Build page title.
31
39
  *
package/dist/virtual.d.ts CHANGED
@@ -12,6 +12,23 @@ declare module 'studiocms:logger' {
12
12
  ) => Response;
13
13
  }
14
14
 
15
+ declare module 'studiocms:client/apiClients' {
16
+ export const authClient: typeof import('./client/apiClient').authClient;
17
+ export const dashboardClient: typeof import('./client/apiClient').dashboardClient;
18
+ export const integrationsClient: typeof import('./client/apiClient').integrationsClient;
19
+ export const restClient: typeof import('./client/apiClient').restClient;
20
+ export const sdkClient: typeof import('./client/apiClient').sdkClient;
21
+ export const apiClients: typeof import('./client/apiClient').apiClients;
22
+
23
+ export const dashboardSharedCatchTags: typeof import('./client/apiClient').dashboardSharedCatchTags;
24
+ export const sharedAuthCatchTags: typeof import('./client/apiClient').sharedAuthCatchTags;
25
+ }
26
+
27
+ declare module 'virtual:studiocms/route-config' {
28
+ export const routeConfig: import('./handlers/frontend/types').ProcessedRouteConfig;
29
+ export default routeConfig;
30
+ }
31
+
15
32
  declare module 'studiocms:storage-manager/module' {
16
33
  const module: typeof import('./handlers/storage-manager/core/no-op-storage-manager').default;
17
34
  export default module;
@@ -74,6 +91,12 @@ declare module 'studiocms:plugins/renderers' {
74
91
 
75
92
  declare module 'studiocms:plugins/augments' {
76
93
  export const renderAugments: import('./types.js').RenderAugment[];
94
+ export const renderPostProcessorAugments: import('./types.js').PostProcessorRenderAugment[];
95
+ export const renderAugmentsList: import('./types.js').AugmentListItem[];
96
+ }
97
+
98
+ declare module 'studiocms:plugins/post-processors' {
99
+ export const renderPostProcessors: import('./types.js').PluginPostProcessor[];
77
100
  }
78
101
 
79
102
  declare module 'studiocms:plugins/list' {
@@ -26,8 +26,8 @@ export declare const Encryption: Effect.Effect<{
26
26
  readonly decrypt: (data: Uint8Array<ArrayBufferLike>) => Effect.Effect<Uint8Array<ArrayBufferLike>, import("@withstudiocms/auth-kit/errors").DecryptionError, never>;
27
27
  readonly decryptToString: (data: Uint8Array<ArrayBufferLike>) => Effect.Effect<string, import("@withstudiocms/auth-kit/errors").DecryptionError, never>;
28
28
  }, import("@withstudiocms/auth-kit/errors").EncryptionError, never>, Password: Effect.Effect<{
29
- readonly hashPassword: (password: string, _salt?: string | undefined) => Effect.Effect<string, import("@withstudiocms/effect/scrypt").ScryptError, never>;
30
- readonly verifyPasswordHash: (hash: string, password: string) => Effect.Effect<boolean, import("@withstudiocms/effect/scrypt").ScryptError | import("@withstudiocms/auth-kit/errors").PasswordError, never>;
29
+ readonly hashPassword: (password: string, _salt?: string | undefined) => Effect.Effect<string, import("effectify/scrypt").ScryptError, never>;
30
+ readonly verifyPasswordHash: (hash: string, password: string) => Effect.Effect<boolean, import("effectify/scrypt").ScryptError | import("@withstudiocms/auth-kit/errors").PasswordError, never>;
31
31
  readonly verifyPasswordStrength: (pass: string) => Effect.Effect<string | true, import("@withstudiocms/auth-kit/errors").PasswordError | import("@withstudiocms/auth-kit/errors").CheckIfUnsafeError | import("@effect/platform/HttpClientError").ResponseError, never>;
32
32
  }, never, never>, Session: Effect.Effect<{
33
33
  readonly generateSessionToken: () => Effect.Effect<string, import("@withstudiocms/auth-kit/errors").SessionError, never>;
@@ -41,15 +41,15 @@ export declare const Encryption: Effect.Effect<{
41
41
  }, import("@withstudiocms/auth-kit/errors").SessionError, never>, User: Effect.Effect<{
42
42
  readonly verifyUsernameInput: (username: string) => Effect.Effect<string | true, import("@withstudiocms/auth-kit/errors").CheckIfUnsafeError | import("@withstudiocms/auth-kit/errors").UserError, never>;
43
43
  readonly createUserAvatar: (email: string) => Effect.Effect<string, import("@withstudiocms/auth-kit/errors").UserError, never>;
44
- readonly createLocalUser: (name: string, username: string, email: string, password: string) => Effect.Effect<import("@withstudiocms/auth-kit/types").UserData, import("@withstudiocms/effect/scrypt").ScryptError | import("@withstudiocms/auth-kit/errors").UserError, never>;
44
+ readonly createLocalUser: (name: string, username: string, email: string, password: string) => Effect.Effect<import("@withstudiocms/auth-kit/types").UserData, import("effectify/scrypt").ScryptError | import("@withstudiocms/auth-kit/errors").UserError, never>;
45
45
  readonly createOAuthUser: (data: import("@withstudiocms/auth-kit/types").UserDataInsert, oAuthFields: {
46
46
  provider: string;
47
47
  providerUserId: string;
48
48
  }) => Effect.Effect<import("@withstudiocms/auth-kit/types").UserData, import("@withstudiocms/auth-kit/errors").UserError, never>;
49
- readonly updateUserPassword: (userId: string, password: string) => Effect.Effect<import("@withstudiocms/auth-kit/types").UserData, import("@withstudiocms/effect/scrypt").ScryptError | import("@withstudiocms/auth-kit/errors").UserError, never>;
49
+ readonly updateUserPassword: (userId: string, password: string) => Effect.Effect<import("@withstudiocms/auth-kit/types").UserData, import("effectify/scrypt").ScryptError | import("@withstudiocms/auth-kit/errors").UserError, never>;
50
50
  readonly getUserPasswordHash: (userId: string) => Effect.Effect<string, import("@withstudiocms/auth-kit/errors").UserError, never>;
51
51
  readonly getUserFromEmail: (email: string) => Effect.Effect<import("@withstudiocms/auth-kit/types").CombinedUserData | null | undefined, import("@withstudiocms/auth-kit/errors").UserError, never>;
52
52
  readonly getUserData: (context: import("astro").APIContext | import("astro").AstroGlobal<Record<string, any>, import("astro/runtime/server/index.js").AstroComponentFactory, Record<string, string | undefined>>) => Effect.Effect<import("@withstudiocms/auth-kit/types").UserSessionData, import("@withstudiocms/auth-kit/errors").SessionError | import("@withstudiocms/auth-kit/errors").UserError, never>;
53
53
  readonly getUserPermissionLevel: (userData: import("@withstudiocms/auth-kit/types").UserSessionData | import("@withstudiocms/auth-kit/types").CombinedUserData | null) => Effect.Effect<import("@withstudiocms/auth-kit/types").UserPermissionLevel, import("@withstudiocms/auth-kit/errors").UserError, never>;
54
- readonly isUserAllowed: (userData: import("@withstudiocms/auth-kit/types").UserSessionData | import("@withstudiocms/auth-kit/types").CombinedUserData | null, requiredPerms: "owner" | "admin" | "editor" | "visitor" | "unknown") => Effect.Effect<boolean, import("@withstudiocms/auth-kit/errors").UserError, never>;
54
+ readonly isUserAllowed: (userData: import("@withstudiocms/auth-kit/types").UserSessionData | import("@withstudiocms/auth-kit/types").CombinedUserData | null, requiredPerms: "unknown" | "visitor" | "editor" | "admin" | "owner") => Effect.Effect<boolean, import("@withstudiocms/auth-kit/errors").UserError, never>;
55
55
  }, import("@withstudiocms/auth-kit/errors").SessionError | import("@withstudiocms/auth-kit/errors").UserError, never>;
@@ -11,7 +11,7 @@ export declare class VerifyEmailError extends VerifyEmailError_base<{
11
11
  }
12
12
  declare const VerifyEmail_base: Effect.Service.Class<VerifyEmail, "studiocms/virtuals/auth/verify-email/VerifyEmail", {
13
13
  readonly effect: Effect.Effect<{
14
- isEmailVerificationEnabled: () => Effect.Effect<boolean | undefined, any, never>;
14
+ isEmailVerificationEnabled: () => Effect.Effect<boolean | undefined, import("effect/ConfigError").ConfigError | import("@withstudiocms/kysely/client").DBCallbackFailure | import("@withstudiocms/kysely/core/errors").DatabaseError | import("effect/Cause").UnknownException, never>;
15
15
  getEmailVerificationRequest: (id: string) => Effect.Effect<{
16
16
  readonly id: string;
17
17
  readonly userId: string;
@@ -24,11 +24,11 @@ declare const VerifyEmail_base: Effect.Service.Class<VerifyEmail, "studiocms/vir
24
24
  readonly userId: string;
25
25
  readonly expiresAt: Date;
26
26
  readonly token: string;
27
- }, import("@withstudiocms/kysely/client").DBCallbackFailure | import("@withstudiocms/kysely/core/errors").DatabaseError | import("effect/ConfigError").ConfigError | import("@withstudiocms/sdk/modules/util/generators.js").GeneratorError, never>;
28
- sendVerificationEmail: (userId: string, isOAuth?: boolean) => Effect.Effect<import("../mailer/index.js").MailerErrorResponse | import("../mailer/index.js").MailerSuccessResponse | undefined, any, never>;
29
- isEmailVerified: (user: CombinedUserData | UserSessionData | undefined | null) => Effect.Effect<boolean, any, never>;
27
+ }, import("effect/ConfigError").ConfigError | import("@withstudiocms/kysely/client").DBCallbackFailure | import("@withstudiocms/kysely/core/errors").DatabaseError | import("@withstudiocms/sdk/modules/util/generators.js").GeneratorError, never>;
28
+ sendVerificationEmail: (userId: string, isOAuth?: boolean) => Effect.Effect<import("../mailer/index.js").MailerErrorResponse | import("../mailer/index.js").MailerSuccessResponse | undefined, Error | import("effect/ConfigError").ConfigError, never>;
29
+ isEmailVerified: (user: CombinedUserData | UserSessionData | undefined | null) => Effect.Effect<boolean, import("effect/ConfigError").ConfigError | import("@withstudiocms/kysely/client").DBCallbackFailure | import("@withstudiocms/kysely/core/errors").DatabaseError | import("effect/Cause").UnknownException, never>;
30
30
  }, import("effect/ConfigError").ConfigError, import("../mailer/index.js").Mailer>;
31
- readonly dependencies: readonly [import("effect/Layer").Layer<import("../mailer/index.js").Mailer, import("../sdk/index.js").DBClientInitializationError | import("../sdk/index.js").SDKInitializationError | import("@withstudiocms/kysely/client").DBCallbackFailure | import("@withstudiocms/kysely/core/errors").DatabaseError | import("effect/Cause").UnknownException | import("effect/ConfigError").ConfigError | import("@withstudiocms/effect/smtp").SMTPError, never>];
31
+ readonly dependencies: readonly [import("effect/Layer").Layer<import("../mailer/index.js").Mailer, import("effect/ConfigError").ConfigError | import("../sdk/index.js").DBClientInitializationError | import("../sdk/index.js").SDKInitializationError | import("@withstudiocms/kysely/client").DBCallbackFailure | import("@withstudiocms/kysely/core/errors").DatabaseError | import("effect/Cause").UnknownException | import("@withstudiocms/effect/smtp").SMTPError, never>];
32
32
  }>;
33
33
  /**
34
34
  * The `VerifyEmail` service provides functionality for managing email verification
@@ -54,6 +54,6 @@ declare const VerifyEmail_base: Effect.Service.Class<VerifyEmail, "studiocms/vir
54
54
  * - `generateUrl`: Generates a URL with the given base, path, and query parameters.
55
55
  */
56
56
  export declare class VerifyEmail extends VerifyEmail_base {
57
- static Provide: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, import("../sdk/index.js").DBClientInitializationError | import("../sdk/index.js").SDKInitializationError | import("@withstudiocms/kysely/client").DBCallbackFailure | import("@withstudiocms/kysely/core/errors").DatabaseError | import("effect/Cause").UnknownException | import("effect/ConfigError").ConfigError | import("@withstudiocms/effect/smtp").SMTPError | E, Exclude<R, VerifyEmail>>;
57
+ static Provide: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, import("effect/ConfigError").ConfigError | import("../sdk/index.js").DBClientInitializationError | import("../sdk/index.js").SDKInitializationError | import("@withstudiocms/kysely/client").DBCallbackFailure | import("@withstudiocms/kysely/core/errors").DatabaseError | import("effect/Cause").UnknownException | import("@withstudiocms/effect/smtp").SMTPError | E, Exclude<R, VerifyEmail>>;
58
58
  }
59
59
  export {};
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  ---
3
3
  <meta name="generator" content={Astro.generator} />
4
- <meta name="generator" content={Astro.locals.StudioCMS.SCMSGenerator} />
5
- <meta name="generator" content={Astro.locals.StudioCMS.SCMSUiGenerator} />
4
+ {Astro.locals?.StudioCMS?.SCMSGenerator && <meta name="generator" content={Astro.locals.StudioCMS.SCMSGenerator} />}
5
+ {Astro.locals?.StudioCMS?.SCMSUiGenerator && <meta name="generator" content={Astro.locals.StudioCMS.SCMSUiGenerator} />}
@@ -1,5 +1,6 @@
1
1
  ---
2
- import { renderAugments } from 'studiocms:plugins/augments';
2
+ import { renderAugments, renderPostProcessorAugments } from 'studiocms:plugins/augments';
3
+ import { renderPostProcessors } from 'studiocms:plugins/post-processors';
3
4
  import { pluginRenderers } from 'studiocms:plugins/renderers';
4
5
  import * as renderers from 'virtual:studiocms/plugins/renderers';
5
6
  import type { SSRResult } from 'astro';
@@ -44,12 +45,19 @@ const augments = renderAugments.filter((augment) =>
44
45
  (data.augments as string[])?.includes(augment.id)
45
46
  );
46
47
 
48
+ // Filter post-processor augments to only include those specified in the page data
49
+ const postProcessorAugments = renderPostProcessorAugments.filter((augment) =>
50
+ (data.augments as string[])?.includes(augment.id)
51
+ );
52
+
47
53
  // Render the content using the render function
48
54
  // If no content found, return an error message
49
55
  // Pass in the preRenderer and sanitizeOpts if they exist on the RendererModule
50
56
  const renderedContent = await renderFn({
51
57
  content: data.defaultContent?.content || '<h1>Error: No content found</h1>',
52
58
  augments,
59
+ postProcessorAugments,
60
+ postProcessors: renderPostProcessors,
53
61
  renderOpts: {
54
62
  // @ts-expect-error - $$result is a global variable injected by Astro during compilation and not a editor-known variable
55
63
  result: $$result as SSRResult,
@@ -1,6 +1,6 @@
1
1
  import type { SSRResult } from 'astro';
2
2
  import type { SanitizeOptions } from 'ultrahtml/transformers/sanitize';
3
- import type { GenericAsyncFn, RenderAugment } from '../../types.js';
3
+ import type { GenericAsyncFn, PluginPostProcessor, PostProcessorRenderAugment, RenderAugment } from '../../types.js';
4
4
  /**
5
5
  * Options for creating a render function.
6
6
  *
@@ -23,6 +23,8 @@ interface CreateRenderOptions {
23
23
  export interface RenderFnOptions {
24
24
  renderOpts: CreateRenderOptions;
25
25
  augments?: RenderAugment[];
26
+ postProcessorAugments?: PostProcessorRenderAugment[];
27
+ postProcessors?: PluginPostProcessor[];
26
28
  content: string;
27
29
  }
28
30
  /**
@@ -30,6 +30,24 @@ const renderFn = async (args) => {
30
30
  }
31
31
  renderedContent = await transformHTML(renderedContent, components);
32
32
  renderedContent = await transformHTML(renderedContent, {}, {}, [transformStorageAPI({ site })]);
33
+ if (args.postProcessorAugments && args.postProcessorAugments.length > 0) {
34
+ for (const postProcessorAugment of args.postProcessorAugments) {
35
+ try {
36
+ renderedContent = await postProcessorAugment.postProcessor(renderedContent);
37
+ } catch (error) {
38
+ console.error(`Error in post-processor augment ${postProcessorAugment.id}:`, error);
39
+ }
40
+ }
41
+ }
42
+ if (args.postProcessors && args.postProcessors.length > 0) {
43
+ for (const postProcessor of args.postProcessors) {
44
+ try {
45
+ renderedContent = await postProcessor.postProcessor(renderedContent);
46
+ } catch (error) {
47
+ console.error(`Error in plugin post-processor ${postProcessor.id}:`, error);
48
+ }
49
+ }
50
+ }
33
51
  return renderedContent;
34
52
  };
35
53
  var renderFn_default = renderFn;
@@ -12,7 +12,9 @@ import type { AstroGlobalPartial } from 'astro';
12
12
  * @returns
13
13
  */
14
14
  export declare const headDefaults: (title: string, description: string, lang: string, Astro: AstroGlobalPartial, favicon: string, ogImage: string | undefined, canonical: URL | undefined) => {
15
- tag: "style" | "title" | "base" | "link" | "meta" | "script" | "noscript" | "template";
16
- attrs?: Record<string, string | boolean | undefined> | undefined;
15
+ tag: "title" | "base" | "link" | "meta" | "noscript" | "script" | "style" | "template";
17
16
  content?: string | undefined;
17
+ attrs?: {
18
+ readonly [x: string]: string | boolean | undefined;
19
+ } | undefined;
18
20
  }[];
@@ -2,8 +2,6 @@ import { extname } from "node:path";
2
2
  import version from "studiocms:version";
3
3
  import { lookup } from "mrmime";
4
4
  import { StudioCMSCoreError } from "../../errors.js";
5
- import { HeadConfigSchema } from "./head.js";
6
- const _schema = HeadConfigSchema;
7
5
  const faviconTypes = [".ico", ".gif", ".jpeg", ".jpg", ".png", ".svg"];
8
6
  function isFaviconExt(ext) {
9
7
  if (faviconTypes.includes(ext)) {
@@ -168,10 +168,6 @@ export declare const StudioCMSRoutes: {
168
168
  */
169
169
  searchList: string;
170
170
  partials: {
171
- /**
172
- * API route for live preview box rendering.
173
- */
174
- livePreviewBox: string;
175
171
  /**
176
172
  * API route for fetching user list items.
177
173
  */
@@ -180,10 +176,6 @@ export declare const StudioCMSRoutes: {
180
176
  * API route for rendering content.
181
177
  */
182
178
  render: string;
183
- /**
184
- * API route for the editor.
185
- */
186
- editor: string;
187
179
  };
188
180
  /**
189
181
  * API route for fetching configuration.
@@ -263,10 +255,6 @@ export declare const StudioCMSRoutes: {
263
255
  templates: string;
264
256
  };
265
257
  sdk: {
266
- /**
267
- * SDK route for listing pages.
268
- */
269
- pages: string;
270
258
  /**
271
259
  * SDK route for updating the latest version cache.
272
260
  */
@@ -152,10 +152,6 @@ const StudioCMSRoutes = {
152
152
  */
153
153
  searchList: dashboardAPIRoute("search-list"),
154
154
  partials: {
155
- /**
156
- * API route for live preview box rendering.
157
- */
158
- livePreviewBox: partialsAPIRoute("render"),
159
155
  /**
160
156
  * API route for fetching user list items.
161
157
  */
@@ -163,11 +159,7 @@ const StudioCMSRoutes = {
163
159
  /**
164
160
  * API route for rendering content.
165
161
  */
166
- render: partialsAPIRoute("render"),
167
- /**
168
- * API route for the editor.
169
- */
170
- editor: partialsAPIRoute("editor")
162
+ render: partialsAPIRoute("render")
171
163
  },
172
164
  /**
173
165
  * API route for fetching configuration.
@@ -247,10 +239,6 @@ const StudioCMSRoutes = {
247
239
  templates: dashboardAPIRoute("templates")
248
240
  },
249
241
  sdk: {
250
- /**
251
- * SDK route for listing pages.
252
- */
253
- pages: sdkRoute("list-pages"),
254
242
  /**
255
243
  * SDK route for updating the latest version cache.
256
244
  */
@@ -258,7 +246,7 @@ const StudioCMSRoutes = {
258
246
  /**
259
247
  * SDK route for the full changelog JSON.
260
248
  */
261
- changelog: sdkRoute("full-changelog.json")
249
+ changelog: sdkRoute("full-changelog")
262
250
  },
263
251
  fts: {
264
252
  /**
@@ -53,12 +53,12 @@ declare const Mailer_base: Effect.Service.Class<Mailer, "studiocms/lib/mailer/Ma
53
53
  createMailerConfigTable: (config: ConfigFinal<StudioCMSMailerConfig>) => Effect.Effect<import("@withstudiocms/sdk/types").DynamicConfigEntry<StudioCMSMailerConfig>, import("@withstudiocms/kysely/client").DBCallbackFailure | import("@withstudiocms/kysely/core/errors").DatabaseError, never>;
54
54
  sendMail: ({ subject, ...message }: MailOptions) => Effect.Effect<MailerErrorResponse | MailerSuccessResponse, Error | import("effect/ConfigError").ConfigError, never>;
55
55
  verifyMailConnection: Effect.Effect<MailerErrorResponse | MailerSuccessResponse, Error | import("effect/ConfigError").ConfigError, never>;
56
- isEnabled: Effect.Effect<boolean, any, never>;
56
+ isEnabled: Effect.Effect<boolean, import("effect/ConfigError").ConfigError | import("@withstudiocms/kysely/client").DBCallbackFailure | import("@withstudiocms/kysely/core/errors").DatabaseError | import("effect/Cause").UnknownException, never>;
57
57
  }, import("effect/ConfigError").ConfigError, SMTPMailer | Logger>;
58
- readonly dependencies: readonly [Layer.Layer<Logger, never, never>, Layer.Layer<SMTPMailer, import("../sdk/index.js").DBClientInitializationError | import("../sdk/index.js").SDKInitializationError | import("@withstudiocms/kysely/client").DBCallbackFailure | import("@withstudiocms/kysely/core/errors").DatabaseError | import("effect/Cause").UnknownException | import("effect/ConfigError").ConfigError | import("@withstudiocms/effect/smtp").SMTPError, never>];
58
+ readonly dependencies: readonly [Layer.Layer<Logger, never, never>, Layer.Layer<SMTPMailer, import("effect/ConfigError").ConfigError | import("../sdk/index.js").DBClientInitializationError | import("../sdk/index.js").SDKInitializationError | import("@withstudiocms/kysely/client").DBCallbackFailure | import("@withstudiocms/kysely/core/errors").DatabaseError | import("effect/Cause").UnknownException | import("@withstudiocms/effect/smtp").SMTPError, never>];
59
59
  readonly accessors: true;
60
60
  }>;
61
61
  export declare class Mailer extends Mailer_base {
62
- static Provide: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, import("../sdk/index.js").DBClientInitializationError | import("../sdk/index.js").SDKInitializationError | import("@withstudiocms/kysely/client").DBCallbackFailure | import("@withstudiocms/kysely/core/errors").DatabaseError | import("effect/Cause").UnknownException | import("effect/ConfigError").ConfigError | import("@withstudiocms/effect/smtp").SMTPError | E, Exclude<R, Mailer>>;
62
+ static Provide: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, import("effect/ConfigError").ConfigError | import("../sdk/index.js").DBClientInitializationError | import("../sdk/index.js").SDKInitializationError | import("@withstudiocms/kysely/client").DBCallbackFailure | import("@withstudiocms/kysely/core/errors").DatabaseError | import("effect/Cause").UnknownException | import("@withstudiocms/effect/smtp").SMTPError | E, Exclude<R, Mailer>>;
63
63
  }
64
64
  export {};