@calmlens/js-sdk 0.0.0 → 0.0.2

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 (69) hide show
  1. package/README.md +190 -22
  2. package/cjs/ApiKey.d.ts +31 -0
  3. package/cjs/ApiKey.js +59 -0
  4. package/cjs/Asset.d.ts +83 -3
  5. package/cjs/Asset.js +198 -28
  6. package/cjs/Auth.d.ts +95 -0
  7. package/cjs/Auth.js +2 -0
  8. package/cjs/CalmLensClient.d.ts +28 -11
  9. package/cjs/CalmLensClient.js +138 -77
  10. package/cjs/CalmLensTypes.d.ts +2 -0
  11. package/cjs/Classification.js +40 -7
  12. package/cjs/DocMetaTypes.d.ts +7 -0
  13. package/cjs/DocMetaTypes.js +7 -0
  14. package/cjs/Page.d.ts +42 -0
  15. package/cjs/Page.js +94 -0
  16. package/cjs/PublicApiSchemas.d.ts +1593 -0
  17. package/cjs/PublicApiSchemas.js +334 -0
  18. package/cjs/RequestInfo.d.ts +23 -0
  19. package/cjs/RequestInfo.js +2 -0
  20. package/cjs/Roles.d.ts +21 -0
  21. package/cjs/Roles.js +84 -0
  22. package/cjs/SharedConstants.d.ts +134 -0
  23. package/cjs/SharedConstants.js +125 -0
  24. package/cjs/SharedTypes.d.ts +6 -1
  25. package/cjs/User.d.ts +17 -0
  26. package/cjs/User.js +51 -0
  27. package/cjs/UtilTypes.d.ts +30 -0
  28. package/cjs/UtilTypes.js +4 -0
  29. package/cjs/Workflow.d.ts +58 -0
  30. package/cjs/Workflow.js +83 -0
  31. package/cjs/ZodUtils.d.ts +39 -0
  32. package/cjs/ZodUtils.js +328 -0
  33. package/cjs/index.js +4 -1
  34. package/esm/ApiKey.d.ts +31 -0
  35. package/esm/ApiKey.js +23 -0
  36. package/esm/Asset.d.ts +83 -3
  37. package/esm/Asset.js +148 -12
  38. package/esm/Auth.d.ts +95 -0
  39. package/esm/Auth.js +1 -0
  40. package/esm/CalmLensClient.d.ts +28 -11
  41. package/esm/CalmLensClient.js +104 -55
  42. package/esm/CalmLensTypes.d.ts +2 -0
  43. package/esm/Classification.js +1 -1
  44. package/esm/DocMetaTypes.d.ts +7 -0
  45. package/esm/DocMetaTypes.js +4 -0
  46. package/esm/Page.d.ts +42 -0
  47. package/esm/Page.js +55 -0
  48. package/esm/PublicApiSchemas.d.ts +1593 -0
  49. package/esm/PublicApiSchemas.js +298 -0
  50. package/esm/RequestInfo.d.ts +23 -0
  51. package/esm/RequestInfo.js +1 -0
  52. package/esm/Roles.d.ts +21 -0
  53. package/esm/Roles.js +45 -0
  54. package/esm/SharedConstants.d.ts +134 -0
  55. package/esm/SharedConstants.js +122 -0
  56. package/esm/SharedTypes.d.ts +6 -1
  57. package/esm/User.d.ts +17 -0
  58. package/esm/User.js +15 -0
  59. package/esm/UtilTypes.d.ts +30 -0
  60. package/esm/UtilTypes.js +1 -0
  61. package/esm/Workflow.d.ts +58 -0
  62. package/esm/Workflow.js +46 -0
  63. package/esm/ZodUtils.d.ts +39 -0
  64. package/esm/ZodUtils.js +266 -0
  65. package/package.json +10 -10
  66. package/cjs/SchemaUtils.d.ts +0 -11
  67. package/cjs/SchemaUtils.js +0 -63
  68. package/esm/SchemaUtils.d.ts +0 -11
  69. package/esm/SchemaUtils.js +0 -46
