@engine9/input-tools 2.0.7

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,6 @@
1
+ given_name,family_name,email,phone,mobile_phone,birthdate,street_1,street_2,city,region,postal_code,country,avatar
2
+ Cassandre,Skiles-Schultz,Estefania.Feeney97@hotmail.com,653-835-5999 x129,(749) 629-6330,-58155336616,8396 Marguerite Rapids Suite 864,,South Mandy,NE,68063,GT,https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/729.jpg
3
+ Gilda,Schaefer,Jayce_Wuckert@hotmail.com,908.628.1386 x38583,(291) 240-3296 x70290,680338157655,72016 Brekke Path Suite 507,,Abshireton,LA,70035,MT,https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/1145.jpg
4
+ Stanton,Hauck-Pagac,Loyal.Johns98@hotmail.com,602-202-1206 x4874,500.642.4173 x609,796778263071,3383 Haley Way Suite 879,,North Salvadorboro,WY,82790,MR,https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/615.jpg
5
+ Victor,Nicolas,Deborah56@hotmail.com,1-616-972-4307 x2957,936.247.5623 x57843,-765498042689,70433 Raynor Ways Suite 545,,Emmittboro,MO,65448,IM,https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/295.jpg
6
+ Vada,Douglas-Miller,Beatrice_Bernier86@gmail.com,620.824.7501 x450,736-826-0686 x9957,48215369719,94190 Stephon Route Suite 884,,Fort Daytonstad,MT,59490,LB,https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/292.jpg
@@ -0,0 +1,41 @@
1
+ {
2
+ _id: 3611485,
3
+ remote_message_id: '49887',
4
+ account_id: 'packet-sample',
5
+ date_created: '2023-08-23T21:46:34.504Z',
6
+ last_modified: '2023-08-30T20:36:16.630Z',
7
+ publish_date: '2023-07-11T20:49:40.713Z',
8
+ original_publish_date: null,
9
+ plugin: { plugin_id: 'switchboard_i67', submodule: 'Messages' },
10
+ label: 'Sample Message Label',
11
+ status: 'sent',
12
+ channel: 'sms',
13
+ edit_url: 'https://foo.com/edit?id=49887',
14
+ content: {
15
+ /* Standardized field names for commonly used messaging data */
16
+ subject: 'This team stepped up big time',
17
+ from_name: 'Testing Name',
18
+ from_email: 'test@test.com',
19
+ text: 'Hello {{given_name}} {{family_name}} https://foo.com/?person_id={{person_id}}',
20
+ html:'Hello {{given_name}} {{family_name}} <a href="https://foo.com/?person_id={{person_id}}">Click Me</a>',
21
+ },
22
+ remote_data: {
23
+ /* open fields for other arbitrary remote content */
24
+ slug: 'sample-slug',
25
+ list: {
26
+
27
+ },
28
+ remote_sample_statistics: {
29
+ total_messages: 0,
30
+ total_processed: 0,
31
+ total_delivered: 0,
32
+ total_form_responses: 0,
33
+ clicks: 0,
34
+ replies: 0,
35
+ opt_outs: 0,
36
+ total_donations: 0,
37
+ total_amount: '0.0000',
38
+ cost_estimate: '0.0000'
39
+ }
40
+ }
41
+ }
package/test/uuid.js ADDED
@@ -0,0 +1,20 @@
1
+ import nodetest from 'node:test';
2
+ import assert from 'node:assert';
3
+ import * as debug$0 from 'debug';
4
+ import { getUUIDv7, getUUIDTimestamp } from '../index.js';
5
+ const { it } = nodetest;
6
+ const debug = debug$0('message');
7
+ it('Should correctly calculate UUIDS given various inputs', async () => {
8
+ const now = new Date();
9
+ const uuid = getUUIDv7();
10
+ const ts = getUUIDTimestamp(uuid);
11
+ debug(uuid, ts, now);
12
+ const diff = now.getTime() - ts.getTime();
13
+ assert(diff < 1000 && diff >= 0, 'More than a second between newly created');
14
+ const uuid2 = getUUIDv7(now);
15
+ const ts2 = getUUIDTimestamp(uuid2);
16
+ const diff2 = now.getTime() - ts2.getTime();
17
+ assert(diff2 === 0, 'Timestamps should match');
18
+ const uuid3 = getUUIDv7(now);
19
+ assert(uuid2 !== uuid3, 'UUIDs should be unique match');
20
+ });
@@ -0,0 +1,139 @@
1
+ const SOURCE_CODE_OVERRIDE = 0;
2
+ const CRM_ORIGIN = 1;
3
+ const ACQUISITION = 2;
4
+ // Generic signup
5
+ const SIGNUP = 3;
6
+ // Known first time signup
7
+ const SIGNUP_INITIAL = 4;
8
+ // Known subsequent signup
9
+ const SIGNUP_SUBSEQUENT = 5;
10
+ const UNSUBSCRIBE = 6;
11
+ // Generic monetary transaction
12
+ const TRANSACTION = 10;
13
+ // known one-time transaction
14
+ const TRANSACTION_ONE_TIME = 11;
15
+ // known initial recurring transaction
16
+ const TRANSACTION_INITIAL = 12;
17
+ // known initial transaction
18
+ const TRANSACTION_SUBSEQUENT = 13;
19
+ // known recurring, not sure if first
20
+ const TRANSACTION_RECURRING = 14;
21
+ // refunded transaction, first instance
22
+ const TRANSACTION_REFUND = 15;
23
+ const SEGMENT_PERSON_ADD = 16;
24
+ const SEGMENT_PERSON_REMOVE = 17;
25
+ // unknown generic conversion on a message
26
+ const MESSAGE_CONVERSION = 20;
27
+ // advocacy conversion on a message
28
+ const MESSAGE_CONVERSION_ADVOCACY = 21;
29
+ // unknown transaction conversion on a message
30
+ const MESSAGE_CONVERSION_TRANSACTION = 22;
31
+ const MESSAGE_DELIVERY_FAILURE_SHOULD_RETRY = 25;
32
+ const MESSAGE_DELIVERY_FAILURE_SHOULD_NOT_RETRY = 26;
33
+ const SMS_SEND = 30;
34
+ const SMS_DELIVERED = 31;
35
+ const SMS_CLICK = 33;
36
+ const SMS_UNSUBSCRIBE = 34;
37
+ const SMS_BOUNCE = 37;
38
+ const SMS_SPAM = 38;
39
+ const SMS_REPLY = 39;
40
+ const EMAIL_SEND = 40;
41
+ const EMAIL_DELIVERED = 41;
42
+ const EMAIL_OPEN = 42;
43
+ const EMAIL_CLICK = 43;
44
+ const EMAIL_UNSUBSCRIBE = 44;
45
+ const EMAIL_SOFT_BOUNCE = 45;
46
+ const EMAIL_HARD_BOUNCE = 46;
47
+ const EMAIL_BOUNCE = 47;
48
+ const EMAIL_SPAM = 48;
49
+ const EMAIL_REPLY = 49;
50
+ const PHONE_CALL_ATTEMPT = 50;
51
+ const PHONE_CALL_SUCCESS = 51;
52
+ const PHONE_CALL_FAIL = 52;
53
+ // Generic action
54
+ const FORM_SUBMIT = 60;
55
+ const FORM_PETITION = 61;
56
+ const FORM_PETITION_CONTACT_TARGET = 62;
57
+ const FORM_ADVOCACY = 66;
58
+ const FORM_SURVEY = 67;
59
+ const FILE_IMPORT = 70;
60
+ // For tracking exports or data pushes
61
+ // Generic export of data
62
+ const EXPORT = 80;
63
+ // Export specifically for pushing data to remote systems
64
+ const EXPORT_FOR_REMOTE = 81;
65
+ // Export specifically for sending out messages
66
+ const EXPORT_FOR_MESSAGING = 82;
67
+ //These are for actions we may not have exact
68
+ // details on, but are useful for modeling, etc
69
+ const INFERRED_ENTRY = 91;
70
+ const INFERRED_MESSAGE = 92;
71
+ const INFERRED_FORM = 93;
72
+ // DO. NOT. CHANGE. (once finalized)
73
+ // should probably have offsets between types
74
+ // ie email, transaction, etc.
75
+ // or maybe top level TIMELINE_ROW_TYPES and subtypes. /shrug emoji
76
+ const TIMELINE_ENTRY_TYPES = {
77
+ SOURCE_CODE_OVERRIDE,
78
+ CRM_ORIGIN,
79
+ ACQUISITION,
80
+ // signups
81
+ SIGNUP,
82
+ SIGNUP_INITIAL,
83
+ SIGNUP_SUBSEQUENT,
84
+ UNSUBSCRIBE,
85
+ TRANSACTION,
86
+ TRANSACTION_INITIAL,
87
+ TRANSACTION_SUBSEQUENT,
88
+ TRANSACTION_ONE_TIME,
89
+ TRANSACTION_RECURRING,
90
+ TRANSACTION_REFUND,
91
+ SEGMENT_PERSON_ADD,
92
+ SEGMENT_PERSON_REMOVE,
93
+ SMS_SEND,
94
+ SMS_DELIVERED,
95
+ SMS_CLICK,
96
+ SMS_UNSUBSCRIBE,
97
+ SMS_BOUNCE,
98
+ SMS_SPAM,
99
+ SMS_REPLY,
100
+ // email interactions
101
+ EMAIL_SEND,
102
+ EMAIL_DELIVERED,
103
+ EMAIL_OPEN,
104
+ EMAIL_CLICK,
105
+ EMAIL_UNSUBSCRIBE,
106
+ EMAIL_SOFT_BOUNCE,
107
+ EMAIL_HARD_BOUNCE,
108
+ EMAIL_BOUNCE,
109
+ EMAIL_REPLY,
110
+ EMAIL_SPAM,
111
+ PHONE_CALL_ATTEMPT,
112
+ PHONE_CALL_SUCCESS,
113
+ PHONE_CALL_FAIL,
114
+ // forms
115
+ FORM_SUBMIT,
116
+ FORM_PETITION,
117
+ FORM_PETITION_CONTACT_TARGET,
118
+ FORM_ADVOCACY,
119
+ FORM_SURVEY,
120
+ MESSAGE_CONVERSION,
121
+ MESSAGE_CONVERSION_ADVOCACY,
122
+ MESSAGE_CONVERSION_TRANSACTION,
123
+ MESSAGE_DELIVERY_FAILURE_SHOULD_RETRY,
124
+ MESSAGE_DELIVERY_FAILURE_SHOULD_NOT_RETRY,
125
+ FILE_IMPORT,
126
+ EXPORT,
127
+ EXPORT_FOR_REMOTE,
128
+ EXPORT_FOR_MESSAGING,
129
+ INFERRED_ENTRY,
130
+ INFERRED_MESSAGE,
131
+ INFERRED_FORM
132
+ };
133
+ Object.entries(TIMELINE_ENTRY_TYPES).forEach(([k, v]) => {
134
+ TIMELINE_ENTRY_TYPES[v] = k;
135
+ });
136
+ export { TIMELINE_ENTRY_TYPES };
137
+ export default {
138
+ TIMELINE_ENTRY_TYPES
139
+ };