@webiny/app-utils 0.0.0-unstable.e53eceafb5 → 0.0.0-unstable.eb196ccd2f

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,4 +1,4 @@
1
- import { makeAutoObservable } from "mobx";
1
+ import { makeAutoObservable, runInAction } from "mobx";
2
2
  import { decodeCursor, encodeCursor } from "@webiny/utils";
3
3
  import { Meta, MetaMapper } from "../../Models/Meta";
4
4
  export class MetaRepository {
@@ -7,7 +7,9 @@ export class MetaRepository {
7
7
  makeAutoObservable(this);
8
8
  }
9
9
  async set(meta) {
10
- this.meta = Meta.create(meta);
10
+ runInAction(() => {
11
+ this.meta = Meta.create(meta);
12
+ });
11
13
  }
12
14
  get() {
13
15
  return MetaMapper.toDto(this.meta);
@@ -1 +1 @@
1
- {"version":3,"names":["makeAutoObservable","decodeCursor","encodeCursor","Meta","MetaMapper","MetaRepository","constructor","meta","createEmpty","set","create","get","toDto","decreaseTotalCount","count","updateMetaOnColumnDeltaChange","increaseTotalCount","countDelta","current","totalCount","cursorDecoded","cursor","newCursorDecoded","String","Number"],"sources":["MetaRepository.ts"],"sourcesContent":["import { makeAutoObservable } from \"mobx\";\nimport { decodeCursor, encodeCursor } from \"@webiny/utils\";\nimport type { IMetaRepository } from \"./IMetaRepository\";\nimport type { MetaDTO } from \"~/fta/Domain/Models/Meta\";\nimport { Meta, MetaMapper } from \"~/fta/Domain/Models/Meta\";\n\nexport class MetaRepository implements IMetaRepository {\n private meta: Meta;\n\n constructor() {\n this.meta = Meta.createEmpty();\n makeAutoObservable(this);\n }\n\n async set(meta: MetaDTO) {\n this.meta = Meta.create(meta);\n }\n\n get() {\n return MetaMapper.toDto(this.meta);\n }\n\n async decreaseTotalCount(count = 1) {\n return await this.updateMetaOnColumnDeltaChange(-count);\n }\n\n async increaseTotalCount(count = 1) {\n return await this.updateMetaOnColumnDeltaChange(count);\n }\n\n private async updateMetaOnColumnDeltaChange(countDelta: number) {\n // Retrieve the current meta\n const current = this.get();\n\n // Calculate the new totalCount based on the delta change\n const totalCount = current.totalCount + countDelta;\n\n // Calculate the new cursor position based on the delta change\n const cursorDecoded = decodeCursor(current.cursor);\n const newCursorDecoded = String(Number(cursorDecoded) + countDelta);\n const cursor = encodeCursor(newCursorDecoded);\n\n // Update the meta with the new totalCount and cursor\n return await this.set({ ...current, totalCount, cursor });\n }\n}\n"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,MAAM;AACzC,SAASC,YAAY,EAAEC,YAAY,QAAQ,eAAe;AAG1D,SAASC,IAAI,EAAEC,UAAU;AAEzB,OAAO,MAAMC,cAAc,CAA4B;EAGnDC,WAAWA,CAAA,EAAG;IACV,IAAI,CAACC,IAAI,GAAGJ,IAAI,CAACK,WAAW,CAAC,CAAC;IAC9BR,kBAAkB,CAAC,IAAI,CAAC;EAC5B;EAEA,MAAMS,GAAGA,CAACF,IAAa,EAAE;IACrB,IAAI,CAACA,IAAI,GAAGJ,IAAI,CAACO,MAAM,CAACH,IAAI,CAAC;EACjC;EAEAI,GAAGA,CAAA,EAAG;IACF,OAAOP,UAAU,CAACQ,KAAK,CAAC,IAAI,CAACL,IAAI,CAAC;EACtC;EAEA,MAAMM,kBAAkBA,CAACC,KAAK,GAAG,CAAC,EAAE;IAChC,OAAO,MAAM,IAAI,CAACC,6BAA6B,CAAC,CAACD,KAAK,CAAC;EAC3D;EAEA,MAAME,kBAAkBA,CAACF,KAAK,GAAG,CAAC,EAAE;IAChC,OAAO,MAAM,IAAI,CAACC,6BAA6B,CAACD,KAAK,CAAC;EAC1D;EAEA,MAAcC,6BAA6BA,CAACE,UAAkB,EAAE;IAC5D;IACA,MAAMC,OAAO,GAAG,IAAI,CAACP,GAAG,CAAC,CAAC;;IAE1B;IACA,MAAMQ,UAAU,GAAGD,OAAO,CAACC,UAAU,GAAGF,UAAU;;IAElD;IACA,MAAMG,aAAa,GAAGnB,YAAY,CAACiB,OAAO,CAACG,MAAM,CAAC;IAClD,MAAMC,gBAAgB,GAAGC,MAAM,CAACC,MAAM,CAACJ,aAAa,CAAC,GAAGH,UAAU,CAAC;IACnE,MAAMI,MAAM,GAAGnB,YAAY,CAACoB,gBAAgB,CAAC;;IAE7C;IACA,OAAO,MAAM,IAAI,CAACb,GAAG,CAAC;MAAE,GAAGS,OAAO;MAAEC,UAAU;MAAEE;IAAO,CAAC,CAAC;EAC7D;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["makeAutoObservable","runInAction","decodeCursor","encodeCursor","Meta","MetaMapper","MetaRepository","constructor","meta","createEmpty","set","create","get","toDto","decreaseTotalCount","count","updateMetaOnColumnDeltaChange","increaseTotalCount","countDelta","current","totalCount","cursorDecoded","cursor","newCursorDecoded","String","Number"],"sources":["MetaRepository.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from \"mobx\";\nimport { decodeCursor, encodeCursor } from \"@webiny/utils\";\nimport type { IMetaRepository } from \"./IMetaRepository\";\nimport type { MetaDTO } from \"~/fta/Domain/Models/Meta\";\nimport { Meta, MetaMapper } from \"~/fta/Domain/Models/Meta\";\n\nexport class MetaRepository implements IMetaRepository {\n private meta: Meta;\n\n constructor() {\n this.meta = Meta.createEmpty();\n makeAutoObservable(this);\n }\n\n async set(meta: MetaDTO) {\n runInAction(() => {\n this.meta = Meta.create(meta);\n });\n }\n\n get() {\n return MetaMapper.toDto(this.meta);\n }\n\n async decreaseTotalCount(count = 1) {\n return await this.updateMetaOnColumnDeltaChange(-count);\n }\n\n async increaseTotalCount(count = 1) {\n return await this.updateMetaOnColumnDeltaChange(count);\n }\n\n private async updateMetaOnColumnDeltaChange(countDelta: number) {\n // Retrieve the current meta\n const current = this.get();\n\n // Calculate the new totalCount based on the delta change\n const totalCount = current.totalCount + countDelta;\n\n // Calculate the new cursor position based on the delta change\n const cursorDecoded = decodeCursor(current.cursor);\n const newCursorDecoded = String(Number(cursorDecoded) + countDelta);\n const cursor = encodeCursor(newCursorDecoded);\n\n // Update the meta with the new totalCount and cursor\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CAACb,GAAG,CAAC;MAAE,GAAGS,OAAO;MAAEC,UAAU;MAAEE;IAAO,CAAC,CAAC;EAC7D;AACJ","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/app-utils",
3
- "version": "0.0.0-unstable.e53eceafb5",
3
+ "version": "0.0.0-unstable.eb196ccd2f",
4
4
  "main": "index.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -10,11 +10,11 @@
10
10
  "author": "Webiny Ltd.",
11
11
  "license": "MIT",
12
12
  "dependencies": {
13
- "@webiny/utils": "0.0.0-unstable.e53eceafb5",
13
+ "@webiny/utils": "0.0.0-unstable.eb196ccd2f",
14
14
  "mobx": "6.9.0"
15
15
  },
16
16
  "devDependencies": {
17
- "@webiny/project-utils": "0.0.0-unstable.e53eceafb5",
17
+ "@webiny/project-utils": "0.0.0-unstable.eb196ccd2f",
18
18
  "typescript": "5.3.3"
19
19
  },
20
20
  "publishConfig": {
@@ -25,5 +25,5 @@
25
25
  "build": "node ../cli/bin.js run build",
26
26
  "watch": "node ../cli/bin.js run watch"
27
27
  },
28
- "gitHead": "e53eceafb5ce1a3872c9b4548939bb2eae5b1aef"
28
+ "gitHead": "eb196ccd2f32296e10f7add6dd7220d4e3abece4"
29
29
  }