@@ -0,0 +1,298 @@
1
+ import { ErrorCode } from "sendable-error";
2
+ import * as zod from "zod/v4";
3
+ import { metaStore } from "zod-meta";
4
+ import { ASSET_SCHEMA } from "./Asset";
5
+ import { docPropertyInfo } from "./DocMetaTypes";
6
+ import { createPageSchema, PAGE_QUERY_SCHEMA } from "./Page";
7
+ import { MAX_IMAGE_UPLOAD_STRING, MAX_NON_IMAGE_UPLOAD_STRING } from "./SharedConstants";
8
+ import { rsqlField } from "./ZodUtils";
9
+ export const PUBLIC_ERROR_CODES = {
10
+ FILE_TOO_LARGE: new ErrorCode({
11
+ id: "upload/file-too-large",
12
+ defaultMessage: `File size exceeds limit. Maximum size for images is ${MAX_IMAGE_UPLOAD_STRING}, for other files is ${MAX_NON_IMAGE_UPLOAD_STRING}.`,
13
+ status: 400,
14
+ }),
15
+ IMAGE_EXCEEDED_MAX_DIMENSIONS: new ErrorCode({
16
+ id: "upload/image-exceeded-max-dimensions",
17
+ defaultMessage: "Image exceeds maximum dimensions. Maximum dimensions are 12,000px.",
18
+ status: 400,
19
+ }),
20
+ UPLOAD_LIMIT_EXCEEDED: new ErrorCode({
21
+ id: "upload/limit-exceeded",
22
+ defaultMessage: "Upload limit exceeded. You have used all your free uploads. Please upgrade to Plus or Pro for unlimited uploads.",
23
+ status: 403,
24
+ }),
25
+ ASSET_NOT_FOUND: new ErrorCode({
26
+ id: "asset/not-found",
27
+ defaultMessage: "Asset not found",
28
+ status: 404,
29
+ }),
30
+ PROJECT_NOT_FOUND: new ErrorCode({
31
+ id: "project/not-found",
32
+ defaultMessage: "Project not found",
33
+ status: 404,
34
+ }),
35
+ ASSET_UPDATE_FAILED: new ErrorCode({
36
+ id: "asset/update-failed",
37
+ defaultMessage: "Failed to update asset",
38
+ status: 500,
39
+ }),
40
+ };
41
+ export const GET_ASSETS_PAGE_PARAMS_SCHEMA = zod.object({
42
+ projectId: zod
43
+ .string()
44
+ .uuid()
45
+ .meta(metaStore([
46
+ docPropertyInfo({
47
+ description: "UUID of the project to fetch assets from",
48
+ placeholder: "123e4567-e89b-12d3-a456-426614174000",
49
+ }),
50
+ ])),
51
+ });
52
+ export const GET_ASSETS_PAGE_QUERY_SCHEMA = PAGE_QUERY_SCHEMA.extend({
53
+ filter: rsqlField().nullish(),
54
+ });
55
+ export const GET_ASSETS_PAGE_RESPONSE_SCHEMA = createPageSchema(ASSET_SCHEMA);
56
+ export const GET_ASSETS_PAGE_REQUEST = {
57
+ name: "Get Assets Page",
58
+ id: "get-assets-page",
59
+ method: "GET",
60
+ path: "/projects/:projectId/assets/page",
61
+ description: "Get a paginated list of assets for a project",
62
+ auth: "API Key",
63
+ sdkPath: ["assets", "list"],
64
+ schemas: {
65
+ params: GET_ASSETS_PAGE_PARAMS_SCHEMA,
66
+ query: GET_ASSETS_PAGE_QUERY_SCHEMA,
67
+ response: GET_ASSETS_PAGE_RESPONSE_SCHEMA,
68
+ },
69
+ errorCodes: [PUBLIC_ERROR_CODES.PROJECT_NOT_FOUND],
70
+ };
71
+ // ------
72
+ export const GET_ASSET_PARAMS_SCHEMA = zod.object({
73
+ projectId: zod
74
+ .string()
75
+ .uuid()
76
+ .meta(metaStore([
77
+ docPropertyInfo({
78
+ description: "UUID of the project containing the asset",
79
+ placeholder: "123e4567-e89b-12d3-a456-426614174000",
80
+ }),
81
+ ])),
82
+ assetId: zod
83
+ .string()
84
+ .uuid()
85
+ .meta(metaStore([
86
+ docPropertyInfo({
87
+ description: "UUID of the asset to fetch",
88
+ placeholder: "987fcdeb-51a2-43d7-b890-123456789abc",
89
+ }),
90
+ ])),
91
+ });
92
+ export const GET_ASSET_RESPONSE_SCHEMA = ASSET_SCHEMA;
93
+ export const GET_ASSET_REQUEST = {
94
+ name: "Get Asset",
95
+ id: "get-asset",
96
+ method: "GET",
97
+ path: "/projects/:projectId/assets/:assetId",
98
+ description: "Get a single asset by ID",
99
+ auth: "API Key",
100
+ sdkPath: ["assets", "retrieve"],
101
+ schemas: {
102
+ params: GET_ASSET_PARAMS_SCHEMA,
103
+ response: GET_ASSET_RESPONSE_SCHEMA,
104
+ },
105
+ errorCodes: [
106
+ PUBLIC_ERROR_CODES.ASSET_NOT_FOUND,
107
+ PUBLIC_ERROR_CODES.PROJECT_NOT_FOUND,
108
+ ],
109
+ };
110
+ // ------
111
+ export const GET_ASSET_CHILDREN_PARAMS_SCHEMA = zod.object({
112
+ projectId: zod
113
+ .string()
114
+ .uuid()
115
+ .meta(metaStore([
116
+ docPropertyInfo({
117
+ description: "UUID of the project containing the parent asset",
118
+ placeholder: "123e4567-e89b-12d3-a456-426614174000",
119
+ }),
120
+ ])),
121
+ assetId: zod
122
+ .string()
123
+ .uuid()
124
+ .meta(metaStore([
125
+ docPropertyInfo({
126
+ description: "UUID of the parent asset to fetch children for",
127
+ placeholder: "987fcdeb-51a2-43d7-b890-123456789abc",
128
+ }),
129
+ ])),
130
+ });
131
+ export const GET_ASSET_CHILDREN_QUERY_SCHEMA = PAGE_QUERY_SCHEMA;
132
+ export const GET_ASSET_CHILDREN_RESPONSE_SCHEMA = createPageSchema(ASSET_SCHEMA);
133
+ export const GET_ASSET_CHILDREN_REQUEST = {
134
+ name: "Get Asset Children",
135
+ id: "get-asset-children",
136
+ method: "GET",
137
+ path: "/projects/:projectId/assets/:assetId/children",
138
+ description: "Get child assets of a parent asset",
139
+ auth: "API Key",
140
+ sdkPath: ["assets", "listChildren"],
141
+ schemas: {
142
+ params: GET_ASSET_CHILDREN_PARAMS_SCHEMA,
143
+ query: GET_ASSET_CHILDREN_QUERY_SCHEMA,
144
+ response: GET_ASSET_CHILDREN_RESPONSE_SCHEMA,
145
+ },
146
+ };
147
+ // ------
148
+ export const POST_ASSET_PARAMS_SCHEMA = zod.object({
149
+ projectId: zod
150
+ .string()
151
+ .uuid()
152
+ .meta(metaStore([
153
+ docPropertyInfo({
154
+ description: "UUID of the project to upload the asset to",
155
+ placeholder: "123e4567-e89b-12d3-a456-426614174000",
156
+ }),
157
+ ])),
158
+ });
159
+ const POST_ASSET_FILE_BODY_SCHEMA = zod.object({
160
+ file: zod.string().meta(metaStore([
161
+ docPropertyInfo({
162
+ description: "Base64 encoded file content or data URL",
163
+ placeholder: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ...",
164
+ }),
165
+ ])),
166
+ fileType: zod.string().meta(metaStore([
167
+ docPropertyInfo({
168
+ description: "MIME type or file extension",
169
+ placeholder: "image/jpeg",
170
+ }),
171
+ ])),
172
+ externalUrl: zod.string().url().optional(),
173
+ });
174
+ const POST_ASSET_URL_BODY_SCHEMA = zod.object({
175
+ url: zod
176
+ .string()
177
+ .url()
178
+ .meta(metaStore([
179
+ docPropertyInfo({
180
+ description: "URL to fetch the asset from",
181
+ placeholder: "https://example.com/image.jpg",
182
+ }),
183
+ ])),
184
+ });
185
+ const POST_ASSET_COMMON_BODY_SCHEMA = ASSET_SCHEMA.pick({
186
+ name: true,
187
+ }).and(ASSET_SCHEMA.pick({
188
+ description: true,
189
+ processingOptions: true,
190
+ visibility: true,
191
+ }).partial());
192
+ export const POST_ASSET_BODY_SCHEMA = zod
193
+ .union([POST_ASSET_FILE_BODY_SCHEMA, POST_ASSET_URL_BODY_SCHEMA])
194
+ .and(POST_ASSET_COMMON_BODY_SCHEMA);
195
+ export const POST_ASSET_RESPONSE_SCHEMA = ASSET_SCHEMA;
196
+ export const POST_ASSET_REQUEST = {
197
+ name: "Create Asset",
198
+ id: "post-asset",
199
+ method: "POST",
200
+ path: "/projects/:projectId/assets",
201
+ description: "Upload a new asset to a project",
202
+ auth: "API Key",
203
+ sdkPath: ["assets", "create"],
204
+ schemas: {
205
+ params: POST_ASSET_PARAMS_SCHEMA,
206
+ body: POST_ASSET_BODY_SCHEMA,
207
+ response: POST_ASSET_RESPONSE_SCHEMA,
208
+ },
209
+ errorCodes: [
210
+ PUBLIC_ERROR_CODES.FILE_TOO_LARGE,
211
+ PUBLIC_ERROR_CODES.UPLOAD_LIMIT_EXCEEDED,
212
+ ],
213
+ };
214
+ // ------
215
+ export const PATCH_ASSET_PARAMS_SCHEMA = zod.object({
216
+ projectId: zod
217
+ .string()
218
+ .uuid()
219
+ .meta(metaStore([
220
+ docPropertyInfo({
221
+ description: "UUID of the project containing the asset",
222
+ placeholder: "123e4567-e89b-12d3-a456-426614174000",
223
+ }),
224
+ ])),
225
+ assetId: zod
226
+ .string()
227
+ .uuid()
228
+ .meta(metaStore([
229
+ docPropertyInfo({
230
+ description: "UUID of the asset to update",
231
+ placeholder: "987fcdeb-51a2-43d7-b890-123456789abc",
232
+ }),
233
+ ])),
234
+ });
235
+ export const PATCH_ASSET_BODY_SCHEMA = ASSET_SCHEMA.pick({
236
+ name: true,
237
+ description: true,
238
+ externalId: true,
239
+ externalUrl: true,
240
+ metadata: true,
241
+ tags: true,
242
+ visibility: true,
243
+ }).partial();
244
+ export const PATCH_ASSET_RESPONSE_SCHEMA = ASSET_SCHEMA;
245
+ export const PATCH_ASSET_REQUEST = {
246
+ name: "Update Asset",
247
+ id: "patch-asset",
248
+ method: "PATCH",
249
+ path: "/projects/:projectId/assets/:assetId",
250
+ description: "Update an existing asset",
251
+ auth: "API Key",
252
+ sdkPath: ["assets", "update"],
253
+ schemas: {
254
+ params: PATCH_ASSET_PARAMS_SCHEMA,
255
+ body: PATCH_ASSET_BODY_SCHEMA,
256
+ response: PATCH_ASSET_RESPONSE_SCHEMA,
257
+ },
258
+ errorCodes: [
259
+ PUBLIC_ERROR_CODES.ASSET_NOT_FOUND,
260
+ PUBLIC_ERROR_CODES.ASSET_UPDATE_FAILED,
261
+ ],
262
+ };
263
+ // ------
264
+ export const DELETE_ASSET_PARAMS_SCHEMA = zod.object({
265
+ projectId: zod
266
+ .string()
267
+ .uuid()
268
+ .meta(metaStore([
269
+ docPropertyInfo({
270
+ description: "UUID of the project containing the asset",
271
+ placeholder: "123e4567-e89b-12d3-a456-426614174000",
272
+ }),
273
+ ])),
274
+ assetId: zod
275
+ .string()
276
+ .uuid()
277
+ .meta(metaStore([
278
+ docPropertyInfo({
279
+ description: "UUID of the asset to delete",
280
+ placeholder: "987fcdeb-51a2-43d7-b890-123456789abc",
281
+ }),
282
+ ])),
283
+ });
284
+ export const DELETE_ASSET_RESPONSE_SCHEMA = zod.object({});
285
+ export const DELETE_ASSET_REQUEST = {
286
+ name: "Delete Asset",
287
+ id: "delete-asset",
288
+ method: "DELETE",
289
+ path: "/projects/:projectId/assets/:assetId",
290
+ description: "Delete an asset from a project",
291
+ auth: "API Key",
292
+ sdkPath: ["assets", "delete"],
293
+ schemas: {
294
+ params: DELETE_ASSET_PARAMS_SCHEMA,
295
+ response: DELETE_ASSET_RESPONSE_SCHEMA,
296
+ },
297
+ errorCodes: [PUBLIC_ERROR_CODES.ASSET_NOT_FOUND],
298
+ };
@@ -0,0 +1,23 @@
1
+ import type * as zod from "zod/v4";
2
+ export interface RequestErrorCode {
3
+ getId(): string;
4
+ getDefaultMessage(): string | undefined;
5
+ is(error: any): error is any;
6
+ getStatus(): number | undefined;
7
+ }
8
+ export interface RequestInfo {
9
+ id: string;
10
+ method: string;
11
+ name: string;
12
+ path: string;
13
+ description: string;
14
+ auth: string;
15
+ sdkPath: string[];
16
+ schemas: {
17
+ params?: zod.ZodSchema;
18
+ query?: zod.ZodSchema;
19
+ body?: zod.ZodSchema;
20
+ response: zod.ZodSchema;
21
+ };
22
+ errorCodes?: RequestErrorCode[];
23
+ }
@@ -0,0 +1 @@
1
+ export {};
package/esm/Roles.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ import * as zod from "zod/v4";
2
+ import type { Auth } from "./Auth";
3
+ export declare const ROLE_SCHEMA: zod.ZodEnum<{
4
+ "system:super-admin": "system:super-admin";
5
+ "system:banned": "system:banned";
6
+ "assets:view-all": "assets:view-all";
7
+ }>;
8
+ export type Role = zod.infer<typeof ROLE_SCHEMA>;
9
+ export interface RoleInfo {
10
+ id: Role;
11
+ label: string;
12
+ description: string;
13
+ category: string;
14
+ system: boolean;
15
+ dangerous?: boolean;
16
+ color?: string;
17
+ }
18
+ export declare const ROLE_INFO: Record<Role, RoleInfo>;
19
+ export declare const getRoleInfo: (roleId: Role) => RoleInfo;
20
+ export declare const getRolesByCategory: (category: RoleInfo["category"]) => RoleInfo[];
21
+ export declare const hasRole: (auth: Auth | undefined, roles: Role | Role[]) => boolean;
package/esm/Roles.js ADDED
@@ -0,0 +1,45 @@
1
+ import * as zod from "zod/v4";
2
+ export const ROLE_SCHEMA = zod.enum(["system:super-admin", "system:banned", "assets:view-all"]);
3
+ export const ROLE_INFO = {
4
+ "system:super-admin": {
5
+ id: "system:super-admin",
6
+ system: true,
7
+ label: "Super Admin",
8
+ description: "Full administrative access to the platform",
9
+ category: "system",
10
+ dangerous: true,
11
+ color: "#ef4444",
12
+ },
13
+ "system:banned": {
14
+ id: "system:banned",
15
+ system: true,
16
+ label: "Banned",
17
+ description: "User is banned from using the platform",
18
+ category: "system",
19
+ dangerous: true,
20
+ color: "#dc2626",
21
+ },
22
+ "assets:view-all": {
23
+ id: "assets:view-all",
24
+ system: true,
25
+ label: "View All Assets",
26
+ description: "View all assets in the platform",
27
+ category: "assets",
28
+ dangerous: false,
29
+ color: "#000000",
30
+ },
31
+ };
32
+ export const getRoleInfo = (roleId) => {
33
+ return ROLE_INFO[roleId];
34
+ };
35
+ export const getRolesByCategory = (category) => {
36
+ return Object.values(ROLE_INFO).filter((role) => role.category === category);
37
+ };
38
+ export const hasRole = (auth, roles) => {
39
+ if (!auth)
40
+ return false;
41
+ if (!auth.roles)
42
+ return false;
43
+ const roleArray = Array.isArray(roles) ? roles : [roles];
44
+ return roleArray.some((role) => auth.roles.includes(role));
45
+ };
@@ -0,0 +1,134 @@
1
+ import type { Fit } from "./UtilTypes";
2
+ export type CookieType = "functional" | "analytics" | "marketing" | "essential";
3
+ export interface CookieInfo {
4
+ name: string;
5
+ description: string;
6
+ expirationDescription: string;
7
+ expirationMs?: number;
8
+ type: CookieType;
9
+ providerName?: string;
10
+ }
11
+ export declare const FIRST_PARTY_COOKIES: {
12
+ readonly ACCEPTED_COOKIES_VERSION: {
13
+ readonly name: "CL_acceptedCookiesVersion";
14
+ readonly description: "Indicates the version of the cookies the user has accepted";
15
+ readonly expirationDescription: "1 year";
16
+ readonly type: "essential";
17
+ readonly providerName: "CalmLens";
18
+ };
19
+ readonly RANDOM_SEED: {
20
+ readonly name: "CL_randomnessSeed";
21
+ readonly description: "Random seed used for consistent randomization across sessions";
22
+ readonly expirationDescription: "Session";
23
+ readonly type: "functional";
24
+ readonly providerName: "CalmLens";
25
+ };
26
+ readonly EVER_LOGGED_IN: {
27
+ readonly name: "CL_everLoggedIn";
28
+ readonly description: "Indicates if the user has ever logged in to the app";
29
+ readonly expirationDescription: "10 years";
30
+ readonly type: "essential";
31
+ readonly providerName: "CalmLens";
32
+ };
33
+ readonly ID_TOKEN_EXPIRES_AT: {
34
+ readonly name: "CL_idTokenExpiresAt";
35
+ readonly description: "User authentication token expiration time";
36
+ readonly expirationDescription: "Session";
37
+ readonly type: "essential";
38
+ readonly providerName: "CalmLens";
39
+ };
40
+ readonly ID_TOKEN: {
41
+ readonly name: "CL_idToken";
42
+ readonly description: "User authentication token";
43
+ readonly expirationDescription: "Session";
44
+ readonly type: "essential";
45
+ readonly providerName: "CalmLens";
46
+ };
47
+ readonly LOGGED_IN: {
48
+ readonly name: "CL_loggedIn";
49
+ readonly description: "Indicates if the user is currently logged in";
50
+ readonly expirationDescription: "Session";
51
+ readonly type: "essential";
52
+ readonly providerName: "CalmLens";
53
+ };
54
+ readonly REFRESH_TOKEN: {
55
+ readonly name: "CL_refreshToken";
56
+ readonly description: "User refresh token";
57
+ readonly expirationDescription: "Session";
58
+ readonly type: "essential";
59
+ readonly providerName: "CalmLens";
60
+ };
61
+ readonly PRE_RENDERED_WIDTH: {
62
+ readonly name: "CL_preRenderedWidth";
63
+ readonly description: "Indicates the viewport width of the user";
64
+ readonly expirationDescription: "Session";
65
+ readonly type: "essential";
66
+ readonly providerName: "CalmLens";
67
+ };
68
+ readonly SELECTED_PROJECT_ID: {
69
+ readonly name: "CL_selectedProjectId";
70
+ readonly description: "The currently selected project ID";
71
+ readonly expirationDescription: "1 year";
72
+ readonly type: "functional";
73
+ readonly providerName: "CalmLens";
74
+ };
75
+ readonly ASSET_DASHBOARD_STATE: {
76
+ readonly name: "CL_assetDashboardState";
77
+ readonly description: "Asset dashboard persistent state (view mode, filters, etc.)";
78
+ readonly expirationDescription: "1 year";
79
+ readonly expirationMs: number;
80
+ readonly type: "functional";
81
+ readonly providerName: "CalmLens";
82
+ };
83
+ readonly ASSET_VIEW: {
84
+ readonly name: "CL_assetView";
85
+ readonly description: "Preferred view mode for an asset's sub-assets (append _<assetId> to the name)";
86
+ readonly expirationDescription: "1 year";
87
+ readonly expirationMs: number;
88
+ readonly type: "functional";
89
+ readonly providerName: "CalmLens";
90
+ };
91
+ readonly PORTAL_SIDEBAR_SPLIT_PANE: {
92
+ readonly name: "CL_portalSidebarSplitPane";
93
+ readonly description: "Portal sidebar split pane panel sizes";
94
+ readonly expirationDescription: "1 year";
95
+ readonly expirationMs: number;
96
+ readonly type: "functional";
97
+ readonly providerName: "CalmLens";
98
+ };
99
+ readonly PORTAL_LAYOUT_SPLIT_PANE: {
100
+ readonly name: "CL_portalLayoutSplitPane";
101
+ readonly description: "Portal layout horizontal split pane panel sizes";
102
+ readonly expirationDescription: "1 year";
103
+ readonly expirationMs: number;
104
+ readonly type: "functional";
105
+ readonly providerName: "CalmLens";
106
+ };
107
+ };
108
+ export declare const THIRD_PARTY_COOKIES: {
109
+ readonly STRIPE: {
110
+ readonly name: "__stripe_mid";
111
+ readonly description: "Payment processing";
112
+ readonly expirationDescription: "Session";
113
+ readonly type: "essential";
114
+ readonly providerName: "Stripe";
115
+ };
116
+ };
117
+ export declare const PAYMENT_RETURN_TYPES: readonly ["edit", "account", "settings", "subscription"];
118
+ export type PaymentReturnType = (typeof PAYMENT_RETURN_TYPES)[number];
119
+ export declare const PLAN_TYPES: readonly ["plus", "pro"];
120
+ export type PlanType = (typeof PLAN_TYPES)[number];
121
+ export declare const IS_BACKEND: boolean;
122
+ export declare const COOKIE_NEVER_EXPIRES: number;
123
+ export declare const DEFAULT_FIT: Fit;
124
+ export declare const MAX_IMAGE_UPLOAD_MB = 10;
125
+ export declare const MAX_IMAGE_UPLOAD_STRING = "10MB";
126
+ export declare const MAX_IMAGE_DIMENSION = 12000;
127
+ export declare const MAX_IMAGE_UPLOAD_BYTES: number;
128
+ export declare const MAX_NON_IMAGE_UPLOAD_MB = 5000;
129
+ export declare const MAX_NON_IMAGE_UPLOAD_BYTES: number;
130
+ export declare const MAX_NON_IMAGE_UPLOAD_STRING = "5GB";
131
+ export declare const IMPERSONATION_COOKIE_NAME = "CL_impersonation";
132
+ export declare const DOMAIN = "calmlens.com";
133
+ export declare const TITLE = "CalmLens";
134
+ export declare const BLURB = "AI-powered content moderation for safer online communities";
@@ -0,0 +1,122 @@
1
+ export const FIRST_PARTY_COOKIES = {
2
+ ACCEPTED_COOKIES_VERSION: {
3
+ name: "CL_acceptedCookiesVersion",
4
+ description: "Indicates the version of the cookies the user has accepted",
5
+ expirationDescription: "1 year",
6
+ type: "essential",
7
+ providerName: "CalmLens",
8
+ },
9
+ RANDOM_SEED: {
10
+ name: "CL_randomnessSeed",
11
+ description: "Random seed used for consistent randomization across sessions",
12
+ expirationDescription: "Session",
13
+ type: "functional",
14
+ providerName: "CalmLens",
15
+ },
16
+ EVER_LOGGED_IN: {
17
+ name: "CL_everLoggedIn",
18
+ description: "Indicates if the user has ever logged in to the app",
19
+ expirationDescription: "10 years",
20
+ type: "essential",
21
+ providerName: "CalmLens",
22
+ },
23
+ ID_TOKEN_EXPIRES_AT: {
24
+ name: "CL_idTokenExpiresAt",
25
+ description: "User authentication token expiration time",
26
+ expirationDescription: "Session",
27
+ type: "essential",
28
+ providerName: "CalmLens",
29
+ },
30
+ ID_TOKEN: {
31
+ name: "CL_idToken",
32
+ description: "User authentication token",
33
+ expirationDescription: "Session",
34
+ type: "essential",
35
+ providerName: "CalmLens",
36
+ },
37
+ LOGGED_IN: {
38
+ name: "CL_loggedIn",
39
+ description: "Indicates if the user is currently logged in",
40
+ expirationDescription: "Session",
41
+ type: "essential",
42
+ providerName: "CalmLens",
43
+ },
44
+ REFRESH_TOKEN: {
45
+ name: "CL_refreshToken",
46
+ description: "User refresh token",
47
+ expirationDescription: "Session",
48
+ type: "essential",
49
+ providerName: "CalmLens",
50
+ },
51
+ PRE_RENDERED_WIDTH: {
52
+ name: "CL_preRenderedWidth",
53
+ description: "Indicates the viewport width of the user",
54
+ expirationDescription: "Session",
55
+ type: "essential",
56
+ providerName: "CalmLens",
57
+ },
58
+ SELECTED_PROJECT_ID: {
59
+ name: "CL_selectedProjectId",
60
+ description: "The currently selected project ID",
61
+ expirationDescription: "1 year",
62
+ type: "functional",
63
+ providerName: "CalmLens",
64
+ },
65
+ ASSET_DASHBOARD_STATE: {
66
+ name: "CL_assetDashboardState",
67
+ description: "Asset dashboard persistent state (view mode, filters, etc.)",
68
+ expirationDescription: "1 year",
69
+ expirationMs: 365 * 24 * 60 * 60 * 1000,
70
+ type: "functional",
71
+ providerName: "CalmLens",
72
+ },
73
+ ASSET_VIEW: {
74
+ name: "CL_assetView",
75
+ description: "Preferred view mode for an asset's sub-assets (append _<assetId> to the name)",
76
+ expirationDescription: "1 year",
77
+ expirationMs: 365 * 24 * 60 * 60 * 1000,
78
+ type: "functional",
79
+ providerName: "CalmLens",
80
+ },
81
+ PORTAL_SIDEBAR_SPLIT_PANE: {
82
+ name: "CL_portalSidebarSplitPane",
83
+ description: "Portal sidebar split pane panel sizes",
84
+ expirationDescription: "1 year",
85
+ expirationMs: 365 * 24 * 60 * 60 * 1000,
86
+ type: "functional",
87
+ providerName: "CalmLens",
88
+ },
89
+ PORTAL_LAYOUT_SPLIT_PANE: {
90
+ name: "CL_portalLayoutSplitPane",
91
+ description: "Portal layout horizontal split pane panel sizes",
92
+ expirationDescription: "1 year",
93
+ expirationMs: 365 * 24 * 60 * 60 * 1000,
94
+ type: "functional",
95
+ providerName: "CalmLens",
96
+ },
97
+ };
98
+ export const THIRD_PARTY_COOKIES = {
99
+ STRIPE: {
100
+ name: "__stripe_mid",
101
+ description: "Payment processing",
102
+ expirationDescription: "Session",
103
+ type: "essential",
104
+ providerName: "Stripe",
105
+ },
106
+ };
107
+ export const PAYMENT_RETURN_TYPES = ["edit", "account", "settings", "subscription"];
108
+ export const PLAN_TYPES = ["plus", "pro"];
109
+ export const IS_BACKEND = typeof process === "undefined" || typeof WebSocketPair !== "undefined";
110
+ export const COOKIE_NEVER_EXPIRES = 60 * 60 * 24 * 365 * 10; // 10 years
111
+ export const DEFAULT_FIT = "contain";
112
+ export const MAX_IMAGE_UPLOAD_MB = 10;
113
+ export const MAX_IMAGE_UPLOAD_STRING = "10MB";
114
+ export const MAX_IMAGE_DIMENSION = 12000; // Cloudflare Images limit
115
+ export const MAX_IMAGE_UPLOAD_BYTES = MAX_IMAGE_UPLOAD_MB * 1024 * 1024; // 10MB
116
+ export const MAX_NON_IMAGE_UPLOAD_MB = 5000;
117
+ export const MAX_NON_IMAGE_UPLOAD_BYTES = MAX_NON_IMAGE_UPLOAD_MB * 1024 * 1024; // 5GB
118
+ export const MAX_NON_IMAGE_UPLOAD_STRING = "5GB";
119
+ export const IMPERSONATION_COOKIE_NAME = "CL_impersonation";
120
+ export const DOMAIN = "calmlens.com";
121
+ export const TITLE = "CalmLens";
122
+ export const BLURB = "AI-powered content moderation for safer online communities";
@@ -8,6 +8,11 @@ export type SubmitAssetOptions = ({
8
8
  }) & {
9
9
  name: string;
10
10
  description?: string;
11
- keepAfterProcessing?: boolean;
11
+ processingOptions?: {
12
+ keepAfterProcessing?: boolean;
13
+ image?: {
14
+ ocrEnabled?: boolean;
15
+ };
16
+ };
12
17
  visibility?: AssetVisibility;
13
18
  };
