@thebes/cadmus 0.2.1 → 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.
Files changed (49) hide show
  1. package/dist/cms/index.cjs +689 -3
  2. package/dist/cms/index.cjs.map +1 -1
  3. package/dist/cms/index.d.cts +2 -2
  4. package/dist/cms/index.d.ts +2 -2
  5. package/dist/cms/index.js +671 -5
  6. package/dist/cms/index.js.map +1 -1
  7. package/dist/email/index.cjs +1 -1
  8. package/dist/email/index.js +1 -1
  9. package/dist/{errors-CW6Lz0AQ.cjs → errors-BhoibM6Z.cjs} +24 -1
  10. package/dist/{errors-CW6Lz0AQ.cjs.map → errors-BhoibM6Z.cjs.map} +1 -1
  11. package/dist/{errors-mZIqZJO4.js → errors-C8SqkFjl.js} +19 -2
  12. package/dist/{errors-mZIqZJO4.js.map → errors-C8SqkFjl.js.map} +1 -1
  13. package/dist/hono/index.cjs +6 -1
  14. package/dist/hono/index.cjs.map +1 -1
  15. package/dist/hono/index.d.cts +1 -1
  16. package/dist/hono/index.d.cts.map +1 -1
  17. package/dist/hono/index.d.ts +1 -1
  18. package/dist/hono/index.d.ts.map +1 -1
  19. package/dist/hono/index.js +6 -1
  20. package/dist/hono/index.js.map +1 -1
  21. package/dist/index-sB3YOadC.d.cts +1304 -0
  22. package/dist/index-sB3YOadC.d.cts.map +1 -0
  23. package/dist/index-sB3YOadC.d.ts +1304 -0
  24. package/dist/index-sB3YOadC.d.ts.map +1 -0
  25. package/dist/index.cjs +22 -1
  26. package/dist/index.d.cts +3 -89
  27. package/dist/index.d.cts.map +1 -1
  28. package/dist/index.d.ts +3 -89
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +3 -3
  31. package/dist/queues/index.cjs +1 -1
  32. package/dist/queues/index.js +1 -1
  33. package/dist/rate-limit/index.cjs +1 -1
  34. package/dist/rate-limit/index.js +1 -1
  35. package/dist/session/index.cjs +1 -1
  36. package/dist/session/index.js +1 -1
  37. package/dist/storage/index.cjs +1 -1
  38. package/dist/storage/index.cjs.map +1 -1
  39. package/dist/storage/index.d.cts +31 -2
  40. package/dist/storage/index.d.cts.map +1 -1
  41. package/dist/storage/index.d.ts +31 -2
  42. package/dist/storage/index.d.ts.map +1 -1
  43. package/dist/storage/index.js +1 -1
  44. package/dist/storage/index.js.map +1 -1
  45. package/package.json +1 -1
  46. package/dist/index-BUrCSGVb.d.cts +0 -616
  47. package/dist/index-BUrCSGVb.d.cts.map +0 -1
  48. package/dist/index-BUrCSGVb.d.ts +0 -616
  49. package/dist/index-BUrCSGVb.d.ts.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-sB3YOadC.d.ts","names":[],"sources":["../src/cms/blocks.ts","../src/errors.ts","../src/cms/patch.ts","../src/cms/localApi.ts","../src/cms/validation.ts","../src/cms/types.ts","../src/cms/codegen.ts","../src/cms/defineCollection.ts","../src/cms/meta.ts","../src/cms/migrate.ts","../src/cms/schema-gen.ts","../src/cms/structure.ts","../src/cms/visual-editing.ts","../src/cms/webhooks.ts"],"mappings":";;;;;;;;AAuBA;;;;AACM;AAGN;;;;;;;;;;UAJiB,iBAAA;EACf,IAAI;AAAA;AAAA,UAGW,aAAA;EAcQ;EAZvB,QAAA,CAAS,IAAA,UAAc,QAAA,EAAU,SAAA,GAAY,aAAA,CAAc,SAAA;EAY3B;EAVhC,YAAA,CAAa,SAAA,EAAW,MAAA,SAAe,SAAA,IAAa,aAAA,CAAc,SAAA;EAFlE;EAIA,GAAA,CAAI,IAAA,WAAe,SAAA;EAJc;EAMjC,GAAA,CAAI,IAAA;EANyC;EAQ7C,KAAA;EANA;EAQA,WAAA,CAAY,QAAA,EAAU,SAAA,GAAY,aAAA,CAAc,SAAA;EART;EAUvC,OAAA,CAAQ,IAAA,WAAe,SAAA;AAAA;;;;;;;;;;;;;iBAeT,mBAAA,YACd,OAAA,GAAS,MAAA,SAAe,SAAA,GACxB,OAAA;EAAW,QAAA,GAAW,SAAA;AAAA,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AA;AAAA;;cAIW,SAAA;;cAGA,mBAAA;AAAA,iBAEG,aAAA,CAAc,GAAY,EAAP,OAAO;;iBAK1B,aAAA,CAAc,KAAA,WAAgB,OAAO;;;;;;iBAcrC,QAAA,CAAS,GAAA,EAAK,OAAA,GAAU,MAAM;AAAA,UAI7B,oBAAA;EACf,IAAA,SAAa,mBAAA;EACb,GAAA,EAAK,OAAO;AAAA;AAAA,UAGG,oBAAA;EZ5Bf;EY8BA,QAAA,IAAY,GAAA,EAAK,OAAA,EAAS,OAAA,EAAS,OAAO;EZ5BpB;;;;EYiCtB,YAAA;EZ/BQ;EYiCR,cAAA;AAAA;AZjCgC;AAelC;;;;;AAfkC,iBY0ClB,kBAAA,CACd,OAAkC,GAAzB,oBAAyB;;;UCpEnB,aAAA;;EAEf,GAAA;EbKe;EaHf,MAAA,GAAS,KAAK;;;AbIV;AAGN;;EaDE,MAAA;AAAA;;UAIe,cAAA;EACf,GAAA;EACA,MAAA;EACA,KAAA;EACA,GAAA,EAAK,MAAM;EbDQ;EaGnB,SAAA;AAAA;;;;;;;;iBAUc,iBAAA,CACd,KAAA,EAAO,KAAA,CAAM,cAAA,GACb,MAAA,EAAQ,aAAA,GACP,WAAA,CAAY,eAAA;;;;;;;iBA0EO,qBAAA,CACpB,OAAA,EAAS,cAAA,GACR,OAAO"}
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_auth_index = require("./auth/index.cjs");
3
3
  const require_cache_index = require("./cache/index.cjs");
4
- const require_errors = require("./errors-CW6Lz0AQ.cjs");
4
+ const require_errors = require("./errors-BhoibM6Z.cjs");
5
5
  const require_queues_index = require("./queues/index.cjs");
6
6
  const require_cms_index = require("./cms/index.cjs");
7
7
  const require_db_index = require("./db/index.cjs");
@@ -21,8 +21,16 @@ exports.CadmusQueueError = require_errors.CadmusQueueError;
21
21
  exports.CadmusRateLimitError = require_errors.CadmusRateLimitError;
22
22
  exports.CadmusSessionError = require_errors.CadmusSessionError;
23
23
  exports.CadmusStorageError = require_errors.CadmusStorageError;
24
+ exports.CadmusValidationError = require_errors.CadmusValidationError;
25
+ exports.DEFAULT_STUDIO_GROUP = require_cms_index.DEFAULT_STUDIO_GROUP;
26
+ exports.EDIT_ATTR = require_cms_index.EDIT_ATTR;
24
27
  exports.IMAGE_MIME_WHITELIST = require_storage_index.IMAGE_MIME_WHITELIST;
25
28
  exports.MAX_IMAGE_UPLOAD_BYTES = require_storage_index.MAX_IMAGE_UPLOAD_BYTES;
29
+ exports.Rule = require_cms_index.Rule;
30
+ exports.VISUAL_EDIT_MESSAGE = require_cms_index.VISUAL_EDIT_MESSAGE;
31
+ exports.applyPatch = require_cms_index.applyPatch;
32
+ exports.assertValid = require_cms_index.assertValid;
33
+ exports.buildStudioStructure = require_cms_index.buildStudioStructure;
26
34
  exports.can = require_cms_index.can;
27
35
  exports.checkRateLimit = require_rate_limit_index.checkRateLimit;
28
36
  exports.cmsConfigToSchema = require_cms_index.cmsConfigToSchema;
@@ -30,15 +38,23 @@ exports.collectionSearchTableName = require_cms_index.collectionSearchTableName;
30
38
  exports.collectionSearchTableSQL = require_cms_index.collectionSearchTableSQL;
31
39
  exports.collectionToTable = require_cms_index.collectionToTable;
32
40
  exports.collectionVersionsTable = require_cms_index.collectionVersionsTable;
41
+ exports.computePatch = require_cms_index.computePatch;
42
+ exports.createBlockRegistry = require_cms_index.createBlockRegistry;
33
43
  exports.createLocalApi = require_cms_index.createLocalApi;
34
44
  exports.createSession = require_session_index.createSession;
35
45
  exports.createVersionedLocalApi = require_cms_index.createVersionedLocalApi;
36
46
  exports.createWebhookHook = require_cms_index.createWebhookHook;
37
47
  exports.db = require_db_index.db;
48
+ exports.decodeEditRef = require_cms_index.decodeEditRef;
38
49
  exports.defineCmsConfig = require_cms_index.defineCmsConfig;
39
50
  exports.defineCollection = require_cms_index.defineCollection;
51
+ exports.defineField = require_cms_index.defineField;
52
+ exports.defineMigration = require_cms_index.defineMigration;
40
53
  exports.deleteSession = require_session_index.deleteSession;
