@kyro-cms/core 0.1.7 → 0.1.8

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 (42) hide show
  1. package/README.md +25 -2
  2. package/dist/{WebhookService-BPVJUgTl.d.ts → WebhookService-CXJ5oz6L.d.ts} +1 -1
  3. package/dist/{WebhookService-BCgL1bLF.d.cts → WebhookService-Dqx9Is7m.d.cts} +1 -1
  4. package/dist/{base-DaP-5PPG.d.ts → base-CciYzoDF.d.ts} +1 -1
  5. package/dist/{base-B0Y6isUJ.d.cts → base-Cfek4fp3.d.cts} +1 -1
  6. package/dist/chunk-EWP5AT6A.cjs +268 -0
  7. package/dist/chunk-EWP5AT6A.cjs.map +1 -0
  8. package/dist/chunk-QKOFKITP.js +258 -0
  9. package/dist/chunk-QKOFKITP.js.map +1 -0
  10. package/dist/client.cjs +45 -0
  11. package/dist/client.cjs.map +1 -0
  12. package/dist/client.d.cts +11 -0
  13. package/dist/client.d.ts +11 -0
  14. package/dist/client.js +4 -0
  15. package/dist/client.js.map +1 -0
  16. package/dist/drizzle/index.d.cts +114 -4
  17. package/dist/drizzle/index.d.ts +114 -4
  18. package/dist/graphql/index.d.cts +2 -2
  19. package/dist/graphql/index.d.ts +2 -2
  20. package/dist/{index-DupWTmW6.d.ts → index-BvZ1iWm2.d.ts} +1 -1
  21. package/dist/{index-BwE4NueJ.d.cts → index-CTLPjpMH.d.cts} +1 -1
  22. package/dist/index.cjs +45 -268
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +15 -230
  25. package/dist/index.d.ts +15 -230
  26. package/dist/index.js +13 -260
  27. package/dist/index.js.map +1 -1
  28. package/dist/mongodb/index.d.cts +2 -2
  29. package/dist/mongodb/index.d.ts +2 -2
  30. package/dist/rate-limit-BvUAVCzw.d.cts +223 -0
  31. package/dist/rate-limit-CJnqG1mG.d.ts +223 -0
  32. package/dist/rest/index.d.cts +3 -3
  33. package/dist/rest/index.d.ts +3 -3
  34. package/dist/templates/index.d.cts +1 -1
  35. package/dist/templates/index.d.ts +1 -1
  36. package/dist/trpc/index.d.cts +2 -2
  37. package/dist/trpc/index.d.ts +2 -2
  38. package/dist/{index-DtBi3zP0.d.ts → types-BSR91JFN.d.cts} +1 -112
  39. package/dist/{index-DUKmDSeC.d.cts → types-BSR91JFN.d.ts} +1 -112
  40. package/dist/{types-BM0s_YOy.d.cts → types-Bt1OEk0S.d.cts} +12 -4
  41. package/dist/{types-BM0s_YOy.d.ts → types-Bt1OEk0S.d.ts} +12 -4
  42. package/package.json +9 -2
