@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.
- package/CHANGELOG.md +71 -0
- package/LICENSE +21 -0
- package/README.md +262 -0
- package/__tests__/country.test.d.ts +2 -0
- package/__tests__/country.test.d.ts.map +1 -0
- package/__tests__/country.test.js +62 -0
- package/__tests__/country.test.js.map +1 -0
- package/__tests__/order.test.d.ts +2 -0
- package/__tests__/order.test.d.ts.map +1 -0
- package/__tests__/order.test.js +84 -0
- package/__tests__/order.test.js.map +1 -0
- package/application/facade.d.ts +13 -0
- package/application/facade.d.ts.map +1 -0
- package/application/facade.js +26 -0
- package/application/facade.js.map +1 -0
- package/application/index.d.ts +6 -0
- package/application/index.d.ts.map +1 -0
- package/application/index.js +22 -0
- package/application/index.js.map +1 -0
- package/application/services/jsonLightService.d.ts +5 -0
- package/application/services/jsonLightService.d.ts.map +1 -0
- package/application/services/jsonLightService.js +31 -0
- package/application/services/jsonLightService.js.map +1 -0
- package/application/useCases/compress.d.ts +9 -0
- package/application/useCases/compress.d.ts.map +1 -0
- package/application/useCases/compress.js +106 -0
- package/application/useCases/compress.js.map +1 -0
- package/application/useCases/decompress.d.ts +9 -0
- package/application/useCases/decompress.d.ts.map +1 -0
- package/application/useCases/decompress.js +102 -0
- package/application/useCases/decompress.js.map +1 -0
- package/application/useCases/getType.d.ts +5 -0
- package/application/useCases/getType.d.ts.map +1 -0
- package/application/useCases/getType.js +12 -0
- package/application/useCases/getType.js.map +1 -0
- package/domain/index.d.ts +2 -0
- package/domain/index.d.ts.map +1 -0
- package/domain/index.js +18 -0
- package/domain/index.js.map +1 -0
- package/domain/services.d.ts +22 -0
- package/domain/services.d.ts.map +1 -0
- package/domain/services.js +3 -0
- package/domain/services.js.map +1 -0
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -0
- package/index.js +18 -0
- package/index.js.map +1 -0
- package/infrastructure/builder.d.ts +5 -0
- package/infrastructure/builder.d.ts.map +1 -0
- package/infrastructure/builder.js +12 -0
- package/infrastructure/builder.js.map +1 -0
- package/infrastructure/cli/json-light.d.ts +5 -0
- package/infrastructure/cli/json-light.d.ts.map +1 -0
- package/infrastructure/cli/json-light.js +27 -0
- package/infrastructure/cli/json-light.js.map +1 -0
- package/infrastructure/commands/compress.d.ts +2 -0
- package/infrastructure/commands/compress.d.ts.map +1 -0
- package/infrastructure/commands/compress.js +40 -0
- package/infrastructure/commands/compress.js.map +1 -0
- package/infrastructure/commands/decompress.d.ts +2 -0
- package/infrastructure/commands/decompress.d.ts.map +1 -0
- package/infrastructure/commands/decompress.js +39 -0
- package/infrastructure/commands/decompress.js.map +1 -0
- package/infrastructure/commands/help.d.ts +2 -0
- package/infrastructure/commands/help.d.ts.map +1 -0
- package/infrastructure/commands/help.js +38 -0
- package/infrastructure/commands/help.js.map +1 -0
- package/infrastructure/commands/schema.d.ts +2 -0
- package/infrastructure/commands/schema.d.ts.map +1 -0
- package/infrastructure/commands/schema.js +37 -0
- package/infrastructure/commands/schema.js.map +1 -0
- package/infrastructure/commands/version.d.ts +2 -0
- package/infrastructure/commands/version.d.ts.map +1 -0
- package/infrastructure/commands/version.js +6 -0
- package/infrastructure/commands/version.js.map +1 -0
- package/infrastructure/helper.d.ts +5 -0
- package/infrastructure/helper.d.ts.map +1 -0
- package/infrastructure/helper.js +9 -0
- package/infrastructure/helper.js.map +1 -0
- package/infrastructure/index.d.ts +2 -0
- package/infrastructure/index.d.ts.map +1 -0
- package/infrastructure/index.js +6 -0
- package/infrastructure/index.js.map +1 -0
- package/jest-unit-config.json +15 -0
- package/package.json +36 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 5.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 1b07b2e: Publish under the `@data7expressions/` npm scope instead of unscoped
|
|
8
|
+
package names. Update your dependency and imports accordingly, e.g.
|
|
9
|
+
`h3lp` -> `@data7expressions/h3lp`. The old unscoped packages remain
|
|
10
|
+
on npm but no longer receive updates.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [1b07b2e]
|
|
15
|
+
- @data7expressions/typ3s@5.0.0
|
|
16
|
+
|
|
17
|
+
## 4.1.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- 979d24a: desploy test
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies [979d24a]
|
|
26
|
+
- typ3s@4.1.0
|
|
27
|
+
|
|
28
|
+
## 4.0.0
|
|
29
|
+
|
|
30
|
+
### Major Changes
|
|
31
|
+
|
|
32
|
+
- 13d22dd: test
|
|
33
|
+
|
|
34
|
+
### Minor Changes
|
|
35
|
+
|
|
36
|
+
- 13d22dd: test
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- Updated dependencies [13d22dd]
|
|
41
|
+
- Updated dependencies [13d22dd]
|
|
42
|
+
- typ3s@4.0.0
|
|
43
|
+
|
|
44
|
+
## 3.1.0
|
|
45
|
+
|
|
46
|
+
### Minor Changes
|
|
47
|
+
|
|
48
|
+
- 2a522e5: changeset test
|
|
49
|
+
|
|
50
|
+
### Patch Changes
|
|
51
|
+
|
|
52
|
+
- Updated dependencies [2a522e5]
|
|
53
|
+
- typ3s@3.1.0
|
|
54
|
+
|
|
55
|
+
## 1.0.20
|
|
56
|
+
|
|
57
|
+
### Patch Changes
|
|
58
|
+
|
|
59
|
+
- bc54542: ci test
|
|
60
|
+
- Updated dependencies [bc54542]
|
|
61
|
+
- typ3s@1.1.5
|
|
62
|
+
|
|
63
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
64
|
+
|
|
65
|
+
### [1.0.19](https://github.com/data7expressions/json-light/compare/v2.0.21...v1.0.19) (2026-07-01)
|
|
66
|
+
|
|
67
|
+
### [1.0.18](https://github.com/data7expressions/json-light/compare/v2.0.19...v1.0.18) (2026-06-16)
|
|
68
|
+
|
|
69
|
+
### [1.0.16](https://github.com/data7expressions/json-light/compare/v2.0.17...v1.0.16) (2026-06-16)
|
|
70
|
+
|
|
71
|
+
### [1.0.15](https://github.com/data7expressions/json-light/compare/v2.0.15...v1.0.15) (2026-06-16)
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Flavio Lionel Rita
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
# Json Light
|
|
2
|
+
|
|
3
|
+
>Json Light is a json compressor, generating a new simplified json file from a type definition.
|
|
4
|
+
>
|
|
5
|
+
>The type can be written by us or generated by the library itself.
|
|
6
|
+
>
|
|
7
|
+
>Json Light extracts the property tags from a json object and stores the values in an array.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- Compress json generating a new valid json
|
|
13
|
+
- Allows to get type from json data
|
|
14
|
+
- In the event that you do not want to pass the type to the compress function, it will be generated from the data and stored within the resulting json, allowing it to be later decompressed without the need to pass the type
|
|
15
|
+
- CLI
|
|
16
|
+
|
|
17
|
+
## Methods
|
|
18
|
+
|
|
19
|
+
### .type(data:any)
|
|
20
|
+
|
|
21
|
+
get type from json data
|
|
22
|
+
|
|
23
|
+
- Params:
|
|
24
|
+
- data : json data
|
|
25
|
+
|
|
26
|
+
### .compress(data:any, type?:string)
|
|
27
|
+
|
|
28
|
+
get a compressed json
|
|
29
|
+
|
|
30
|
+
- Params:
|
|
31
|
+
- data : json data
|
|
32
|
+
- type : type (optional)
|
|
33
|
+
- mapping : replace names of properties for key and save mapping (optional)
|
|
34
|
+
|
|
35
|
+
### .decompress(data:any, type?:string)
|
|
36
|
+
|
|
37
|
+
decompress a previously compressed json getting the original json
|
|
38
|
+
|
|
39
|
+
- Params:
|
|
40
|
+
- data : json data
|
|
41
|
+
- type : type (optional)
|
|
42
|
+
|
|
43
|
+
## Quick start
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import { JsonLight } from 'json-light'
|
|
47
|
+
|
|
48
|
+
const data = {
|
|
49
|
+
name: 'Spain',
|
|
50
|
+
region: 'Europe',
|
|
51
|
+
phoneCode: '34',
|
|
52
|
+
timezones: [
|
|
53
|
+
{ name: 'Madrid', offset: 1, pos: { lat: 40.4165, log: -3.70256 } },
|
|
54
|
+
{ name: 'Ceuta', offset: 1, pos: { lat: 35.8883, log: -5.3162 } },
|
|
55
|
+
{ name: 'Canary', offset: 0, pos: { lat: 28.1248, log: -15.43 } }
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Get Type:
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
const type = JsonLight.type(data)
|
|
64
|
+
console.log(type)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Output:
|
|
68
|
+
|
|
69
|
+
```txt
|
|
70
|
+
{ name:string,
|
|
71
|
+
region:string,
|
|
72
|
+
phoneCode:string,
|
|
73
|
+
timezones:[
|
|
74
|
+
{name:string,
|
|
75
|
+
offset:integer,
|
|
76
|
+
pos:{lat:decimal,log:decimal}
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Compress:
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
const compressed = JsonLight.compress(data, { type , mapping: true })
|
|
86
|
+
console.log(JSON.stringify(compressed, null, 2))
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Output:
|
|
90
|
+
|
|
91
|
+
```javascript
|
|
92
|
+
{
|
|
93
|
+
"0": [
|
|
94
|
+
{
|
|
95
|
+
"1": [
|
|
96
|
+
40.4165,
|
|
97
|
+
-3.70256
|
|
98
|
+
],
|
|
99
|
+
"_": [
|
|
100
|
+
"Madrid",
|
|
101
|
+
1
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"1": [
|
|
106
|
+
35.8883,
|
|
107
|
+
-5.3162
|
|
108
|
+
],
|
|
109
|
+
"_": [
|
|
110
|
+
"Ceuta",
|
|
111
|
+
1
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"1": [
|
|
116
|
+
28.1248,
|
|
117
|
+
-15.43
|
|
118
|
+
],
|
|
119
|
+
"_": [
|
|
120
|
+
"Canary",
|
|
121
|
+
0
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
"_": [
|
|
126
|
+
"Spain",
|
|
127
|
+
"Europe",
|
|
128
|
+
"34"
|
|
129
|
+
],
|
|
130
|
+
"__map": {
|
|
131
|
+
"0": "timezones",
|
|
132
|
+
"1": "pos"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Decompress:
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
const decompressed = JsonLight.decompress(compressed, { type })
|
|
141
|
+
console.log(JSON.stringify(decompressed, null, 2))
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Output:
|
|
145
|
+
|
|
146
|
+
```javascript
|
|
147
|
+
{
|
|
148
|
+
"name": "Spain",
|
|
149
|
+
"region": "Europe",
|
|
150
|
+
"phoneCode": "34",
|
|
151
|
+
"timezones": [
|
|
152
|
+
{
|
|
153
|
+
"name": "Madrid",
|
|
154
|
+
"offset": 1,
|
|
155
|
+
"pos": {
|
|
156
|
+
"lat": 40.4165,
|
|
157
|
+
"log": -3.70256
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"name": "Ceuta",
|
|
162
|
+
"offset": 1,
|
|
163
|
+
"pos": {
|
|
164
|
+
"lat": 35.8883,
|
|
165
|
+
"log": -5.3162
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"name": "Canary",
|
|
170
|
+
"offset": 0,
|
|
171
|
+
"pos": {
|
|
172
|
+
"lat": 28.1248,
|
|
173
|
+
"log": -15.43
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
]
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## CLI
|
|
181
|
+
|
|
182
|
+
Install
|
|
183
|
+
|
|
184
|
+
```sh
|
|
185
|
+
npm install -g @data7expressions/json-light
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Version:
|
|
189
|
+
|
|
190
|
+
```sh
|
|
191
|
+
json-light version
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Type:
|
|
195
|
+
|
|
196
|
+
```sh
|
|
197
|
+
json-light type -i source.json
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Compress:
|
|
201
|
+
|
|
202
|
+
```sh
|
|
203
|
+
json-light compress -i source.json -o compressed.json -s '{name:string,region:string,phoneCode:string,timezones:[{name:string,offset:integer,pos:{lat:decimal,log:decimal}}]}'
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Decompress:
|
|
207
|
+
|
|
208
|
+
```sh
|
|
209
|
+
json-light decompress -i compressed.json -o original.json -s '{name:string,region:string,phoneCode:string,timezones:[{name:string,offset:integer,pos:{lat:decimal,log:decimal}}]}'
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## CLI examples
|
|
213
|
+
|
|
214
|
+
these examples are based on the files found in the git repository
|
|
215
|
+
|
|
216
|
+
### Type
|
|
217
|
+
|
|
218
|
+
```sh
|
|
219
|
+
json-light type -i ./src/dev/sources/countries.json
|
|
220
|
+
json-light type -i ./src/dev/sources/northwind.json
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Output:
|
|
224
|
+
|
|
225
|
+
```javascript
|
|
226
|
+
[{name:string,iso3:string,iso2:string,numeric_code:string,phone_code:string,capital:string,currency:string,currency_symbol:string,tld:string,native:string,region:string,subregion:string,timezones:[{zoneName:string,gmtOffset:integer,gmtOffsetName:string,abbreviation:string,tzName:string}],translations:{kr:string,br:string,pt:string,nl:string,hr:string,fa:string,de:string,es:string,fr:string,ja:string,it:string,cn:string},latitude:string,longitude:string,emoji:string,emojiU:string,states:[{id:integer,name:string,state_code:string,latitude:string,longitude:string,type:string}]}]
|
|
227
|
+
|
|
228
|
+
{entities:[{entity:string,rows:[{id:any,name:string,description:string,contact:string,phone:string,address:string,city:string,region:string,postalCode:string,country:string,lastName:string,firstName:string,title:string,titleOfCourtesy:string,birthDate:string,hireDate:string,reportsToId:integer,homepage:string,supplierId:integer,categoryId:integer,quantity:string,price:decimal,inStock:integer,onOrder:integer,reorderLevel:integer,discontinued:boolean,customerId:string,employeeId:integer,orderDate:string,requiredDate:string,shippedDate:string,shipViaId:integer,freight:decimal,details:[{orderId:integer,productId:integer,unitPrice:decimal,quantity:integer,discount:integer}]}]}]}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Compress
|
|
232
|
+
|
|
233
|
+
```sh
|
|
234
|
+
json-light compress -i ./src/dev/sources/countries.json -o ./src/dev/results/countries.json -m
|
|
235
|
+
json-light compress -i ./src/dev/sources/northwind.json -o ./src/dev/results/northwind.json -m
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Decompress
|
|
239
|
+
|
|
240
|
+
```sh
|
|
241
|
+
json-light decompress -i ./src/dev/results/countries.json -o ./src/dev/results/countries_original.json
|
|
242
|
+
json-light decompress -i ./src/dev/results/northwind.json -o ./src/dev/results/northwind_original.json
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Results
|
|
248
|
+
|
|
249
|
+
```sh
|
|
250
|
+
[4.0K] .
|
|
251
|
+
├── [4.0K] results
|
|
252
|
+
│ ├── [427K] countries.json
|
|
253
|
+
│ ├── [712K] countries_original.json
|
|
254
|
+
│ ├── [ 43M] customers.json
|
|
255
|
+
│ ├── [ 79M] customers_original.json
|
|
256
|
+
│ ├── [328K] northwind.json
|
|
257
|
+
│ └── [464K] northwind_original.json
|
|
258
|
+
└── [4.0K] sources
|
|
259
|
+
├── [949K] countries.json
|
|
260
|
+
├── [154M] customers.json
|
|
261
|
+
└── [893K] northwind.json
|
|
262
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"country.test.d.ts","sourceRoot":"","sources":["../../../src/lib/__tests__/country.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
/* eslint-disable no-template-curly-in-string */
|
|
13
|
+
const __1 = require("..");
|
|
14
|
+
let data;
|
|
15
|
+
beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
data = {
|
|
17
|
+
name: 'Spain',
|
|
18
|
+
region: 'Europe',
|
|
19
|
+
phoneCode: '34',
|
|
20
|
+
timezones: [
|
|
21
|
+
{ name: 'Madrid', offset: 1, pos: { lat: 40.4165, log: -3.70256 } },
|
|
22
|
+
{ name: 'Ceuta', offset: 1, pos: { lat: 35.8883, log: -5.3162 } },
|
|
23
|
+
{ name: 'Canary', offset: 0, pos: { lat: 28.1248, log: -15.43 } }
|
|
24
|
+
]
|
|
25
|
+
};
|
|
26
|
+
}));
|
|
27
|
+
describe('simple', () => {
|
|
28
|
+
test('resolve', () => {
|
|
29
|
+
const result = __1.JsonLight.type(data);
|
|
30
|
+
const expected = '{name:string,region:string,phoneCode:string,timezones:[{name:string,offset:integer,pos:{lat:decimal,log:decimal}}]}';
|
|
31
|
+
expect(expected).toStrictEqual(result);
|
|
32
|
+
});
|
|
33
|
+
test('compressed', () => {
|
|
34
|
+
const type = __1.JsonLight.type(data);
|
|
35
|
+
const result = __1.JsonLight.compress(data, { type });
|
|
36
|
+
const expected = '{"_":["Spain","Europe","34"],"timezones":[{"_":["Madrid",1],"pos":[40.4165,-3.70256]},{"_":["Ceuta",1],"pos":[35.8883,-5.3162]},{"_":["Canary",0],"pos":[28.1248,-15.43]}]}';
|
|
37
|
+
expect(expected).toStrictEqual(JSON.stringify(result));
|
|
38
|
+
});
|
|
39
|
+
test('decompress', () => {
|
|
40
|
+
const type = __1.JsonLight.type(data);
|
|
41
|
+
const compressed = __1.JsonLight.compress(data, { type });
|
|
42
|
+
const result = __1.JsonLight.decompress(compressed, { type });
|
|
43
|
+
const expected = '{"name":"Spain","region":"Europe","phoneCode":"34","timezones":[{"name":"Madrid","offset":1,"pos":{"lat":40.4165,"log":-3.70256}},{"name":"Ceuta","offset":1,"pos":{"lat":35.8883,"log":-5.3162}},{"name":"Canary","offset":0,"pos":{"lat":28.1248,"log":-15.43}}]}';
|
|
44
|
+
expect(expected).toStrictEqual(JSON.stringify(result));
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
describe('mapping', () => {
|
|
48
|
+
test('compressed', () => {
|
|
49
|
+
const type = __1.JsonLight.type(data);
|
|
50
|
+
const result = __1.JsonLight.compress(data, { type, mapping: true });
|
|
51
|
+
const expected = '{"0":[{"1":[40.4165,-3.70256],"_":["Madrid",1]},{"1":[35.8883,-5.3162],"_":["Ceuta",1]},{"1":[28.1248,-15.43],"_":["Canary",0]}],"_":["Spain","Europe","34"],"__map":{"0":"timezones","1":"pos"}}';
|
|
52
|
+
expect(expected).toStrictEqual(JSON.stringify(result));
|
|
53
|
+
});
|
|
54
|
+
test('decompress', () => {
|
|
55
|
+
const type = __1.JsonLight.type(data);
|
|
56
|
+
const compressed = __1.JsonLight.compress(data, { type, mapping: true });
|
|
57
|
+
const result = __1.JsonLight.decompress(compressed, { type });
|
|
58
|
+
const expected = '{"name":"Spain","region":"Europe","phoneCode":"34","timezones":[{"name":"Madrid","offset":1,"pos":{"lat":40.4165,"log":-3.70256}},{"name":"Ceuta","offset":1,"pos":{"lat":35.8883,"log":-5.3162}},{"name":"Canary","offset":0,"pos":{"lat":28.1248,"log":-15.43}}]}';
|
|
59
|
+
expect(expected).toStrictEqual(JSON.stringify(result));
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=country.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"country.test.js","sourceRoot":"","sources":["../../../src/lib/__tests__/country.test.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order.test.d.ts","sourceRoot":"","sources":["../../../src/lib/__tests__/order.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
/* eslint-disable no-template-curly-in-string */
|
|
13
|
+
const __1 = require("..");
|
|
14
|
+
let data;
|
|
15
|
+
beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
data = {
|
|
17
|
+
id: 139,
|
|
18
|
+
customerId: 'FAMIA',
|
|
19
|
+
employeeId: 9,
|
|
20
|
+
orderDate: '1996-12-17T23:00:00.000Z',
|
|
21
|
+
requiredDate: '1996-12-31T23:00:00.000Z',
|
|
22
|
+
shippedDate: '1996-12-24T23:00:00.000Z',
|
|
23
|
+
shipViaId: 3,
|
|
24
|
+
freight: 13.99,
|
|
25
|
+
name: 'Familia Arquibaldo',
|
|
26
|
+
address: 'Rua Ors, 92',
|
|
27
|
+
city: 'Sao Paulo',
|
|
28
|
+
region: 'SP',
|
|
29
|
+
postalCode: '05442-030',
|
|
30
|
+
country: 'Brazil',
|
|
31
|
+
details: [
|
|
32
|
+
{
|
|
33
|
+
orderId: 139,
|
|
34
|
+
productId: 24,
|
|
35
|
+
unitPrice: 3.6,
|
|
36
|
+
quantity: 15,
|
|
37
|
+
discount: 0
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
orderId: 139,
|
|
41
|
+
productId: 34,
|
|
42
|
+
unitPrice: 11.2,
|
|
43
|
+
quantity: 10,
|
|
44
|
+
discount: 0
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
};
|
|
48
|
+
}));
|
|
49
|
+
describe('simple', () => {
|
|
50
|
+
test('resolve', () => {
|
|
51
|
+
const result = __1.JsonLight.type(data);
|
|
52
|
+
const expected = '{id:integer,customerId:string,employeeId:integer,orderDate:string,requiredDate:string,shippedDate:string,shipViaId:integer,freight:decimal,name:string,address:string,city:string,region:string,postalCode:string,country:string,details:[{orderId:integer,productId:integer,unitPrice:decimal,quantity:integer,discount:integer}]}';
|
|
53
|
+
expect(expected).toStrictEqual(result);
|
|
54
|
+
});
|
|
55
|
+
test('compressed', () => {
|
|
56
|
+
const type = __1.JsonLight.type(data);
|
|
57
|
+
const result = __1.JsonLight.compress(data, { type });
|
|
58
|
+
const expected = '{"_":[139,"FAMIA",9,"1996-12-17T23:00:00.000Z","1996-12-31T23:00:00.000Z","1996-12-24T23:00:00.000Z",3,13.99,"Familia Arquibaldo","Rua Ors, 92","Sao Paulo","SP","05442-030","Brazil"],"details":[[139,24,3.6,15,0],[139,34,11.2,10,0]]}';
|
|
59
|
+
expect(expected).toStrictEqual(JSON.stringify(result));
|
|
60
|
+
});
|
|
61
|
+
test('decompress', () => {
|
|
62
|
+
const type = __1.JsonLight.type(data);
|
|
63
|
+
const compressed = __1.JsonLight.compress(data, { type });
|
|
64
|
+
const result = __1.JsonLight.decompress(compressed, { type });
|
|
65
|
+
const expected = '{"id":139,"customerId":"FAMIA","employeeId":9,"orderDate":"1996-12-17T23:00:00.000Z","requiredDate":"1996-12-31T23:00:00.000Z","shippedDate":"1996-12-24T23:00:00.000Z","shipViaId":3,"freight":13.99,"name":"Familia Arquibaldo","address":"Rua Ors, 92","city":"Sao Paulo","region":"SP","postalCode":"05442-030","country":"Brazil","details":[{"orderId":139,"productId":24,"unitPrice":3.6,"quantity":15,"discount":0},{"orderId":139,"productId":34,"unitPrice":11.2,"quantity":10,"discount":0}]}';
|
|
66
|
+
expect(expected).toStrictEqual(JSON.stringify(result));
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
describe('mapping', () => {
|
|
70
|
+
test('compressed', () => {
|
|
71
|
+
const type = __1.JsonLight.type(data);
|
|
72
|
+
const result = __1.JsonLight.compress(data, { type, mapping: true });
|
|
73
|
+
const expected = '{"0":[[139,24,3.6,15,0],[139,34,11.2,10,0]],"_":[139,"FAMIA",9,"1996-12-17T23:00:00.000Z","1996-12-31T23:00:00.000Z","1996-12-24T23:00:00.000Z",3,13.99,"Familia Arquibaldo","Rua Ors, 92","Sao Paulo","SP","05442-030","Brazil"],"__map":{"0":"details"}}';
|
|
74
|
+
expect(expected).toStrictEqual(JSON.stringify(result));
|
|
75
|
+
});
|
|
76
|
+
test('decompress', () => {
|
|
77
|
+
const type = __1.JsonLight.type(data);
|
|
78
|
+
const compressed = __1.JsonLight.compress(data, { type, mapping: true });
|
|
79
|
+
const result = __1.JsonLight.decompress(compressed, { type });
|
|
80
|
+
const expected = '{"id":139,"customerId":"FAMIA","employeeId":9,"orderDate":"1996-12-17T23:00:00.000Z","requiredDate":"1996-12-31T23:00:00.000Z","shippedDate":"1996-12-24T23:00:00.000Z","shipViaId":3,"freight":13.99,"name":"Familia Arquibaldo","address":"Rua Ors, 92","city":"Sao Paulo","region":"SP","postalCode":"05442-030","country":"Brazil","details":[{"orderId":139,"productId":24,"unitPrice":3.6,"quantity":15,"discount":0},{"orderId":139,"productId":34,"unitPrice":11.2,"quantity":10,"discount":0}]}';
|
|
81
|
+
expect(expected).toStrictEqual(JSON.stringify(result));
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
//# sourceMappingURL=order.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order.test.js","sourceRoot":"","sources":["../../../src/lib/__tests__/order.test.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Compressor, CompressorOptions, Decompressor, DecompressorOptions, JsonLight, JsonLightService, TypeSolver } from '../domain';
|
|
2
|
+
export declare class JsonLightFacade implements JsonLight {
|
|
3
|
+
private readonly typeSolver;
|
|
4
|
+
private readonly service;
|
|
5
|
+
private readonly compressor;
|
|
6
|
+
private readonly decompressor;
|
|
7
|
+
constructor(typeSolver: TypeSolver, service: JsonLightService, compressor: Compressor, decompressor: Decompressor);
|
|
8
|
+
type(data: any): string;
|
|
9
|
+
compress(data: any, options?: CompressorOptions): any;
|
|
10
|
+
decompress(data: any, options?: DecompressorOptions): any;
|
|
11
|
+
json(value: any): any;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=facade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"facade.d.ts","sourceRoot":"","sources":["../../../src/lib/application/facade.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,YAAY,EAAE,mBAAmB,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAErI,qBAAa,eAAgB,YAAW,SAAS;IAEnC,OAAO,CAAC,QAAQ,CAAC,UAAU;IACvC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,YAAY;gBAHA,UAAU,EAAC,UAAU,EACjC,OAAO,EAAC,gBAAgB,EACxB,UAAU,EAAC,UAAU,EACrB,YAAY,EAAE,YAAY;IAErC,IAAI,CAAE,IAAI,EAAC,GAAG,GAAE,MAAM;IAItB,QAAQ,CAAE,IAAI,EAAC,GAAG,EAAE,OAAO,CAAC,EAAC,iBAAiB,GAAE,GAAG;IAInD,UAAU,CAAE,IAAI,EAAC,GAAG,EAAE,OAAO,CAAC,EAAC,mBAAmB,GAAE,GAAG;IAIvD,IAAI,CAAE,KAAK,EAAE,GAAG,GAAG,GAAG;CAG7B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JsonLightFacade = void 0;
|
|
4
|
+
class JsonLightFacade {
|
|
5
|
+
// eslint-disable-next-line no-useless-constructor
|
|
6
|
+
constructor(typeSolver, service, compressor, decompressor) {
|
|
7
|
+
this.typeSolver = typeSolver;
|
|
8
|
+
this.service = service;
|
|
9
|
+
this.compressor = compressor;
|
|
10
|
+
this.decompressor = decompressor;
|
|
11
|
+
}
|
|
12
|
+
type(data) {
|
|
13
|
+
return this.typeSolver.type(data);
|
|
14
|
+
}
|
|
15
|
+
compress(data, options) {
|
|
16
|
+
return this.compressor.compress(data, options);
|
|
17
|
+
}
|
|
18
|
+
decompress(data, options) {
|
|
19
|
+
return this.decompressor.decompress(data, options);
|
|
20
|
+
}
|
|
21
|
+
json(value) {
|
|
22
|
+
return this.service.json(value);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.JsonLightFacade = JsonLightFacade;
|
|
26
|
+
//# sourceMappingURL=facade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"facade.js","sourceRoot":"","sources":["../../../src/lib/application/facade.ts"],"names":[],"mappings":";;;AAGA,MAAa,eAAe;IAC3B,kDAAkD;IAClD,YAA8B,UAAqB,EACjC,OAAwB,EACxB,UAAqB,EACrB,YAA0B;QAHd,eAAU,GAAV,UAAU,CAAW;QACjC,YAAO,GAAP,OAAO,CAAiB;QACxB,eAAU,GAAV,UAAU,CAAW;QACrB,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;IAEzC,IAAI,CAAE,IAAQ;QACpB,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAClC,CAAC;IAEM,QAAQ,CAAE,IAAQ,EAAE,OAA0B;QACpD,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAC/C,CAAC;IAEM,UAAU,CAAE,IAAQ,EAAE,OAA4B;QACxD,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IACnD,CAAC;IAEM,IAAI,CAAE,KAAU;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAChC,CAAC;CACD;AAtBD,0CAsBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/application/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./services/jsonLightService"), exports);
|
|
18
|
+
__exportStar(require("./useCases/compress"), exports);
|
|
19
|
+
__exportStar(require("./useCases/decompress"), exports);
|
|
20
|
+
__exportStar(require("./useCases/getType"), exports);
|
|
21
|
+
__exportStar(require("./facade"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/application/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA2C;AAC3C,sDAAmC;AACnC,wDAAqC;AACrC,qDAAkC;AAClC,2CAAwB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLightService.d.ts","sourceRoot":"","sources":["../../../../src/lib/application/services/jsonLightService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE/C,qBAAa,mBAAoB,YAAW,gBAAgB;IACpD,IAAI,CAAE,KAAK,EAAE,GAAG,GAAG,GAAG;CAqB7B"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JsonLightServiceImp = void 0;
|
|
4
|
+
class JsonLightServiceImp {
|
|
5
|
+
json(value) {
|
|
6
|
+
if (value === null || value === undefined) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
if (typeof value === 'string') {
|
|
10
|
+
if (value.indexOf('{') > -1 || value.indexOf('[') > -1) {
|
|
11
|
+
try {
|
|
12
|
+
return JSON.parse(value);
|
|
13
|
+
}
|
|
14
|
+
catch (_a) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (typeof value === 'object') {
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.JsonLightServiceImp = JsonLightServiceImp;
|
|
31
|
+
//# sourceMappingURL=jsonLightService.js.map
|