@synnaxlabs/client 0.35.0 → 0.37.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 (122) 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 +3125 -2990
  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 +13 -13
  47. package/src/client.ts +16 -2
  48. package/src/control/state.ts +1 -1
  49. package/src/framer/frame.spec.ts +31 -3
  50. package/src/framer/frame.ts +17 -0
  51. package/src/framer/streamer.spec.ts +15 -6
  52. package/src/index.ts +1 -0
  53. package/src/ontology/group/payload.ts +9 -7
  54. package/src/ranger/client.ts +4 -1
  55. package/src/transport.ts +7 -2
  56. package/src/workspace/client.ts +147 -45
  57. package/src/workspace/index.ts +1 -1
  58. package/src/workspace/lineplot/client.ts +97 -28
  59. package/src/workspace/lineplot/index.ts +1 -1
  60. package/src/workspace/log/client.ts +94 -28
  61. package/src/workspace/log/index.ts +1 -1
  62. package/src/workspace/schematic/client.ts +122 -29
  63. package/src/workspace/schematic/index.ts +1 -1
  64. package/src/workspace/table/client.ts +103 -28
  65. package/src/workspace/table/index.ts +1 -1
  66. package/dist/workspace/external.d.ts +0 -3
  67. package/dist/workspace/external.d.ts.map +0 -1
  68. package/dist/workspace/lineplot/external.d.ts +0 -3
  69. package/dist/workspace/lineplot/external.d.ts.map +0 -1
  70. package/dist/workspace/lineplot/retriever.d.ts +0 -9
  71. package/dist/workspace/lineplot/retriever.d.ts.map +0 -1
  72. package/dist/workspace/lineplot/writer.d.ts +0 -35
  73. package/dist/workspace/lineplot/writer.d.ts.map +0 -1
  74. package/dist/workspace/log/external.d.ts +0 -3
  75. package/dist/workspace/log/external.d.ts.map +0 -1
  76. package/dist/workspace/log/payload.d.ts +0 -36
  77. package/dist/workspace/log/payload.d.ts.map +0 -1
  78. package/dist/workspace/log/retriever.d.ts +0 -9
  79. package/dist/workspace/log/retriever.d.ts.map +0 -1
  80. package/dist/workspace/log/writer.d.ts +0 -35
  81. package/dist/workspace/log/writer.d.ts.map +0 -1
  82. package/dist/workspace/payload.d.ts +0 -38
  83. package/dist/workspace/payload.d.ts.map +0 -1
  84. package/dist/workspace/retriever.d.ts +0 -13
  85. package/dist/workspace/retriever.d.ts.map +0 -1
  86. package/dist/workspace/schematic/external.d.ts +0 -3
  87. package/dist/workspace/schematic/external.d.ts.map +0 -1
  88. package/dist/workspace/schematic/payload.d.ts +0 -42
  89. package/dist/workspace/schematic/payload.d.ts.map +0 -1
  90. package/dist/workspace/schematic/retriever.d.ts +0 -9
  91. package/dist/workspace/schematic/retriever.d.ts.map +0 -1
  92. package/dist/workspace/schematic/writer.d.ts +0 -41
  93. package/dist/workspace/schematic/writer.d.ts.map +0 -1
  94. package/dist/workspace/table/external.d.ts +0 -3
  95. package/dist/workspace/table/external.d.ts.map +0 -1
  96. package/dist/workspace/table/payload.d.ts +0 -36
  97. package/dist/workspace/table/payload.d.ts.map +0 -1
  98. package/dist/workspace/table/retriever.d.ts +0 -8
  99. package/dist/workspace/table/retriever.d.ts.map +0 -1
  100. package/dist/workspace/table/writer.d.ts +0 -35
  101. package/dist/workspace/table/writer.d.ts.map +0 -1
  102. package/dist/workspace/writer.d.ts +0 -66
  103. package/dist/workspace/writer.d.ts.map +0 -1
  104. package/src/workspace/external.ts +0 -11
  105. package/src/workspace/lineplot/external.ts +0 -11
  106. package/src/workspace/lineplot/retriever.ts +0 -34
  107. package/src/workspace/lineplot/writer.ts +0 -115
  108. package/src/workspace/log/external.ts +0 -11
  109. package/src/workspace/log/payload.ts +0 -36
  110. package/src/workspace/log/retriever.ts +0 -38
  111. package/src/workspace/log/writer.ts +0 -116
  112. package/src/workspace/payload.ts +0 -44
  113. package/src/workspace/retriever.ts +0 -70
  114. package/src/workspace/schematic/external.ts +0 -11
  115. package/src/workspace/schematic/payload.ts +0 -38
  116. package/src/workspace/schematic/retriever.ts +0 -42
  117. package/src/workspace/schematic/writer.ts +0 -140
  118. package/src/workspace/table/external.ts +0 -11
  119. package/src/workspace/table/payload.ts +0 -36
  120. package/src/workspace/table/retriever.ts +0 -33
  121. package/src/workspace/table/writer.ts +0 -102
  122. package/src/workspace/writer.ts +0 -111
@@ -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
1
  import { UnaryClient } from '@synnaxlabs/freighter';
