@webiny/db 6.0.0-alpha.5 β†’ 6.0.0-rc.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/DbRegistry.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { IRegistry, IRegistryItem, IRegistryRegisterParams } from "./types";
1
+ import type { IRegistry, IRegistryItem, IRegistryRegisterParams } from "./types.js";
2
2
  export declare class DbRegistry implements IRegistry {
3
3
  private readonly items;
4
4
  register<T = unknown>(input: IRegistryRegisterParams<T>): void;
package/DbRegistry.js CHANGED
@@ -1,10 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.DbRegistry = void 0;
7
- class DbRegistry {
1
+ export class DbRegistry {
8
2
  items = {};
9
3
  register(input) {
10
4
  const key = `${input.app}-${input.tags.sort().join("-")}`;
@@ -40,6 +34,5 @@ class DbRegistry {
40
34
  return results;
41
35
  }
42
36
  }
43
- exports.DbRegistry = DbRegistry;
44
37
 
45
38
  //# sourceMappingURL=DbRegistry.js.map
package/DbRegistry.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["DbRegistry","items","register","input","key","app","tags","sort","join","Error","getOneItem","cb","item","getItem","getItems","length","results","push","exports"],"sources":["DbRegistry.ts"],"sourcesContent":["import type { IRegistry, IRegistryItem, IRegistryRegisterParams } from \"./types\";\nimport type { GenericRecord } from \"@webiny/api/types\";\n\nexport class DbRegistry implements IRegistry {\n private readonly items: GenericRecord<string, IRegistryItem> = {};\n\n public register<T = unknown>(input: IRegistryRegisterParams<T>): void {\n const key = `${input.app}-${input.tags.sort().join(\"-\")}`;\n\n if (this.items[key]) {\n throw new Error(\n `Item with app \"${input.app}\" and tags \"${input.tags.join(\n \", \"\n )}\" is already registered.`\n );\n }\n this.items[key] = input;\n }\n\n public getOneItem<T = unknown>(cb: (item: IRegistryItem<T>) => boolean): IRegistryItem<T> {\n const item = this.getItem(cb);\n if (!item) {\n throw new Error(\"Item not found.\");\n }\n return item;\n }\n\n public getItem<T = unknown>(cb: (item: IRegistryItem<T>) => boolean): IRegistryItem<T> | null {\n const items = this.getItems(cb);\n if (items.length === 0) {\n return null;\n } else if (items.length > 1) {\n throw new Error(\"More than one item found with the provided criteria.\");\n }\n return items[0];\n }\n\n public getItems<T = unknown>(cb: (item: IRegistryItem<T>) => boolean): IRegistryItem<T>[] {\n const results: IRegistryItem<T>[] = [];\n for (const key in this.items) {\n const item = this.items[key] as IRegistryItem<T>;\n if (cb(item)) {\n results.push(item);\n }\n }\n\n return results;\n }\n}\n"],"mappings":";;;;;;AAGO,MAAMA,UAAU,CAAsB;EACxBC,KAAK,GAAyC,CAAC,CAAC;EAE1DC,QAAQA,CAAcC,KAAiC,EAAQ;IAClE,MAAMC,GAAG,GAAG,GAAGD,KAAK,CAACE,GAAG,IAAIF,KAAK,CAACG,IAAI,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,EAAE;IAEzD,IAAI,IAAI,CAACP,KAAK,CAACG,GAAG,CAAC,EAAE;MACjB,MAAM,IAAIK,KAAK,CACX,kBAAkBN,KAAK,CAACE,GAAG,eAAeF,KAAK,CAACG,IAAI,CAACE,IAAI,CACrD,IACJ,CAAC,0BACL,CAAC;IACL;IACA,IAAI,CAACP,KAAK,CAACG,GAAG,CAAC,GAAGD,KAAK;EAC3B;EAEOO,UAAUA,CAAcC,EAAuC,EAAoB;IACtF,MAAMC,IAAI,GAAG,IAAI,CAACC,OAAO,CAACF,EAAE,CAAC;IAC7B,IAAI,CAACC,IAAI,EAAE;MACP,MAAM,IAAIH,KAAK,CAAC,iBAAiB,CAAC;IACtC;IACA,OAAOG,IAAI;EACf;EAEOC,OAAOA,CAAcF,EAAuC,EAA2B;IAC1F,MAAMV,KAAK,GAAG,IAAI,CAACa,QAAQ,CAACH,EAAE,CAAC;IAC/B,IAAIV,KAAK,CAACc,MAAM,KAAK,CAAC,EAAE;MACpB,OAAO,IAAI;IACf,CAAC,MAAM,IAAId,KAAK,CAACc,MAAM,GAAG,CAAC,EAAE;MACzB,MAAM,IAAIN,KAAK,CAAC,sDAAsD,CAAC;IAC3E;IACA,OAAOR,KAAK,CAAC,CAAC,CAAC;EACnB;EAEOa,QAAQA,CAAcH,EAAuC,EAAsB;IACtF,MAAMK,OAA2B,GAAG,EAAE;IACtC,KAAK,MAAMZ,GAAG,IAAI,IAAI,CAACH,KAAK,EAAE;MAC1B,MAAMW,IAAI,GAAG,IAAI,CAACX,KAAK,CAACG,GAAG,CAAqB;MAChD,IAAIO,EAAE,CAACC,IAAI,CAAC,EAAE;QACVI,OAAO,CAACC,IAAI,CAACL,IAAI,CAAC;MACtB;IACJ;IAEA,OAAOI,OAAO;EAClB;AACJ;AAACE,OAAA,CAAAlB,UAAA,GAAAA,UAAA","ignoreList":[]}
1
+ {"version":3,"names":["DbRegistry","items","register","input","key","app","tags","sort","join","Error","getOneItem","cb","item","getItem","getItems","length","results","push"],"sources":["DbRegistry.ts"],"sourcesContent":["import type { IRegistry, IRegistryItem, IRegistryRegisterParams } from \"./types.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\n\nexport class DbRegistry implements IRegistry {\n private readonly items: GenericRecord<string, IRegistryItem> = {};\n\n public register<T = unknown>(input: IRegistryRegisterParams<T>): void {\n const key = `${input.app}-${input.tags.sort().join(\"-\")}`;\n\n if (this.items[key]) {\n throw new Error(\n `Item with app \"${input.app}\" and tags \"${input.tags.join(\n \", \"\n )}\" is already registered.`\n );\n }\n this.items[key] = input;\n }\n\n public getOneItem<T = unknown>(cb: (item: IRegistryItem<T>) => boolean): IRegistryItem<T> {\n const item = this.getItem(cb);\n if (!item) {\n throw new Error(\"Item not found.\");\n }\n return item;\n }\n\n public getItem<T = unknown>(cb: (item: IRegistryItem<T>) => boolean): IRegistryItem<T> | null {\n const items = this.getItems(cb);\n if (items.length === 0) {\n return null;\n } else if (items.length > 1) {\n throw new Error(\"More than one item found with the provided criteria.\");\n }\n return items[0];\n }\n\n public getItems<T = unknown>(cb: (item: IRegistryItem<T>) => boolean): IRegistryItem<T>[] {\n const results: IRegistryItem<T>[] = [];\n for (const key in this.items) {\n const item = this.items[key] as IRegistryItem<T>;\n if (cb(item)) {\n results.push(item);\n }\n }\n\n return results;\n }\n}\n"],"mappings":"AAGA,OAAO,MAAMA,UAAU,CAAsB;EACxBC,KAAK,GAAyC,CAAC,CAAC;EAE1DC,QAAQA,CAAcC,KAAiC,EAAQ;IAClE,MAAMC,GAAG,GAAG,GAAGD,KAAK,CAACE,GAAG,IAAIF,KAAK,CAACG,IAAI,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,EAAE;IAEzD,IAAI,IAAI,CAACP,KAAK,CAACG,GAAG,CAAC,EAAE;MACjB,MAAM,IAAIK,KAAK,CACX,kBAAkBN,KAAK,CAACE,GAAG,eAAeF,KAAK,CAACG,IAAI,CAACE,IAAI,CACrD,IACJ,CAAC,0BACL,CAAC;IACL;IACA,IAAI,CAACP,KAAK,CAACG,GAAG,CAAC,GAAGD,KAAK;EAC3B;EAEOO,UAAUA,CAAcC,EAAuC,EAAoB;IACtF,MAAMC,IAAI,GAAG,IAAI,CAACC,OAAO,CAACF,EAAE,CAAC;IAC7B,IAAI,CAACC,IAAI,EAAE;MACP,MAAM,IAAIH,KAAK,CAAC,iBAAiB,CAAC;IACtC;IACA,OAAOG,IAAI;EACf;EAEOC,OAAOA,CAAcF,EAAuC,EAA2B;IAC1F,MAAMV,KAAK,GAAG,IAAI,CAACa,QAAQ,CAACH,EAAE,CAAC;IAC/B,IAAIV,KAAK,CAACc,MAAM,KAAK,CAAC,EAAE;MACpB,OAAO,IAAI;IACf,CAAC,MAAM,IAAId,KAAK,CAACc,MAAM,GAAG,CAAC,EAAE;MACzB,MAAM,IAAIN,KAAK,CAAC,sDAAsD,CAAC;IAC3E;IACA,OAAOR,KAAK,CAAC,CAAC,CAAC;EACnB;EAEOa,QAAQA,CAAcH,EAAuC,EAAsB;IACtF,MAAMK,OAA2B,GAAG,EAAE;IACtC,KAAK,MAAMZ,GAAG,IAAI,IAAI,CAACH,KAAK,EAAE;MAC1B,MAAMW,IAAI,GAAG,IAAI,CAACX,KAAK,CAACG,GAAG,CAAqB;MAChD,IAAIO,EAAE,CAACC,IAAI,CAAC,EAAE;QACVI,OAAO,CAACC,IAAI,CAACL,IAAI,CAAC;MACtB;IACJ;IAEA,OAAOI,OAAO;EAClB;AACJ","ignoreList":[]}
package/README.md CHANGED
@@ -1,20 +1,11 @@
1
1
  # @webiny/db
2
- [![](https://img.shields.io/npm/dw/webiny-data.svg)](https://www.npmjs.com/package/webiny-data)
3
- [![](https://img.shields.io/npm/v/webiny-data.svg)](https://www.npmjs.com/package/webiny-data)
4
- [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
5
- [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
6
2
 
7
- A set of frequently used data higher order functions.
3
+ > [!NOTE]
4
+ > This package is part of the [Webiny](https://www.webiny.com) monorepo.
5
+ > It’s **included in every Webiny project by default** and is not meant to be used as a standalone package.
8
6
 
9
- For more information, please visit
10
- [the official docs](https://github.com/doitadrian/data).
11
-
12
- ## Install
13
- ```
14
- npm install --save @webiny/db
15
- ```
7
+ πŸ“˜ **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
16
8
 
17
- Or if you prefer yarn:
18
- ```
19
- yarn add @webiny/db
20
- ```
9
+ ---
10
+
11
+ _This README file is automatically generated during the publish process._
package/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { DbRegistry } from "./DbRegistry";
2
- import type { IStore } from "./store/types";
3
- export * from "./types";
1
+ import { DbRegistry } from "./DbRegistry.js";
2
+ import type { IStore } from "./store/types.js";
3
+ export * from "./types.js";
4
4
  export interface DbDriver<T> extends IStore {
5
5
  getClient(): T;
6
6
  }
package/index.js CHANGED
@@ -1,39 +1,19 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _exportNames = {
7
- Db: true
8
- };
9
- exports.Db = void 0;
10
- var _DbRegistry = require("./DbRegistry");
11
- var _Store = require("./store/Store");
12
- var _types = require("./types");
13
- Object.keys(_types).forEach(function (key) {
14
- if (key === "default" || key === "__esModule") return;
15
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
16
- if (key in exports && exports[key] === _types[key]) return;
17
- Object.defineProperty(exports, key, {
18
- enumerable: true,
19
- get: function () {
20
- return _types[key];
21
- }
22
- });
23
- });
1
+ import { DbRegistry } from "./DbRegistry.js";
2
+ import { Store } from "./store/Store.js";
3
+ export * from "./types.js";
24
4
  class Db {
25
- registry = new _DbRegistry.DbRegistry();
5
+ registry = new DbRegistry();
26
6
  constructor({
27
7
  driver,
28
8
  table
29
9
  }) {
30
10
  this.table = table;
31
11
  this.driver = driver;
32
- this.store = new _Store.Store({
12
+ this.store = new Store({
33
13
  driver
34
14
  });
35
15
  }
36
16
  }
37
- exports.Db = Db;
17
+ export { Db };
38
18
 
39
19
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_DbRegistry","require","_Store","_types","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","Db","registry","DbRegistry","constructor","driver","table","store","Store"],"sources":["index.ts"],"sourcesContent":["import { DbRegistry } from \"~/DbRegistry\";\nimport type { IStore } from \"~/store/types\";\nimport { Store } from \"~/store/Store\";\n\nexport * from \"./types\";\n\nexport interface DbDriver<T> extends IStore {\n getClient(): T;\n}\n\nexport interface ConstructorArgs<T> {\n driver: DbDriver<T>;\n table?: string;\n}\n\nclass Db<T> {\n public driver: DbDriver<T>;\n public readonly table?: string;\n public readonly store: IStore;\n\n public readonly registry = new DbRegistry();\n\n constructor({ driver, table }: ConstructorArgs<T>) {\n this.table = table;\n this.driver = driver;\n this.store = new Store<T>({\n driver\n });\n }\n}\n\nexport { Db };\n"],"mappings":";;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAAAG,MAAA,CAAAC,IAAA,CAAAF,MAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,MAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,MAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAWA,MAAMS,EAAE,CAAI;EAKQC,QAAQ,GAAG,IAAIC,sBAAU,CAAC,CAAC;EAE3CC,WAAWA,CAAC;IAAEC,MAAM;IAAEC;EAA0B,CAAC,EAAE;IAC/C,IAAI,CAACA,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACD,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACE,KAAK,GAAG,IAAIC,YAAK,CAAI;MACtBH;IACJ,CAAC,CAAC;EACN;AACJ;AAACR,OAAA,CAAAI,EAAA,GAAAA,EAAA","ignoreList":[]}
1
+ {"version":3,"names":["DbRegistry","Store","Db","registry","constructor","driver","table","store"],"sources":["index.ts"],"sourcesContent":["import { DbRegistry } from \"~/DbRegistry.js\";\nimport type { IStore } from \"~/store/types.js\";\nimport { Store } from \"~/store/Store.js\";\n\nexport * from \"./types.js\";\n\nexport interface DbDriver<T> extends IStore {\n getClient(): T;\n}\n\nexport interface ConstructorArgs<T> {\n driver: DbDriver<T>;\n table?: string;\n}\n\nclass Db<T> {\n public driver: DbDriver<T>;\n public readonly table?: string;\n public readonly store: IStore;\n\n public readonly registry = new DbRegistry();\n\n constructor({ driver, table }: ConstructorArgs<T>) {\n this.table = table;\n this.driver = driver;\n this.store = new Store<T>({\n driver\n });\n }\n}\n\nexport { Db };\n"],"mappings":"AAAA,SAASA,UAAU;AAEnB,SAASC,KAAK;AAEd;AAWA,MAAMC,EAAE,CAAI;EAKQC,QAAQ,GAAG,IAAIH,UAAU,CAAC,CAAC;EAE3CI,WAAWA,CAAC;IAAEC,MAAM;IAAEC;EAA0B,CAAC,EAAE;IAC/C,IAAI,CAACA,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACD,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACE,KAAK,GAAG,IAAIN,KAAK,CAAI;MACtBI;IACJ,CAAC,CAAC;EACN;AACJ;AAEA,SAASH,EAAE","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@webiny/db",
3
- "version": "6.0.0-alpha.5",
3
+ "version": "6.0.0-rc.0",
4
+ "type": "module",
4
5
  "main": "index.js",
5
6
  "repository": {
6
7
  "type": "git",
@@ -13,17 +14,13 @@
13
14
  "directory": "dist"
14
15
  },
15
16
  "dependencies": {
16
- "@webiny/api": "6.0.0-alpha.5",
17
- "type-fest": "4.14.0"
17
+ "@webiny/api": "6.0.0-rc.0",
18
+ "type-fest": "5.4.4"
18
19
  },
19
20
  "devDependencies": {
20
- "@webiny/project-utils": "6.0.0-alpha.5",
21
- "rimraf": "6.0.1",
22
- "typescript": "5.3.3"
21
+ "@webiny/build-tools": "6.0.0-rc.0",
22
+ "rimraf": "6.1.3",
23
+ "typescript": "5.9.3"
23
24
  },
24
- "scripts": {
25
- "build": "node ../cli/bin.js run build",
26
- "watch": "node ../cli/bin.js run watch"
27
- },
28
- "gitHead": "b7e120541b093e91f214904a9f13e4c2c4640978"
25
+ "gitHead": "0f2aa699f4642e550ab62c96fcd050e8d02345c9"
29
26
  }
package/store/Store.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { GetValueResult, GetValuesResult, IListValuesParams, IStore, ListValuesResult, RemoveValueResult, RemoveValuesResult, StorageKey, StoreValueResult, StoreValuesResult } from "./types";
2
- import type { GenericRecord } from "@webiny/api/types";
3
- import type { DbDriver } from "../index";
1
+ import type { GetValueResult, GetValuesResult, IListValuesParams, IStore, ListValuesResult, RemoveValueResult, RemoveValuesResult, StorageKey, StoreValueResult, StoreValuesResult } from "./types.js";
2
+ import type { GenericRecord } from "@webiny/api/types.js";
3
+ import type { DbDriver } from "../index.js";
4
4
  export interface IStoreParams<T> {
5
5
  driver: DbDriver<T>;
6
6
  }
package/store/Store.js CHANGED
@@ -1,10 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Store = void 0;
7
- class Store {
1
+ export class Store {
8
2
  constructor(params) {
9
3
  this.driver = params.driver;
10
4
  }
@@ -30,6 +24,5 @@ class Store {
30
24
  return this.driver.removeValues(keys);
31
25
  }
32
26
  }
33
- exports.Store = Store;
34
27
 
35
28
  //# sourceMappingURL=Store.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Store","constructor","params","driver","storeValue","key","value","storeValues","values","getValue","getValues","keys","listValues","removeValue","removeValues","exports"],"sources":["Store.ts"],"sourcesContent":["import type {\n GetValueResult,\n GetValuesResult,\n IListValuesParams,\n IStore,\n ListValuesResult,\n RemoveValueResult,\n RemoveValuesResult,\n StorageKey,\n StoreValueResult,\n StoreValuesResult\n} from \"./types\";\nimport type { GenericRecord } from \"@webiny/api/types\";\nimport type { DbDriver } from \"~/index\";\n\nexport interface IStoreParams<T> {\n driver: DbDriver<T>;\n}\n\nexport class Store<T> implements IStore {\n private driver: DbDriver<T>;\n\n public constructor(params: IStoreParams<T>) {\n this.driver = params.driver;\n }\n\n public async storeValue<V>(key: StorageKey, value: V): Promise<StoreValueResult<V>> {\n return this.driver.storeValue<V>(key, value);\n }\n\n public async storeValues<V extends GenericRecord<StorageKey>>(\n values: V\n ): Promise<StoreValuesResult<V>> {\n return this.driver.storeValues<V>(values);\n }\n\n public async getValue<V>(key: StorageKey): Promise<GetValueResult<V>> {\n return this.driver.getValue<V>(key);\n }\n\n public async getValues<V extends GenericRecord<StorageKey>>(\n keys: (keyof V)[]\n ): Promise<GetValuesResult<V>> {\n return this.driver.getValues<V>(keys);\n }\n\n public async listValues<V extends GenericRecord<StorageKey>>(\n params?: IListValuesParams\n ): Promise<ListValuesResult<V>> {\n return this.driver.listValues<V>(params);\n }\n\n public async removeValue<V>(key: StorageKey): Promise<RemoveValueResult<V>> {\n return this.driver.removeValue<V>(key);\n }\n\n public async removeValues<V extends GenericRecord<StorageKey>>(\n keys: (keyof V)[]\n ): Promise<RemoveValuesResult<V>> {\n return this.driver.removeValues<V>(keys);\n }\n}\n"],"mappings":";;;;;;AAmBO,MAAMA,KAAK,CAAsB;EAG7BC,WAAWA,CAACC,MAAuB,EAAE;IACxC,IAAI,CAACC,MAAM,GAAGD,MAAM,CAACC,MAAM;EAC/B;EAEA,MAAaC,UAAUA,CAAIC,GAAe,EAAEC,KAAQ,EAAgC;IAChF,OAAO,IAAI,CAACH,MAAM,CAACC,UAAU,CAAIC,GAAG,EAAEC,KAAK,CAAC;EAChD;EAEA,MAAaC,WAAWA,CACpBC,MAAS,EACoB;IAC7B,OAAO,IAAI,CAACL,MAAM,CAACI,WAAW,CAAIC,MAAM,CAAC;EAC7C;EAEA,MAAaC,QAAQA,CAAIJ,GAAe,EAA8B;IAClE,OAAO,IAAI,CAACF,MAAM,CAACM,QAAQ,CAAIJ,GAAG,CAAC;EACvC;EAEA,MAAaK,SAASA,CAClBC,IAAiB,EACU;IAC3B,OAAO,IAAI,CAACR,MAAM,CAACO,SAAS,CAAIC,IAAI,CAAC;EACzC;EAEA,MAAaC,UAAUA,CACnBV,MAA0B,EACE;IAC5B,OAAO,IAAI,CAACC,MAAM,CAACS,UAAU,CAAIV,MAAM,CAAC;EAC5C;EAEA,MAAaW,WAAWA,CAAIR,GAAe,EAAiC;IACxE,OAAO,IAAI,CAACF,MAAM,CAACU,WAAW,CAAIR,GAAG,CAAC;EAC1C;EAEA,MAAaS,YAAYA,CACrBH,IAAiB,EACa;IAC9B,OAAO,IAAI,CAACR,MAAM,CAACW,YAAY,CAAIH,IAAI,CAAC;EAC5C;AACJ;AAACI,OAAA,CAAAf,KAAA,GAAAA,KAAA","ignoreList":[]}
1
+ {"version":3,"names":["Store","constructor","params","driver","storeValue","key","value","storeValues","values","getValue","getValues","keys","listValues","removeValue","removeValues"],"sources":["Store.ts"],"sourcesContent":["import type {\n GetValueResult,\n GetValuesResult,\n IListValuesParams,\n IStore,\n ListValuesResult,\n RemoveValueResult,\n RemoveValuesResult,\n StorageKey,\n StoreValueResult,\n StoreValuesResult\n} from \"./types.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport type { DbDriver } from \"~/index.js\";\n\nexport interface IStoreParams<T> {\n driver: DbDriver<T>;\n}\n\nexport class Store<T> implements IStore {\n private driver: DbDriver<T>;\n\n public constructor(params: IStoreParams<T>) {\n this.driver = params.driver;\n }\n\n public async storeValue<V>(key: StorageKey, value: V): Promise<StoreValueResult<V>> {\n return this.driver.storeValue<V>(key, value);\n }\n\n public async storeValues<V extends GenericRecord<StorageKey>>(\n values: V\n ): Promise<StoreValuesResult<V>> {\n return this.driver.storeValues<V>(values);\n }\n\n public async getValue<V>(key: StorageKey): Promise<GetValueResult<V>> {\n return this.driver.getValue<V>(key);\n }\n\n public async getValues<V extends GenericRecord<StorageKey>>(\n keys: (keyof V)[]\n ): Promise<GetValuesResult<V>> {\n return this.driver.getValues<V>(keys);\n }\n\n public async listValues<V extends GenericRecord<StorageKey>>(\n params?: IListValuesParams\n ): Promise<ListValuesResult<V>> {\n return this.driver.listValues<V>(params);\n }\n\n public async removeValue<V>(key: StorageKey): Promise<RemoveValueResult<V>> {\n return this.driver.removeValue<V>(key);\n }\n\n public async removeValues<V extends GenericRecord<StorageKey>>(\n keys: (keyof V)[]\n ): Promise<RemoveValuesResult<V>> {\n return this.driver.removeValues<V>(keys);\n }\n}\n"],"mappings":"AAmBA,OAAO,MAAMA,KAAK,CAAsB;EAG7BC,WAAWA,CAACC,MAAuB,EAAE;IACxC,IAAI,CAACC,MAAM,GAAGD,MAAM,CAACC,MAAM;EAC/B;EAEA,MAAaC,UAAUA,CAAIC,GAAe,EAAEC,KAAQ,EAAgC;IAChF,OAAO,IAAI,CAACH,MAAM,CAACC,UAAU,CAAIC,GAAG,EAAEC,KAAK,CAAC;EAChD;EAEA,MAAaC,WAAWA,CACpBC,MAAS,EACoB;IAC7B,OAAO,IAAI,CAACL,MAAM,CAACI,WAAW,CAAIC,MAAM,CAAC;EAC7C;EAEA,MAAaC,QAAQA,CAAIJ,GAAe,EAA8B;IAClE,OAAO,IAAI,CAACF,MAAM,CAACM,QAAQ,CAAIJ,GAAG,CAAC;EACvC;EAEA,MAAaK,SAASA,CAClBC,IAAiB,EACU;IAC3B,OAAO,IAAI,CAACR,MAAM,CAACO,SAAS,CAAIC,IAAI,CAAC;EACzC;EAEA,MAAaC,UAAUA,CACnBV,MAA0B,EACE;IAC5B,OAAO,IAAI,CAACC,MAAM,CAACS,UAAU,CAAIV,MAAM,CAAC;EAC5C;EAEA,MAAaW,WAAWA,CAAIR,GAAe,EAAiC;IACxE,OAAO,IAAI,CAACF,MAAM,CAACU,WAAW,CAAIR,GAAG,CAAC;EAC1C;EAEA,MAAaS,YAAYA,CACrBH,IAAiB,EACa;IAC9B,OAAO,IAAI,CAACR,MAAM,CAACW,YAAY,CAAIH,IAAI,CAAC;EAC5C;AACJ","ignoreList":[]}
package/store/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { CamelCase } from "type-fest";
2
- import type { GenericRecord } from "@webiny/api/types";
2
+ import type { GenericRecord } from "@webiny/api/types.js";
3
3
  export type StorageKey = `${CamelCase<string>}`;
4
4
  export interface IStoreValueSuccessResult<V> {
5
5
  key: StorageKey;
package/store/types.js CHANGED
@@ -1,7 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ export {};
6
2
 
7
3
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { CamelCase } from \"type-fest\";\nimport type { GenericRecord } from \"@webiny/api/types\";\n\nexport type StorageKey = `${CamelCase<string>}`;\n\nexport interface IStoreValueSuccessResult<V> {\n key: StorageKey;\n data: V | null | undefined;\n error?: undefined;\n}\n\nexport interface IStoreValueErrorResult {\n key: StorageKey;\n data?: never;\n error: Error;\n}\n\nexport type StoreValueResult<V> = IStoreValueSuccessResult<V> | IStoreValueErrorResult;\n\nexport interface IStoreValuesSuccessResult<V extends GenericRecord<StorageKey>> {\n keys: (keyof V)[];\n data: V;\n error?: undefined;\n}\n\nexport interface IStoreValuesErrorResult<V> {\n keys: (keyof V)[];\n data?: never;\n error: Error;\n}\n\nexport type StoreValuesResult<V extends GenericRecord<StorageKey>> =\n | IStoreValuesSuccessResult<V>\n | IStoreValuesErrorResult<V>;\n\nexport interface IGetValueSuccessResult<V> {\n key: StorageKey;\n data: V | null | undefined;\n error?: undefined;\n}\n\nexport interface IGetValueErrorResult {\n key: StorageKey;\n data?: never;\n error: Error;\n}\n\nexport type GetValueResult<V> = IGetValueSuccessResult<V> | IGetValueErrorResult;\n\nexport interface IGetValuesSuccessResult<V extends GenericRecord<StorageKey>> {\n keys: (keyof V)[];\n data: V;\n error?: undefined;\n}\n\nexport interface IGetValuesErrorResult<V> {\n keys: (keyof V)[];\n data?: never;\n error: Error;\n}\n\nexport type GetValuesResult<V extends GenericRecord<StorageKey>> =\n | IGetValuesSuccessResult<V>\n | IGetValuesErrorResult<V>;\n\nexport interface IListValuesSuccessResult<V extends GenericRecord<StorageKey>> {\n keys: (keyof V)[];\n data: V;\n error?: undefined;\n}\n\nexport interface IListValuesErrorResult {\n data?: never;\n error: Error;\n}\n\nexport type ListValuesResult<V extends GenericRecord<StorageKey>> =\n | IListValuesSuccessResult<V>\n | IListValuesErrorResult;\n\nexport type IListValuesParams =\n | {\n beginsWith: string;\n }\n | {\n eq: string;\n }\n | {\n gt: string;\n }\n | {\n gte: string;\n }\n | {\n lt: string;\n }\n | {\n lte: string;\n };\n\nexport type RemoveValueResult<V> = StoreValueResult<V>;\n\nexport interface RemoveValuesResult<V extends GenericRecord<StorageKey>> {\n keys: (keyof V)[];\n error?: Error;\n}\n\nexport interface IStore {\n storeValue<V>(key: StorageKey, value: V): Promise<StoreValueResult<V>>;\n storeValues<V extends GenericRecord<StorageKey>>(values: V): Promise<StoreValuesResult<V>>;\n getValue<V>(key: StorageKey): Promise<GetValueResult<V>>;\n getValues<V extends GenericRecord<StorageKey>>(keys: (keyof V)[]): Promise<GetValuesResult<V>>;\n listValues<V extends GenericRecord<StorageKey>>(\n params?: IListValuesParams\n ): Promise<ListValuesResult<V>>;\n removeValue<V>(key: StorageKey): Promise<RemoveValueResult<V>>;\n removeValues<V extends GenericRecord<StorageKey>>(\n keys: (keyof V)[]\n ): Promise<RemoveValuesResult<V>>;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { CamelCase } from \"type-fest\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\n\nexport type StorageKey = `${CamelCase<string>}`;\n\nexport interface IStoreValueSuccessResult<V> {\n key: StorageKey;\n data: V | null | undefined;\n error?: undefined;\n}\n\nexport interface IStoreValueErrorResult {\n key: StorageKey;\n data?: never;\n error: Error;\n}\n\nexport type StoreValueResult<V> = IStoreValueSuccessResult<V> | IStoreValueErrorResult;\n\nexport interface IStoreValuesSuccessResult<V extends GenericRecord<StorageKey>> {\n keys: (keyof V)[];\n data: V;\n error?: undefined;\n}\n\nexport interface IStoreValuesErrorResult<V> {\n keys: (keyof V)[];\n data?: never;\n error: Error;\n}\n\nexport type StoreValuesResult<V extends GenericRecord<StorageKey>> =\n | IStoreValuesSuccessResult<V>\n | IStoreValuesErrorResult<V>;\n\nexport interface IGetValueSuccessResult<V> {\n key: StorageKey;\n data: V | null | undefined;\n error?: undefined;\n}\n\nexport interface IGetValueErrorResult {\n key: StorageKey;\n data?: never;\n error: Error;\n}\n\nexport type GetValueResult<V> = IGetValueSuccessResult<V> | IGetValueErrorResult;\n\nexport interface IGetValuesSuccessResult<V extends GenericRecord<StorageKey>> {\n keys: (keyof V)[];\n data: V;\n error?: undefined;\n}\n\nexport interface IGetValuesErrorResult<V> {\n keys: (keyof V)[];\n data?: never;\n error: Error;\n}\n\nexport type GetValuesResult<V extends GenericRecord<StorageKey>> =\n | IGetValuesSuccessResult<V>\n | IGetValuesErrorResult<V>;\n\nexport interface IListValuesSuccessResult<V extends GenericRecord<StorageKey>> {\n keys: (keyof V)[];\n data: V;\n error?: undefined;\n}\n\nexport interface IListValuesErrorResult {\n data?: never;\n error: Error;\n}\n\nexport type ListValuesResult<V extends GenericRecord<StorageKey>> =\n | IListValuesSuccessResult<V>\n | IListValuesErrorResult;\n\nexport type IListValuesParams =\n | {\n beginsWith: string;\n }\n | {\n eq: string;\n }\n | {\n gt: string;\n }\n | {\n gte: string;\n }\n | {\n lt: string;\n }\n | {\n lte: string;\n };\n\nexport type RemoveValueResult<V> = StoreValueResult<V>;\n\nexport interface RemoveValuesResult<V extends GenericRecord<StorageKey>> {\n keys: (keyof V)[];\n error?: Error;\n}\n\nexport interface IStore {\n storeValue<V>(key: StorageKey, value: V): Promise<StoreValueResult<V>>;\n storeValues<V extends GenericRecord<StorageKey>>(values: V): Promise<StoreValuesResult<V>>;\n getValue<V>(key: StorageKey): Promise<GetValueResult<V>>;\n getValues<V extends GenericRecord<StorageKey>>(keys: (keyof V)[]): Promise<GetValuesResult<V>>;\n listValues<V extends GenericRecord<StorageKey>>(\n params?: IListValuesParams\n ): Promise<ListValuesResult<V>>;\n removeValue<V>(key: StorageKey): Promise<RemoveValueResult<V>>;\n removeValues<V extends GenericRecord<StorageKey>>(\n keys: (keyof V)[]\n ): Promise<RemoveValuesResult<V>>;\n}\n"],"mappings":"","ignoreList":[]}
package/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { NonEmptyArray } from "@webiny/api/types";
1
+ import type { NonEmptyArray } from "@webiny/api/types.js";
2
2
  export interface IRegistryRegisterParams<T = unknown> {
3
3
  item: T;
4
4
  app: string;
@@ -21,4 +21,4 @@ export interface IRegistry {
21
21
  getItem<T = unknown>(cb: (item: IRegistryItem<T>) => boolean): IRegistryItem<T> | null;
22
22
  getItems<T = unknown>(cb: (item: IRegistryItem<T>) => boolean): IRegistryItem<T>[];
23
23
  }
24
- export * from "./store/types";
24
+ export * from "./store/types.js";
package/types.js CHANGED
@@ -1,18 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _types = require("./store/types");
7
- Object.keys(_types).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _types[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _types[key];
14
- }
15
- });
16
- });
1
+ export * from "./store/types.js";
2
+ export {};
17
3
 
18
4
  //# sourceMappingURL=types.js.map
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_types","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["types.ts"],"sourcesContent":["import type { NonEmptyArray } from \"@webiny/api/types\";\n\nexport interface IRegistryRegisterParams<T = unknown> {\n item: T;\n app: string;\n tags: NonEmptyArray<string>;\n}\n\nexport interface IRegistryItem<T = unknown> {\n item: T;\n app: string;\n tags: NonEmptyArray<string>;\n}\n\nexport interface IRegistry {\n register<T = unknown>(params: IRegistryRegisterParams<T>): void;\n /**\n * Throws an error if more than one item is found or there is no item found.\n */\n getOneItem<T = unknown>(cb: (item: IRegistryItem<T>) => boolean): IRegistryItem<T>;\n /**\n * Throws an error if more than one item is found.\n */\n getItem<T = unknown>(cb: (item: IRegistryItem<T>) => boolean): IRegistryItem<T> | null;\n getItems<T = unknown>(cb: (item: IRegistryItem<T>) => boolean): IRegistryItem<T>[];\n}\n\nexport * from \"./store/types\";\n"],"mappings":";;;;;AA2BA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { NonEmptyArray } from \"@webiny/api/types.js\";\n\nexport interface IRegistryRegisterParams<T = unknown> {\n item: T;\n app: string;\n tags: NonEmptyArray<string>;\n}\n\nexport interface IRegistryItem<T = unknown> {\n item: T;\n app: string;\n tags: NonEmptyArray<string>;\n}\n\nexport interface IRegistry {\n register<T = unknown>(params: IRegistryRegisterParams<T>): void;\n /**\n * Throws an error if more than one item is found or there is no item found.\n */\n getOneItem<T = unknown>(cb: (item: IRegistryItem<T>) => boolean): IRegistryItem<T>;\n /**\n * Throws an error if more than one item is found.\n */\n getItem<T = unknown>(cb: (item: IRegistryItem<T>) => boolean): IRegistryItem<T> | null;\n getItems<T = unknown>(cb: (item: IRegistryItem<T>) => boolean): IRegistryItem<T>[];\n}\n\nexport * from \"./store/types.js\";\n"],"mappings":"AA2BA;AAAiC","ignoreList":[]}