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
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { ParseResult } from "effect";
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
import { SyncFunctionSchema } from "effectify/schemas";
|
|
4
|
+
import { availableTranslationFileKeys } from "../virtuals/i18n/v-files.js";
|
|
5
|
+
const expectedIconPrefixes = ["heroicons", "simpleicons", "lang-flags"];
|
|
6
|
+
const UIIconListSchema = Schema.declare(
|
|
7
|
+
(input) => {
|
|
8
|
+
if (typeof input !== "string") {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
const [prefix] = input.split(":");
|
|
12
|
+
if (!expectedIconPrefixes.includes(prefix)) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
return true;
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
title: "UIIconListSchema",
|
|
19
|
+
identifier: "UIIconListSchema",
|
|
20
|
+
description: "Schema for validating UI icon names against the list of available icons in StudioCMS."
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
const SanitizeOptionsSchema = Schema.declare(
|
|
24
|
+
(input) => {
|
|
25
|
+
if (typeof input !== "object" || input === null) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
title: "SanitizeOptionsSchema",
|
|
32
|
+
identifier: "SanitizeOptionsSchema",
|
|
33
|
+
description: "Schema for validating SanitizeOptions objects used in plugin configurations."
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
const AstroComponentSchema = SyncFunctionSchema(Schema.Any, Schema.Any);
|
|
37
|
+
const AstroIntegrationSchema = Schema.declare(
|
|
38
|
+
(input) => {
|
|
39
|
+
if (typeof input !== "object" || input === null) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
if ("name" in input && typeof input.name === "string") {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
return false;
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
title: "AstroIntegrationSchema",
|
|
49
|
+
identifier: "AstroIntegrationSchema",
|
|
50
|
+
description: "Schema for validating Astro integrations used in plugin configurations."
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
const AstroIntegrationLoggerSchema = Schema.declare(
|
|
54
|
+
(input) => {
|
|
55
|
+
if (typeof input !== "object" || input === null) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
if ("info" in input && typeof input.info === "function" && "warn" in input && typeof input.warn === "function" && "error" in input && typeof input.error === "function" && "debug" in input && typeof input.debug === "function") {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
title: "AstroIntegrationLoggerSchema",
|
|
65
|
+
identifier: "AstroIntegrationLoggerSchema",
|
|
66
|
+
description: "Schema for validating Astro integration loggers used in plugin configurations."
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
const I18nKeySchema = Schema.transformOrFail(Schema.String, Schema.String, {
|
|
70
|
+
strict: true,
|
|
71
|
+
decode: (input, _options, ast) => {
|
|
72
|
+
if (typeof input !== "string") {
|
|
73
|
+
return ParseResult.fail(
|
|
74
|
+
new ParseResult.Type(ast, input, "Expected a string for I18nKeySchema")
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
if (!availableTranslationFileKeys.includes(input)) {
|
|
78
|
+
return ParseResult.fail(
|
|
79
|
+
new ParseResult.Type(
|
|
80
|
+
ast,
|
|
81
|
+
input,
|
|
82
|
+
`Invalid translation key. Expected one of: ${availableTranslationFileKeys.join(", ")}`
|
|
83
|
+
)
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
return ParseResult.succeed(input);
|
|
87
|
+
},
|
|
88
|
+
encode: (output) => ParseResult.succeed(output)
|
|
89
|
+
}).annotations({
|
|
90
|
+
title: "I18nKeySchema",
|
|
91
|
+
identifier: "I18nKeySchema",
|
|
92
|
+
description: "Schema for validating translation keys used in plugin configurations, ensuring that only valid translation keys from the available translation file keys are accepted."
|
|
93
|
+
});
|
|
94
|
+
const LongShortUndefined = Schema.Union(Schema.Literal("long", "short"), Schema.Undefined);
|
|
95
|
+
const LongShortNarrowUndefined = Schema.Union(LongShortUndefined, Schema.Literal("narrow"));
|
|
96
|
+
const Numeric2Digit = Schema.Literal("numeric", "2-digit");
|
|
97
|
+
const Numeric2DigitUndefined = Schema.Union(Numeric2Digit, Schema.Undefined);
|
|
98
|
+
const TZOffsets = Schema.Literal("shortOffset", "longOffset");
|
|
99
|
+
const TZGenerics = Schema.Literal("shortGeneric", "longGeneric");
|
|
100
|
+
const TZName = Schema.Union(LongShortUndefined, TZOffsets, TZGenerics);
|
|
101
|
+
const BestFitUndefined = Schema.Union(Schema.Literal("best fit"), Schema.Undefined);
|
|
102
|
+
class DateTimeFormatOptions extends Schema.Class(
|
|
103
|
+
"DateTimeFormatOptions"
|
|
104
|
+
)(
|
|
105
|
+
{
|
|
106
|
+
localeMatcher: Schema.optional(Schema.Union(BestFitUndefined, Schema.Literal("lookup"))),
|
|
107
|
+
weekday: Schema.optional(LongShortNarrowUndefined),
|
|
108
|
+
era: Schema.optional(LongShortNarrowUndefined),
|
|
109
|
+
year: Schema.optional(Numeric2DigitUndefined),
|
|
110
|
+
month: Schema.optional(Schema.Union(Numeric2Digit, LongShortNarrowUndefined)),
|
|
111
|
+
day: Schema.optional(Numeric2DigitUndefined),
|
|
112
|
+
hour: Schema.optional(Numeric2DigitUndefined),
|
|
113
|
+
minute: Schema.optional(Numeric2DigitUndefined),
|
|
114
|
+
second: Schema.optional(Numeric2DigitUndefined),
|
|
115
|
+
timeZoneName: Schema.optional(TZName),
|
|
116
|
+
formatMatcher: Schema.optional(Schema.Union(BestFitUndefined, Schema.Literal("basic"))),
|
|
117
|
+
hour12: Schema.optional(Schema.Union(Schema.Boolean, Schema.Undefined)),
|
|
118
|
+
timeZone: Schema.optional(Schema.Union(Schema.String, Schema.Undefined))
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
title: "DateTimeFormatOptions",
|
|
122
|
+
description: "JavaScript Intl.DateTimeFormatOptions options for formatting dates and times in the dashboard.",
|
|
123
|
+
identifier: "DateTimeFormatOptions"
|
|
124
|
+
}
|
|
125
|
+
) {
|
|
126
|
+
}
|
|
127
|
+
const ValidEmailSchema = Schema.transformOrFail(Schema.String, Schema.String, {
|
|
128
|
+
strict: true,
|
|
129
|
+
decode: (input, _options, ast) => {
|
|
130
|
+
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
131
|
+
if (!emailRegex.test(input)) {
|
|
132
|
+
return ParseResult.fail(
|
|
133
|
+
new ParseResult.Type(
|
|
134
|
+
ast,
|
|
135
|
+
input,
|
|
136
|
+
"Invalid email format, expected a valid email address. (e.g., example@example.com)"
|
|
137
|
+
)
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
return ParseResult.succeed(input);
|
|
141
|
+
},
|
|
142
|
+
encode: (output) => ParseResult.succeed(output)
|
|
143
|
+
}).annotations({
|
|
144
|
+
title: "ValidEmailSchema",
|
|
145
|
+
identifier: "ValidEmailSchema",
|
|
146
|
+
description: "A schema for validating email addresses in StudioCMS, ensuring that any provided email addresses adhere to standard email formatting rules.",
|
|
147
|
+
examples: ["example@example.com", "john@doe.com"],
|
|
148
|
+
documentation: "This schema uses a regular expression to validate that the input string is in a valid email format, making it suitable for validating email addresses in plugin configurations or other parts of StudioCMS.",
|
|
149
|
+
jsonSchema: {
|
|
150
|
+
type: "string",
|
|
151
|
+
format: "email"
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
const isValidEmail = (email) => {
|
|
155
|
+
const result = Schema.decodeEither(ValidEmailSchema)(email);
|
|
156
|
+
if (result._tag === "Left") {
|
|
157
|
+
return { success: false, error: result.left };
|
|
158
|
+
}
|
|
159
|
+
return { success: true, data: email };
|
|
160
|
+
};
|
|
161
|
+
export {
|
|
162
|
+
AstroComponentSchema,
|
|
163
|
+
AstroIntegrationLoggerSchema,
|
|
164
|
+
AstroIntegrationSchema,
|
|
165
|
+
BestFitUndefined,
|
|
166
|
+
DateTimeFormatOptions,
|
|
167
|
+
I18nKeySchema,
|
|
168
|
+
LongShortNarrowUndefined,
|
|
169
|
+
LongShortUndefined,
|
|
170
|
+
Numeric2Digit,
|
|
171
|
+
Numeric2DigitUndefined,
|
|
172
|
+
SanitizeOptionsSchema,
|
|
173
|
+
TZGenerics,
|
|
174
|
+
TZName,
|
|
175
|
+
TZOffsets,
|
|
176
|
+
UIIconListSchema,
|
|
177
|
+
ValidEmailSchema,
|
|
178
|
+
isValidEmail
|
|
179
|
+
};
|
package/dist/schemas/index.d.ts
CHANGED
package/dist/schemas/index.js
CHANGED
|
@@ -1,40 +1,67 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import * as Schema from 'effect/Schema';
|
|
2
|
+
/**
|
|
3
|
+
* Plugin Translations Schema
|
|
4
|
+
*/
|
|
5
|
+
export declare const TranslationsJSONSchema: Schema.mutable<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
6
|
+
/**
|
|
7
|
+
* Type for the plugin translations JSON object.
|
|
8
|
+
*/
|
|
9
|
+
export type TranslationsJSON = typeof TranslationsJSONSchema.Type;
|
|
10
|
+
/**
|
|
11
|
+
* Schema for the components translations JSON object.
|
|
12
|
+
*/
|
|
13
|
+
export declare const ComponentsJSONSchema: Schema.mutable<Schema.Record$<typeof Schema.String, Schema.mutable<Schema.Record$<typeof Schema.String, typeof Schema.String>>>>;
|
|
14
|
+
/**
|
|
15
|
+
* Type for the components translations JSON object.
|
|
16
|
+
*/
|
|
17
|
+
export type ComponentsJSON = typeof ComponentsJSONSchema.Type;
|
|
18
|
+
/**
|
|
19
|
+
* Schema for the plugin translations collection.
|
|
20
|
+
*/
|
|
21
|
+
export declare const PluginTranslationsSchema: Schema.mutable<Schema.Record$<typeof Schema.String, Schema.mutable<Schema.Record$<typeof Schema.String, Schema.mutable<Schema.Record$<typeof Schema.String, typeof Schema.String>>>>>>;
|
|
22
|
+
/**
|
|
23
|
+
* Type for the plugin translations collection.
|
|
24
|
+
*/
|
|
25
|
+
export type PluginTranslations = typeof PluginTranslationsSchema.Type;
|
|
26
|
+
/**
|
|
27
|
+
* Schema for a collection of plugin translations.
|
|
28
|
+
*/
|
|
29
|
+
export declare const PluginTranslationCollectionSchema: Schema.mutable<Schema.Record$<typeof Schema.String, Schema.mutable<Schema.Record$<typeof Schema.String, Schema.mutable<Schema.Record$<typeof Schema.String, Schema.mutable<Schema.Record$<typeof Schema.String, typeof Schema.String>>>>>>>>;
|
|
30
|
+
/**
|
|
31
|
+
* Type for a collection of plugin translations.
|
|
32
|
+
*/
|
|
33
|
+
export type PluginTranslationCollection = typeof PluginTranslationCollectionSchema.Type;
|
|
34
|
+
/**
|
|
35
|
+
* Schema for the plugin augments translations JSON object.
|
|
36
|
+
*/
|
|
37
|
+
export declare const AugmentsJSONSchema: Schema.mutable<Schema.Struct<{
|
|
38
|
+
augments: Schema.mutable<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
39
|
+
}>>;
|
|
40
|
+
/**
|
|
41
|
+
* Type for the plugin augments translations JSON object.
|
|
42
|
+
*/
|
|
43
|
+
export type AugmentsJSON = typeof AugmentsJSONSchema.Type;
|
|
44
|
+
/**
|
|
45
|
+
* Schema for a collection of plugin augments translations.
|
|
13
46
|
*
|
|
14
47
|
* @example
|
|
15
48
|
* {
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* },
|
|
26
|
-
* },
|
|
27
|
-
* 'plugin2': { ... }
|
|
49
|
+
* en: {
|
|
50
|
+
* augments: {
|
|
51
|
+
* 'augment-key': 'Augment Text',
|
|
52
|
+
* 'another-augment': 'More augment text'
|
|
53
|
+
* }
|
|
54
|
+
* },
|
|
55
|
+
* fr: {
|
|
56
|
+
* augments: { ... }
|
|
57
|
+
* }
|
|
28
58
|
* }
|
|
29
59
|
*/
|
|
30
|
-
export
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
export interface AugmentsJSON {
|
|
34
|
-
augments: TranslationsJSON;
|
|
35
|
-
}
|
|
60
|
+
export declare const PluginAugmentsTranslationCollectionSchema: Schema.mutable<Schema.Record$<typeof Schema.String, Schema.mutable<Schema.Struct<{
|
|
61
|
+
augments: Schema.mutable<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
62
|
+
}>>>>;
|
|
36
63
|
/**
|
|
37
|
-
*
|
|
64
|
+
* Type for a collection of plugin augments translations.
|
|
38
65
|
*
|
|
39
66
|
* @example
|
|
40
67
|
* {
|
|
@@ -49,11 +76,4 @@ export interface AugmentsJSON {
|
|
|
49
76
|
* }
|
|
50
77
|
* }
|
|
51
78
|
*/
|
|
52
|
-
export
|
|
53
|
-
[language: string]: AugmentsJSON;
|
|
54
|
-
}
|
|
55
|
-
export declare const pluginTranslationsSchema: z.ZodType<PluginTranslations, z.ZodTypeDef, PluginTranslations>;
|
|
56
|
-
/**
|
|
57
|
-
* Schema for a collection of plugin translations.
|
|
58
|
-
*/
|
|
59
|
-
export declare const pluginTranslationCollectionSchema: z.ZodType<PluginTranslationCollection, z.ZodTypeDef, PluginTranslationCollection>;
|
|
79
|
+
export type PluginAugmentsTranslationCollection = typeof PluginAugmentsTranslationCollectionSchema.Type;
|
|
@@ -1,7 +1,44 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
3
|
-
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
const TranslationsJSONSchema = Schema.mutable(
|
|
3
|
+
Schema.Record({
|
|
4
|
+
key: Schema.String,
|
|
5
|
+
value: Schema.String
|
|
6
|
+
})
|
|
7
|
+
);
|
|
8
|
+
const ComponentsJSONSchema = Schema.mutable(
|
|
9
|
+
Schema.Record({
|
|
10
|
+
key: Schema.String,
|
|
11
|
+
value: TranslationsJSONSchema
|
|
12
|
+
})
|
|
13
|
+
);
|
|
14
|
+
const PluginTranslationsSchema = Schema.mutable(
|
|
15
|
+
Schema.Record({
|
|
16
|
+
key: Schema.String,
|
|
17
|
+
value: ComponentsJSONSchema
|
|
18
|
+
})
|
|
19
|
+
);
|
|
20
|
+
const PluginTranslationCollectionSchema = Schema.mutable(
|
|
21
|
+
Schema.Record({
|
|
22
|
+
key: Schema.String,
|
|
23
|
+
value: PluginTranslationsSchema
|
|
24
|
+
})
|
|
25
|
+
);
|
|
26
|
+
const AugmentsJSONSchema = Schema.mutable(
|
|
27
|
+
Schema.Struct({
|
|
28
|
+
augments: TranslationsJSONSchema
|
|
29
|
+
})
|
|
30
|
+
);
|
|
31
|
+
const PluginAugmentsTranslationCollectionSchema = Schema.mutable(
|
|
32
|
+
Schema.Record({
|
|
33
|
+
key: Schema.String,
|
|
34
|
+
value: AugmentsJSONSchema
|
|
35
|
+
})
|
|
36
|
+
);
|
|
4
37
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
38
|
+
AugmentsJSONSchema,
|
|
39
|
+
ComponentsJSONSchema,
|
|
40
|
+
PluginAugmentsTranslationCollectionSchema,
|
|
41
|
+
PluginTranslationCollectionSchema,
|
|
42
|
+
PluginTranslationsSchema,
|
|
43
|
+
TranslationsJSONSchema
|
|
7
44
|
};
|