@synnaxlabs/client 0.2.0 → 0.13.5
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/main/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/cdc/external.ts +10 -0
- package/src/cdc/index.ts +10 -0
- package/src/cdc/observable.ts +80 -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 +112 -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 +25 -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 +117 -0
- package/src/errors.ts +153 -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 +43 -4
- package/src/ontology/cdc.ts +135 -0
- package/src/ontology/client.ts +103 -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 +121 -0
- package/src/ontology/retriever.ts +91 -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 +124 -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 +74 -0
- package/src/ranger/ranger.spec.ts +167 -0
- package/src/ranger/retriever.ts +50 -0
- package/src/ranger/writer.ts +80 -0
- package/src/setupspecs.ts +14 -5
- 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 +67 -0
- package/src/workspace/workspace.spec.ts +62 -0
- package/src/workspace/writer.ts +103 -0
- package/tsconfig.json +3 -43
- package/tsconfig.vite.json +4 -0
- package/vite.config.ts +25 -0
- package/.DS_Store +0 -0
- package/.editorconfig +0 -15
- package/.eslintrc.json +0 -33
- package/.gitignore +0 -9
- package/.nyc_output/20720f2d-6abe-420f-a3c5-304d52d60827.json +0 -1
- package/.nyc_output/4725921c-6f1b-4ae9-9819-e455f702d31c.json +0 -1
- package/.nyc_output/47478588-5ffd-4332-873c-facaa4a2fc38.json +0 -1
- package/.nyc_output/48180641-e0b2-49ab-a6eb-e7910e9eac2f.json +0 -1
- package/.nyc_output/cb0abf31-740f-47db-b94a-8e3f8f117cb8.json +0 -1
- package/.nyc_output/fc77fce2-dad0-49a8-8d4b-0a9014ecf8c5.json +0 -1
- package/.nyc_output/processinfo/20720f2d-6abe-420f-a3c5-304d52d60827.json +0 -1
- package/.nyc_output/processinfo/4725921c-6f1b-4ae9-9819-e455f702d31c.json +0 -1
- package/.nyc_output/processinfo/47478588-5ffd-4332-873c-facaa4a2fc38.json +0 -1
- package/.nyc_output/processinfo/48180641-e0b2-49ab-a6eb-e7910e9eac2f.json +0 -1
- package/.nyc_output/processinfo/cb0abf31-740f-47db-b94a-8e3f8f117cb8.json +0 -1
- package/.nyc_output/processinfo/fc77fce2-dad0-49a8-8d4b-0a9014ecf8c5.json +0 -1
- package/.nyc_output/processinfo/index.json +0 -1
- package/.prettierignore +0 -2
- 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.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.d.ts +0 -54
- 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/tsconfig.module.tsbuildinfo +0 -1
- package/build/tsconfig.tsbuildinfo +0 -1
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -191
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -191
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov-report/src/index.html +0 -116
- package/coverage/lcov-report/src/lib/auth.ts.html +0 -340
- package/coverage/lcov-report/src/lib/channel/client.ts.html +0 -604
- package/coverage/lcov-report/src/lib/channel/creator.ts.html +0 -304
- package/coverage/lcov-report/src/lib/channel/index.html +0 -176
- package/coverage/lcov-report/src/lib/channel/payload.ts.html +0 -139
- package/coverage/lcov-report/src/lib/channel/registry.ts.html +0 -202
- package/coverage/lcov-report/src/lib/channel/retriever.ts.html +0 -244
- package/coverage/lcov-report/src/lib/client.ts.html +0 -244
- package/coverage/lcov-report/src/lib/errors.ts.html +0 -484
- package/coverage/lcov-report/src/lib/index.html +0 -176
- package/coverage/lcov-report/src/lib/segment/client.ts.html +0 -463
- package/coverage/lcov-report/src/lib/segment/index.html +0 -206
- package/coverage/lcov-report/src/lib/segment/iterator.ts.html +0 -928
- package/coverage/lcov-report/src/lib/segment/payload.ts.html +0 -139
- package/coverage/lcov-report/src/lib/segment/splitter.ts.html +0 -181
- package/coverage/lcov-report/src/lib/segment/typed.ts.html +0 -307
- package/coverage/lcov-report/src/lib/segment/validator.ts.html +0 -331
- package/coverage/lcov-report/src/lib/segment/writer.ts.html +0 -727
- package/coverage/lcov-report/src/lib/telem.ts.html +0 -2056
- package/coverage/lcov-report/src/lib/transport.ts.html +0 -196
- package/coverage/lcov-report/src/lib/user/index.html +0 -116
- package/coverage/lcov-report/src/lib/user/payload.ts.html +0 -109
- package/coverage/lcov-report/src/lib/util/index.html +0 -116
- package/coverage/lcov-report/src/lib/util/telem.ts.html +0 -124
- package/coverage/lcov-report/src/setupspecs.ts.html +0 -133
- package/coverage/lcov.info +0 -1230
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -196
- package/coverage/src/index.html +0 -116
- package/coverage/src/lib/auth.ts.html +0 -340
- package/coverage/src/lib/channel/client.ts.html +0 -604
- package/coverage/src/lib/channel/creator.ts.html +0 -304
- package/coverage/src/lib/channel/index.html +0 -176
- package/coverage/src/lib/channel/payload.ts.html +0 -139
- package/coverage/src/lib/channel/registry.ts.html +0 -202
- package/coverage/src/lib/channel/retriever.ts.html +0 -244
- package/coverage/src/lib/client.ts.html +0 -244
- package/coverage/src/lib/errors.ts.html +0 -484
- package/coverage/src/lib/index.html +0 -176
- package/coverage/src/lib/segment/client.ts.html +0 -463
- package/coverage/src/lib/segment/index.html +0 -206
- package/coverage/src/lib/segment/iterator.ts.html +0 -928
- package/coverage/src/lib/segment/payload.ts.html +0 -139
- package/coverage/src/lib/segment/splitter.ts.html +0 -181
- package/coverage/src/lib/segment/typed.ts.html +0 -307
- package/coverage/src/lib/segment/validator.ts.html +0 -331
- package/coverage/src/lib/segment/writer.ts.html +0 -727
- package/coverage/src/lib/telem.ts.html +0 -2056
- package/coverage/src/lib/transport.ts.html +0 -196
- package/coverage/src/lib/user/index.html +0 -116
- package/coverage/src/lib/user/payload.ts.html +0 -109
- package/coverage/src/lib/util/index.html +0 -116
- package/coverage/src/lib/util/telem.ts.html +0 -124
- package/coverage/src/setupspecs.ts.html +0 -133
- package/src/lib/.DS_Store +0 -0
- package/src/lib/auth.spec.ts +0 -36
- package/src/lib/auth.ts +0 -85
- package/src/lib/channel/channel.spec.ts +0 -49
- package/src/lib/channel/client.ts +0 -173
- package/src/lib/channel/creator.ts +0 -73
- package/src/lib/channel/payload.ts +0 -18
- package/src/lib/channel/registry.ts +0 -39
- package/src/lib/channel/retriever.ts +0 -53
- package/src/lib/client.ts +0 -53
- package/src/lib/errors.ts +0 -133
- package/src/lib/segment/client.ts +0 -126
- package/src/lib/segment/iterator.spec.ts +0 -78
- package/src/lib/segment/iterator.ts +0 -281
- package/src/lib/segment/payload.ts +0 -18
- package/src/lib/segment/splitter.ts +0 -32
- package/src/lib/segment/typed.ts +0 -74
- package/src/lib/segment/validator.ts +0 -82
- package/src/lib/segment/writer.spec.ts +0 -85
- package/src/lib/segment/writer.ts +0 -214
- package/src/lib/telem.spec.ts +0 -200
- package/src/lib/telem.ts +0 -657
- package/src/lib/transport.ts +0 -37
- package/src/lib/user/payload.ts +0 -8
- package/src/lib/util/telem.ts +0 -13
- package/tsconfig.module.json +0 -9
- package/yarn-error.log +0 -5756
- package/yarn.lock +0 -5936
- /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,67 @@
|
|
|
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
|
+
const res = await this.execute({ keys: normalized });
|
|
47
|
+
return res;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async retrieveByAuthor(author: string): Promise<Workspace[]> {
|
|
51
|
+
return await this.execute({ author });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async search(term: string): Promise<Workspace[]> {
|
|
55
|
+
return await this.execute({ search: term });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async page(offset: number, limit: number): Promise<Workspace[]> {
|
|
59
|
+
return await this.execute({ offset, limit });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private async execute(request: Request): Promise<Workspace[]> {
|
|
63
|
+
const [res, err] = await this.client.send(Retriever.ENDPOINT, request, resZ);
|
|
64
|
+
if (err != null) throw err;
|
|
65
|
+
return res.workspaces;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -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 Response = 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
CHANGED
|
@@ -1,47 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
+
"extends": "@synnaxlabs/tsconfig/base.json",
|
|
2
3
|
"compilerOptions": {
|
|
3
|
-
"
|
|
4
|
-
"target": "es2017",
|
|
5
|
-
"outDir": "build/main",
|
|
6
|
-
"rootDir": "src",
|
|
7
|
-
"moduleResolution": "node",
|
|
8
|
-
"module": "commonjs",
|
|
9
|
-
"declaration": true,
|
|
10
|
-
"inlineSourceMap": true,
|
|
11
|
-
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
|
|
12
|
-
"resolveJsonModule": true /* Include modules imported with .json extension. */,
|
|
13
|
-
|
|
14
|
-
"strict": true /* Enable all strict type-checking options. */,
|
|
15
|
-
|
|
16
|
-
/* Strict Type-Checking Options */
|
|
17
|
-
// "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
|
|
18
|
-
// "strictNullChecks": true /* Enable strict null checks. */,
|
|
19
|
-
// "strictFunctionTypes": true /* Enable strict checking of function types. */,
|
|
20
|
-
// "strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */,
|
|
21
|
-
// "noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */,
|
|
22
|
-
// "alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */,
|
|
23
|
-
|
|
24
|
-
/* Additional Checks */
|
|
25
|
-
"noUnusedLocals": true /* Report errors on unused locals. */,
|
|
26
|
-
"noUnusedParameters": true /* Report errors on unused parameters. */,
|
|
27
|
-
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
|
|
28
|
-
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,
|
|
29
|
-
|
|
30
|
-
/* Debugging Options */
|
|
31
|
-
"traceResolution": false /* Report module resolution log messages. */,
|
|
32
|
-
"listEmittedFiles": false /* Print names of generated files part of the compilation. */,
|
|
33
|
-
"listFiles": false /* Print names of files part of the compilation. */,
|
|
34
|
-
"pretty": true /* Stylize errors and messages using color and context. */,
|
|
35
|
-
|
|
36
|
-
/* Experimental Options */
|
|
37
|
-
// "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */,
|
|
38
|
-
// "emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */,
|
|
39
|
-
|
|
40
|
-
"lib": ["es2017", "dom"],
|
|
41
|
-
"types": ["node"],
|
|
42
|
-
"typeRoots": ["node_modules/@types", "src/types"]
|
|
4
|
+
"baseUrl": ".",
|
|
43
5
|
},
|
|
44
|
-
"include": ["src
|
|
45
|
-
"exclude": ["node_modules/**"],
|
|
46
|
-
"compileOnSave": false
|
|
6
|
+
"include": ["src/**/*"]
|
|
47
7
|
}
|
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/.DS_Store
DELETED
|
Binary file
|
package/.editorconfig
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# http://editorconfig.org
|
|
2
|
-
root = true
|
|
3
|
-
|
|
4
|
-
[*]
|
|
5
|
-
charset = utf-8
|
|
6
|
-
end_of_line = lf
|
|
7
|
-
indent_size = 2
|
|
8
|
-
indent_style = space
|
|
9
|
-
insert_final_newline = true
|
|
10
|
-
max_line_length = 80
|
|
11
|
-
trim_trailing_whitespace = true
|
|
12
|
-
|
|
13
|
-
[*.md]
|
|
14
|
-
max_line_length = 0
|
|
15
|
-
trim_trailing_whitespace = false
|
package/.eslintrc.json
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"root": true,
|
|
3
|
-
"parser": "@typescript-eslint/parser",
|
|
4
|
-
"parserOptions": { "project": "./tsconfig.json" },
|
|
5
|
-
"env": { "es6": true },
|
|
6
|
-
"ignorePatterns": ["node_modules", "build", "coverage"],
|
|
7
|
-
"plugins": ["import", "eslint-comments"],
|
|
8
|
-
"extends": [
|
|
9
|
-
"eslint:recommended",
|
|
10
|
-
"plugin:eslint-comments/recommended",
|
|
11
|
-
"plugin:@typescript-eslint/recommended",
|
|
12
|
-
"plugin:import/typescript",
|
|
13
|
-
"prettier",
|
|
14
|
-
"prettier/@typescript-eslint"
|
|
15
|
-
],
|
|
16
|
-
"globals": { "BigInt": true, "console": true, "WebAssembly": true },
|
|
17
|
-
"rules": {
|
|
18
|
-
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
19
|
-
"eslint-comments/disable-enable-pair": [
|
|
20
|
-
"error",
|
|
21
|
-
{ "allowWholeFile": true }
|
|
22
|
-
],
|
|
23
|
-
"eslint-comments/no-unused-disable": "error",
|
|
24
|
-
"import/order": [
|
|
25
|
-
"error",
|
|
26
|
-
{ "newlines-between": "always", "alphabetize": { "order": "asc" } }
|
|
27
|
-
],
|
|
28
|
-
"sort-imports": [
|
|
29
|
-
"error",
|
|
30
|
-
{ "ignoreDeclarationSort": true, "ignoreCase": true }
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
}
|