@synnaxlabs/client 0.35.0 → 0.36.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 (121) hide show
  1. package/.turbo/turbo-build.log +7 -7
  2. package/dist/client.cjs +28 -28
  3. package/dist/client.d.ts +35 -0
  4. package/dist/client.d.ts.map +1 -1
  5. package/dist/client.js +3078 -2955
  6. package/dist/control/state.d.ts.map +1 -1
  7. package/dist/framer/deleter.d.ts.map +1 -1
  8. package/dist/framer/frame.d.ts +14 -7
  9. package/dist/framer/frame.d.ts.map +1 -1
  10. package/dist/framer/writer.d.ts +8 -8
  11. package/dist/framer/writer.d.ts.map +1 -1
  12. package/dist/hardware/device/payload.d.ts +2 -2
  13. package/dist/hardware/device/payload.d.ts.map +1 -1
  14. package/dist/hardware/task/payload.d.ts +4 -4
  15. package/dist/hardware/task/payload.d.ts.map +1 -1
  16. package/dist/index.d.ts +1 -0
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/ontology/group/payload.d.ts +3 -0
  19. package/dist/ontology/group/payload.d.ts.map +1 -1
  20. package/dist/ranger/client.d.ts +1 -0
  21. package/dist/ranger/client.d.ts.map +1 -1
  22. package/dist/ranger/payload.d.ts.map +1 -1
  23. package/dist/ranger/writer.d.ts.map +1 -1
  24. package/dist/transport.d.ts +2 -1
  25. package/dist/transport.d.ts.map +1 -1
  26. package/dist/workspace/client.d.ts +68 -11
  27. package/dist/workspace/client.d.ts.map +1 -1
  28. package/dist/workspace/index.d.ts +1 -1
  29. package/dist/workspace/index.d.ts.map +1 -1
  30. package/dist/workspace/lineplot/client.d.ts +48 -6
  31. package/dist/workspace/lineplot/client.d.ts.map +1 -1
  32. package/dist/workspace/lineplot/index.d.ts +1 -1
  33. package/dist/workspace/lineplot/index.d.ts.map +1 -1
  34. package/dist/workspace/log/client.d.ts +48 -6
  35. package/dist/workspace/log/client.d.ts.map +1 -1
  36. package/dist/workspace/log/index.d.ts +1 -1
  37. package/dist/workspace/log/index.d.ts.map +1 -1
  38. package/dist/workspace/schematic/client.d.ts +72 -6
  39. package/dist/workspace/schematic/client.d.ts.map +1 -1
  40. package/dist/workspace/schematic/index.d.ts +1 -1
  41. package/dist/workspace/schematic/index.d.ts.map +1 -1
  42. package/dist/workspace/table/client.d.ts +61 -6
  43. package/dist/workspace/table/client.d.ts.map +1 -1
  44. package/dist/workspace/table/index.d.ts +1 -1
  45. package/dist/workspace/table/index.d.ts.map +1 -1
  46. package/package.json +9 -9
  47. package/src/client.ts +16 -2
  48. package/src/control/state.ts +1 -1
  49. package/src/framer/frame.spec.ts +32 -3
  50. package/src/framer/frame.ts +17 -0
  51. package/src/index.ts +1 -0
  52. package/src/ontology/group/payload.ts +8 -7
  53. package/src/ranger/client.ts +4 -1
  54. package/src/transport.ts +8 -3
  55. package/src/workspace/client.ts +148 -47
  56. package/src/workspace/index.ts +1 -1
  57. package/src/workspace/lineplot/client.ts +96 -28
  58. package/src/workspace/lineplot/index.ts +1 -1
  59. package/src/workspace/log/client.ts +93 -28
  60. package/src/workspace/log/index.ts +1 -1
  61. package/src/workspace/schematic/client.ts +121 -29
  62. package/src/workspace/schematic/index.ts +1 -1
  63. package/src/workspace/table/client.ts +102 -28
  64. package/src/workspace/table/index.ts +1 -1
  65. package/dist/workspace/external.d.ts +0 -3
  66. package/dist/workspace/external.d.ts.map +0 -1
  67. package/dist/workspace/lineplot/external.d.ts +0 -3
  68. package/dist/workspace/lineplot/external.d.ts.map +0 -1
  69. package/dist/workspace/lineplot/retriever.d.ts +0 -9
  70. package/dist/workspace/lineplot/retriever.d.ts.map +0 -1
  71. package/dist/workspace/lineplot/writer.d.ts +0 -35
  72. package/dist/workspace/lineplot/writer.d.ts.map +0 -1
  73. package/dist/workspace/log/external.d.ts +0 -3
  74. package/dist/workspace/log/external.d.ts.map +0 -1
  75. package/dist/workspace/log/payload.d.ts +0 -36
  76. package/dist/workspace/log/payload.d.ts.map +0 -1
  77. package/dist/workspace/log/retriever.d.ts +0 -9
  78. package/dist/workspace/log/retriever.d.ts.map +0 -1
  79. package/dist/workspace/log/writer.d.ts +0 -35
  80. package/dist/workspace/log/writer.d.ts.map +0 -1
  81. package/dist/workspace/payload.d.ts +0 -38
  82. package/dist/workspace/payload.d.ts.map +0 -1
  83. package/dist/workspace/retriever.d.ts +0 -13
  84. package/dist/workspace/retriever.d.ts.map +0 -1
  85. package/dist/workspace/schematic/external.d.ts +0 -3
  86. package/dist/workspace/schematic/external.d.ts.map +0 -1
  87. package/dist/workspace/schematic/payload.d.ts +0 -42
  88. package/dist/workspace/schematic/payload.d.ts.map +0 -1
  89. package/dist/workspace/schematic/retriever.d.ts +0 -9
  90. package/dist/workspace/schematic/retriever.d.ts.map +0 -1
  91. package/dist/workspace/schematic/writer.d.ts +0 -41
  92. package/dist/workspace/schematic/writer.d.ts.map +0 -1
  93. package/dist/workspace/table/external.d.ts +0 -3
  94. package/dist/workspace/table/external.d.ts.map +0 -1
  95. package/dist/workspace/table/payload.d.ts +0 -36
  96. package/dist/workspace/table/payload.d.ts.map +0 -1
  97. package/dist/workspace/table/retriever.d.ts +0 -8
  98. package/dist/workspace/table/retriever.d.ts.map +0 -1
  99. package/dist/workspace/table/writer.d.ts +0 -35
  100. package/dist/workspace/table/writer.d.ts.map +0 -1
  101. package/dist/workspace/writer.d.ts +0 -66
  102. package/dist/workspace/writer.d.ts.map +0 -1
  103. package/src/workspace/external.ts +0 -11
  104. package/src/workspace/lineplot/external.ts +0 -11
  105. package/src/workspace/lineplot/retriever.ts +0 -34
  106. package/src/workspace/lineplot/writer.ts +0 -115
  107. package/src/workspace/log/external.ts +0 -11
  108. package/src/workspace/log/payload.ts +0 -36
  109. package/src/workspace/log/retriever.ts +0 -38
  110. package/src/workspace/log/writer.ts +0 -116
  111. package/src/workspace/payload.ts +0 -44
  112. package/src/workspace/retriever.ts +0 -70
  113. package/src/workspace/schematic/external.ts +0 -11
  114. package/src/workspace/schematic/payload.ts +0 -38
  115. package/src/workspace/schematic/retriever.ts +0 -42
  116. package/src/workspace/schematic/writer.ts +0 -140
  117. package/src/workspace/table/external.ts +0 -11
  118. package/src/workspace/table/payload.ts +0 -36
  119. package/src/workspace/table/retriever.ts +0 -33
  120. package/src/workspace/table/writer.ts +0 -102
  121. package/src/workspace/writer.ts +0 -111
