@statefarmins/destringify-any-json 1.0.2 → 1.0.4

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 (2) hide show
  1. package/README.md +22 -23
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -6,31 +6,31 @@
6
6
  ## What is the destringify function?
7
7
  The problem:
8
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.
9
+ wraps the event in metadata and stringifies it. This is repeated each time a
10
+ resource is passed. As a result, structures that have variable levels of stringification
11
+ can get continually passed through a distributed AWS flow.
12
12
 
13
13
  An example of a log with single and triple levels of stringification.
14
14
 
15
- "data":{"Records":[{"messageId":"a59c0eb1-9f86-4e37-8942","receiptHandle":"AQEB95j==","body":"{\n \"Type\" :
16
- \"Notification\",\n \"MessageId\" : \"fd8e5d6c-fa6a-5571-9747-3d793a1a926c\",\n \"SequenceNumber\" : \"1000000\",\n
17
- \"TopicArn\" : \"arn:aws:sns:us-east-1:6:sf-telematics-trace-test5-enrollment-topic.fifo\",\n \"Message\" : \"
18
- {\\\"event_code\\\":\\\"EE4220\\\",\\\"event_name\\\":\\\"Registration Reminder-40\\\",
19
- \\\"source\\\":\\\"EnrollmentLambda-RewriteNewFull\\\",\\\"telematics_enrollment_id\\\":\\\"91511\\\",
20
- \\\"physical_object_id\\\":\\\"15858412\\\",\\\"agre_index_id\\\":\\\"3530069169\\\",
21
- \\\"book_of_business_id\\\":\\\"ZS46WM8AL\\\",\\\"product_code\\\":\\\"20\\\",\\\"product_name\\\":\\\"DSSB\\\",
22
- \\\"enrollment_start_reason_code\\\":\\\"EN-210000\\\",\\\"enrollment_start_date\\\":\\\"2024-12-20\\\",
23
- \\\"enrollment_effective_date\\\":\\\"2025-02-07\\\",\\\"enrollment_setup_window_end_date\\\":\\\"2025-04-08\\\",
24
- \\\"enrollment_stop_date\\\":\\\"9999-12-31\\\",\\\"enrollment_complete_date\\\":\\\"2025-02-07\\\",
25
- \\\"enrollment_consent_date\\\":\\\"2025-01-30\\\",\\\"event_id\\\":\\\"6591cdaa-d0d9-4672-b6d5-2ae5393700d2\\\",
15
+ "data":{"Records":[{"messageId":"9999-99999-9999-9999","receiptHandle":"AQEB95j==","body":"{\n \"Type\" :
16
+ \"Notification\",\n \"MessageId\" : \"fd8e5d6c-fa6a-ttttt-ttttt-tttt\",\n \"SequenceNumber\" : \"1000000\",\n
17
+ \"TopicArn\" : \"arn:aws:sns:us-east-1:6:trace-topic.fifo\",\n \"Message\" : \"
18
+ {\\\"event_code\\\":\\\"EE4220\\\",\\\"event_name\\\":\\\"Reminder-40\\\",
19
+ \\\"source\\\":\\\"EnrollmentLambda-Whatever\\\",\\\"enroll_id\\\":\\\"xxxxx\\\",
20
+ \\\"obj_id\\\":\\\"xxxxxx\\\",\\\"index\\\":\\\"xxxxxxxxxx\\\",
21
+ \\\"book_id\\\":\\\"xxxxxxx\\\",\\\"product_code\\\":\\\"xx\\\",\\\"product_name\\\":\\\"XXXX\\\",
22
+ \\\"reason_code\\\":\\\"XX-999999\\\",\\\"start\\\":\\\"1700-12-20\\\",
23
+ \\\"eff_date\\\":\\\"1700-01-99\\\",\\\"end_date\\\":\\\"1600-xx-xx\\\",
24
+ \\\"enrollment_stop_date\\\":\\\"9999-xx-xx\\\",\\\"complete_date\\\":\\\"2025-xx-xx\\\",
25
+ \\\"enrollment_consent_date\\\":\\\"2025-xx-xx\\\",\\\"id\\\":\\\"6591cdaa-4672-b6d5-2ae5393700d2\\\",
26
26
  \\\"timestamp\\\":1738260015994}\",\n \"Timestamp\" : \"2025-01-30T18:00:16.004Z\",\n \"UnsubscribeURL\" :
27
27
  \"https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&
28
- SubscriptionArn=arn:aws:sns:us-east-1::sf-telematics-trace-test5-enrollment-topic.fifo:c62aa\",\n
28
+ SubscriptionArn=arn:aws:sns:us-east-1::trace-test5-enrollment.fifo:c62aa\",\n
29
29
  \"MessageAttributes\" : {\n \"eventTypeCode\" : {\"Type\":\"String\",\"Value\":\"E20\"},\n \"groupId\" :
30
30
  {\"Type\":\"String\",\"Value\":\"Registration Reminder-40\"}\n }\n}","attributes":{"ApproximateReceiveCount":"3",
31
- "AWSTraceHeader":"Root=1-679bbe24-1a9afbcc0a83d3fb;Parent=f8e463248a4c5;Sampled=1;Lineage=2:573fd71f:0",
32
- "SentTimestamp":"17382027","SequenceNumber":"18891737812463872","MessageGroupId":"m1","SenderId":"AIDAYRRVD2ENUBX",
33
- "MessageDeduplicationId":"91768beacb3c9690d0362422141784aaa38c90b"....
31
+ "AWSTraceHeader":"Root=1-679bbe24-xx;Parent=xx;Sampled=1;Lineage=2:xx:0",
32
+ "SentTimestamp":"1738","SequenceNumber":"xxxxx","MessageGroupId":"m1","SenderId":"eeeeeee",
33
+ "MessageDeduplicationId":"xxxxxxx"....
34
34
 
35
35
  Due to the distributed nature of AWS microservice infrastructure, there are a lot of logs/events like this.
36
36
  Logs can be single, double, triple, quadrupled, ect.. stringified at different levels within a json
@@ -50,14 +50,13 @@
50
50
  1. Include this code in a script that can take a “wall of text" as input and convert it into
51
51
  something that is readable and editable.
52
52
 
53
- 2. Called at the beginning of a lambda so that stringification is completely ignored.
53
+ 2. Called at the beginning of a lambda so that stringification is ignored.
54
54
  This is especially useful when creating custom input for testing purposes. The test input does not need
55
55
  to be stringified or destringified before being sent into the app. This applies to unit/integration/manual
56
56
  testing.
57
57
 
58
- 3. An applications that has multiple source of input that contain variable levels of strigification.
59
- Especially if the app can be subscribed to and the level of stringification that is received in
60
- future events is unknown.
58
+ 3. An application that has multiple sources of input that contain variable levels of strigification.
59
+ Especially if the service can be subscribed to and the level of stringification that will be received is unknown.
61
60
 
62
61
  ```javascript
63
62
  // Example:
@@ -70,4 +69,4 @@ const destringifiedJSON = destringify(jsonStructure);
70
69
 
71
70
  ## Contacts
72
71
  - Eric Schaumburg(Blaane15)
73
- - Matthew Walden(mwalden2004)
72
+ - Matthew Walden(mwalden2004)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statefarmins/destringify-any-json",
3
- "version": "1.0.02",
3
+ "version": "1.0.4",
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",