41
54
  exports.deliverWebhookMessage = require_cms_index.deliverWebhookMessage;
55
+ exports.diffDocuments = require_cms_index.diffDocuments;
56
+ exports.editAttr = require_cms_index.editAttr;
57
+ exports.encodeEditRef = require_cms_index.encodeEditRef;
42
58
  exports.enqueue = require_queues_index.enqueue;
43
59
  exports.extractSearchText = require_cms_index.extractSearchText;
44
60
  exports.flattenDoc = require_cms_index.flattenDoc;
@@ -50,11 +66,16 @@ exports.getCollectionsMeta = require_cms_index.getCollectionsMeta;
50
66
  exports.getRegisteredApi = require_cms_index.getRegisteredApi;
51
67
  exports.getSession = require_session_index.getSession;
52
68
  exports.hashToken = require_auth_index.hashToken;
69
+ exports.mountVisualEditing = require_cms_index.mountVisualEditing;
53
70
  exports.nestDoc = require_cms_index.nestDoc;
54
71
  exports.processBatch = require_queues_index.processBatch;
55
72
  exports.purgeCache = require_cache_index.purgeCache;
56
73
  exports.relationshipJoinTables = require_cms_index.relationshipJoinTables;
74
+ exports.renderBlocksToString = require_cms_index.renderBlocksToString;
75
+ exports.rule = require_cms_index.rule;
76
+ exports.runMigration = require_cms_index.runMigration;
57
77
  exports.sendEmail = require_email_index.sendEmail;
58
78
  exports.signSession = require_auth_index.signSession;
79
+ exports.validateDocument = require_cms_index.validateDocument;
59
80
  exports.validateImageFile = require_storage_index.validateImageFile;
60
81
  exports.verifySession = require_auth_index.verifySession;
package/dist/index.d.cts CHANGED
@@ -1,99 +1,13 @@
1
1
  import { generateSessionId, generateToken, hashToken, signSession, verifySession } from "./auth/index.cjs";
2
2
  import { purgeCache } from "./cache/index.cjs";
3
- import { A as CollectionAccess, B as RelationshipFieldConfig, C as relationshipJoinTables, D as CadmeaPlugin, E as BaseFieldConfig, F as GroupFieldConfig, G as flattenDoc, H as SelectFieldConfig, I as JsonFieldConfig, K as flattenFields, L as JsonValue, M as CollectionHooks, N as DateFieldConfig, O as CheckboxFieldConfig, P as FieldConfig, R as NumberFieldConfig, S as extractSearchText, T as ArrayFieldConfig, U as TextFieldConfig, V as RichTextFieldConfig, W as UploadFieldConfig, _ as cmsConfigToSchema, a as generateSchemaSource, b as collectionToTable, c as CmsRegistry, d as can, f as createLocalApi, g as defineCollection, h as defineCmsConfig, i as deliverWebhookMessage, j as CollectionConfig, k as CmsConfig, l as LocalApi, m as getRegisteredApi, n as WebhookMessage, o as CollectionMeta, p as createVersionedLocalApi, q as nestDoc, r as createWebhookHook, s as getCollectionsMeta, t as WebhookConfig, u as VersionedLocalApi, v as collectionSearchTableName, w as AccessFn, x as collectionVersionsTable, y as collectionSearchTableSQL, z as RelationshipDepth } from "./index-BUrCSGVb.cjs";
3
+ import { $ as RelationshipDepth, A as cmsConfigToSchema, At as PatchOp, B as CadmeaPlugin, Bt as CadmusEmailError, C as RunMigrationOptions, Ct as createLocalApi, D as getCollectionsMeta, Dt as FieldChange, E as CollectionMeta, Et as DiffOptions, F as extractSearchText, Ft as CadmusApiError, G as CollectionConfig, Gt as CadmusStorageError, H as CmsConfig, Ht as CadmusQueueError, I as relationshipJoinTables, It as CadmusAuthError, J as FieldConfig, Jt as BlockRegistry, K as CollectionHooks, Kt as CadmusValidationError, L as AccessFn, Lt as CadmusCacheError, M as collectionSearchTableSQL, Mt as computePatch, N as collectionToTable, Nt as diffDocuments, O as defineCmsConfig, Ot as FieldChangeKind, P as collectionVersionsTable, Pt as CadmusAccessDeniedError, Q as NumberFieldConfig, Qt as renderBlocksToString, R as ArrayFieldConfig, Rt as CadmusCmsError, S as MigrationResult, St as can, T as runMigration, Tt as getRegisteredApi, U as CollectionAccess, Ut as CadmusRateLimitError, V as CheckboxFieldConfig, Vt as CadmusError, W as CollectionAdminConfig, Wt as CadmusSessionError, X as JsonFieldConfig, Xt as StringBlockRenderer, Y as GroupFieldConfig, Yt as PortableBlockLike, Z as JsonValue, Zt as createBlockRegistry, _ as StudioStructureItem, _t as rule, a as EDIT_ATTR, at as flattenDoc, b as Migration, bt as LocalApi, c as VisualEditingMessage, ct as CustomValidator, d as editAttr, dt as ValidateDocumentOptions, et as RelationshipFieldConfig, f as encodeEditRef, ft as ValidationBuilder, g as StudioStructureGroup, gt as defineField, h as DEFAULT_STUDIO_GROUP, ht as assertValid, i as deliverWebhookMessage, it as UploadFieldConfig, j as collectionSearchTableName, jt as applyPatch, k as defineCollection, kt as Patch, l as VisualEditingOptions, lt as CustomValidatorResult, m as BuildStudioStructureOptions, mt as ValidationSeverity, n as WebhookMessage, nt as SelectFieldConfig, o as EditRef, ot as flattenFields, p as mountVisualEditing, pt as ValidationFieldContext, q as DateFieldConfig, qt as ValidationViolation, r as createWebhookHook, rt as TextFieldConfig, s as VISUAL_EDIT_MESSAGE, st as nestDoc, t as WebhookConfig, tt as RichTextFieldConfig, u as decodeEditRef, ut as Rule, v as buildStudioStructure, vt as validateDocument, w as defineMigration, wt as createVersionedLocalApi, x as MigrationChange, xt as VersionedLocalApi, y as generateSchemaSource, yt as CmsRegistry, z as BaseFieldConfig, zt as CadmusDbError } from "./index-sB3YOadC.cjs";
4
4
  import { db } from "./db/index.cjs";
5
5
  import { SendEmailInput, sendEmail } from "./email/index.cjs";
6
6
  import { QueueMessageHandler, enqueue, processBatch } from "./queues/index.cjs";
7
7
  import { RateLimitResult, checkRateLimit } from "./rate-limit/index.cjs";
8
8
  import { createSession, deleteSession, getSession } from "./session/index.cjs";
9
- import { IMAGE_MIME_WHITELIST, ImageService, MAX_IMAGE_UPLOAD_BYTES, RenderedImage, validateImageFile } from "./storage/index.cjs";
9
+ import { IMAGE_MIME_WHITELIST, ImageCrop, ImageHotspot, ImageService, MAX_IMAGE_UPLOAD_BYTES, RenderedImage, validateImageFile } from "./storage/index.cjs";
10
10
 
11
- //#region src/errors.d.ts
12
- declare global {
13
- interface ErrorConstructor {
14
- captureStackTrace?(targetObject: object, constructorOpt?: Function): void;
15
- }
16
- }
17
- /**
18
- * Base class for all Cadmus errors.
19
- * All primitives throw CadmusError or a typed subclass — never a raw Error.
20
- *
21
- * @example
22
- * try {
23
- * await createMagicLink({ kv, email, to })
24
- * } catch (e) {
25
- * if (e instanceof CadmusAuthError) {
26
- * // auth-specific handling
27
- * } else if (e instanceof CadmusError) {
28
- * // any cadmus error — e.code tells you which primitive threw
29
- * } else {
30
- * throw e // re-throw unknown errors
31
- * }
32
- * }
33
- */
34
- declare class CadmusError extends Error {
35
- readonly code: string;
36
- readonly cause?: unknown | undefined;
37
- constructor(message: string, code: string, cause?: unknown | undefined);
38
- }
39
- /** Thrown by @thebes/cadmus/auth primitives */
40
- declare class CadmusAuthError extends CadmusError {
41
- constructor(message: string, cause?: unknown);
42
- }
43
- /** Thrown by @thebes/cadmus/db primitives */
44
- declare class CadmusDbError extends CadmusError {
45
- constructor(message: string, cause?: unknown);
46
- }
47
- /** Thrown by @thebes/cadmus/storage primitives */
48
- declare class CadmusStorageError extends CadmusError {
49
- constructor(message: string, cause?: unknown);
50
- }
51
- /** Thrown by @thebes/cadmus/cache primitives */
52
- declare class CadmusCacheError extends CadmusError {
53
- constructor(message: string, cause?: unknown);
54
- }
55
- /** Thrown by @thebes/cadmus/email primitives */
56
- declare class CadmusEmailError extends CadmusError {
57
- constructor(message: string, cause?: unknown);
58
- }
59
- /** Thrown by @thebes/cadmus/session primitives */
60
- declare class CadmusSessionError extends CadmusError {
61
- constructor(message: string, cause?: unknown);
62
- }
63
- /** Thrown by @thebes/cadmus/rate-limit primitives */
64
- declare class CadmusRateLimitError extends CadmusError {
65
- constructor(message: string, cause?: unknown);
66
- }
67
- /** Thrown by @thebes/cadmus/queues primitives */
68
- declare class CadmusQueueError extends CadmusError {
69
- constructor(message: string, cause?: unknown);
70
- }
71
- /** Thrown by @thebes/cadmus/cms primitives */
72
- declare class CadmusCmsError extends CadmusError {
73
- constructor(message: string, cause?: unknown);
74
- }
75
- /**
76
- * Thrown by @thebes/cadmus/cms's createLocalApi when a collection's
77
- * `access` function rejects an operation. A distinct subclass (rather than
78
- * a plain CadmusCmsError) so consumers like mountCmsRoutes can map it to
79
- * 403 by `instanceof`, not by matching on message text.
80
- */
81
- declare class CadmusAccessDeniedError extends CadmusCmsError {
82
- constructor(message: string, cause?: unknown);
83
- }
84
- /**
85
- * Thrown by @thebes/cadmus/hono's `createCmsApiClient` when a request
86
- * against a `mountCmsRoutes` surface returns a non-2xx response. Carries
87
- * the HTTP status and parsed body so callers can branch on `status`
88
- * (e.g. 403 → access denied, 404 → not found) instead of re-parsing
89
- * `{ error: string }` response bodies by hand.
90
- */
91
- declare class CadmusApiError extends CadmusError {
92
- readonly status: number;
93
- readonly body: unknown;
94
- constructor(message: string, status: number, body: unknown);
95
- }
96
- //#endregion
97
11
  //#region src/index.d.ts