2
- import { UnknownRecord } from '@synnaxlabs/x/record';
3
- import { Key, Log, Params } from './payload';
4
- import { NewLog } from './writer';
2
+ import { UnknownRecord } from '@synnaxlabs/x';
3
+ import { z } from 'zod';
4
+ import { ontology } from '../../ontology';
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,MAAM,yBAAyB,CAAC;AAE1E,OAAO,EAAE,KAAK,MAAM,EAA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AI,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
1
  import { UnaryClient } from '@synnaxlabs/freighter';
2
- import { UnknownRecord } from '@synnaxlabs/x/record';
3
- import { Key, Params, Schematic } from './payload';
4
- import { NewSchematic } from './writer';
2
+ import { UnknownRecord } from '@synnaxlabs/x';
3
+ import { z } from 'zod';
4
+ import { ontology } from '../../ontology';
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/schematic/client.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KA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AQ,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
1
  import { UnaryClient } from '@synnaxlabs/freighter';
2
- import { UnknownRecord } from '@synnaxlabs/x/record';
3
- import { Key, Params, Table } from './payload';
4
- import { NewTable } from './writer';
2
+ import { UnknownRecord } from '@synnaxlabs/x';
3
+ import { z } from 'zod';
4
+ import { ontology } from '../../ontology';
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,EAAgB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,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AAC;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.37.0",
4
4
  "description": "The Synnax Client Library",
5
5
  "keywords": [
6
6
  "synnax",
@@ -25,22 +25,22 @@
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
+ "uuid": "^11.0.3",
29
+ "zod": "^3.24.1",
30
+ "@synnaxlabs/x": "0.37.0",
31
+ "@synnaxlabs/freighter": "0.37.0"
31
32
  },
32
33
  "devDependencies": {
33
- "@types/node": "^22.7.5",
34
+ "@types/node": "^22.10.2",
34
35
  "@types/uuid": "^10.0.0",
35
- "@vitest/coverage-v8": "^2.1.4",
36
- "eslint": "^9.14.0",
37
- "typescript": "^5.6.3",
38
- "uuid": "^10.0.0",
39
- "vite": "^5.4.10",
40
- "vitest": "^2.1.4",
41
- "eslint-config-synnaxlabs": "0.0.1",
36
+ "@vitest/coverage-v8": "^2.1.8",
37
+ "eslint": "^9.17.0",
38
+ "typescript": "^5.7.2",
39
+ "vite": "^6.0.3",
40
+ "vitest": "^2.1.8",
42
41
  "@synnaxlabs/tsconfig": "0.0.2",
43
- "@synnaxlabs/vite-plugin": "0.0.1"
42
+ "@synnaxlabs/vite-plugin": "0.0.1",
43
+ "eslint-config-synnaxlabs": "0.0.1"
44
44
  },
45
45
  "type": "module",
46
46
  "types": "dist/index.d.ts",
package/src/client.ts CHANGED
@@ -7,6 +7,7 @@
7
7
  // License, use of this software will be governed by the Apache License, Version 2.0,
8
8
  // included in the file licenses/APL.txt.
9
9
 
10
+ import { breaker } from "@synnaxlabs/x";
10
11
  import { TimeSpan, TimeStamp } from "@synnaxlabs/x/telem";
11
12
  import { URL } from "@synnaxlabs/x/url";
12
13
  import { z } from "zod";
@@ -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
  });
@@ -79,9 +79,7 @@ describe("framer.Frame", () => {
79
79
  it("should correctly parse a series payload", () => {
80
80
  const f = new framer.Frame({
81
81
  keys: [12],
82
- series: [
83
- { dataType: new DataType("float32"), data: new SharedArrayBuffer(12) },
84
- ],
82
+ series: [{ dataType: new DataType("float32"), data: new ArrayBuffer(12) }],
85
83
  });
86
84
  expect(f.length.valueOf()).toEqual(3);
87
85
  expect(f.columns.length).toEqual(1);
@@ -515,4 +513,34 @@ describe("framer.Frame", () => {
515
513
  expect(f.at(2)).toEqual({ 12: 3, 13: undefined });
516
514
  });
517
515
  });
516
+
517
+ describe("digest", () => {
518
+ it("should return digest information about the frame", () => {
519
+ const s1 = new Series({
520
+ data: new Float32Array([1, 2, 3]),
521
+ timeRange: new TimeRange(40, 50000),
522
+ });
523
+ const s2 = new Series({
524
+ data: new Float32Array([4, 5, 6]),
525
+ timeRange: new TimeRange(50001, 60000),
526
+ });
527
+ const s3 = new Series({
528
+ data: new Float32Array([7, 8, 9]),
529
+ timeRange: new TimeRange(500, 50001),
530
+ });
531
+ const f = new framer.Frame(
532
+ new Map([
533
+ [12, [s1, s2]],
534
+ [13, [s3]],
535
+ ]),
536
+ );
537
+ const digest = f.digest;
538
+ expect(Object.keys(digest)).toEqual(["12", "13"]);
539
+ expect(digest[12].length).toEqual(2);
540
+ expect(digest[13].length).toEqual(1);
541
+ expect(digest[12][0]).toEqual(s1.digest);
542
+ expect(digest[12][1]).toEqual(s2.digest);
543
+ expect(digest[13][0]).toEqual(s3.digest);
544
+ });
545
+ });
518
546
  });
