@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.
Files changed (68) hide show
  1. package/cjs/ApiKey.d.ts +31 -0
  2. package/cjs/ApiKey.js +59 -0
  3. package/cjs/Asset.d.ts +83 -3
  4. package/cjs/Asset.js +198 -28
  5. package/cjs/Auth.d.ts +95 -0
  6. package/cjs/Auth.js +2 -0
  7. package/cjs/CalmLensClient.d.ts +37 -11
  8. package/cjs/CalmLensClient.js +176 -77
  9. package/cjs/CalmLensTypes.d.ts +2 -0
  10. package/cjs/Classification.js +40 -7
  11. package/cjs/DocMetaTypes.d.ts +7 -0
  12. package/cjs/DocMetaTypes.js +7 -0
  13. package/cjs/Page.d.ts +42 -0
  14. package/cjs/Page.js +94 -0
  15. package/cjs/PublicApiSchemas.d.ts +1600 -0
  16. package/cjs/PublicApiSchemas.js +346 -0
  17. package/cjs/RequestInfo.d.ts +23 -0
  18. package/cjs/RequestInfo.js +2 -0
  19. package/cjs/Roles.d.ts +21 -0
  20. package/cjs/Roles.js +84 -0
  21. package/cjs/SharedConstants.d.ts +134 -0
  22. package/cjs/SharedConstants.js +125 -0
  23. package/cjs/SharedTypes.d.ts +6 -1
  24. package/cjs/User.d.ts +17 -0
  25. package/cjs/User.js +51 -0
  26. package/cjs/UtilTypes.d.ts +30 -0
  27. package/cjs/UtilTypes.js +4 -0
  28. package/cjs/Workflow.d.ts +58 -0
  29. package/cjs/Workflow.js +83 -0
  30. package/cjs/ZodUtils.d.ts +39 -0
  31. package/cjs/ZodUtils.js +328 -0
  32. package/cjs/index.js +4 -1
  33. package/esm/ApiKey.d.ts +31 -0
  34. package/esm/ApiKey.js +23 -0
  35. package/esm/Asset.d.ts +83 -3
  36. package/esm/Asset.js +148 -12
  37. package/esm/Auth.d.ts +95 -0
  38. package/esm/Auth.js +1 -0
  39. package/esm/CalmLensClient.d.ts +37 -11
  40. package/esm/CalmLensClient.js +134 -55
  41. package/esm/CalmLensTypes.d.ts +2 -0
  42. package/esm/Classification.js +1 -1
  43. package/esm/DocMetaTypes.d.ts +7 -0
  44. package/esm/DocMetaTypes.js +4 -0
  45. package/esm/Page.d.ts +42 -0
  46. package/esm/Page.js +55 -0
  47. package/esm/PublicApiSchemas.d.ts +1600 -0
  48. package/esm/PublicApiSchemas.js +310 -0
  49. package/esm/RequestInfo.d.ts +23 -0
  50. package/esm/RequestInfo.js +1 -0
  51. package/esm/Roles.d.ts +21 -0
  52. package/esm/Roles.js +45 -0
  53. package/esm/SharedConstants.d.ts +134 -0
  54. package/esm/SharedConstants.js +122 -0
  55. package/esm/SharedTypes.d.ts +6 -1
  56. package/esm/User.d.ts +17 -0
  57. package/esm/User.js +15 -0
  58. package/esm/UtilTypes.d.ts +30 -0
  59. package/esm/UtilTypes.js +1 -0
  60. package/esm/Workflow.d.ts +58 -0
  61. package/esm/Workflow.js +46 -0
  62. package/esm/ZodUtils.d.ts +39 -0
  63. package/esm/ZodUtils.js +266 -0
  64. package/package.json +10 -10
  65. package/cjs/SchemaUtils.d.ts +0 -11
  66. package/cjs/SchemaUtils.js +0 -63
  67. package/esm/SchemaUtils.d.ts +0 -11
  68. 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
+ }));