package/dist/index.js CHANGED
@@ -2,6 +2,8 @@ export { allSettingsGlobals, blogCollections, blogGlobals, coreSettingsGlobals,
2
2
  export { RedisAuthAdapter } from './chunk-GLCPGZPM.js';
3
3
  import { PasswordPolicy, SQLiteAuthAdapter } from './chunk-RRYXQMZG.js';
4
4
  export { PasswordPolicy, SQLiteAuthAdapter, autoBootstrap, bootstrapAdmin, getBootstrapFromEnv } from './chunk-RRYXQMZG.js';
5
+ import { createAuditContext } from './chunk-QKOFKITP.js';
6
+ export { CSSGenerator, createAdminStyling, defaultDarkTheme, defaultFieldStyling, defaultLightTheme, ecommerce2026Theme, generateCSSVariables, generateTailwindConfig } from './chunk-QKOFKITP.js';
5
7
  import { createKyroServer } from './chunk-OUGKLCYF.js';
6
8
  export { createContext, createCountProcedure, createCreateProcedure, createDeleteProcedure, createDynamicRouter, createFindByIDProcedure, createFindProcedure, createKyroServer, createUpdateProcedure } from './chunk-OUGKLCYF.js';
7
9
  import { buildGraphQLSchema } from './chunk-KWGNR4HM.js';
@@ -2115,6 +2117,9 @@ function isBlocksField(field) {
2115
2117
  function isUploadField(field) {
2116
2118
  return field.type === "upload";
2117
2119
  }
2120
+ function isImageField(field) {
2121
+ return field.type === "image";
2122
+ }
2118
2123
  function isRichTextField(field) {
2119
2124
  return field.type === "richtext";
2120
2125
  }
@@ -2141,6 +2146,7 @@ var COMPLEX_FIELD_TYPES = [
2141
2146
  "json",
2142
2147
  "code",
2143
2148
  "upload",
2149
+ "image",
2144
2150
  "markdown"
2145
2151
  ];
2146
2152
  var RELATIONAL_FIELD_TYPES = [
@@ -3232,253 +3238,6 @@ var presetPlugins = {
3232
3238
  Wishlist: WishlistPlugin
3233
3239
  };
3234
3240
 
3235
- // src/styling/index.ts
3236
- var CSSGenerator = class {
3237
- constructor(config) {
3238
- this.config = config;
3239
- }
3240
- config;
3241
- css = [];
3242
- addRule(selector, properties) {
3243
- const props = Object.entries(properties).map(([k, v]) => ` ${k}: ${v};`).join("\n");
3244
- this.css.push(`${selector} {
3245
- ${props}
3246
- }`);
3247
- return this;
3248
- }
3249
- addMediaQuery(breakpoint, rules) {
3250
- this.css.push(`@media (min-width: ${breakpoint}) {
3251
- ${rules.join("\n ")}
3252
- }`);
3253
- return this;
3254
- }
3255
- generate() {
3256
- return this.css.join("\n\n");
3257
- }
3258
- };
3259
- function generateTailwindConfig(theme) {
3260
- return {
3261
- theme: {
3262
- extend: {
3263
- colors: theme.colors || {},
3264
- fontFamily: theme.fonts || {},
3265
- spacing: theme.spacing || {},
3266
- borderRadius: theme.borderRadius || {},
3267
- boxShadow: theme.shadows || {},
3268
- screens: theme.breakpoints || {}
3269
- }
3270
- }
3271
- };
3272
- }
3273
- var defaultLightTheme = {
3274
- colors: {
3275
- primary: "#3b82f6",
3276
- secondary: "#6366f1",
3277
- accent: "#ec4899",
3278
- background: "#ffffff",
3279
- surface: "#f9fafb",
3280
- text: "#111827",
3281
- textMuted: "#6b7280",
3282
- border: "#e5e7eb",
3283
- error: "#ef4444",
3284
- warning: "#f59e0b",
3285
- success: "#10b981",
3286
- info: "#3b82f6"
3287
- },
3288
- fonts: {
3289
- sans: "system-ui, -apple-system, sans-serif",
3290
- serif: "Georgia, serif",
3291
- mono: "Menlo, monospace"
3292
- },
3293
- spacing: {
3294
- xs: "0.25rem",
3295
- sm: "0.5rem",
3296
- md: "1rem",
3297
- lg: "1.5rem",
3298
- xl: "2rem",
3299
- "2xl": "3rem",
3300
- "3xl": "4rem"
3301
- },
3302
- borderRadius: {
3303
- sm: "0.125rem",
3304
- md: "0.375rem",
3305
- lg: "0.5rem",
3306
- xl: "0.75rem",
3307
- full: "9999px"
3308
- },
3309
- shadows: {
3310
- sm: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
3311
- md: "0 4px 6px -1px rgb(0 0 0 / 0.1)",
3312
- lg: "0 10px 15px -3px rgb(0 0 0 / 0.1)",
3313
- xl: "0 20px 25px -5px rgb(0 0 0 / 0.1)"
3314
- }
3315
- };
3316
- var defaultDarkTheme = {
3317
- colors: {
3318
- primary: "#60a5fa",
3319
- secondary: "#818cf8",
3320
- accent: "#f472b6",
3321
- background: "#111827",
3322
- surface: "#1f2937",
3323
- text: "#f9fafb",
3324
- textMuted: "#9ca3af",
3325
- border: "#374151",
3326
- error: "#f87171",
3327
- warning: "#fbbf24",
3328
- success: "#34d399",
3329
- info: "#60a5fa"
3330
- },
3331
- fonts: defaultLightTheme.fonts,
3332
- spacing: defaultLightTheme.spacing,
3333
- borderRadius: defaultLightTheme.borderRadius,
3334
- shadows: {
3335
- sm: "0 1px 2px 0 rgb(0 0 0 / 0.3)",
3336
- md: "0 4px 6px -1px rgb(0 0 0 / 0.4)",
3337
- lg: "0 10px 15px -3px rgb(0 0 0 / 0.5)",
3338
- xl: "0 20px 25px -5px rgb(0 0 0 / 0.6)"
3339
- }
3340
- };
3341
- var ecommerce2026Theme = {
3342
- colors: {
3343
- primary: "#FF6B35",
3344
- secondary: "#1A1A2E",
3345
- accent: "#16C79A",
3346
- background: "#FFFFFF",
3347
- surface: "#F8F9FA",
3348
- text: "#1A1A2E",
3349
- textMuted: "#6B7280",
3350
- border: "#E5E7EB",
3351
- error: "#EF4444",
3352
- warning: "#F59E0B",
3353
- success: "#16C79A",
3354
- info: "#3B82F6"
3355
- },
3356
- fonts: {
3357
- sans: '"Inter", "Satoshi", system-ui, sans-serif',
3358
- serif: '"Playfair Display", Georgia, serif',
3359
- mono: '"JetBrains Mono", monospace'
3360
- },
3361
- spacing: {
3362
- xs: "0.125rem",
3363
- sm: "0.25rem",
3364
- md: "0.5rem",
3365
- lg: "1rem",
3366
- xl: "1.5rem",
3367
- "2xl": "2rem",
3368
- "3xl": "3rem",
3369
- "4xl": "4rem"
3370
- },
3371
- borderRadius: {
3372
- sm: "0",
3373
- md: "0",
3374
- lg: "0",
3375
- xl: "0",
3376
- full: "9999px"
3377
- },
3378
- shadows: {
3379
- sm: "0 1px 2px rgba(0,0,0,0.05)",
3380
- md: "0 4px 6px rgba(0,0,0,0.07)",
3381
- lg: "0 10px 15px rgba(0,0,0,0.1)",
3382
- xl: "0 20px 25px rgba(0,0,0,0.15)"
3383
- }
3384
- };
3385
- function generateCSSVariables(theme) {
3386
- const variables = [];
3387
- if (theme.colors) {
3388
- for (const [key, value] of Object.entries(theme.colors)) {
3389
- variables.push(` --color-${key}: ${value};`);
3390
- }
3391
- }
3392
- if (theme.fonts) {
3393
- for (const [key, value] of Object.entries(theme.fonts)) {
3394
- variables.push(` --font-${key}: ${value};`);
3395
- }
3396
- }
3397
- if (theme.spacing) {
3398
- for (const [key, value] of Object.entries(theme.spacing)) {
3399
- variables.push(` --spacing-${key}: ${value};`);
3400
- }
3401
- }
3402
- if (theme.borderRadius) {
3403
- for (const [key, value] of Object.entries(theme.borderRadius)) {
3404
- variables.push(` --radius-${key}: ${value};`);
3405
- }
3406
- }
3407
- if (theme.shadows) {
3408
- for (const [key, value] of Object.entries(theme.shadows)) {
3409
- variables.push(` --shadow-${key}: ${value};`);
3410
- }
3411
- }
3412
- return `:root {
3413
- ${variables.join("\n")}
3414
- }`;
3415
- }
3416
- function createAdminStyling(config) {
3417
- const cssVars = generateCSSVariables(config.theme || defaultLightTheme);
3418
- const componentStyles = [];
3419
- if (config.componentOverrides) {
3420
- for (const [selector, styles] of Object.entries(config.componentOverrides)) {
3421
- const props = Object.entries(styles).map(([k, v]) => ` ${k}: ${v};`).join("\n");
3422
- componentStyles.push(`${selector} {
3423
- ${props}
3424
- }`);
3425
- }
3426
- }
3427
- return `
3428
- ${cssVars}
3429
- ${config.customStyles || ""}
3430
- ${componentStyles.join("\n")}
3431
- `;
3432
- }
3433
- var defaultFieldStyling = {
3434
- text: {
3435
- wrapper: { marginBottom: "var(--spacing-md)" },
3436
- label: {
3437
- display: "block",
3438
- marginBottom: "var(--spacing-xs)",
3439
- fontWeight: "500",
3440
- color: "var(--color-text)"
3441
- },
3442
- input: {
3443
- width: "100%",
3444
- padding: "var(--spacing-sm) var(--spacing-md)",
3445
- border: "1px solid var(--color-border)",
3446
- borderRadius: "var(--radius-md)",
3447
- fontSize: "0.875rem"
3448
- },
3449
- error: {
3450
- color: "var(--color-error)",
3451
- fontSize: "0.75rem",
3452
- marginTop: "var(--spacing-xs)"
3453
- }
3454
- },
3455
- number: {
3456
- wrapper: { marginBottom: "var(--spacing-md)" },
3457
- label: { display: "block", marginBottom: "var(--spacing-xs)", fontWeight: "500" },
3458
- input: {
3459
- width: "100%",
3460
- padding: "var(--spacing-sm) var(--spacing-md)",
3461
- border: "1px solid var(--color-border)",
3462
- borderRadius: "var(--radius-md)"
3463
- }
3464
- },
3465
- checkbox: {
3466
- wrapper: { display: "flex", alignItems: "center", gap: "var(--spacing-sm)" },
3467
- input: { width: "1rem", height: "1rem" },
3468
- label: { cursor: "pointer" }
3469
- },
3470
- select: {
3471
- wrapper: { marginBottom: "var(--spacing-md)" },
3472
- input: {
3473
- width: "100%",
3474
- padding: "var(--spacing-sm) var(--spacing-md)",
3475
- border: "1px solid var(--color-border)",
3476
- borderRadius: "var(--radius-md)",
3477
- backgroundColor: "white"
3478
- }
3479
- }
3480
- };
3481
-
3482
3241
  // src/auth/security/lockout.ts
3483
3242
  var DEFAULT_LOCKOUT_CONFIG = {
3484
3243
  maxAttempts: 5,
@@ -3970,7 +3729,7 @@ var AuditLogger = class {
3970
3729
  };
3971
3730
  }
3972
3731
  };
3973
- function createAuditContext(req) {
3732
+ function createAuditContext2(req) {
3974
3733
  return {
3975
3734
  ipAddress: req.headers.get("x-forwarded-for")?.split(",")[0]?.trim() || req.headers.get("x-real-ip") || "unknown",
3976
3735
  userAgent: req.headers.get("user-agent") || "unknown"
@@ -4425,12 +4184,6 @@ var InMemoryAuditLogger = class {
4425
4184
  this.logs = this.logs.filter((log) => log.timestamp >= cutoffDate);
4426
4185
  }
4427
4186
  };
4428
- function createAuditContext2(req) {
4429
- return {
4430
- ipAddress: req.headers.get("x-forwarded-for")?.split(",")[0]?.trim() || req.headers.get("x-real-ip") || "unknown",
4431
- userAgent: req.headers.get("user-agent") || "unknown"
4432
- };
4433
- }
4434
4187
  var AuthRoutes = class {
4435
4188
  authAdapter;
4436
4189
  email;
@@ -4459,7 +4212,7 @@ var AuthRoutes = class {
4459
4212
  this.emailVerificationRequired = config.emailVerificationRequired ?? true;
4460
4213
  }
4461
4214
  async register(req) {
4462
- const { ipAddress, userAgent } = createAuditContext2(req);
4215
+ const { ipAddress, userAgent } = createAuditContext(req);
4463
4216
  if (this.rateLimiter) {
4464
4217
  const limit = await this.rateLimiter.check("auth:register", ipAddress);
4465
4218
  if (!limit.allowed) {
@@ -4520,7 +4273,7 @@ var AuthRoutes = class {
4520
4273
  }
4521
4274
  }
4522
4275
  async login(req) {
4523
- const { ipAddress, userAgent } = createAuditContext2(req);
4276
+ const { ipAddress, userAgent } = createAuditContext(req);
4524
4277
  if (this.rateLimiter) {
4525
4278
  const limit = await this.rateLimiter.check("auth:login", ipAddress);
4526
4279
  if (!limit.allowed) {
@@ -4617,7 +4370,7 @@ var AuthRoutes = class {
4617
4370
  if (!token) {
4618
4371
  return this.errorResponse("No session to logout", 401);
4619
4372
  }
4620
- const { ipAddress, userAgent } = createAuditContext2(req);
4373
+ const { ipAddress, userAgent } = createAuditContext(req);
4621
4374
  try {
4622
4375
  const payload = jwt.decode(token);
4623
4376
  if (payload && payload.sub) {
@@ -4681,7 +4434,7 @@ var AuthRoutes = class {
4681
4434
  if (!token) {
4682
4435
  return this.errorResponse("Not authenticated", 401);
4683
4436
  }
4684
- const { ipAddress, userAgent } = createAuditContext2(req);
4437
+ const { ipAddress, userAgent } = createAuditContext(req);
4685
4438
  try {
4686
4439
  const payload = jwt.verify(token, this.jwtSecret);
4687
4440
  const body = await req.json();
@@ -4757,7 +4510,7 @@ var AuthRoutes = class {
4757
4510
  }
4758
4511
  }
4759
4512
  async forgotPassword(req) {
4760
- const { ipAddress, userAgent } = createAuditContext2(req);
4513
+ const { ipAddress, userAgent } = createAuditContext(req);
4761
4514
  if (this.rateLimiter) {
4762
4515
  const limit = await this.rateLimiter.check("auth:forgot", ipAddress);
4763
4516
  if (!limit.allowed) {
@@ -6967,6 +6720,6 @@ function defineConfig(config) {
6967
6720
  };
6968
6721
  }
6969
6722
 
6970
- export { ALL_FIELD_TYPES, AccountLockout, AnalyticsPlugin, AuditLogger, Auth, COMPLEX_FIELD_TYPES, CSSGenerator, CommentsPlugin, ConfigValidationError, InMemoryAccountLockout, InMemoryAuditLogger, InMemoryAuthAdapter, Kyro, KyroPlugin, LAYOUT_FIELD_TYPES, LocalAdapter, MediaService, PRIMITIVE_FIELD_TYPES, PluginManager, RELATIONAL_FIELD_TYPES, RateLimiter, Registry, ReviewsPlugin, SEOPLugin, VersionManager, WishlistPlugin, authConfig, collectionToCreateZod, collectionToUpdateZod, collectionToWhereZod, collectionToZod, createAdminStyling, createAuditContext, createAuth, createAuthConfig, createColumnsNode, createKyro, createLocalAdapter, createLocalStorage, createRegistry, createVersionManager, defaultDarkTheme, defaultFieldStyling, defaultLightTheme, defineConfig, ecommerce2026Theme, fieldToZod, generateCSSVariables, generateTailwindConfig, getDefaultDraftPublishConfig, getRegistry, globalToZod, isArchived, isArrayField, isBlocksField, isDraft, isGroupField, isLayoutField, isNumberField, isPublished, isRelationshipField, isRichTextField, isSelectField, isTextField, isUploadField, normalizeRichTextDocument, normalizeRichTextValue, presetPlugins, renderRichText, resetRegistry, resolveProvider, richTextStyles, runFieldHooks, runHooks, validateCollection, validateConfig, validateFields, validateGlobal };
6723
+ export { ALL_FIELD_TYPES, AccountLockout, AnalyticsPlugin, AuditLogger, Auth, COMPLEX_FIELD_TYPES, CommentsPlugin, ConfigValidationError, InMemoryAccountLockout, InMemoryAuditLogger, InMemoryAuthAdapter, Kyro, KyroPlugin, LAYOUT_FIELD_TYPES, LocalAdapter, MediaService, PRIMITIVE_FIELD_TYPES, PluginManager, RELATIONAL_FIELD_TYPES, RateLimiter, Registry, ReviewsPlugin, SEOPLugin, VersionManager, WishlistPlugin, authConfig, collectionToCreateZod, collectionToUpdateZod, collectionToWhereZod, collectionToZod, createAuditContext2 as createAuditContext, createAuth, createAuthConfig, createColumnsNode, createKyro, createLocalAdapter, createLocalStorage, createRegistry, createVersionManager, defineConfig, fieldToZod, getDefaultDraftPublishConfig, getRegistry, globalToZod, isArchived, isArrayField, isBlocksField, isDraft, isGroupField, isImageField, isLayoutField, isNumberField, isPublished, isRelationshipField, isRichTextField, isSelectField, isTextField, isUploadField, normalizeRichTextDocument, normalizeRichTextValue, presetPlugins, renderRichText, resetRegistry, resolveProvider, richTextStyles, runFieldHooks, runHooks, validateCollection, validateConfig, validateFields, validateGlobal };
6971
6724
  //# sourceMappingURL=index.js.map
6972
6725
  //# sourceMappingURL=index.js.map