98
12
  interface CadmusEnv {
99
13
  DB: D1Database;
@@ -103,5 +17,5 @@ interface CadmusEnv {
103
17
  SESSION_SECRET: string;
104
18
  }
105
19
  //#endregion
106
- export { AccessFn, ArrayFieldConfig, BaseFieldConfig, CadmeaPlugin, CadmusAccessDeniedError, CadmusApiError, CadmusAuthError, CadmusCacheError, CadmusCmsError, CadmusDbError, CadmusEmailError, CadmusEnv, CadmusError, CadmusQueueError, CadmusRateLimitError, CadmusSessionError, CadmusStorageError, CheckboxFieldConfig, CmsConfig, CmsRegistry, CollectionAccess, CollectionConfig, CollectionHooks, CollectionMeta, DateFieldConfig, FieldConfig, GroupFieldConfig, IMAGE_MIME_WHITELIST, ImageService, JsonFieldConfig, JsonValue, LocalApi, MAX_IMAGE_UPLOAD_BYTES, NumberFieldConfig, QueueMessageHandler, RateLimitResult, RelationshipDepth, RelationshipFieldConfig, RenderedImage, RichTextFieldConfig, SelectFieldConfig, SendEmailInput, TextFieldConfig, UploadFieldConfig, VersionedLocalApi, WebhookConfig, WebhookMessage, can, checkRateLimit, cmsConfigToSchema, collectionSearchTableName, collectionSearchTableSQL, collectionToTable, collectionVersionsTable, createLocalApi, createSession, createVersionedLocalApi, createWebhookHook, db, defineCmsConfig, defineCollection, deleteSession, deliverWebhookMessage, enqueue, extractSearchText, flattenDoc, flattenFields, generateSchemaSource, generateSessionId, generateToken, getCollectionsMeta, getRegisteredApi, getSession, hashToken, nestDoc, processBatch, purgeCache, relationshipJoinTables, sendEmail, signSession, validateImageFile, verifySession };
20
+ export { AccessFn, ArrayFieldConfig, BaseFieldConfig, BlockRegistry, BuildStudioStructureOptions, CadmeaPlugin, CadmusAccessDeniedError, CadmusApiError, CadmusAuthError, CadmusCacheError, CadmusCmsError, CadmusDbError, CadmusEmailError, CadmusEnv, CadmusError, CadmusQueueError, CadmusRateLimitError, CadmusSessionError, CadmusStorageError, CadmusValidationError, CheckboxFieldConfig, CmsConfig, CmsRegistry, CollectionAccess, CollectionAdminConfig, CollectionConfig, CollectionHooks, CollectionMeta, CustomValidator, CustomValidatorResult, DEFAULT_STUDIO_GROUP, DateFieldConfig, DiffOptions, EDIT_ATTR, EditRef, FieldChange, FieldChangeKind, FieldConfig, GroupFieldConfig, IMAGE_MIME_WHITELIST, ImageCrop, ImageHotspot, ImageService, JsonFieldConfig, JsonValue, LocalApi, MAX_IMAGE_UPLOAD_BYTES, Migration, MigrationChange, MigrationResult, NumberFieldConfig, Patch, PatchOp, PortableBlockLike, QueueMessageHandler, RateLimitResult, RelationshipDepth, RelationshipFieldConfig, RenderedImage, RichTextFieldConfig, Rule, RunMigrationOptions, SelectFieldConfig, SendEmailInput, StringBlockRenderer, StudioStructureGroup, StudioStructureItem, TextFieldConfig, UploadFieldConfig, VISUAL_EDIT_MESSAGE, ValidateDocumentOptions, ValidationBuilder, ValidationFieldContext, ValidationSeverity, ValidationViolation, VersionedLocalApi, VisualEditingMessage, VisualEditingOptions, WebhookConfig, WebhookMessage, applyPatch, assertValid, buildStudioStructure, can, checkRateLimit, cmsConfigToSchema, collectionSearchTableName, collectionSearchTableSQL, collectionToTable, collectionVersionsTable, computePatch, createBlockRegistry, createLocalApi, createSession, createVersionedLocalApi, createWebhookHook, db, decodeEditRef, defineCmsConfig, defineCollection, defineField, defineMigration, deleteSession, deliverWebhookMessage, diffDocuments, editAttr, encodeEditRef, enqueue, extractSearchText, flattenDoc, flattenFields, generateSchemaSource, generateSessionId, generateToken, getCollectionsMeta, getRegisteredApi, getSession, hashToken, mountVisualEditing, nestDoc, processBatch, purgeCache, relationshipJoinTables, renderBlocksToString, rule, runMigration, sendEmail, signSession, validateDocument, validateImageFile, verifySession };
107
21
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/errors.ts","../src/index.ts"],"mappings":";;;;;;;;;;;QAOQ,MAAA;EAAA,UACI,gBAAA;IAER,iBAAA,EAAmB,YAAA,UAAsB,cAAA,GAAiB,QAAQ;EAAA;AAAA;;;;;;;;;;;;;;;;;;cAqBzD,WAAA,SAAoB,KAAK;EAAA,SAGlB,IAAA;EAAA,SACA,KAAA;cAFhB,OAAA,UACgB,IAAA,UACA,KAAA;AAAA;;cAYP,eAAA,SAAwB,WAAW;cAClC,OAAA,UAAiB,KAAA;AAAA;;cAOlB,aAAA,SAAsB,WAAW;cAChC,OAAA,UAAiB,KAAA;AAAA;;cAOlB,kBAAA,SAA2B,WAAW;cACrC,OAAA,UAAiB,KAAA;AAAA;;cAOlB,gBAAA,SAAyB,WAAW;cACnC,OAAA,UAAiB,KAAA;AAAA;;cAOlB,gBAAA,SAAyB,WAAW;cACnC,OAAA,UAAiB,KAAA;AAAA;AAzB/B;AAAA,cAgCa,kBAAA,SAA2B,WAAW;cACrC,OAAA,UAAiB,KAAA;AAAA;;cAOlB,oBAAA,SAA6B,WAAW;cACvC,OAAA,UAAiB,KAAA;AAAA;;cAOlB,gBAAA,SAAyB,WAAW;cACnC,OAAA,UAAiB,KAAA;AAAA;;cAOlB,cAAA,SAAuB,WAAW;cACjC,OAAA,UAAiB,KAAA;AAAA;;;;AAhDe;AAO9C;;cAqDa,uBAAA,SAAgC,cAAc;cAC7C,OAAA,UAAiB,KAAA;AAAA;;;;;AArDe;AAO9C;;cA2Da,cAAA,SAAuB,WAAW;EAAA,SAG3B,MAAA;EAAA,SACA,IAAA;cAFhB,OAAA,UACgB,MAAA,UACA,IAAA;AAAA;;;UC3HH,SAAA;EACf,EAAA,EAAI,UAAA;EACJ,EAAA,EAAI,WAAA;EACJ,EAAA,EAAI,QAAA;EACJ,KAAA,EAAO,SAAA;EACP,cAAA;AAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;UAmBiB,SAAA;EACf,EAAA,EAAI,UAAA;EACJ,EAAA,EAAI,WAAA;EACJ,EAAA,EAAI,QAAA;EACJ,KAAA,EAAO,SAAA;EACP,cAAA;AAAA"}
package/dist/index.d.ts CHANGED
@@ -1,99 +1,13 @@
1
1
  import { generateSessionId, generateToken, hashToken, signSession, verifySession } from "./auth/index.js";
2
2
  import { purgeCache } from "./cache/index.js";
3
- import { A as CollectionAccess, B as RelationshipFieldConfig, C as relationshipJoinTables, D as CadmeaPlugin, E as BaseFieldConfig, F as GroupFieldConfig, G as flattenDoc, H as SelectFieldConfig, I as JsonFieldConfig, K as flattenFields, L as JsonValue, M as CollectionHooks, N as DateFieldConfig, O as CheckboxFieldConfig, P as FieldConfig, R as NumberFieldConfig, S as extractSearchText, T as ArrayFieldConfig, U as TextFieldConfig, V as RichTextFieldConfig, W as UploadFieldConfig, _ as cmsConfigToSchema, a as generateSchemaSource, b as collectionToTable, c as CmsRegistry, d as can, f as createLocalApi, g as defineCollection, h as defineCmsConfig, i as deliverWebhookMessage, j as CollectionConfig, k as CmsConfig, l as LocalApi, m as getRegisteredApi, n as WebhookMessage, o as CollectionMeta, p as createVersionedLocalApi, q as nestDoc, r as createWebhookHook, s as getCollectionsMeta, t as WebhookConfig, u as VersionedLocalApi, v as collectionSearchTableName, w as AccessFn, x as collectionVersionsTable, y as collectionSearchTableSQL, z as RelationshipDepth } from "./index-BUrCSGVb.js";
3
+ import { $ as RelationshipDepth, A as cmsConfigToSchema, At as PatchOp, B as CadmeaPlugin, Bt as CadmusEmailError, C as RunMigrationOptions, Ct as createLocalApi, D as getCollectionsMeta, Dt as FieldChange, E as CollectionMeta, Et as DiffOptions, F as extractSearchText, Ft as CadmusApiError, G as CollectionConfig, Gt as CadmusStorageError, H as CmsConfig, Ht as CadmusQueueError, I as relationshipJoinTables, It as CadmusAuthError, J as FieldConfig, Jt as BlockRegistry, K as CollectionHooks, Kt as CadmusValidationError, L as AccessFn, Lt as CadmusCacheError, M as collectionSearchTableSQL, Mt as computePatch, N as collectionToTable, Nt as diffDocuments, O as defineCmsConfig, Ot as FieldChangeKind, P as collectionVersionsTable, Pt as CadmusAccessDeniedError, Q as NumberFieldConfig, Qt as renderBlocksToString, R as ArrayFieldConfig, Rt as CadmusCmsError, S as MigrationResult, St as can, T as runMigration, Tt as getRegisteredApi, U as CollectionAccess, Ut as CadmusRateLimitError, V as CheckboxFieldConfig, Vt as CadmusError, W as CollectionAdminConfig, Wt as CadmusSessionError, X as JsonFieldConfig, Xt as StringBlockRenderer, Y as GroupFieldConfig, Yt as PortableBlockLike, Z as JsonValue, Zt as createBlockRegistry, _ as StudioStructureItem, _t as rule, a as EDIT_ATTR, at as flattenDoc, b as Migration, bt as LocalApi, c as VisualEditingMessage, ct as CustomValidator, d as editAttr, dt as ValidateDocumentOptions, et as RelationshipFieldConfig, f as encodeEditRef, ft as ValidationBuilder, g as StudioStructureGroup, gt as defineField, h as DEFAULT_STUDIO_GROUP, ht as assertValid, i as deliverWebhookMessage, it as UploadFieldConfig, j as collectionSearchTableName, jt as applyPatch, k as defineCollection, kt as Patch, l as VisualEditingOptions, lt as CustomValidatorResult, m as BuildStudioStructureOptions, mt as ValidationSeverity, n as WebhookMessage, nt as SelectFieldConfig, o as EditRef, ot as flattenFields, p as mountVisualEditing, pt as ValidationFieldContext, q as DateFieldConfig, qt as ValidationViolation, r as createWebhookHook, rt as TextFieldConfig, s as VISUAL_EDIT_MESSAGE, st as nestDoc, t as WebhookConfig, tt as RichTextFieldConfig, u as decodeEditRef, ut as Rule, v as buildStudioStructure, vt as validateDocument, w as defineMigration, wt as createVersionedLocalApi, x as MigrationChange, xt as VersionedLocalApi, y as generateSchemaSource, yt as CmsRegistry, z as BaseFieldConfig, zt as CadmusDbError } from "./index-sB3YOadC.js";
4
4
  import { db } from "./db/index.js";
5
5
  import { SendEmailInput, sendEmail } from "./email/index.js";
6
6
  import { QueueMessageHandler, enqueue, processBatch } from "./queues/index.js";
7
7
  import { RateLimitResult, checkRateLimit } from "./rate-limit/index.js";
8
8
  import { createSession, deleteSession, getSession } from "./session/index.js";
9
- import { IMAGE_MIME_WHITELIST, ImageService, MAX_IMAGE_UPLOAD_BYTES, RenderedImage, validateImageFile } from "./storage/index.js";
9
+ import { IMAGE_MIME_WHITELIST, ImageCrop, ImageHotspot, ImageService, MAX_IMAGE_UPLOAD_BYTES, RenderedImage, validateImageFile } from "./storage/index.js";
10
10
 
11
- //#region src/errors.d.ts
12
- declare global {
13
- interface ErrorConstructor {
14
- captureStackTrace?(targetObject: object, constructorOpt?: Function): void;
15
- }
16
- }
17
- /**
18
- * Base class for all Cadmus errors.
19
- * All primitives throw CadmusError or a typed subclass — never a raw Error.
20
- *
21
- * @example
22
- * try {
23
- * await createMagicLink({ kv, email, to })
24
- * } catch (e) {
25
- * if (e instanceof CadmusAuthError) {
26
- * // auth-specific handling
27
- * } else if (e instanceof CadmusError) {
28
- * // any cadmus error — e.code tells you which primitive threw
29
- * } else {
30
- * throw e // re-throw unknown errors
31
- * }
32
- * }
33
- */
34
- declare class CadmusError extends Error {
35
- readonly code: string;
36
- readonly cause?: unknown | undefined;
37
- constructor(message: string, code: string, cause?: unknown | undefined);
38
- }
39
- /** Thrown by @thebes/cadmus/auth primitives */
40
- declare class CadmusAuthError extends CadmusError {
41
- constructor(message: string, cause?: unknown);
42
- }
43
- /** Thrown by @thebes/cadmus/db primitives */
44
- declare class CadmusDbError extends CadmusError {
45
- constructor(message: string, cause?: unknown);
46
- }
47
- /** Thrown by @thebes/cadmus/storage primitives */
48
- declare class CadmusStorageError extends CadmusError {
49
- constructor(message: string, cause?: unknown);
50
- }
51
- /** Thrown by @thebes/cadmus/cache primitives */
52
- declare class CadmusCacheError extends CadmusError {
53
- constructor(message: string, cause?: unknown);
54
- }
55
- /** Thrown by @thebes/cadmus/email primitives */
56
- declare class CadmusEmailError extends CadmusError {
57
- constructor(message: string, cause?: unknown);
58
- }
59
- /** Thrown by @thebes/cadmus/session primitives */
60
- declare class CadmusSessionError extends CadmusError {
61
- constructor(message: string, cause?: unknown);
62
- }
63
- /** Thrown by @thebes/cadmus/rate-limit primitives */
64
- declare class CadmusRateLimitError extends CadmusError {
65
- constructor(message: string, cause?: unknown);
66
- }
67
- /** Thrown by @thebes/cadmus/queues primitives */
68
- declare class CadmusQueueError extends CadmusError {
69
- constructor(message: string, cause?: unknown);
70
- }
71
- /** Thrown by @thebes/cadmus/cms primitives */
72
- declare class CadmusCmsError extends CadmusError {
73
- constructor(message: string, cause?: unknown);
74
- }
75
- /**
76
- * Thrown by @thebes/cadmus/cms's createLocalApi when a collection's
77
- * `access` function rejects an operation. A distinct subclass (rather than
78
- * a plain CadmusCmsError) so consumers like mountCmsRoutes can map it to
79
- * 403 by `instanceof`, not by matching on message text.
80
- */
81
- declare class CadmusAccessDeniedError extends CadmusCmsError {
82
- constructor(message: string, cause?: unknown);
83
- }
84
- /**
85
- * Thrown by @thebes/cadmus/hono's `createCmsApiClient` when a request
86
- * against a `mountCmsRoutes` surface returns a non-2xx response. Carries
87
- * the HTTP status and parsed body so callers can branch on `status`
88
- * (e.g. 403 → access denied, 404 → not found) instead of re-parsing
89
- * `{ error: string }` response bodies by hand.
90
- */
91
- declare class CadmusApiError extends CadmusError {
92
- readonly status: number;
93
- readonly body: unknown;
94
- constructor(message: string, status: number, body: unknown);
95
- }
96
- //#endregion
97
11
  //#region src/index.d.ts
98
12
  interface CadmusEnv {
99
13
  DB: D1Database;
@@ -103,5 +17,5 @@ interface CadmusEnv {
103
17
  SESSION_SECRET: string;
104
18
  }
105
19
  //#endregion
106
- export { AccessFn, ArrayFieldConfig, BaseFieldConfig, CadmeaPlugin, CadmusAccessDeniedError, CadmusApiError, CadmusAuthError, CadmusCacheError, CadmusCmsError, CadmusDbError, CadmusEmailError, CadmusEnv, CadmusError, CadmusQueueError, CadmusRateLimitError, CadmusSessionError, CadmusStorageError, CheckboxFieldConfig, CmsConfig, CmsRegistry, CollectionAccess, CollectionConfig, CollectionHooks, CollectionMeta, DateFieldConfig, FieldConfig, GroupFieldConfig, IMAGE_MIME_WHITELIST, ImageService, JsonFieldConfig, JsonValue, LocalApi, MAX_IMAGE_UPLOAD_BYTES, NumberFieldConfig, QueueMessageHandler, RateLimitResult, RelationshipDepth, RelationshipFieldConfig, RenderedImage, RichTextFieldConfig, SelectFieldConfig, SendEmailInput, TextFieldConfig, UploadFieldConfig, VersionedLocalApi, WebhookConfig, WebhookMessage, can, checkRateLimit, cmsConfigToSchema, collectionSearchTableName, collectionSearchTableSQL, collectionToTable, collectionVersionsTable, createLocalApi, createSession, createVersionedLocalApi, createWebhookHook, db, defineCmsConfig, defineCollection, deleteSession, deliverWebhookMessage, enqueue, extractSearchText, flattenDoc, flattenFields, generateSchemaSource, generateSessionId, generateToken, getCollectionsMeta, getRegisteredApi, getSession, hashToken, nestDoc, processBatch, purgeCache, relationshipJoinTables, sendEmail, signSession, validateImageFile, verifySession };
20
+ export { AccessFn, ArrayFieldConfig, BaseFieldConfig, BlockRegistry, BuildStudioStructureOptions, CadmeaPlugin, CadmusAccessDeniedError, CadmusApiError, CadmusAuthError, CadmusCacheError, CadmusCmsError, CadmusDbError, CadmusEmailError, CadmusEnv, CadmusError, CadmusQueueError, CadmusRateLimitError, CadmusSessionError, CadmusStorageError, CadmusValidationError, CheckboxFieldConfig, CmsConfig, CmsRegistry, CollectionAccess, CollectionAdminConfig, CollectionConfig, CollectionHooks, CollectionMeta, CustomValidator, CustomValidatorResult, DEFAULT_STUDIO_GROUP, DateFieldConfig, DiffOptions, EDIT_ATTR, EditRef, FieldChange, FieldChangeKind, FieldConfig, GroupFieldConfig, IMAGE_MIME_WHITELIST, ImageCrop, ImageHotspot, ImageService, JsonFieldConfig, JsonValue, LocalApi, MAX_IMAGE_UPLOAD_BYTES, Migration, MigrationChange, MigrationResult, NumberFieldConfig, Patch, PatchOp, PortableBlockLike, QueueMessageHandler, RateLimitResult, RelationshipDepth, RelationshipFieldConfig, RenderedImage, RichTextFieldConfig, Rule, RunMigrationOptions, SelectFieldConfig, SendEmailInput, StringBlockRenderer, StudioStructureGroup, StudioStructureItem, TextFieldConfig, UploadFieldConfig, VISUAL_EDIT_MESSAGE, ValidateDocumentOptions, ValidationBuilder, ValidationFieldContext, ValidationSeverity, ValidationViolation, VersionedLocalApi, VisualEditingMessage, VisualEditingOptions, WebhookConfig, WebhookMessage, applyPatch, assertValid, buildStudioStructure, can, checkRateLimit, cmsConfigToSchema, collectionSearchTableName, collectionSearchTableSQL, collectionToTable, collectionVersionsTable, computePatch, createBlockRegistry, createLocalApi, createSession, createVersionedLocalApi, createWebhookHook, db, decodeEditRef, defineCmsConfig, defineCollection, defineField, defineMigration, deleteSession, deliverWebhookMessage, diffDocuments, editAttr, encodeEditRef, enqueue, extractSearchText, flattenDoc, flattenFields, generateSchemaSource, generateSessionId, generateToken, getCollectionsMeta, getRegisteredApi, getSession, hashToken, mountVisualEditing, nestDoc, processBatch, purgeCache, relationshipJoinTables, renderBlocksToString, rule, runMigration, sendEmail, signSession, validateDocument, validateImageFile, verifySession };
107
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/errors.ts","../src/index.ts"],"mappings":";;;;;;;;;;;QAOQ,MAAA;EAAA,UACI,gBAAA;IAER,iBAAA,EAAmB,YAAA,UAAsB,cAAA,GAAiB,QAAQ;EAAA;AAAA;;;;;;;;;;;;;;;;;;cAqBzD,WAAA,SAAoB,KAAK;EAAA,SAGlB,IAAA;EAAA,SACA,KAAA;cAFhB,OAAA,UACgB,IAAA,UACA,KAAA;AAAA;;cAYP,eAAA,SAAwB,WAAW;cAClC,OAAA,UAAiB,KAAA;AAAA;;cAOlB,aAAA,SAAsB,WAAW;cAChC,OAAA,UAAiB,KAAA;AAAA;;cAOlB,kBAAA,SAA2B,WAAW;cACrC,OAAA,UAAiB,KAAA;AAAA;;cAOlB,gBAAA,SAAyB,WAAW;cACnC,OAAA,UAAiB,KAAA;AAAA;;cAOlB,gBAAA,SAAyB,WAAW;cACnC,OAAA,UAAiB,KAAA;AAAA;AAzB/B;AAAA,cAgCa,kBAAA,SAA2B,WAAW;cACrC,OAAA,UAAiB,KAAA;AAAA;;cAOlB,oBAAA,SAA6B,WAAW;cACvC,OAAA,UAAiB,KAAA;AAAA;;cAOlB,gBAAA,SAAyB,WAAW;cACnC,OAAA,UAAiB,KAAA;AAAA;;cAOlB,cAAA,SAAuB,WAAW;cACjC,OAAA,UAAiB,KAAA;AAAA;;;;AAhDe;AAO9C;;cAqDa,uBAAA,SAAgC,cAAc;cAC7C,OAAA,UAAiB,KAAA;AAAA;;;;;AArDe;AAO9C;;cA2Da,cAAA,SAAuB,WAAW;EAAA,SAG3B,MAAA;EAAA,SACA,IAAA;cAFhB,OAAA,UACgB,MAAA,UACA,IAAA;AAAA;;;UC3HH,SAAA;EACf,EAAA,EAAI,UAAA;EACJ,EAAA,EAAI,WAAA;EACJ,EAAA,EAAI,QAAA;EACJ,KAAA,EAAO,SAAA;EACP,cAAA;AAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;UAmBiB,SAAA;EACf,EAAA,EAAI,UAAA;EACJ,EAAA,EAAI,WAAA;EACJ,EAAA,EAAI,QAAA;EACJ,KAAA,EAAO,SAAA;EACP,cAAA;AAAA"}
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { generateSessionId, generateToken, hashToken, signSession, verifySession } from "./auth/index.js";
2
2
  import { purgeCache } from "./cache/index.js";
3
- import { a as CadmusCmsError, c as CadmusError, d as CadmusSessionError, f as CadmusStorageError, i as CadmusCacheError, l as CadmusQueueError, n as CadmusApiError, o as CadmusDbError, r as CadmusAuthError, s as CadmusEmailError, t as CadmusAccessDeniedError, u as CadmusRateLimitError } from "./errors-mZIqZJO4.js";
3
+ import { a as CadmusCmsError, c as CadmusError, d as CadmusSessionError, f as CadmusStorageError, i as CadmusCacheError, l as CadmusQueueError, n as CadmusApiError, o as CadmusDbError, p as CadmusValidationError, r as CadmusAuthError, s as CadmusEmailError, t as CadmusAccessDeniedError, u as CadmusRateLimitError } from "./errors-C8SqkFjl.js";
4
4
  import { enqueue, processBatch } from "./queues/index.js";
5
- import { can, cmsConfigToSchema, collectionSearchTableName, collectionSearchTableSQL, collectionToTable, collectionVersionsTable, createLocalApi, createVersionedLocalApi, createWebhookHook, defineCmsConfig, defineCollection, deliverWebhookMessage, extractSearchText, flattenDoc, flattenFields, generateSchemaSource, getCollectionsMeta, getRegisteredApi, nestDoc, relationshipJoinTables } from "./cms/index.js";
5
+ import { DEFAULT_STUDIO_GROUP, EDIT_ATTR, Rule, VISUAL_EDIT_MESSAGE, applyPatch, assertValid, buildStudioStructure, can, cmsConfigToSchema, collectionSearchTableName, collectionSearchTableSQL, collectionToTable, collectionVersionsTable, computePatch, createBlockRegistry, createLocalApi, createVersionedLocalApi, createWebhookHook, decodeEditRef, defineCmsConfig, defineCollection, defineField, defineMigration, deliverWebhookMessage, diffDocuments, editAttr, encodeEditRef, extractSearchText, flattenDoc, flattenFields, generateSchemaSource, getCollectionsMeta, getRegisteredApi, mountVisualEditing, nestDoc, relationshipJoinTables, renderBlocksToString, rule, runMigration, validateDocument } from "./cms/index.js";
6
6
  import { db } from "./db/index.js";
7
7
  import { sendEmail } from "./email/index.js";
8
8
  import { checkRateLimit } from "./rate-limit/index.js";
9
9
  import { createSession, deleteSession, getSession } from "./session/index.js";
10
10
  import { IMAGE_MIME_WHITELIST, MAX_IMAGE_UPLOAD_BYTES, validateImageFile } from "./storage/index.js";
11
- export { CadmusAccessDeniedError, CadmusApiError, CadmusAuthError, CadmusCacheError, CadmusCmsError, CadmusDbError, CadmusEmailError, CadmusError, CadmusQueueError, CadmusRateLimitError, CadmusSessionError, CadmusStorageError, IMAGE_MIME_WHITELIST, MAX_IMAGE_UPLOAD_BYTES, can, checkRateLimit, cmsConfigToSchema, collectionSearchTableName, collectionSearchTableSQL, collectionToTable, collectionVersionsTable, createLocalApi, createSession, createVersionedLocalApi, createWebhookHook, db, defineCmsConfig, defineCollection, deleteSession, deliverWebhookMessage, enqueue, extractSearchText, flattenDoc, flattenFields, generateSchemaSource, generateSessionId, generateToken, getCollectionsMeta, getRegisteredApi, getSession, hashToken, nestDoc, processBatch, purgeCache, relationshipJoinTables, sendEmail, signSession, validateImageFile, verifySession };
11
+ export { CadmusAccessDeniedError, CadmusApiError, CadmusAuthError, CadmusCacheError, CadmusCmsError, CadmusDbError, CadmusEmailError, CadmusError, CadmusQueueError, CadmusRateLimitError, CadmusSessionError, CadmusStorageError, CadmusValidationError, DEFAULT_STUDIO_GROUP, EDIT_ATTR, IMAGE_MIME_WHITELIST, MAX_IMAGE_UPLOAD_BYTES, Rule, VISUAL_EDIT_MESSAGE, applyPatch, assertValid, buildStudioStructure, can, checkRateLimit, cmsConfigToSchema, collectionSearchTableName, collectionSearchTableSQL, collectionToTable, collectionVersionsTable, computePatch, createBlockRegistry, createLocalApi, createSession, createVersionedLocalApi, createWebhookHook, db, decodeEditRef, defineCmsConfig, defineCollection, defineField, defineMigration, deleteSession, deliverWebhookMessage, diffDocuments, editAttr, encodeEditRef, enqueue, extractSearchText, flattenDoc, flattenFields, generateSchemaSource, generateSessionId, generateToken, getCollectionsMeta, getRegisteredApi, getSession, hashToken, mountVisualEditing, nestDoc, processBatch, purgeCache, relationshipJoinTables, renderBlocksToString, rule, runMigration, sendEmail, signSession, validateDocument, validateImageFile, verifySession };
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_errors = require("../errors-CW6Lz0AQ.cjs");
2
+ const require_errors = require("../errors-BhoibM6Z.cjs");
3
3
  //#region src/queues/index.ts
4
4
  /** Enqueues `message` onto `queue`. Throws CadmusQueueError on failure. */
5
5
  async function enqueue(queue, message) {
@@ -1,4 +1,4 @@
1
- import { l as CadmusQueueError } from "../errors-mZIqZJO4.js";
1
+ import { l as CadmusQueueError } from "../errors-C8SqkFjl.js";
2
2
  //#region src/queues/index.ts
3
3
  /** Enqueues `message` onto `queue`. Throws CadmusQueueError on failure. */
4
4
  async function enqueue(queue, message) {
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_errors = require("../errors-CW6Lz0AQ.cjs");
2
+ const require_errors = require("../errors-BhoibM6Z.cjs");
3
3
  //#region src/rate-limit/index.ts
4
4
  /**
5
5
  * Increments the counter for `key` within a fixed `windowSeconds` window,
@@ -1,4 +1,4 @@
1
- import { u as CadmusRateLimitError } from "../errors-mZIqZJO4.js";
1
+ import { u as CadmusRateLimitError } from "../errors-C8SqkFjl.js";
2
2
  //#region src/rate-limit/index.ts
3
3
  /**
4
4
  * Increments the counter for `key` within a fixed `windowSeconds` window,
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_errors = require("../errors-CW6Lz0AQ.cjs");
2
+ const require_errors = require("../errors-BhoibM6Z.cjs");
3
3
  //#region src/session/index.ts
4
4
  const RETRY_ATTEMPTS = 2;
5
5
  const RETRY_DELAY_MS = 100;
@@ -1,4 +1,4 @@
1
- import { d as CadmusSessionError } from "../errors-mZIqZJO4.js";
1
+ import { d as CadmusSessionError } from "../errors-C8SqkFjl.js";
2
2
  //#region src/session/index.ts
3
3
  const RETRY_ATTEMPTS = 2;
4
4
  const RETRY_DELAY_MS = 100;
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_errors = require("../errors-CW6Lz0AQ.cjs");
2
+ const require_errors = require("../errors-BhoibM6Z.cjs");
3
3
  //#region src/storage/index.ts
4
4
  /** MIME types `validateImageFile` accepts — never trust a client-sent
5
5
  * MIME type beyond this whitelist check; it's still just `file.type`,
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["CadmusStorageError"],"sources":["../../src/storage/index.ts"],"sourcesContent":["// Copyright (c) 2026 BowenLabs. All rights reserved.\n// Cadmus is MIT licensed. See LICENSE in the repo root.\n//\n// @thebes/cadmus/storage\n//\n// Defines the ImageService contract only — R2 upload/serve and any\n// alternate implementation (e.g. a Cloudflare Images extension) live\n// outside this primitive. Cadmus ships the interface so apps can swap\n// implementations without touching any component, renderer, or block\n// data; it has no opinion on which implementation is active.\nimport { CadmusStorageError } from \"../errors.js\";\n\n/** A rendered `<img>`-ready description of a stored image. */\nexport interface RenderedImage {\n src: string;\n srcset?: string;\n sizes?: string;\n}\n\n/**\n * Resolved once per app and imported everywhere images are read or\n * written. Never construct storage URLs or `cdn-cgi/image/...` paths\n * inline — always go through an `ImageService`.\n */\nexport interface ImageService {\n upload: (file: File) => Promise<{ url: string }>;\n render: (image: {\n url: string;\n width?: number;\n height?: number;\n alt: string;\n }) => RenderedImage;\n}\n\n/** MIME types `validateImageFile` accepts — never trust a client-sent\n * MIME type beyond this whitelist check; it's still just `file.type`,\n * not a real content sniff, but rules out the obviously-wrong cases. */\nexport const IMAGE_MIME_WHITELIST = [\n \"image/jpeg\",\n \"image/png\",\n \"image/webp\",\n \"image/gif\",\n] as const;\n\nexport const MAX_IMAGE_UPLOAD_BYTES = 5 * 1024 * 1024; // 5MB\n\n/**\n * Validates a file against the image MIME whitelist and 5MB size cap\n * before it ever reaches `ImageService.upload()`/R2. Throws\n * `CadmusStorageError` — callers map that to the right HTTP status\n * (400 for an invalid type, 413 for oversize).\n */\nexport function validateImageFile(file: File): void {\n if (\n !IMAGE_MIME_WHITELIST.includes(\n file.type as (typeof IMAGE_MIME_WHITELIST)[number],\n )\n ) {\n throw new CadmusStorageError(\n `Unsupported file type: ${file.type || \"unknown\"}`,\n );\n }\n if (file.size > MAX_IMAGE_UPLOAD_BYTES) {\n throw new CadmusStorageError(\n `File exceeds the ${MAX_IMAGE_UPLOAD_BYTES / (1024 * 1024)}MB limit`,\n );\n }\n}\n"],"mappings":";;;;;;AAqCA,MAAa,uBAAuB;CAClC;CACA;CACA;CACA;AACF;AAEA,MAAa,yBAAyB,IAAI,OAAO;;;;;;;AAQjD,SAAgB,kBAAkB,MAAkB;CAClD,IACE,CAAC,qBAAqB,SACpB,KAAK,IACP,GAEA,MAAM,IAAIA,eAAAA,mBACR,0BAA0B,KAAK,QAAQ,WACzC;CAEF,IAAI,KAAK,OAAA,SACP,MAAM,IAAIA,eAAAA,mBACR,oBAAoB,0BAA0B,OAAO,MAAM,SAC7D;AAEJ"}
1
+ {"version":3,"file":"index.cjs","names":["CadmusStorageError"],"sources":["../../src/storage/index.ts"],"sourcesContent":["// Copyright (c) 2026 BowenLabs. All rights reserved.\n// Cadmus is MIT licensed. See LICENSE in the repo root.\n//\n// @thebes/cadmus/storage\n//\n// Defines the ImageService contract only — R2 upload/serve and any\n// alternate implementation (e.g. a Cloudflare Images extension) live\n// outside this primitive. Cadmus ships the interface so apps can swap\n// implementations without touching any component, renderer, or block\n// data; it has no opinion on which implementation is active.\nimport { CadmusStorageError } from \"../errors.js\";\n\n/** A rendered `<img>`-ready description of a stored image. */\nexport interface RenderedImage {\n src: string;\n srcset?: string;\n sizes?: string;\n}\n\n/**\n * Focal point of an image (issue #17) — adopts Sanity's hotspot model.\n * Normalized 0–1 coordinates; `{ x: 0.5, y: 0.5 }` is dead center. When a\n * render crops (e.g. `fit=cover` to a fixed width/height), the focal point\n * is kept in frame instead of the geometric center, so a subject near an\n * edge isn't cut off.\n */\nexport interface ImageHotspot {\n x: number;\n y: number;\n}\n\n/**\n * A crop region (issue #17), as normalized 0–1 insets from each edge —\n * Sanity's crop model. `{ top: 0.1, bottom: 0, left: 0, right: 0.2 }` keeps\n * the middle-left 70%×90% of the image. Applying a crop region needs the\n * source's pixel dimensions (see the render input's `sourceWidth`/\n * `sourceHeight`); without them an implementation should fall back to the\n * hotspot alone.\n */\nexport interface ImageCrop {\n top: number;\n bottom: number;\n left: number;\n right: number;\n}\n\n/**\n * Resolved once per app and imported everywhere images are read or\n * written. Never construct storage URLs or `cdn-cgi/image/...` paths\n * inline — always go through an `ImageService`.\n */\nexport interface ImageService {\n upload: (file: File) => Promise<{ url: string }>;\n render: (image: {\n url: string;\n width?: number;\n height?: number;\n alt: string;\n /** Focal point for cover-crops (issue #17). */\n hotspot?: ImageHotspot;\n /** Crop region (issue #17); needs `sourceWidth`/`sourceHeight` to apply. */\n crop?: ImageCrop;\n /** Source pixel dimensions — required to apply a `crop` region. */\n sourceWidth?: number;\n sourceHeight?: number;\n }) => RenderedImage;\n}\n\n/** MIME types `validateImageFile` accepts — never trust a client-sent\n * MIME type beyond this whitelist check; it's still just `file.type`,\n * not a real content sniff, but rules out the obviously-wrong cases. */\nexport const IMAGE_MIME_WHITELIST = [\n \"image/jpeg\",\n \"image/png\",\n \"image/webp\",\n \"image/gif\",\n] as const;\n\nexport const MAX_IMAGE_UPLOAD_BYTES = 5 * 1024 * 1024; // 5MB\n\n/**\n * Validates a file against the image MIME whitelist and 5MB size cap\n * before it ever reaches `ImageService.upload()`/R2. Throws\n * `CadmusStorageError` — callers map that to the right HTTP status\n * (400 for an invalid type, 413 for oversize).\n */\nexport function validateImageFile(file: File): void {\n if (\n !IMAGE_MIME_WHITELIST.includes(\n file.type as (typeof IMAGE_MIME_WHITELIST)[number],\n )\n ) {\n throw new CadmusStorageError(\n `Unsupported file type: ${file.type || \"unknown\"}`,\n );\n }\n if (file.size > MAX_IMAGE_UPLOAD_BYTES) {\n throw new CadmusStorageError(\n `File exceeds the ${MAX_IMAGE_UPLOAD_BYTES / (1024 * 1024)}MB limit`,\n );\n }\n}\n"],"mappings":";;;;;;AAuEA,MAAa,uBAAuB;CAClC;CACA;CACA;CACA;AACF;AAEA,MAAa,yBAAyB,IAAI,OAAO;;;;;;;AAQjD,SAAgB,kBAAkB,MAAkB;CAClD,IACE,CAAC,qBAAqB,SACpB,KAAK,IACP,GAEA,MAAM,IAAIA,eAAAA,mBACR,0BAA0B,KAAK,QAAQ,WACzC;CAEF,IAAI,KAAK,OAAA,SACP,MAAM,IAAIA,eAAAA,mBACR,oBAAoB,0BAA0B,OAAO,MAAM,SAC7D;AAEJ"}
@@ -5,6 +5,31 @@ interface RenderedImage {
5
5
  srcset?: string;
6
6
  sizes?: string;
7
7
  }
8
+ /**
9
+ * Focal point of an image (issue #17) — adopts Sanity's hotspot model.
10
+ * Normalized 0–1 coordinates; `{ x: 0.5, y: 0.5 }` is dead center. When a
11
+ * render crops (e.g. `fit=cover` to a fixed width/height), the focal point
12
+ * is kept in frame instead of the geometric center, so a subject near an
13
+ * edge isn't cut off.
14
+ */
15
+ interface ImageHotspot {
16
+ x: number;
17
+ y: number;
18
+ }
19
+ /**
20
+ * A crop region (issue #17), as normalized 0–1 insets from each edge —
21
+ * Sanity's crop model. `{ top: 0.1, bottom: 0, left: 0, right: 0.2 }` keeps
22
+ * the middle-left 70%×90% of the image. Applying a crop region needs the
23
+ * source's pixel dimensions (see the render input's `sourceWidth`/
24
+ * `sourceHeight`); without them an implementation should fall back to the
25
+ * hotspot alone.
26
+ */
27
+ interface ImageCrop {
28
+ top: number;
29
+ bottom: number;
30
+ left: number;
31
+ right: number;
32
+ }
8
33
  /**
9
34
  * Resolved once per app and imported everywhere images are read or
10
35
  * written. Never construct storage URLs or `cdn-cgi/image/...` paths
@@ -18,7 +43,11 @@ interface ImageService {
18
43
  url: string;
19
44
  width?: number;
20
45
  height?: number;
21
- alt: string;
46
+ alt: string; /** Focal point for cover-crops (issue #17). */
47
+ hotspot?: ImageHotspot; /** Crop region (issue #17); needs `sourceWidth`/`sourceHeight` to apply. */
48
+ crop?: ImageCrop; /** Source pixel dimensions — required to apply a `crop` region. */
49
+ sourceWidth?: number;
50
+ sourceHeight?: number;
22
51
  }) => RenderedImage;
23
52
  }
