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.
Files changed (263) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/dist/cli/add/index.d.ts +2 -2
  3. package/dist/cli/add/npm-utils.d.ts +6 -6
  4. package/dist/cli/add/tryToInstallPlugins.d.ts +1 -1
  5. package/dist/cli/add/updateStudioCMSConfig.d.ts +1 -1
  6. package/dist/cli/add/validatePlugins.d.ts +1 -1
  7. package/dist/cli/crypto/genJWT/index.d.ts +1 -1
  8. package/dist/cli/crypto/index.d.ts +1 -1
  9. package/dist/cli/init/steps/env.js +12 -2
  10. package/dist/cli/init/steps/next.d.ts +1 -1
  11. package/dist/cli/migrator/index.d.ts +1 -1
  12. package/dist/cli/users/index.d.ts +1 -1
  13. package/dist/cli/users/steps/createUsers.js +3 -3
  14. package/dist/cli/users/steps/next.d.ts +1 -1
  15. package/dist/cli/utils/context.d.ts +1 -1
  16. package/dist/cli/utils/getCliDbClient.d.ts +1 -1
  17. package/dist/cli/utils/intro.d.ts +1 -1
  18. package/dist/cli/utils/loadConfig.d.ts +54 -49
  19. package/dist/cli/utils/loadConfig.js +5 -8
  20. package/dist/cli/utils/user-utils.d.ts +1 -1
  21. package/dist/client/apiClient.d.ts +4923 -0
  22. package/dist/client/apiClient.js +72 -0
  23. package/dist/config.d.ts +1734 -1
  24. package/dist/consts.d.ts +5 -5
  25. package/dist/consts.js +3 -2
  26. package/dist/db/plugins.d.ts +1 -1
  27. package/dist/db/plugins.js +5 -8
  28. package/dist/handlers/frontend/routes.d.ts +4 -18
  29. package/dist/handlers/frontend/routes.js +13 -152
  30. package/dist/handlers/frontend/types.d.ts +1 -1
  31. package/dist/handlers/frontend/utils.js +0 -18
  32. package/dist/handlers/pluginHandler.d.ts +34 -257
  33. package/dist/handlers/pluginHandler.js +92 -46
  34. package/dist/handlers/routeHandler.js +32 -11
  35. package/dist/handlers/setupDbStudio.d.ts +1 -1
  36. package/dist/handlers/storage-manager/core/effectify-astro-context.d.ts +25 -0
  37. package/dist/handlers/storage-manager/core/effectify-astro-context.js +78 -0
  38. package/dist/handlers/storage-manager/no-op.d.ts +2 -2
  39. package/dist/handlers/storage-manager/no-op.js +2 -3
  40. package/dist/index.d.ts +0 -1
  41. package/dist/index.js +9 -5
  42. package/dist/integrations/robots/index.d.ts +2 -2
  43. package/dist/integrations/robots/index.js +1 -3
  44. package/dist/integrations/robots/schema.d.ts +102 -273
  45. package/dist/integrations/robots/schema.js +220 -209
  46. package/dist/plugins/analytics/assets/schemas.d.ts +14 -9
  47. package/dist/plugins/analytics/assets/schemas.js +25 -17
  48. package/dist/plugins/analytics/db-client.d.ts +1 -1
  49. package/dist/plugins/analytics/index.d.ts +823 -3
  50. package/dist/plugins/analytics/index.js +4 -5
  51. package/dist/plugins/analytics/schemas.d.ts +54 -62
  52. package/dist/plugins/analytics/schemas.js +64 -13
  53. package/dist/plugins/analytics/table.d.ts +1 -1
  54. package/dist/plugins.d.ts +0 -1
  55. package/dist/schemas/config/api.d.ts +17 -0
  56. package/dist/schemas/config/api.js +14 -0
  57. package/dist/schemas/config/auth.d.ts +55 -59
  58. package/dist/schemas/config/auth.js +34 -11
  59. package/dist/schemas/config/dashboard.d.ts +43 -79
  60. package/dist/schemas/config/dashboard.js +43 -12
  61. package/dist/schemas/config/db.d.ts +15 -17
  62. package/dist/schemas/config/db.js +13 -5
  63. package/dist/schemas/config/developer.d.ts +33 -45
  64. package/dist/schemas/config/developer.js +22 -5
  65. package/dist/schemas/config/index.d.ts +398 -521
  66. package/dist/schemas/config/index.js +115 -57
  67. package/dist/schemas/config/sdk.d.ts +50 -196
  68. package/dist/schemas/config/sdk.js +61 -73
  69. package/dist/schemas/custom.d.ts +40 -0
  70. package/dist/schemas/custom.js +41 -0
  71. package/dist/schemas/external-schemas.d.ts +171 -0
  72. package/dist/schemas/external-schemas.js +179 -0
  73. package/dist/schemas/index.d.ts +2 -0
  74. package/dist/schemas/index.js +2 -0
  75. package/dist/schemas/plugins/i18n.d.ts +59 -39
  76. package/dist/schemas/plugins/i18n.js +42 -5
  77. package/dist/schemas/plugins/index.d.ts +7126 -10296
  78. package/dist/schemas/plugins/index.js +260 -276
  79. package/dist/schemas/plugins/shared.d.ts +1293 -3718
  80. package/dist/schemas/plugins/shared.js +320 -329
  81. package/dist/test-utils.d.ts +15 -4
  82. package/dist/test-utils.js +27 -11
  83. package/dist/toolbar/db-viewer/db-shared-types.d.ts +6 -6
  84. package/dist/toolbar/db-viewer/viewer.js +20 -21
  85. package/dist/types.d.ts +30 -0
  86. package/dist/utils/effects/smtp.d.ts +1 -1
  87. package/dist/utils/lang-helper.d.ts +10 -2
  88. package/dist/virtual.d.ts +23 -0
  89. package/dist/virtuals/auth/core.d.ts +5 -5
  90. package/dist/virtuals/auth/verify-email.d.ts +6 -6
  91. package/dist/virtuals/components/Generator.astro +2 -2
  92. package/dist/virtuals/components/Renderer.astro +9 -1
  93. package/dist/virtuals/components/renderFn.d.ts +3 -1
  94. package/dist/virtuals/components/renderFn.js +18 -0
  95. package/dist/virtuals/lib/headDefaults.d.ts +4 -2
  96. package/dist/virtuals/lib/headDefaults.js +0 -2
  97. package/dist/virtuals/lib/routeMap.d.ts +0 -12
  98. package/dist/virtuals/lib/routeMap.js +2 -14
  99. package/dist/virtuals/mailer/index.d.ts +3 -3
  100. package/dist/virtuals/notifier/index.d.ts +5 -5
  101. package/dist/virtuals/plugins/dashboard-pages.d.ts +2 -64
  102. package/dist/virtuals/scripts/StorageFileBrowser.d.ts +1 -172
  103. package/dist/virtuals/scripts/StorageFileBrowser.js +216 -119
  104. package/dist/virtuals/template-engine/index.d.ts +4 -4
  105. package/frontend/components/dashboard/configuration/ConfigForm.astro +218 -110
  106. package/frontend/components/dashboard/content-mgmt/ContentSearch.astro +21 -22
  107. package/frontend/components/dashboard/content-mgmt/CreateFolder.astro +66 -54
  108. package/frontend/components/dashboard/content-mgmt/CreatePage.astro +58 -104
  109. package/frontend/components/dashboard/content-mgmt/EditFolder.astro +65 -67
  110. package/frontend/components/dashboard/content-mgmt/EditPage.astro +86 -134
  111. package/frontend/components/dashboard/content-mgmt/InnerSidebarElement.astro +0 -1
  112. package/frontend/components/dashboard/content-mgmt/PageHeader.astro +33 -52
  113. package/frontend/components/dashboard/content-mgmt/PageTypeHandler.astro +2 -2
  114. package/frontend/components/dashboard/profile/APITokens.astro +219 -158
  115. package/frontend/components/dashboard/profile/BasicInfo.astro +165 -106
  116. package/frontend/components/dashboard/profile/Notifications.astro +27 -18
  117. package/frontend/components/dashboard/profile/UpdatePassword.astro +134 -94
  118. package/frontend/components/dashboard/sidebar/VersionCheck.astro +31 -16
  119. package/frontend/components/dashboard/sidebar/VersionCheckChangelog.astro +18 -11
  120. package/frontend/components/dashboard/sidebar-modals/VersionModal.astro +2 -2
  121. package/frontend/components/dashboard/smtp-config/TemplateEditor.astro +14 -14
  122. package/frontend/components/dashboard/taxonomy/InnerSidebarElement.astro +0 -1
  123. package/frontend/components/dashboard/taxonomy/MetaContainer.astro +0 -2
  124. package/frontend/components/dashboard/taxonomy/PageHeader.astro +16 -24
  125. package/frontend/components/dashboard/taxonomy/TaxonomySearch.astro +23 -27
  126. package/frontend/components/dashboard/user-mgmt/InnerSidebarElement.astro +111 -104
  127. package/frontend/components/dashboard/user-mgmt/UserListItem.astro +9 -22
  128. package/frontend/components/dashboard/user-mgmt/UserListItems.astro +18 -0
  129. package/frontend/components/first-time-setup/snippets/{opt2-studiocms.config.diff → studiocms.config.diff} +1 -0
  130. package/frontend/components/shared/Code.astro +1 -4
  131. package/frontend/components/shared/DynamicSettingsRenderer.astro +1 -1
  132. package/frontend/components/shared/SSRUser.astro +2 -4
  133. package/frontend/components/shared/foldertree/FolderTreeNode.astro +0 -6
  134. package/frontend/components/shared/storage-manager/StorageCopyOutput.astro +0 -1
  135. package/frontend/components/shared/taxonomy/TaxonomyTreeNode.astro +0 -6
  136. package/frontend/layouts/DashboardLayout.astro +0 -9
  137. package/frontend/layouts/TaxonomyLayout.astro +0 -1
  138. package/frontend/middleware/index.ts +102 -61
  139. package/frontend/pages/404.astro +0 -1
  140. package/frontend/pages/[dashboard]/[...pluginPage].astro +10 -1
  141. package/frontend/pages/[dashboard]/configuration.astro +10 -1
  142. package/frontend/pages/[dashboard]/content-management/createfolder.astro +10 -1
  143. package/frontend/pages/[dashboard]/content-management/createpage.astro +10 -1
  144. package/frontend/pages/[dashboard]/content-management/diff.astro +39 -14
  145. package/frontend/pages/[dashboard]/content-management/editfolder.astro +10 -1
  146. package/frontend/pages/[dashboard]/content-management/editpage.astro +10 -1
  147. package/frontend/pages/[dashboard]/content-management/index.astro +10 -1
  148. package/frontend/pages/[dashboard]/index.astro +10 -1
  149. package/frontend/pages/[dashboard]/login.astro +86 -25
  150. package/frontend/pages/[dashboard]/password-reset.astro +22 -16
  151. package/frontend/pages/[dashboard]/plugins/[plugin].astro +10 -1
  152. package/frontend/pages/[dashboard]/profile.astro +10 -1
  153. package/frontend/pages/[dashboard]/signup.astro +153 -52
  154. package/frontend/pages/[dashboard]/smtp-configuration.astro +77 -75
  155. package/frontend/pages/[dashboard]/system-management.astro +10 -1
  156. package/frontend/pages/[dashboard]/taxonomy/categories.astro +30 -41
  157. package/frontend/pages/[dashboard]/taxonomy/index.astro +10 -0
  158. package/frontend/pages/[dashboard]/taxonomy/tags.astro +33 -43
  159. package/frontend/pages/[dashboard]/unverified-email.astro +29 -21
  160. package/frontend/pages/[dashboard]/user-management/edit.astro +170 -90
  161. package/frontend/pages/[dashboard]/user-management/index.astro +10 -1
  162. package/frontend/pages/studiocms_api/[...all].ts +106 -0
  163. package/frontend/pages/studiocms_api/_handlers/_utils/auth.ts +26 -0
  164. package/frontend/pages/studiocms_api/_handlers/_utils/changelog.ts +147 -0
  165. package/frontend/pages/studiocms_api/_handlers/_utils/db-studio-driver.ts +46 -0
  166. package/frontend/pages/studiocms_api/_handlers/_utils/parseLogLevel.ts +27 -0
  167. package/frontend/pages/studiocms_api/_handlers/auth/auth.ts +459 -0
  168. package/frontend/pages/studiocms_api/_handlers/auth/index.ts +17 -0
  169. package/frontend/pages/studiocms_api/_handlers/auth/oauth.ts +91 -0
  170. package/frontend/pages/studiocms_api/_handlers/dashboard/_shared.ts +57 -0
  171. package/frontend/pages/studiocms_api/_handlers/dashboard/apiTokens.ts +134 -0
  172. package/frontend/pages/studiocms_api/_handlers/dashboard/config.ts +64 -0
  173. package/frontend/pages/studiocms_api/_handlers/dashboard/content.ts +741 -0
  174. package/frontend/pages/studiocms_api/_handlers/dashboard/create.ts +480 -0
  175. package/frontend/pages/studiocms_api/_handlers/dashboard/emailNotifications.ts +49 -0
  176. package/frontend/pages/studiocms_api/_handlers/dashboard/index.ts +45 -0
  177. package/frontend/pages/studiocms_api/_handlers/dashboard/mailer.ts +136 -0
  178. package/frontend/pages/studiocms_api/_handlers/dashboard/plugins.ts +80 -0
  179. package/frontend/pages/studiocms_api/_handlers/dashboard/profile.ts +275 -0
  180. package/frontend/pages/studiocms_api/_handlers/dashboard/resetPassword.ts +140 -0
  181. package/frontend/pages/studiocms_api/_handlers/dashboard/search.ts +63 -0
  182. package/frontend/pages/studiocms_api/_handlers/dashboard/taxonomy.ts +285 -0
  183. package/frontend/pages/studiocms_api/_handlers/dashboard/templates.ts +75 -0
  184. package/frontend/pages/studiocms_api/_handlers/dashboard/users.ts +312 -0
  185. package/frontend/pages/studiocms_api/_handlers/dashboard/verifyEndpoints.ts +307 -0
  186. package/frontend/pages/studiocms_api/_handlers/integration/dbStudio.ts +98 -0
  187. package/frontend/pages/studiocms_api/_handlers/integration/index.ts +17 -0
  188. package/frontend/pages/studiocms_api/_handlers/integration/storageManager.ts +107 -0
  189. package/frontend/pages/studiocms_api/_handlers/rest-api/index.ts +8 -0
  190. package/frontend/pages/studiocms_api/_handlers/rest-api/v1/_shared.ts +41 -0
  191. package/frontend/pages/studiocms_api/_handlers/rest-api/v1/index.ts +17 -0
  192. package/frontend/pages/studiocms_api/_handlers/rest-api/v1/public.ts +195 -0
  193. package/frontend/pages/studiocms_api/_handlers/rest-api/v1/secure.ts +1726 -0
  194. package/frontend/pages/studiocms_api/_handlers/sdk.ts +129 -0
  195. package/frontend/pages/studiocms_api/_middleware/astroLocals.ts +36 -0
  196. package/frontend/pages/studiocms_api/_middleware/restApi.ts +56 -0
  197. package/frontend/pages/studiocms_api/integrations/[...all].ts +8 -0
  198. package/frontend/scripts/formdata.ts +219 -0
  199. package/frontend/setup-pages/3-done.astro +4 -20
  200. package/frontend/setup-pages/studiocms_api/dashboard/step-2.ts +3 -6
  201. package/frontend/styles/dashboard-base.css +0 -1
  202. package/frontend/web-vitals/endpoint.ts +2 -1
  203. package/package.json +34 -29
  204. package/dist/global.d.ts +0 -9
  205. package/frontend/components/dashboard/LoginChecker.astro +0 -68
  206. package/frontend/components/dashboard/user-mgmt/RankCheck.astro +0 -57
  207. package/frontend/components/first-time-setup/snippets/opt1-astro.config.diff +0 -14
  208. package/frontend/components/first-time-setup/snippets/opt2-astro.config.diff +0 -9
  209. package/frontend/middleware/_authmap.ts +0 -63
  210. package/frontend/pages/studiocms_api/auth/[path].ts +0 -384
  211. package/frontend/pages/studiocms_api/auth/[provider]/[...id].ts +0 -64
  212. package/frontend/pages/studiocms_api/auth/[provider]/_effects/index.ts +0 -101
  213. package/frontend/pages/studiocms_api/auth/_shared.ts +0 -52
  214. package/frontend/pages/studiocms_api/dashboard/api-tokens.ts +0 -115
  215. package/frontend/pages/studiocms_api/dashboard/config.ts +0 -74
  216. package/frontend/pages/studiocms_api/dashboard/content/diff.ts +0 -73
  217. package/frontend/pages/studiocms_api/dashboard/content/folder.ts +0 -220
  218. package/frontend/pages/studiocms_api/dashboard/content/page.ts +0 -359
  219. package/frontend/pages/studiocms_api/dashboard/create-reset-link.ts +0 -77
  220. package/frontend/pages/studiocms_api/dashboard/create-user-invite.ts +0 -231
  221. package/frontend/pages/studiocms_api/dashboard/create-user.ts +0 -186
  222. package/frontend/pages/studiocms_api/dashboard/email-notification-settings-site.ts +0 -74
  223. package/frontend/pages/studiocms_api/dashboard/mailer/check-email.ts +0 -75
  224. package/frontend/pages/studiocms_api/dashboard/mailer/config.ts +0 -136
  225. package/frontend/pages/studiocms_api/dashboard/plugins/[plugin].ts +0 -80
  226. package/frontend/pages/studiocms_api/dashboard/profile.ts +0 -245
  227. package/frontend/pages/studiocms_api/dashboard/resend-verify-email.ts +0 -77
  228. package/frontend/pages/studiocms_api/dashboard/reset-password.ts +0 -124
  229. package/frontend/pages/studiocms_api/dashboard/search-list.ts +0 -59
  230. package/frontend/pages/studiocms_api/dashboard/taxonomy-search.ts +0 -47
  231. package/frontend/pages/studiocms_api/dashboard/taxonomy.ts +0 -230
  232. package/frontend/pages/studiocms_api/dashboard/templates.ts +0 -74
  233. package/frontend/pages/studiocms_api/dashboard/update-user-notifications.ts +0 -86
  234. package/frontend/pages/studiocms_api/dashboard/users.ts +0 -236
  235. package/frontend/pages/studiocms_api/dashboard/verify-email.ts +0 -83
  236. package/frontend/pages/studiocms_api/dashboard/verify-session.ts +0 -187
  237. package/frontend/pages/studiocms_api/integrations/[type]/[...id].ts +0 -15
  238. package/frontend/pages/studiocms_api/integrations/[type]/_routes/db-studio.ts +0 -173
  239. package/frontend/pages/studiocms_api/integrations/[type]/_routes/storage.ts +0 -88
  240. package/frontend/pages/studiocms_api/partials/editor.astro +0 -74
  241. package/frontend/pages/studiocms_api/partials/render.astro +0 -39
  242. package/frontend/pages/studiocms_api/partials/user-list-items.astro +0 -43
  243. package/frontend/pages/studiocms_api/rest/utils/auth-token.ts +0 -59
  244. package/frontend/pages/studiocms_api/rest/v1/[type]/[...id].ts +0 -23
  245. package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/categories.ts +0 -267
  246. package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/folders.ts +0 -283
  247. package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/pages.ts +0 -505
  248. package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/settings.ts +0 -100
  249. package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/tags.ts +0 -229
  250. package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/users.ts +0 -553
  251. package/frontend/pages/studiocms_api/rest/v1/public/[type]/[...id].ts +0 -19
  252. package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/categories.ts +0 -74
  253. package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/folders.ts +0 -85
  254. package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/pages.ts +0 -103
  255. package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/tags.ts +0 -67
  256. package/frontend/pages/studiocms_api/sdk/[...path].ts +0 -97
  257. package/frontend/pages/studiocms_api/sdk/utils/changelog.ts +0 -119
  258. package/frontend/scripts/auth/formListener.ts +0 -81
  259. package/frontend/scripts/formdata-utils.ts +0 -116
  260. package/frontend/utils/build-partial-schema.ts +0 -46
  261. package/frontend/utils/errors.ts +0 -6
  262. package/frontend/utils/param-extractor.ts +0 -83
  263. package/frontend/utils/rest-router.ts +0 -444
