@pipedream/samsara 0.0.1 → 0.2.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.
@@ -0,0 +1,27 @@
1
+ import common from "../common/base.mjs";
2
+ import sampleEmit from "./test-event.mjs";
3
+
4
+ export default {
5
+ ...common,
6
+ key: "samsara-new-document-submitted-instant",
7
+ name: "New Document Submitted (Instant)",
8
+ description: "Emit new event when a document is submitted.",
9
+ version: "0.0.1",
10
+ type: "source",
11
+ dedupe: "unique",
12
+ props: {
13
+ ...common.props,
14
+ },
15
+ methods: {
16
+ ...common.methods,
17
+ getEventTypes() {
18
+ return [
19
+ "DocumentSubmitted",
20
+ ];
21
+ },
22
+ getSummary({ data }) {
23
+ return `New document with Id: ${data.document.id} successfully submitted!`;
24
+ },
25
+ },
26
+ sampleEmit,
27
+ };
@@ -0,0 +1,224 @@
1
+ export default {
2
+ "eventId": "017db07f-6e95-470e-8cc0-a371f9deed2b",
3
+ "eventTime": "1970-01-20T06:39:05.683Z",
4
+ "eventType": "DocumentSubmitted",
5
+ "orgId": 20936,
6
+ "webhookId": "1411751028848270",
7
+ "data": {
8
+ "document": {
9
+ "conditionalFieldSections": [
10
+ {
11
+ "conditionalFieldFirstIndex": 5083143870897228000,
12
+ "conditionalFieldLastIndex": 2770896918544835600,
13
+ "triggeringFieldIndex": 8389989517472915000,
14
+ "triggeringFieldValue": "Optiona 1"
15
+ },
16
+ {
17
+ "conditionalFieldFirstIndex": 5083143870897228000,
18
+ "conditionalFieldLastIndex": 2770896918544835600,
19
+ "triggeringFieldIndex": 8389989517472915000,
20
+ "triggeringFieldValue": "Optiona 1"
21
+ },
22
+ {
23
+ "conditionalFieldFirstIndex": 5083143870897228000,
24
+ "conditionalFieldLastIndex": 2770896918544835600,
25
+ "triggeringFieldIndex": 8389989517472915000,
26
+ "triggeringFieldValue": "Optiona 1"
27
+ }
28
+ ],
29
+ "createdAtTime": "1976-03-06T08:22:53Z",
30
+ "documentType": {
31
+ "id": "9814a1fa-f0c6-408b-bf85-51dc3bc71ac7",
32
+ "name": "Fleet Truck List"
33
+ },
34
+ "fields": [
35
+ {
36
+ "label": "Load weight",
37
+ "type": "photo",
38
+ "value": {
39
+ "barcodeValue": [
40
+ {
41
+ "barcodeType": "org.gs1.EAN-13",
42
+ "barcodeValue": "0853883003114"
43
+ },
44
+ {
45
+ "barcodeType": "org.gs1.EAN-13",
46
+ "barcodeValue": "0853883003114"
47
+ },
48
+ {
49
+ "barcodeType": "org.gs1.EAN-13",
50
+ "barcodeValue": "0853883003114"
51
+ },
52
+ {
53
+ "barcodeType": "org.gs1.EAN-13",
54
+ "barcodeValue": "0853883003114"
55
+ }
56
+ ],
57
+ "dateTimeValue": {
58
+ "dateTime": "1984-10-23T07:14:29Z"
59
+ },
60
+ "multipleChoiceValue": [
61
+ {
62
+ "selected": false,
63
+ "value": "Yes"
64
+ },
65
+ {
66
+ "selected": false,
67
+ "value": "Yes"
68
+ },
69
+ {
70
+ "selected": false,
71
+ "value": "Yes"
72
+ }
73
+ ],
74
+ "numberValue": 123.456,
75
+ "photoValue": [
76
+ {
77
+ "id": "f5271458-21f9-4a9f-a290-780c6d8840ff",
78
+ "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456"
79
+ },
80
+ {
81
+ "id": "f5271458-21f9-4a9f-a290-780c6d8840ff",
82
+ "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456"
83
+ }
84
+ ],
85
+ "scannedDocumentValue": [
86
+ {
87
+ "id": "f5271458-21f9-4a9f-a290-780c6d8840ff",
88
+ "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456"
89
+ },
90
+ {
91
+ "id": "f5271458-21f9-4a9f-a290-780c6d8840ff",
92
+ "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456"
93
+ },
94
+ {
95
+ "id": "f5271458-21f9-4a9f-a290-780c6d8840ff",
96
+ "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456"
97
+ }
98
+ ],
99
+ "signatureValue": {
100
+ "id": "9814a1fa-f0c6-408b-bf85-51dc3bc71ac7",
101
+ "name": "John Smith",
102
+ "signedAtTime": "1996-01-30T06:14:20Z",
103
+ "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456"
104
+ },
105
+ "stringValue": "Red Truck"
106
+ }
107
+ },
108
+ {
109
+ "label": "Load weight",
110
+ "type": "photo",
111
+ "value": {
112
+ "barcodeValue": [
113
+ {
114
+ "barcodeType": "org.gs1.EAN-13",
115
+ "barcodeValue": "0853883003114"
116
+ },
117
+ {
118
+ "barcodeType": "org.gs1.EAN-13",
119
+ "barcodeValue": "0853883003114"
120
+ },
121
+ {
122
+ "barcodeType": "org.gs1.EAN-13",
123
+ "barcodeValue": "0853883003114"
124
+ },
125
+ {
126
+ "barcodeType": "org.gs1.EAN-13",
127
+ "barcodeValue": "0853883003114"
128
+ }
129
+ ],
130
+ "dateTimeValue": {
131
+ "dateTime": "1984-10-23T07:14:29Z"
132
+ },
133
+ "multipleChoiceValue": [
134
+ {
135
+ "selected": false,
136
+ "value": "Yes"
137
+ },
138
+ {
139
+ "selected": false,
140
+ "value": "Yes"
141
+ },
142
+ {
143
+ "selected": false,
144
+ "value": "Yes"
145
+ }
146
+ ],
147
+ "numberValue": 123.456,
148
+ "photoValue": [
149
+ {
150
+ "id": "f5271458-21f9-4a9f-a290-780c6d8840ff",
151
+ "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456"
152
+ },
153
+ {
154
+ "id": "f5271458-21f9-4a9f-a290-780c6d8840ff",
155
+ "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456"
156
+ }
157
+ ],
158
+ "scannedDocumentValue": [
159
+ {
160
+ "id": "f5271458-21f9-4a9f-a290-780c6d8840ff",
161
+ "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456"
162
+ },
163
+ {
164
+ "id": "f5271458-21f9-4a9f-a290-780c6d8840ff",
165
+ "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456"
166
+ },
167
+ {
168
+ "id": "f5271458-21f9-4a9f-a290-780c6d8840ff",
169
+ "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456"
170
+ }
171
+ ],
172
+ "signatureValue": {
173
+ "id": "9814a1fa-f0c6-408b-bf85-51dc3bc71ac7",
174
+ "name": "John Smith",
175
+ "signedAtTime": "1996-01-30T06:14:20Z",
176
+ "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456"
177
+ },
178
+ "stringValue": "Red Truck"
179
+ }
180
+ }
181
+ ],
182
+ "id": "9814a1fa-f0c6-408b-bf85-51dc3bc71ac7",
183
+ "name": "Dropoff Slip 123",
184
+ "notes": "Missing a crate",
185
+ "route": {
186
+ "externalIds": {
187
+ "myRouteId": "abc"
188
+ },
189
+ "id": "131313",
190
+ "name": "Pineapple delivery"
191
+ },
192
+ "routeStop": {
193
+ "externalIds": {
194
+ "siteId": "54"
195
+ },
196
+ "id": "494123",
197
+ "name": "Company Warehouse #1"
198
+ },
199
+ "state": "submitted",
200
+ "updatedAtTime": "2009-01-10T02:28:18Z"
201
+ },
202
+ "driver": {
203
+ "externalIds": {
204
+ "payrollId": "ABFS18600"
205
+ },
206
+ "id": "45646",
207
+ "name": "Driver Bob"
208
+ },
209
+ "vehicle": {
210
+ "assetType": "vehicle",
211
+ "externalIds": {
212
+ "maintenanceId": "250020"
213
+ },
214
+ "gateway": {
215
+ "model": "VG34",
216
+ "serial": "GFRV-43N-VGX"
217
+ },
218
+ "id": "494123",
219
+ "licensePlate": "6SAM123",
220
+ "name": "Fleet Truck #1",
221
+ "vin": "1GBJ6P1B2HV112765"
222
+ }
223
+ }
224
+ }
@@ -0,0 +1,35 @@
1
+ import common from "../common/base.mjs";
2
+ import sampleEmit from "./test-event.mjs";
3
+
4
+ export default {
5
+ ...common,
6
+ key: "samsara-new-route-job-completion-instant",
7
+ name: "New Route Job Completion (Instant)",
8
+ description: "Emit new event when a job is completed on a Samsara route.",
9
+ version: "0.0.1",
10
+ type: "source",
11
+ dedupe: "unique",
12
+ props: {
13
+ ...common.props,
14
+ },
15
+ methods: {
16
+ ...common.methods,
17
+ getEventTypes() {
18
+ return [
19
+ "RouteStopDeparture",
20
+ "RouteStopArrival",
21
+ ];
22
+ },
23
+ getSummary({ data }) {
24
+ return `Route ${data.route.name} successfully completed.`;
25
+ },
26
+ checkEvent({ data }) {
27
+ const filteredStops = data.route.stops.filter((stop) => {
28
+ return stop.state != "departed";
29
+ });
30
+
31
+ return !filteredStops.length;
32
+ },
33
+ },
34
+ sampleEmit,
35
+ };
@@ -0,0 +1,217 @@
1
+ export default {
2
+ "eventId": "017db07f-6e95-470e-8cc0-a371f9deed2b",
3
+ "eventTime": "1970-01-20T06:39:05.683Z",
4
+ "eventType": "RouteStopArrival",
5
+ "orgId": 20936,
6
+ "webhookId": "1411751028848270",
7
+ "data": {
8
+ "driver": {
9
+ "externalIds": {
10
+ "payrollId": "ABFS18600"
11
+ },
12
+ "id": "45646",
13
+ "name": "Driver Bob"
14
+ },
15
+ "operation": "stop arrived",
16
+ "route": {
17
+ "actualRouteEndTime": "2019-06-13T19:08:25Z",
18
+ "actualRouteStartTime": "2019-06-13T19:08:25Z",
19
+ "externalIds": {
20
+ "myRouteId": "abc"
21
+ },
22
+ "id": "342341",
23
+ "name": "Bid 123",
24
+ "notes": "These are my notes",
25
+ "scheduledRouteEndTime": "2019-06-13T19:08:25Z",
26
+ "scheduledRouteStartTime": "2019-06-13T19:08:25Z",
27
+ "settings": {
28
+ "routeCompletionCondition": "arriveLastStop",
29
+ "routeStartingCondition": "departFirstStop"
30
+ },
31
+ "stops": [
32
+ {
33
+ "actualArrivalTime": "2006-01-02T15:04:05+07:00",
34
+ "actualDepartureTime": "2006-01-02T15:04:05+07:00",
35
+ "address": {
36
+ "externalIds": {
37
+ "siteId": "54"
38
+ },
39
+ "id": "494123",
40
+ "name": "Company Office #1"
41
+ },
42
+ "documents": [
43
+ {
44
+ "id": "494123",
45
+ "name": "Fuel Receipt Wichita"
46
+ },
47
+ {
48
+ "id": "494123",
49
+ "name": "Fuel Receipt Wichita"
50
+ }
51
+ ],
52
+ "enRouteTime": "2006-01-02T15:04:05+07:00",
53
+ "eta": "2006-01-02T15:04:05+07:00",
54
+ "externalIds": {
55
+ "siteId": "54"
56
+ },
57
+ "id": "324231",
58
+ "liveSharingUrl": "https://cloud.samsara.com/fleet/viewer/job/fleet_viewer_token",
59
+ "locationLiveSharingLinks": [
60
+ {
61
+ "expiresAtTime": "2020-01-27T07:06:25Z",
62
+ "liveSharingUrl": "https://cloud.samsara.com/o/123456/fleet/viewer/address/gEAitEnnOwcv92cuPzcU",
63
+ "name": "Name"
64
+ },
65
+ {
66
+ "expiresAtTime": "2020-01-27T07:06:25Z",
67
+ "liveSharingUrl": "https://cloud.samsara.com/o/123456/fleet/viewer/address/gEAitEnnOwcv92cuPzcU",
68
+ "name": "Name"
69
+ }
70
+ ],
71
+ "name": "Stop #1",
72
+ "notes": "These are my notes",
73
+ "scheduledArrivalTime": "2019-06-13T19:08:25Z",
74
+ "scheduledDepartureTime": "2019-06-13T19:08:25Z",
75
+ "singleUseLocation": {
76
+ "address": "1234 Main St, San Jose, CA",
77
+ "latitude": 123.456,
78
+ "longitude": 37.459
79
+ },
80
+ "skippedTime": "2006-01-02T15:04:05+07:00",
81
+ "state": "scheduled"
82
+ },
83
+ {
84
+ "actualArrivalTime": "2006-01-02T15:04:05+07:00",
85
+ "actualDepartureTime": "2006-01-02T15:04:05+07:00",
86
+ "address": {
87
+ "externalIds": {
88
+ "siteId": "54"
89
+ },
90
+ "id": "494123",
91
+ "name": "Company Office #1"
92
+ },
93
+ "documents": [
94
+ {
95
+ "id": "494123",
96
+ "name": "Fuel Receipt Wichita"
97
+ },
98
+ {
99
+ "id": "494123",
100
+ "name": "Fuel Receipt Wichita"
101
+ }
102
+ ],
103
+ "enRouteTime": "2006-01-02T15:04:05+07:00",
104
+ "eta": "2006-01-02T15:04:05+07:00",
105
+ "externalIds": {
106
+ "siteId": "54"
107
+ },
108
+ "id": "324231",
109
+ "liveSharingUrl": "https://cloud.samsara.com/fleet/viewer/job/fleet_viewer_token",
110
+ "locationLiveSharingLinks": [
111
+ {
112
+ "expiresAtTime": "2020-01-27T07:06:25Z",
113
+ "liveSharingUrl": "https://cloud.samsara.com/o/123456/fleet/viewer/address/gEAitEnnOwcv92cuPzcU",
114
+ "name": "Name"
115
+ },
116
+ {
117
+ "expiresAtTime": "2020-01-27T07:06:25Z",
118
+ "liveSharingUrl": "https://cloud.samsara.com/o/123456/fleet/viewer/address/gEAitEnnOwcv92cuPzcU",
119
+ "name": "Name"
120
+ }
121
+ ],
122
+ "name": "Stop #1",
123
+ "notes": "These are my notes",
124
+ "scheduledArrivalTime": "2019-06-13T19:08:25Z",
125
+ "scheduledDepartureTime": "2019-06-13T19:08:25Z",
126
+ "singleUseLocation": {
127
+ "address": "1234 Main St, San Jose, CA",
128
+ "latitude": 123.456,
129
+ "longitude": 37.459
130
+ },
131
+ "skippedTime": "2006-01-02T15:04:05+07:00",
132
+ "state": "scheduled"
133
+ },
134
+ {
135
+ "actualArrivalTime": "2006-01-02T15:04:05+07:00",
136
+ "actualDepartureTime": "2006-01-02T15:04:05+07:00",
137
+ "address": {
138
+ "externalIds": {
139
+ "siteId": "54"
140
+ },
141
+ "id": "494123",
142
+ "name": "Company Office #1"
143
+ },
144
+ "documents": [
145
+ {
146
+ "id": "494123",
147
+ "name": "Fuel Receipt Wichita"
148
+ },
149
+ {
150
+ "id": "494123",
151
+ "name": "Fuel Receipt Wichita"
152
+ }
153
+ ],
154
+ "enRouteTime": "2006-01-02T15:04:05+07:00",
155
+ "eta": "2006-01-02T15:04:05+07:00",
156
+ "externalIds": {
157
+ "siteId": "54"
158
+ },
159
+ "id": "324231",
160
+ "liveSharingUrl": "https://cloud.samsara.com/fleet/viewer/job/fleet_viewer_token",
161
+ "locationLiveSharingLinks": [
162
+ {
163
+ "expiresAtTime": "2020-01-27T07:06:25Z",
164
+ "liveSharingUrl": "https://cloud.samsara.com/o/123456/fleet/viewer/address/gEAitEnnOwcv92cuPzcU",
165
+ "name": "Name"
166
+ },
167
+ {
168
+ "expiresAtTime": "2020-01-27T07:06:25Z",
169
+ "liveSharingUrl": "https://cloud.samsara.com/o/123456/fleet/viewer/address/gEAitEnnOwcv92cuPzcU",
170
+ "name": "Name"
171
+ }
172
+ ],
173
+ "name": "Stop #1",
174
+ "notes": "These are my notes",
175
+ "scheduledArrivalTime": "2019-06-13T19:08:25Z",
176
+ "scheduledDepartureTime": "2019-06-13T19:08:25Z",
177
+ "singleUseLocation": {
178
+ "address": "1234 Main St, San Jose, CA",
179
+ "latitude": 123.456,
180
+ "longitude": 37.459
181
+ },
182
+ "skippedTime": "2006-01-02T15:04:05+07:00",
183
+ "state": "scheduled"
184
+ }
185
+ ]
186
+ },
187
+ "routeStopDetails": {
188
+ "actualArrivalTime": "2006-01-02T15:04:05+07:00",
189
+ "actualDepartureTime": "2006-01-02T15:04:05+07:00",
190
+ "enRouteTime": "2006-01-02T15:04:05+07:00",
191
+ "eta": "2006-01-02T15:04:05+07:00",
192
+ "externalIds": {
193
+ "siteId": "54"
194
+ },
195
+ "id": "141414",
196
+ "liveSharingUrl": "https://cloud.samsara.com/fleet/viewer/job/fleet_viewer_token",
197
+ "skippedTime": "2006-01-02T15:04:05+07:00",
198
+ "state": "scheduled"
199
+ },
200
+ "time": "2020-01-27T07:06:25Z",
201
+ "type": "route tracking",
202
+ "vehicle": {
203
+ "assetType": "vehicle",
204
+ "externalIds": {
205
+ "maintenanceId": "250020"
206
+ },
207
+ "gateway": {
208
+ "model": "VG34",
209
+ "serial": "GFRV-43N-VGX"
210
+ },
211
+ "id": "494123",
212
+ "licensePlate": "6SAM123",
213
+ "name": "Fleet Truck #1",
214
+ "vin": "1GBJ6P1B2HV112765"
215
+ }
216
+ }
217
+ }
@@ -0,0 +1,34 @@
1
+ import common from "../common/base.mjs";
2
+ import sampleEmit from "./test-event.mjs";
3
+
4
+ export default {
5
+ ...common,
6
+ key: "samsara-new-route-started-instant",
7
+ name: "New Route Started (Instant)",
8
+ description: "Emit new event when a new route is stated.",
9
+ version: "0.0.1",
10
+ type: "source",
11
+ dedupe: "unique",
12
+ props: {
13
+ ...common.props,
14
+ },
15
+ methods: {
16
+ ...common.methods,
17
+ getEventTypes() {
18
+ return [
19
+ "RouteStopDeparture",
20
+ ];
21
+ },
22
+ getSummary({ data }) {
23
+ return `New route with Id: ${data.route.id} successfully started!`;
24
+ },
25
+ checkEvent({ data }) {
26
+ const filteredStops = data.route.stops.filter((stop) => {
27
+ return stop.state === "departed";
28
+ });
29
+
30
+ return filteredStops.length === 1;
31
+ },
32
+ },
33
+ sampleEmit,
34
+ };