@data7expressions/json-light 5.0.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.
Files changed (85) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/LICENSE +21 -0
  3. package/README.md +262 -0
  4. package/__tests__/country.test.d.ts +2 -0
  5. package/__tests__/country.test.d.ts.map +1 -0
  6. package/__tests__/country.test.js +62 -0
  7. package/__tests__/country.test.js.map +1 -0
  8. package/__tests__/order.test.d.ts +2 -0
  9. package/__tests__/order.test.d.ts.map +1 -0
  10. package/__tests__/order.test.js +84 -0
  11. package/__tests__/order.test.js.map +1 -0
  12. package/application/facade.d.ts +13 -0
  13. package/application/facade.d.ts.map +1 -0
  14. package/application/facade.js +26 -0
  15. package/application/facade.js.map +1 -0
  16. package/application/index.d.ts +6 -0
  17. package/application/index.d.ts.map +1 -0
  18. package/application/index.js +22 -0
  19. package/application/index.js.map +1 -0
  20. package/application/services/jsonLightService.d.ts +5 -0
  21. package/application/services/jsonLightService.d.ts.map +1 -0
  22. package/application/services/jsonLightService.js +31 -0
  23. package/application/services/jsonLightService.js.map +1 -0
  24. package/application/useCases/compress.d.ts +9 -0
  25. package/application/useCases/compress.d.ts.map +1 -0
  26. package/application/useCases/compress.js +106 -0
  27. package/application/useCases/compress.js.map +1 -0
  28. package/application/useCases/decompress.d.ts +9 -0
  29. package/application/useCases/decompress.d.ts.map +1 -0
  30. package/application/useCases/decompress.js +102 -0
  31. package/application/useCases/decompress.js.map +1 -0
  32. package/application/useCases/getType.d.ts +5 -0
  33. package/application/useCases/getType.d.ts.map +1 -0
  34. package/application/useCases/getType.js +12 -0
  35. package/application/useCases/getType.js.map +1 -0
  36. package/domain/index.d.ts +2 -0
  37. package/domain/index.d.ts.map +1 -0
  38. package/domain/index.js +18 -0
  39. package/domain/index.js.map +1 -0
  40. package/domain/services.d.ts +22 -0
  41. package/domain/services.d.ts.map +1 -0
  42. package/domain/services.js +3 -0
  43. package/domain/services.js.map +1 -0
  44. package/index.d.ts +2 -0
  45. package/index.d.ts.map +1 -0
  46. package/index.js +18 -0
  47. package/index.js.map +1 -0
  48. package/infrastructure/builder.d.ts +5 -0
  49. package/infrastructure/builder.d.ts.map +1 -0
  50. package/infrastructure/builder.js +12 -0
  51. package/infrastructure/builder.js.map +1 -0
  52. package/infrastructure/cli/json-light.d.ts +5 -0
  53. package/infrastructure/cli/json-light.d.ts.map +1 -0
  54. package/infrastructure/cli/json-light.js +27 -0
  55. package/infrastructure/cli/json-light.js.map +1 -0
  56. package/infrastructure/commands/compress.d.ts +2 -0
  57. package/infrastructure/commands/compress.d.ts.map +1 -0
  58. package/infrastructure/commands/compress.js +40 -0
  59. package/infrastructure/commands/compress.js.map +1 -0
  60. package/infrastructure/commands/decompress.d.ts +2 -0
  61. package/infrastructure/commands/decompress.d.ts.map +1 -0
  62. package/infrastructure/commands/decompress.js +39 -0
  63. package/infrastructure/commands/decompress.js.map +1 -0
  64. package/infrastructure/commands/help.d.ts +2 -0
  65. package/infrastructure/commands/help.d.ts.map +1 -0
  66. package/infrastructure/commands/help.js +38 -0
  67. package/infrastructure/commands/help.js.map +1 -0
  68. package/infrastructure/commands/schema.d.ts +2 -0
  69. package/infrastructure/commands/schema.d.ts.map +1 -0
  70. package/infrastructure/commands/schema.js +37 -0
  71. package/infrastructure/commands/schema.js.map +1 -0
  72. package/infrastructure/commands/version.d.ts +2 -0
  73. package/infrastructure/commands/version.d.ts.map +1 -0
  74. package/infrastructure/commands/version.js +6 -0
  75. package/infrastructure/commands/version.js.map +1 -0
  76. package/infrastructure/helper.d.ts +5 -0
  77. package/infrastructure/helper.d.ts.map +1 -0
  78. package/infrastructure/helper.js +9 -0
  79. package/infrastructure/helper.js.map +1 -0
  80. package/infrastructure/index.d.ts +2 -0
  81. package/infrastructure/index.d.ts.map +1 -0
  82. package/infrastructure/index.js +6 -0
  83. package/infrastructure/index.js.map +1 -0
  84. package/jest-unit-config.json +15 -0
  85. package/package.json +36 -0
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const index_1 = require("../index");
13
+ const helper_1 = require("../helper");
14
+ module.exports = (args) => __awaiter(void 0, void 0, void 0, function* () {
15
+ const input = args.input || args.i;
16
+ const output = args.output || args.o;
17
+ if (!input) {
18
+ console.error('input is required!');
19
+ return;
20
+ }
21
+ let data = index_1.JsonLight.json(input);
22
+ if (data === null) {
23
+ const str = yield helper_1.jsonLightHelp.fs.read(input);
24
+ if (str === null) {
25
+ throw new Error(`File ${input} not found`);
26
+ }
27
+ data = JSON.parse(str);
28
+ }
29
+ const type = index_1.JsonLight.type(data);
30
+ if (output) {
31
+ yield helper_1.jsonLightHelp.fs.write(output, type);
32
+ }
33
+ else {
34
+ console.log(type);
35
+ }
36
+ });
37
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/lib/infrastructure/commands/schema.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,oCAAoC;AACpC,sCAAyC;AACzC,MAAM,CAAC,OAAO,GAAG,CAAO,IAAQ,EAAE,EAAE;IACnC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAA;IAClC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAA;IACpC,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAA;QACnC,OAAM;IACP,CAAC;IAED,IAAI,IAAI,GAAG,iBAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAChC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QACnB,MAAM,GAAG,GAAG,MAAM,sBAAa,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC9C,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAA;QAC3C,CAAC;QACD,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACvB,CAAC;IAED,MAAM,IAAI,GAAG,iBAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACjC,IAAI,MAAM,EAAE,CAAC;QACZ,MAAM,sBAAa,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAC3C,CAAC;SAAM,CAAC;QACP,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IAClB,CAAC;AACF,CAAC,CAAA,CAAA"}
@@ -0,0 +1,2 @@
1
+ declare const version: any;
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../../src/lib/infrastructure/commands/version.ts"],"names":[],"mappings":"AAAA,QAAA,MAAQ,OAAO,KAAkC,CAAA"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ const { version } = require('../../package.json');
3
+ module.exports = () => {
4
+ console.log(`v${version}`);
5
+ };
6
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../../src/lib/infrastructure/commands/version.ts"],"names":[],"mappings":";AAAA,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAA;AACjD,MAAM,CAAC,OAAO,GAAG,GAAG,EAAE;IACrB,OAAO,CAAC,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC,CAAA;AAC3B,CAAC,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { TypeH3lp } from '@data7expressions/typ3s';
2
+ export declare class JsonLightHelp extends TypeH3lp {
3
+ }
4
+ export declare const jsonLightHelp: JsonLightHelp;
5
+ //# sourceMappingURL=helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../../src/lib/infrastructure/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAY,MAAM,yBAAyB,CAAA;AAC5D,qBAAa,aAAc,SAAQ,QAAQ;CAAI;AAC/C,eAAO,MAAM,aAAa,eAA8B,CAAA"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.jsonLightHelp = exports.JsonLightHelp = void 0;
4
+ const typ3s_1 = require("@data7expressions/typ3s");
5
+ class JsonLightHelp extends typ3s_1.TypeH3lp {
6
+ }
7
+ exports.JsonLightHelp = JsonLightHelp;
8
+ exports.jsonLightHelp = new JsonLightHelp(typ3s_1.typeH3lp);
9
+ //# sourceMappingURL=helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/lib/infrastructure/helper.ts"],"names":[],"mappings":";;;AAAA,mDAA4D;AAC5D,MAAa,aAAc,SAAQ,gBAAQ;CAAI;AAA/C,sCAA+C;AAClC,QAAA,aAAa,GAAG,IAAI,aAAa,CAAC,gBAAQ,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const JsonLight: import("../domain").JsonLight;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/infrastructure/index.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,SAAS,+BAAiC,CAAA"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonLight = void 0;
4
+ const builder_1 = require("./builder");
5
+ exports.JsonLight = new builder_1.JsonLightBuilder().build();
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/infrastructure/index.ts"],"names":[],"mappings":";;;AAAA,uCAA4C;AAC/B,QAAA,SAAS,GAAG,IAAI,0BAAgB,EAAE,CAAC,KAAK,EAAE,CAAA"}
@@ -0,0 +1,15 @@
1
+ {
2
+ "transform": {
3
+ "^.+\\.(t|j)sx?$": "ts-jest"
4
+ },
5
+ "testMatch": [
6
+ "**/__tests__/*.test.ts",
7
+ "**/__tests__/auto/*.test.ts"
8
+ ],
9
+ "moduleFileExtensions": [
10
+ "ts",
11
+ "js",
12
+ "json",
13
+ "node"
14
+ ]
15
+ }
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@data7expressions/json-light",
3
+ "version": "5.0.0",
4
+ "description": "Allow to extend yaml or json files configuration",
5
+ "scripts": {
6
+ "test": "npx jest --config jest-unit-config.json"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/data7expressions/json-light.git"
11
+ },
12
+ "keywords": [
13
+ "json",
14
+ "light",
15
+ "serialized",
16
+ "schema",
17
+ "deserializer",
18
+ "parse",
19
+ "stringify"
20
+ ],
21
+ "author": "Flavio Lionel Rita <flaviolrita@hotmail.com>",
22
+ "license": "MIT",
23
+ "bugs": {
24
+ "url": "https://github.com/data7expressions/json-light/issues"
25
+ },
26
+ "homepage": "https://github.com/data7expressions/json-light#readme",
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "main": "index.js",
31
+ "types": "index.d.ts",
32
+ "dependencies": {
33
+ "minimist": "^1.2.6",
34
+ "@data7expressions/typ3s": "^5.0.0"
35
+ }
36
+ }