@alwith/module-store 0.1.0 → 0.1.2

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/LICENSE CHANGED
@@ -11,8 +11,8 @@ reduces rights granted by those licenses or by mandatory applicable law.
11
11
  2. Permission to develop and distribute applications
12
12
  Subject to this license, ALwith grants you a worldwide, non-exclusive, royalty-free
13
13
  copyright license to use, reproduce, integrate and modify the supplied Software
14
- to develop, test, host and operate your own applications, including WorkBuddy
15
- applications, for personal, internal business or commercial use. You may brand,
14
+ to develop, test, host and operate your own applications, for personal,
15
+ internal business or commercial use. You may brand,
16
16
  sell and distribute those applications, including the Software embedded in them,
17
17
  to your customers and end users. No per-application registration, approval or
18
18
  royalty is required by this software license.
package/README.md CHANGED
@@ -13,7 +13,7 @@ No user data or preferences are migrated by this extraction.
13
13
 
14
14
  See [LICENSE](LICENSE) and [third-party notices](THIRD_PARTY_NOTICES.md).
15
15
  ALwith-owned code is proprietary, not open source. You may build, customize, host,
16
- charge for and distribute your own WorkBuddy applications under the included
16
+ charge for and distribute your own applications under the included
17
17
  license, without per-application registration. This does not grant hosted-service
18
18
  access or rights to separately distributed Rust libraries or Runtime binaries.
19
19
  The npm artifact includes compiled/minified JS, declarations and necessary assets,
package/dist/index.d.ts CHANGED
@@ -1,29 +1,29 @@
1
1
  export interface AlwithStore {
2
- get<T>(key: string): Promise<T | undefined>;
3
- set(key: string, value: unknown): Promise<void>;
4
- has(key: string): Promise<boolean>;
5
- delete(key: string): Promise<void>;
6
- keys(): Promise<string[]>;
7
- values<T>(): Promise<T[]>;
8
- entries<T>(): Promise<[key: string, value: T][]>;
9
- clear(): Promise<void>;
10
- reload(): Promise<void>;
11
- length(): Promise<number>;
12
- onKeyChange<T>(key: string, listener: (value: T | undefined) => void): Promise<() => void>;
13
- onChange<T>(listener: (key: string, value: T | undefined) => void): Promise<() => void>;
2
+ get: <T>(key: string) => Promise<T | undefined>;
3
+ set: (key: string, value: unknown) => Promise<void>;
4
+ has: (key: string) => Promise<boolean>;
5
+ delete: (key: string) => Promise<void>;
6
+ keys: () => Promise<string[]>;
7
+ values: <T>() => Promise<T[]>;
8
+ entries: <T>() => Promise<[key: string, value: T][]>;
9
+ clear: () => Promise<void>;
10
+ reload: () => Promise<void>;
11
+ length: () => Promise<number>;
12
+ onKeyChange: <T>(key: string, listener: (value: T | undefined) => void) => Promise<() => void>;
13
+ onChange: <T>(listener: (key: string, value: T | undefined) => void) => Promise<() => void>;
14
14
  }
15
15
  export type StoreScope = "data" | "cache";
16
16
  export interface StorePort {
17
- storeEntries(scope: StoreScope, store: string): Promise<Record<string, unknown>>;
18
- storeSet(scope: StoreScope, store: string, key: string, value: unknown): Promise<void>;
19
- storeDelete(scope: StoreScope, store: string, key: string): Promise<void>;
20
- storeClear(scope: StoreScope, store: string): Promise<void>;
21
- storeReload(scope: StoreScope, store: string): Promise<void>;
22
- onStoreChanged(handler: (change: {
17
+ storeEntries: (scope: StoreScope, store: string) => Promise<Record<string, unknown>>;
18
+ storeSet: (scope: StoreScope, store: string, key: string, value: unknown) => Promise<void>;
19
+ storeDelete: (scope: StoreScope, store: string, key: string) => Promise<void>;
20
+ storeClear: (scope: StoreScope, store: string) => Promise<void>;
21
+ storeReload: (scope: StoreScope, store: string) => Promise<void>;
22
+ onStoreChanged: (handler: (change: {
23
23
  store: string;
24
24
  key: string;
25
25
  value: unknown;
26
- }) => void): Promise<() => void>;
26
+ }) => void) => Promise<() => void>;
27
27
  }
28
28
  export declare function createStoreClient(createHostPort: () => StorePort): {
29
29
  openStore: (name: string, scope?: StoreScope) => AlwithStore;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- function o(s){class i{scope;name;constructor(e,t){this.scope=e,this.name=t}entriesObject(){return s().storeEntries(this.scope,this.name)}async get(e){return(await this.entriesObject())[e]}async set(e,t){await s().storeSet(this.scope,this.name,e,t)}async has(e){return Object.hasOwn(await this.entriesObject(),e)}async delete(e){await s().storeDelete(this.scope,this.name,e)}async keys(){return Object.keys(await this.entriesObject())}async values(){return Object.values(await this.entriesObject())}async clear(){await s().storeClear(this.scope,this.name)}async reload(){await s().storeReload(this.scope,this.name)}async entries(){return Object.entries(await this.entriesObject())}async length(){return Object.keys(await this.entriesObject()).length}onKeyChange(e,t){return this.onChange((n,a)=>{if(n===e)t(a)})}onChange(e){return s().onStoreChanged((t)=>{if(t.store===this.name)e(t.key,t.value)})}}let r=new Map;function h(e,t="data"){let n=`${t}:${e}`,a=r.get(n);if(a)return a;let c=new i(t,e);return r.set(n,c),c}return{openStore:h}}export{o as createStoreClient};
1
+ function c(r){class n{scope;name;constructor(e,t){this.scope=e;this.name=t}entriesObject(){return r().storeEntries(this.scope,this.name)}async get(e){return(await this.entriesObject())[e]}async set(e,t){await r().storeSet(this.scope,this.name,e,t)}async has(e){return Object.hasOwn(await this.entriesObject(),e)}async delete(e){await r().storeDelete(this.scope,this.name,e)}async keys(){return Object.keys(await this.entriesObject())}async values(){return Object.values(await this.entriesObject())}async clear(){await r().storeClear(this.scope,this.name)}async reload(){await r().storeReload(this.scope,this.name)}async entries(){return Object.entries(await this.entriesObject())}async length(){return Object.keys(await this.entriesObject()).length}onKeyChange(e,t){return this.onChange((s,i)=>{if(s===e)t(i)})}onChange(e){return r().onStoreChanged((t)=>{if(t.store===this.name)e(t.key,t.value)})}}let o=new Map;function d(e,t="data"){let s=`${t}:${e}`,i=o.get(s);if(i)return i;let a=new n(t,e);return o.set(s,a),a}return{openStore:d}}export{c as createStoreClient};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alwith/module-store",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
@@ -22,7 +22,6 @@
22
22
  },
23
23
  "scripts": {
24
24
  "test": "bun test src",
25
- "typecheck": "tsc --noEmit",
26
25
  "build": "bun ../../../scripts/build-npm.ts",
27
26
  "prepack": "bun run build"
28
27
  },