sh3-server 0.16.0 → 0.17.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.
@@ -1,2 +0,0 @@
1
- import{LazyStore as r}from"./index-YGsF1N98.js";import"./core-DsojzR6k.js";class n{#t;#e=new Map;constructor(e){this.#t=new r(`${e}.json`,{defaults:{},autoSave:!0})}read(e){return this.#e.get(e)}write(e,t){this.#e.set(e,t),this.#t.set(e,t).catch(s=>console.warn("SH3: store write failed",s))}delete(e){this.#e.delete(e),this.#t.delete(e).catch(t=>console.warn("SH3: store delete failed",t))}list(){return[...this.#e.keys()]}async init(){const e=await this.#t.entries();for(const[t,s]of e)this.#e.set(t,s)}}export{n as TauriStoreBackend};
2
- //# sourceMappingURL=tauri-backend-C83nL1gr.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tauri-backend-C83nL1gr.js","sources":["../../../sh3-core/src/platform/tauri-backend.ts"],"sourcesContent":["/*\n * TauriStoreBackend — implements the sh3 Backend interface using\n * @tauri-apps/plugin-store. Each zone gets its own .json store file\n * (e.g. \"workspace.json\", \"user.json\") in Tauri's app data directory.\n *\n * tauri-plugin-store v2 keeps an in-memory cache and flushes to disk\n * automatically. We pre-load the full store into a local Map during\n * init(), then serve reads/lists synchronously from that cache —\n * matching the Backend interface contract. Writes go to both the\n * local cache and the Tauri store (fire-and-forget async).\n */\n\nimport { LazyStore } from '@tauri-apps/plugin-store';\nimport type { Backend } from '../state/types';\n\nexport class TauriStoreBackend implements Backend {\n #store: LazyStore;\n #cache = new Map<string, unknown>();\n\n constructor(zoneName: string) {\n this.#store = new LazyStore(`${zoneName}.json`, { defaults: {}, autoSave: true });\n }\n\n read(shardId: string): unknown | undefined {\n return this.#cache.get(shardId);\n }\n\n write(shardId: string, value: unknown): void {\n this.#cache.set(shardId, value);\n // Fire-and-forget — autoSave flushes to disk.\n this.#store.set(shardId, value).catch((e: unknown) => console.warn('SH3: store write failed', e));\n }\n\n delete(shardId: string): void {\n this.#cache.delete(shardId);\n this.#store.delete(shardId).catch((e: unknown) => console.warn('SH3: store delete failed', e));\n }\n\n list(): string[] {\n return [...this.#cache.keys()];\n }\n\n /**\n * Load the store from disk into the local cache. Must be called once\n * before read/list return meaningful data. Called by the platform\n * resolver at boot.\n */\n async init(): Promise<void> {\n const entries = await this.#store.entries<unknown>();\n for (const [key, value] of entries) {\n this.#cache.set(key, value);\n }\n }\n}\n"],"names":["TauriStoreBackend","#store","#cache","zoneName","LazyStore","shardId","value","e","entries","key"],"mappings":"2EAeO,MAAMA,CAAqC,CAChDC,GACAC,OAAa,IAEb,YAAYC,EAAkB,CAC5B,KAAKF,GAAS,IAAIG,EAAU,GAAGD,CAAQ,QAAS,CAAE,SAAU,CAAA,EAAI,SAAU,EAAA,CAAM,CAClF,CAEA,KAAKE,EAAsC,CACzC,OAAO,KAAKH,GAAO,IAAIG,CAAO,CAChC,CAEA,MAAMA,EAAiBC,EAAsB,CAC3C,KAAKJ,GAAO,IAAIG,EAASC,CAAK,EAE9B,KAAKL,GAAO,IAAII,EAASC,CAAK,EAAE,MAAOC,GAAe,QAAQ,KAAK,0BAA2BA,CAAC,CAAC,CAClG,CAEA,OAAOF,EAAuB,CAC5B,KAAKH,GAAO,OAAOG,CAAO,EAC1B,KAAKJ,GAAO,OAAOI,CAAO,EAAE,MAAOE,GAAe,QAAQ,KAAK,2BAA4BA,CAAC,CAAC,CAC/F,CAEA,MAAiB,CACf,MAAO,CAAC,GAAG,KAAKL,GAAO,MAAM,CAC/B,CAOA,MAAM,MAAsB,CAC1B,MAAMM,EAAU,MAAM,KAAKP,GAAO,QAAA,EAClC,SAAW,CAACQ,EAAKH,CAAK,IAAKE,EACzB,KAAKN,GAAO,IAAIO,EAAKH,CAAK,CAE9B,CACF"}