@synnaxlabs/client 0.2.1 → 0.13.6
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/.eslintrc.cjs +18 -0
- package/.pytest_cache/README.md +8 -0
- package/.turbo/turbo-build.log +16 -0
- package/LICENSE +4 -21
- package/{build/module/lib → dist/auth}/auth.d.ts +16 -19
- package/dist/auth/index.d.ts +1 -0
- package/dist/cdc/external.d.ts +1 -0
- package/dist/cdc/index.d.ts +1 -0
- package/dist/cdc/observable.d.ts +17 -0
- package/dist/channel/client.d.ts +58 -0
- package/dist/channel/creator.d.ts +8 -0
- package/dist/channel/external.d.ts +4 -0
- package/dist/channel/index.d.ts +1 -0
- package/dist/channel/payload.d.ts +63 -0
- package/dist/channel/retriever.d.ts +49 -0
- package/dist/client.cjs.js +23050 -0
- package/dist/client.cjs.js.map +1 -0
- package/dist/client.d.ts +73 -0
- package/dist/client.es.js +23050 -0
- package/dist/client.es.js.map +1 -0
- package/dist/connection/checker.d.ts +66 -0
- package/dist/connection/index.d.ts +1 -0
- package/dist/control/authority.d.ts +6 -0
- package/dist/control/external.d.ts +2 -0
- package/dist/control/index.d.ts +1 -0
- package/dist/control/state.d.ts +81 -0
- package/{build/main/lib → dist}/errors.d.ts +6 -3
- package/dist/framer/adapter.d.ts +21 -0
- package/dist/framer/client.d.ts +44 -0
- package/dist/framer/external.d.ts +5 -0
- package/dist/framer/frame.d.ts +251 -0
- package/dist/framer/index.d.ts +1 -0
- package/{build/module/lib/segment → dist/framer}/iterator.d.ts +32 -64
- package/dist/framer/streamProxy.d.ts +12 -0
- package/dist/framer/streamer.d.ts +17 -0
- package/dist/framer/writer.d.ts +257 -0
- package/dist/index.d.ts +16 -0
- package/dist/label/client.d.ts +25 -0
- package/dist/label/external.d.ts +4 -0
- package/dist/label/index.d.ts +1 -0
- package/dist/label/payload.d.ts +20 -0
- package/dist/label/retriever.d.ts +13 -0
- package/dist/label/writer.d.ts +26 -0
- package/dist/ontology/cdc.d.ts +25 -0
- package/dist/ontology/client.d.ts +25 -0
- package/dist/ontology/external.d.ts +3 -0
- package/dist/ontology/group/client.d.ts +11 -0
- package/dist/ontology/group/external.d.ts +2 -0
- package/dist/ontology/group/group.d.ts +7 -0
- package/dist/ontology/group/index.d.ts +1 -0
- package/dist/ontology/group/payload.d.ts +40 -0
- package/dist/ontology/group/writer.d.ts +13 -0
- package/dist/ontology/index.d.ts +1 -0
- package/dist/ontology/ontology.spec.d.ts +1 -0
- package/dist/ontology/payload.d.ts +235 -0
- package/dist/ontology/retriever.d.ts +12 -0
- package/dist/ontology/signals.d.ts +25 -0
- package/dist/ontology/writer.d.ts +9 -0
- package/dist/ranger/active.d.ts +9 -0
- package/dist/ranger/alias.d.ts +32 -0
- package/dist/ranger/client.d.ts +31 -0
- package/dist/ranger/external.d.ts +6 -0
- package/dist/ranger/index.d.ts +1 -0
- package/dist/ranger/kv.d.ts +50 -0
- package/dist/ranger/payload.d.ts +94 -0
- package/dist/ranger/range.d.ts +29 -0
- package/dist/ranger/ranger.spec.d.ts +1 -0
- package/dist/ranger/retriever.d.ts +10 -0
- package/dist/ranger/writer.d.ts +9 -0
- package/{build/main → dist}/setupspecs.d.ts +2 -2
- package/dist/signals/external.d.ts +1 -0
- package/dist/signals/index.d.ts +1 -0
- package/dist/signals/observable.d.ts +17 -0
- package/dist/transport.d.ts +10 -0
- package/dist/user/index.d.ts +1 -0
- package/{build/main/lib → dist}/user/payload.d.ts +3 -3
- package/dist/util/telem.d.ts +2 -0
- package/dist/workspace/client.d.ts +22 -0
- package/dist/workspace/external.d.ts +2 -0
- package/dist/workspace/index.d.ts +1 -0
- package/dist/workspace/lineplot/client.d.ts +15 -0
- package/dist/workspace/lineplot/external.d.ts +2 -0
- package/dist/workspace/lineplot/index.d.ts +1 -0
- package/dist/workspace/lineplot/linePlot.spec.d.ts +1 -0
- package/dist/workspace/lineplot/payload.d.ts +31 -0
- package/dist/workspace/lineplot/retriever.d.ts +9 -0
- package/dist/workspace/lineplot/writer.d.ts +39 -0
- package/dist/workspace/payload.d.ts +31 -0
- package/dist/workspace/pid/client.d.ts +16 -0
- package/dist/workspace/pid/external.d.ts +2 -0
- package/dist/workspace/pid/index.d.ts +1 -0
- package/dist/workspace/pid/payload.d.ts +37 -0
- package/dist/workspace/pid/pid.spec.d.ts +1 -0
- package/dist/workspace/pid/retriever.d.ts +9 -0
- package/dist/workspace/pid/writer.d.ts +46 -0
- package/dist/workspace/retriever.d.ts +12 -0
- package/dist/workspace/workspace.spec.d.ts +1 -0
- package/dist/workspace/writer.d.ts +55 -0
- package/package.json +27 -98
- package/src/auth/auth.spec.ts +46 -0
- package/src/auth/auth.ts +83 -0
- package/src/auth/index.ts +10 -0
- package/src/channel/channel.spec.ts +82 -0
- package/src/channel/client.ts +209 -0
- package/src/channel/creator.ts +43 -0
- package/src/channel/external.ts +13 -0
- package/src/channel/index.ts +10 -0
- package/src/channel/payload.ts +52 -0
- package/src/channel/retriever.ts +160 -0
- package/src/client.ts +116 -0
- package/src/connection/checker.ts +104 -0
- package/src/connection/connection.spec.ts +35 -0
- package/src/connection/index.ts +10 -0
- package/src/control/authority.ts +26 -0
- package/src/control/external.ts +11 -0
- package/src/control/index.ts +10 -0
- package/src/control/state.spec.ts +24 -0
- package/src/control/state.ts +133 -0
- package/src/errors.ts +163 -0
- package/src/framer/adapter.ts +116 -0
- package/src/framer/client.ts +116 -0
- package/src/framer/external.ts +14 -0
- package/src/framer/frame.spec.ts +317 -0
- package/src/framer/frame.ts +412 -0
- package/src/framer/index.ts +10 -0
- package/src/framer/iterator.spec.ts +62 -0
- package/src/framer/iterator.ts +240 -0
- package/src/framer/streamProxy.ts +59 -0
- package/src/framer/streamer.spec.ts +42 -0
- package/src/framer/streamer.ts +86 -0
- package/src/framer/writer.spec.ts +52 -0
- package/src/framer/writer.ts +236 -0
- package/src/index.ts +53 -0
- package/src/label/client.ts +103 -0
- package/src/label/external.ts +13 -0
- package/src/label/index.ts +10 -0
- package/src/label/label.spec.ts +51 -0
- package/src/label/payload.ts +29 -0
- package/src/label/retriever.ts +65 -0
- package/src/label/writer.ts +90 -0
- package/src/ontology/client.ts +104 -0
- package/src/ontology/external.ts +12 -0
- package/src/ontology/group/client.ts +40 -0
- package/src/ontology/group/external.ts +11 -0
- package/src/ontology/group/group.spec.ts +46 -0
- package/src/ontology/group/group.ts +27 -0
- package/src/ontology/group/index.ts +10 -0
- package/src/ontology/group/payload.ts +65 -0
- package/src/ontology/group/writer.ts +48 -0
- package/src/ontology/index.ts +10 -0
- package/src/ontology/ontology.spec.ts +114 -0
- package/src/ontology/payload.ts +118 -0
- package/src/ontology/retriever.ts +91 -0
- package/src/ontology/signals.ts +135 -0
- package/src/ontology/writer.ts +49 -0
- package/src/ranger/active.ts +56 -0
- package/src/ranger/alias.ts +183 -0
- package/src/ranger/client.ts +129 -0
- package/src/ranger/external.ts +15 -0
- package/src/ranger/index.ts +10 -0
- package/src/ranger/kv.ts +91 -0
- package/src/ranger/payload.ts +70 -0
- package/src/ranger/range.ts +95 -0
- package/src/ranger/ranger.spec.ts +201 -0
- package/src/ranger/retriever.ts +50 -0
- package/src/ranger/writer.ts +80 -0
- package/src/setupspecs.ts +25 -0
- package/src/signals/external.ts +10 -0
- package/src/signals/index.ts +10 -0
- package/src/signals/observable.ts +80 -0
- package/src/transport.ts +39 -0
- package/src/user/index.ts +10 -0
- package/src/user/payload.ts +17 -0
- package/src/util/telem.ts +19 -0
- package/src/vite-env.d.ts +11 -0
- package/src/workspace/client.ts +75 -0
- package/src/workspace/external.ts +11 -0
- package/src/workspace/index.ts +10 -0
- package/src/workspace/lineplot/client.ts +51 -0
- package/src/workspace/lineplot/external.ts +11 -0
- package/src/workspace/lineplot/index.ts +10 -0
- package/src/workspace/lineplot/linePlot.spec.ts +78 -0
- package/src/workspace/lineplot/payload.ts +29 -0
- package/src/workspace/lineplot/retriever.ts +49 -0
- package/src/workspace/lineplot/writer.ts +109 -0
- package/src/workspace/payload.ts +29 -0
- package/src/workspace/pid/client.ts +55 -0
- package/src/workspace/pid/external.ts +11 -0
- package/src/workspace/pid/index.ts +10 -0
- package/src/workspace/pid/payload.ts +31 -0
- package/src/workspace/pid/pid.spec.ts +111 -0
- package/src/workspace/pid/retriever.ts +45 -0
- package/src/workspace/pid/writer.ts +130 -0
- package/src/workspace/retriever.ts +66 -0
- package/src/workspace/workspace.spec.ts +62 -0
- package/src/workspace/writer.ts +103 -0
- package/tsconfig.json +7 -0
- package/tsconfig.vite.json +4 -0
- package/vite.config.ts +25 -0
- package/CHANGELOG.md +0 -5
- package/build/main/index.d.ts +0 -4
- package/build/main/index.js +0 -35
- package/build/main/lib/auth.d.ts +0 -54
- package/build/main/lib/auth.js +0 -62
- package/build/main/lib/auth.spec.js +0 -39
- package/build/main/lib/channel/channel.spec.js +0 -49
- package/build/main/lib/channel/client.d.ts +0 -94
- package/build/main/lib/channel/client.js +0 -134
- package/build/main/lib/channel/creator.d.ts +0 -19
- package/build/main/lib/channel/creator.js +0 -44
- package/build/main/lib/channel/payload.d.ts +0 -25
- package/build/main/lib/channel/payload.js +0 -18
- package/build/main/lib/channel/registry.d.ts +0 -9
- package/build/main/lib/channel/registry.js +0 -37
- package/build/main/lib/channel/retriever.d.ts +0 -11
- package/build/main/lib/channel/retriever.js +0 -39
- package/build/main/lib/client.d.ts +0 -30
- package/build/main/lib/client.js +0 -46
- package/build/main/lib/errors.js +0 -122
- package/build/main/lib/segment/client.d.ts +0 -62
- package/build/main/lib/segment/client.js +0 -95
- package/build/main/lib/segment/iterator.d.ts +0 -134
- package/build/main/lib/segment/iterator.js +0 -253
- package/build/main/lib/segment/iterator.spec.js +0 -73
- package/build/main/lib/segment/payload.d.ts +0 -16
- package/build/main/lib/segment/payload.js +0 -13
- package/build/main/lib/segment/splitter.d.ts +0 -7
- package/build/main/lib/segment/splitter.js +0 -25
- package/build/main/lib/segment/typed.d.ts +0 -15
- package/build/main/lib/segment/typed.js +0 -49
- package/build/main/lib/segment/validator.d.ts +0 -22
- package/build/main/lib/segment/validator.js +0 -64
- package/build/main/lib/segment/writer.d.ts +0 -98
- package/build/main/lib/segment/writer.js +0 -183
- package/build/main/lib/segment/writer.spec.js +0 -90
- package/build/main/lib/telem.d.ts +0 -395
- package/build/main/lib/telem.js +0 -553
- package/build/main/lib/telem.spec.js +0 -152
- package/build/main/lib/transport.d.ts +0 -10
- package/build/main/lib/transport.js +0 -22
- package/build/main/lib/user/payload.js +0 -9
- package/build/main/lib/util/telem.d.ts +0 -2
- package/build/main/lib/util/telem.js +0 -13
- package/build/main/setupspecs.js +0 -17
- package/build/module/index.d.ts +0 -4
- package/build/module/index.js +0 -5
- package/build/module/lib/auth.js +0 -63
- package/build/module/lib/auth.spec.js +0 -34
- package/build/module/lib/channel/channel.spec.js +0 -44
- package/build/module/lib/channel/client.d.ts +0 -94
- package/build/module/lib/channel/client.js +0 -134
- package/build/module/lib/channel/creator.d.ts +0 -19
- package/build/module/lib/channel/creator.js +0 -42
- package/build/module/lib/channel/payload.d.ts +0 -25
- package/build/module/lib/channel/payload.js +0 -15
- package/build/module/lib/channel/registry.d.ts +0 -9
- package/build/module/lib/channel/registry.js +0 -36
- package/build/module/lib/channel/retriever.d.ts +0 -11
- package/build/module/lib/channel/retriever.js +0 -37
- package/build/module/lib/client.d.ts +0 -30
- package/build/module/lib/client.js +0 -44
- package/build/module/lib/errors.d.ts +0 -53
- package/build/module/lib/errors.js +0 -113
- package/build/module/lib/segment/client.d.ts +0 -62
- package/build/module/lib/segment/client.js +0 -94
- package/build/module/lib/segment/iterator.js +0 -248
- package/build/module/lib/segment/iterator.spec.js +0 -68
- package/build/module/lib/segment/payload.d.ts +0 -16
- package/build/module/lib/segment/payload.js +0 -10
- package/build/module/lib/segment/splitter.d.ts +0 -7
- package/build/module/lib/segment/splitter.js +0 -26
- package/build/module/lib/segment/typed.d.ts +0 -15
- package/build/module/lib/segment/typed.js +0 -49
- package/build/module/lib/segment/validator.d.ts +0 -22
- package/build/module/lib/segment/validator.js +0 -60
- package/build/module/lib/segment/writer.d.ts +0 -98
- package/build/module/lib/segment/writer.js +0 -183
- package/build/module/lib/segment/writer.spec.js +0 -85
- package/build/module/lib/telem.d.ts +0 -395
- package/build/module/lib/telem.js +0 -545
- package/build/module/lib/telem.spec.js +0 -147
- package/build/module/lib/transport.d.ts +0 -10
- package/build/module/lib/transport.js +0 -22
- package/build/module/lib/user/payload.d.ts +0 -12
- package/build/module/lib/user/payload.js +0 -6
- package/build/module/lib/util/telem.d.ts +0 -2
- package/build/module/lib/util/telem.js +0 -9
- package/build/module/setupspecs.d.ts +0 -4
- package/build/module/setupspecs.js +0 -16
- /package/{build/main/lib → dist/auth}/auth.spec.d.ts +0 -0
- /package/{build/main/lib → dist}/channel/channel.spec.d.ts +0 -0
- /package/{build/main/lib/segment/iterator.spec.d.ts → dist/connection/connection.spec.d.ts} +0 -0
- /package/{build/main/lib/segment/writer.spec.d.ts → dist/control/state.spec.d.ts} +0 -0
- /package/{build/main/lib/telem.spec.d.ts → dist/framer/frame.spec.d.ts} +0 -0
- /package/{build/module/lib/segment → dist/framer}/iterator.spec.d.ts +0 -0
- /package/{build/module/lib/auth.spec.d.ts → dist/framer/streamer.spec.d.ts} +0 -0
- /package/{build/module/lib/segment → dist/framer}/writer.spec.d.ts +0 -0
- /package/{build/module/lib/channel/channel.spec.d.ts → dist/label/label.spec.d.ts} +0 -0
- /package/{build/module/lib/telem.spec.d.ts → dist/ontology/group/group.spec.d.ts} +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Copyright 2023 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.
|
|
9
|
+
|
|
10
|
+
import { type UnaryClient } from "@synnaxlabs/freighter";
|
|
11
|
+
import { type UnknownRecord } from "@synnaxlabs/x";
|
|
12
|
+
|
|
13
|
+
import { type Key, type Params, type PID } from "@/workspace/pid/payload";
|
|
14
|
+
import { Retriever } from "@/workspace/pid/retriever";
|
|
15
|
+
import { Writer, type UncreatedPID } from "@/workspace/pid/writer";
|
|
16
|
+
|
|
17
|
+
export class Client {
|
|
18
|
+
private readonly writer: Writer;
|
|
19
|
+
private readonly retriever: Retriever;
|
|
20
|
+
|
|
21
|
+
constructor(client: UnaryClient) {
|
|
22
|
+
this.writer = new Writer(client);
|
|
23
|
+
this.retriever = new Retriever(client);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async create(workspace: string, pid: UncreatedPID): Promise<PID> {
|
|
27
|
+
return await this.writer.create(workspace, pid);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async rename(key: Key, name: string): Promise<void> {
|
|
31
|
+
await this.writer.rename(key, name);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async setData(key: Key, data: UnknownRecord): Promise<void> {
|
|
35
|
+
await this.writer.setData(key, data);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async retrieve(key: Key): Promise<PID>;
|
|
39
|
+
|
|
40
|
+
async retrieve(keys: Key[]): Promise<PID[]>;
|
|
41
|
+
|
|
42
|
+
async retrieve(keys: Params): Promise<PID | PID[]> {
|
|
43
|
+
const isMany = Array.isArray(keys);
|
|
44
|
+
const res = await this.retriever.retrieve(keys);
|
|
45
|
+
return isMany ? res : res[0];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async delete(keys: Params): Promise<void> {
|
|
49
|
+
await this.writer.delete(keys);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async copy(key: Key, name: string, snapshot: boolean): Promise<PID> {
|
|
53
|
+
return await this.writer.copy(key, name, snapshot);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright 2023 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.
|
|
9
|
+
|
|
10
|
+
export * from "@/workspace/pid/payload";
|
|
11
|
+
export * from "@/workspace/pid/client";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Copyright 2023 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.
|
|
9
|
+
|
|
10
|
+
export * as pid from "@/workspace/pid/external";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Copyright 2023 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.
|
|
9
|
+
|
|
10
|
+
import { type UnknownRecord, unknownRecordZ } from "@synnaxlabs/x";
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
|
|
13
|
+
export const keyZ = z.string().uuid();
|
|
14
|
+
export type Key = z.infer<typeof keyZ>;
|
|
15
|
+
export type Params = Key | Key[];
|
|
16
|
+
|
|
17
|
+
export const pidZ = z.object({
|
|
18
|
+
key: z.string(),
|
|
19
|
+
name: z.string(),
|
|
20
|
+
data: unknownRecordZ,
|
|
21
|
+
snapshot: z.boolean(),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const pidRemoteZ = z.object({
|
|
25
|
+
key: z.string(),
|
|
26
|
+
name: z.string(),
|
|
27
|
+
snapshot: z.boolean(),
|
|
28
|
+
data: z.string().transform((s) => JSON.parse(s) as UnknownRecord),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export type PID = z.infer<typeof pidZ>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// Copyright 2023 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.
|
|
9
|
+
|
|
10
|
+
import { describe, test, expect, it } from "vitest";
|
|
11
|
+
|
|
12
|
+
import { ValidationError } from "@/errors";
|
|
13
|
+
import { newClient } from "@/setupspecs";
|
|
14
|
+
|
|
15
|
+
const client = newClient();
|
|
16
|
+
|
|
17
|
+
const ZERO_UUID = "00000000-0000-0000-0000-000000000000";
|
|
18
|
+
|
|
19
|
+
describe("PID", () => {
|
|
20
|
+
describe("create", () => {
|
|
21
|
+
test("create one", async () => {
|
|
22
|
+
const ws = await client.workspaces.create({
|
|
23
|
+
name: "PID",
|
|
24
|
+
layout: { one: 1 },
|
|
25
|
+
});
|
|
26
|
+
const pid = await client.workspaces.pid.create(ws.key, {
|
|
27
|
+
name: "PID",
|
|
28
|
+
data: { one: 1 },
|
|
29
|
+
});
|
|
30
|
+
expect(pid.name).toEqual("PID");
|
|
31
|
+
expect(pid.key).not.toEqual(ZERO_UUID);
|
|
32
|
+
expect(pid.data.one).toEqual(1);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
describe("rename", () => {
|
|
36
|
+
test("rename one", async () => {
|
|
37
|
+
const ws = await client.workspaces.create({
|
|
38
|
+
name: "PID",
|
|
39
|
+
layout: { one: 1 },
|
|
40
|
+
});
|
|
41
|
+
const pid = await client.workspaces.pid.create(ws.key, {
|
|
42
|
+
name: "PID",
|
|
43
|
+
data: { one: 1 },
|
|
44
|
+
});
|
|
45
|
+
await client.workspaces.pid.rename(pid.key, "PID2");
|
|
46
|
+
const res = await client.workspaces.pid.retrieve(pid.key);
|
|
47
|
+
expect(res.name).toEqual("PID2");
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
describe("setData", () => {
|
|
51
|
+
test("set data", async () => {
|
|
52
|
+
const ws = await client.workspaces.create({
|
|
53
|
+
name: "PID",
|
|
54
|
+
layout: { one: 1 },
|
|
55
|
+
});
|
|
56
|
+
const pid = await client.workspaces.pid.create(ws.key, {
|
|
57
|
+
name: "PID",
|
|
58
|
+
data: { one: 1 },
|
|
59
|
+
});
|
|
60
|
+
await client.workspaces.pid.setData(pid.key, { two: 2 });
|
|
61
|
+
const res = await client.workspaces.pid.retrieve(pid.key);
|
|
62
|
+
expect(res.data.two).toEqual(2);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
describe("delete", () => {
|
|
66
|
+
test("delete one", async () => {
|
|
67
|
+
const ws = await client.workspaces.create({
|
|
68
|
+
name: "PID",
|
|
69
|
+
layout: { one: 1 },
|
|
70
|
+
});
|
|
71
|
+
const pid = await client.workspaces.pid.create(ws.key, {
|
|
72
|
+
name: "PID",
|
|
73
|
+
data: { one: 1 },
|
|
74
|
+
});
|
|
75
|
+
await client.workspaces.pid.delete(pid.key);
|
|
76
|
+
await expect(client.workspaces.pid.retrieve(pid.key)).rejects.toThrow();
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
describe("copy", () => {
|
|
80
|
+
test("copy one", async () => {
|
|
81
|
+
const ws = await client.workspaces.create({
|
|
82
|
+
name: "PID",
|
|
83
|
+
layout: { one: 1 },
|
|
84
|
+
});
|
|
85
|
+
const pid = await client.workspaces.pid.create(ws.key, {
|
|
86
|
+
name: "PID",
|
|
87
|
+
data: { one: 1 },
|
|
88
|
+
});
|
|
89
|
+
const pid2 = await client.workspaces.pid.copy(pid.key, "PID2", false);
|
|
90
|
+
expect(pid2.name).toEqual("PID2");
|
|
91
|
+
expect(pid2.key).not.toEqual(ZERO_UUID);
|
|
92
|
+
expect(pid2.data.one).toEqual(1);
|
|
93
|
+
});
|
|
94
|
+
describe("snapshot", () => {
|
|
95
|
+
it("should not allow the caller to edit the snapshot", async () => {
|
|
96
|
+
const ws = await client.workspaces.create({
|
|
97
|
+
name: "PID",
|
|
98
|
+
layout: { one: 1 },
|
|
99
|
+
});
|
|
100
|
+
const pid = await client.workspaces.pid.create(ws.key, {
|
|
101
|
+
name: "PID",
|
|
102
|
+
data: { one: 1 },
|
|
103
|
+
});
|
|
104
|
+
const pid2 = await client.workspaces.pid.copy(pid.key, "PID2", true);
|
|
105
|
+
await expect(
|
|
106
|
+
client.workspaces.pid.setData(pid2.key, { two: 2 }),
|
|
107
|
+
).rejects.toThrow(ValidationError);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Copyright 2023 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.
|
|
9
|
+
|
|
10
|
+
import { type UnaryClient } from "@synnaxlabs/freighter";
|
|
11
|
+
import { toArray } from "@synnaxlabs/x";
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
|
|
14
|
+
import { type PID, type Params, pidRemoteZ } from "./payload";
|
|
15
|
+
|
|
16
|
+
const reqZ = z.object({
|
|
17
|
+
keys: z.string().array(),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
type Request = z.infer<typeof reqZ>;
|
|
21
|
+
|
|
22
|
+
const resZ = z.object({
|
|
23
|
+
pids: pidRemoteZ.array(),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export class Retriever {
|
|
27
|
+
private readonly ENDPOINT = "/workspace/pid/retrieve";
|
|
28
|
+
private readonly client: UnaryClient;
|
|
29
|
+
|
|
30
|
+
constructor(client: UnaryClient) {
|
|
31
|
+
this.client = client;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async retrieve(params: Params): Promise<PID[]> {
|
|
35
|
+
const normalized = toArray(params);
|
|
36
|
+
const res = await this.execute({ keys: normalized });
|
|
37
|
+
return res;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
private async execute(request: Request): Promise<PID[]> {
|
|
41
|
+
const [res, err] = await this.client.send(this.ENDPOINT, request, resZ);
|
|
42
|
+
if (err != null) throw err;
|
|
43
|
+
return res.pids;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// Copyright 2023 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.
|
|
9
|
+
|
|
10
|
+
import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
|
|
11
|
+
import { toArray, type UnknownRecord } from "@synnaxlabs/x";
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
|
|
14
|
+
import { keyZ as workspaceKeyZ } from "@/workspace/payload";
|
|
15
|
+
import {
|
|
16
|
+
pidZ,
|
|
17
|
+
type PID,
|
|
18
|
+
type Params,
|
|
19
|
+
keyZ,
|
|
20
|
+
type Key,
|
|
21
|
+
pidRemoteZ,
|
|
22
|
+
} from "@/workspace/pid/payload";
|
|
23
|
+
|
|
24
|
+
export const crudePIDz = pidZ.partial({ key: true });
|
|
25
|
+
export const pidWriteZ = pidRemoteZ.partial({ key: true, snapshot: true });
|
|
26
|
+
|
|
27
|
+
export type UncreatedPID = z.infer<typeof pidWriteZ>;
|
|
28
|
+
|
|
29
|
+
const createReqZ = z.object({
|
|
30
|
+
workspace: workspaceKeyZ,
|
|
31
|
+
pids: pidWriteZ.array(),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const createResZ = z.object({
|
|
35
|
+
pids: pidRemoteZ.array(),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const deleteReqZ = z.object({
|
|
39
|
+
keys: keyZ.array(),
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const deleteResZ = z.object({});
|
|
43
|
+
|
|
44
|
+
const renameReqZ = z.object({
|
|
45
|
+
key: keyZ,
|
|
46
|
+
name: z.string(),
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const renameResZ = z.object({});
|
|
50
|
+
|
|
51
|
+
const setDataReqZ = z.object({
|
|
52
|
+
key: keyZ,
|
|
53
|
+
data: z.string(),
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const setDataResZ = z.object({});
|
|
57
|
+
|
|
58
|
+
const copyReqZ = z.object({
|
|
59
|
+
key: keyZ,
|
|
60
|
+
name: z.string(),
|
|
61
|
+
snapshot: z.boolean(),
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const copyResZ = z.object({
|
|
65
|
+
pid: pidRemoteZ,
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const CREATE_ENDPOINT = "/workspace/pid/create";
|
|
69
|
+
const DELETE_ENDPOINT = "/workspace/pid/delete";
|
|
70
|
+
const RENAME_ENDPOINT = "/workspace/pid/rename";
|
|
71
|
+
const SET_DATA_ENDPOINT = "/workspace/pid/set-data";
|
|
72
|
+
const COPY_ENDPOINT = "/workspace/pid/copy";
|
|
73
|
+
|
|
74
|
+
export class Writer {
|
|
75
|
+
private readonly client: UnaryClient;
|
|
76
|
+
|
|
77
|
+
constructor(client: UnaryClient) {
|
|
78
|
+
this.client = client;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async create(workspace: string, pid: UncreatedPID): Promise<PID> {
|
|
82
|
+
const pid_ = { ...pid, data: JSON.stringify(pid.data) };
|
|
83
|
+
const res = await sendRequired<typeof createReqZ, typeof createResZ>(
|
|
84
|
+
this.client,
|
|
85
|
+
CREATE_ENDPOINT,
|
|
86
|
+
{ workspace, pids: [pid_] },
|
|
87
|
+
createResZ,
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
return res.pids[0];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async copy(key: Key, name: string, snapshot: boolean): Promise<PID> {
|
|
94
|
+
const res = await sendRequired<typeof copyReqZ, typeof copyResZ>(
|
|
95
|
+
this.client,
|
|
96
|
+
COPY_ENDPOINT,
|
|
97
|
+
{ key, name, snapshot },
|
|
98
|
+
copyResZ,
|
|
99
|
+
);
|
|
100
|
+
return res.pid;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async delete(params: Params): Promise<void> {
|
|
104
|
+
const normalized = toArray(params);
|
|
105
|
+
await sendRequired<typeof deleteReqZ, typeof deleteResZ>(
|
|
106
|
+
this.client,
|
|
107
|
+
DELETE_ENDPOINT,
|
|
108
|
+
{ keys: normalized },
|
|
109
|
+
deleteResZ,
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
async rename(pid: Key, name: string): Promise<void> {
|
|
114
|
+
await sendRequired<typeof renameReqZ, typeof renameResZ>(
|
|
115
|
+
this.client,
|
|
116
|
+
RENAME_ENDPOINT,
|
|
117
|
+
{ key: pid, name },
|
|
118
|
+
renameResZ,
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
async setData(pid: Key, data: UnknownRecord): Promise<void> {
|
|
123
|
+
await sendRequired<typeof setDataReqZ, typeof setDataResZ>(
|
|
124
|
+
this.client,
|
|
125
|
+
SET_DATA_ENDPOINT,
|
|
126
|
+
{ key: pid, data: JSON.stringify(data) },
|
|
127
|
+
renameResZ,
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Copyright 2023 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.
|
|
9
|
+
|
|
10
|
+
import { type UnaryClient } from "@synnaxlabs/freighter";
|
|
11
|
+
import { toArray } from "@synnaxlabs/x";
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
type Params,
|
|
16
|
+
type Workspace,
|
|
17
|
+
keyZ,
|
|
18
|
+
workspaceRemoteZ,
|
|
19
|
+
} from "@/workspace/payload";
|
|
20
|
+
|
|
21
|
+
const reqZ = z.object({
|
|
22
|
+
keys: keyZ.array().optional(),
|
|
23
|
+
search: z.string().optional(),
|
|
24
|
+
author: z.string().uuid().optional(),
|
|
25
|
+
offset: z.number().optional(),
|
|
26
|
+
limit: z.number().optional(),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
type Request = z.infer<typeof reqZ>;
|
|
30
|
+
|
|
31
|
+
const resZ = z.object({
|
|
32
|
+
workspaces: workspaceRemoteZ.array(),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export class Retriever {
|
|
36
|
+
private static readonly ENDPOINT = "/workspace/retrieve";
|
|
37
|
+
|
|
38
|
+
private readonly client: UnaryClient;
|
|
39
|
+
|
|
40
|
+
constructor(client: UnaryClient) {
|
|
41
|
+
this.client = client;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async retrieve(params: Params): Promise<Workspace[]> {
|
|
45
|
+
const normalized = toArray(params);
|
|
46
|
+
return await this.execute({ keys: normalized });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async retrieveByAuthor(author: string): Promise<Workspace[]> {
|
|
50
|
+
return await this.execute({ author });
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async search(term: string): Promise<Workspace[]> {
|
|
54
|
+
return await this.execute({ search: term });
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async page(offset: number, limit: number): Promise<Workspace[]> {
|
|
58
|
+
return await this.execute({ offset, limit });
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private async execute(request: Request): Promise<Workspace[]> {
|
|
62
|
+
const [res, err] = await this.client.send(Retriever.ENDPOINT, request, resZ);
|
|
63
|
+
if (err != null) throw err;
|
|
64
|
+
return res.workspaces;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Copyright 2023 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.
|
|
9
|
+
|
|
10
|
+
import { describe, test, expect } from "vitest";
|
|
11
|
+
|
|
12
|
+
import { newClient } from "@/setupspecs";
|
|
13
|
+
|
|
14
|
+
const client = newClient();
|
|
15
|
+
|
|
16
|
+
const ZERO_UUID = "00000000-0000-0000-0000-000000000000";
|
|
17
|
+
|
|
18
|
+
describe("Workspace", () => {
|
|
19
|
+
describe("create", () => {
|
|
20
|
+
test("create one", async () => {
|
|
21
|
+
const pid = await client.workspaces.create({
|
|
22
|
+
name: "PID",
|
|
23
|
+
layout: { one: 1 },
|
|
24
|
+
});
|
|
25
|
+
expect(pid.name).toEqual("PID");
|
|
26
|
+
expect(pid.key).not.toEqual(ZERO_UUID);
|
|
27
|
+
expect(pid.layout.one).toEqual(1);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
describe("rename", () => {
|
|
31
|
+
test("rename one", async () => {
|
|
32
|
+
const ws = await client.workspaces.create({
|
|
33
|
+
name: "PID",
|
|
34
|
+
layout: { one: 1 },
|
|
35
|
+
});
|
|
36
|
+
await client.workspaces.rename(ws.key, "PID2");
|
|
37
|
+
const res = await client.workspaces.retrieve(ws.key);
|
|
38
|
+
expect(res.name).toEqual("PID2");
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
describe("setLayout", () => {
|
|
42
|
+
test("set layout", async () => {
|
|
43
|
+
const ws = await client.workspaces.create({
|
|
44
|
+
name: "PID",
|
|
45
|
+
layout: { one: 1 },
|
|
46
|
+
});
|
|
47
|
+
await client.workspaces.setLayout(ws.key, { two: 2 });
|
|
48
|
+
const res = await client.workspaces.retrieve(ws.key);
|
|
49
|
+
expect(res.layout.two).toEqual(2);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
describe("delete", () => {
|
|
53
|
+
test("delete one", async () => {
|
|
54
|
+
const ws = await client.workspaces.create({
|
|
55
|
+
name: "PID",
|
|
56
|
+
layout: { one: 1 },
|
|
57
|
+
});
|
|
58
|
+
await client.workspaces.delete(ws.key);
|
|
59
|
+
await expect(client.workspaces.retrieve(ws.key)).rejects.toThrow();
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// Copyright 2023 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.
|
|
9
|
+
|
|
10
|
+
import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
|
|
11
|
+
import { toArray, type UnknownRecord } from "@synnaxlabs/x";
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
|
|
14
|
+
import { type Workspace, workspaceZ, keyZ, workspaceRemoteZ } from "./payload";
|
|
15
|
+
|
|
16
|
+
const crudeWorkspaceZ = workspaceZ.partial({ key: true });
|
|
17
|
+
const workspaceWriteZ = workspaceRemoteZ.partial({ key: true });
|
|
18
|
+
|
|
19
|
+
export type CrudeWorkspace = z.infer<typeof crudeWorkspaceZ>;
|
|
20
|
+
|
|
21
|
+
const createReqZ = z.object({
|
|
22
|
+
workspaces: workspaceWriteZ.partial({ key: true }).array(),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const createResZ = z.object({
|
|
26
|
+
workspaces: workspaceRemoteZ.array(),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const deleteReqZ = z.object({
|
|
30
|
+
keys: keyZ.array(),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const deleteResZ = z.object({});
|
|
34
|
+
|
|
35
|
+
const renameReqZ = z.object({
|
|
36
|
+
key: keyZ,
|
|
37
|
+
name: z.string(),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const renameResZ = z.object({});
|
|
41
|
+
|
|
42
|
+
const setLayoutReqZ = z.object({
|
|
43
|
+
key: keyZ,
|
|
44
|
+
layout: z.string(),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const setLayoutResZ = z.object({});
|
|
48
|
+
|
|
49
|
+
export type CreateResponse = z.infer<typeof createResZ>;
|
|
50
|
+
|
|
51
|
+
const CREATE_ENDPOINT = "/workspace/create";
|
|
52
|
+
const DELETE_ENDPOINT = "/workspace/delete";
|
|
53
|
+
const RENAME_ENDPOINT = "/workspace/rename";
|
|
54
|
+
const SET_LAYOUT_ENDPOINT = "/workspace/set-layout";
|
|
55
|
+
|
|
56
|
+
export class Writer {
|
|
57
|
+
private readonly client: UnaryClient;
|
|
58
|
+
|
|
59
|
+
constructor(client: UnaryClient) {
|
|
60
|
+
this.client = client;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async create(workspaces: CrudeWorkspace | CrudeWorkspace[]): Promise<Workspace[]> {
|
|
64
|
+
const ws = toArray(workspaces).map((w) => ({
|
|
65
|
+
...w,
|
|
66
|
+
layout: JSON.stringify(w.layout),
|
|
67
|
+
}));
|
|
68
|
+
const res = await sendRequired<typeof createReqZ, typeof createResZ>(
|
|
69
|
+
this.client,
|
|
70
|
+
CREATE_ENDPOINT,
|
|
71
|
+
{ workspaces: ws },
|
|
72
|
+
createResZ,
|
|
73
|
+
);
|
|
74
|
+
return res.workspaces;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async delete(keys: string | string[]): Promise<void> {
|
|
78
|
+
await sendRequired<typeof deleteReqZ, typeof deleteResZ>(
|
|
79
|
+
this.client,
|
|
80
|
+
DELETE_ENDPOINT,
|
|
81
|
+
{ keys: toArray(keys) },
|
|
82
|
+
deleteResZ,
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async rename(key: string, name: string): Promise<void> {
|
|
87
|
+
await sendRequired<typeof renameReqZ, typeof renameResZ>(
|
|
88
|
+
this.client,
|
|
89
|
+
RENAME_ENDPOINT,
|
|
90
|
+
{ key, name },
|
|
91
|
+
renameResZ,
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
async setLayout(key: string, layout: UnknownRecord): Promise<void> {
|
|
96
|
+
await sendRequired<typeof setLayoutReqZ, typeof setLayoutResZ>(
|
|
97
|
+
this.client,
|
|
98
|
+
SET_LAYOUT_ENDPOINT,
|
|
99
|
+
{ key, layout: JSON.stringify(layout) },
|
|
100
|
+
setLayoutResZ,
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
}
|
package/tsconfig.json
ADDED
package/vite.config.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Copyright 2023 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.
|
|
9
|
+
|
|
10
|
+
import { lib } from "@synnaxlabs/vite-plugin";
|
|
11
|
+
import { defineConfig } from "vite";
|
|
12
|
+
|
|
13
|
+
export default defineConfig({
|
|
14
|
+
plugins: [lib({ name: "client" })],
|
|
15
|
+
build: {
|
|
16
|
+
minify: false,
|
|
17
|
+
rollupOptions: {
|
|
18
|
+
external: "zod",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
test: {
|
|
22
|
+
globals: true,
|
|
23
|
+
environment: "jsdom",
|
|
24
|
+
},
|
|
25
|
+
});
|
package/CHANGELOG.md
DELETED
package/build/main/index.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { default as Synnax } from './lib/client';
|
|
2
|
-
export * from './lib/telem';
|
|
3
|
-
export { AuthError, ContiguityError, GeneralError, ParseError, QueryError, RouteError, UnexpectedError, ValidationError, } from './lib/errors';
|
|
4
|
-
export { Channel } from './lib/channel/client';
|