@@ -1,2 +1,2 @@
1
- export * as linePlot from './external';
1
+ export * as linePlot from './client';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/workspace/lineplot/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,QAAQ,MAAM,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/workspace/lineplot/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,QAAQ,MAAM,6BAA6B,CAAC"}
@@ -1,16 +1,58 @@
1
+ import { ontology } from '../../ontology';
1
2
  import { UnaryClient } from '@synnaxlabs/freighter';
2
- import { UnknownRecord } from '@synnaxlabs/x/record';
3
- import { Key, Log, Params } from './payload';
4
- import { NewLog } from './writer';
3
+ import { UnknownRecord } from '@synnaxlabs/x';
4
+ import { z } from 'zod';
5
+ export declare const keyZ: z.ZodString;
6
+ export type Key = z.infer<typeof keyZ>;
7
+ export type Params = Key | Key[];
8
+ export declare const logZ: z.ZodObject<{
9
+ key: z.ZodString;
10
+ name: z.ZodString;
11
+ data: z.ZodUnion<[z.ZodRecord<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodSymbol]>, z.ZodUnknown>, z.ZodEffects<z.ZodString, UnknownRecord, string>]>;
12
+ }, "strip", z.ZodTypeAny, {
13
+ name: string;
14
+ key: string;
15
+ data: UnknownRecord | Record<string | number | symbol, unknown>;
16
+ }, {
17
+ name: string;
18
+ key: string;
19
+ data: string | Record<string | number | symbol, unknown>;
20
+ }>;
21
+ export type Log = z.infer<typeof logZ>;
22
+ export declare const ONTOLOGY_TYPE: ontology.ResourceType;
23
+ export declare const ontologyID: (key: Key) => ontology.ID;
24
+ export declare const newLogZ: z.ZodEffects<z.ZodObject<{
25
+ name: z.ZodString;
26
+ key: z.ZodOptional<z.ZodString>;
27
+ data: z.ZodUnion<[z.ZodRecord<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodSymbol]>, z.ZodUnknown>, z.ZodEffects<z.ZodString, UnknownRecord, string>]>;
28
+ }, "strip", z.ZodTypeAny, {
29
+ name: string;
30
+ data: UnknownRecord | Record<string | number | symbol, unknown>;
31
+ key?: string | undefined;
32
+ }, {
33
+ name: string;
34
+ data: string | Record<string | number | symbol, unknown>;
35
+ key?: string | undefined;
36
+ }>, {
37
+ data: string;
38
+ name: string;
39
+ key?: string | undefined;
40
+ }, {
41
+ name: string;
42
+ data: string | Record<string | number | symbol, unknown>;
43
+ key?: string | undefined;
44
+ }>;
45
+ export type NewLog = z.input<typeof newLogZ>;
5
46
  export declare class Client {
6
- private readonly writer;
7
- private readonly retriever;
47
+ private readonly client;
8
48
  constructor(client: UnaryClient);
9
49
  create(workspace: string, log: NewLog): Promise<Log>;
50
+ create(workspace: string, logs: NewLog[]): Promise<Log[]>;
10
51
  rename(key: Key, name: string): Promise<void>;
11
52
  setData(key: Key, data: UnknownRecord): Promise<void>;
12
53
  retrieve(key: Key): Promise<Log>;
13
54
  retrieve(keys: Key[]): Promise<Log[]>;
14
- delete(keys: Params): Promise<void>;
55
+ delete(key: Key): Promise<void>;
56
+ delete(keys: Key[]): Promise<void>;
15
57
  }