24
53
  /** MIME types `validateImageFile` accepts — never trust a client-sent
@@ -34,5 +63,5 @@ declare const MAX_IMAGE_UPLOAD_BYTES: number;
34
63
  */
35
64
  declare function validateImageFile(file: File): void;
36
65
  //#endregion
37
- export { IMAGE_MIME_WHITELIST, ImageService, MAX_IMAGE_UPLOAD_BYTES, RenderedImage, validateImageFile };
66
+ export { IMAGE_MIME_WHITELIST, ImageCrop, ImageHotspot, ImageService, MAX_IMAGE_UPLOAD_BYTES, RenderedImage, validateImageFile };
38
67
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/storage/index.ts"],"mappings":";;UAaiB,aAAA;EACf,GAAA;EACA,MAAA;EACA,KAAA;AAAA;;;;AAAK;AAQP;UAAiB,YAAA;EACf,MAAA,GAAS,IAAA,EAAM,IAAA,KAAS,OAAA;IAAU,GAAA;EAAA;EAClC,MAAA,GAAS,KAAA;IACP,GAAA;IACA,KAAA;IACA,MAAA;IACA,GAAA;EAAA,MACI,aAAA;AAAA;;;;cAMK,oBAAA;AAAA,cAOA,sBAAA;;;;;AAbQ;AAMrB;iBAegB,iBAAA,CAAkB,IAAU,EAAJ,IAAI"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/storage/index.ts"],"mappings":";;UAaiB,aAAA;EACf,GAAA;EACA,MAAA;EACA,KAAA;AAAA;;;;AAAK;AAUP;;;UAAiB,YAAA;EACf,CAAA;EACA,CAAC;AAAA;;;;;;;;AAeI;UAJU,SAAA;EACf,GAAA;EACA,MAAA;EACA,IAAA;EACA,KAAA;AAAA;;;;;;UAQe,YAAA;EACf,MAAA,GAAS,IAAA,EAAM,IAAA,KAAS,OAAA;IAAU,GAAA;EAAA;EAClC,MAAA,GAAS,KAAA;IACP,GAAA;IACA,KAAA;IACA,MAAA;IACA,GAAA,UAEA;IAAA,OAAA,GAAU,YAAA,EAEV;IAAA,IAAA,GAAO,SAAA,EAEP;IAAA,WAAA;IACA,YAAA;EAAA,MACI,aAAA;AAAA;AAAa;AAMrB;;AANqB,cAMR,oBAAA;AAAA,cAOA,sBAAA;AAFH;AAEV;;;;AAAqD;AAF3C,iBAUM,iBAAA,CAAkB,IAAU,EAAJ,IAAI"}
@@ -5,6 +5,31 @@ interface RenderedImage {
5
5
  srcset?: string;
6
6
  sizes?: string;
7
7
  }
