@statefarmins/destringify-any-json 1.0.0 → 1.0.2
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/README.md +23 -6
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
## What is the destringify function?
|
|
7
7
|
The problem:
|
|
8
|
-
When AWS
|
|
9
|
-
and stringifies it. This is repeated each time a
|
|
10
|
-
|
|
8
|
+
When AWS microservices pass an event from one service to the next; the service
|
|
9
|
+
wraps the event in meta data and stringifies it. This is repeated each time a
|
|
10
|
+
resource is passed. This how events that have variable levels of stringification
|
|
11
|
+
get continually passed through an distributed AWS flow.
|
|
11
12
|
|
|
12
13
|
An example of a log with single and triple levels of stringification.
|
|
13
14
|
|
|
@@ -31,16 +32,23 @@
|
|
|
31
32
|
"SentTimestamp":"17382027","SequenceNumber":"18891737812463872","MessageGroupId":"m1","SenderId":"AIDAYRRVD2ENUBX",
|
|
32
33
|
"MessageDeduplicationId":"91768beacb3c9690d0362422141784aaa38c90b"....
|
|
33
34
|
|
|
34
|
-
Due to the distributed nature of AWS infrastructure, there are a lot of logs/events like this.
|
|
35
|
-
Logs can be single, double, triple, quadrupled, ect.. stringified
|
|
35
|
+
Due to the distributed nature of AWS microservice infrastructure, there are a lot of logs/events like this.
|
|
36
|
+
Logs can be single, double, triple, quadrupled, ect.. stringified at different levels within a json
|
|
36
37
|
structure.
|
|
38
|
+
|
|
39
|
+
The challenges:
|
|
40
|
+
1. During testing, whether automated or manual, the data must always be correctly strigified.
|
|
41
|
+
2. If a service is called by multiple resources, then input can have variable levels of
|
|
42
|
+
stringification.
|
|
43
|
+
3. It can make the structures(from logs or elsewhere) difficult to read/edit.
|
|
37
44
|
|
|
38
45
|
The solution:
|
|
39
46
|
This function will always return a json object with no stringification. It will fully parse any json object
|
|
40
47
|
regardless of the level of stringification at any level within a json object.
|
|
41
48
|
|
|
42
49
|
Use cases:
|
|
43
|
-
1.
|
|
50
|
+
1. Include this code in a script that can take a “wall of text" as input and convert it into
|
|
51
|
+
something that is readable and editable.
|
|
44
52
|
|
|
45
53
|
2. Called at the beginning of a lambda so that stringification is completely ignored.
|
|
46
54
|
This is especially useful when creating custom input for testing purposes. The test input does not need
|
|
@@ -50,6 +58,15 @@
|
|
|
50
58
|
3. An applications that has multiple source of input that contain variable levels of strigification.
|
|
51
59
|
Especially if the app can be subscribed to and the level of stringification that is received in
|
|
52
60
|
future events is unknown.
|
|
61
|
+
|
|
62
|
+
```javascript
|
|
63
|
+
// Example:
|
|
64
|
+
// Import the destringify function
|
|
65
|
+
import { destringify } from '@statefarmins/destringify-any-json';
|
|
66
|
+
|
|
67
|
+
// Use it to parse any JSON structure with any level of stringification
|
|
68
|
+
const destringifiedJSON = destringify(jsonStructure);
|
|
69
|
+
```
|
|
53
70
|
|
|
54
71
|
## Contacts
|
|
55
72
|
- Eric Schaumburg(Blaane15)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statefarmins/destringify-any-json",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.02",
|
|
4
4
|
"description": "A one size fits all solution to destringification. Handles any level of stringification in JSON objects.",
|
|
5
5
|
"main": "src/destringify.js",
|
|
6
6
|
"type": "module",
|
|
@@ -22,7 +22,12 @@
|
|
|
22
22
|
"destringify",
|
|
23
23
|
"stringify",
|
|
24
24
|
"object",
|
|
25
|
-
"parser"
|
|
25
|
+
"parser",
|
|
26
|
+
"aws",
|
|
27
|
+
"destributed-system",
|
|
28
|
+
"lambda",
|
|
29
|
+
"serverless",
|
|
30
|
+
"microservice"
|
|
26
31
|
],
|
|
27
32
|
"author": "jkaq",
|
|
28
33
|
"license": "SEE LICENCE IN LICENSE",
|