@@ -1,61 +1,119 @@
1
- import { z } from "astro/zod";
1
+ import * as Schema from "effect/Schema";
2
2
  import { RobotsTXTConfigSchema } from "../../integrations/robots/schema.js";
3
- import { availableTranslationsKeys } from "../../virtuals/i18n/v-files.js";
4
- import { authConfigSchema } from "./auth.js";
5
- import { dashboardConfigSchema } from "./dashboard.js";
6
- import { dbConfigSchema } from "./db.js";
7
- import { developerConfigSchema } from "./developer.js";
8
- import { SDKSchema } from "./sdk.js";
9
- const StudioCMSOptionsSchema = z.object({
10
- dbStartPage: z.boolean().optional().default(true),
11
- verbose: z.boolean().optional().default(false),
12
- logLevel: z.union([
13
- z.literal("All"),
14
- z.literal("Fatal"),
15
- z.literal("Error"),
16
- z.literal("Warning"),
17
- z.literal("Info"),
18
- z.literal("Debug"),
19
- z.literal("Trace"),
20
- z.literal("None")
21
- ]).optional().default("Info"),
22
- db: dbConfigSchema,
23
- plugins: z.custom().optional(),
24
- storageManager: z.custom().optional(),
25
- componentRegistry: z.record(z.string()).optional(),
26
- locale: z.object({
27
- dateLocale: z.string().optional().default("en-us"),
28
- dateTimeFormat: z.custom().optional().default({
29
- year: "numeric",
30
- month: "short",
31
- day: "numeric"
32
- }),
33
- i18n: z.object({
34
- defaultLocale: z.string().superRefine((val, ctx) => {
35
- if (!availableTranslationsKeys.includes(val)) {
36
- ctx.addIssue({
37
- code: z.ZodIssueCode.custom,
38
- message: `Locale '${val}' is not supported. Available locales are: ${availableTranslationsKeys.join(
39
- ", "
40
- )}`
41
- });
42
- return z.NEVER;
43
- }
44
- }).optional().default("en")
45
- }).optional().default({})
46
- }).optional().default({}),
47
- features: z.object({
48
- robotsTXT: z.union([RobotsTXTConfigSchema, z.boolean()]).optional().default(true),
49
- injectQuickActionsMenu: z.boolean().optional().default(true),
50
- sdk: SDKSchema,
51
- dashboardConfig: dashboardConfigSchema,
52
- authConfig: authConfigSchema,
53
- developerConfig: developerConfigSchema,
54
- preferredImageService: z.string().optional(),
55
- webVitals: z.boolean().optional().default(false)
56
- }).optional().default({})
57
- }).optional().default({});
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
- dashboardConfigSchema
118
+ StudioCMSRobotsTXTConfigSchema
61
119
  };