16
58
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/workspace/log/client.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,GAAG,EAAE,KAAK,MAAM,EAAE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AAG,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAEvC,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,YAAoB,CAAC;AAE1D,eAAO,MAAM,UAAU,QAAS,GAAG,KAAG,QAAQ,CAAC,EACA,CAAC;AAQhD,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;EAGjB,CAAC;AAEJ,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;AAY7C,qBAAa,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,MAAM,EAAE,WAAW;IAIzB,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IACpD,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAczD,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAU7C,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAUrD,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAcrC,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAC/B,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAWzC"}
@@ -1,2 +1,2 @@
1
- export * as log from './external';
1
+ export * as log from './client';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/workspace/log/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,GAAG,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/workspace/log/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,GAAG,MAAM,wBAAwB,CAAC"}
@@ -1,17 +1,83 @@
1
+ import { ontology } from '../../ontology';
1
2
  import { UnaryClient } from '@synnaxlabs/freighter';
2
- import { UnknownRecord } from '@synnaxlabs/x/record';
3
- import { Key, Params, Schematic } from './payload';
4
- import { NewSchematic } from './writer';
3
+ import { UnknownRecord } from '@synnaxlabs/x';
4
+ import { z } from 'zod';
5
+ export declare const keyZ: z.ZodString;
6
+ export type Key = z.infer<typeof keyZ>;
7
+ export type Params = Key | Key[];
8
+ export declare const schematicZ: z.ZodObject<{
9
+ key: z.ZodString;
10
+ name: z.ZodString;
11
+ data: z.ZodUnion<[z.ZodRecord<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodSymbol]>, z.ZodUnknown>, z.ZodEffects<z.ZodString, UnknownRecord, string>]>;
12
+ snapshot: z.ZodBoolean;
13
+ }, "strip", z.ZodTypeAny, {
14
+ name: string;
15
+ key: string;
16
+ data: UnknownRecord | Record<string | number | symbol, unknown>;
17
+ snapshot: boolean;
18
+ }, {
19
+ name: string;
20
+ key: string;
21
+ data: string | Record<string | number | symbol, unknown>;
22
+ snapshot: boolean;
23
+ }>;
24
+ export declare const schematicRemoteZ: z.ZodObject<{
25
+ key: z.ZodString;
26
+ name: z.ZodString;
27
+ snapshot: z.ZodBoolean;
28
+ data: z.ZodEffects<z.ZodString, UnknownRecord, string>;
29
+ }, "strip", z.ZodTypeAny, {
30
+ name: string;
31
+ key: string;
32
+ data: UnknownRecord;
33
+ snapshot: boolean;
34
+ }, {
35
+ name: string;
36
+ key: string;
37
+ data: string;
38
+ snapshot: boolean;
39
+ }>;
40
+ export type Schematic = z.infer<typeof schematicZ>;
41
+ export declare const ONTOLOGY_TYPE: ontology.ResourceType;
42
+ export declare const ontologyID: (key: Key) => ontology.ID;
43
+ export declare const newSchematicZ: z.ZodEffects<z.ZodObject<{
44
+ name: z.ZodString;
45
+ key: z.ZodOptional<z.ZodString>;
46
+ data: z.ZodUnion<[z.ZodRecord<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodSymbol]>, z.ZodUnknown>, z.ZodEffects<z.ZodString, UnknownRecord, string>]>;
47
+ snapshot: z.ZodOptional<z.ZodBoolean>;
48
+ }, "strip", z.ZodTypeAny, {
49
+ name: string;
50
+ data: UnknownRecord | Record<string | number | symbol, unknown>;
51
+ key?: string | undefined;
52
+ snapshot?: boolean | undefined;
53
+ }, {
54
+ name: string;
55
+ data: string | Record<string | number | symbol, unknown>;
56
+ key?: string | undefined;
57
+ snapshot?: boolean | undefined;
58
+ }>, {
59
+ data: string;
60
+ name: string;
61
+ key?: string | undefined;
62
+ snapshot?: boolean | undefined;
63
+ }, {
64
+ name: string;
65
+ data: string | Record<string | number | symbol, unknown>;
66
+ key?: string | undefined;
67
+ snapshot?: boolean | undefined;
68
+ }>;
69
+ export type NewSchematic = z.input<typeof newSchematicZ>;
5
70
  export declare class Client {
6
- private readonly writer;
7
- private readonly retriever;
71
+ private readonly client;
8
72
  constructor(client: UnaryClient);
9
73
  create(workspace: string, schematic: NewSchematic): Promise<Schematic>;
74
+ create(workspace: string, schematics: NewSchematic[]): Promise<Schematic[]>;
10
75
  rename(key: Key, name: string): Promise<void>;
11
76
  setData(key: Key, data: UnknownRecord): Promise<void>;
12
77
  retrieve(key: Key): Promise<Schematic>;
13
78
  retrieve(keys: Key[]): Promise<Schematic[]>;
14
- delete(keys: Params): Promise<void>;
79
+ delete(key: Key): Promise<void>;
80
+ delete(keys: Key[]): Promise<void>;
15
81
  copy(key: Key, name: string, snapshot: boolean): Promise<Schematic>;
16
82
  }
