diff --git a/.github/workflows/publish_docs_cloudflare.yml b/.github/workflows/publish_docs_cloudflare.yml new file mode 100644 index 0000000..7b3b1f4 --- /dev/null +++ b/.github/workflows/publish_docs_cloudflare.yml @@ -0,0 +1,47 @@ +env: + SUBFOLDER: docs_website + +name: Publish Docs to docs.velconnect.ugavel.com (Cloudflare Pages) +on: + push: + paths: + - docs_website/** + +jobs: + publish-docs: + defaults: + run: + working-directory: ${{env.SUBFOLDER}} + runs-on: ubuntu-latest + permissions: + contents: read + deployments: write + name: Publish to Cloudflare Pages + steps: + - name: Checkout + uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: 3.x + + - run: echo "CACHE_ID=$(date --utc '+%V')" >> $GITHUB_ENV + + - uses: actions/cache@v3 + with: + key: mkdocs-material-${{ env.CACHE_ID }} + path: .cache + restore-keys: | + mkdocs-material- + + - run: pip install -r requirements.txt + + - name: Build + run: mkdocs build --site-dir public + + - name: Upload + env: + PROJECT_NAME: velconnect-docs + CLOUDFLARE_ACCOUNT_ID: 8077b5b1f8e2ade41874cbaa3f883069 + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + run: npx wrangler@3.1.1 pages deploy public --project-name="${{env.PROJECT_NAME}}" --branch="${{env.GITHUB_REF_NAME}}" diff --git a/.github/workflows/publish_svelte_npm.yml b/.github/workflows/publish_svelte_npm.yml index 8df126f..4f04509 100644 --- a/.github/workflows/publish_svelte_npm.yml +++ b/.github/workflows/publish_svelte_npm.yml @@ -20,6 +20,6 @@ jobs: registry-url: "https://registry.npmjs.org" - run: npm install - run: npm ci - - run: npm publish + - run: npm publish --access public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/publish_ts_npm.yml b/.github/workflows/publish_ts_npm.yml index 59bfd5b..6f649a2 100644 --- a/.github/workflows/publish_ts_npm.yml +++ b/.github/workflows/publish_ts_npm.yml @@ -20,6 +20,6 @@ jobs: registry-url: "https://registry.npmjs.org" - run: npm install - run: npm ci - - run: npm publish + - run: npm publish --access public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/docs_website/.gitignore b/docs_website/.gitignore new file mode 100644 index 0000000..04eaa16 --- /dev/null +++ b/docs_website/.gitignore @@ -0,0 +1,4 @@ +env/ +public/ +site/ +.venv/ \ No newline at end of file diff --git a/docs_website/.vscode/launch.json b/docs_website/.vscode/launch.json new file mode 100644 index 0000000..906667e --- /dev/null +++ b/docs_website/.vscode/launch.json @@ -0,0 +1,10 @@ +{ + "configurations": [ + { + "name": "Serve Docs", + "type": "node-terminal", + "request": "launch", + "command": "mkdocs serve" + } + ] +} \ No newline at end of file diff --git a/docs_website/.vscode/settings.json b/docs_website/.vscode/settings.json new file mode 100644 index 0000000..a11fa9b --- /dev/null +++ b/docs_website/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.terminal.activateEnvironment": true, +} \ No newline at end of file diff --git a/docs_website/.vscode/tasks.json b/docs_website/.vscode/tasks.json new file mode 100644 index 0000000..bf42bfa --- /dev/null +++ b/docs_website/.vscode/tasks.json @@ -0,0 +1,17 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Autogenerate docs from code", + "detail": "Runs generate_docs.py", + "command": "python generate_docs.py", + "type": "shell", + "args": [], + "problemMatcher": [], + "presentation": { + "reveal": "always" + }, + "group": "build" + } + ] +} \ No newline at end of file diff --git a/docs_website/README.md b/docs_website/README.md new file mode 100644 index 0000000..f4c251f --- /dev/null +++ b/docs_website/README.md @@ -0,0 +1,19 @@ +# VEL-Connect Docs + +## Setup + +1. Create or activate a pip environment + - Create: + - `python -m venv env` + - Activate: + - PowerShell: `.\env\Scripts\Activate.ps1` + - CMD: `.\env\Scripts\Activate.bat` +2. Install requirements: + - `pip install -r requirements.txt` +3. Run: + - `mkdocs serve` + - or use `F5` in VSCode +4. Build and Deploy + - Building and deploying happens automatically using a GitHub Action on push. If you want to build manually, use this command: + - `mkdocs build` + - For more information, visit these docs pages: https://squidfunk.github.io/mkdocs-material/getting-started/ \ No newline at end of file diff --git a/docs_website/docs/assets/screenshots/scoped_registry.png b/docs_website/docs/assets/screenshots/scoped_registry.png new file mode 100644 index 0000000..a0cd3ff Binary files /dev/null and b/docs_website/docs/assets/screenshots/scoped_registry.png differ diff --git a/docs_website/docs/assets/vel_logo_3d.png b/docs_website/docs/assets/vel_logo_3d.png new file mode 100644 index 0000000..291df49 Binary files /dev/null and b/docs_website/docs/assets/vel_logo_3d.png differ diff --git a/docs_website/docs/assets/vel_logo_3d_square.png b/docs_website/docs/assets/vel_logo_3d_square.png new file mode 100644 index 0000000..6f61553 Binary files /dev/null and b/docs_website/docs/assets/vel_logo_3d_square.png differ diff --git a/docs_website/docs/index.md b/docs_website/docs/index.md new file mode 100644 index 0000000..e6add07 --- /dev/null +++ b/docs_website/docs/index.md @@ -0,0 +1,8 @@ +# VEL-Connect + +VEL-Connect is a persistent shared storage mechanism for Unity projects. It can be used as a key-value store as a networked replacement for PlayerPrefs, to share a profile of user data across multiple devices, or to easily switch between different user profiles on a single device. + +Important pages: + +- [Installation](/installation) +- [Quick Start](/quick-start) \ No newline at end of file diff --git a/docs_website/docs/installation.md b/docs_website/docs/installation.md new file mode 100644 index 0000000..5bc5aba --- /dev/null +++ b/docs_website/docs/installation.md @@ -0,0 +1,40 @@ + +Install the UPM package in Unity: + +=== "**Option 1:** Add the VEL package registry" + + ![Scoped registry example](assets/screenshots/scoped_registry.png){ align=right } + + Using the scoped registry allows you to easily install a specific version of the package by using the Version History tab. + + - In Unity, go to `Edit->Project Settings...->Package Manager` + - Under "Scoped Registries" click the + icon + - Add the following details, then click Apply + - Name: `VEL` (or anything you want) + - URL: `https://npm.ugavel.com` + - Scope(s): `edu.uga.engr.vel` + - Install the package: + - In the package manager, select `My Registries` from the dropdown + - Install the `VEL-Connect` package. + +=== "**Option 2:** Add the package by git url" + + 1. Open the Package Manager in Unity with `Window->Package Manager` + - Add the local package: + - `+`->`Add package from git URL...` + - Set the path to `https://github.com/velaboratory/VEL-Connect` + + To update the package, click the `Update` button in the Package Manager, or delete the `packages-lock.json` file. + +=== "**Option 3:** Add the package locally" + + 1. Clone the repository on your computer: + `git clone git@github.com:velaboratory/VEL-Connect.git` + - Open the Package Manager in Unity with `Window->Package Manager` + - Add the local package: + - `+`->`Add package from disk...` + - Set the path to `VEL-Connect/package.json` on your hard drive. + + To update the package, use `git pull` in the VEL-Connect folder. + +Then check out the [quick start guide](quick-start.md). diff --git a/docs_website/docs/quick-start.md b/docs_website/docs/quick-start.md new file mode 100644 index 0000000..731fe29 --- /dev/null +++ b/docs_website/docs/quick-start.md @@ -0,0 +1,180 @@ +--- +title: Quick Start +--- + + +## Setup + +1. [Install the package](/) +2. Add the VelConnectManager script to an object in your scene. If you transition between scenes in your application, mark the object as `DontDestroyOnLoad` +3. Set the `Vel Connect Url` field on the component to a valid velconnect server. `https://velconnect-v4.ugavel.com` is useful for VEL projects. + +## Usage + +### Setting data + +To set user data in VEL-Connect use the static function `SetUserData`. + +You can add a single key and value: +```cs +VELConnectManager.SetUserData("key1", "val1"); +``` + +Or set multiple keys with the dictionary syntax: +```cs +VELConnectManager.SetUserData(new Dictionary +{ + { "key2", "val2" }, + { "key3", "val3" } +}); +``` +Data will be set instantly locally, then pushed to the server. You don't have to wait for VEL-Connect to initialize at the beginning of your game to set data. + +### Getting data + +Fetching data from a remote server can be more tricky because it won't be available immediately when the game starts. Data can also be set from other applications (such as a dashboard or other users in the case of room data), so change listeners are useful. + +To fetch a single value from a key: +```cs +string value1 = VELConnectManager.GetUserData("key1"); +``` +The latest local value will be returned. This will always return null in `Start()` because no data has been fetched yet, so you could wrap this call in the `OnInitialState` callback: +```cs +VELConnectManager.OnInitialState += state => +{ + VELConnectManager.GetUserData("key1"); +}; +``` +If the data was already on the server before the start of your application, the correct value will be returned. + + +#### Change listeners + +If you want to subscribe to changes in a key you can set up change listeners: +```cs +VELConnectManager.AddUserDataListener("key1", this, value => +{ + Debug.Log($"key1: {value}"); +}, true); +``` +Passing in `this` binds the lifetime of the listener to the lifetime of the current script. It is often tedious to make sure to unsubscribe to all of your listeners OnDisable or OnDestroy to prevent the event emitter from sending events to objects that no longer exist, but VEL-Connect will remove listeners when their `keepAliveObject` parameter becomes null. The last parameter in this function (`true` in the example) tells VEL-Connect to activate the callback immediately or when the first value is received. You can add the listener on `Start()` and the first invokation of the callback will have the previous value of the server. + + + +--- + +Full example: +```cs +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using VELConnect; + +public class VELConnectTesting : MonoBehaviour +{ + private IEnumerator Start() + { + VELConnectManager.OnInitialState += state => + { + Debug.Log($"[OnInitialState] key1: {VELConnectManager.GetUserData("key1")}"); + }; + + VELConnectManager.AddUserDataListener("key1", this, value => + { + Debug.Log($"[Listener] key1: {value}"); + }, true); + + VELConnectManager.AddUserDataListener("key2", this, value => + { + Debug.Log($"[Listener] key2: {value}"); + }, false); + + yield return new WaitForSeconds(1f); + + VELConnectManager.SetUserData("key1", "val1"); + + VELConnectManager.SetUserData(new Dictionary + { + { "key1", "val1" }, + { "key2", "val2" }, + }); + + yield return new WaitForSeconds(1f); + + VELConnectManager.SetUserData("key1", "val1_later"); + } +} +``` + +--- + +JSON.Net Example that illustrates how to persist a complex object of data using VEL-Connect, initializing at start, and saving on application quit + +```cs +using Newtonsoft.Json; +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using VELConnect; +public class VelConnectDemo1 : MonoBehaviour +{ + class ExampleJSON + { + public string a_string="a"; //you can use initializers + public int a_int=0; + public List a_list = new List(); // you can use lists of objects + } + class ExampleChildJSON + { + public string a_string; //if you don't, that's fine too, but you probably want a constructor then + public int a_int; + public ExampleChildJSON() { } //you need to make sure you have a blank constructor for deserialization + public ExampleChildJSON(string a_string, int a_int) + { + this.a_string = a_string; + this.a_int = a_int; + } + } + + ExampleJSON dataToPersist = null; + + IEnumerator Start() + { + VELConnectManager.OnInitialState += (state) => + { + var s = VELConnectManager.GetUserData("mydata"); + Debug.Log("Retrieved: " + s); + try + { + dataToPersist = JsonConvert.DeserializeObject(s); + } + catch (Exception e) + { + Debug.Log("Error serializing state: " + e.Message); + } + if(dataToPersist == null) + { + Debug.Log("Null state, initializing"); + dataToPersist =new ExampleJSON(); + } + }; + + while (dataToPersist == null) yield return null; + + dataToPersist.a_list.Add( + new ExampleChildJSON("" + UnityEngine.Random.Range(0, 10), + UnityEngine.Random.Range(0, 10)) + ); + Debug.Log(JsonConvert.SerializeObject(dataToPersist)); + + } + private void OnApplicationQuit() + { + VELConnectManager.SetUserData("mydata", JsonConvert.SerializeObject(dataToPersist)); + } + +} + + +``` diff --git a/docs_website/docs/stylesheets/extra.css b/docs_website/docs/stylesheets/extra.css new file mode 100644 index 0000000..aead5c1 --- /dev/null +++ b/docs_website/docs/stylesheets/extra.css @@ -0,0 +1,17 @@ +:root { + --md-primary-fg-color: #7a2020; + --md-primary-fg-color--light: #ffffff; + --md-primary-fg-color--dark: #e4002b; + --md-primary-bg-color: hsla(0, 0%, 100%, 1); + --md-primary-bg-color--light: hsla(0, 0%, 100%, 0.7); + + /* --md-accent-fg-color: #ffffff; + --md-accent-fg-color--transparent: #ffffff11; + --md-accent-bg-color: hsla(0, 0%, 100%, 1); + --md-accent-bg-color--light: hsla(0, 0%, 100%, 0.7); */ +} +[data-md-color-scheme="slate"] { + --md-hue: 34; + --md-default-bg-color: #191818; + --md-code-bg-color: #252525; +} diff --git a/docs_website/mkdocs.yml b/docs_website/mkdocs.yml new file mode 100644 index 0000000..304d7ff --- /dev/null +++ b/docs_website/mkdocs.yml @@ -0,0 +1,59 @@ +site_name: VEL-Connect Docs +site_url: https://docs.velconnect.ugavel.com +repo_url: https://github.com/velaboratory/VEL-Connect +repo_name: velaboratory/VEL-Connect +edit_uri: edit/main/docs_website/docs + +theme: + name: material + features: + - content.action.edit + - navigation.instant + # - navigation.sections + - navigation.expand + - navigation.path + - navigation.indexes + - toc.follow + - toc.integrate + - content.code.copy + + palette: + scheme: slate + primary: custom + accent: red + # background: custom + font: false + # text: Oswald + # text: Merriweather + # text: Merriweather Sans + logo: assets/vel_logo_3d.png + favicon: assets/vel_logo_3d_square.png + +plugins: + - search: + # - social: + # cards_layout_options: + # font_family: Oswald + - git-revision-date-localized: + enable_creation_date: true + +markdown_extensions: + - attr_list + - md_in_html + - pymdownx.emoji: + emoji_index: !!python/name:material.extensions.emoji.twemoji + emoji_generator: !!python/name:material.extensions.emoji.to_svg + - pymdownx.superfences + - pymdownx.tabbed: + alternate_style: true + - admonition + - pymdownx.details + - pymdownx.highlight: + anchor_linenums: true + line_spans: __span + pygments_lang_class: true + - pymdownx.inlinehilite + - pymdownx.snippets + +extra_css: + - stylesheets/extra.css diff --git a/docs_website/requirements.txt b/docs_website/requirements.txt new file mode 100644 index 0000000..f522c59 --- /dev/null +++ b/docs_website/requirements.txt @@ -0,0 +1,2 @@ +mkdocs-material +mkdocs-git-revision-date-localized-plugin \ No newline at end of file diff --git a/unity_package/Runtime/GenericSpawnedObject.cs b/unity_package/Runtime/GenericSpawnedObject.cs new file mode 100644 index 0000000..72c0f69 --- /dev/null +++ b/unity_package/Runtime/GenericSpawnedObject.cs @@ -0,0 +1,70 @@ +using System.Collections; +using System.Collections.Generic; +using System.IO; +using UnityEngine; +using UnityEngine.Networking; +using UnityEngine.UI; +using VelNet; + +namespace VELConnect +{ + public class GenericSpawnedObject : SyncState + { + private string url; + + private string Url + { + get => url; + set + { + if (url == value) return; + + url = value; + + if (url.EndsWith(".png") || url.EndsWith(".jpg")) + { + StartCoroutine(DownloadImage(url)); + } + else + { + Debug.LogError("Invalid image url: " + url); + } + } + } + + public RawImage rawImage; + + public void Init(string dataUrl) + { + Url = dataUrl; + } + + protected override void SendState(BinaryWriter binaryWriter) + { + binaryWriter.Write(Url); + } + + protected override void ReceiveState(BinaryReader binaryReader) + { + Url = binaryReader.ReadString(); + } + + private IEnumerator DownloadImage(string downloadUrl) + { + UnityWebRequest request = UnityWebRequestTexture.GetTexture(downloadUrl); + yield return request.SendWebRequest(); + if (request.result != UnityWebRequest.Result.Success) + { + Debug.Log(request.error); + yield break; + } + + rawImage.texture = ((DownloadHandlerTexture)request.downloadHandler).texture; + float aspect = (float)rawImage.texture.width / rawImage.texture.height; + Transform t = transform; + Vector3 s = t.localScale; + s = new Vector3(aspect * s.y, s.y, s.z); + t.localScale = s; + } + } +} \ No newline at end of file diff --git a/unity_package/Runtime/GenericSpawnedObject.cs.meta b/unity_package/Runtime/GenericSpawnedObject.cs.meta new file mode 100644 index 0000000..dd44ce1 --- /dev/null +++ b/unity_package/Runtime/GenericSpawnedObject.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 16f283d9b4aeffc429940a70600d2e5e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/unity_package/Runtime/VELConnectManager.cs b/unity_package/Runtime/VELConnectManager.cs index 1feae4d..23c048f 100644 --- a/unity_package/Runtime/VELConnectManager.cs +++ b/unity_package/Runtime/VELConnectManager.cs @@ -171,21 +171,18 @@ namespace VELConnect private void Awake() { + velConnectUrl = velConnectUrl.TrimEnd('/'); if (instance != null) Debug.LogError("VELConnectManager instance already exists", this); instance = this; - - // Compute device id - MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider(); - StringBuilder sb = new StringBuilder(SystemInfo.deviceUniqueIdentifier); - sb.Append(Application.productName); -#if UNITY_EDITOR - // allows running multiple builds on the same computer - // return SystemInfo.deviceUniqueIdentifier + Hash128.Compute(Application.dataPath); - sb.Append(Application.dataPath); - sb.Append("EDITOR"); -#endif - string id = Convert.ToBase64String(md5.ComputeHash(Encoding.UTF8.GetBytes(sb.ToString()))); deviceId = CreateDeviceId(); + VelNetManager.OnLocalNetworkObjectSpawned += networkObject => + { + if (!networkObject.ownershipLocked) + { + // TODO + // SetRoomData("spawned_" + networkObject.networkId, networkObject.prefabName); + } + }; } // Computes 15-char device id compatibly with pocketbase @@ -264,25 +261,7 @@ namespace VELConnect state = JsonConvert.DeserializeObject(json); if (state == null) return; - bool isInitialState = false; - - // first load stuff - if (lastState == null) - { - try - { - OnInitialState?.Invoke(state); - } - catch (Exception e) - { - Debug.LogError(e); - } - - isInitialState = true; - // lastState = state; - // return; - } - + bool isInitialState = lastState == null; // if (state.device.modified_by != DeviceId) { @@ -413,7 +392,7 @@ namespace VELConnect foreach (KeyValuePair elem in state.room.data) { string oldValue = null; - lastState?.room.data.TryGetValue(elem.Key, out oldValue); + lastState?.room?.data.TryGetValue(elem.Key, out oldValue); if (elem.Value != oldValue) { try @@ -482,6 +461,18 @@ namespace VELConnect { Debug.LogError("Pairing code nulllll"); } + + if (isInitialState) + { + try + { + OnInitialState?.Invoke(state); + } + catch (Exception e) + { + Debug.LogError(e); + } + } }); } catch (Exception e) @@ -689,6 +680,11 @@ namespace VELConnect ); } + public static void SetUserData(string key, string value) + { + SetUserData(new Dictionary { { key, value } }); + } + /// /// Sets the 'data' object of the Device table /// @@ -755,6 +751,7 @@ namespace VELConnect State.DataBlock room = new State.DataBlock { category = "room", + modified_by = "Unity", data = data }; @@ -795,6 +792,9 @@ namespace VELConnect ); } + /// + /// Unpairs this device from the current user. + /// public static void Unpair() { if (instance.state?.device != null) @@ -917,7 +917,7 @@ namespace VELConnect case UnityWebRequest.Result.ConnectionError: case UnityWebRequest.Result.DataProcessingError: case UnityWebRequest.Result.ProtocolError: - Debug.LogError(url + ": Error: " + webRequest.error + "\n" + webRequest.downloadHandler.text + "\n" + Environment.StackTrace); + Debug.LogWarning(url + ": Error: " + webRequest.error + "\n" + webRequest.downloadHandler.text + "\n" + Environment.StackTrace); failureCallback?.Invoke(webRequest.error); break; case UnityWebRequest.Result.Success: diff --git a/unity_package/Runtime/VelNetPersist.cs b/unity_package/Runtime/VelNetPersist.cs index e8df8ef..c402b20 100644 --- a/unity_package/Runtime/VelNetPersist.cs +++ b/unity_package/Runtime/VelNetPersist.cs @@ -45,6 +45,16 @@ namespace VELConnect { loading = true; if (debugLogs) Debug.Log($"[VelNetPersist] Loading {Id}"); + if (syncState == null) + { + Debug.LogError("SyncState is null for Persist", this); + return; + } + if (syncState.networkObject == null) + { + Debug.LogError("Network Object is null for SyncState", syncState); + return; + } VELConnectManager.GetDataBlock(Id, data => { if (!data.data.TryGetValue("state", out string d)) @@ -63,7 +73,6 @@ namespace VELConnect loading = false; }, s => { - Debug.LogError(s); loading = false; }); } @@ -71,6 +80,16 @@ namespace VELConnect private void Save() { if (debugLogs) Debug.Log($"[VelNetPersist] Saving {Id}"); + if (syncState == null) + { + Debug.LogError("SyncState is null for Persist", this); + return; + } + if (syncState.networkObject == null) + { + Debug.LogError("Network Object is null for SyncState", syncState); + return; + } VELConnectManager.SetDataBlock(Id, new VELConnectManager.State.DataBlock() { category = "object_persist", diff --git a/unity_package/package.json b/unity_package/package.json index 2bdd01b..22a0d46 100644 --- a/unity_package/package.json +++ b/unity_package/package.json @@ -1,7 +1,7 @@ { "name": "edu.uga.engr.vel.vel-connect", "displayName": "VEL-Connect", - "version": "4.0.1", + "version": "4.0.7", "unity": "2019.1", "description": "Web-based configuration for VR applications", "keywords": [], @@ -13,6 +13,6 @@ "samples": [], "dependencies": { "com.unity.nuget.newtonsoft-json": "3.0.0", - "edu.uga.engr.vel.velnet": "1.1.8" + "edu.uga.engr.vel.velnet": "1.3.8" } } diff --git a/velconnect-npm/package-lock.json b/velconnect-npm/package-lock.json index 85a3597..1cff075 100644 --- a/velconnect-npm/package-lock.json +++ b/velconnect-npm/package-lock.json @@ -1,12 +1,12 @@ { "name": "@velaboratory/velconnect", - "version": "1.0.0", + "version": "1.0.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@velaboratory/velconnect", - "version": "1.0.0", + "version": "1.0.1", "license": "MIT", "dependencies": { "pocketbase": "^0.20.3" diff --git a/velconnect-npm/package.json b/velconnect-npm/package.json index 2208e9a..97de1d4 100644 --- a/velconnect-npm/package.json +++ b/velconnect-npm/package.json @@ -1,6 +1,6 @@ { "name": "@velaboratory/velconnect", - "version": "1.0.0", + "version": "1.0.1", "description": "Use VEL-Connect with a dashboard", "main": "src/index.js", "files": [ diff --git a/velconnect-npm/src/types/pocketbase-types.ts b/velconnect-npm/src/types/pocketbase-types.ts index 9499f9a..a176947 100644 --- a/velconnect-npm/src/types/pocketbase-types.ts +++ b/velconnect-npm/src/types/pocketbase-types.ts @@ -36,7 +36,7 @@ export type AuthSystemFields = { // Record types for each collection -export type DataBlockRecord = { +export type DataBlockRecord = { block_id?: string category?: string data?: null | Tdata @@ -74,10 +74,10 @@ export type UsersRecord = { } // Response types include system fields and match responses from the PocketBase API -export type DataBlockResponse = Required> & BaseSystemFields +export type DataBlockResponse = Required> & BaseSystemFields export type DeviceResponse = Required & BaseSystemFields export type UserCountResponse = Required & BaseSystemFields -export type UsersResponse = Required & AuthSystemFields +export type UsersResponse = Required & AuthSystemFields // Types containing all Records and Responses, useful for creating typing helper functions