@@ -1,216 +1,70 @@
1
- import { z } from 'astro/zod';
2
- export declare const TimeUnitSchema: z.ZodUnion<[z.ZodLiteral<"m">, z.ZodLiteral<"h">]>;
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 CacheConfigSchema: z.ZodObject<{
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 processed cache configuration.
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 type CacheConfig = z.infer<typeof CacheConfigSchema>;
58
- /**
59
- * Represents the processed cache configuration inferred from the ProcessedCacheConfigSchema.
60
- *
61
- * This type is used to define the structure of the cache configuration after it has been
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
- * Schema for SDK cache configuration.
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 SDKCacheSchema: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
82
- /**
83
- * Cache Lifetime
84
- *
85
- * `{number}{unit}` - e.g. '5m' for 5 minutes or '1h' for 1 hour
86
- * @default '5m'
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 processing SDK configuration.
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 ProcessedSDKSchema: z.ZodObject<{
103
- /**
104
- * Cache Configuration
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
- * Type definition for the processed SDK configuration.
37
+ * Gets the default cache configuration based on whether caching is enabled or not.
142
38
  *
143
- * This type is inferred from the `ProcessedSDKSchema` using Zod's `infer` method.
144
- * It represents the structure of the SDK configuration after it has been processed.
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 type ProcessedSDKConfig = z.infer<typeof ProcessedSDKSchema>;
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
- * SDKSchema is a Zod schema that validates the SDK configuration.
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 SDKSchema: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
180
- cacheConfig: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
181
- /**
182
- * Cache Lifetime
183
- *
184
- * `{number}{unit}` - e.g. '5m' for 5 minutes or '1h' for 1 hour
185
- * @default '5m'
186
- */
187
- lifetime: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>>;
188
- }, "strip", z.ZodTypeAny, {
189
- lifetime: number;
190
- }, {
191
- lifetime?: string | undefined;
192
- }>]>>>, {
193
- lifetime: number;
194
- enabled: boolean;
195
- }, boolean | {
196
- lifetime?: string | undefined;
197
- } | undefined>;
198
- }, "strip", z.ZodTypeAny, {
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 { z } from "astro/zod";
2
- import { defaultCacheLifeTime } from "../../consts.js";
3
- const TimeUnitSchema = z.union([z.literal("m"), z.literal("h")]);
4
- const TimeStringSchema = z.string().regex(/^\d+(m|h)$/, {
5
- message: "Invalid time string format. Must be a number followed by 'm' or 'h'."
6
- }).transform((value) => {
7
- const timeUnits = {
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 = z.object({
22
- /**
23
- * Cache Lifetime
24
- *
25
- * `{number}{unit}` - e.g. '5m' for 5 minutes or '1h' for 1 hour
26
- * @default '5m'
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 ProcessedCacheConfigSchema = z.object({
31
- /**
32
- * Cache Enabled
33
- *
34
- * @default true
35
- */
36
- enabled: z.boolean().default(true),
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 SDKCacheSchema = z.union([z.boolean(), CacheConfigSchema]).optional().default(true).transform((cacheConfig) => {
46
- if (typeof cacheConfig === "boolean") {
47
- return {
48
- enabled: cacheConfig,
49
- lifetime: TimeStringSchema.parse(defaultCacheLifeTime)
50
- };
51
- }
52
- return { enabled: true, lifetime: cacheConfig.lifetime };
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 ProcessedSDKSchema = z.object({
55
- /**
56
- * Cache Configuration
57
- *
58
- * @default cacheConfig: { lifetime: '5m' }
59
- */
60
- cacheConfig: ProcessedCacheConfigSchema
35
+ const getDefaultCacheConfig = (enabled) => ({
36
+ cacheConfig: {
37
+ lifetime: Duration.toMillis(DefaultCacheLifetime),
38
+ enabled
39
+ }
61
40
  });
62
- const SDKSchema = z.union([
63
- z.boolean(),
64
- z.object({
65
- cacheConfig: SDKCacheSchema
66
- })
67
- ]).optional().default(true).transform((sdkConfig) => {
68
- if (typeof sdkConfig === "boolean") {
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: sdkConfig,
72
- lifetime: TimeStringSchema.parse(defaultCacheLifeTime)
52
+ enabled: true,
53
+ lifetime: input.cacheConfig?.lifetime ? Duration.toMillis(input.cacheConfig.lifetime) : Duration.toMillis(DefaultCacheLifetime)
73
54
  }
74
55
  };
75
- }
76
- return sdkConfig;
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
- ProcessedCacheConfigSchema,
81
- ProcessedSDKSchema,
82
- SDKCacheSchema,
83
- SDKSchema,
84
- TimeStringSchema,
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
+ }>;