package/esm/User.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ import * as zod from "zod/v4";
2
+ export declare const USER_SCHEMA: zod.ZodObject<{
3
+ id: zod.ZodString;
4
+ createdAt: zod.ZodNumber;
5
+ updatedAt: zod.ZodOptional<zod.ZodNumber>;
6
+ email: zod.ZodOptional<zod.ZodNullable<zod.ZodPipe<zod.ZodString, zod.ZodTransform<string, string>>>>;
7
+ firstName: zod.ZodOptional<zod.ZodNullable<zod.ZodPipe<zod.ZodString, zod.ZodTransform<string, string>>>>;
8
+ lastName: zod.ZodOptional<zod.ZodNullable<zod.ZodPipe<zod.ZodString, zod.ZodTransform<string, string>>>>;
9
+ customerId: zod.ZodOptional<zod.ZodNullable<zod.ZodPipe<zod.ZodString, zod.ZodTransform<string, string>>>>;
10
+ roles: zod.ZodOptional<zod.ZodNullable<zod.ZodArray<zod.ZodEnum<{
11
+ "system:super-admin": "system:super-admin";
12
+ "system:banned": "system:banned";
13
+ "assets:view-all": "assets:view-all";
14
+ }>>>>;
15
+ freeUploadsUsed: zod.ZodOptional<zod.ZodNullable<zod.ZodNumber>>;
16
+ }, zod.z.core.$strip>;
17
+ export type User = zod.infer<typeof USER_SCHEMA>;