@calmlens/js-sdk 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/ApiKey.d.ts +31 -0
- package/cjs/ApiKey.js +59 -0
- package/cjs/Asset.d.ts +83 -3
- package/cjs/Asset.js +198 -28
- package/cjs/Auth.d.ts +95 -0
- package/cjs/Auth.js +2 -0
- package/cjs/CalmLensClient.d.ts +37 -11
- package/cjs/CalmLensClient.js +176 -77
- package/cjs/CalmLensTypes.d.ts +2 -0
- package/cjs/Classification.js +40 -7
- package/cjs/DocMetaTypes.d.ts +7 -0
- package/cjs/DocMetaTypes.js +7 -0
- package/cjs/Page.d.ts +42 -0
- package/cjs/Page.js +94 -0
- package/cjs/PublicApiSchemas.d.ts +1600 -0
- package/cjs/PublicApiSchemas.js +346 -0
- package/cjs/RequestInfo.d.ts +23 -0
- package/cjs/RequestInfo.js +2 -0
- package/cjs/Roles.d.ts +21 -0
- package/cjs/Roles.js +84 -0
- package/cjs/SharedConstants.d.ts +134 -0
- package/cjs/SharedConstants.js +125 -0
- package/cjs/SharedTypes.d.ts +6 -1
- package/cjs/User.d.ts +17 -0
- package/cjs/User.js +51 -0
- package/cjs/UtilTypes.d.ts +30 -0
- package/cjs/UtilTypes.js +4 -0
- package/cjs/Workflow.d.ts +58 -0
- package/cjs/Workflow.js +83 -0
- package/cjs/ZodUtils.d.ts +39 -0
- package/cjs/ZodUtils.js +328 -0
- package/cjs/index.js +4 -1
- package/esm/ApiKey.d.ts +31 -0
- package/esm/ApiKey.js +23 -0
- package/esm/Asset.d.ts +83 -3
- package/esm/Asset.js +148 -12
- package/esm/Auth.d.ts +95 -0
- package/esm/Auth.js +1 -0
- package/esm/CalmLensClient.d.ts +37 -11
- package/esm/CalmLensClient.js +134 -55
- package/esm/CalmLensTypes.d.ts +2 -0
- package/esm/Classification.js +1 -1
- package/esm/DocMetaTypes.d.ts +7 -0
- package/esm/DocMetaTypes.js +4 -0
- package/esm/Page.d.ts +42 -0
- package/esm/Page.js +55 -0
- package/esm/PublicApiSchemas.d.ts +1600 -0
- package/esm/PublicApiSchemas.js +310 -0
- package/esm/RequestInfo.d.ts +23 -0
- package/esm/RequestInfo.js +1 -0
- package/esm/Roles.d.ts +21 -0
- package/esm/Roles.js +45 -0
- package/esm/SharedConstants.d.ts +134 -0
- package/esm/SharedConstants.js +122 -0
- package/esm/SharedTypes.d.ts +6 -1
- package/esm/User.d.ts +17 -0
- package/esm/User.js +15 -0
- package/esm/UtilTypes.d.ts +30 -0
- package/esm/UtilTypes.js +1 -0
- package/esm/Workflow.d.ts +58 -0
- package/esm/Workflow.js +46 -0
- package/esm/ZodUtils.d.ts +39 -0
- package/esm/ZodUtils.js +266 -0
- package/package.json +10 -10
- package/cjs/SchemaUtils.d.ts +0 -11
- package/cjs/SchemaUtils.js +0 -63
- package/esm/SchemaUtils.d.ts +0 -11
- package/esm/SchemaUtils.js +0 -46
package/esm/Page.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as zod from "zod/v4";
|
|
2
|
+
import { metaStore } from "zod-meta";
|
|
3
|
+
import { docPropertyInfo } from "./DocMetaTypes";
|
|
4
|
+
export const DEFAULT_PAGE_SIZE = 10;
|
|
5
|
+
export const ORDER_SCHEMA = zod.object({
|
|
6
|
+
field: zod.string().meta(metaStore([
|
|
7
|
+
docPropertyInfo({
|
|
8
|
+
description: "The field name to order by",
|
|
9
|
+
placeholder: "createdAt",
|
|
10
|
+
}),
|
|
11
|
+
])),
|
|
12
|
+
direction: zod.enum(["ASC", "DESC"]).meta(metaStore([
|
|
13
|
+
docPropertyInfo({
|
|
14
|
+
description: "The sort direction",
|
|
15
|
+
defaultValue: "ASC",
|
|
16
|
+
}),
|
|
17
|
+
])),
|
|
18
|
+
});
|
|
19
|
+
export const PAGE_QUERY_SCHEMA = zod.object({
|
|
20
|
+
pageIndex: zod
|
|
21
|
+
.number()
|
|
22
|
+
.min(0)
|
|
23
|
+
.default(0)
|
|
24
|
+
.meta(metaStore([
|
|
25
|
+
docPropertyInfo({
|
|
26
|
+
description: "The zero-based page index",
|
|
27
|
+
defaultValue: "0",
|
|
28
|
+
}),
|
|
29
|
+
])),
|
|
30
|
+
pageSize: zod
|
|
31
|
+
.number()
|
|
32
|
+
.min(1)
|
|
33
|
+
.max(100)
|
|
34
|
+
.optional()
|
|
35
|
+
.meta(metaStore([
|
|
36
|
+
docPropertyInfo({
|
|
37
|
+
description: "Number of items per page (1-100)",
|
|
38
|
+
placeholder: "10",
|
|
39
|
+
}),
|
|
40
|
+
])),
|
|
41
|
+
ordering: zod
|
|
42
|
+
.array(ORDER_SCHEMA)
|
|
43
|
+
.optional()
|
|
44
|
+
.meta(metaStore([
|
|
45
|
+
docPropertyInfo({
|
|
46
|
+
description: "Array of field ordering specifications",
|
|
47
|
+
placeholder: '[{"field": "createdAt", "direction": "DESC"}]',
|
|
48
|
+
}),
|
|
49
|
+
])),
|
|
50
|
+
});
|
|
51
|
+
export const createPageSchema = (itemSchema) => PAGE_QUERY_SCHEMA.required().and(zod.object({
|
|
52
|
+
items: zod.array(itemSchema),
|
|
53
|
+
total: zod.number(),
|
|
54
|
+
hasMore: zod.boolean(),
|
|
55
|
+
}));
|