17
83
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/workspace/sch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AAO,CAAC,SAAS,CAAC;IACtC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAc3C,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAC/B,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAYlC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;CAU1E"}
@@ -1,2 +1,2 @@
1
- export * as schematic from './external';
1
+ export * as schematic from './client';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/workspace/schematic/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,SAAS,MAAM,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/workspace/schematic/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,SAAS,MAAM,8BAA8B,CAAC"}
@@ -1,16 +1,71 @@
1
+ import { ontology } from '../../ontology';
1
2
  import { UnaryClient } from '@synnaxlabs/freighter';
2
- import { UnknownRecord } from '@synnaxlabs/x/record';
3
- import { Key, Params, Table } from './payload';
4
- import { NewTable } from './writer';
3
+ import { UnknownRecord } from '@synnaxlabs/x';
4
+ import { z } from 'zod';
5
+ export declare const keyZ: z.ZodString;
6
+ export type Key = z.infer<typeof keyZ>;
7
+ export type Params = Key | Key[];
8
+ export declare const tableZ: z.ZodObject<{
9
+ key: z.ZodString;
10
+ name: z.ZodString;
11
+ data: z.ZodUnion<[z.ZodRecord<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodSymbol]>, z.ZodUnknown>, z.ZodEffects<z.ZodString, UnknownRecord, string>]>;
12
+ }, "strip", z.ZodTypeAny, {
13
+ name: string;
14
+ key: string;
15
+ data: UnknownRecord | Record<string | number | symbol, unknown>;
16
+ }, {
17
+ name: string;
18
+ key: string;
19
+ data: string | Record<string | number | symbol, unknown>;
20
+ }>;
21
+ export type Table = z.infer<typeof tableZ>;
22
+ export declare const ONTOLOGY_TYPE: ontology.ResourceType;
23
+ export declare const ontologyID: (key: Key) => ontology.ID;
24
+ export declare const newTableZ: z.ZodEffects<z.ZodObject<{
25
+ name: z.ZodString;
26
+ key: z.ZodOptional<z.ZodString>;
27
+ data: z.ZodUnion<[z.ZodRecord<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodSymbol]>, z.ZodUnknown>, z.ZodEffects<z.ZodString, UnknownRecord, string>]>;
28
+ }, "strip", z.ZodTypeAny, {
29
+ name: string;
30
+ data: UnknownRecord | Record<string | number | symbol, unknown>;
31
+ key?: string | undefined;
32
+ }, {
33
+ name: string;
34
+ data: string | Record<string | number | symbol, unknown>;
35
+ key?: string | undefined;
36
+ }>, {
37
+ data: string;
38
+ name: string;
39
+ key?: string | undefined;
40
+ }, {
41
+ name: string;
42
+ data: string | Record<string | number | symbol, unknown>;
43
+ key?: string | undefined;
44
+ }>;
45
+ export type NewTable = z.input<typeof newTableZ>;
46
+ export declare const tableRemoteZ: z.ZodObject<{
47
+ key: z.ZodString;
48
+ name: z.ZodString;
49
+ data: z.ZodEffects<z.ZodString, UnknownRecord, string>;
50
+ }, "strip", z.ZodTypeAny, {
51
+ name: string;
52
+ key: string;
53
+ data: UnknownRecord;
54
+ }, {
55
+ name: string;
56
+ key: string;
57
+ data: string;
58
+ }>;
5
59
  export declare class Client {
6
- private readonly writer;
7
- private readonly retriever;
60
+ private readonly client;
8
61
  constructor(client: UnaryClient);
9
62
  create(workspace: string, table: NewTable): Promise<Table>;
63
+ create(workspace: string, tables: NewTable[]): Promise<Table[]>;
10
64
  rename(key: Key, name: string): Promise<void>;
11
65
  setData(key: Key, data: UnknownRecord): Promise<void>;
12
66
  retrieve(key: Key): Promise<Table>;
13
67
  retrieve(keys: Key[]): Promise<Table[]>;
14
- delete(keys: Params): Promise<void>;
68
+ delete(key: Key): Promise<void>;
69
+ delete(keys: Key[]): Promise<void>;
15
70
  }
