@synnaxlabs/client 0.20.0 → 0.22.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 -7
- package/.vscode/settings.json +3 -0
- package/README.md +13 -0
- package/dist/auth/auth.d.ts +7 -6
- package/dist/auth/auth.d.ts.map +1 -1
- package/dist/channel/client.d.ts +14 -11
- package/dist/channel/client.d.ts.map +1 -1
- package/dist/channel/creator.d.ts +10 -0
- package/dist/channel/creator.d.ts.map +1 -0
- package/dist/channel/payload.d.ts +6 -2
- package/dist/channel/payload.d.ts.map +1 -1
- package/dist/channel/retriever.d.ts +65 -35
- package/dist/channel/retriever.d.ts.map +1 -1
- package/dist/channel/writer.d.ts +4 -3
- package/dist/client.cjs +19 -22
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +12 -10
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +6781 -6675
- package/dist/client.js.map +1 -1
- package/dist/connection/checker.d.ts +4 -3
- package/dist/connection/checker.d.ts.map +1 -1
- package/dist/control/authority.d.ts +2 -1
- package/dist/control/state.d.ts +6 -4
- package/dist/control/state.d.ts.map +1 -1
- package/dist/errors.d.ts +24 -20
- package/dist/errors.d.ts.map +1 -1
- package/dist/framer/adapter.d.ts +5 -4
- package/dist/framer/adapter.d.ts.map +1 -1
- package/dist/framer/client.d.ts +12 -12
- package/dist/framer/client.d.ts.map +1 -1
- package/dist/framer/frame.d.ts +13 -12
- package/dist/framer/frame.d.ts.map +1 -1
- package/dist/framer/iterator.d.ts +5 -4
- package/dist/framer/iterator.d.ts.map +1 -1
- package/dist/framer/streamProxy.d.ts +3 -2
- package/dist/framer/streamProxy.d.ts.map +1 -1
- package/dist/framer/streamer.d.ts +13 -4
- package/dist/framer/streamer.d.ts.map +1 -1
- package/dist/framer/writer.d.ts +67 -33
- package/dist/framer/writer.d.ts.map +1 -1
- package/dist/hardware/client.d.ts +4 -3
- package/dist/hardware/device/client.d.ts +107 -14
- package/dist/hardware/device/client.d.ts.map +1 -1
- package/dist/hardware/device/external.d.ts +0 -2
- package/dist/hardware/device/external.d.ts.map +1 -1
- package/dist/hardware/device/index.d.ts +1 -1
- package/dist/hardware/device/index.d.ts.map +1 -1
- package/dist/hardware/rack/client.d.ts +43 -20
- package/dist/hardware/rack/client.d.ts.map +1 -1
- package/dist/hardware/rack/external.d.ts +0 -2
- package/dist/hardware/rack/external.d.ts.map +1 -1
- package/dist/hardware/task/client.d.ts +197 -14
- package/dist/hardware/task/client.d.ts.map +1 -1
- package/dist/hardware/task/index.d.ts +1 -1
- package/dist/hardware/task/index.d.ts.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/label/client.d.ts +8 -6
- package/dist/label/client.d.ts.map +1 -1
- package/dist/label/payload.d.ts +2 -1
- package/dist/label/retriever.d.ts +3 -2
- package/dist/label/writer.d.ts +4 -3
- package/dist/ontology/client.d.ts +82 -14
- package/dist/ontology/client.d.ts.map +1 -1
- package/dist/ontology/external.d.ts +0 -1
- package/dist/ontology/external.d.ts.map +1 -1
- package/dist/ontology/group/client.d.ts +3 -2
- package/dist/ontology/group/client.d.ts.map +1 -1
- package/dist/ontology/group/group.d.ts +1 -0
- package/dist/ontology/group/payload.d.ts +2 -1
- package/dist/ontology/group/writer.d.ts +4 -3
- package/dist/ontology/payload.d.ts +71 -60
- package/dist/ontology/payload.d.ts.map +1 -1
- package/dist/ontology/writer.d.ts +3 -2
- package/dist/ranger/active.d.ts +3 -2
- package/dist/ranger/alias.d.ts +7 -6
- package/dist/ranger/alias.d.ts.map +1 -1
- package/dist/ranger/client.d.ts +162 -11
- package/dist/ranger/client.d.ts.map +1 -1
- package/dist/ranger/external.d.ts +0 -1
- package/dist/ranger/external.d.ts.map +1 -1
- package/dist/ranger/kv.d.ts +5 -3
- package/dist/ranger/kv.d.ts.map +1 -1
- package/dist/ranger/payload.d.ts +57 -50
- package/dist/ranger/payload.d.ts.map +1 -1
- package/dist/ranger/range.d.ts +12 -10
- package/dist/ranger/range.d.ts.map +1 -1
- package/dist/ranger/writer.d.ts +3 -2
- package/dist/setupspecs.d.ts +2 -1
- package/dist/signals/observable.d.ts +8 -15
- package/dist/signals/observable.d.ts.map +1 -1
- package/dist/transport.d.ts +3 -2
- package/dist/transport.d.ts.map +1 -1
- package/dist/user/payload.d.ts +2 -1
- package/dist/util/retrieve.d.ts +24 -0
- package/dist/util/retrieve.d.ts.map +1 -0
- package/dist/util/retrieve.spec.d.ts +2 -0
- package/dist/util/retrieve.spec.d.ts.map +1 -0
- package/dist/util/telem.d.ts +2 -1
- package/dist/util/telem.d.ts.map +1 -1
- package/dist/util/zod.d.ts +4 -0
- package/dist/util/zod.d.ts.map +1 -0
- package/dist/workspace/client.d.ts +9 -6
- package/dist/workspace/client.d.ts.map +1 -1
- package/dist/workspace/lineplot/client.d.ts +6 -5
- package/dist/workspace/lineplot/client.d.ts.map +1 -1
- package/dist/workspace/lineplot/payload.d.ts +3 -2
- package/dist/workspace/lineplot/payload.d.ts.map +1 -1
- package/dist/workspace/lineplot/retriever.d.ts +3 -2
- package/dist/workspace/lineplot/retriever.d.ts.map +1 -1
- package/dist/workspace/lineplot/writer.d.ts +7 -6
- package/dist/workspace/lineplot/writer.d.ts.map +1 -1
- package/dist/workspace/payload.d.ts +3 -2
- package/dist/workspace/payload.d.ts.map +1 -1
- package/dist/workspace/retriever.d.ts +3 -2
- package/dist/workspace/schematic/client.d.ts +18 -0
- package/dist/workspace/schematic/client.d.ts.map +1 -0
- package/dist/workspace/schematic/external.d.ts.map +1 -0
- package/dist/workspace/schematic/index.d.ts +2 -0
- package/dist/workspace/schematic/index.d.ts.map +1 -0
- package/dist/workspace/{pid → schematic}/payload.d.ts +6 -5
- package/dist/workspace/schematic/payload.d.ts.map +1 -0
- package/dist/workspace/schematic/retriever.d.ts +10 -0
- package/dist/workspace/schematic/retriever.d.ts.map +1 -0
- package/dist/workspace/schematic/schematic.spec.d.ts +2 -0
- package/dist/workspace/schematic/schematic.spec.d.ts.map +1 -0
- package/dist/workspace/{pid → schematic}/writer.d.ts +11 -10
- package/dist/workspace/schematic/writer.d.ts.map +1 -0
- package/dist/workspace/writer.d.ts +5 -4
- package/dist/workspace/writer.d.ts.map +1 -1
- package/examples/node/package-lock.json +29 -12
- package/examples/node/package.json +2 -2
- package/examples/node/streamWrite.js +8 -11
- package/package.json +10 -9
- package/src/auth/auth.spec.ts +55 -15
- package/src/auth/auth.ts +41 -42
- package/src/channel/batchRetriever.spec.ts +37 -40
- package/src/channel/channel.spec.ts +4 -4
- package/src/channel/client.ts +42 -49
- package/src/channel/creator.ts +37 -0
- package/src/channel/payload.ts +2 -1
- package/src/channel/retriever.ts +55 -71
- package/src/client.ts +23 -20
- package/src/connection/checker.ts +1 -1
- package/src/connection/connection.spec.ts +1 -6
- package/src/control/state.ts +3 -1
- package/src/errors.ts +71 -67
- package/src/framer/adapter.spec.ts +33 -1
- package/src/framer/adapter.ts +10 -6
- package/src/framer/client.ts +13 -12
- package/src/framer/frame.spec.ts +1 -1
- package/src/framer/frame.ts +9 -6
- package/src/framer/iterator.spec.ts +1 -1
- package/src/framer/iterator.ts +1 -1
- package/src/framer/streamProxy.ts +12 -13
- package/src/framer/streamer.spec.ts +1 -1
- package/src/framer/streamer.ts +25 -1
- package/src/framer/writer.spec.ts +49 -2
- package/src/framer/writer.ts +27 -2
- package/src/hardware/device/client.ts +155 -28
- package/src/hardware/device/device.spec.ts +2 -2
- package/src/hardware/device/external.ts +0 -2
- package/src/hardware/device/index.ts +2 -2
- package/src/hardware/rack/client.ts +139 -56
- package/src/hardware/rack/external.ts +0 -2
- package/src/hardware/rack/rack.spec.ts +20 -1
- package/src/hardware/task/client.ts +324 -31
- package/src/hardware/task/index.ts +1 -1
- package/src/hardware/task/task.spec.ts +41 -0
- package/src/index.ts +3 -4
- package/src/label/client.ts +3 -2
- package/src/label/retriever.ts +1 -1
- package/src/label/writer.ts +1 -1
- package/src/ontology/client.ts +195 -41
- package/src/ontology/external.ts +0 -1
- package/src/ontology/group/client.ts +1 -2
- package/src/ontology/group/payload.ts +1 -1
- package/src/ontology/ontology.spec.ts +16 -0
- package/src/ontology/payload.ts +22 -13
- package/src/ranger/active.ts +5 -5
- package/src/ranger/alias.ts +2 -2
- package/src/ranger/client.ts +68 -17
- package/src/ranger/external.ts +0 -1
- package/src/ranger/kv.ts +6 -1
- package/src/ranger/payload.ts +6 -4
- package/src/ranger/range.ts +4 -1
- package/src/ranger/ranger.spec.ts +24 -2
- package/src/signals/observable.ts +24 -63
- package/src/transport.ts +2 -1
- package/src/util/retrieve.spec.ts +56 -0
- package/src/util/retrieve.ts +103 -0
- package/src/util/telem.ts +1 -1
- package/src/util/zod.ts +4 -0
- package/src/workspace/client.ts +6 -4
- package/src/workspace/lineplot/client.ts +3 -3
- package/src/workspace/lineplot/linePlot.spec.ts +11 -11
- package/src/workspace/lineplot/payload.ts +1 -1
- package/src/workspace/lineplot/retriever.ts +5 -13
- package/src/workspace/lineplot/writer.ts +8 -7
- package/src/workspace/payload.ts +6 -3
- package/src/workspace/retriever.ts +1 -1
- package/src/workspace/{pid → schematic}/client.ts +10 -10
- package/src/workspace/{pid → schematic}/external.ts +2 -2
- package/src/workspace/{pid → schematic}/index.ts +1 -1
- package/src/workspace/{pid → schematic}/payload.ts +4 -4
- package/src/workspace/{pid → schematic}/retriever.ts +10 -10
- package/src/workspace/{pid/pid.spec.ts → schematic/schematic.spec.ts} +35 -35
- package/src/workspace/{pid → schematic}/writer.ts +26 -25
- package/src/workspace/workspace.spec.ts +7 -7
- package/src/workspace/writer.ts +8 -2
- package/dist/hardware/device/payload.d.ts +0 -30
- package/dist/hardware/device/payload.d.ts.map +0 -1
- package/dist/hardware/device/retriever.d.ts +0 -10
- package/dist/hardware/device/retriever.d.ts.map +0 -1
- package/dist/hardware/device/writer.d.ts +0 -9
- package/dist/hardware/device/writer.d.ts.map +0 -1
- package/dist/hardware/rack/payload.d.ts +0 -26
- package/dist/hardware/rack/payload.d.ts.map +0 -1
- package/dist/hardware/rack/retriever.d.ts +0 -10
- package/dist/hardware/rack/retriever.d.ts.map +0 -1
- package/dist/hardware/rack/writer.d.ts +0 -9
- package/dist/hardware/rack/writer.d.ts.map +0 -1
- package/dist/hardware/task/external.d.ts +0 -4
- package/dist/hardware/task/external.d.ts.map +0 -1
- package/dist/hardware/task/payload.d.ts +0 -42
- package/dist/hardware/task/payload.d.ts.map +0 -1
- package/dist/hardware/task/retriever.d.ts +0 -29
- package/dist/hardware/task/retriever.d.ts.map +0 -1
- package/dist/hardware/task/writer.d.ts +0 -9
- package/dist/hardware/task/writer.d.ts.map +0 -1
- package/dist/ontology/retriever.d.ts +0 -13
- package/dist/ontology/retriever.d.ts.map +0 -1
- package/dist/ontology/signals.d.ts +0 -30
- package/dist/ontology/signals.d.ts.map +0 -1
- package/dist/ranger/retriever.d.ts +0 -11
- package/dist/ranger/retriever.d.ts.map +0 -1
- package/dist/workspace/pid/client.d.ts +0 -17
- package/dist/workspace/pid/client.d.ts.map +0 -1
- package/dist/workspace/pid/external.d.ts.map +0 -1
- package/dist/workspace/pid/index.d.ts +0 -2
- package/dist/workspace/pid/index.d.ts.map +0 -1
- package/dist/workspace/pid/payload.d.ts.map +0 -1
- package/dist/workspace/pid/pid.spec.d.ts +0 -2
- package/dist/workspace/pid/pid.spec.d.ts.map +0 -1
- package/dist/workspace/pid/retriever.d.ts +0 -9
- package/dist/workspace/pid/retriever.d.ts.map +0 -1
- package/dist/workspace/pid/writer.d.ts.map +0 -1
- package/src/hardware/device/payload.ts +0 -27
- package/src/hardware/device/retriever.ts +0 -60
- package/src/hardware/device/writer.ts +0 -59
- package/src/hardware/rack/payload.ts +0 -26
- package/src/hardware/rack/retriever.ts +0 -68
- package/src/hardware/rack/writer.ts +0 -59
- package/src/hardware/task/external.ts +0 -12
- package/src/hardware/task/payload.ts +0 -40
- package/src/hardware/task/retriever.ts +0 -70
- package/src/hardware/task/writer.ts +0 -65
- package/src/ontology/retriever.ts +0 -91
- package/src/ontology/signals.ts +0 -139
- package/src/ranger/retriever.ts +0 -50
- /package/dist/workspace/{pid → schematic}/external.d.ts +0 -0
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type UnaryClient } from "@synnaxlabs/freighter";
|
|
2
|
-
import { ID, type Resource } from './payload';
|
|
3
|
-
export declare class Retriever {
|
|
4
|
-
private static readonly ENDPOINT;
|
|
5
|
-
private readonly client;
|
|
6
|
-
constructor(unary: UnaryClient);
|
|
7
|
-
search(term: string): Promise<Resource[]>;
|
|
8
|
-
retrieve(ids: ID | ID[] | string | string[], includeSchema?: boolean, includeFieldData?: boolean): Promise<Resource[]>;
|
|
9
|
-
retrieveChildren(ids: ID | ID[], includeSchema?: boolean, includeFieldData?: boolean): Promise<Resource[]>;
|
|
10
|
-
retrieveParents(ids: ID | ID[], includeSchema?: boolean, includeFieldData?: boolean): Promise<Resource[]>;
|
|
11
|
-
private execute;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=retriever.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retriever.d.ts","sourceRoot":"","sources":["../../src/ontology/retriever.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIvE,OAAO,EAAE,EAAE,EAAE,KAAK,QAAQ,EAAwB,MAAM,oBAAoB,CAAC;AAiB7E,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAwB;IACxD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,KAAK,EAAE,WAAW;IAIxB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAKzC,QAAQ,CACZ,GAAG,EAAE,EAAE,GAAG,EAAE,EAAE,GAAG,MAAM,GAAG,MAAM,EAAE,EAClC,aAAa,GAAE,OAAc,EAC7B,gBAAgB,GAAE,OAAc,GAC/B,OAAO,CAAC,QAAQ,EAAE,CAAC;IAQhB,gBAAgB,CACpB,GAAG,EAAE,EAAE,GAAG,EAAE,EAAE,EACd,aAAa,GAAE,OAAc,EAC7B,gBAAgB,GAAE,OAAc,GAC/B,OAAO,CAAC,QAAQ,EAAE,CAAC;IAShB,eAAe,CACnB,GAAG,EAAE,EAAE,GAAG,EAAE,EAAE,EACd,aAAa,GAAE,OAAc,EAC7B,gBAAgB,GAAE,OAAc,GAC/B,OAAO,CAAC,QAAQ,EAAE,CAAC;YASR,OAAO;CAStB"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { observe, type change } from "@synnaxlabs/x";
|
|
2
|
-
import { type Client as FrameClient } from '../framer/client';
|
|
3
|
-
import { type Streamer as FrameStreamer } from '../framer/streamer';
|
|
4
|
-
import { ID, type Relationship, type Resource } from './payload';
|
|
5
|
-
import { type Retriever } from './retriever';
|
|
6
|
-
export type ResourceChange = change.Change<ID, Resource>;
|
|
7
|
-
export type ResourceSet = change.Set<ID, Resource>;
|
|
8
|
-
export type ResourceDelete = change.Delete<ID, Resource>;
|
|
9
|
-
export type RelationshipChange = change.Change<Relationship, undefined>;
|
|
10
|
-
export type RelationshipSet = change.Set<Relationship, undefined>;
|
|
11
|
-
export type RelationshipDelete = change.Delete<Relationship, undefined>;
|
|
12
|
-
export declare class ChangeTracker {
|
|
13
|
-
private readonly resourceObs;
|
|
14
|
-
private readonly relationshipObs;
|
|
15
|
-
readonly relationships: observe.Observable<RelationshipChange[]>;
|
|
16
|
-
readonly resources: observe.Observable<ResourceChange[]>;
|
|
17
|
-
private readonly streamer;
|
|
18
|
-
private readonly retriever;
|
|
19
|
-
private readonly closePromise;
|
|
20
|
-
constructor(streamer: FrameStreamer, retriever: Retriever);
|
|
21
|
-
close(): Promise<void>;
|
|
22
|
-
private start;
|
|
23
|
-
private update;
|
|
24
|
-
private parseRelationshipSets;
|
|
25
|
-
private parseRelationshipDeletes;
|
|
26
|
-
private parseResourceSets;
|
|
27
|
-
private parseResourceDeletes;
|
|
28
|
-
static open(client: FrameClient, retriever: Retriever): Promise<ChangeTracker>;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=signals.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signals.d.ts","sourceRoot":"","sources":["../../src/ontology/signals.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAGrD,OAAO,EAAE,KAAK,MAAM,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,EAAE,KAAK,QAAQ,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EACL,EAAE,EAEF,KAAK,YAAY,EACjB,KAAK,QAAQ,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;AACzD,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;AACnD,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;AACzD,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;AACxE,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;AAClE,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;AAOxE,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqC;IACjE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAyC;IAEzE,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC,UAAU,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACjE,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC,CAAC;IAEzD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;IACzC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;IACtC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAgB;gBAEjC,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS;IAUnD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAKd,KAAK;YAML,MAAM;IAYpB,OAAO,CAAC,qBAAqB;IAU7B,OAAO,CAAC,wBAAwB;YASlB,iBAAiB;IAqB/B,OAAO,CAAC,oBAAoB;WAUf,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC;CASrF"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type UnaryClient } from "@synnaxlabs/freighter";
|
|
2
|
-
import { type Params, type Payload } from "./payload";
|
|
3
|
-
export declare class Retriever {
|
|
4
|
-
private readonly ENDPOINT;
|
|
5
|
-
private readonly client;
|
|
6
|
-
constructor(client: UnaryClient);
|
|
7
|
-
retrieve(params: Params): Promise<Payload[]>;
|
|
8
|
-
search(term: string): Promise<Payload[]>;
|
|
9
|
-
private execute;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=retriever.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retriever.d.ts","sourceRoot":"","sources":["../../src/ranger/retriever.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGzD,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,EAAiC,MAAM,WAAW,CAAC;AAcrF,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;IAC9C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,MAAM,EAAE,WAAW;IAIzB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAM5C,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;YAIhC,OAAO;CAKtB"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type UnaryClient } from "@synnaxlabs/freighter";
|
|
2
|
-
import { type UnknownRecord } from "@synnaxlabs/x";
|
|
3
|
-
import { type Key, type Params, type PID } from './payload';
|
|
4
|
-
import { type NewPID } from './writer';
|
|
5
|
-
export declare class Client {
|
|
6
|
-
private readonly writer;
|
|
7
|
-
private readonly retriever;
|
|
8
|
-
constructor(client: UnaryClient);
|
|
9
|
-
create(workspace: string, pid: NewPID): Promise<PID>;
|
|
10
|
-
rename(key: Key, name: string): Promise<void>;
|
|
11
|
-
setData(key: Key, data: UnknownRecord): Promise<void>;
|
|
12
|
-
retrieve(key: Key): Promise<PID>;
|
|
13
|
-
retrieve(keys: Key[]): Promise<PID[]>;
|
|
14
|
-
delete(keys: Params): Promise<void>;
|
|
15
|
-
copy(key: Key, name: string, snapshot: boolean): Promise<PID>;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/workspace/pid/client.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,MAAM,EAAE,KAAK,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAE1E,OAAO,EAAU,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAE7D,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,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAIpD,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,GAAG,CAAC;IAEhC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAQrC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAInC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC;CAGpE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../../../src/workspace/pid/external.ts"],"names":[],"mappings":"AASA,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/workspace/pid/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,GAAG,MAAM,0BAA0B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../../src/workspace/pid/payload.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,aAAa,EAAkB,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,IAAI,aAAoB,CAAC;AACtC,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AACvC,MAAM,MAAM,MAAM,GAAG,GAAG,GAAG,GAAG,EAAE,CAAC;AAEjC,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;EAKf,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;EAKrB,CAAC;AAEH,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pid.spec.d.ts","sourceRoot":"","sources":["../../../src/workspace/pid/pid.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type UnaryClient } from "@synnaxlabs/freighter";
|
|
2
|
-
import { type PID, type Params } from "./payload";
|
|
3
|
-
export declare class Retriever {
|
|
4
|
-
private readonly ENDPOINT;
|
|
5
|
-
private readonly client;
|
|
6
|
-
constructor(client: UnaryClient);
|
|
7
|
-
retrieve(params: Params): Promise<PID[]>;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=retriever.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retriever.d.ts","sourceRoot":"","sources":["../../../src/workspace/pid/retriever.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIvE,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,MAAM,EAAc,MAAM,WAAW,CAAC;AAY9D,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA6B;IACtD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,MAAM,EAAE,WAAW;IAIzB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;CAS/C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../../src/workspace/pid/writer.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAW,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAEL,KAAK,GAAG,EACR,KAAK,MAAM,EAEX,KAAK,GAAG,EAET,MAAM,yBAAyB,CAAC;AAEjC,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;EAGjB,CAAC;AAEJ,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;AA+C7C,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;IAapD,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC;IAW7D,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWrC,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;CAS5D"}
|
|
@@ -1,27 +0,0 @@
|
|
|
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.
|
|
9
|
-
|
|
10
|
-
import { z } from "zod";
|
|
11
|
-
|
|
12
|
-
import { rackKeyZ } from "@/hardware/rack/payload";
|
|
13
|
-
|
|
14
|
-
export const deviceKeyZ = z.string();
|
|
15
|
-
|
|
16
|
-
export const deviceZ = z.object({
|
|
17
|
-
key: deviceKeyZ,
|
|
18
|
-
rack: rackKeyZ,
|
|
19
|
-
name: z.string(),
|
|
20
|
-
make: z.string(),
|
|
21
|
-
model: z.string(),
|
|
22
|
-
location: z.string(),
|
|
23
|
-
properties: z.string(),
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
export type Device = z.infer<typeof deviceZ>;
|
|
27
|
-
export type DeviceKey = z.infer<typeof deviceKeyZ>;
|
|
@@ -1,60 +0,0 @@
|
|
|
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.
|
|
9
|
-
|
|
10
|
-
import { type UnaryClient, sendRequired } from "@synnaxlabs/freighter";
|
|
11
|
-
import { z } from "zod";
|
|
12
|
-
|
|
13
|
-
import { type Device, deviceKeyZ, deviceZ } from "@/hardware/device/payload";
|
|
14
|
-
import { AsyncTermSearcher } from "@synnaxlabs/x";
|
|
15
|
-
|
|
16
|
-
const RETRIEVE_ENDPOINT = "/hardware/device/retrieve";
|
|
17
|
-
|
|
18
|
-
const retrieveDeviceReqZ = z.object({
|
|
19
|
-
search: z.string().optional(),
|
|
20
|
-
limit: z.number().optional(),
|
|
21
|
-
offset: z.number().optional(),
|
|
22
|
-
keys: deviceKeyZ.array().optional(),
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const retrieveDeviceResZ = z.object({
|
|
26
|
-
devices: deviceZ.array(),
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
export class Retriever {
|
|
30
|
-
private readonly client: UnaryClient;
|
|
31
|
-
|
|
32
|
-
constructor(client: UnaryClient) {
|
|
33
|
-
this.client = client;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
async search(term: string): Promise<Device[]> {
|
|
37
|
-
const res = await sendRequired<
|
|
38
|
-
typeof retrieveDeviceReqZ,
|
|
39
|
-
typeof retrieveDeviceResZ
|
|
40
|
-
>(this.client, RETRIEVE_ENDPOINT, { keys: [term] }, retrieveDeviceReqZ, retrieveDeviceResZ);
|
|
41
|
-
return res.devices;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
async page(offset: number, limit: number): Promise<Device[]> {
|
|
45
|
-
const res = await sendRequired<
|
|
46
|
-
typeof retrieveDeviceReqZ,
|
|
47
|
-
typeof retrieveDeviceResZ
|
|
48
|
-
>(this.client, RETRIEVE_ENDPOINT, { offset, limit }, retrieveDeviceReqZ, retrieveDeviceResZ);
|
|
49
|
-
return res.devices;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
async retrieve(keys: string[]): Promise<Device[]> {
|
|
54
|
-
const res = await sendRequired<
|
|
55
|
-
typeof retrieveDeviceReqZ,
|
|
56
|
-
typeof retrieveDeviceResZ
|
|
57
|
-
>(this.client, RETRIEVE_ENDPOINT, { keys }, retrieveDeviceReqZ, retrieveDeviceResZ);
|
|
58
|
-
return res.devices;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
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.
|
|
9
|
-
|
|
10
|
-
import { type UnaryClient, sendRequired } from "@synnaxlabs/freighter";
|
|
11
|
-
import { z } from "zod";
|
|
12
|
-
|
|
13
|
-
import { type Device, deviceKeyZ, deviceZ } from "@/hardware/device/payload";
|
|
14
|
-
|
|
15
|
-
const CREATE_ENDPOINT = "/hardware/device/create";
|
|
16
|
-
const DELETE_ENDPOINT = "/hardware/device/delete";
|
|
17
|
-
|
|
18
|
-
const createReqZ = z.object({
|
|
19
|
-
devices: deviceZ.array(),
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const createResZ = z.object({
|
|
23
|
-
devices: deviceZ.array(),
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const deleteReqZ = z.object({
|
|
27
|
-
keys: deviceKeyZ.array(),
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
const deleteResZ = z.object({});
|
|
31
|
-
|
|
32
|
-
export class Writer {
|
|
33
|
-
private readonly client: UnaryClient;
|
|
34
|
-
|
|
35
|
-
constructor(client: UnaryClient) {
|
|
36
|
-
this.client = client;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async create(devices: Device[]): Promise<Device[]> {
|
|
40
|
-
const res = await sendRequired<typeof createReqZ, typeof createResZ>(
|
|
41
|
-
this.client,
|
|
42
|
-
CREATE_ENDPOINT,
|
|
43
|
-
{ devices },
|
|
44
|
-
createReqZ,
|
|
45
|
-
createResZ,
|
|
46
|
-
);
|
|
47
|
-
return res.devices;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async delete(keys: string[]): Promise<void> {
|
|
51
|
-
await sendRequired<typeof deleteReqZ, typeof deleteResZ>(
|
|
52
|
-
this.client,
|
|
53
|
-
DELETE_ENDPOINT,
|
|
54
|
-
{ keys },
|
|
55
|
-
deleteReqZ,
|
|
56
|
-
deleteResZ,
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
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.
|
|
9
|
-
|
|
10
|
-
import { z } from "zod";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export const rackKeyZ = z.number();
|
|
14
|
-
|
|
15
|
-
export type RackKey = z.infer<typeof rackKeyZ>;
|
|
16
|
-
|
|
17
|
-
export const rackZ = z.object({
|
|
18
|
-
key: rackKeyZ,
|
|
19
|
-
name: z.string(),
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
export type RackPayload = z.infer<typeof rackZ>;
|
|
23
|
-
|
|
24
|
-
export const newRackZ = rackZ.partial({ key: true });
|
|
25
|
-
|
|
26
|
-
export type NewRack = z.input<typeof newRackZ>;
|
|
@@ -1,68 +0,0 @@
|
|
|
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.
|
|
9
|
-
|
|
10
|
-
import { type UnaryClient, sendRequired } from "@synnaxlabs/freighter";
|
|
11
|
-
import { z } from "zod";
|
|
12
|
-
|
|
13
|
-
import { rackKeyZ, rackZ, type RackPayload } from "@/hardware/rack/payload";
|
|
14
|
-
|
|
15
|
-
const RETRIEVE_ENDPOINT = "/hardware/rack/retrieve";
|
|
16
|
-
|
|
17
|
-
const retrieveRackReqZ = z.object({
|
|
18
|
-
keys: rackKeyZ.array().optional(),
|
|
19
|
-
search: z.string().optional(),
|
|
20
|
-
offset: z.number().optional(),
|
|
21
|
-
limit: z.number().optional(),
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const retrieveRackResZ = z.object({
|
|
25
|
-
racks: rackZ.array(),
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export class Retriever {
|
|
30
|
-
private readonly client: UnaryClient;
|
|
31
|
-
|
|
32
|
-
constructor(client: UnaryClient) {
|
|
33
|
-
this.client = client;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
async page(offset: number, limit: number): Promise<RackPayload[]> {
|
|
37
|
-
const res = await sendRequired<typeof retrieveRackReqZ, typeof retrieveRackResZ>(
|
|
38
|
-
this.client,
|
|
39
|
-
RETRIEVE_ENDPOINT,
|
|
40
|
-
{ offset, limit },
|
|
41
|
-
retrieveRackReqZ,
|
|
42
|
-
retrieveRackResZ,
|
|
43
|
-
);
|
|
44
|
-
return res.racks;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
async search(term: string): Promise<RackPayload[]> {
|
|
48
|
-
const res = await sendRequired<typeof retrieveRackReqZ, typeof retrieveRackResZ>(
|
|
49
|
-
this.client,
|
|
50
|
-
RETRIEVE_ENDPOINT,
|
|
51
|
-
{ search: term },
|
|
52
|
-
retrieveRackReqZ,
|
|
53
|
-
retrieveRackResZ,
|
|
54
|
-
);
|
|
55
|
-
return res.racks;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async retrieve(keys: number[]): Promise<RackPayload[]> {
|
|
59
|
-
const res = await sendRequired<typeof retrieveRackReqZ, typeof retrieveRackResZ>(
|
|
60
|
-
this.client,
|
|
61
|
-
RETRIEVE_ENDPOINT,
|
|
62
|
-
{ keys },
|
|
63
|
-
retrieveRackReqZ,
|
|
64
|
-
retrieveRackResZ,
|
|
65
|
-
);
|
|
66
|
-
return res.racks;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
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.
|
|
9
|
-
|
|
10
|
-
import { z } from "zod";
|
|
11
|
-
import { NewRack, RackPayload, newRackZ, rackKeyZ, rackZ } from "@/hardware/rack/payload";
|
|
12
|
-
import { UnaryClient, sendRequired } from "@synnaxlabs/freighter";
|
|
13
|
-
|
|
14
|
-
const CREATE_RACK_ENDPOINT = "/hardware/rack/create";
|
|
15
|
-
const DELETE_RACK_ENDPOINT = "/hardware/rack/delete";
|
|
16
|
-
|
|
17
|
-
const createReqZ = z.object({
|
|
18
|
-
racks: newRackZ.array(),
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const createResZ = z.object({
|
|
22
|
-
racks: rackZ.array(),
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const deleteReqZ = z.object({
|
|
26
|
-
keys: rackKeyZ.array(),
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const deleteResZ = z.object({});
|
|
30
|
-
|
|
31
|
-
export class Writer {
|
|
32
|
-
private readonly client: UnaryClient;
|
|
33
|
-
|
|
34
|
-
constructor(client: UnaryClient) {
|
|
35
|
-
this.client = client;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
async create(racks: NewRack[]): Promise<RackPayload[]> {
|
|
39
|
-
const res = await sendRequired<typeof createReqZ, typeof createResZ>(
|
|
40
|
-
this.client,
|
|
41
|
-
CREATE_RACK_ENDPOINT,
|
|
42
|
-
{ racks },
|
|
43
|
-
createReqZ,
|
|
44
|
-
createResZ,
|
|
45
|
-
);
|
|
46
|
-
return res.racks;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async delete(keys: number[]): Promise<void> {
|
|
50
|
-
await sendRequired<typeof deleteReqZ, typeof deleteResZ>(
|
|
51
|
-
this.client,
|
|
52
|
-
DELETE_RACK_ENDPOINT,
|
|
53
|
-
{ keys },
|
|
54
|
-
deleteReqZ,
|
|
55
|
-
deleteResZ,
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
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.
|
|
9
|
-
|
|
10
|
-
export * from "@/hardware/task/client";
|
|
11
|
-
export * from "@/hardware/task/retriever";
|
|
12
|
-
export * from "@/hardware/task/writer";
|
|
@@ -1,40 +0,0 @@
|
|
|
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.
|
|
9
|
-
|
|
10
|
-
import { type UnknownRecord } from "@synnaxlabs/x";
|
|
11
|
-
import { z } from "zod";
|
|
12
|
-
|
|
13
|
-
export const taskKeyZ = z.union([
|
|
14
|
-
z.string(),
|
|
15
|
-
z.bigint().transform((k) => k.toString()),
|
|
16
|
-
z.number().transform((k) => k.toString()),
|
|
17
|
-
])
|
|
18
|
-
|
|
19
|
-
export type TaskKey = z.infer<typeof taskKeyZ>;
|
|
20
|
-
|
|
21
|
-
export const taskZ = z.object({
|
|
22
|
-
key: taskKeyZ,
|
|
23
|
-
name: z.string(),
|
|
24
|
-
type: z.string(),
|
|
25
|
-
config: z
|
|
26
|
-
.record(z.unknown())
|
|
27
|
-
.or(z.string().transform((c) => JSON.parse(c))) as z.ZodType<UnknownRecord>,
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
export const newTaskZ = taskZ.omit({ key: true }).extend({
|
|
31
|
-
key: taskKeyZ.transform((k) => k.toString()).optional(),
|
|
32
|
-
config: z.unknown().transform((c) => JSON.stringify(c)),
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
export type NewTask = z.input<typeof newTaskZ>;
|
|
36
|
-
|
|
37
|
-
export type Task<
|
|
38
|
-
T extends string = string,
|
|
39
|
-
C extends UnknownRecord = UnknownRecord,
|
|
40
|
-
> = Omit<z.infer<typeof taskZ>, "config" | "type"> & { type: T; config: C };
|
|
@@ -1,70 +0,0 @@
|
|
|
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.
|
|
9
|
-
|
|
10
|
-
import { type UnaryClient, sendRequired } from "@synnaxlabs/freighter";
|
|
11
|
-
import { z } from "zod";
|
|
12
|
-
|
|
13
|
-
import { rackKeyZ } from "@/hardware/rack/payload";
|
|
14
|
-
import { type Task, taskZ } from "@/hardware/task/payload";
|
|
15
|
-
|
|
16
|
-
const retrieveReqZ = z.object({
|
|
17
|
-
rack: rackKeyZ.optional(),
|
|
18
|
-
keys: z.string().array().optional(),
|
|
19
|
-
offset: z.number().optional(),
|
|
20
|
-
limit: z.number().optional(),
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const retrieveResZ = z.object({
|
|
24
|
-
tasks: z.union([taskZ.array(), z.null().transform(() => [])]),
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
export type RetrieveRequest = z.infer<typeof retrieveReqZ>;
|
|
28
|
-
|
|
29
|
-
const RETRIEVE_ENDPOINT = "/hardware/task/retrieve";
|
|
30
|
-
|
|
31
|
-
export class Retriever {
|
|
32
|
-
private readonly client: UnaryClient;
|
|
33
|
-
|
|
34
|
-
constructor(client: UnaryClient) {
|
|
35
|
-
this.client = client;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
async retrieve(params: RetrieveRequest): Promise<Task[]> {
|
|
39
|
-
const res = await sendRequired<typeof retrieveReqZ, typeof retrieveResZ>(
|
|
40
|
-
this.client,
|
|
41
|
-
RETRIEVE_ENDPOINT,
|
|
42
|
-
params,
|
|
43
|
-
retrieveReqZ,
|
|
44
|
-
retrieveResZ,
|
|
45
|
-
);
|
|
46
|
-
return res.tasks;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async search(term: string): Promise<Task[]> {
|
|
50
|
-
const res = await sendRequired<typeof retrieveReqZ, typeof retrieveResZ>(
|
|
51
|
-
this.client,
|
|
52
|
-
RETRIEVE_ENDPOINT,
|
|
53
|
-
{ keys: [term] },
|
|
54
|
-
retrieveReqZ,
|
|
55
|
-
retrieveResZ,
|
|
56
|
-
);
|
|
57
|
-
return res.tasks;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
async page(offset: number, limit: number): Promise<Task[]> {
|
|
61
|
-
const res = await sendRequired<typeof retrieveReqZ, typeof retrieveResZ>(
|
|
62
|
-
this.client,
|
|
63
|
-
RETRIEVE_ENDPOINT,
|
|
64
|
-
{ offset, limit },
|
|
65
|
-
retrieveReqZ,
|
|
66
|
-
retrieveResZ,
|
|
67
|
-
);
|
|
68
|
-
return res.tasks;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
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.
|
|
9
|
-
|
|
10
|
-
import { type UnaryClient, sendRequired } from "@synnaxlabs/freighter";
|
|
11
|
-
import { z } from "zod";
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
type NewTask,
|
|
15
|
-
type Task,
|
|
16
|
-
newTaskZ,
|
|
17
|
-
taskKeyZ,
|
|
18
|
-
taskZ,
|
|
19
|
-
} from "@/hardware/task/payload";
|
|
20
|
-
|
|
21
|
-
const CREATE_ENDPOINT = "/hardware/task/create";
|
|
22
|
-
const DELETE_ENDPOINT = "/hardware/task/delete";
|
|
23
|
-
|
|
24
|
-
const createReqZ = z.object({
|
|
25
|
-
tasks: newTaskZ.array(),
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const createResZ = z.object({
|
|
29
|
-
tasks: taskZ.array(),
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const deleteReqZ = z.object({
|
|
33
|
-
keys: taskKeyZ.array(),
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const deleteResZ = z.object({});
|
|
37
|
-
|
|
38
|
-
export class Writer {
|
|
39
|
-
private readonly client: UnaryClient;
|
|
40
|
-
|
|
41
|
-
constructor(client: UnaryClient) {
|
|
42
|
-
this.client = client;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
async create(tasks: NewTask[]): Promise<Task[]> {
|
|
46
|
-
const res = await sendRequired<typeof createReqZ, typeof createResZ>(
|
|
47
|
-
this.client,
|
|
48
|
-
CREATE_ENDPOINT,
|
|
49
|
-
{ tasks },
|
|
50
|
-
createReqZ,
|
|
51
|
-
createResZ,
|
|
52
|
-
);
|
|
53
|
-
return res.tasks;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
async delete(keys: bigint[]): Promise<void> {
|
|
57
|
-
await sendRequired<typeof deleteReqZ, typeof deleteResZ>(
|
|
58
|
-
this.client,
|
|
59
|
-
DELETE_ENDPOINT,
|
|
60
|
-
{ keys },
|
|
61
|
-
deleteReqZ,
|
|
62
|
-
deleteResZ,
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
}
|