studiocms 0.3.0 → 0.4.1
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 +89 -0
- package/dist/cli/add/index.d.ts +2 -2
- package/dist/cli/add/npm-utils.d.ts +6 -6
- package/dist/cli/add/tryToInstallPlugins.d.ts +1 -1
- package/dist/cli/add/updateStudioCMSConfig.d.ts +1 -1
- package/dist/cli/add/validatePlugins.d.ts +1 -1
- package/dist/cli/crypto/genJWT/index.d.ts +1 -1
- package/dist/cli/crypto/index.d.ts +1 -1
- package/dist/cli/init/steps/env.js +12 -2
- package/dist/cli/init/steps/next.d.ts +1 -1
- package/dist/cli/migrator/index.d.ts +1 -1
- package/dist/cli/users/index.d.ts +1 -1
- package/dist/cli/users/steps/createUsers.js +3 -3
- package/dist/cli/users/steps/next.d.ts +1 -1
- package/dist/cli/utils/context.d.ts +1 -1
- 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/user-utils.d.ts +1 -1
- 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 +1 -1
- 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 +9 -5
- 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/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 +23 -0
- 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 +0 -9
- package/frontend/layouts/TaxonomyLayout.astro +0 -1
- package/frontend/middleware/index.ts +102 -61
- package/frontend/pages/404.astro +0 -1
- 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 +34 -29
- 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 -384
- 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
|
@@ -1,61 +1,119 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
2
|
import { RobotsTXTConfigSchema } from "../../integrations/robots/schema.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
3
|
+
import { BooleanDefaultFalse, BooleanDefaultTrue, OptionalWithDefaults } from "../custom.js";
|
|
4
|
+
import { DateTimeFormatOptions, I18nKeySchema } from "../external-schemas.js";
|
|
5
|
+
import { StudioCMSPluginSchema, StudioCMSStorageManagerSchema } from "../plugins/index.js";
|
|
6
|
+
import { ApiConfigSchema } from "./api.js";
|
|
7
|
+
import { AuthConfigSchema } from "./auth.js";
|
|
8
|
+
import { DashboardConfigSchema } from "./dashboard.js";
|
|
9
|
+
import { DbConfigSchema } from "./db.js";
|
|
10
|
+
import { DeveloperConfigSchema } from "./developer.js";
|
|
11
|
+
import { SDKConfigSchema } from "./sdk.js";
|
|
12
|
+
const LocaleI18nConfigSchema = Schema.Struct({
|
|
13
|
+
defaultLocale: OptionalWithDefaults(I18nKeySchema, "en").annotations({
|
|
14
|
+
description: "Default Locale - Set the default locale for the dashboard translations"
|
|
15
|
+
})
|
|
16
|
+
}).annotations({
|
|
17
|
+
title: "Locale I18n Configuration",
|
|
18
|
+
description: "Locale I18n Configuration - Configure the internationalization settings for the dashboard",
|
|
19
|
+
identifier: "LocaleI18nConfig"
|
|
20
|
+
});
|
|
21
|
+
const LocaleConfigSchema = Schema.Struct({
|
|
22
|
+
dateLocale: OptionalWithDefaults(Schema.String, "en-us").annotations({
|
|
23
|
+
description: "Date Locale - Set the locale for date formatting in the dashboard"
|
|
24
|
+
}),
|
|
25
|
+
dateTimeFormat: OptionalWithDefaults(DateTimeFormatOptions, {
|
|
26
|
+
year: "numeric",
|
|
27
|
+
month: "short",
|
|
28
|
+
day: "numeric"
|
|
29
|
+
}).annotations({
|
|
30
|
+
description: "Date Time Format - Set the date and time formatting options for the dashboard"
|
|
31
|
+
}),
|
|
32
|
+
i18n: OptionalWithDefaults(LocaleI18nConfigSchema, {}).annotations({
|
|
33
|
+
description: "I18n Configuration - Configure the internationalization settings for the dashboard"
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
const StudioCMSRobotsTXTConfigSchema = Schema.Union(Schema.Boolean, RobotsTXTConfigSchema);
|
|
37
|
+
const FeaturesConfigSchema = Schema.Struct({
|
|
38
|
+
robotsTXT: OptionalWithDefaults(StudioCMSRobotsTXTConfigSchema, true).annotations({
|
|
39
|
+
description: "Robots TXT Configuration - Configure the robots.txt settings for the dashboard, allowing for customization of the robots.txt file served by the dashboard to control how search engines and web crawlers interact with the dashboard."
|
|
40
|
+
}),
|
|
41
|
+
injectQuickActionsMenu: BooleanDefaultTrue.annotations({
|
|
42
|
+
description: "Inject Quick Actions Menu - Allows injecting a quick actions menu in the dashboard for easy access to common actions"
|
|
43
|
+
}),
|
|
44
|
+
sdk: OptionalWithDefaults(SDKConfigSchema, true).annotations({
|
|
45
|
+
description: "SDK Configuration with Default - Allows configuring the SDK with cache settings, defaults to enabled with a 5 minute lifetime"
|
|
46
|
+
}),
|
|
47
|
+
dashboardConfig: OptionalWithDefaults(DashboardConfigSchema, {}).annotations({
|
|
48
|
+
description: "Dashboard Configuration - Configure settings related to the dashboard, such as enabling/disabling the dashboard, customizing the favicon, and configuring security settings."
|
|
49
|
+
}),
|
|
50
|
+
authConfig: OptionalWithDefaults(AuthConfigSchema, {}).annotations({
|
|
51
|
+
description: "Authentication Configuration - Configure settings related to authentication, such as enabling/disabling authentication and configuring authentication providers."
|
|
52
|
+
}),
|
|
53
|
+
developerConfig: OptionalWithDefaults(DeveloperConfigSchema, {}).annotations({
|
|
54
|
+
description: "Developer Configuration - Configure settings related to development features, such as enabling/disabling demo mode."
|
|
55
|
+
}),
|
|
56
|
+
preferredImageService: Schema.optional(Schema.String).annotations({
|
|
57
|
+
description: "Preferred Image Service - Set the preferred image service for handling image processing tasks, such as resizing and optimization. This can be set to a specific image service provider or left undefined to use the default image service."
|
|
58
|
+
}),
|
|
59
|
+
webVitals: BooleanDefaultFalse.annotations({
|
|
60
|
+
description: "Web Vitals - Enable or disable the collection of web vitals metrics for performance monitoring and optimization."
|
|
61
|
+
}),
|
|
62
|
+
api: OptionalWithDefaults(ApiConfigSchema, {}).annotations({
|
|
63
|
+
description: "API Configuration - Configure the API settings for the dashboard, such as enabling/disabling the API documentation."
|
|
64
|
+
})
|
|
65
|
+
}).annotations({
|
|
66
|
+
title: "Features Configuration",
|
|
67
|
+
description: "Features Configuration - Configure various features for the dashboard, such as enabling/disabling the dashboard, authentication, SDK settings, and more.",
|
|
68
|
+
identifier: "FeaturesConfig"
|
|
69
|
+
});
|
|
70
|
+
const StudioCMSOptionsSchema = Schema.Struct({
|
|
71
|
+
dbStartPage: BooleanDefaultTrue.annotations({
|
|
72
|
+
description: "DB Start Page - Whether to start into setup mode"
|
|
73
|
+
}),
|
|
74
|
+
verbose: BooleanDefaultFalse.annotations({
|
|
75
|
+
description: "Verbose Logging - Whether to enable verbose logging for debugging purposes"
|
|
76
|
+
}),
|
|
77
|
+
logLevel: Schema.optionalWith(
|
|
78
|
+
Schema.Literal("All", "Fatal", "Error", "Warning", "Info", "Debug", "Trace", "None"),
|
|
79
|
+
{
|
|
80
|
+
default: () => "Info"
|
|
81
|
+
}
|
|
82
|
+
).annotations({
|
|
83
|
+
description: "Log Level - Set the LogLevel for Effect based code"
|
|
84
|
+
}),
|
|
85
|
+
db: OptionalWithDefaults(DbConfigSchema, {}).annotations({
|
|
86
|
+
description: "Database Configuration - Configure the database settings for StudioCMS"
|
|
87
|
+
}),
|
|
88
|
+
plugins: Schema.optional(Schema.mutable(Schema.Array(StudioCMSPluginSchema))).annotations({
|
|
89
|
+
description: "Plugins - Add plugins to the StudioCMS to extend its functionality"
|
|
90
|
+
}),
|
|
91
|
+
storageManager: Schema.optional(StudioCMSStorageManagerSchema).annotations({
|
|
92
|
+
description: "Storage Manager - Configure the storage manager for handling file uploads and storage"
|
|
93
|
+
}),
|
|
94
|
+
componentRegistry: Schema.optional(
|
|
95
|
+
Schema.Record({
|
|
96
|
+
key: Schema.String,
|
|
97
|
+
value: Schema.String
|
|
98
|
+
})
|
|
99
|
+
).annotations({
|
|
100
|
+
description: "Component Registry - A record of custom components that can be used in the dashboard, where the key is the component name and the value is the path to the component"
|
|
101
|
+
}),
|
|
102
|
+
locale: OptionalWithDefaults(LocaleConfigSchema, {}).annotations({
|
|
103
|
+
description: "Locale Configuration - Configure locale specific settings for the dashboard"
|
|
104
|
+
}),
|
|
105
|
+
features: OptionalWithDefaults(FeaturesConfigSchema, {}).annotations({
|
|
106
|
+
description: "Features Configuration - Configure various features for the dashboard, such as enabling/disabling the dashboard, authentication, SDK settings, and more."
|
|
107
|
+
})
|
|
108
|
+
}).annotations({
|
|
109
|
+
title: "StudioCMS Configuration",
|
|
110
|
+
description: "Main configuration schema for StudioCMS, including database settings, plugins, storage manager, locale settings, and feature flags.",
|
|
111
|
+
identifier: "StudioCMSConfig"
|
|
112
|
+
});
|
|
58
113
|
export {
|
|
114
|
+
FeaturesConfigSchema,
|
|
115
|
+
LocaleConfigSchema,
|
|
116
|
+
LocaleI18nConfigSchema,
|
|
59
117
|
StudioCMSOptionsSchema,
|
|
60
|
-
|
|
118
|
+
StudioCMSRobotsTXTConfigSchema
|
|
61
119
|
};
|
|
@@ -1,216 +1,70 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const TimeStringSchema: z.ZodEffects<z.ZodString, number, string>;
|
|
4
|
-
export type TimeString = typeof TimeStringSchema._input;
|
|
1
|
+
import { Duration } from 'effect';
|
|
2
|
+
import * as Schema from 'effect/Schema';
|
|
5
3
|
/**
|
|
6
|
-
* Schema for cache configuration.
|
|
4
|
+
* Schema for the cache lifetime configuration, which is an optional duration that defaults to 5 minutes if not provided.
|
|
7
5
|
*/
|
|
8
|
-
export declare const
|
|
9
|
-
|
|
10
|
-
* Cache Lifetime
|
|
11
|
-
*
|
|
12
|
-
* `{number}{unit}` - e.g. '5m' for 5 minutes or '1h' for 1 hour
|
|
13
|
-
* @default '5m'
|
|
14
|
-
*/
|
|
15
|
-
lifetime: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>>;
|
|
16
|
-
}, "strip", z.ZodTypeAny, {
|
|
17
|
-
lifetime: number;
|
|
18
|
-
}, {
|
|
19
|
-
lifetime?: string | undefined;
|
|
6
|
+
export declare const LifeTimeSchema: Schema.optionalWith<typeof Schema.DurationFromSelf, {
|
|
7
|
+
default: () => Duration.Duration;
|
|
20
8
|
}>;
|
|
21
9
|
/**
|
|
22
|
-
* Schema for
|
|
23
|
-
*
|
|
24
|
-
* Extends the base CacheConfigSchema with additional properties.
|
|
25
|
-
*
|
|
26
|
-
* Properties:
|
|
27
|
-
* - `enabled` (boolean): Indicates if the cache is enabled.
|
|
28
|
-
* - @default true
|
|
29
|
-
*/
|
|
30
|
-
export declare const ProcessedCacheConfigSchema: z.ZodObject<{
|
|
31
|
-
/**
|
|
32
|
-
* Cache Enabled
|
|
33
|
-
*
|
|
34
|
-
* @default true
|
|
35
|
-
*/
|
|
36
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
37
|
-
/**
|
|
38
|
-
* Cache Lifetime
|
|
39
|
-
*
|
|
40
|
-
* `{number}{unit}` - e.g. '5m' for 5 minutes or '1h' for 1 hour
|
|
41
|
-
* @default '5m'
|
|
42
|
-
*/
|
|
43
|
-
lifetime: z.ZodDefault<z.ZodEffects<z.ZodString, number, string>>;
|
|
44
|
-
}, "strip", z.ZodTypeAny, {
|
|
45
|
-
lifetime: number;
|
|
46
|
-
enabled: boolean;
|
|
47
|
-
}, {
|
|
48
|
-
lifetime?: string | undefined;
|
|
49
|
-
enabled?: boolean | undefined;
|
|
50
|
-
}>;
|
|
51
|
-
/**
|
|
52
|
-
* Represents the configuration for the cache.
|
|
53
|
-
*
|
|
54
|
-
* This type is inferred from the `CacheConfigSchema` using Zod's `infer` method.
|
|
55
|
-
* It ensures that the cache configuration adheres to the schema defined in `CacheConfigSchema`.
|
|
10
|
+
* Schema for the cache configuration, which can be either a boolean to enable/disable caching or an object to specify the cache lifetime.
|
|
56
11
|
*/
|
|
57
|
-
export
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
* processed and validated by the schema.
|
|
63
|
-
*/
|
|
64
|
-
export type ProcessedCacheConfig = z.infer<typeof ProcessedCacheConfigSchema>;
|
|
12
|
+
export declare const CacheConfigSchema: Schema.Union<[typeof Schema.Boolean, Schema.Struct<{
|
|
13
|
+
lifetime: Schema.optionalWith<typeof Schema.DurationFromSelf, {
|
|
14
|
+
default: () => Duration.Duration;
|
|
15
|
+
}>;
|
|
16
|
+
}>]>;
|
|
65
17
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* This schema allows for either a boolean value or a more detailed cache configuration object.
|
|
69
|
-
*
|
|
70
|
-
* - If a boolean value is provided:
|
|
71
|
-
* - `true`: Enables caching with a default lifetime.
|
|
72
|
-
* - `false`: Disables caching.
|
|
73
|
-
* - If a cache configuration object is provided, it must conform to `CacheConfigSchema`.
|
|
74
|
-
*
|
|
75
|
-
* The schema is optional and defaults to `true` (enabled with default lifetime).
|
|
76
|
-
*
|
|
77
|
-
* The transformation ensures that the resulting configuration is of type `ProcessedCacheConfig`:
|
|
78
|
-
* - If a boolean value is provided, it is transformed into an object with `enabled` and `lifetime` properties.
|
|
79
|
-
* - If a cache configuration object is provided, it is transformed to ensure `enabled` is always `true`.
|
|
18
|
+
* Default cache lifetime in milliseconds (5 minutes).
|
|
80
19
|
*/
|
|
81
|
-
export declare const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
lifetime: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>>;
|
|
89
|
-
}, "strip", z.ZodTypeAny, {
|
|
90
|
-
lifetime: number;
|
|
91
|
-
}, {
|
|
92
|
-
lifetime?: string | undefined;
|
|
93
|
-
}>]>>>, {
|
|
94
|
-
lifetime: number;
|
|
95
|
-
enabled: boolean;
|
|
96
|
-
}, boolean | {
|
|
97
|
-
lifetime?: string | undefined;
|
|
98
|
-
} | undefined>;
|
|
20
|
+
export declare const InputSDKConfigSchema: Schema.Union<[typeof Schema.Boolean, Schema.Struct<{
|
|
21
|
+
cacheConfig: Schema.Union<[typeof Schema.Boolean, Schema.Struct<{
|
|
22
|
+
lifetime: Schema.optionalWith<typeof Schema.DurationFromSelf, {
|
|
23
|
+
default: () => Duration.Duration;
|
|
24
|
+
}>;
|
|
25
|
+
}>]>;
|
|
26
|
+
}>]>;
|
|
99
27
|
/**
|
|
100
|
-
* Schema for
|
|
28
|
+
* Schema for the processed cache configuration, which has a boolean to indicate if caching is enabled and a number for the cache lifetime in milliseconds.
|
|
101
29
|
*/
|
|
102
|
-
export declare const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
* @default cacheConfig: { lifetime: '5m' }
|
|
107
|
-
*/
|
|
108
|
-
cacheConfig: z.ZodObject<{
|
|
109
|
-
/**
|
|
110
|
-
* Cache Enabled
|
|
111
|
-
*
|
|
112
|
-
* @default true
|
|
113
|
-
*/
|
|
114
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
115
|
-
/**
|
|
116
|
-
* Cache Lifetime
|
|
117
|
-
*
|
|
118
|
-
* `{number}{unit}` - e.g. '5m' for 5 minutes or '1h' for 1 hour
|
|
119
|
-
* @default '5m'
|
|
120
|
-
*/
|
|
121
|
-
lifetime: z.ZodDefault<z.ZodEffects<z.ZodString, number, string>>;
|
|
122
|
-
}, "strip", z.ZodTypeAny, {
|
|
123
|
-
lifetime: number;
|
|
124
|
-
enabled: boolean;
|
|
125
|
-
}, {
|
|
126
|
-
lifetime?: string | undefined;
|
|
127
|
-
enabled?: boolean | undefined;
|
|
30
|
+
export declare const OutputSDKConfigSchema: Schema.Struct<{
|
|
31
|
+
cacheConfig: Schema.Struct<{
|
|
32
|
+
lifetime: typeof Schema.Number;
|
|
33
|
+
enabled: typeof Schema.Boolean;
|
|
128
34
|
}>;
|
|
129
|
-
}, "strip", z.ZodTypeAny, {
|
|
130
|
-
cacheConfig: {
|
|
131
|
-
lifetime: number;
|
|
132
|
-
enabled: boolean;
|
|
133
|
-
};
|
|
134
|
-
}, {
|
|
135
|
-
cacheConfig: {
|
|
136
|
-
lifetime?: string | undefined;
|
|
137
|
-
enabled?: boolean | undefined;
|
|
138
|
-
};
|
|
139
35
|
}>;
|
|
140
36
|
/**
|
|
141
|
-
*
|
|
37
|
+
* Gets the default cache configuration based on whether caching is enabled or not.
|
|
142
38
|
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
39
|
+
* @param enabled - A boolean indicating whether caching is enabled or not.
|
|
40
|
+
* @returns An object containing the cache configuration with lifetime in milliseconds and enabled status.
|
|
145
41
|
*/
|
|
146
|
-
export
|
|
147
|
-
export type StudioCMS_SDKOptions = boolean | {
|
|
148
|
-
/**
|
|
149
|
-
* Cache Configuration
|
|
150
|
-
*
|
|
151
|
-
* @default cacheConfig: { lifetime: '5m' }
|
|
152
|
-
*/
|
|
153
|
-
cacheConfig?: boolean | {
|
|
154
|
-
/**
|
|
155
|
-
* Cache Lifetime
|
|
156
|
-
*
|
|
157
|
-
* `{number}{unit}` - e.g. '5m' for 5 minutes or '1h' for 1 hour
|
|
158
|
-
* @default '5m'
|
|
159
|
-
*/
|
|
160
|
-
lifetime?: string | undefined;
|
|
161
|
-
} | undefined;
|
|
162
|
-
} | undefined;
|
|
163
|
-
export interface StudioCMS_SDKConfig {
|
|
42
|
+
export declare const getDefaultCacheConfig: (enabled: boolean) => {
|
|
164
43
|
cacheConfig: {
|
|
165
44
|
lifetime: number;
|
|
166
45
|
enabled: boolean;
|
|
167
46
|
};
|
|
168
|
-
}
|
|
47
|
+
};
|
|
169
48
|
/**
|
|
170
|
-
*
|
|
171
|
-
* It can either be a boolean or an object containing cache configuration.
|
|
172
|
-
*
|
|
173
|
-
* If it is a boolean, it defaults to `true` and transforms into an object
|
|
174
|
-
* with default cache configuration.
|
|
175
|
-
*
|
|
176
|
-
* If it is an object, it must contain the `cacheConfig` property which is
|
|
177
|
-
* validated by the `SDKCacheSchema`.
|
|
49
|
+
* Processes the input SDK configuration and returns the processed cache configuration.
|
|
178
50
|
*/
|
|
179
|
-
export declare const
|
|
180
|
-
cacheConfig:
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
lifetime:
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
cacheConfig: {
|
|
200
|
-
lifetime: number;
|
|
201
|
-
enabled: boolean;
|
|
202
|
-
};
|
|
203
|
-
}, {
|
|
204
|
-
cacheConfig?: boolean | {
|
|
205
|
-
lifetime?: string | undefined;
|
|
206
|
-
} | undefined;
|
|
207
|
-
}>]>>>, {
|
|
208
|
-
cacheConfig: {
|
|
209
|
-
lifetime: number;
|
|
210
|
-
enabled: boolean;
|
|
211
|
-
};
|
|
212
|
-
}, boolean | {
|
|
213
|
-
cacheConfig?: boolean | {
|
|
214
|
-
lifetime?: string | undefined;
|
|
215
|
-
} | undefined;
|
|
216
|
-
} | undefined>;
|
|
51
|
+
export declare const SDKConfigSchema: Schema.transform<Schema.Union<[typeof Schema.Boolean, Schema.Struct<{
|
|
52
|
+
cacheConfig: Schema.Union<[typeof Schema.Boolean, Schema.Struct<{
|
|
53
|
+
lifetime: Schema.optionalWith<typeof Schema.DurationFromSelf, {
|
|
54
|
+
default: () => Duration.Duration;
|
|
55
|
+
}>;
|
|
56
|
+
}>]>;
|
|
57
|
+
}>]>, Schema.Struct<{
|
|
58
|
+
cacheConfig: Schema.Struct<{
|
|
59
|
+
lifetime: typeof Schema.Number;
|
|
60
|
+
enabled: typeof Schema.Boolean;
|
|
61
|
+
}>;
|
|
62
|
+
}>>;
|
|
63
|
+
/**
|
|
64
|
+
* Type for the SDK configuration.
|
|
65
|
+
*/
|
|
66
|
+
export type SDKConfig = typeof SDKConfigSchema.Encoded;
|
|
67
|
+
/**
|
|
68
|
+
* Resolved type for the SDK configuration.
|
|
69
|
+
*/
|
|
70
|
+
export type SDKConfigResolved = typeof SDKConfigSchema.Type;
|
|
@@ -1,86 +1,74 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
}).
|
|
7
|
-
|
|
8
|
-
m: 60 * 1e3,
|
|
9
|
-
// Minutes to milliseconds
|
|
10
|
-
h: 60 * 60 * 1e3
|
|
11
|
-
// Hours to milliseconds
|
|
12
|
-
};
|
|
13
|
-
const match = value.match(/^(\d+)([mh])$/);
|
|
14
|
-
if (!match) {
|
|
15
|
-
throw new Error("Invalid time format. Use values like '5m', '1h', etc.");
|
|
16
|
-
}
|
|
17
|
-
const val = Number.parseInt(match[1], 10);
|
|
18
|
-
const unit = match[2];
|
|
19
|
-
return val * timeUnits[unit];
|
|
1
|
+
import { Duration } from "effect";
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
import { DefaultCacheLifetime } from "../../consts.js";
|
|
4
|
+
const LifeTimeSchema = Schema.optionalWith(Schema.DurationFromSelf, {
|
|
5
|
+
default: () => DefaultCacheLifetime
|
|
6
|
+
}).annotations({
|
|
7
|
+
description: "Cache Lifetime - The duration for which the cache is valid"
|
|
20
8
|
});
|
|
21
|
-
const CacheConfigSchema =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
lifetime: TimeStringSchema.optional().default(defaultCacheLifeTime)
|
|
9
|
+
const CacheConfigSchema = Schema.Union(
|
|
10
|
+
Schema.Boolean,
|
|
11
|
+
Schema.Struct({
|
|
12
|
+
lifetime: LifeTimeSchema
|
|
13
|
+
})
|
|
14
|
+
).annotations({
|
|
15
|
+
description: "Cache Configuration - Allows enabling/disabling cache and setting cache lifetime"
|
|
29
16
|
});
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Cache Lifetime
|
|
39
|
-
*
|
|
40
|
-
* `{number}{unit}` - e.g. '5m' for 5 minutes or '1h' for 1 hour
|
|
41
|
-
* @default '5m'
|
|
42
|
-
*/
|
|
43
|
-
lifetime: TimeStringSchema.default(defaultCacheLifeTime)
|
|
17
|
+
const InputSDKConfigSchema = Schema.Union(
|
|
18
|
+
Schema.Boolean,
|
|
19
|
+
Schema.Struct({
|
|
20
|
+
cacheConfig: CacheConfigSchema
|
|
21
|
+
})
|
|
22
|
+
).annotations({
|
|
23
|
+
description: "SDK Configuration - Allows configuring the SDK with cache settings"
|
|
44
24
|
});
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
25
|
+
const OutputSDKConfigSchema = Schema.Struct({
|
|
26
|
+
cacheConfig: Schema.Struct({
|
|
27
|
+
lifetime: Schema.Number,
|
|
28
|
+
enabled: Schema.Boolean
|
|
29
|
+
}).annotations({
|
|
30
|
+
description: "Processed Cache Configuration - Contains the processed cache settings with lifetime in milliseconds and enabled status"
|
|
31
|
+
})
|
|
32
|
+
}).annotations({
|
|
33
|
+
description: "Processed SDK Configuration - The resulting configuration after processing the input SDK configuration"
|
|
53
34
|
});
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
*/
|
|
60
|
-
cacheConfig: ProcessedCacheConfigSchema
|
|
35
|
+
const getDefaultCacheConfig = (enabled) => ({
|
|
36
|
+
cacheConfig: {
|
|
37
|
+
lifetime: Duration.toMillis(DefaultCacheLifetime),
|
|
38
|
+
enabled
|
|
39
|
+
}
|
|
61
40
|
});
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
41
|
+
const SDKConfigSchema = Schema.transform(InputSDKConfigSchema, OutputSDKConfigSchema, {
|
|
42
|
+
strict: true,
|
|
43
|
+
decode: (input) => {
|
|
44
|
+
if (typeof input === "boolean") {
|
|
45
|
+
return getDefaultCacheConfig(input);
|
|
46
|
+
}
|
|
47
|
+
if (typeof input.cacheConfig === "boolean") {
|
|
48
|
+
return getDefaultCacheConfig(input.cacheConfig);
|
|
49
|
+
}
|
|
69
50
|
return {
|
|
70
51
|
cacheConfig: {
|
|
71
|
-
enabled:
|
|
72
|
-
lifetime:
|
|
52
|
+
enabled: true,
|
|
53
|
+
lifetime: input.cacheConfig?.lifetime ? Duration.toMillis(input.cacheConfig.lifetime) : Duration.toMillis(DefaultCacheLifetime)
|
|
73
54
|
}
|
|
74
55
|
};
|
|
75
|
-
}
|
|
76
|
-
|
|
56
|
+
},
|
|
57
|
+
encode: (output) => ({
|
|
58
|
+
cacheConfig: {
|
|
59
|
+
lifetime: Duration.millis(output.cacheConfig.lifetime)
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
}).annotations({
|
|
63
|
+
title: "SDK Configuration",
|
|
64
|
+
description: "Configuration options related to the SDK, including cache settings",
|
|
65
|
+
identifier: "SDKConfig"
|
|
77
66
|
});
|
|
78
67
|
export {
|
|
79
68
|
CacheConfigSchema,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
TimeUnitSchema
|
|
69
|
+
InputSDKConfigSchema,
|
|
70
|
+
LifeTimeSchema,
|
|
71
|
+
OutputSDKConfigSchema,
|
|
72
|
+
SDKConfigSchema,
|
|
73
|
+
getDefaultCacheConfig
|
|
86
74
|
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom schema definitions for StudioCMS.
|
|
3
|
+
*
|
|
4
|
+
* These schemas are used to define the shape of custom configuration options for StudioCMS.
|
|
5
|
+
*
|
|
6
|
+
* @module customSchemas
|
|
7
|
+
* @description This module contains custom schema definitions for StudioCMS, including boolean and string schemas with default values, as well as a utility function for creating optional schemas with defaults.
|
|
8
|
+
*/
|
|
9
|
+
import * as Schema from 'effect/Schema';
|
|
10
|
+
/**
|
|
11
|
+
* Schema definition for a Boolean value that defaults to true if not provided.
|
|
12
|
+
*/
|
|
13
|
+
export declare const BooleanDefaultTrue: Schema.optionalWith<typeof Schema.Boolean, {
|
|
14
|
+
default: () => true;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* Schema definition for a Boolean value that defaults to false if not provided.
|
|
18
|
+
*/
|
|
19
|
+
export declare const BooleanDefaultFalse: Schema.optionalWith<typeof Schema.Boolean, {
|
|
20
|
+
default: () => false;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Schema definition for a String value that defaults to a provided default value if not provided.
|
|
24
|
+
*
|
|
25
|
+
* @param defaultValue - The default string value to use if the value is not provided.
|
|
26
|
+
* @returns A schema for a string with a default value.
|
|
27
|
+
*/
|
|
28
|
+
export declare const StringWithDefault: (defaultValue: string) => Schema.optionalWith<typeof Schema.NonEmptyTrimmedString, {
|
|
29
|
+
default: () => string;
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Utility function to create an optional schema with a default value.
|
|
33
|
+
*
|
|
34
|
+
* @param schema - The schema to make optional with a default value.
|
|
35
|
+
* @param defaultValue - The default value to use if the value is not provided.
|
|
36
|
+
* @returns A schema that is optional and has a default value.
|
|
37
|
+
*/
|
|
38
|
+
export declare const OptionalWithDefaults: <A, I>(schema: Schema.Schema<A, I, never>, defaultValue: I) => Schema.optionalWith<Schema.Schema<A, I, never>, {
|
|
39
|
+
default: () => A;
|
|
40
|
+
}>;
|