16
71
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/workspace/table/client.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,MAAM,EAAE,KAAK,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAE9E,OAAO,EAAE,KAAK,QAAQ,EAAU,MAAM,0BAA0B,CAAC;AAEjE,qBAAa,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;gBAE1B,MAAM,EAAE,WAAW;IAKzB,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC;IAI1D,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7C,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrD,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC;IAElC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAQvC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG1C"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/workspace/table/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,Y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AAO,CAAC,IAAI,CAAC;IAUrD,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAcvC,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAC/B,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAWzC"}
@@ -1,2 +1,2 @@
1
- export * as table from './external';
1
+ export * as table from './client';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/workspace/table/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,KAAK,MAAM,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/workspace/table/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synnaxlabs/client",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
4
  "description": "The Synnax Client Library",
5
5
  "keywords": [
6
6
  "synnax",
@@ -25,21 +25,21 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "async-mutex": "^0.5.0",
28
- "zod": "^3.23.8",
29
- "@synnaxlabs/x": "0.35.0",
30
- "@synnaxlabs/freighter": "0.35.0"
28
+ "zod": "^3.24.1",
29
+ "@synnaxlabs/x": "0.36.0",
30
+ "@synnaxlabs/freighter": "0.36.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "^22.7.5",
34
34
  "@types/uuid": "^10.0.0",
35
- "@vitest/coverage-v8": "^2.1.4",
36
- "eslint": "^9.14.0",
35
+ "@vitest/coverage-v8": "^2.1.8",
36
+ "eslint": "^9.16.0",
37
37
  "typescript": "^5.6.3",
38
38
  "uuid": "^10.0.0",
39
- "vite": "^5.4.10",
40
- "vitest": "^2.1.4",
41
- "eslint-config-synnaxlabs": "0.0.1",
39
+ "vite": "^6.0.3",
40
+ "vitest": "^2.1.8",
42
41
  "@synnaxlabs/tsconfig": "0.0.2",
42
+ "eslint-config-synnaxlabs": "0.0.1",
43
43
  "@synnaxlabs/vite-plugin": "0.0.1"
44
44
  },