8
+ /**
9
+ * Focal point of an image (issue #17) — adopts Sanity's hotspot model.
10
+ * Normalized 0–1 coordinates; `{ x: 0.5, y: 0.5 }` is dead center. When a
11
+ * render crops (e.g. `fit=cover` to a fixed width/height), the focal point
12
+ * is kept in frame instead of the geometric center, so a subject near an
13
+ * edge isn't cut off.
14
+ */
15
+ interface ImageHotspot {
16
+ x: number;
17
+ y: number;
18
+ }
19
+ /**
20
+ * A crop region (issue #17), as normalized 0–1 insets from each edge —
21
+ * Sanity's crop model. `{ top: 0.1, bottom: 0, left: 0, right: 0.2 }` keeps
22
+ * the middle-left 70%×90% of the image. Applying a crop region needs the
23
+ * source's pixel dimensions (see the render input's `sourceWidth`/
24
+ * `sourceHeight`); without them an implementation should fall back to the
25
+ * hotspot alone.
26
+ */
27
+ interface ImageCrop {
28
+ top: number;
29
+ bottom: number;
30
+ left: number;
31
+ right: number;
32
+ }
8
33
  /**
9
34
  * Resolved once per app and imported everywhere images are read or
10
35
  * written. Never construct storage URLs or `cdn-cgi/image/...` paths
@@ -18,7 +43,11 @@ interface ImageService {
18
43
  url: string;
19
44
  width?: number;
20
45
  height?: number;
21
- alt: string;
46
+ alt: string; /** Focal point for cover-crops (issue #17). */
47
+ hotspot?: ImageHotspot; /** Crop region (issue #17); needs `sourceWidth`/`sourceHeight` to apply. */
48
+ crop?: ImageCrop; /** Source pixel dimensions — required to apply a `crop` region. */
49
+ sourceWidth?: number;
50
+ sourceHeight?: number;
22
51
  }) => RenderedImage;
