studiocms 0.2.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.
- package/CHANGELOG.md +122 -0
- package/dist/cli/add/index.d.ts +2 -2
- package/dist/cli/add/index.js +4 -3
- package/dist/cli/add/npm-utils.d.ts +6 -6
- package/dist/cli/add/tryToInstallPlugins.d.ts +1 -1
- package/dist/cli/add/tryToInstallPlugins.js +6 -5
- package/dist/cli/add/updateStudioCMSConfig.d.ts +1 -1
- package/dist/cli/add/updateStudioCMSConfig.js +3 -4
- package/dist/cli/add/validatePlugins.d.ts +1 -2
- package/dist/cli/add/validatePlugins.js +15 -9
- package/dist/cli/crypto/genJWT/index.d.ts +1 -1
- package/dist/cli/crypto/genJWT/index.js +8 -9
- package/dist/cli/crypto/index.d.ts +1 -1
- package/dist/cli/init/steps/env.js +14 -4
- package/dist/cli/init/steps/next.d.ts +1 -1
- package/dist/cli/init/steps/next.js +6 -5
- package/dist/cli/migrator/index.d.ts +1 -1
- package/dist/cli/migrator/index.js +2 -2
- package/dist/cli/users/index.d.ts +1 -1
- package/dist/cli/users/shared.js +2 -2
- package/dist/cli/users/steps/createUsers.js +7 -7
- package/dist/cli/users/steps/modifyUsers.js +2 -2
- package/dist/cli/users/steps/next.d.ts +1 -1
- package/dist/cli/utils/checkRequiredEnvVars.js +2 -2
- package/dist/cli/utils/context.d.ts +2 -4
- package/dist/cli/utils/context.js +1 -3
- package/dist/cli/utils/getCliDbClient.d.ts +1 -1
- package/dist/cli/utils/intro.d.ts +1 -1
- package/dist/cli/utils/loadConfig.d.ts +54 -49
- package/dist/cli/utils/loadConfig.js +5 -8
- package/dist/cli/utils/logger.js +3 -3
- package/dist/cli/utils/user-utils.d.ts +1 -1
- package/dist/cli/utils/user-utils.js +4 -3
- package/dist/client/apiClient.d.ts +4923 -0
- package/dist/client/apiClient.js +72 -0
- package/dist/config.d.ts +1734 -1
- package/dist/consts.d.ts +5 -5
- package/dist/consts.js +3 -2
- package/dist/db/plugins.d.ts +1 -1
- package/dist/db/plugins.js +5 -8
- package/dist/handlers/frontend/routes.d.ts +4 -18
- package/dist/handlers/frontend/routes.js +13 -152
- package/dist/handlers/frontend/types.d.ts +1 -1
- package/dist/handlers/frontend/utils.js +0 -18
- package/dist/handlers/pluginHandler.d.ts +34 -257
- package/dist/handlers/pluginHandler.js +92 -46
- package/dist/handlers/routeHandler.js +32 -11
- package/dist/handlers/setupDbStudio.d.ts +3 -1
- package/dist/handlers/setupDbStudio.js +19 -10
- package/dist/handlers/storage-manager/core/effectify-astro-context.d.ts +25 -0
- package/dist/handlers/storage-manager/core/effectify-astro-context.js +78 -0
- package/dist/handlers/storage-manager/no-op.d.ts +2 -2
- package/dist/handlers/storage-manager/no-op.js +2 -3
- package/dist/index.d.ts +0 -1
- package/dist/index.js +10 -20
- package/dist/integrations/robots/index.d.ts +2 -2
- package/dist/integrations/robots/index.js +1 -3
- package/dist/integrations/robots/schema.d.ts +102 -273
- package/dist/integrations/robots/schema.js +220 -209
- package/dist/plugins/analytics/assets/schemas.d.ts +14 -9
- package/dist/plugins/analytics/assets/schemas.js +25 -17
- package/dist/plugins/analytics/db-client.d.ts +1 -1
- package/dist/plugins/analytics/index.d.ts +823 -3
- package/dist/plugins/analytics/index.js +4 -5
- package/dist/plugins/analytics/schemas.d.ts +54 -62
- package/dist/plugins/analytics/schemas.js +64 -13
- package/dist/plugins/analytics/table.d.ts +1 -1
- package/dist/plugins.d.ts +0 -1
- package/dist/schemas/config/api.d.ts +17 -0
- package/dist/schemas/config/api.js +14 -0
- package/dist/schemas/config/auth.d.ts +55 -59
- package/dist/schemas/config/auth.js +34 -11
- package/dist/schemas/config/dashboard.d.ts +43 -79
- package/dist/schemas/config/dashboard.js +43 -12
- package/dist/schemas/config/db.d.ts +15 -17
- package/dist/schemas/config/db.js +13 -5
- package/dist/schemas/config/developer.d.ts +33 -45
- package/dist/schemas/config/developer.js +22 -5
- package/dist/schemas/config/index.d.ts +398 -521
- package/dist/schemas/config/index.js +115 -57
- package/dist/schemas/config/sdk.d.ts +50 -196
- package/dist/schemas/config/sdk.js +61 -73
- package/dist/schemas/custom.d.ts +40 -0
- package/dist/schemas/custom.js +41 -0
- package/dist/schemas/external-schemas.d.ts +171 -0
- package/dist/schemas/external-schemas.js +179 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/index.js +2 -0
- package/dist/schemas/plugins/i18n.d.ts +59 -39
- package/dist/schemas/plugins/i18n.js +42 -5
- package/dist/schemas/plugins/index.d.ts +7126 -10296
- package/dist/schemas/plugins/index.js +260 -276
- package/dist/schemas/plugins/shared.d.ts +1293 -3718
- package/dist/schemas/plugins/shared.js +320 -329
- package/dist/test-utils.d.ts +15 -4
- package/dist/test-utils.js +27 -11
- package/dist/toolbar/db-viewer/db-shared-types.d.ts +6 -6
- package/dist/toolbar/db-viewer/studio/connection.d.ts +8 -4
- package/dist/toolbar/db-viewer/studio/connection.js +2 -28
- package/dist/toolbar/db-viewer/studio/env/libsql.d.ts +7 -0
- package/dist/toolbar/db-viewer/studio/env/libsql.js +17 -0
- package/dist/toolbar/db-viewer/studio/env/mysql.d.ts +7 -0
- package/dist/toolbar/db-viewer/studio/env/mysql.js +23 -0
- package/dist/toolbar/db-viewer/studio/env/postgres.d.ts +7 -0
- package/dist/toolbar/db-viewer/studio/env/postgres.js +23 -0
- package/dist/toolbar/db-viewer/studio/index.js +20 -56
- package/dist/toolbar/db-viewer/studio/type.d.ts +1 -2
- package/dist/toolbar/db-viewer/studio/virtual-connection/libsql.d.ts +3 -0
- package/dist/toolbar/db-viewer/studio/virtual-connection/libsql.js +24 -0
- package/dist/toolbar/db-viewer/studio/virtual-connection/mysql.d.ts +3 -0
- package/dist/toolbar/db-viewer/studio/virtual-connection/mysql.js +9 -0
- package/dist/toolbar/db-viewer/studio/virtual-connection/postgres.d.ts +3 -0
- package/dist/toolbar/db-viewer/studio/virtual-connection/postgres.js +9 -0
- package/dist/toolbar/db-viewer/viewer.js +20 -21
- package/dist/types.d.ts +30 -0
- package/dist/utils/effects/smtp.d.ts +1 -1
- package/dist/utils/lang-helper.d.ts +10 -2
- package/dist/virtual.d.ts +35 -28
- package/dist/virtuals/auth/core.d.ts +5 -5
- package/dist/virtuals/auth/verify-email.d.ts +6 -6
- package/dist/virtuals/components/Generator.astro +2 -2
- package/dist/virtuals/components/Renderer.astro +9 -1
- package/dist/virtuals/components/renderFn.d.ts +3 -1
- package/dist/virtuals/components/renderFn.js +18 -0
- package/dist/virtuals/lib/headDefaults.d.ts +4 -2
- package/dist/virtuals/lib/headDefaults.js +0 -2
- package/dist/virtuals/lib/routeMap.d.ts +0 -12
- package/dist/virtuals/lib/routeMap.js +2 -14
- package/dist/virtuals/mailer/index.d.ts +3 -3
- package/dist/virtuals/notifier/index.d.ts +5 -5
- package/dist/virtuals/plugins/dashboard-pages.d.ts +2 -64
- package/dist/virtuals/scripts/StorageFileBrowser.d.ts +1 -172
- package/dist/virtuals/scripts/StorageFileBrowser.js +216 -119
- package/dist/virtuals/template-engine/index.d.ts +4 -4
- package/frontend/components/dashboard/configuration/ConfigForm.astro +218 -110
- package/frontend/components/dashboard/content-mgmt/ContentSearch.astro +21 -22
- package/frontend/components/dashboard/content-mgmt/CreateFolder.astro +66 -54
- package/frontend/components/dashboard/content-mgmt/CreatePage.astro +58 -104
- package/frontend/components/dashboard/content-mgmt/EditFolder.astro +65 -67
- package/frontend/components/dashboard/content-mgmt/EditPage.astro +86 -134
- package/frontend/components/dashboard/content-mgmt/InnerSidebarElement.astro +0 -1
- package/frontend/components/dashboard/content-mgmt/PageHeader.astro +33 -52
- package/frontend/components/dashboard/content-mgmt/PageTypeHandler.astro +2 -2
- package/frontend/components/dashboard/profile/APITokens.astro +219 -158
- package/frontend/components/dashboard/profile/BasicInfo.astro +165 -106
- package/frontend/components/dashboard/profile/Notifications.astro +27 -18
- package/frontend/components/dashboard/profile/UpdatePassword.astro +134 -94
- package/frontend/components/dashboard/sidebar/VersionCheck.astro +31 -16
- package/frontend/components/dashboard/sidebar/VersionCheckChangelog.astro +18 -11
- package/frontend/components/dashboard/sidebar-modals/VersionModal.astro +2 -2
- package/frontend/components/dashboard/smtp-config/TemplateEditor.astro +14 -14
- package/frontend/components/dashboard/taxonomy/InnerSidebarElement.astro +0 -1
- package/frontend/components/dashboard/taxonomy/MetaContainer.astro +0 -2
- package/frontend/components/dashboard/taxonomy/PageHeader.astro +16 -24
- package/frontend/components/dashboard/taxonomy/TaxonomySearch.astro +23 -27
- package/frontend/components/dashboard/user-mgmt/InnerSidebarElement.astro +111 -104
- package/frontend/components/dashboard/user-mgmt/UserListItem.astro +9 -22
- package/frontend/components/dashboard/user-mgmt/UserListItems.astro +18 -0
- package/frontend/components/first-time-setup/snippets/{opt2-studiocms.config.diff → studiocms.config.diff} +1 -0
- package/frontend/components/shared/Code.astro +1 -4
- package/frontend/components/shared/DynamicSettingsRenderer.astro +1 -1
- package/frontend/components/shared/SSRUser.astro +2 -4
- package/frontend/components/shared/foldertree/FolderTreeNode.astro +0 -6
- package/frontend/components/shared/storage-manager/StorageCopyOutput.astro +0 -1
- package/frontend/components/shared/taxonomy/TaxonomyTreeNode.astro +0 -6
- package/frontend/layouts/DashboardLayout.astro +1 -10
- package/frontend/layouts/TaxonomyLayout.astro +0 -1
- package/frontend/middleware/index.ts +102 -61
- package/frontend/pages/404.astro +5 -9
- package/frontend/pages/[dashboard]/[...pluginPage].astro +10 -1
- package/frontend/pages/[dashboard]/configuration.astro +10 -1
- package/frontend/pages/[dashboard]/content-management/createfolder.astro +10 -1
- package/frontend/pages/[dashboard]/content-management/createpage.astro +10 -1
- package/frontend/pages/[dashboard]/content-management/diff.astro +39 -14
- package/frontend/pages/[dashboard]/content-management/editfolder.astro +10 -1
- package/frontend/pages/[dashboard]/content-management/editpage.astro +10 -1
- package/frontend/pages/[dashboard]/content-management/index.astro +10 -1
- package/frontend/pages/[dashboard]/index.astro +10 -1
- package/frontend/pages/[dashboard]/login.astro +86 -25
- package/frontend/pages/[dashboard]/password-reset.astro +22 -16
- package/frontend/pages/[dashboard]/plugins/[plugin].astro +10 -1
- package/frontend/pages/[dashboard]/profile.astro +10 -1
- package/frontend/pages/[dashboard]/signup.astro +153 -52
- package/frontend/pages/[dashboard]/smtp-configuration.astro +77 -75
- package/frontend/pages/[dashboard]/system-management.astro +10 -1
- package/frontend/pages/[dashboard]/taxonomy/categories.astro +30 -41
- package/frontend/pages/[dashboard]/taxonomy/index.astro +10 -0
- package/frontend/pages/[dashboard]/taxonomy/tags.astro +33 -43
- package/frontend/pages/[dashboard]/unverified-email.astro +29 -21
- package/frontend/pages/[dashboard]/user-management/edit.astro +170 -90
- package/frontend/pages/[dashboard]/user-management/index.astro +10 -1
- package/frontend/pages/studiocms_api/[...all].ts +106 -0
- package/frontend/pages/studiocms_api/_handlers/_utils/auth.ts +26 -0
- package/frontend/pages/studiocms_api/_handlers/_utils/changelog.ts +147 -0
- package/frontend/pages/studiocms_api/_handlers/_utils/db-studio-driver.ts +46 -0
- package/frontend/pages/studiocms_api/_handlers/_utils/parseLogLevel.ts +27 -0
- package/frontend/pages/studiocms_api/_handlers/auth/auth.ts +459 -0
- package/frontend/pages/studiocms_api/_handlers/auth/index.ts +17 -0
- package/frontend/pages/studiocms_api/_handlers/auth/oauth.ts +91 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/_shared.ts +57 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/apiTokens.ts +134 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/config.ts +64 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/content.ts +741 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/create.ts +480 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/emailNotifications.ts +49 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/index.ts +45 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/mailer.ts +136 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/plugins.ts +80 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/profile.ts +275 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/resetPassword.ts +140 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/search.ts +63 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/taxonomy.ts +285 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/templates.ts +75 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/users.ts +312 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/verifyEndpoints.ts +307 -0
- package/frontend/pages/studiocms_api/_handlers/integration/dbStudio.ts +98 -0
- package/frontend/pages/studiocms_api/_handlers/integration/index.ts +17 -0
- package/frontend/pages/studiocms_api/_handlers/integration/storageManager.ts +107 -0
- package/frontend/pages/studiocms_api/_handlers/rest-api/index.ts +8 -0
- package/frontend/pages/studiocms_api/_handlers/rest-api/v1/_shared.ts +41 -0
- package/frontend/pages/studiocms_api/_handlers/rest-api/v1/index.ts +17 -0
- package/frontend/pages/studiocms_api/_handlers/rest-api/v1/public.ts +195 -0
- package/frontend/pages/studiocms_api/_handlers/rest-api/v1/secure.ts +1726 -0
- package/frontend/pages/studiocms_api/_handlers/sdk.ts +129 -0
- package/frontend/pages/studiocms_api/_middleware/astroLocals.ts +36 -0
- package/frontend/pages/studiocms_api/_middleware/restApi.ts +56 -0
- package/frontend/pages/studiocms_api/integrations/[...all].ts +8 -0
- package/frontend/scripts/formdata.ts +219 -0
- package/frontend/setup-pages/3-done.astro +4 -20
- package/frontend/setup-pages/studiocms_api/dashboard/step-2.ts +3 -6
- package/frontend/styles/dashboard-base.css +0 -1
- package/frontend/web-vitals/endpoint.ts +2 -1
- package/package.json +35 -31
- package/dist/global.d.ts +0 -9
- package/frontend/components/dashboard/LoginChecker.astro +0 -68
- package/frontend/components/dashboard/user-mgmt/RankCheck.astro +0 -57
- package/frontend/components/first-time-setup/snippets/opt1-astro.config.diff +0 -14
- package/frontend/components/first-time-setup/snippets/opt2-astro.config.diff +0 -9
- package/frontend/middleware/_authmap.ts +0 -63
- package/frontend/pages/studiocms_api/auth/[path].ts +0 -390
- package/frontend/pages/studiocms_api/auth/[provider]/[...id].ts +0 -64
- package/frontend/pages/studiocms_api/auth/[provider]/_effects/index.ts +0 -101
- package/frontend/pages/studiocms_api/auth/_shared.ts +0 -52
- package/frontend/pages/studiocms_api/dashboard/api-tokens.ts +0 -115
- package/frontend/pages/studiocms_api/dashboard/config.ts +0 -74
- package/frontend/pages/studiocms_api/dashboard/content/diff.ts +0 -73
- package/frontend/pages/studiocms_api/dashboard/content/folder.ts +0 -220
- package/frontend/pages/studiocms_api/dashboard/content/page.ts +0 -359
- package/frontend/pages/studiocms_api/dashboard/create-reset-link.ts +0 -77
- package/frontend/pages/studiocms_api/dashboard/create-user-invite.ts +0 -231
- package/frontend/pages/studiocms_api/dashboard/create-user.ts +0 -186
- package/frontend/pages/studiocms_api/dashboard/email-notification-settings-site.ts +0 -74
- package/frontend/pages/studiocms_api/dashboard/mailer/check-email.ts +0 -75
- package/frontend/pages/studiocms_api/dashboard/mailer/config.ts +0 -136
- package/frontend/pages/studiocms_api/dashboard/plugins/[plugin].ts +0 -80
- package/frontend/pages/studiocms_api/dashboard/profile.ts +0 -245
- package/frontend/pages/studiocms_api/dashboard/resend-verify-email.ts +0 -77
- package/frontend/pages/studiocms_api/dashboard/reset-password.ts +0 -124
- package/frontend/pages/studiocms_api/dashboard/search-list.ts +0 -59
- package/frontend/pages/studiocms_api/dashboard/taxonomy-search.ts +0 -47
- package/frontend/pages/studiocms_api/dashboard/taxonomy.ts +0 -230
- package/frontend/pages/studiocms_api/dashboard/templates.ts +0 -74
- package/frontend/pages/studiocms_api/dashboard/update-user-notifications.ts +0 -86
- package/frontend/pages/studiocms_api/dashboard/users.ts +0 -236
- package/frontend/pages/studiocms_api/dashboard/verify-email.ts +0 -83
- package/frontend/pages/studiocms_api/dashboard/verify-session.ts +0 -187
- package/frontend/pages/studiocms_api/integrations/[type]/[...id].ts +0 -15
- package/frontend/pages/studiocms_api/integrations/[type]/_routes/db-studio.ts +0 -173
- package/frontend/pages/studiocms_api/integrations/[type]/_routes/storage.ts +0 -88
- package/frontend/pages/studiocms_api/partials/editor.astro +0 -74
- package/frontend/pages/studiocms_api/partials/render.astro +0 -39
- package/frontend/pages/studiocms_api/partials/user-list-items.astro +0 -43
- package/frontend/pages/studiocms_api/rest/utils/auth-token.ts +0 -59
- package/frontend/pages/studiocms_api/rest/v1/[type]/[...id].ts +0 -23
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/categories.ts +0 -267
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/folders.ts +0 -283
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/pages.ts +0 -505
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/settings.ts +0 -100
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/tags.ts +0 -229
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/users.ts +0 -553
- package/frontend/pages/studiocms_api/rest/v1/public/[type]/[...id].ts +0 -19
- package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/categories.ts +0 -74
- package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/folders.ts +0 -85
- package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/pages.ts +0 -103
- package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/tags.ts +0 -67
- package/frontend/pages/studiocms_api/sdk/[...path].ts +0 -97
- package/frontend/pages/studiocms_api/sdk/utils/changelog.ts +0 -119
- package/frontend/scripts/auth/formListener.ts +0 -81
- package/frontend/scripts/formdata-utils.ts +0 -116
- package/frontend/utils/build-partial-schema.ts +0 -46
- package/frontend/utils/errors.ts +0 -6
- package/frontend/utils/param-extractor.ts +0 -83
- package/frontend/utils/rest-router.ts +0 -444
package/dist/test-utils.d.ts
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import type { AstroIntegration, AstroIntegrationLogger } from 'astro';
|
|
2
|
-
import type
|
|
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
|
-
|
|
53
|
+
readonly plugin: StudioCMSPlugin;
|
|
43
54
|
private readonly injectedLogger?;
|
|
44
|
-
constructor(plugin:
|
|
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' | '
|
|
111
|
+
getPluginInfo(): Pick<StudioCMSPlugin, 'identifier' | 'name' | 'requires'>;
|
|
101
112
|
/**
|
|
102
113
|
* Checks if the plugin has any StudioCMS-specific hooks defined.
|
|
103
114
|
*
|
package/dist/test-utils.js
CHANGED
|
@@ -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,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @module StudioCMS/Toolbar/DBViewer/Studio/Connection
|
|
4
|
+
*
|
|
5
|
+
* This module is used for providing types for our .d.ts files or the 'virtual:studiocms/db-studio/connection' module.
|
|
6
|
+
*/
|
|
7
|
+
import type BaseDriver from './drivers/base.js';
|
|
4
8
|
import type { JsonConnectionConfig } from './type.js';
|
|
5
|
-
export declare function createConnectionFromConfig(
|
|
9
|
+
export declare function createConnectionFromConfig(_configFile: string, _config: JsonConnectionConfig): BaseDriver | undefined;
|
|
@@ -1,31 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import PostgresDriver from "./drivers/postgres.js";
|
|
4
|
-
import TursoDriver from "./drivers/sqlite.js";
|
|
5
|
-
function createConnectionFromConfig(configFile, config) {
|
|
6
|
-
const configPath = path.dirname(configFile);
|
|
7
|
-
if (config.driver === "sqlite") {
|
|
8
|
-
return new TursoDriver({
|
|
9
|
-
url: `file:${path.join(configPath, config.connection.file)}`,
|
|
10
|
-
attach: config.connection.attach ? Object.entries(config.connection.attach).reduce((a, [key, value]) => {
|
|
11
|
-
a[key] = path.join(configPath, value);
|
|
12
|
-
return a;
|
|
13
|
-
}, {}) : void 0
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
if (config.driver === "turso") {
|
|
17
|
-
return new TursoDriver({
|
|
18
|
-
url: config.connection.url,
|
|
19
|
-
attach: config.connection.attach,
|
|
20
|
-
token: config.connection.token
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
if (config.driver === "mysql") {
|
|
24
|
-
return new MySQLDriver(config.connection);
|
|
25
|
-
}
|
|
26
|
-
if (config.driver === "postgres") {
|
|
27
|
-
return new PostgresDriver(config.connection);
|
|
28
|
-
}
|
|
1
|
+
function createConnectionFromConfig(_configFile, _config) {
|
|
2
|
+
return void 0;
|
|
29
3
|
}
|
|
30
4
|
export {
|
|
31
5
|
createConnectionFromConfig
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import type { TursoConfig } from '../type.js';
|
|
3
|
+
/**
|
|
4
|
+
* Effect to retrieve Turso (LibSQL) database configuration from environment variables.
|
|
5
|
+
*/
|
|
6
|
+
declare const tursoConfig: Effect.Effect<TursoConfig, import("effect/ConfigError").ConfigError, never>;
|
|
7
|
+
export default tursoConfig;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Config, Effect, Redacted } from "effect";
|
|
2
|
+
const tursoConfig = Effect.gen(function* () {
|
|
3
|
+
const url = yield* Config.redacted("CMS_LIBSQL_URL");
|
|
4
|
+
const authToken = yield* Config.redacted("CMS_LIBSQL_AUTH_TOKEN");
|
|
5
|
+
const config = {
|
|
6
|
+
driver: "turso",
|
|
7
|
+
connection: {
|
|
8
|
+
url: Redacted.value(url),
|
|
9
|
+
token: Redacted.value(authToken)
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
return config;
|
|
13
|
+
});
|
|
14
|
+
var libsql_default = tursoConfig;
|
|
15
|
+
export {
|
|
16
|
+
libsql_default as default
|
|
17
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import type { MySqlConfig } from '../type.js';
|
|
3
|
+
/**
|
|
4
|
+
* Effect to retrieve MySQL database configuration from environment variables.
|
|
5
|
+
*/
|
|
6
|
+
declare const mysqlConfig: Effect.Effect<MySqlConfig, import("effect/ConfigError").ConfigError, never>;
|
|
7
|
+
export default mysqlConfig;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Config, Effect, Redacted } from "effect";
|
|
2
|
+
const mysqlConfig = Effect.gen(function* () {
|
|
3
|
+
const database = yield* Config.string("CMS_MYSQL_DATABASE");
|
|
4
|
+
const host = yield* Config.string("CMS_MYSQL_HOST");
|
|
5
|
+
const port = yield* Config.number("CMS_MYSQL_PORT");
|
|
6
|
+
const user = yield* Config.redacted("CMS_MYSQL_USER");
|
|
7
|
+
const password = yield* Config.redacted("CMS_MYSQL_PASSWORD");
|
|
8
|
+
const config = {
|
|
9
|
+
driver: "mysql",
|
|
10
|
+
connection: {
|
|
11
|
+
database,
|
|
12
|
+
host,
|
|
13
|
+
port,
|
|
14
|
+
user: Redacted.value(user),
|
|
15
|
+
password: Redacted.value(password)
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
return config;
|
|
19
|
+
});
|
|
20
|
+
var mysql_default = mysqlConfig;
|
|
21
|
+
export {
|
|
22
|
+
mysql_default as default
|
|
23
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import type { PostgresConfig } from '../type.js';
|
|
3
|
+
/**
|
|
4
|
+
* Effect to retrieve Postgres database configuration from environment variables.
|
|
5
|
+
*/
|
|
6
|
+
declare const postgresConfig: Effect.Effect<PostgresConfig, import("effect/ConfigError").ConfigError, never>;
|
|
7
|
+
export default postgresConfig;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Config, Effect, Redacted } from "effect";
|
|
2
|
+
const postgresConfig = Effect.gen(function* () {
|
|
3
|
+
const database = yield* Config.string("CMS_PG_DATABASE");
|
|
4
|
+
const host = yield* Config.string("CMS_PG_HOST");
|
|
5
|
+
const port = yield* Config.number("CMS_PG_PORT");
|
|
6
|
+
const user = yield* Config.redacted("CMS_PG_USER");
|
|
7
|
+
const password = yield* Config.redacted("CMS_PG_PASSWORD");
|
|
8
|
+
const config = {
|
|
9
|
+
driver: "postgres",
|
|
10
|
+
connection: {
|
|
11
|
+
database,
|
|
12
|
+
host,
|
|
13
|
+
port,
|
|
14
|
+
user: Redacted.value(user),
|
|
15
|
+
password: Redacted.value(password)
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
return config;
|
|
19
|
+
});
|
|
20
|
+
var postgres_default = postgresConfig;
|
|
21
|
+
export {
|
|
22
|
+
postgres_default as default
|
|
23
|
+
};
|
|
@@ -1,73 +1,37 @@
|
|
|
1
1
|
import { root } from "astro:config/server";
|
|
2
2
|
import { db } from "studiocms:config";
|
|
3
|
+
import { createConnectionFromConfig } from "virtual:studiocms/db-studio/connection";
|
|
3
4
|
import { runEffect } from "@withstudiocms/effect";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
5
|
+
import tursoConfig from "./env/libsql.js";
|
|
6
|
+
import mysqlConfig from "./env/mysql.js";
|
|
7
|
+
import postgresConfig from "./env/postgres.js";
|
|
6
8
|
export * from "../db-shared-types.js";
|
|
7
9
|
import { default as default2 } from "./drivers/base.js";
|
|
8
10
|
export * from "./type.js";
|
|
9
11
|
async function getDialectConfig() {
|
|
12
|
+
let configEffect;
|
|
10
13
|
switch (db.dialect) {
|
|
11
14
|
case "libsql": {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const url = yield* Config.redacted("CMS_LIBSQL_URL");
|
|
15
|
-
const authToken = yield* Config.redacted("CMS_LIBSQL_AUTH_TOKEN");
|
|
16
|
-
const config = {
|
|
17
|
-
driver: "turso",
|
|
18
|
-
connection: {
|
|
19
|
-
url: Redacted.value(url),
|
|
20
|
-
token: Redacted.value(authToken)
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
return config;
|
|
24
|
-
})
|
|
25
|
-
);
|
|
15
|
+
configEffect = tursoConfig;
|
|
16
|
+
break;
|
|
26
17
|
}
|
|
27
18
|
case "mysql": {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const database = yield* Config.string("CMS_MYSQL_DATABASE");
|
|
31
|
-
const host = yield* Config.string("CMS_MYSQL_HOST");
|
|
32
|
-
const port = yield* Config.number("CMS_MYSQL_PORT");
|
|
33
|
-
const user = yield* Config.redacted("CMS_MYSQL_USER");
|
|
34
|
-
const password = yield* Config.redacted("CMS_MYSQL_PASSWORD");
|
|
35
|
-
const config = {
|
|
36
|
-
driver: "mysql",
|
|
37
|
-
connection: {
|
|
38
|
-
database,
|
|
39
|
-
host,
|
|
40
|
-
port,
|
|
41
|
-
user: Redacted.value(user),
|
|
42
|
-
password: Redacted.value(password)
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
return config;
|
|
46
|
-
})
|
|
47
|
-
);
|
|
19
|
+
configEffect = mysqlConfig;
|
|
20
|
+
break;
|
|
48
21
|
}
|
|
49
22
|
case "postgres": {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const database = yield* Config.string("CMS_PG_DATABASE");
|
|
53
|
-
const host = yield* Config.string("CMS_PG_HOST");
|
|
54
|
-
const port = yield* Config.number("CMS_PG_PORT");
|
|
55
|
-
const user = yield* Config.redacted("CMS_PG_USER");
|
|
56
|
-
const password = yield* Config.redacted("CMS_PG_PASSWORD");
|
|
57
|
-
const config = {
|
|
58
|
-
driver: "postgres",
|
|
59
|
-
connection: {
|
|
60
|
-
database,
|
|
61
|
-
host,
|
|
62
|
-
port,
|
|
63
|
-
user: Redacted.value(user),
|
|
64
|
-
password: Redacted.value(password)
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
return config;
|
|
68
|
-
})
|
|
69
|
-
);
|
|
23
|
+
configEffect = postgresConfig;
|
|
24
|
+
break;
|
|
70
25
|
}
|
|
26
|
+
default: {
|
|
27
|
+
throw new Error(`Unsupported database dialect: ${db.dialect}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
const config = await runEffect(configEffect);
|
|
32
|
+
return config;
|
|
33
|
+
} catch (error) {
|
|
34
|
+
throw new Error(`Failed to retrieve database configuration: ${error.message}`);
|
|
71
35
|
}
|
|
72
36
|
}
|
|
73
37
|
async function getDriver() {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ClientConfig } from 'pg';
|
|
2
1
|
export interface TursoConfig {
|
|
3
2
|
driver: 'turso';
|
|
4
3
|
connection: {
|
|
@@ -26,7 +25,7 @@ interface SqliteConfig {
|
|
|
26
25
|
}
|
|
27
26
|
export interface PostgresConfig {
|
|
28
27
|
driver: 'postgres';
|
|
29
|
-
connection: ClientConfig;
|
|
28
|
+
connection: import('pg').ClientConfig;
|
|
30
29
|
}
|
|
31
30
|
export type JsonConnectionConfig = TursoConfig | SqliteConfig | MySqlConfig | PostgresConfig;
|
|
32
31
|
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import TursoDriver from "../drivers/sqlite.js";
|
|
3
|
+
function createConnectionFromConfig(configFile, config) {
|
|
4
|
+
const configPath = path.dirname(configFile);
|
|
5
|
+
if (config.driver === "sqlite") {
|
|
6
|
+
return new TursoDriver({
|
|
7
|
+
url: `file:${path.join(configPath, config.connection.file)}`,
|
|
8
|
+
attach: config.connection.attach ? Object.entries(config.connection.attach).reduce((a, [key, value]) => {
|
|
9
|
+
a[key] = path.join(configPath, value);
|
|
10
|
+
return a;
|
|
11
|
+
}, {}) : void 0
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
if (config.driver === "turso") {
|
|
15
|
+
return new TursoDriver({
|
|
16
|
+
url: config.connection.url,
|
|
17
|
+
attach: config.connection.attach,
|
|
18
|
+
token: config.connection.token
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
createConnectionFromConfig
|
|
24
|
+
};
|
|
@@ -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
|
|
46
|
-
switch (
|
|
47
|
+
const payload = event.data;
|
|
48
|
+
switch (payload?.type) {
|
|
47
49
|
case "transaction":
|
|
48
50
|
case "query": {
|
|
49
|
-
console.debug("Executing %s:",
|
|
50
|
-
const result = await this.#
|
|
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
|
|
59
|
+
* Executes a SQL query or transaction
|
|
58
60
|
*/
|
|
59
|
-
async #
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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("
|
|
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:
|
|
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) =>
|
|
34
|
+
getComponent: (lang: string, comp: string) => {
|
|
35
|
+
[x: string]: string;
|
|
36
|
+
} | undefined;
|
|
29
37
|
/**
|
|
30
38
|
* Build page title.
|
|
31
39
|
*
|