45
45
  "type": "module",
package/src/client.ts CHANGED
@@ -28,6 +28,7 @@ import { ranger } from "@/ranger";
28
28
  import { Transport } from "@/transport";
29
29
  import { user } from "@/user";
30
30
  import { workspace } from "@/workspace";
31
+ import { breaker } from "@synnaxlabs/x";
31
32
 
32
33
  export const synnaxPropsZ = z.object({
33
34
  host: z
@@ -49,6 +50,7 @@ export const synnaxPropsZ = z.object({
49
50
  connectivityPollFrequency: TimeSpan.z.default(TimeSpan.seconds(30)),
50
51
  secure: z.boolean().optional().default(false),
51
52
  name: z.string().optional(),
53
+ retry: breaker.breakerConfig.optional(),
52
54
  });
53
55
 
54
56
  export type SynnaxProps = z.input<typeof synnaxPropsZ>;
@@ -101,8 +103,20 @@ export default class Synnax extends framer.Client {
101
103
  */
102
104
  constructor(props_: SynnaxProps) {
103
105
  const props = synnaxPropsZ.parse(props_);
104
- const { host, port, username, password, connectivityPollFrequency, secure } = props;
105
- const transport = new Transport(new URL({ host, port: Number(port) }), secure);
106
+ const {
107
+ host,
108
+ port,
109
+ username,
110
+ password,
111
+ connectivityPollFrequency,
112
+ secure,
113
+ retry: breaker,
114
+ } = props;
115
+ const transport = new Transport(
116
+ new URL({ host, port: Number(port) }),
117
+ breaker,
118
+ secure,
119
+ );
106
120
  transport.use(errorsMiddleware);
107
121
  let auth_: auth.Client | undefined;
108
122
  if (username != null && password != null) {
@@ -47,7 +47,7 @@ export class StateTracker
47
47
 
48
48
  constructor(streamer: FrameStreamer) {
49
49
  super(streamer, (frame) => {
50
- const update: Update = this.codec.decode(frame.series[0].data);
50
+ const update: Update = this.codec.decode(frame.series[0].buffer);
51
51
  this.merge(update);
52
52
  return [update.transfers, true];
53
53
  });
@@ -11,6 +11,7 @@ import { DataType, Series, TimeRange } from "@synnaxlabs/x/telem";
11
11
  import { describe, expect, it, test } from "vitest";
12
12
 
13
13
  import { framer } from "@/framer";
14
+ import { equal } from "assert";
14
15
 
15
16
  describe("framer.Frame", () => {
16
17
  describe("construction", () => {
@@ -79,9 +80,7 @@ describe("framer.Frame", () => {
79
80
  it("should correctly parse a series payload", () => {
80
81
  const f = new framer.Frame({
81
82
  keys: [12],
82
- series: [
83
- { dataType: new DataType("float32"), data: new SharedArrayBuffer(12) },
84
- ],
83
+ series: [{ dataType: new DataType("float32"), data: new ArrayBuffer(12) }],
85
84
  });
86
85
  expect(f.length.valueOf()).toEqual(3);
87
86
  expect(f.columns.length).toEqual(1);
@@ -515,4 +514,34 @@ describe("framer.Frame", () => {
515
514
  expect(f.at(2)).toEqual({ 12: 3, 13: undefined });
516
515
  });
517
516
  });
517
+
518
+ describe("digest", () => {
519
+ it("should return digest information about the frame", () => {
520
+ const s1 = new Series({
521
+ data: new Float32Array([1, 2, 3]),
522
+ timeRange: new TimeRange(40, 50000),
523
+ });
524
+ const s2 = new Series({
525
+ data: new Float32Array([4, 5, 6]),
526
+ timeRange: new TimeRange(50001, 60000),
527
+ });
528
+ const s3 = new Series({
529
+ data: new Float32Array([7, 8, 9]),
530
+ timeRange: new TimeRange(500, 50001),
531
+ });
532
+ const f = new framer.Frame(
533
+ new Map([
534
+ [12, [s1, s2]],
535
+ [13, [s3]],
536
+ ]),
537
+ );
538
+ const digest = f.digest;
539
+ expect(Object.keys(digest)).toEqual(["12", "13"]);
540
+ expect(digest[12].length).toEqual(2);
541
+ expect(digest[13].length).toEqual(1);
542
+ expect(digest[12][0]).toEqual(s1.digest);
543
+ expect(digest[12][1]).toEqual(s2.digest);
544
+ expect(digest[13][0]).toEqual(s3.digest);
545
+ });
546
+ });
518
547
  });
@@ -10,6 +10,7 @@
10
10
  import {
11
11
  MultiSeries,
12
12
  Series,
13
+ SeriesDigest,
13
14
  type SeriesPayload,
14
15
  Size,
15
16
  type TelemValue,
@@ -31,6 +32,8 @@ import { UnexpectedError, ValidationError } from "@/errors";
31
32
 
32
33
  type ColumnType = "key" | "name" | null;
33
34
 
35
+ export interface FrameDigest extends Record<KeyOrName, SeriesDigest[]> {}
36
+
34
37
  const columnType = (columns: Params): ColumnType => {
35
38
  const arrKeys = toArray(columns);
36
39
  if (arrKeys.length === 0) return null;
@@ -392,6 +395,20 @@ export class Frame {
392
395
  return new Size(this.series.reduce((acc, v) => acc.add(v.byteLength), Size.ZERO));
393
396
  }
394
397
 
398
+ /**
399
+ * @returns a digest of information about the structure of the frame for debugging
400
+ * purposes.
401
+ */
402
+ get digest(): FrameDigest {
403
+ const digest: FrameDigest = {};
404
+ this.keys.forEach((k, i) => {
405
+ const sd = this.series[i].digest;
406
+ if (k in digest) digest[k].push(sd);
407
+ else digest[k] = [sd];
408
+ });
409
+ return digest;
410
+ }
411
+
395
412
  /** @returns the total number of samples in the frame. */
396
413
  get length(): number {
397
414
  return this.series.reduce((acc, v) => acc + v.length, 0);
package/src/index.ts CHANGED
@@ -32,6 +32,7 @@ export { rack } from "@/hardware/rack";
32
32
  export { task } from "@/hardware/task";
33
33
  export { label } from "@/label";
34
34
  export { ontology } from "@/ontology";
35
+ export { group } from "@/ontology/group";
35
36
  export { ranger } from "@/ranger";
36
37
  export { signals } from "@/signals";
37
38
  export { user } from "@/user";
@@ -9,6 +9,7 @@
9
9
 
10
10
  import { toArray } from "@synnaxlabs/x/toArray";
11
11
  import { z } from "zod";
12
+ import { ontology } from "@/ontology";
12
13
 
13
14
  export const keyZ = z.string().uuid();
14
15
  export type Key = z.infer<typeof keyZ>;
@@ -17,10 +18,7 @@ export type Keys = Key[];
17
18
  export type Names = Name[];
18
19
  export type Params = Key | Name | Keys | Names;
19
20
 
20
- export const groupZ = z.object({
21
- key: keyZ,
22
- name: z.string(),
23
- });
21
+ export const groupZ = z.object({ key: keyZ, name: z.string() });
24
22
 
25
23
  export type Payload = z.infer<typeof groupZ>;
26
24
 
@@ -52,9 +50,7 @@ export type ParamAnalysisResult =
52
50
 
53
51
  export const analyzeParams = (groups: Params): ParamAnalysisResult => {
54
52
  const normal = toArray(groups) as Keys | Names;
55
- if (normal.length === 0)
56
- throw new Error("No groups specified");
57
-
53
+ if (normal.length === 0) throw new Error("No groups specified");
58
54
  const isKey = keyZ.safeParse(normal[0]).success;
59
55
  return {
60
56
  single: !Array.isArray(groups),
@@ -63,3 +59,8 @@ export const analyzeParams = (groups: Params): ParamAnalysisResult => {
63
59
  actual: groups,
64
60
  } as const as ParamAnalysisResult;
65
61
  };
62
+
63
+ export const ONTOLOGY_TYPE: ontology.ResourceType = "group";
64
+
65
+ export const ontologyID = (key: Key): ontology.ID =>
66
+ new ontology.ID({ type: ONTOLOGY_TYPE, key });
@@ -8,7 +8,7 @@
8
8
  // included in the file licenses/APL.txt.
9
9
 
10
10
  import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
11
- import { type CrudeTimeRange, observe, TimeRange } from "@synnaxlabs/x";
11
+ import { type CrudeTimeRange, observe, sortTimeRange, TimeRange } from "@synnaxlabs/x";
12
12
  import { type AsyncTermSearcher } from "@synnaxlabs/x/search";
13
13
  import { type Series } from "@synnaxlabs/x/telem";
14
14
  import { toArray } from "@synnaxlabs/x/toArray";
@@ -192,6 +192,9 @@ export class Range {
192
192
  }
193
193
  }
194
194
 
195
+ export const sort = (a: Range, b: Range): -1 | 0 | 1 =>
196
+ sortTimeRange(a.timeRange, b.timeRange);
197
+
195
198
  const retrieveReqZ = z.object({
196
199
  keys: keyZ.array().optional(),
197
200
  names: z.array(z.string()).optional(),
package/src/transport.ts CHANGED
@@ -12,8 +12,10 @@ import {
12
12
  type Middleware,
13
13
  type StreamClient,
14
14
  type UnaryClient,
15
+ unaryWithBreaker,
15
16
  WebSocketClient,
16
17
  } from "@synnaxlabs/freighter";
18
+ import { breaker } from "@synnaxlabs/x";
17
19
  import { binary } from "@synnaxlabs/x/binary";
18
20
  import { type URL } from "@synnaxlabs/x/url";
19
21
 
@@ -25,12 +27,15 @@ export class Transport {
25
27
  readonly stream: StreamClient;
26
28
  readonly secure: boolean;
27
29
 
28
- constructor(url: URL, secure: boolean = false) {
30
+ constructor(url: URL, breakerCfg: breaker.Config = {}, secure: boolean = false) {
29
31
  this.secure = secure;
30
32
  this.url = url.child(baseAPIEndpoint);
31
33
  const codec = new binary.JSONCodec();
32
- this.unary = new HTTPClient(this.url, codec, this.secure);
33
- this.stream = new WebSocketClient(this.url, codec, this.secure);
34
+ (this.unary = unaryWithBreaker(
35
+ new HTTPClient(this.url, codec, this.secure),
36
+ breakerCfg,
37
+ )),
38
+ (this.stream = new WebSocketClient(this.url, codec, this.secure));
34
39
  }
35
40
 
36
41
  use(...middleware: Middleware[]): void {