23
52
  }
24
53
  /** MIME types `validateImageFile` accepts — never trust a client-sent
@@ -34,5 +63,5 @@ declare const MAX_IMAGE_UPLOAD_BYTES: number;
34
63
  */
35
64
  declare function validateImageFile(file: File): void;
36
65
  //#endregion
37
- export { IMAGE_MIME_WHITELIST, ImageService, MAX_IMAGE_UPLOAD_BYTES, RenderedImage, validateImageFile };
66
+ export { IMAGE_MIME_WHITELIST, ImageCrop, ImageHotspot, ImageService, MAX_IMAGE_UPLOAD_BYTES, RenderedImage, validateImageFile };
38
67
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/storage/index.ts"],"mappings":";;UAaiB,aAAA;EACf,GAAA;EACA,MAAA;EACA,KAAA;AAAA;;;;AAAK;AAQP;UAAiB,YAAA;EACf,MAAA,GAAS,IAAA,EAAM,IAAA,KAAS,OAAA;IAAU,GAAA;EAAA;EAClC,MAAA,GAAS,KAAA;IACP,GAAA;IACA,KAAA;IACA,MAAA;IACA,GAAA;EAAA,MACI,aAAA;AAAA;;;;cAMK,oBAAA;AAAA,cAOA,sBAAA;;;;;AAbQ;AAMrB;iBAegB,iBAAA,CAAkB,IAAU,EAAJ,IAAI"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/storage/index.ts"],"mappings":";;UAaiB,aAAA;EACf,GAAA;EACA,MAAA;EACA,KAAA;AAAA;;;;AAAK;AAUP;;;UAAiB,YAAA;EACf,CAAA;EACA,CAAC;AAAA;;;;;;;;AAeI;UAJU,SAAA;EACf,GAAA;EACA,MAAA;EACA,IAAA;EACA,KAAA;AAAA;;;;;;UAQe,YAAA;EACf,MAAA,GAAS,IAAA,EAAM,IAAA,KAAS,OAAA;IAAU,GAAA;EAAA;EAClC,MAAA,GAAS,KAAA;IACP,GAAA;IACA,KAAA;IACA,MAAA;IACA,GAAA,UAEA;IAAA,OAAA,GAAU,YAAA,EAEV;IAAA,IAAA,GAAO,SAAA,EAEP;IAAA,WAAA;IACA,YAAA;EAAA,MACI,aAAA;AAAA;AAAa;AAMrB;;AANqB,cAMR,oBAAA;AAAA,cAOA,sBAAA;AAFH;AAEV;;;;AAAqD;AAF3C,iBAUM,iBAAA,CAAkB,IAAU,EAAJ,IAAI"}
@@ -1,4 +1,4 @@
1
- import { f as CadmusStorageError } from "../errors-mZIqZJO4.js";
1
+ import { f as CadmusStorageError } from "../errors-C8SqkFjl.js";
2
2
  //#region src/storage/index.ts
