@synnaxlabs/client 0.22.0 → 0.23.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.
- package/.turbo/turbo-build.log +7 -6
- package/dist/auth/auth.d.ts.map +1 -1
- package/dist/channel/client.d.ts +14 -4
- package/dist/channel/client.d.ts.map +1 -1
- package/dist/channel/creator.d.ts +1 -1
- package/dist/channel/creator.d.ts.map +1 -1
- package/dist/channel/external.d.ts +1 -1
- package/dist/channel/external.d.ts.map +1 -1
- package/dist/channel/payload.d.ts +21 -8
- package/dist/channel/payload.d.ts.map +1 -1
- package/dist/channel/retriever.d.ts +6 -6
- package/dist/channel/retriever.d.ts.map +1 -1
- package/dist/channel/writer.d.ts +13 -1
- package/dist/channel/writer.d.ts.map +1 -1
- package/dist/client.cjs +17 -18
- package/dist/client.d.ts +4 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +5487 -13607
- package/dist/connection/checker.d.ts +4 -4
- package/dist/control/client.d.ts +9 -0
- package/dist/control/client.d.ts.map +1 -0
- package/dist/control/external.d.ts +1 -1
- package/dist/control/external.d.ts.map +1 -1
- package/dist/control/state.d.ts +17 -52
- package/dist/control/state.d.ts.map +1 -1
- package/dist/errors.d.ts +6 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/framer/adapter.d.ts +1 -1
- package/dist/framer/adapter.d.ts.map +1 -1
- package/dist/framer/client.d.ts +7 -5
- package/dist/framer/client.d.ts.map +1 -1
- package/dist/framer/deleter.d.ts +68 -0
- package/dist/framer/deleter.d.ts.map +1 -0
- package/dist/framer/deleter.spec.d.ts +2 -0
- package/dist/framer/deleter.spec.d.ts.map +1 -0
- package/dist/framer/frame.d.ts +45 -241
- package/dist/framer/frame.d.ts.map +1 -1
- package/dist/framer/iterator.d.ts +1 -1
- package/dist/framer/iterator.d.ts.map +1 -1
- package/dist/framer/streamProxy.d.ts.map +1 -1
- package/dist/framer/streamer.d.ts.map +1 -1
- package/dist/framer/writer.d.ts +86 -231
- package/dist/framer/writer.d.ts.map +1 -1
- package/dist/hardware/device/client.d.ts +9 -7
- package/dist/hardware/device/client.d.ts.map +1 -1
- package/dist/hardware/task/client.d.ts +17 -14
- package/dist/hardware/task/client.d.ts.map +1 -1
- package/dist/index.d.ts +12 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/label/client.d.ts.map +1 -1
- package/dist/label/external.d.ts +2 -2
- package/dist/label/external.d.ts.map +1 -1
- package/dist/label/writer.d.ts +4 -2
- package/dist/label/writer.d.ts.map +1 -1
- package/dist/ontology/client.d.ts +8 -8
- package/dist/ontology/client.d.ts.map +1 -1
- package/dist/ontology/group/client.d.ts +1 -1
- package/dist/ontology/group/client.d.ts.map +1 -1
- package/dist/ontology/group/external.d.ts +1 -1
- package/dist/ontology/group/external.d.ts.map +1 -1
- package/dist/ontology/group/writer.d.ts +1 -1
- package/dist/ontology/group/writer.d.ts.map +1 -1
- package/dist/ontology/payload.d.ts +14 -26
- package/dist/ontology/payload.d.ts.map +1 -1
- package/dist/ontology/writer.d.ts.map +1 -1
- package/dist/ranger/active.d.ts +1 -1
- package/dist/ranger/active.d.ts.map +1 -1
- package/dist/ranger/alias.d.ts.map +1 -1
- package/dist/ranger/client.d.ts +16 -100
- package/dist/ranger/client.d.ts.map +1 -1
- package/dist/ranger/external.d.ts +2 -2
- package/dist/ranger/external.d.ts.map +1 -1
- package/dist/ranger/kv.d.ts.map +1 -1
- package/dist/ranger/payload.d.ts +34 -270
- package/dist/ranger/payload.d.ts.map +1 -1
- package/dist/ranger/range.d.ts +1 -1
- package/dist/ranger/range.d.ts.map +1 -1
- package/dist/ranger/writer.d.ts.map +1 -1
- package/dist/transport.d.ts.map +1 -1
- package/dist/util/retrieve.d.ts.map +1 -1
- package/dist/util/zod.d.ts +1 -1
- package/dist/util/zod.d.ts.map +1 -1
- package/dist/workspace/client.d.ts.map +1 -1
- package/dist/workspace/external.d.ts +1 -1
- package/dist/workspace/external.d.ts.map +1 -1
- package/dist/workspace/lineplot/client.d.ts +1 -1
- package/dist/workspace/lineplot/client.d.ts.map +1 -1
- package/dist/workspace/lineplot/external.d.ts +1 -1
- package/dist/workspace/lineplot/external.d.ts.map +1 -1
- package/dist/workspace/lineplot/payload.d.ts +2 -2
- package/dist/workspace/lineplot/retriever.d.ts.map +1 -1
- package/dist/workspace/lineplot/writer.d.ts +4 -4
- package/dist/workspace/lineplot/writer.d.ts.map +1 -1
- package/dist/workspace/payload.d.ts +6 -4
- package/dist/workspace/payload.d.ts.map +1 -1
- package/dist/workspace/retriever.d.ts.map +1 -1
- package/dist/workspace/schematic/client.d.ts.map +1 -1
- package/dist/workspace/schematic/external.d.ts +1 -1
- package/dist/workspace/schematic/external.d.ts.map +1 -1
- package/dist/workspace/schematic/payload.d.ts +2 -2
- package/dist/workspace/schematic/retriever.d.ts +1 -1
- package/dist/workspace/schematic/retriever.d.ts.map +1 -1
- package/dist/workspace/schematic/writer.d.ts +4 -4
- package/dist/workspace/schematic/writer.d.ts.map +1 -1
- package/dist/workspace/writer.d.ts +7 -5
- package/dist/workspace/writer.d.ts.map +1 -1
- package/eslint.config.js +12 -0
- package/examples/node/basicReadWrite.js +11 -2
- package/examples/node/liveStream.js +13 -4
- package/examples/node/seriesAndFrames.js +12 -3
- package/examples/node/streamWrite.js +15 -6
- package/package.json +11 -8
- package/src/auth/auth.spec.ts +7 -6
- package/src/auth/auth.ts +17 -13
- package/src/auth/index.ts +1 -1
- package/src/channel/batchRetriever.spec.ts +16 -5
- package/src/channel/channel.spec.ts +42 -4
- package/src/channel/client.ts +26 -9
- package/src/channel/creator.ts +2 -2
- package/src/channel/external.ts +2 -2
- package/src/channel/index.ts +1 -1
- package/src/channel/payload.ts +3 -1
- package/src/channel/retriever.ts +6 -4
- package/src/channel/writer.ts +23 -4
- package/src/client.ts +5 -3
- package/src/connection/checker.ts +1 -1
- package/src/connection/connection.spec.ts +1 -1
- package/src/connection/index.ts +1 -1
- package/src/control/client.ts +17 -0
- package/src/control/external.ts +2 -2
- package/src/control/index.ts +1 -1
- package/src/control/state.spec.ts +2 -3
- package/src/control/state.ts +20 -84
- package/src/errors.ts +18 -7
- package/src/framer/adapter.spec.ts +9 -0
- package/src/framer/adapter.ts +3 -3
- package/src/framer/client.spec.ts +1 -1
- package/src/framer/client.ts +34 -14
- package/src/framer/deleter.spec.ts +129 -0
- package/src/framer/deleter.ts +49 -0
- package/src/framer/external.ts +1 -1
- package/src/framer/frame.spec.ts +1 -1
- package/src/framer/frame.ts +14 -14
- package/src/framer/index.ts +1 -1
- package/src/framer/iterator.spec.ts +2 -2
- package/src/framer/iterator.ts +2 -2
- package/src/framer/streamProxy.ts +2 -4
- package/src/framer/streamer.spec.ts +2 -2
- package/src/framer/streamer.ts +6 -5
- package/src/framer/writer.spec.ts +18 -1
- package/src/framer/writer.ts +19 -27
- package/src/hardware/device/client.ts +2 -2
- package/src/hardware/device/index.ts +1 -1
- package/src/hardware/external.ts +1 -1
- package/src/hardware/index.ts +1 -1
- package/src/hardware/rack/rack.spec.ts +1 -1
- package/src/hardware/task/client.ts +3 -3
- package/src/hardware/task/task.spec.ts +2 -2
- package/src/index.ts +26 -25
- package/src/label/client.ts +2 -2
- package/src/label/external.ts +3 -3
- package/src/label/index.ts +1 -1
- package/src/label/label.spec.ts +1 -1
- package/src/label/payload.ts +1 -1
- package/src/label/retriever.ts +1 -1
- package/src/label/writer.ts +1 -1
- package/src/ontology/client.ts +7 -7
- package/src/ontology/external.ts +1 -1
- package/src/ontology/group/client.ts +3 -3
- package/src/ontology/group/external.ts +2 -2
- package/src/ontology/group/group.spec.ts +2 -2
- package/src/ontology/group/group.ts +1 -1
- package/src/ontology/group/index.ts +1 -1
- package/src/ontology/group/payload.ts +1 -1
- package/src/ontology/group/writer.ts +22 -6
- package/src/ontology/index.ts +1 -1
- package/src/ontology/ontology.spec.ts +2 -2
- package/src/ontology/payload.ts +3 -3
- package/src/ontology/writer.ts +2 -2
- package/src/ranger/active.ts +2 -2
- package/src/ranger/alias.ts +2 -2
- package/src/ranger/client.ts +15 -16
- package/src/ranger/external.ts +3 -3
- package/src/ranger/index.ts +1 -1
- package/src/ranger/kv.ts +2 -2
- package/src/ranger/payload.ts +1 -1
- package/src/ranger/range.ts +2 -2
- package/src/ranger/ranger.spec.ts +1 -1
- package/src/ranger/writer.ts +3 -3
- package/src/setupspecs.ts +1 -1
- package/src/signals/external.ts +1 -1
- package/src/signals/index.ts +1 -1
- package/src/signals/observable.ts +1 -1
- package/src/transport.ts +2 -2
- package/src/user/index.ts +1 -1
- package/src/user/payload.ts +1 -1
- package/src/util/retrieve.spec.ts +1 -1
- package/src/util/retrieve.ts +1 -1
- package/src/util/telem.ts +1 -1
- package/src/util/zod.ts +11 -2
- package/src/vite-env.d.ts +2 -2
- package/src/workspace/client.ts +2 -2
- package/src/workspace/external.ts +2 -2
- package/src/workspace/index.ts +1 -1
- package/src/workspace/lineplot/client.ts +2 -2
- package/src/workspace/lineplot/external.ts +2 -2
- package/src/workspace/lineplot/index.ts +1 -1
- package/src/workspace/lineplot/linePlot.spec.ts +2 -2
- package/src/workspace/lineplot/payload.ts +1 -1
- package/src/workspace/lineplot/retriever.ts +4 -10
- package/src/workspace/lineplot/writer.ts +4 -4
- package/src/workspace/payload.ts +11 -6
- package/src/workspace/retriever.ts +12 -6
- package/src/workspace/schematic/client.ts +2 -2
- package/src/workspace/schematic/external.ts +2 -2
- package/src/workspace/schematic/index.ts +1 -1
- package/src/workspace/schematic/payload.ts +1 -1
- package/src/workspace/schematic/retriever.ts +17 -18
- package/src/workspace/schematic/schematic.spec.ts +2 -2
- package/src/workspace/schematic/writer.ts +5 -5
- package/src/workspace/workspace.spec.ts +2 -2
- package/src/workspace/writer.ts +3 -3
- package/vite.config.ts +3 -4
- package/.eslintrc.cjs +0 -18
- package/dist/client.cjs.map +0 -1
- package/dist/client.js.map +0 -1
- package/dist/control/authority.d.ts +0 -8
- package/dist/control/authority.d.ts.map +0 -1
- package/src/control/authority.ts +0 -26
|
@@ -7,7 +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 {
|
|
10
|
+
import { describe, expect,it } from "vitest";
|
|
11
11
|
import { type Primitive } from "zod";
|
|
12
12
|
|
|
13
13
|
import {
|
package/src/util/retrieve.ts
CHANGED
|
@@ -7,7 +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 {
|
|
10
|
+
import { type Primitive,toArray } from "@synnaxlabs/x";
|
|
11
11
|
|
|
12
12
|
import { MultipleFoundError, NotFoundError } from "@/errors";
|
|
13
13
|
|
package/src/util/telem.ts
CHANGED
package/src/util/zod.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Use of this software is governed by the Business Source License included in the file
|
|
4
|
+
// licenses/BSL.txt.
|
|
5
|
+
//
|
|
6
|
+
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
7
|
+
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
|
+
// included in the file licenses/APL.txt.
|
|
2
9
|
|
|
10
|
+
import { z } from "zod";
|
|
3
11
|
|
|
4
|
-
export const nullableArrayZ = <Z extends z.ZodTypeAny>(item: Z) =>
|
|
12
|
+
export const nullableArrayZ = <Z extends z.ZodTypeAny>(item: Z) =>
|
|
13
|
+
z.union([z.null().transform(() => [] as z.output<Z>[]), item.array()]);
|
package/src/vite-env.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -7,5 +7,5 @@
|
|
|
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
|
-
|
|
10
|
+
|
|
11
11
|
/// <reference types="vite/client" />
|
package/src/workspace/client.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -13,8 +13,8 @@ import { type AsyncTermSearcher } from "@synnaxlabs/x/search";
|
|
|
13
13
|
|
|
14
14
|
import { linePlot } from "@/workspace/lineplot";
|
|
15
15
|
import { type Key, type Workspace } from "@/workspace/payload";
|
|
16
|
-
import { schematic } from "@/workspace/schematic";
|
|
17
16
|
import { Retriever } from "@/workspace/retriever";
|
|
17
|
+
import { schematic } from "@/workspace/schematic";
|
|
18
18
|
import { type NewWorkspace, Writer } from "@/workspace/writer";
|
|
19
19
|
|
|
20
20
|
export class Client implements AsyncTermSearcher<string, Key, Workspace> {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -7,5 +7,5 @@
|
|
|
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
|
-
export * from "@/workspace/payload";
|
|
11
10
|
export * from "@/workspace/client";
|
|
11
|
+
export * from "@/workspace/payload";
|
package/src/workspace/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { type UnaryClient } from "@synnaxlabs/freighter";
|
|
11
11
|
import { type UnknownRecord } from "@synnaxlabs/x/record";
|
|
12
12
|
|
|
13
|
-
import { type
|
|
13
|
+
import { type Key, type LinePlot, type Params } from "@/workspace/lineplot/payload";
|
|
14
14
|
import { Retriever } from "@/workspace/lineplot/retriever";
|
|
15
15
|
import { type NewLinePlot, Writer } from "@/workspace/lineplot/writer";
|
|
16
16
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -7,5 +7,5 @@
|
|
|
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
|
-
export * from "@/workspace/lineplot/payload";
|
|
11
10
|
export * from "@/workspace/lineplot/client";
|
|
11
|
+
export * from "@/workspace/lineplot/payload";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -7,7 +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 { describe, test
|
|
10
|
+
import { describe, expect,test } from "vitest";
|
|
11
11
|
|
|
12
12
|
import { newClient } from "@/setupspecs";
|
|
13
13
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -11,17 +11,11 @@ import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
|
|
|
11
11
|
import { toArray } from "@synnaxlabs/x/toArray";
|
|
12
12
|
import { z } from "zod";
|
|
13
13
|
|
|
14
|
-
import { type LinePlot, type Params
|
|
14
|
+
import { type LinePlot, linePlotZ, type Params } from "@/workspace/lineplot/payload";
|
|
15
15
|
|
|
16
|
-
const reqZ = z.object({
|
|
17
|
-
keys: z.string().array(),
|
|
18
|
-
});
|
|
16
|
+
const reqZ = z.object({ keys: z.string().array() });
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const resZ = z.object({
|
|
23
|
-
linePlots: linePlotZ.array(),
|
|
24
|
-
});
|
|
18
|
+
const resZ = z.object({ linePlots: linePlotZ.array() });
|
|
25
19
|
|
|
26
20
|
export class Retriever {
|
|
27
21
|
private readonly ENDPOINT = "/workspace/lineplot/retrieve";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -13,11 +13,11 @@ import { toArray } from "@synnaxlabs/x/toArray";
|
|
|
13
13
|
import { z } from "zod";
|
|
14
14
|
|
|
15
15
|
import {
|
|
16
|
-
|
|
16
|
+
type Key,
|
|
17
|
+
keyZ,
|
|
17
18
|
type LinePlot,
|
|
19
|
+
linePlotZ,
|
|
18
20
|
type Params,
|
|
19
|
-
keyZ,
|
|
20
|
-
type Key,
|
|
21
21
|
} from "@/workspace/lineplot/payload";
|
|
22
22
|
import { keyZ as workspaceKeyZ } from "@/workspace/payload";
|
|
23
23
|
|
package/src/workspace/payload.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -7,7 +7,6 @@
|
|
|
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 { binary } from "@synnaxlabs/x/binary";
|
|
11
10
|
import { type UnknownRecord, unknownRecordZ } from "@synnaxlabs/x/record";
|
|
12
11
|
import { z } from "zod";
|
|
13
12
|
|
|
@@ -17,16 +16,22 @@ export type Key = z.infer<typeof keyZ>;
|
|
|
17
16
|
|
|
18
17
|
export type Params = Key | Key[];
|
|
19
18
|
|
|
19
|
+
// --- VERY IMPORTANT ---
|
|
20
|
+
// Synnax's encoders (in the binary package inside x) automatically convert the case
|
|
21
|
+
// of keys in objects to snake_case and back to camelCase when encoding and decoding
|
|
22
|
+
// respectively. This is done to ensure that the keys are consistent across all
|
|
23
|
+
// languages and platforms. Sometimes workspaces have keys that are uuids, which have
|
|
24
|
+
// dashes, and those get messed up. So we just use regular JSON for workspaces.
|
|
25
|
+
const parse = (s: string): UnknownRecord => JSON.parse(s) as UnknownRecord;
|
|
26
|
+
|
|
20
27
|
export const workspaceZ = z.object({
|
|
21
28
|
name: z.string(),
|
|
22
29
|
key: keyZ,
|
|
23
|
-
layout: unknownRecordZ.or(
|
|
24
|
-
z.string().transform((s) => binary.JSON_ECD.decodeString(s) as UnknownRecord),
|
|
25
|
-
),
|
|
30
|
+
layout: unknownRecordZ.or(z.string().transform((s) => parse(s) as UnknownRecord)),
|
|
26
31
|
});
|
|
27
32
|
|
|
28
33
|
export const workspaceRemoteZ = workspaceZ.omit({ layout: true }).extend({
|
|
29
|
-
layout: z.string().transform((s) =>
|
|
34
|
+
layout: z.string().transform((s) => parse(s) as UnknownRecord),
|
|
30
35
|
});
|
|
31
36
|
|
|
32
37
|
export type Workspace = z.infer<typeof workspaceZ>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -11,10 +11,11 @@ import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
|
|
|
11
11
|
import { toArray } from "@synnaxlabs/x/toArray";
|
|
12
12
|
import { z } from "zod";
|
|
13
13
|
|
|
14
|
+
import { nullableArrayZ } from "@/util/zod";
|
|
14
15
|
import {
|
|
16
|
+
keyZ,
|
|
15
17
|
type Params,
|
|
16
18
|
type Workspace,
|
|
17
|
-
keyZ,
|
|
18
19
|
workspaceRemoteZ,
|
|
19
20
|
} from "@/workspace/payload";
|
|
20
21
|
|
|
@@ -28,9 +29,7 @@ const reqZ = z.object({
|
|
|
28
29
|
|
|
29
30
|
type Request = z.infer<typeof reqZ>;
|
|
30
31
|
|
|
31
|
-
const resZ = z.object({
|
|
32
|
-
workspaces: workspaceRemoteZ.array(),
|
|
33
|
-
});
|
|
32
|
+
const resZ = z.object({ workspaces: nullableArrayZ(workspaceRemoteZ) });
|
|
34
33
|
|
|
35
34
|
export class Retriever {
|
|
36
35
|
private static readonly ENDPOINT = "/workspace/retrieve";
|
|
@@ -59,6 +58,13 @@ export class Retriever {
|
|
|
59
58
|
}
|
|
60
59
|
|
|
61
60
|
private async execute(request: Request): Promise<Workspace[]> {
|
|
62
|
-
|
|
61
|
+
const res = await sendRequired(
|
|
62
|
+
this.client,
|
|
63
|
+
Retriever.ENDPOINT,
|
|
64
|
+
request,
|
|
65
|
+
reqZ,
|
|
66
|
+
resZ,
|
|
67
|
+
);
|
|
68
|
+
return res.workspaces;
|
|
63
69
|
}
|
|
64
70
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -12,7 +12,7 @@ import { type UnknownRecord } from "@synnaxlabs/x/record";
|
|
|
12
12
|
|
|
13
13
|
import { type Key, type Params, type Schematic } from "@/workspace/schematic/payload";
|
|
14
14
|
import { Retriever } from "@/workspace/schematic/retriever";
|
|
15
|
-
import {
|
|
15
|
+
import { type NewSchematic,Writer } from "@/workspace/schematic/writer";
|
|
16
16
|
|
|
17
17
|
export class Client {
|
|
18
18
|
private readonly writer: Writer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -7,5 +7,5 @@
|
|
|
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
|
-
export * from "@/workspace/schematic/payload";
|
|
11
10
|
export * from "@/workspace/schematic/client";
|
|
11
|
+
export * from "@/workspace/schematic/payload";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -11,17 +11,14 @@ import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
|
|
|
11
11
|
import { toArray } from "@synnaxlabs/x/toArray";
|
|
12
12
|
import { z } from "zod";
|
|
13
13
|
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
type Params,
|
|
16
|
+
type Schematic,
|
|
17
|
+
schematicRemoteZ,
|
|
18
|
+
} from "@/workspace/schematic/payload";
|
|
15
19
|
|
|
16
|
-
const reqZ = z.object({
|
|
17
|
-
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
type Request = z.infer<typeof reqZ>;
|
|
21
|
-
|
|
22
|
-
const resZ = z.object({
|
|
23
|
-
schematics: schematicRemoteZ.array(),
|
|
24
|
-
});
|
|
20
|
+
const reqZ = z.object({ keys: z.string().array() });
|
|
21
|
+
const resZ = z.object({ schematics: schematicRemoteZ.array() });
|
|
25
22
|
|
|
26
23
|
export class Retriever {
|
|
27
24
|
private readonly ENDPOINT = "/workspace/schematic/retrieve";
|
|
@@ -32,12 +29,14 @@ export class Retriever {
|
|
|
32
29
|
}
|
|
33
30
|
|
|
34
31
|
async retrieve(params: Params): Promise<Schematic[]> {
|
|
35
|
-
return (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
32
|
+
return (
|
|
33
|
+
await sendRequired(
|
|
34
|
+
this.client,
|
|
35
|
+
this.ENDPOINT,
|
|
36
|
+
{ keys: toArray(params) },
|
|
37
|
+
reqZ,
|
|
38
|
+
resZ,
|
|
39
|
+
)
|
|
40
|
+
).schematics;
|
|
42
41
|
}
|
|
43
42
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -7,7 +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 { describe,
|
|
10
|
+
import { describe, expect, it,test } from "vitest";
|
|
11
11
|
|
|
12
12
|
import { ValidationError } from "@/errors";
|
|
13
13
|
import { newClient } from "@/setupspecs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -14,12 +14,12 @@ import { z } from "zod";
|
|
|
14
14
|
|
|
15
15
|
import { keyZ as workspaceKeyZ } from "@/workspace/payload";
|
|
16
16
|
import {
|
|
17
|
-
schematicZ,
|
|
18
|
-
type Schematic,
|
|
19
|
-
type Params,
|
|
20
|
-
keyZ,
|
|
21
17
|
type Key,
|
|
18
|
+
keyZ,
|
|
19
|
+
type Params,
|
|
20
|
+
type Schematic,
|
|
22
21
|
schematicRemoteZ,
|
|
22
|
+
schematicZ,
|
|
23
23
|
} from "@/workspace/schematic/payload";
|
|
24
24
|
|
|
25
25
|
export const newSchematicZ = schematicZ.partial({ key: true, snapshot: true }).transform((p) => ({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -7,7 +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 { describe, test
|
|
10
|
+
import { describe, expect,test } from "vitest";
|
|
11
11
|
|
|
12
12
|
import { newClient } from "@/setupspecs";
|
|
13
13
|
|
package/src/workspace/writer.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -13,10 +13,10 @@ import { toArray } from "@synnaxlabs/x/toArray";
|
|
|
13
13
|
import { z } from "zod";
|
|
14
14
|
|
|
15
15
|
import {
|
|
16
|
-
type Workspace,
|
|
17
|
-
workspaceZ,
|
|
18
16
|
keyZ,
|
|
17
|
+
type Workspace,
|
|
19
18
|
workspaceRemoteZ,
|
|
19
|
+
workspaceZ,
|
|
20
20
|
} from "@/workspace/payload";
|
|
21
21
|
|
|
22
22
|
const newWorkspaceZ = workspaceZ.partial({ key: true }).transform((w) => ({
|
package/vite.config.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -7,15 +7,14 @@
|
|
|
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 { lib } from "@synnaxlabs/vite-plugin";
|
|
10
|
+
import { isProd, lib } from "@synnaxlabs/vite-plugin";
|
|
11
11
|
import { defineConfig } from "vite";
|
|
12
12
|
|
|
13
13
|
export default defineConfig({
|
|
14
14
|
plugins: [lib({ name: "client" })],
|
|
15
15
|
build: {
|
|
16
|
-
minify: true,
|
|
17
16
|
rollupOptions: {
|
|
18
|
-
external: "zod",
|
|
17
|
+
external: ["zod"],
|
|
19
18
|
},
|
|
20
19
|
},
|
|
21
20
|
test: {
|
package/.eslintrc.cjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2023 Synnax Labs, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Use of this software is governed by the Business Source License included in the file
|
|
5
|
-
* licenses/BSL.txt.
|
|
6
|
-
*
|
|
7
|
-
* As of the Change Date specified in that file, in accordance with the Business Source
|
|
8
|
-
* License, use of this software will be governed by the Apache License, Version 2.0,
|
|
9
|
-
* included in the file licenses/APL.txt.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
module.exports = {
|
|
13
|
-
root: true,
|
|
14
|
-
extends: ["synnaxlabs"],
|
|
15
|
-
parserOptions: {
|
|
16
|
-
project: "./tsconfig.json",
|
|
17
|
-
},
|
|
18
|
-
};
|