@@ -10,6 +10,7 @@
10
10
  import {
11
11
  MultiSeries,
12
12
  Series,
13
+ type 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);
@@ -52,7 +52,10 @@ describe("Streamer", () => {
52
52
  });
53
53
  test("downsample factor of 1", async () => {
54
54
  const ch = await newChannel();
55
- const streamer = await client.openStreamer({channels: ch.key, downsampleFactor: 1});
55
+ const streamer = await client.openStreamer({
56
+ channels: ch.key,
57
+ downsampleFactor: 1,
58
+ });
56
59
  await new Promise((resolve) => setTimeout(resolve, 100));
57
60
  const writer = await client.openWriter({
58
61
  start: TimeStamp.now(),
@@ -66,9 +69,12 @@ describe("Streamer", () => {
66
69
  const d = await streamer.read();
67
70
  expect(Array.from(d.get(ch.key))).toEqual([1, 2, 3, 4, 5]);
68
71
  });
69
- test("downsample factor of 2", async () => {
72
+ test("downsample factor of 2", async () => {
70
73
  const ch = await newChannel();
71
- const streamer = await client.openStreamer({channels: ch.key, downsampleFactor: 2});
74
+ const streamer = await client.openStreamer({
75
+ channels: ch.key,
76
+ downsampleFactor: 2,
77
+ });
72
78
  await new Promise((resolve) => setTimeout(resolve, 100));
73
79
  const writer = await client.openWriter({
74
80
  start: TimeStamp.now(),
@@ -82,16 +88,19 @@ test("downsample factor of 2", async () => {
82
88
  const d = await streamer.read();
83
89
  expect(Array.from(d.get(ch.key))).toEqual([1, 3, 5, 7, 9]);
84
90
  });
85
- test("downsample factor of 10", async () => {
91
+ test("downsample factor of 10", async () => {
86
92
  const ch = await newChannel();
87
- const streamer = await client.openStreamer({channels: ch.key, downsampleFactor: 10});
93
+ const streamer = await client.openStreamer({
94
+ channels: ch.key,
95
+ downsampleFactor: 10,
96
+ });
88
97
  await new Promise((resolve) => setTimeout(resolve, 100));
89
98
  const writer = await client.openWriter({
90
99
  start: TimeStamp.now(),
91
100
  channels: ch.key,
92
101
  });
93
102
  try {
94
- await writer.write(ch.key, new Float64Array([1, 2, 3, 4, 5, 6,7,8,9,10]));
103
+ await writer.write(ch.key, new Float64Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]));
95
104
  } finally {
96
105
  await writer.close();
97
106
  }
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";
@@ -10,6 +10,8 @@
10
10
  import { toArray } from "@synnaxlabs/x/toArray";
11
11
  import { z } from "zod";
12
12
 
13
+ import { ontology } from "@/ontology";
14
+
13
15
  export const keyZ = z.string().uuid();
14
16
  export type Key = z.infer<typeof keyZ>;
15
17
  export type Name = string;
@@ -17,10 +19,7 @@ export type Keys = Key[];
17
19
  export type Names = Name[];
18
20
  export type Params = Key | Name | Keys | Names;
19
21
 
20
- export const groupZ = z.object({
21
- key: keyZ,
22
- name: z.string(),
23
- });
22
+ export const groupZ = z.object({ key: keyZ, name: z.string() });
24
23
 
25
24
  export type Payload = z.infer<typeof groupZ>;
26
25
 
@@ -52,9 +51,7 @@ export type ParamAnalysisResult =
52
51
 
53
52
  export const analyzeParams = (groups: Params): ParamAnalysisResult => {
54
53
  const normal = toArray(groups) as Keys | Names;
55
- if (normal.length === 0)
56
- throw new Error("No groups specified");
57
-
54
+ if (normal.length === 0) throw new Error("No groups specified");
58
55
  const isKey = keyZ.safeParse(normal[0]).success;
59
56
  return {
60
57
  single: !Array.isArray(groups),
@@ -63,3 +60,8 @@ export const analyzeParams = (groups: Params): ParamAnalysisResult => {
63
60
  actual: groups,
64
61
  } as const as ParamAnalysisResult;
65
62
  };
63
+
64
+ export const ONTOLOGY_TYPE: ontology.ResourceType = "group";
65
+
66
+ export const ontologyID = (key: Key): ontology.ID =>
67
+ 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 { type breaker } from "@synnaxlabs/x";
17
19
  import { binary } from "@synnaxlabs/x/binary";
18
20
  import { type URL } from "@synnaxlabs/x/url";
19
21
 
@@ -25,11 +27,14 @@ 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);
34
+ this.unary = unaryWithBreaker(
35
+ new HTTPClient(this.url, codec, this.secure),
36
+ breakerCfg,
37
+ );
33
38
  this.stream = new WebSocketClient(this.url, codec, this.secure);
34
39
  }
35
40