@fossa-app/bridge 0.1.23 → 0.1.24

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.
@@ -0,0 +1,11 @@
1
+ import { IJsonSerializer } from "./IJsonSerializer.ts";
2
+ import { TypeInfo } from "@fable-org/fable-library-ts/Reflection.ts";
3
+ export declare class JsonSerializer implements IJsonSerializer {
4
+ readonly enquoteRegex: RegExp;
5
+ readonly dequoteRegex: RegExp;
6
+ constructor();
7
+ Serialize<T>(value: T): string;
8
+ Deserialize<T>(json: string): T;
9
+ }
10
+ export declare function JsonSerializer_$reflection(): TypeInfo;
11
+ export declare function JsonSerializer_$ctor(): JsonSerializer;
@@ -0,0 +1,33 @@
1
+ import { replace } from "@fable-org/fable-library-ts/RegExp.ts";
2
+ import { isNullOrWhiteSpace } from "@fable-org/fable-library-ts/String.ts";
3
+ import { defaultOf } from "@fable-org/fable-library-ts/Util.ts";
4
+ import { class_type } from "@fable-org/fable-library-ts/Reflection.ts";
5
+ export class JsonSerializer {
6
+ enquoteRegex;
7
+ dequoteRegex;
8
+ constructor() {
9
+ this.enquoteRegex = (/(?<=[:\[,]\s*)(-?\d{15,})(?=\s*[,\]}])/gu);
10
+ this.dequoteRegex = (/(?<=[:\[,]\s*)"(-?\d{15,})"(?=\s*[,\]}])/gu);
11
+ }
12
+ Serialize(value) {
13
+ const _ = this;
14
+ return replace(_.dequoteRegex, JSON.stringify(value), "$1");
15
+ }
16
+ Deserialize(json) {
17
+ const _ = this;
18
+ if (isNullOrWhiteSpace(json)) {
19
+ return defaultOf();
20
+ }
21
+ else {
22
+ const enquotedJson = replace(_.enquoteRegex, json, "\"$1\"");
23
+ return JSON.parse(enquotedJson);
24
+ }
25
+ }
26
+ }
27
+ export function JsonSerializer_$reflection() {
28
+ return class_type("Fossa.Bridge.Services.JsonSerializer", undefined, JsonSerializer);
29
+ }
30
+ export function JsonSerializer_$ctor() {
31
+ return new JsonSerializer();
32
+ }
33
+ //# sourceMappingURL=JsonSerializer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JsonSerializer.js","sourceRoot":"","sources":["../../fable_output/Services/JsonSerializer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAEhE,OAAO,EAAE,UAAU,EAAY,MAAM,2CAA2C,CAAC;AAEjF,MAAM,OAAO,cAAc;IACd,YAAY,CAAS;IACrB,YAAY,CAAS;IAC9B;QACI,IAAI,CAAC,YAAY,GAAG,CAAC,0CAA0C,CAAC,CAAC;QACjE,IAAI,CAAC,YAAY,GAAG,CAAC,4CAA4C,CAAC,CAAC;IACvE,CAAC;IACD,SAAS,CAAI,KAAQ;QACjB,MAAM,CAAC,GAAmB,IAAI,CAAC;QAC/B,OAAO,OAAO,CAAC,CAAC,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;IAChE,CAAC;IACD,WAAW,CAAI,IAAY;QACvB,MAAM,CAAC,GAAmB,IAAI,CAAC;QAC/B,IAAI,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3B,OAAO,SAAS,EAAE,CAAC;QACvB,CAAC;aACI,CAAC;YACF,MAAM,YAAY,GAAW,OAAO,CAAC,CAAC,CAAC,YAAY,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;YACrE,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QACpC,CAAC;IACL,CAAC;CACJ;AAED,MAAM,UAAU,0BAA0B;IACtC,OAAO,UAAU,CAAC,sCAAsC,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;AACzF,CAAC;AAED,MAAM,UAAU,oBAAoB;IAChC,OAAO,IAAI,cAAc,EAAE,CAAC;AAChC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fossa-app/bridge",
3
- "version": "0.1.23",
3
+ "version": "0.1.24",
4
4
  "description": "Shared Domain Models and DTOs for Fossa UI and API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -21,9 +21,9 @@
21
21
  "author": "",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@fable-org/fable-library-ts": "^2.0.0-rc.4"
24
+ "@fable-org/fable-library-ts": "^2.0.0-rc.5"
25
25
  },
26
26
  "devDependencies": {
27
- "typescript": "^5.9.3"
27
+ "typescript": "^6.0.2"
28
28
  }
29
29
  }