3
3
  /** MIME types `validateImageFile` accepts — never trust a client-sent
4
4
  * MIME type beyond this whitelist check; it's still just `file.type`,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/storage/index.ts"],"sourcesContent":["// Copyright (c) 2026 BowenLabs. All rights reserved.\n// Cadmus is MIT licensed. See LICENSE in the repo root.\n//\n// @thebes/cadmus/storage\n//\n// Defines the ImageService contract only — R2 upload/serve and any\n// alternate implementation (e.g. a Cloudflare Images extension) live\n// outside this primitive. Cadmus ships the interface so apps can swap\n// implementations without touching any component, renderer, or block\n// data; it has no opinion on which implementation is active.\nimport { CadmusStorageError } from \"../errors.js\";\n\n/** A rendered `<img>`-ready description of a stored image. */\nexport interface RenderedImage {\n src: string;\n srcset?: string;\n sizes?: string;\n}\n\n/**\n * Resolved once per app and imported everywhere images are read or\n * written. Never construct storage URLs or `cdn-cgi/image/...` paths\n * inline — always go through an `ImageService`.\n */\nexport interface ImageService {\n upload: (file: File) => Promise<{ url: string }>;\n render: (image: {\n url: string;\n width?: number;\n height?: number;\n alt: string;\n }) => RenderedImage;\n}\n\n/** MIME types `validateImageFile` accepts — never trust a client-sent\n * MIME type beyond this whitelist check; it's still just `file.type`,\n * not a real content sniff, but rules out the obviously-wrong cases. */\nexport const IMAGE_MIME_WHITELIST = [\n \"image/jpeg\",\n \"image/png\",\n \"image/webp\",\n \"image/gif\",\n] as const;\n\nexport const MAX_IMAGE_UPLOAD_BYTES = 5 * 1024 * 1024; // 5MB\n\n/**\n * Validates a file against the image MIME whitelist and 5MB size cap\n * before it ever reaches `ImageService.upload()`/R2. Throws\n * `CadmusStorageError` — callers map that to the right HTTP status\n * (400 for an invalid type, 413 for oversize).\n */\nexport function validateImageFile(file: File): void {\n if (\n !IMAGE_MIME_WHITELIST.includes(\n file.type as (typeof IMAGE_MIME_WHITELIST)[number],\n )\n ) {\n throw new CadmusStorageError(\n `Unsupported file type: ${file.type || \"unknown\"}`,\n );\n }\n if (file.size > MAX_IMAGE_UPLOAD_BYTES) {\n throw new CadmusStorageError(\n `File exceeds the ${MAX_IMAGE_UPLOAD_BYTES / (1024 * 1024)}MB limit`,\n );\n }\n}\n"],"mappings":";;;;;AAqCA,MAAa,uBAAuB;CAClC;CACA;CACA;CACA;AACF;AAEA,MAAa,yBAAyB,IAAI,OAAO;;;;;;;AAQjD,SAAgB,kBAAkB,MAAkB;CAClD,IACE,CAAC,qBAAqB,SACpB,KAAK,IACP,GAEA,MAAM,IAAI,mBACR,0BAA0B,KAAK,QAAQ,WACzC;CAEF,IAAI,KAAK,OAAA,SACP,MAAM,IAAI,mBACR,oBAAoB,0BAA0B,OAAO,MAAM,SAC7D;AAEJ"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/storage/index.ts"],"sourcesContent":["// Copyright (c) 2026 BowenLabs. All rights reserved.\n// Cadmus is MIT licensed. See LICENSE in the repo root.\n//\n// @thebes/cadmus/storage\n//\n// Defines the ImageService contract only — R2 upload/serve and any\n// alternate implementation (e.g. a Cloudflare Images extension) live\n// outside this primitive. Cadmus ships the interface so apps can swap\n// implementations without touching any component, renderer, or block\n// data; it has no opinion on which implementation is active.\nimport { CadmusStorageError } from \"../errors.js\";\n\n/** A rendered `<img>`-ready description of a stored image. */\nexport interface RenderedImage {\n src: string;\n srcset?: string;\n sizes?: string;\n}\n\n/**\n * Focal point of an image (issue #17) — adopts Sanity's hotspot model.\n * Normalized 0–1 coordinates; `{ x: 0.5, y: 0.5 }` is dead center. When a\n * render crops (e.g. `fit=cover` to a fixed width/height), the focal point\n * is kept in frame instead of the geometric center, so a subject near an\n * edge isn't cut off.\n */\nexport interface ImageHotspot {\n x: number;\n y: number;\n}\n\n/**\n * A crop region (issue #17), as normalized 0–1 insets from each edge —\n * Sanity's crop model. `{ top: 0.1, bottom: 0, left: 0, right: 0.2 }` keeps\n * the middle-left 70%×90% of the image. Applying a crop region needs the\n * source's pixel dimensions (see the render input's `sourceWidth`/\n * `sourceHeight`); without them an implementation should fall back to the\n * hotspot alone.\n */\nexport interface ImageCrop {\n top: number;\n bottom: number;\n left: number;\n right: number;\n}\n\n/**\n * Resolved once per app and imported everywhere images are read or\n * written. Never construct storage URLs or `cdn-cgi/image/...` paths\n * inline — always go through an `ImageService`.\n */\nexport interface ImageService {\n upload: (file: File) => Promise<{ url: string }>;\n render: (image: {\n url: string;\n width?: number;\n height?: number;\n alt: string;\n /** Focal point for cover-crops (issue #17). */\n hotspot?: ImageHotspot;\n /** Crop region (issue #17); needs `sourceWidth`/`sourceHeight` to apply. */\n crop?: ImageCrop;\n /** Source pixel dimensions — required to apply a `crop` region. */\n sourceWidth?: number;\n sourceHeight?: number;\n }) => RenderedImage;\n}\n\n/** MIME types `validateImageFile` accepts — never trust a client-sent\n * MIME type beyond this whitelist check; it's still just `file.type`,\n * not a real content sniff, but rules out the obviously-wrong cases. */\nexport const IMAGE_MIME_WHITELIST = [\n \"image/jpeg\",\n \"image/png\",\n \"image/webp\",\n \"image/gif\",\n] as const;\n\nexport const MAX_IMAGE_UPLOAD_BYTES = 5 * 1024 * 1024; // 5MB\n\n/**\n * Validates a file against the image MIME whitelist and 5MB size cap\n * before it ever reaches `ImageService.upload()`/R2. Throws\n * `CadmusStorageError` — callers map that to the right HTTP status\n * (400 for an invalid type, 413 for oversize).\n */\nexport function validateImageFile(file: File): void {\n if (\n !IMAGE_MIME_WHITELIST.includes(\n file.type as (typeof IMAGE_MIME_WHITELIST)[number],\n )\n ) {\n throw new CadmusStorageError(\n `Unsupported file type: ${file.type || \"unknown\"}`,\n );\n }\n if (file.size > MAX_IMAGE_UPLOAD_BYTES) {\n throw new CadmusStorageError(\n `File exceeds the ${MAX_IMAGE_UPLOAD_BYTES / (1024 * 1024)}MB limit`,\n );\n }\n}\n"],"mappings":";;;;;AAuEA,MAAa,uBAAuB;CAClC;CACA;CACA;CACA;AACF;AAEA,MAAa,yBAAyB,IAAI,OAAO;;;;;;;AAQjD,SAAgB,kBAAkB,MAAkB;CAClD,IACE,CAAC,qBAAqB,SACpB,KAAK,IACP,GAEA,MAAM,IAAI,mBACR,0BAA0B,KAAK,QAAQ,WACzC;CAEF,IAAI,KAAK,OAAA,SACP,MAAM,IAAI,mBACR,oBAAoB,0BAA0B,OAAO,MAAM,SAC7D;AAEJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thebes/cadmus",
3
- "version": "0.2.1",
3
+ "version": "0.4.0",
4
4
  "description": "V8-first, Cloudflare-native full-stack framework primitives",
5
5
  "author": "BowenLabs <hello@bowenlabs.io>",
6
6
  "license": "MIT",